From c5cfb3843504abf72e4773ac0003c418625f585a Mon Sep 17 00:00:00 2001
From: windy <1374721899@qq.com>
Date: Tue, 3 Sep 2019 11:50:48 +0800
Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84numbereditor?=
 =?UTF-8?q?=E5=AD=98=E5=80=BC=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 dist/2.0/fineui.ie.js                                 | 8 ++++++--
 dist/2.0/fineui.js                                    | 8 ++++++--
 dist/bundle.ie.js                                     | 8 ++++++--
 dist/bundle.js                                        | 8 ++++++--
 dist/fineui.ie.js                                     | 8 ++++++--
 dist/fineui.js                                        | 8 ++++++--
 dist/fineui_without_jquery_polyfill.js                | 8 ++++++--
 dist/widget.js                                        | 8 ++++++--
 src/widget/datetimepane/__test__/datetimepane.test.js | 4 ++--
 src/widget/numbereditor/number.editor.js              | 8 ++++++--
 10 files changed, 56 insertions(+), 20 deletions(-)

diff --git a/dist/2.0/fineui.ie.js b/dist/2.0/fineui.ie.js
index ae47cdd93b..62aeb17b9e 100644
--- a/dist/2.0/fineui.ie.js
+++ b/dist/2.0/fineui.ie.js
@@ -77562,11 +77562,15 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
             errorText: o.errorText
         });
         this.editor.on(BI.TextEditor.EVENT_CHANGE, function () {
-            o.value = BI.parseFloat(this.getValue());
             self.fireEvent(BI.NumberEditor.EVENT_CHANGE);
         });
-        this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
+        this.editor.on(BI.TextEditor.EVENT_ERROR, function () {
+            o.value = BI.parseFloat(this.getLastValidValue());
+        });
+        this.editor.on(BI.TextEditor.EVENT_VALID, function () {
             o.value = BI.parseFloat(this.getValue());
+        });
+        this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
             self.fireEvent(BI.NumberEditor.EVENT_CONFIRM);
         });
         this.topBtn = BI.createWidget({
diff --git a/dist/2.0/fineui.js b/dist/2.0/fineui.js
index 4a36be6440..1eb9d31797 100644
--- a/dist/2.0/fineui.js
+++ b/dist/2.0/fineui.js
@@ -77966,11 +77966,15 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
             errorText: o.errorText
         });
         this.editor.on(BI.TextEditor.EVENT_CHANGE, function () {
-            o.value = BI.parseFloat(this.getValue());
             self.fireEvent(BI.NumberEditor.EVENT_CHANGE);
         });
-        this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
+        this.editor.on(BI.TextEditor.EVENT_ERROR, function () {
+            o.value = BI.parseFloat(this.getLastValidValue());
+        });
+        this.editor.on(BI.TextEditor.EVENT_VALID, function () {
             o.value = BI.parseFloat(this.getValue());
+        });
+        this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
             self.fireEvent(BI.NumberEditor.EVENT_CONFIRM);
         });
         this.topBtn = BI.createWidget({
diff --git a/dist/bundle.ie.js b/dist/bundle.ie.js
index ae47cdd93b..62aeb17b9e 100644
--- a/dist/bundle.ie.js
+++ b/dist/bundle.ie.js
@@ -77562,11 +77562,15 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
             errorText: o.errorText
         });
         this.editor.on(BI.TextEditor.EVENT_CHANGE, function () {
-            o.value = BI.parseFloat(this.getValue());
             self.fireEvent(BI.NumberEditor.EVENT_CHANGE);
         });
-        this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
+        this.editor.on(BI.TextEditor.EVENT_ERROR, function () {
+            o.value = BI.parseFloat(this.getLastValidValue());
+        });
+        this.editor.on(BI.TextEditor.EVENT_VALID, function () {
             o.value = BI.parseFloat(this.getValue());
+        });
+        this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
             self.fireEvent(BI.NumberEditor.EVENT_CONFIRM);
         });
         this.topBtn = BI.createWidget({
diff --git a/dist/bundle.js b/dist/bundle.js
index 4a36be6440..1eb9d31797 100644
--- a/dist/bundle.js
+++ b/dist/bundle.js
@@ -77966,11 +77966,15 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
             errorText: o.errorText
         });
         this.editor.on(BI.TextEditor.EVENT_CHANGE, function () {
-            o.value = BI.parseFloat(this.getValue());
             self.fireEvent(BI.NumberEditor.EVENT_CHANGE);
         });
-        this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
+        this.editor.on(BI.TextEditor.EVENT_ERROR, function () {
+            o.value = BI.parseFloat(this.getLastValidValue());
+        });
+        this.editor.on(BI.TextEditor.EVENT_VALID, function () {
             o.value = BI.parseFloat(this.getValue());
+        });
+        this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
             self.fireEvent(BI.NumberEditor.EVENT_CONFIRM);
         });
         this.topBtn = BI.createWidget({
diff --git a/dist/fineui.ie.js b/dist/fineui.ie.js
index c8b78856d3..89955f22a1 100644
--- a/dist/fineui.ie.js
+++ b/dist/fineui.ie.js
@@ -77807,11 +77807,15 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
             errorText: o.errorText
         });
         this.editor.on(BI.TextEditor.EVENT_CHANGE, function () {
-            o.value = BI.parseFloat(this.getValue());
             self.fireEvent(BI.NumberEditor.EVENT_CHANGE);
         });
