Merge branch 'dev' of http://git.verdnatura.es/salix into dev
This commit is contained in:
commit
fdb1fa40e2
|
@ -2,6 +2,7 @@ import {module} from '../module';
|
|||
import Component from '../lib/component';
|
||||
import copyObject from '../lib/copy';
|
||||
import './style.scss';
|
||||
import { log } from 'util';
|
||||
|
||||
class Autocomplete extends Component {
|
||||
constructor($element, $scope, $http, $timeout, $filter) {
|
||||
|
@ -27,6 +28,8 @@ class Autocomplete extends Component {
|
|||
this._multiField = [];
|
||||
this.readonly = true;
|
||||
this.removeLoadMore = false;
|
||||
this.form = null;
|
||||
this.findForm = false;
|
||||
}
|
||||
|
||||
get showDropDown() {
|
||||
|
@ -87,6 +90,7 @@ class Autocomplete extends Component {
|
|||
if (this.multiple) {
|
||||
this.setMultiField(value[this.valueField]);
|
||||
}
|
||||
this.setDirtyForm();
|
||||
} else {
|
||||
this.setValue(value);
|
||||
}
|
||||
|
@ -284,6 +288,22 @@ class Autocomplete extends Component {
|
|||
}
|
||||
}
|
||||
}
|
||||
_parentForm() {
|
||||
this.findForm = true;
|
||||
let formScope = this.$scope;
|
||||
while (formScope && !formScope.form && formScope.$id > 1) {
|
||||
formScope = formScope.$parent;
|
||||
}
|
||||
this.form = formScope ? formScope.form || null : null;
|
||||
}
|
||||
setDirtyForm() {
|
||||
if (!this.form && !this.findForm) {
|
||||
this._parentForm();
|
||||
}
|
||||
if (this.form) {
|
||||
this.form.$setDirty();
|
||||
}
|
||||
}
|
||||
|
||||
$onInit() {
|
||||
this.findMore = this.url && this.maxRow;
|
||||
|
|
|
@ -12,7 +12,7 @@ export default class App {
|
|||
this.$rootScope = $rootScope;
|
||||
}
|
||||
show(message) {
|
||||
if (this.snackbar) this.snackbar.show({message: message});
|
||||
if (this.snackbar) this.snackbar.show({message: message, timeout: 400});
|
||||
}
|
||||
showMessage(message) {
|
||||
this.show(message);
|
||||
|
|
|
@ -181,7 +181,7 @@ export default class Watcher extends Component {
|
|||
}
|
||||
|
||||
dataChanged() {
|
||||
// if (this.form && !this.form.$dirty) return false; // TODO: autocomplete no hace dirty de form
|
||||
if (this.form && !this.form.$dirty) return false;
|
||||
let newData = this.copyInNewObject(this.data);
|
||||
return !isEqual(newData, this.orgData);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue