Merge branch 'dev' of https://git.verdnatura.es/salix into dev

* 'dev' of https://git.verdnatura.es/salix:
  refactoring autocomplete: input readonly and autofucos on search input
  bug fixed in address edit with watcher
This commit is contained in:
Carlos 2017-09-21 14:47:04 +02:00
commit 4473b97c1f
7 changed files with 19 additions and 5 deletions

View File

@ -6,7 +6,6 @@
data="$ctrl.address" data="$ctrl.address"
form="form"> form="form">
</vn-watcher> </vn-watcher>
<mg-ajax path="/client/api/Addresses/{{edit.params.addressId}}" actions="$ctrl.address=edit.model" options="mgEdit"></mg-ajax>
<form name="form" ng-submit="watcher.submitBack()" pad-medium> <form name="form" ng-submit="watcher.submitBack()" pad-medium>
<vn-card> <vn-card>
<vn-vertical pad-large> <vn-vertical pad-large>

View File

@ -1,5 +1,5 @@
<vn-vertical ng-click="$ctrl.showDropDown = true"> <vn-vertical ng-click="$ctrl.showDropDown = true">
<vn-textfield vn-one label="{{$ctrl.label}}" model="$ctrl.displayValue"></vn-textfield> <vn-textfield vn-one label="{{$ctrl.label}}" model="$ctrl.displayValue" readonly="$ctrl.readonly"></vn-textfield>
<vn-drop-down vn-one <vn-drop-down vn-one
items="$ctrl.items" items="$ctrl.items"
show="$ctrl.showDropDown" show="$ctrl.showDropDown"

View File

@ -22,6 +22,7 @@ class Autocomplete extends Component {
this.items = this.data || []; this.items = this.data || [];
this.displayValueMultiCheck = []; this.displayValueMultiCheck = [];
this._multiField = []; this._multiField = [];
this.readonly = true;
} }
get showDropDown() { get showDropDown() {

View File

@ -12,7 +12,19 @@ export default class DropDown {
this.itemsFiltered = []; this.itemsFiltered = [];
this._activeOption = -1; this._activeOption = -1;
} }
get show() {
return this._show;
}
set show(value) {
let oldValue = this.show;
this._show = value;
if (value && oldValue !== value && this.filter) {
let inputFilterSearch = this.$element[0].querySelector('input');
this.$timeout(() => {
inputFilterSearch.focus();
});
}
}
get search() { get search() {
return this._search; return this._search;
} }

View File

@ -6,6 +6,7 @@
ng-model="$ctrl.value" ng-model="$ctrl.value"
vn-validation="{{$ctrl.rule}}" vn-validation="{{$ctrl.rule}}"
ng-disabled="$ctrl.disabled" ng-disabled="$ctrl.disabled"
ng-readonly="$ctrl.readonly"
/> />
<div class="mdl-chip__action"> <div class="mdl-chip__action">
<i class="material-icons pointer" ng-show="$ctrl.hasValue" ng-click="$ctrl.clear()">clear</i> <i class="material-icons pointer" ng-show="$ctrl.hasValue" ng-click="$ctrl.clear()">clear</i>

View File

@ -20,7 +20,6 @@ export default class TextfieldController extends Component {
this.focus = false; this.focus = false;
this.hasInfo = Boolean(this.$attrs.info); this.hasInfo = Boolean(this.$attrs.info);
this.info = this.$attrs.info || null; this.info = this.$attrs.info || null;
componentHandler.upgradeElement($element[0].firstChild); componentHandler.upgradeElement($element[0].firstChild);
} }
@ -56,6 +55,7 @@ module.component('vnTextfield', {
label: '@?', label: '@?',
name: '@?', name: '@?',
disabled: '<?', disabled: '<?',
readonly: '<?',
rule: '@?', rule: '@?',
type: '@?' type: '@?'
} }

View File

@ -153,7 +153,8 @@ export default class Watcher extends Component {
return copy; return copy;
} }
callback(transition) { callback(transition) {
if (!this.state && this.dataChanged()) { let dataChanged = this.dataChanged();
if (!this.state && dataChanged) {
this.state = transition.to().name; this.state = transition.to().name;
this.$scope.confirm.show(); this.$scope.confirm.show();
return false; return false;