Errores solucionados

This commit is contained in:
Juan Ferrer Toribio 2017-05-25 12:52:38 +02:00
parent 345f2e55a5
commit 1482b842bd
16 changed files with 76 additions and 56 deletions

View File

@ -29,16 +29,14 @@
value-field="id"
select-fields="surname"
label="Comercial">
<item-template>
<tpl-item>
{{::i.name}} {{::i.surname}}
</item-template>
</tpl-item>
</vn-autocomplete>
<vn-autocomplete vn-one
initial-value="$ctrl.client.contactChannel"
field="$ctrl.client.contactChannelFk"
url="/client/api/ContactChannels"
show-field="name"
value-field="id"
url="/client/api/ContactChannels/scope"
label="Canal">
</vn-autocomplete>
</vn-horizontal>

View File

@ -23,7 +23,7 @@
vn-id="change-pass"
on-open="$ctrl.onPassOpen()"
on-response="$ctrl.onPassChange(response)">
<dbody>
<tpl-body>
<vn-textfield
type="password"
label="New password"
@ -34,9 +34,9 @@
label="Repeat password"
model="$ctrl.repeatPassword">
</vn-textfield>
</dbody>
<buttons>
</tpl-body>
<tpl-buttons>
<button response="CANCEL" translate>Cancel</button>
<button response="ACCEPT" translate>Change password</button>
</buttons>
</tpl-body>
</vn-dialog>

View File

@ -167,7 +167,7 @@ export default class Autocomplete extends Component {
this.destroyScopes();
this.scopes = [];
let hasTemplate = this.$transclude.isSlotFilled('itemTemplate');
let hasTemplate = this.$transclude.isSlotFilled('tplItem');
for (let i = 0; i < data.length; i++) {
let li = this.document.createElement('li');
@ -178,7 +178,7 @@ export default class Autocomplete extends Component {
scope[this.itemAs] = data[i];
li.appendChild(clone[0]);
this.scopes[i] = scope;
}, null, 'itemTemplate');
}, null, 'tplItem');
} else {
let text = this.document.createTextNode(data[i][this.showField]);
li.appendChild(text);
@ -412,7 +412,7 @@ module.component('vnAutocomplete', {
label: '@'
},
transclude: {
itemTemplate: '?itemTemplate'
tplItem: '?tplItem'
},
controller: Autocomplete
});

View File

@ -1,25 +1,23 @@
<div ng-mousedown="$ctrl.onDialogMouseDown($event)">
<div vn-one style="float:right;margin: -2em -1.4em 1em 0;">
<button>
<vn-icon vn-one icon="clear" ng-click="$ctrl.hide()" style="color:black"></vn-icon>
</button>
</div>
<form vn-one>
<button ng-click="$ctrl.hide()" class="close" translate-attr="{title: 'Close'}">
<vn-icon vn-one icon="clear" style="color:black"></vn-icon>
</button>
<form>
<div>
<dbody>
<tpl-body>
<h6 class="dialog-title" translate>
{{$ctrl.question}}
</h6>
<h6 translate>
{{$ctrl.message}}
</h6>
</dbody>
</tpl-body>
</div>
<div class="button-bar" ng-click="$ctrl.onButtonClick($event)">
<buttons>
<tpl-buttons>
<button response="CANCEL" translate>Cancel</button>
<button response="ACCEPT" translate>Accept</button>
</buttons>
</tpl-buttons>
</div>
</form>
</div>

View File

