From 9202831d8cbad9981c36155cbd6958e944083b84 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Fri, 30 Aug 2019 15:42:54 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E9=80=89=E8=89=B2=E5=99=A8=E7=9A=84trigger?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E6=98=AF=E5=90=A6=E8=83=BD=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E4=B8=8D=E7=BB=9F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/case/colorchooser/colorchooser.trigger.long.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/case/colorchooser/colorchooser.trigger.long.js b/src/case/colorchooser/colorchooser.trigger.long.js index 04c88b88af..946fe67bf2 100644 --- a/src/case/colorchooser/colorchooser.trigger.long.js +++ b/src/case/colorchooser/colorchooser.trigger.long.js @@ -26,6 +26,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, { ref: function (_ref) { self.changeIcon = _ref; }, + disableSelected: true, iconCls: "auto-color-icon", width: 24, iconWidth: 16, From 1e6ece11a2a8b826da980dea6903481ed5a5da1c Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 2 Sep 2019 14:55:24 +0800 Subject: [PATCH 2/8] =?UTF-8?q?REPORT-21332=20fix:=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E4=B8=80=E4=B8=8B=E9=BB=98=E8=AE=A4=E4=BC=A0value=E5=B1=9E?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 1 + dist/2.0/fineui.ie.js | 7 +++++++ dist/2.0/fineui.js | 7 +++++++ dist/bundle.ie.js | 7 +++++++ dist/bundle.js | 7 +++++++ dist/case.js | 1 + dist/fineui.ie.js | 7 +++++++ dist/fineui.js | 7 +++++++ dist/fineui_without_jquery_polyfill.js | 6 ++++++ dist/widget.js | 6 ++++++ .../treevaluechooser/combo.listtreevaluechooser.js | 1 + .../treevaluechooser/combo.treevaluechooser.insert.js | 1 + src/component/treevaluechooser/combo.treevaluechooser.js | 1 + src/component/valuechooser/combo.valuechooser.insert.js | 1 + src/component/valuechooser/combo.valuechooser.js | 1 + src/component/valuechooser/pane.valuechooser.js | 1 + 16 files changed, 62 insertions(+) diff --git a/changelog.md b/changelog.md index 5bc8e600e4..0d84d3b1be 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # 更新日志 2.0(2019-08) +- 修复valueChooser系列不支持value属性的问题 - 更新了若干icon-font的样式 - 修复了单选树同步搜索状态下父节点前可能没有展开符号的问题 - 单选树可展示并选中不存在的值 diff --git a/dist/2.0/fineui.ie.js b/dist/2.0/fineui.ie.js index ef3d7742b9..b56d2a2ffc 100644 --- a/dist/2.0/fineui.ie.js +++ b/dist/2.0/fineui.ie.js @@ -54754,6 +54754,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, { ref: function (_ref) { self.changeIcon = _ref; }, + disableSelected: true, iconCls: "auto-color-icon", width: 24, iconWidth: 16, @@ -88537,6 +88538,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser, type: "bi.multi_tree_list_combo", element: this, text: o.text, + value: o.value, watermark: o.watermark, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), @@ -88624,6 +88626,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_insert_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -88712,6 +88715,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -88942,6 +88946,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_insert_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89036,6 +89041,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89124,6 +89130,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, { this.list = BI.createWidget({ type: "bi.multi_select_list", element: this, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this) }); diff --git a/dist/2.0/fineui.js b/dist/2.0/fineui.js index 7f1f7b5e37..3be2bd50ca 100644 --- a/dist/2.0/fineui.js +++ b/dist/2.0/fineui.js @@ -55158,6 +55158,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, { ref: function (_ref) { self.changeIcon = _ref; }, + disableSelected: true, iconCls: "auto-color-icon", width: 24, iconWidth: 16, @@ -88941,6 +88942,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser, type: "bi.multi_tree_list_combo", element: this, text: o.text, + value: o.value, watermark: o.watermark, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), @@ -89028,6 +89030,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_insert_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -89116,6 +89119,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -89346,6 +89350,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_insert_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89440,6 +89445,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89528,6 +89534,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, { this.list = BI.createWidget({ type: "bi.multi_select_list", element: this, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this) }); diff --git a/dist/bundle.ie.js b/dist/bundle.ie.js index ef3d7742b9..b56d2a2ffc 100644 --- a/dist/bundle.ie.js +++ b/dist/bundle.ie.js @@ -54754,6 +54754,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, { ref: function (_ref) { self.changeIcon = _ref; }, + disableSelected: true, iconCls: "auto-color-icon", width: 24, iconWidth: 16, @@ -88537,6 +88538,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser, type: "bi.multi_tree_list_combo", element: this, text: o.text, + value: o.value, watermark: o.watermark, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), @@ -88624,6 +88626,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_insert_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -88712,6 +88715,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -88942,6 +88946,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_insert_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89036,6 +89041,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89124,6 +89130,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, { this.list = BI.createWidget({ type: "bi.multi_select_list", element: this, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this) }); diff --git a/dist/bundle.js b/dist/bundle.js index 7f1f7b5e37..3be2bd50ca 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -55158,6 +55158,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, { ref: function (_ref) { self.changeIcon = _ref; }, + disableSelected: true, iconCls: "auto-color-icon", width: 24, iconWidth: 16, @@ -88941,6 +88942,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser, type: "bi.multi_tree_list_combo", element: this, text: o.text, + value: o.value, watermark: o.watermark, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), @@ -89028,6 +89030,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_insert_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -89116,6 +89119,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -89346,6 +89350,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_insert_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89440,6 +89445,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89528,6 +89534,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, { this.list = BI.createWidget({ type: "bi.multi_select_list", element: this, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this) }); diff --git a/dist/case.js b/dist/case.js index 76304cf00d..3f6f8c41d9 100644 --- a/dist/case.js +++ b/dist/case.js @@ -2730,6 +2730,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, { ref: function (_ref) { self.changeIcon = _ref; }, + disableSelected: true, iconCls: "auto-color-icon", width: 24, iconWidth: 16, diff --git a/dist/fineui.ie.js b/dist/fineui.ie.js index 0dcd4d2d34..36310d834e 100644 --- a/dist/fineui.ie.js +++ b/dist/fineui.ie.js @@ -54999,6 +54999,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, { ref: function (_ref) { self.changeIcon = _ref; }, + disableSelected: true, iconCls: "auto-color-icon", width: 24, iconWidth: 16, @@ -88782,6 +88783,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser, type: "bi.multi_tree_list_combo", element: this, text: o.text, + value: o.value, watermark: o.watermark, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), @@ -88869,6 +88871,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_insert_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -88957,6 +88960,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -89187,6 +89191,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_insert_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89281,6 +89286,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89369,6 +89375,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, { this.list = BI.createWidget({ type: "bi.multi_select_list", element: this, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this) }); diff --git a/dist/fineui.js b/dist/fineui.js index 0d4d63c4f1..79c1c1d00a 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -55403,6 +55403,7 @@ BI.LongColorChooserTrigger = BI.inherit(BI.Trigger, { ref: function (_ref) { self.changeIcon = _ref; }, + disableSelected: true, iconCls: "auto-color-icon", width: 24, iconWidth: 16, @@ -89186,6 +89187,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser, type: "bi.multi_tree_list_combo", element: this, text: o.text, + value: o.value, watermark: o.watermark, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), @@ -89273,6 +89275,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_insert_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -89361,6 +89364,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -89591,6 +89595,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_insert_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89685,6 +89690,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -89773,6 +89779,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, { this.list = BI.createWidget({ type: "bi.multi_select_list", element: this, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this) }); diff --git a/dist/fineui_without_jquery_polyfill.js b/dist/fineui_without_jquery_polyfill.js index 466eb1ea09..3c51d538bd 100644 --- a/dist/fineui_without_jquery_polyfill.js +++ b/dist/fineui_without_jquery_polyfill.js @@ -71486,6 +71486,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser, type: "bi.multi_tree_list_combo", element: this, text: o.text, + value: o.value, watermark: o.watermark, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), @@ -71573,6 +71574,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_insert_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -71661,6 +71663,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -71891,6 +71894,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_insert_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -71985,6 +71989,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -72073,6 +72078,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, { this.list = BI.createWidget({ type: "bi.multi_select_list", element: this, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this) }); diff --git a/dist/widget.js b/dist/widget.js index ad6aa5d23f..4b3828e126 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -26597,6 +26597,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser, type: "bi.multi_tree_list_combo", element: this, text: o.text, + value: o.value, watermark: o.watermark, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), @@ -26684,6 +26685,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_insert_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -26772,6 +26774,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), @@ -27002,6 +27005,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_insert_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -27096,6 +27100,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, @@ -27184,6 +27189,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, { this.list = BI.createWidget({ type: "bi.multi_select_list", element: this, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this) }); diff --git a/src/component/treevaluechooser/combo.listtreevaluechooser.js b/src/component/treevaluechooser/combo.listtreevaluechooser.js index c817cd9394..383b3184b6 100644 --- a/src/component/treevaluechooser/combo.listtreevaluechooser.js +++ b/src/component/treevaluechooser/combo.listtreevaluechooser.js @@ -27,6 +27,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser, type: "bi.multi_tree_list_combo", element: this, text: o.text, + value: o.value, watermark: o.watermark, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), diff --git a/src/component/treevaluechooser/combo.treevaluechooser.insert.js b/src/component/treevaluechooser/combo.treevaluechooser.insert.js index e8314110f0..2a8b0ca546 100644 --- a/src/component/treevaluechooser/combo.treevaluechooser.insert.js +++ b/src/component/treevaluechooser/combo.treevaluechooser.insert.js @@ -26,6 +26,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_insert_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), diff --git a/src/component/treevaluechooser/combo.treevaluechooser.js b/src/component/treevaluechooser/combo.treevaluechooser.js index 84b93f8761..662f22385a 100644 --- a/src/component/treevaluechooser/combo.treevaluechooser.js +++ b/src/component/treevaluechooser/combo.treevaluechooser.js @@ -26,6 +26,7 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { this.combo = BI.createWidget({ type: "bi.multi_tree_combo", text: o.text, + value: o.value, watermark: o.watermark, element: this, itemsCreator: BI.bind(this._itemsCreator, this), diff --git a/src/component/valuechooser/combo.valuechooser.insert.js b/src/component/valuechooser/combo.valuechooser.insert.js index 0c155ea1ad..c1f290c3a9 100644 --- a/src/component/valuechooser/combo.valuechooser.insert.js +++ b/src/component/valuechooser/combo.valuechooser.insert.js @@ -25,6 +25,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_insert_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, diff --git a/src/component/valuechooser/combo.valuechooser.js b/src/component/valuechooser/combo.valuechooser.js index d8c3454daf..312f4c0e49 100644 --- a/src/component/valuechooser/combo.valuechooser.js +++ b/src/component/valuechooser/combo.valuechooser.js @@ -29,6 +29,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, { type: "bi.multi_select_combo", element: this, text: o.text, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, diff --git a/src/component/valuechooser/pane.valuechooser.js b/src/component/valuechooser/pane.valuechooser.js index 9e7a9e0963..143f8f8c93 100644 --- a/src/component/valuechooser/pane.valuechooser.js +++ b/src/component/valuechooser/pane.valuechooser.js @@ -23,6 +23,7 @@ BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, { this.list = BI.createWidget({ type: "bi.multi_select_list", element: this, + value: o.value, itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this) }); From cf03538f94e19e02ce584457ba63be85a75b5903 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 2 Sep 2019 16:51:22 +0800 Subject: [PATCH 3/8] =?UTF-8?q?test:=20=E6=97=A5=E6=9C=9F=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E6=8E=A7=E4=BB=B6=E8=A6=86=E7=9B=96=E7=8E=87100%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gruntfile.js | 4 +- karma.conf.js | 1 + src/widget/datepane/__test__/datepane.test.js | 143 ++++++++++++++++++ 3 files changed, 146 insertions(+), 2 deletions(-) create mode 100644 src/widget/datepane/__test__/datepane.test.js diff --git a/Gruntfile.js b/Gruntfile.js index d1ea191484..1d2e978d7a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -74,10 +74,10 @@ module.exports = function (grunt) { dest: "dist/case.js" }, widgetJs: { - src: [ + src: filterPath([ "src/widget/**/*.js", "src/component/**/*.js" - ], + ]), dest: "dist/widget.js" }, routerJs: { diff --git a/karma.conf.js b/karma.conf.js index ae5a5a85f1..398ac8fa92 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -21,6 +21,7 @@ module.exports = function (config) { "src/core/foundation.js", "src/core/lodash.js", "src/core/base.js", + "i18n/i18n.cn.js", "src/core/ob.js", "src/core/widget.js", "src/core/shortcut.js", diff --git a/src/widget/datepane/__test__/datepane.test.js b/src/widget/datepane/__test__/datepane.test.js new file mode 100644 index 0000000000..0c56324a49 --- /dev/null +++ b/src/widget/datepane/__test__/datepane.test.js @@ -0,0 +1,143 @@ +/** + * @author windy + * @version 2.0 + * Created by windy on 2019/9/2 + */ + +describe("DatePane", function () { + + /** + * test_author_windy + */ + it("defaultValue", function () { + var datePane = BI.Test.createWidget({ + type: "bi.dynamic_date_pane", + value: { + type: 1, + value: { + year: 2017, + month: 12, + day: 11 + } + }, + }); + expect(datePane.element.find(".bi-year-combo .bi-label").text()).to.equal("2017"); + expect(datePane.element.find(".bi-month-combo .bi-label").text()).to.equal("12"); + expect(datePane.element.find(".bi-calendar .bi-list-item-select.active .bi-text").text()).to.equal("11"); + datePane.destroy(); + }); + + /** + * test_author_windy + */ + it("setStaticValue", function () { + var datePane = BI.Test.createWidget({ + type: "bi.dynamic_date_pane", + }); + datePane.setValue({ + type: 1, + value: { + year: 2017, + month: 12, + day: 11 + } + }); + expect(datePane.element.find(".bi-year-combo .bi-label").text()).to.equal("2017"); + expect(datePane.element.find(".bi-month-combo .bi-label").text()).to.equal("12"); + expect(datePane.element.find(".bi-calendar .bi-list-item-select.active .bi-text").text()).to.equal("11"); + datePane.destroy(); + }); + + /** + * test_author_windy + */ + it("setDynamicValue", function () { + var datePane = BI.Test.createWidget({ + type: "bi.dynamic_date_pane", + }); + datePane.setValue({ + type: 2, + value: { + year: -1, + month: 1, + quarter: -1, + week: 1, + day: 1 + } + }); + expect(datePane.element.find(".bi-line-segment-button.active").text()).to.equal("动态时间"); + + datePane.setValue({ + type: 2, + value: { + workDay: 1 + } + }); + expect(datePane.element.find(".bi-line-segment-button.active").text()).to.equal("动态时间"); + datePane.destroy(); + }); + + /** + * test_author_windy + */ + it("getStaticValue", function (done) { + var datePane = BI.Test.createWidget({ + type: "bi.dynamic_date_pane", + value: { + type: 1, + value: { + year: 2019, + month: 3, + day: 30 + } + } + }); + BI.nextTick(function () { + datePane.element.find(".bi-month-combo .bi-date-triangle-trigger").click(); + 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(); + expect(datePane.getValue()).to.deep.equal({ + type: 1, + value: { + year: 2019, + month: 2, + day: 27 + } + }); + datePane.destroy(); + done(); + }) + }); + }); + + /** + * test_author_windy + */ + it("getDynamicValue", function (done) { + var datePane = BI.Test.createWidget({ + type: "bi.dynamic_date_pane", + value: { + type: 2, + value: {} + } + }); + BI.nextTick(function () { + // 先点到静态时间再到动态时间 + datePane.element.find(".bi-linear-segment .bi-line-segment-button").get(0).click(); + datePane.element.find(".bi-linear-segment .bi-line-segment-button").get(1).click(); + BI.nextTick(function () { + datePane.element.find(".bi-multi-select-item.active").click(); + datePane.element.find(".bi-multi-select-item").click(); + expect(datePane.getValue()).to.deep.equal({ + type: 2, + value: { + workDay: -0 + } + }); + datePane.destroy(); + done(); + }) + }); + }); +}); From 214d76af60cc4c966237e45f9b59b1911c970fa6 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 2 Sep 2019 19:55:35 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E5=8F=B3=E9=97=B4=E8=B7=9D=E4=B8=BA4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/2.0/fineui.ie.js | 2 +- dist/2.0/fineui.js | 2 +- dist/base.js | 2 +- dist/bundle.ie.js | 2 +- dist/bundle.js | 2 +- dist/fineui.ie.js | 2 +- dist/fineui.js | 2 +- dist/fineui_without_jquery_polyfill.js | 2 +- src/base/single/editor/editor.textarea.js | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dist/2.0/fineui.ie.js b/dist/2.0/fineui.ie.js index b56d2a2ffc..a83082d735 100644 --- a/dist/2.0/fineui.ie.js +++ b/dist/2.0/fineui.ie.js @@ -47228,7 +47228,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { items: [this.content] }, left: 4, - right: 10, + right: 4, top: 4, bottom: 8 }] diff --git a/dist/2.0/fineui.js b/dist/2.0/fineui.js index 3be2bd50ca..1492ee320d 100644 --- a/dist/2.0/fineui.js +++ b/dist/2.0/fineui.js @@ -47632,7 +47632,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { items: [this.content] }, left: 4, - right: 10, + right: 4, top: 4, bottom: 8 }] diff --git a/dist/base.js b/dist/base.js index 4e75992fcf..3fc9bae58a 100644 --- a/dist/base.js +++ b/dist/base.js @@ -9359,7 +9359,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { items: [this.content] }, left: 4, - right: 10, + right: 4, top: 4, bottom: 8 }] diff --git a/dist/bundle.ie.js b/dist/bundle.ie.js index b56d2a2ffc..a83082d735 100644 --- a/dist/bundle.ie.js +++ b/dist/bundle.ie.js @@ -47228,7 +47228,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { items: [this.content] }, left: 4, - right: 10, + right: 4, top: 4, bottom: 8 }] diff --git a/dist/bundle.js b/dist/bundle.js index 3be2bd50ca..1492ee320d 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -47632,7 +47632,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { items: [this.content] }, left: 4, - right: 10, + right: 4, top: 4, bottom: 8 }] diff --git a/dist/fineui.ie.js b/dist/fineui.ie.js index 36310d834e..394d8c8381 100644 --- a/dist/fineui.ie.js +++ b/dist/fineui.ie.js @@ -47473,7 +47473,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { items: [this.content] }, left: 4, - right: 10, + right: 4, top: 4, bottom: 8 }] diff --git a/dist/fineui.js b/dist/fineui.js index 79c1c1d00a..673357db9c 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -47877,7 +47877,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { items: [this.content] }, left: 4, - right: 10, + right: 4, top: 4, bottom: 8 }] diff --git a/dist/fineui_without_jquery_polyfill.js b/dist/fineui_without_jquery_polyfill.js index 3c51d538bd..e1a3d7feec 100644 --- a/dist/fineui_without_jquery_polyfill.js +++ b/dist/fineui_without_jquery_polyfill.js @@ -34991,7 +34991,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { items: [this.content] }, left: 4, - right: 10, + right: 4, top: 4, bottom: 8 }] diff --git a/src/base/single/editor/editor.textarea.js b/src/base/single/editor/editor.textarea.js index 0e66cf2837..59cd55ca11 100644 --- a/src/base/single/editor/editor.textarea.js +++ b/src/base/single/editor/editor.textarea.js @@ -31,7 +31,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { items: [this.content] }, left: 4, - right: 10, + right: 4, top: 4, bottom: 8 }] From bcbacaa38ed41b926c4216e469f644cf1102cbee Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Tue, 3 Sep 2019 09:36:25 +0800 Subject: [PATCH 5/8] =?UTF-8?q?refactor:=20=E6=8D=A2=E4=B8=80=E7=A7=8D?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/2.0/fineui.ie.js | 30 ++++++++++++------- dist/2.0/fineui.js | 30 ++++++++++++------- dist/bundle.ie.js | 30 ++++++++++++------- dist/bundle.js | 30 ++++++++++++------- dist/fineui.ie.js | 30 ++++++++++++------- dist/fineui.js | 30 ++++++++++++------- dist/fineui_without_jquery_polyfill.js | 30 ++++++++++++------- dist/widget.js | 30 ++++++++++++------- .../multilayerselecttree.trigger.js | 15 ++++++---- .../multilayersingletree.trigger.js | 15 ++++++---- 10 files changed, 180 insertions(+), 90 deletions(-) diff --git a/dist/2.0/fineui.ie.js b/dist/2.0/fineui.ie.js index a83082d735..80928cb877 100644 --- a/dist/2.0/fineui.ie.js +++ b/dist/2.0/fineui.ie.js @@ -69244,11 +69244,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -70415,11 +70420,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { diff --git a/dist/2.0/fineui.js b/dist/2.0/fineui.js index 1492ee320d..9bc68ae6cb 100644 --- a/dist/2.0/fineui.js +++ b/dist/2.0/fineui.js @@ -69648,11 +69648,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -70819,11 +70824,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { diff --git a/dist/bundle.ie.js b/dist/bundle.ie.js index a83082d735..80928cb877 100644 --- a/dist/bundle.ie.js +++ b/dist/bundle.ie.js @@ -69244,11 +69244,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -70415,11 +70420,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { diff --git a/dist/bundle.js b/dist/bundle.js index 1492ee320d..9bc68ae6cb 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -69648,11 +69648,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -70819,11 +70824,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { diff --git a/dist/fineui.ie.js b/dist/fineui.ie.js index 394d8c8381..efc058a9d8 100644 --- a/dist/fineui.ie.js +++ b/dist/fineui.ie.js @@ -69489,11 +69489,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -70660,11 +70665,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { diff --git a/dist/fineui.js b/dist/fineui.js index 673357db9c..da2d9cb018 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -69893,11 +69893,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -71064,11 +71069,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { diff --git a/dist/fineui_without_jquery_polyfill.js b/dist/fineui_without_jquery_polyfill.js index e1a3d7feec..61e8bb8e18 100644 --- a/dist/fineui_without_jquery_polyfill.js +++ b/dist/fineui_without_jquery_polyfill.js @@ -52192,11 +52192,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -53363,11 +53368,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { diff --git a/dist/widget.js b/dist/widget.js index 4b3828e126..12b2ce0187 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -7303,11 +7303,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { @@ -8474,11 +8479,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { diff --git a/src/widget/multilayerselecttree/multilayerselecttree.trigger.js b/src/widget/multilayerselecttree/multilayerselecttree.trigger.js index 90cab85f4e..f9312e384c 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.trigger.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.trigger.js @@ -130,11 +130,16 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { diff --git a/src/widget/multilayersingletree/multilayersingletree.trigger.js b/src/widget/multilayersingletree/multilayersingletree.trigger.js index 4ff540e963..819986c595 100644 --- a/src/widget/multilayersingletree/multilayersingletree.trigger.js +++ b/src/widget/multilayersingletree/multilayersingletree.trigger.js @@ -130,11 +130,16 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { _getSearchItems: function(keyword) { var o = this.options; - var findingText = BI.Func.getSearchResult(this.nodes, keyword, "text"); - var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(this.nodes, keyword, "value") : {find: [], match: []}; - var textItems = findingText.find.concat(findingText.match); - var valueItems = findingValue.find.concat(findingValue.match); - return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + // 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索 + var items = []; + this.tree.traverse(function (node) { + var find = BI.Func.getSearchResult([node.text || (o.allowSearchValue && node.value) || ""], keyword); + if(find.find.length > 0 || find.match.length > 0) { + items.push(node); + return true; + } + }); + return this._fillTreeStructure4Search(items, "id"); }, _createJson: function(node, open) { From fa0e94dae997f1d72f6b1a172e870c7068aa5c02 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Tue, 3 Sep 2019 10:45:52 +0800 Subject: [PATCH 6/8] =?UTF-8?q?fix:=20=E7=BC=96=E5=86=99=E5=8D=95=E6=B5=8B?= =?UTF-8?q?=E5=8F=91=E7=8E=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/2.0/fineui.ie.js | 16 +- dist/2.0/fineui.js | 16 +- dist/bundle.ie.js | 16 +- dist/bundle.js | 16 +- dist/fineui.ie.js | 16 +- dist/fineui.js | 16 +- dist/fineui_without_jquery_polyfill.js | 16 +- dist/widget.js | 16 +- .../__test__/datetimepane.test.js | 152 ++++++++++++++++++ .../dynamicdatetime.timeselect.js | 4 +- src/widget/numbereditor/number.editor.js | 12 +- 11 files changed, 224 insertions(+), 72 deletions(-) create mode 100644 src/widget/datetimepane/__test__/datetimepane.test.js diff --git a/dist/2.0/fineui.ie.js b/dist/2.0/fineui.ie.js index 80928cb877..eb9b6db9e4 100644 --- a/dist/2.0/fineui.ie.js +++ b/dist/2.0/fineui.ie.js @@ -66173,8 +66173,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + action: function (v) { + var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -77562,11 +77562,11 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -77576,8 +77576,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -77587,8 +77587,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); BI.createWidget({ type: "bi.htape", diff --git a/dist/2.0/fineui.js b/dist/2.0/fineui.js index 9bc68ae6cb..44d678c8e2 100644 --- a/dist/2.0/fineui.js +++ b/dist/2.0/fineui.js @@ -66577,8 +66577,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + action: function (v) { + var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -77966,11 +77966,11 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -77980,8 +77980,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -77991,8 +77991,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); BI.createWidget({ type: "bi.htape", diff --git a/dist/bundle.ie.js b/dist/bundle.ie.js index 80928cb877..eb9b6db9e4 100644 --- a/dist/bundle.ie.js +++ b/dist/bundle.ie.js @@ -66173,8 +66173,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + action: function (v) { + var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -77562,11 +77562,11 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -77576,8 +77576,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -77587,8 +77587,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); BI.createWidget({ type: "bi.htape", diff --git a/dist/bundle.js b/dist/bundle.js index 9bc68ae6cb..44d678c8e2 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -66577,8 +66577,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + action: function (v) { + var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -77966,11 +77966,11 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -77980,8 +77980,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -77991,8 +77991,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); BI.createWidget({ type: "bi.htape", diff --git a/dist/fineui.ie.js b/dist/fineui.ie.js index efc058a9d8..5a3beb77eb 100644 --- a/dist/fineui.ie.js +++ b/dist/fineui.ie.js @@ -66418,8 +66418,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + action: function (v) { + var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -77807,11 +77807,11 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -77821,8 +77821,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -77832,8 +77832,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); BI.createWidget({ type: "bi.htape", diff --git a/dist/fineui.js b/dist/fineui.js index da2d9cb018..0e2f4b3318 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -66822,8 +66822,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + action: function (v) { + var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -78211,11 +78211,11 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -78225,8 +78225,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -78236,8 +78236,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); BI.createWidget({ type: "bi.htape", diff --git a/dist/fineui_without_jquery_polyfill.js b/dist/fineui_without_jquery_polyfill.js index 61e8bb8e18..9e518b7512 100644 --- a/dist/fineui_without_jquery_polyfill.js +++ b/dist/fineui_without_jquery_polyfill.js @@ -49121,8 +49121,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + action: function (v) { + var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -60510,11 +60510,11 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -60524,8 +60524,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -60535,8 +60535,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); BI.createWidget({ type: "bi.htape", diff --git a/dist/widget.js b/dist/widget.js index 12b2ce0187..17c6813ece 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -4232,8 +4232,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + action: function (v) { + var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -15621,11 +15621,11 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -15635,8 +15635,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -15646,8 +15646,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); BI.createWidget({ type: "bi.htape", diff --git a/src/widget/datetimepane/__test__/datetimepane.test.js b/src/widget/datetimepane/__test__/datetimepane.test.js new file mode 100644 index 0000000000..5faf7c84b1 --- /dev/null +++ b/src/widget/datetimepane/__test__/datetimepane.test.js @@ -0,0 +1,152 @@ +/** + * @author windy + * @version 2.0 + * Created by windy on 2019/9/3 + */ +/** + * @author windy + * @version 2.0 + * Created by windy on 2019/9/2 + */ + +describe("DateTimePane", function () { + + /** + * test_author_windy + */ + it("defaultValue", function () { + var datePane = BI.Test.createWidget({ + type: "bi.dynamic_date_time_pane", + value: { + type: 1, + value: { + year: 2017, + month: 12, + day: 11 + } + }, + }); + expect(datePane.element.find(".bi-year-combo .bi-label").text()).to.equal("2017"); + expect(datePane.element.find(".bi-month-combo .bi-label").text()).to.equal("12"); + expect(datePane.element.find(".bi-calendar .bi-list-item-select.active .bi-text").text()).to.equal("11"); + datePane.destroy(); + }); + + /** + * test_author_windy + */ + it("setStaticValue", function () { + var datePane = BI.Test.createWidget({ + type: "bi.dynamic_date_time_pane", + }); + datePane.setValue({ + type: 1, + value: { + year: 2017, + month: 12, + day: 11 + } + }); + expect(datePane.element.find(".bi-year-combo .bi-label").text()).to.equal("2017"); + expect(datePane.element.find(".bi-month-combo .bi-label").text()).to.equal("12"); + expect(datePane.element.find(".bi-calendar .bi-list-item-select.active .bi-text").text()).to.equal("11"); + datePane.destroy(); + }); + + /** + * test_author_windy + */ + it("setDynamicValue", function () { + var datePane = BI.Test.createWidget({ + type: "bi.dynamic_date_time_pane", + }); + datePane.setValue({ + type: 2, + value: { + year: -1, + month: 1, + quarter: -1, + week: 1, + day: 1 + } + }); + expect(datePane.element.find(".bi-line-segment-button.active").text()).to.equal("动态时间"); + + datePane.setValue({ + type: 2, + value: { + workDay: 1 + } + }); + expect(datePane.element.find(".bi-line-segment-button.active").text()).to.equal("动态时间"); + datePane.destroy(); + }); + + /** + * test_author_windy + */ + it("getStaticValue", function (done) { + var datePane = BI.Test.createWidget({ + type: "bi.dynamic_date_time_pane", + value: { + type: 1, + value: { + year: 2019, + month: 3, + day: 30 + } + } + }); + BI.nextTick(function () { + datePane.element.find(".bi-month-combo .bi-date-triangle-trigger").click(); + 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(); + expect(datePane.getValue()).to.deep.equal({ + type: 1, + value: { + year: 2019, + month: 2, + day: 27, + hour: 0, + minute: 0, + second: 0 + } + }); + datePane.destroy(); + done(); + }) + }); + }); + + /** + * test_author_windy + */ + it("getDynamicValue", function (done) { + var datePane = BI.Test.createWidget({ + type: "bi.dynamic_date_time_pane", + value: { + type: 2, + value: {} + } + }); + BI.nextTick(function () { + // 先点到静态时间再到动态时间 + datePane.element.find(".bi-linear-segment .bi-line-segment-button").get(0).click(); + datePane.element.find(".bi-linear-segment .bi-line-segment-button").get(1).click(); + BI.nextTick(function () { + datePane.element.find(".bi-multi-select-item.active").click(); + datePane.element.find(".bi-multi-select-item").click(); + expect(datePane.getValue()).to.deep.equal({ + type: 2, + value: { + workDay: -0 + } + }); + datePane.destroy(); + done(); + }) + }); + }); +}); diff --git a/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js b/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js index 84f54abcfb..a0959db2e3 100644 --- a/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js +++ b/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js @@ -35,8 +35,8 @@ BI.DynamicDateTimeSelect = BI.inherit(BI.Widget, { } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + action: function (v) { + var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], diff --git a/src/widget/numbereditor/number.editor.js b/src/widget/numbereditor/number.editor.js index fd8f4171f7..8d05191789 100644 --- a/src/widget/numbereditor/number.editor.js +++ b/src/widget/numbereditor/number.editor.js @@ -31,11 +31,11 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -45,8 +45,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -56,8 +56,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); BI.createWidget({ type: "bi.htape", From 23cc5381d37a0b39eb5feb0899b5520be44fb29d Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Tue, 3 Sep 2019 10:57:44 +0800 Subject: [PATCH 7/8] =?UTF-8?q?revert:=20numbereditor=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/2.0/fineui.ie.js | 17 +++++++++-------- dist/2.0/fineui.js | 17 +++++++++-------- dist/bundle.ie.js | 17 +++++++++-------- dist/bundle.js | 17 +++++++++-------- dist/fineui.ie.js | 17 +++++++++-------- dist/fineui.js | 17 +++++++++-------- dist/fineui_without_jquery_polyfill.js | 17 +++++++++-------- dist/widget.js | 17 +++++++++-------- .../dynamicdatetime.timeselect.js | 4 ++-- src/widget/numbereditor/number.editor.js | 13 +++++++------ 10 files changed, 81 insertions(+), 72 deletions(-) diff --git a/dist/2.0/fineui.ie.js b/dist/2.0/fineui.ie.js index eb9b6db9e4..ae47cdd93b 100644 --- a/dist/2.0/fineui.ie.js +++ b/dist/2.0/fineui.ie.js @@ -66173,8 +66173,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function (v) { - var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); + action: function () { + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -77562,11 +77562,12 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); + o.value = BI.parseFloat(this.getValue()); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -77576,8 +77577,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -77587,8 +77588,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); BI.createWidget({ type: "bi.htape", diff --git a/dist/2.0/fineui.js b/dist/2.0/fineui.js index 44d678c8e2..4a36be6440 100644 --- a/dist/2.0/fineui.js +++ b/dist/2.0/fineui.js @@ -66577,8 +66577,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function (v) { - var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); + action: function () { + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -77966,11 +77966,12 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); + o.value = BI.parseFloat(this.getValue()); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -77980,8 +77981,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -77991,8 +77992,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); BI.createWidget({ type: "bi.htape", diff --git a/dist/bundle.ie.js b/dist/bundle.ie.js index eb9b6db9e4..ae47cdd93b 100644 --- a/dist/bundle.ie.js +++ b/dist/bundle.ie.js @@ -66173,8 +66173,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function (v) { - var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); + action: function () { + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -77562,11 +77562,12 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); + o.value = BI.parseFloat(this.getValue()); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -77576,8 +77577,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -77587,8 +77588,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); BI.createWidget({ type: "bi.htape", diff --git a/dist/bundle.js b/dist/bundle.js index 44d678c8e2..4a36be6440 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -66577,8 +66577,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function (v) { - var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); + action: function () { + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -77966,11 +77966,12 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); + o.value = BI.parseFloat(this.getValue()); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -77980,8 +77981,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -77991,8 +77992,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); BI.createWidget({ type: "bi.htape", diff --git a/dist/fineui.ie.js b/dist/fineui.ie.js index 5a3beb77eb..c8b78856d3 100644 --- a/dist/fineui.ie.js +++ b/dist/fineui.ie.js @@ -66418,8 +66418,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function (v) { - var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); + action: function () { + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -77807,11 +77807,12 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); + o.value = BI.parseFloat(this.getValue()); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -77821,8 +77822,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -77832,8 +77833,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); BI.createWidget({ type: "bi.htape", diff --git a/dist/fineui.js b/dist/fineui.js index 0e2f4b3318..dacf70fddd 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -66822,8 +66822,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function (v) { - var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); + action: function () { + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -78211,11 +78211,12 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); + o.value = BI.parseFloat(this.getValue()); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -78225,8 +78226,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -78236,8 +78237,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); BI.createWidget({ type: "bi.htape", diff --git a/dist/fineui_without_jquery_polyfill.js b/dist/fineui_without_jquery_polyfill.js index 9e518b7512..f03a21d0a9 100644 --- a/dist/fineui_without_jquery_polyfill.js +++ b/dist/fineui_without_jquery_polyfill.js @@ -49121,8 +49121,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function (v) { - var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); + action: function () { + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -60510,11 +60510,12 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); + o.value = BI.parseFloat(this.getValue()); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -60524,8 +60525,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -60535,8 +60536,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); BI.createWidget({ type: "bi.htape", diff --git a/dist/widget.js b/dist/widget.js index 17c6813ece..70e9d39800 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -4232,8 +4232,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function (v) { - var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); + action: function () { + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -15621,11 +15621,12 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); + o.value = BI.parseFloat(this.getValue()); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -15635,8 +15636,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -15646,8 +15647,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); BI.createWidget({ type: "bi.htape", diff --git a/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js b/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js index a0959db2e3..dde68f6d97 100644 --- a/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js +++ b/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js @@ -35,8 +35,8 @@ BI.DynamicDateTimeSelect = BI.inherit(BI.Widget, { } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function (v) { - var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); + action: function () { + var value = self._autoSwitch(this.getValue(), BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], diff --git a/src/widget/numbereditor/number.editor.js b/src/widget/numbereditor/number.editor.js index 8d05191789..9a2a176295 100644 --- a/src/widget/numbereditor/number.editor.js +++ b/src/widget/numbereditor/number.editor.js @@ -31,11 +31,12 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); + o.value = BI.parseFloat(this.getValue()); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -45,8 +46,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -56,8 +57,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); }); BI.createWidget({ type: "bi.htape", 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 8/8] =?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({