-        this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
+        this.editor.on(BI.TextEditor.EVENT_ERROR, function () {
+            o.value = BI.parseFloat(this.getLastValidValue());
+        });
+        this.editor.on(BI.TextEditor.EVENT_VALID, function () {
             o.value = BI.parseFloat(this.getValue());
+        });
+        this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
             self.fireEvent(BI.NumberEditor.EVENT_CONFIRM);
         });
         this.topBtn = BI.createWidget({
diff --git a/dist/fineui.js b/dist/fineui.js
index dacf70fddd..770ed980d6 100644
--- a/dist/fineui.js
+++ b/dist/fineui.js
@@ -78211,11 +78211,15 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
             errorText: o.errorText
         });
         this.editor.on(BI.TextEditor.EVENT_CHANGE, function () {
-            o.value = BI.parseFloat(this.getValue());
             self.fireEvent(BI.NumberEditor.EVENT_CHANGE);
         });
-        this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
+        this.editor.on(BI.TextEditor.EVENT_ERROR, function () {
+            o.value = BI.parseFloat(this.getLastValidValue());
+        });
+        this.editor.on(BI.TextEditor.EVENT_VALID, function () {
             o.value = BI.parseFloat(this.getValue());
+        });
+        this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
             self.fireEvent(BI.NumberEditor.EVENT_CONFIRM);
         });
         this.topBtn = BI.createWidget({
diff --git a/dist/fineui_without_jquery_polyfill.js b/dist/fineui_without_jquery_polyfill.js
index f03a21d0a9..8e6be969d2 100644
--- a/dist/fineui_without_jquery_polyfill.js
+++ b/dist/fineui_without_jquery_polyfill.js
@@ -60510,11 +60510,15 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
             errorText: o.errorText
         });
         this.editor.on(BI.TextEditor.EVENT_CHANGE, function () {
-            o.value = BI.parseFloat(this.getValue());
             self.fireEvent(BI.NumberEditor.EVENT_CHANGE);
         });
-        this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
+        this.editor.on(BI.TextEditor.EVENT_ERROR, function () {
+            o.value = BI.parseFloat(this.getLastValidValue());
+        });
+        this.editor.on(BI.TextEditor.EVENT_VALID, function () {
             o.value = BI.parseFloat(this.getValue());
+        });
+        this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
             self.fireEvent(BI.NumberEditor.EVENT_CONFIRM);
         });
         this.topBtn = BI.createWidget({
diff --git a/dist/widget.js b/dist/widget.js
index 70e9d39800..637a78e70f 100644
--- a/dist/widget.js
+++ b/dist/widget.js
@@ -15621,11 +15621,15 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
             errorText: o.errorText
         });
         this.editor.on(BI.TextEditor.EVENT_CHANGE, function () {
-            o.value = BI.parseFloat(this.getValue());
             self.fireEvent(BI.NumberEditor.EVENT_CHANGE);
         });
-        this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
+        this.editor.on(BI.TextEditor.EVENT_ERROR, function () {
+            o.value = BI.parseFloat(this.getLastValidValue());
+        });
+        this.editor.on(BI.TextEditor.EVENT_VALID, function () {
             o.value = BI.parseFloat(this.getValue());
+        });
+        this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
             self.fireEvent(BI.NumberEditor.EVENT_CONFIRM);
         });
         this.topBtn = BI.createWidget({
diff --git a/src/widget/datetimepane/__test__/datetimepane.test.js b/src/widget/datetimepane/__test__/datetimepane.test.js
index 5faf7c84b1..69e0765782 100644
--- a/src/widget/datetimepane/__test__/datetimepane.test.js
+++ b/src/widget/datetimepane/__test__/datetimepane.test.js
@@ -102,14 +102,14 @@ describe("DateTimePane", function () {
             datePane.element.find(".bi-month-combo .bi-list-item-select").get(2).click();
             BI.nextTick(function () {
                 datePane.element.find(".bi-calendar:visible .bi-list-item-select :contains(27)").parent().click();
-                datePane.element.find(".bi-date-time-select .bi-number-editor .top-button").click();
+                datePane.element.find(".bi-date-time-select .bi-number-editor .top-button").get(0).click();
                 expect(datePane.getValue()).to.deep.equal({
                     type: 1,
                     value: {
                         year: 2019,
                         month: 2,
                         day: 27,
-                        hour: 0,
+                        hour: 1,
                         minute: 0,
                         second: 0
                     }
diff --git a/src/widget/numbereditor/number.editor.js b/src/widget/numbereditor/number.editor.js
index 9a2a176295..05292867d4 100644
--- a/src/widget/numbereditor/number.editor.js
+++ b/src/widget/numbereditor/number.editor.js
@@ -31,11 +31,15 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
             errorText: o.errorText
         });
         this.editor.on(BI.TextEditor.EVENT_CHANGE, function () {
-            o.value = BI.parseFloat(this.getValue());
             self.fireEvent(BI.NumberEditor.EVENT_CHANGE);
         });
-        this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
+        this.editor.on(BI.TextEditor.EVENT_ERROR, function () {
+            o.value = BI.parseFloat(this.getLastValidValue());
+        });
+        this.editor.on(BI.TextEditor.EVENT_VALID, function () {
             o.value = BI.parseFloat(this.getValue());
+        });
+        this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
             self.fireEvent(BI.NumberEditor.EVENT_CONFIRM);
         });
         this.topBtn = BI.createWidget({