@ -2,11 +2,7 @@ import {module} from '../module';
import Dialog from '../dialog/index';
import './style.css';
export default class Confirm extends Dialog {
constructor($element) {
super($element);
}
}
export default class Confirm extends Dialog {}
Dialog.$inject = ['$element'];
module.component('vnConfirm', {

View File

@ -1,5 +1,5 @@
vn-dialog .dialog-title {
vn-confirm .dialog-title {
color:#424242;
font-family: raleway-bold;
}

View File

@ -1,10 +1,13 @@
<div ng-mousedown="$ctrl.onDialogMouseDown($event)">
<form>
<div ng-transclude="dbody"></div>
<div
ng-transclude="buttons"
class="button-bar"
ng-click="$ctrl.onButtonClick($event)">
</div>
</form>
<button ng-click="$ctrl.hide()" class="close" translate-attr="{title: 'Close'}">
<vn-icon vn-one icon="clear" style="color:black"></vn-icon>
</button>
<form>
<div ng-transclude="tplBody"></div>
<div
ng-transclude="tplButtons"
class="button-bar"
ng-click="$ctrl.onButtonClick($event)">
</div>
</form>
</div>

View File

@ -29,13 +29,13 @@ export default class Dialog extends Component {
let width = this.dialog.offsetWidth;
let height = this.dialog.offsetHeight;
if(width + screenMargin > innerWidth) {
if (width + screenMargin > innerWidth) {
width = innerWidth - dblMargin;
style.width = width +'px';
style.width = width + 'px';
}
if(height + screenMargin > innerHeight) {
if (height + screenMargin > innerHeight) {
height = innerHeight - dblMargin;
style.height = height +'px';
style.height = height + 'px';
}
this.keypressHandler =
@ -44,7 +44,7 @@ export default class Dialog extends Component {
this.keypressHandler);
this.element.style.display = 'block';
if(this.onOpen)
if (this.onOpen)
this.onOpen();
}
/**
@ -59,7 +59,7 @@ export default class Dialog extends Component {
*/
fireResponse(response) {
let cancel = false;
if(this.onResponse)
if (this.onResponse)
cancel = this.onResponse({response: response});
return cancel;
}
@ -71,17 +71,17 @@ export default class Dialog extends Component {
}
onButtonClick(event) {
let buttonBar = this.element.querySelector('.button-bar');
let buttons = buttonBar.querySelector('buttons');
let buttons = buttonBar.querySelector('tpl-buttons');
let node = event.target;
while(node.parentNode != buttons) {
if(node == buttonBar) return;
while (node.parentNode != buttons) {
if (node == buttonBar) return;
node = node.parentNode;
}
let response = node.getAttribute('response');
let cancel = this.fireResponse(response);
if(cancel !== false) this.realHide();
if (cancel !== false) this.realHide();
}
onDialogMouseDown(event) {
this.lastEvent = event;
@ -91,7 +91,7 @@ export default class Dialog extends Component {
this.hide();
}
onKeypress(event) {
if(event.keyCode == 27) // Esc
if (event.keyCode == 27) // Esc
this.hide();
}
}
@ -100,8 +100,8 @@ Dialog.$inject = ['$element'];
module.component('vnDialog', {
template: require('./index.html'),
transclude: {
dbody: 'dbody',
buttons: 'buttons'
tplBody: 'tplBody',
tplButtons: 'tplButtons'
},
bindings: {
onOpen: '&',

View File

@ -8,6 +8,27 @@
width: 100%;
background-color: rgba(1,1,1,.4);
button.close {
position: absolute;
top: 0;
right: 0;
border-style: none;
background-color: transparent;
padding: .3em;
cursor: pointer;
vn-icon {
display: block;
i {
display: block;
}
}
&:hover {
background-color: rgba(0, 0, 0, .1);
}
}
& > div {
position: relative;
box-shadow: 0 0 .4em rgba(1,1,1,.4);

View File

@ -1 +1 @@
<i display-block class="material-icons">*[icon]*</i>
<i class="material-icons">*[icon]*</i>

View File

@ -3,5 +3,6 @@ vn-icon {
font-size: 18pt;
}
vn-icon > i {
display: block;
font-size: inherit !important;
}

View File

@ -1,4 +1,6 @@
{
"Accept": "Accept",
"Cancel": "Cancel"
"Cancel": "Cancel",
"Close": "Close",
"Clear": "Clear"
}

View File

@ -1,4 +1,6 @@
{
"Accept": "Aceptar",
"Cancel": "Cancelar"
"Cancel": "Cancelar",
"Close": "Cerrar",
"Clear": "Borrar"
}

View File

@ -45,6 +45,7 @@ export default class Textfield extends Component {
this.showClear(this.input.value);
}
showClear(show) {
show = document.activeElement === this.input;
let clearButton = this.element.querySelector('button');
clearButton.style.visibility = show ? 'visible' : 'hidden';
}

View File

@ -5,13 +5,12 @@
name="*[name]*"
ng-model="*[model]*"
vn-validation="*[rule]*"
ng-disabled="*[disable]*"
*[enabled]*/>
ng-disabled="*[disable]*"/>
<button
type="button"
class="mdl-chip__action"
tabindex="-1"
title="Clear text"
translate-attr="{title: 'Clear'}"
style="visibility: hidden">
<i class="material-icons">clear</i>
</button>

View File

@ -66,5 +66,4 @@ module.exports = function(Client) {
limit: p.size
};
}
};