From d14acfa35cd08afcc51a870f3b685aacef083b27 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 14 Dec 2020 22:41:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E6=9C=AC=E6=8E=A7=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E5=BD=93=E6=95=B0=E6=8D=AE=E5=8F=98=E5=8C=96=E5=90=8E=E5=86=8D?= =?UTF-8?q?=E5=BE=80=E5=A4=96=E6=8A=9B=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/multiselect/multiselect.combo.js | 9 +++++++-- src/widget/multiselect/multiselect.combo.nobar.js | 9 +++++++-- src/widget/multiselect/multiselect.insert.combo.js | 11 +++++++---- .../multiselect/multiselect.insert.combo.nobar.js | 7 ++++++- .../multitextvalue.combo.search.js | 7 ++++++- 5 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/widget/multiselect/multiselect.combo.js b/src/widget/multiselect/multiselect.combo.js index cfad24bf4..3d4834936 100644 --- a/src/widget/multiselect/multiselect.combo.js +++ b/src/widget/multiselect/multiselect.combo.js @@ -92,6 +92,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { assertShowValue(); self.populate(); self._setStartValue(""); + self._dataChange = true; }); } }); @@ -109,6 +110,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { self.combo.setValue(self.storeValue); assertShowValue(); } + self._dataChange = true; }); } self.fireEvent(BI.MultiSelectCombo.EVENT_SEARCHING); @@ -124,6 +126,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { assertShowValue(); }); } + self._dataChange = true; self.fireEvent(BI.MultiSelectCombo.EVENT_CLICK_ITEM); }); this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { @@ -153,6 +156,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { listeners: [{ eventName: BI.MultiSelectPopupView.EVENT_CHANGE, action: function () { + self._dataChange = true; self.storeValue = this.getValue(); self._adjust(function () { assertShowValue(); @@ -190,6 +194,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { }); this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { + self._dataChange = false;// 标记数据是否发生变化 this.setValue(self.storeValue); BI.nextTick(function () { self._populate(); @@ -203,7 +208,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { if (self.requesting === true) { self.wants2Quit = true; } else { - self.fireEvent(BI.MultiSelectCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.MultiSelectCombo.EVENT_CONFIRM); } }); @@ -390,7 +395,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { callback(); function adjust () { if (self.wants2Quit === true) { - self.fireEvent(BI.MultiSelectCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.MultiSelectCombo.EVENT_CONFIRM); self.wants2Quit = false; } self.requesting = false; diff --git a/src/widget/multiselect/multiselect.combo.nobar.js b/src/widget/multiselect/multiselect.combo.nobar.js index 5df92c164..22f38b4f4 100644 --- a/src/widget/multiselect/multiselect.combo.nobar.js +++ b/src/widget/multiselect/multiselect.combo.nobar.js @@ -100,6 +100,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, { self.combo.setValue(self.storeValue); assertShowValue(); } + self._dataChange = true; }); } }); @@ -114,6 +115,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, { assertShowValue(); }); } + self._dataChange = true; self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CLICK_ITEM); }); this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { @@ -143,6 +145,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, { listeners: [{ eventName: BI.MultiSelectPopupView.EVENT_CHANGE, action: function () { + self._dataChange = true; self.storeValue = this.getValue(); self._adjust(function () { assertShowValue(); @@ -184,6 +187,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, { }); this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { + self._dataChange = false;// 标记数据是否发生变化 this.setValue(self.storeValue); BI.nextTick(function () { self._populate(); @@ -197,7 +201,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, { if (self.requesting === true) { self.wants2Quit = true; } else { - self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM); } }); @@ -302,6 +306,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, { assertShowValue(); self.populate(); self._setStartValue(""); + self._dataChange = true; }); }, @@ -407,7 +412,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, { function adjust() { if (self.wants2Quit === true) { - self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.MultiSelectNoBarCombo.EVENT_CONFIRM); self.wants2Quit = false; } self.requesting = false; diff --git a/src/widget/multiselect/multiselect.insert.combo.js b/src/widget/multiselect/multiselect.insert.combo.js index 1d4bd8169..db9a91672 100644 --- a/src/widget/multiselect/multiselect.insert.combo.js +++ b/src/widget/multiselect/multiselect.insert.combo.js @@ -104,6 +104,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { self.combo.setValue(self.storeValue); assertShowValue(); } + self._dataChange = true; }); } self.fireEvent(BI.MultiSelectInsertCombo.EVENT_SEARCHING); @@ -119,6 +120,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { assertShowValue(); }); } + self._dataChange = true; self.fireEvent(BI.MultiSelectInsertCombo.EVENT_CLICK_ITEM); }); this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { @@ -148,6 +150,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { listeners: [{ eventName: BI.MultiSelectPopupView.EVENT_CHANGE, action: function () { + self._dataChange = true; self.storeValue = this.getValue(); self._adjust(function () { assertShowValue(); @@ -186,6 +189,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { }); this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { + self._dataChange = false;// 标记数据是否发生变化 this.setValue(self.storeValue); BI.nextTick(function () { self._populate(); @@ -199,7 +203,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { if (self.requesting === true) { self.wants2Quit = true; } else { - self.fireEvent(BI.MultiSelectInsertCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.MultiSelectInsertCombo.EVENT_CONFIRM); } }); @@ -218,7 +222,6 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { } }); - this.numberCounter = BI.createWidget({ type: "bi.multi_select_check_selected_switcher", masker: { @@ -260,7 +263,6 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { } }); - BI.createWidget({ type: "bi.absolute", element: this, @@ -314,6 +316,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { assertShowValue(); self.populate(); self._setStartValue(""); + self._dataChange = true; }); }, @@ -407,7 +410,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { callback(); function adjust () { if (self.wants2Quit === true) { - self.fireEvent(BI.MultiSelectInsertCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.MultiSelectInsertCombo.EVENT_CONFIRM); self.wants2Quit = false; } self.requesting = false; diff --git a/src/widget/multiselect/multiselect.insert.combo.nobar.js b/src/widget/multiselect/multiselect.insert.combo.nobar.js index 6fc46c8b0..8bada74d5 100644 --- a/src/widget/multiselect/multiselect.insert.combo.nobar.js +++ b/src/widget/multiselect/multiselect.insert.combo.nobar.js @@ -99,6 +99,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, { self.combo.setValue(self.storeValue); assertShowValue(); } + self._dataChange = true; }); } }); @@ -113,6 +114,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, { assertShowValue(); }); } + self._dataChange = true; }); this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { // counter的值随点击项的改变而改变, 点击counter的时候不需要setValue(counter会请求刷新计数) @@ -141,6 +143,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, { listeners: [{ eventName: BI.MultiSelectPopupView.EVENT_CHANGE, action: function () { + self._dataChange = true; self.storeValue = this.getValue(); self._adjust(function () { assertShowValue(); @@ -181,6 +184,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, { }); this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { + self._dataChange = false;// 标记数据是否发生变化 this.setValue(self.storeValue); BI.nextTick(function () { self._populate(); @@ -194,7 +198,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, { if (self.requesting === true) { self.wants2Quit = true; } else { - self.fireEvent(BI.MultiSelectInsertNoBarCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.MultiSelectInsertNoBarCombo.EVENT_CONFIRM); } }); @@ -310,6 +314,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, { assertShowValue(); self.populate(); self._setStartValue(""); + self._dataChange = true; }); }, diff --git a/src/widget/searchmultitextvaluecombo/multitextvalue.combo.search.js b/src/widget/searchmultitextvaluecombo/multitextvalue.combo.search.js index 20b2aa2c2..01a92abd4 100644 --- a/src/widget/searchmultitextvaluecombo/multitextvalue.combo.search.js +++ b/src/widget/searchmultitextvaluecombo/multitextvalue.combo.search.js @@ -81,6 +81,7 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, { assertShowValue(); self._populate(); self._setStartValue(""); + self._dataChange = true; }); } }); @@ -98,6 +99,7 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, { self.combo.setValue(self.storeValue); assertShowValue(); } + self._dataChange = true; }); } }); @@ -112,6 +114,7 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, { assertShowValue(); }); } + self._dataChange = true; }); this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { this.getCounter().setValue(self.storeValue); @@ -137,6 +140,7 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, { listeners: [{ eventName: BI.MultiSelectPopupView.EVENT_CHANGE, action: function () { + self._dataChange = true; self.storeValue = this.getValue(); self._adjust(function () { assertShowValue(); @@ -172,6 +176,7 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, { }); this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { + self._dataChange = false;// 标记数据是否发生变化 this.setValue(self.storeValue); BI.nextTick(function () { self._populate(); @@ -189,7 +194,7 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, { * 在存在标红的情况,如果popover没有发生改变就确认需要同步trigger的值,否则对外value值和trigger样式不统一 */ assertShowValue(); - self.fireEvent(BI.SearchMultiTextValueCombo.EVENT_CONFIRM); + self._dataChange && self.fireEvent(BI.SearchMultiTextValueCombo.EVENT_CONFIRM); } });