Bug #576 Cambiar los bindings del textfield

This commit is contained in:
gerard 2018-08-02 15:31:01 +02:00
parent 781fc1b70b
commit dd22309e7c
1 changed files with 7 additions and 24 deletions

View File

@ -22,34 +22,18 @@ export default class Textfield extends Input {
this.rightIcons = tClone[0];
}, null, 'rightIcons');
}
this.input.addEventListener('keyup', e => {
if (e.key == "Escape") {
this._cancel();
this.input.blur();
}
});
this.input.addEventListener('focus', () => this.saveOldValue());
this.input.addEventListener('keyup', e => {
if (e.key == "Enter") {
this._accept();
this.input.addEventListener('change', e => {
if (this.onChange) {
this.onChange();
}
});
}
_accept() {
if (this.accept) {
this.input.blur();
this.accept();
}
}
_cancel() {
this.input.blur();
this.input.value = this.oldValue;
this.value = this.input.value;
this.$.$apply();
if (this.cancel) {
this.cancel();
}
}
saveOldValue() {
this.oldValue = this.input.value;
}
@ -111,8 +95,7 @@ ngModule.component('vnTextfield', {
rule: '@?',
type: '@?',
vnTabIndex: '@?',
accept: '&',
cancel: '&',
unclearable: '<?'
unclearable: '<?',
onChange: '&'
}
});