From 2fa525782c108bfbf2e4012459f5d0206dda1330 Mon Sep 17 00:00:00 2001 From: zsmj Date: Mon, 13 Jun 2022 21:59:53 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=97=A0JIRA=20=20fix:=20=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E5=A4=8D=E9=80=89=E4=B8=8B=E6=8B=89=E6=A1=86=E6=97=B6?= =?UTF-8?q?=E5=BA=8F=E4=B8=8D=E4=B8=80=E8=87=B4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 处理思路是search_trigger调用itemsCreator时候记录op对象,multi_select_combo回调时候把op对象附加到参数列表末尾, search_trigger进行引用比较 --- src/widget/multiselect/multiselect.combo.js | 4 +++- src/widget/multiselect/multiselect.insert.combo.js | 4 +++- src/widget/multiselect/trigger/button.checkselected.js | 5 ++++- .../multiselect/trigger/searcher.multiselect.insert.js | 10 ++++++++-- src/widget/multiselect/trigger/searcher.multiselect.js | 9 +++++++-- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/widget/multiselect/multiselect.combo.js b/src/widget/multiselect/multiselect.combo.js index 23d5385b8..a564dce78 100644 --- a/src/widget/multiselect/multiselect.combo.js +++ b/src/widget/multiselect/multiselect.combo.js @@ -284,11 +284,13 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { var self = this; var o = this.options; o.itemsCreator(op, function (res) { + var args = Array.prototype.slice.call(arguments); if (op.times === 1 && BI.isNotNull(op.keywords)) { // 预防trigger内部把当前的storeValue改掉 self.trigger.setValue(BI.deepClone(self.getValue())); } - callback.apply(self, arguments); + args.push(op); + callback.apply(self, args); }); }, diff --git a/src/widget/multiselect/multiselect.insert.combo.js b/src/widget/multiselect/multiselect.insert.combo.js index b1b4a202e..8001ada8d 100644 --- a/src/widget/multiselect/multiselect.insert.combo.js +++ b/src/widget/multiselect/multiselect.insert.combo.js @@ -285,11 +285,13 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { _itemsCreator4Trigger: function (op, callback) { var self = this, o = this.options; o.itemsCreator(op, function (res) { + var args = Array.prototype.slice.call(arguments); if (op.times === 1 && BI.isNotNull(op.keywords)) { // 预防trigger内部把当前的storeValue改掉 self.trigger.setValue(BI.deepClone(self.getValue())); } - callback.apply(self, arguments); + args.push(op); + callback.apply(self, args); }); }, diff --git a/src/widget/multiselect/trigger/button.checkselected.js b/src/widget/multiselect/trigger/button.checkselected.js index 47a5ca995..17468061f 100644 --- a/src/widget/multiselect/trigger/button.checkselected.js +++ b/src/widget/multiselect/trigger/button.checkselected.js @@ -40,7 +40,7 @@ BI.MultiSelectCheckSelectedButton = BI.inherit(BI.Single, { self.numberCounter.setText(self.numberCounter.getTag()); }); this.setVisible(false); - if(BI.isNotNull(o.value)){ + if (BI.isNotNull(o.value)) { this.setValue(o.value); } }, @@ -51,6 +51,9 @@ BI.MultiSelectCheckSelectedButton = BI.inherit(BI.Single, { o.itemsCreator({ type: BI.MultiSelectCombo.REQ_GET_DATA_LENGTH }, function (res) { + if (self.options.value.type !== BI.Selection.All) { + return; + } if (BI.isNotEmptyString(res.count)) { BI.nextTick(function () { self.numberCounter.setText(res.count); diff --git a/src/widget/multiselect/trigger/searcher.multiselect.insert.js b/src/widget/multiselect/trigger/searcher.multiselect.insert.js index 404a0e4e8..6fe8e0375 100644 --- a/src/widget/multiselect/trigger/searcher.multiselect.insert.js +++ b/src/widget/multiselect/trigger/searcher.multiselect.insert.js @@ -62,8 +62,14 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, { itemsCreator: function (op, callback) { var keyword = self.editor.getKeyword(); op.keywords = [keyword]; + self.op = op; this.setKeyword(keyword); - o.itemsCreator(op, callback); + o.itemsCreator(op, function () { + var args = Array.prototype.slice.call(arguments); + if (BI.last(args) === self.op) { + callback.apply(null, args); + } + }); }, itemHeight: o.itemHeight, value: o.value, @@ -174,7 +180,7 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, { } }, - getState: function() { + getState: function () { return this.editor.getState(); }, diff --git a/src/widget/multiselect/trigger/searcher.multiselect.js b/src/widget/multiselect/trigger/searcher.multiselect.js index ab2688eb4..651540981 100644 --- a/src/widget/multiselect/trigger/searcher.multiselect.js +++ b/src/widget/multiselect/trigger/searcher.multiselect.js @@ -51,7 +51,6 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, { callback(); }, el: this.editor, - popup: BI.extend({ type: "bi.multi_select_search_pane", valueFormatter: o.valueFormatter, @@ -61,7 +60,13 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, { itemsCreator: function (op, callback) { var keyword = self.editor.getValue(); op.keywords = [keyword]; - o.itemsCreator(op, callback); + self.op = op; + o.itemsCreator(op, function () { + var args = Array.prototype.slice.call(arguments); + if (BI.last(args) === self.op) { + callback.apply(null, args); + } + }); }, itemHeight: o.itemHeight, value: o.value From a58673cc63427b9c4807edfa1d676cb0dbbe0394 Mon Sep 17 00:00:00 2001 From: zsmj Date: Tue, 14 Jun 2022 10:55:30 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=97=A0JIRA=20fix:=20=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=A4=8D=E9=80=89=E4=B8=8B=E6=8B=89=E6=A1=86=E6=97=B6=E5=BA=8F?= =?UTF-8?q?=E4=B8=8D=E4=B8=80=E8=87=B4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/combination/searcher.js | 2 +- .../multiselect/trigger/searcher.multiselect.js | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/base/combination/searcher.js b/src/base/combination/searcher.js index c4fd29025..0989b4c8a 100644 --- a/src/base/combination/searcher.js +++ b/src/base/combination/searcher.js @@ -183,7 +183,7 @@ BI.Searcher = BI.inherit(BI.Widget, { keyword: keyword, selectedValues: o.adapter && o.adapter.getValue() }, function (searchResult, matchResult) { - if (!self._stop) { + if (!self._stop && keyword === self.editor.getValue()) { var args = [].slice.call(arguments); if (args.length > 0) { args.push(keyword); diff --git a/src/widget/multiselect/trigger/searcher.multiselect.js b/src/widget/multiselect/trigger/searcher.multiselect.js index 651540981..6a25a9f4a 100644 --- a/src/widget/multiselect/trigger/searcher.multiselect.js +++ b/src/widget/multiselect/trigger/searcher.multiselect.js @@ -62,10 +62,13 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, { op.keywords = [keyword]; self.op = op; o.itemsCreator(op, function () { - var args = Array.prototype.slice.call(arguments); - if (BI.last(args) === self.op) { - callback.apply(null, args); - } + var keyword = self.editor.getValue(); + op.keywords = [keyword]; + o.itemsCreator(op, function () { + if (keyword === self.editor.getValue()) { + callback.apply(null, arguments); + } + }); }); }, itemHeight: o.itemHeight, From c2c7c06083e20480904aeba92b888c847a389b6d Mon Sep 17 00:00:00 2001 From: zsmj Date: Tue, 14 Jun 2022 10:58:30 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=97=A0JIRA=20fix:=20=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=A4=8D=E9=80=89=E4=B8=8B=E6=8B=89=E6=A1=86=E6=97=B6=E5=BA=8F?= =?UTF-8?q?=E4=B8=8D=E4=B8=80=E8=87=B4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/multiselect/multiselect.combo.js | 4 +--- src/widget/multiselect/multiselect.insert.combo.js | 4 +--- .../multiselect/trigger/searcher.multiselect.insert.js | 6 ++---- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/widget/multiselect/multiselect.combo.js b/src/widget/multiselect/multiselect.combo.js index a564dce78..23d5385b8 100644 --- a/src/widget/multiselect/multiselect.combo.js +++ b/src/widget/multiselect/multiselect.combo.js @@ -284,13 +284,11 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { var self = this; var o = this.options; o.itemsCreator(op, function (res) { - var args = Array.prototype.slice.call(arguments); if (op.times === 1 && BI.isNotNull(op.keywords)) { // 预防trigger内部把当前的storeValue改掉 self.trigger.setValue(BI.deepClone(self.getValue())); } - args.push(op); - callback.apply(self, args); + callback.apply(self, arguments); }); }, diff --git a/src/widget/multiselect/multiselect.insert.combo.js b/src/widget/multiselect/multiselect.insert.combo.js index 8001ada8d..b1b4a202e 100644 --- a/src/widget/multiselect/multiselect.insert.combo.js +++ b/src/widget/multiselect/multiselect.insert.combo.js @@ -285,13 +285,11 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { _itemsCreator4Trigger: function (op, callback) { var self = this, o = this.options; o.itemsCreator(op, function (res) { - var args = Array.prototype.slice.call(arguments); if (op.times === 1 && BI.isNotNull(op.keywords)) { // 预防trigger内部把当前的storeValue改掉 self.trigger.setValue(BI.deepClone(self.getValue())); } - args.push(op); - callback.apply(self, args); + callback.apply(self, arguments); }); }, diff --git a/src/widget/multiselect/trigger/searcher.multiselect.insert.js b/src/widget/multiselect/trigger/searcher.multiselect.insert.js index 6fe8e0375..36b3a115f 100644 --- a/src/widget/multiselect/trigger/searcher.multiselect.insert.js +++ b/src/widget/multiselect/trigger/searcher.multiselect.insert.js @@ -62,12 +62,10 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, { itemsCreator: function (op, callback) { var keyword = self.editor.getKeyword(); op.keywords = [keyword]; - self.op = op; this.setKeyword(keyword); o.itemsCreator(op, function () { - var args = Array.prototype.slice.call(arguments); - if (BI.last(args) === self.op) { - callback.apply(null, args); + if (keyword === self.editor.getValue()) { + callback.apply(null, arguments); } }); }, From 5caa61da403468ffb85b91adce2a176a263409ee Mon Sep 17 00:00:00 2001 From: zsmj Date: Tue, 14 Jun 2022 11:00:01 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=97=A0JIRA=20fix:=20=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=A4=8D=E9=80=89=E4=B8=8B=E6=8B=89=E6=A1=86=E6=97=B6=E5=BA=8F?= =?UTF-8?q?=E4=B8=8D=E4=B8=80=E8=87=B4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/multiselect/trigger/searcher.multiselect.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/widget/multiselect/trigger/searcher.multiselect.js b/src/widget/multiselect/trigger/searcher.multiselect.js index 6a25a9f4a..4dbfbead7 100644 --- a/src/widget/multiselect/trigger/searcher.multiselect.js +++ b/src/widget/multiselect/trigger/searcher.multiselect.js @@ -60,7 +60,6 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, { itemsCreator: function (op, callback) { var keyword = self.editor.getValue(); op.keywords = [keyword]; - self.op = op; o.itemsCreator(op, function () { var keyword = self.editor.getValue(); op.keywords = [keyword];