From dd22309e7c685864a60602b02017771a2e2f4eb0 Mon Sep 17 00:00:00 2001 From: gerard Date: Thu, 2 Aug 2018 15:31:01 +0200 Subject: [PATCH] Bug #576 Cambiar los bindings del textfield --- .../src/components/textfield/textfield.js | 31 +++++-------------- 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/client/core/src/components/textfield/textfield.js b/client/core/src/components/textfield/textfield.js index 81385268a..bee5f1d08 100644 --- a/client/core/src/components/textfield/textfield.js +++ b/client/core/src/components/textfield/textfield.js @@ -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: '