From 82da0fbda8767ffc4abd7a04b6c81378d95e7903 Mon Sep 17 00:00:00 2001 From: "Jimmy.Chai" Date: Tue, 20 Jul 2021 15:34:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?BI-90461=20fix=EF=BC=9A=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=85=A8=E9=80=89=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../multiselect/multiselect.insert.combo.js | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/widget/multiselect/multiselect.insert.combo.js b/src/widget/multiselect/multiselect.insert.combo.js index 9c3b97909..479f9891c 100644 --- a/src/widget/multiselect/multiselect.insert.combo.js +++ b/src/widget/multiselect/multiselect.insert.combo.js @@ -350,25 +350,21 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { var self = this, o = this.options; this._assertValue(res); this.requesting = true; + if (this.storeValue.type === res.type) { + var result = BI.Func.getSearchResult(this.storeValue.value, this.trigger.getKey()); + var resultArray = BI.concat(result.match, result.find); + this.storeValue.value = BI.filter(this.storeValue.value, function (i, value) { + return !BI.contains(resultArray, value); + }) || []; + this._adjust(callback); + return; + } o.itemsCreator({ type: BI.MultiSelectInsertCombo.REQ_GET_ALL_DATA, - keywords: [this.trigger.getKey()] + keywords: [this.trigger.getKey()], + selectedValues: this.storeValue.value, }, function (ob) { var items = BI.map(ob.items, "value"); - if (self.storeValue.type === res.type) { - var change = false; - var map = self._makeMap(self.storeValue.value); - BI.each(items, function (i, v) { - if (BI.isNotNull(map[v])) { - change = true; - self.storeValue.assist && self.storeValue.assist.push(map[v]); - delete map[v]; - } - }); - change && (self.storeValue.value = BI.values(map)); - self._adjust(callback); - return; - } var selectedMap = self._makeMap(self.storeValue.value); var notSelectedMap = self._makeMap(res.value); var newItems = []; From c7f463589927ea6b98c5af552f003ccde64dbcb5 Mon Sep 17 00:00:00 2001 From: "Jimmy.Chai" Date: Tue, 20 Jul 2021 17:19:26 +0800 Subject: [PATCH 2/2] =?UTF-8?q?BI-90461=20fix=EF=BC=9A=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=85=A8=E9=80=89=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/multiselect/multiselect.combo.js | 31 +++++++++--------- .../multiselect/multiselect.combo.nobar.js | 32 ++++++++++--------- .../multiselect/multiselect.insert.combo.js | 14 +++++--- .../multiselect.insert.combo.nobar.js | 32 ++++++++++--------- .../multiselectlist/multiselectlist.insert.js | 30 +++++++++-------- .../multiselectlist.insert.nobar.js | 30 +++++++++-------- src/widget/multiselectlist/multiselectlist.js | 30 +++++++++-------- 7 files changed, 108 insertions(+), 91 deletions(-) diff --git a/src/widget/multiselect/multiselect.combo.js b/src/widget/multiselect/multiselect.combo.js index 0dc2550de..c61770dcc 100644 --- a/src/widget/multiselect/multiselect.combo.js +++ b/src/widget/multiselect/multiselect.combo.js @@ -336,26 +336,27 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { var self = this; var o = this.options; this._assertValue(res); this.requesting = true; + if (this.storeValue.type === res.type) { + var result = BI.Func.getSearchResult(this.storeValue.value, this.trigger.getKey()); + var change = false; + var map = this._makeMap(this.storeValue.value); + BI.each(BI.concat(result.match, result.find), function (i, v) { + if (BI.isNotNull(map[v])) { + change = true; + self.storeValue.assist && self.storeValue.assist.push(map[v]); + delete map[v]; + } + }); + change && (this.storeValue.value = BI.values(map)); + this._adjust(callback); + return; + } o.itemsCreator({ type: BI.MultiSelectCombo.REQ_GET_ALL_DATA, keywords: [this.trigger.getKey()], + selectedValues: this.storeValue.value, }, function (ob) { var items = BI.map(ob.items, "value"); - if (self.storeValue.type === res.type) { - var change = false; - var map = self._makeMap(self.storeValue.value); - BI.each(items, function (i, v) { - if (BI.isNotNull(map[v])) { - change = true; - self.storeValue.assist && self.storeValue.assist.push(map[v]); - delete map[v]; - } - }); - change && (self.storeValue.value = BI.values(map)); - self._adjust(callback); - -return; - } var selectedMap = self._makeMap(self.storeValue.value); var notSelectedMap = self._makeMap(res.value); var newItems = []; diff --git a/src/widget/multiselect/multiselect.combo.nobar.js b/src/widget/multiselect/multiselect.combo.nobar.js index 70c6b5db2..eab1f4b2f 100644 --- a/src/widget/multiselect/multiselect.combo.nobar.js +++ b/src/widget/multiselect/multiselect.combo.nobar.js @@ -363,25 +363,27 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, { var self = this, o = this.options; this._assertValue(res); this.requesting = true; + if (this.storeValue.type === res.type) { + var result = BI.Func.getSearchResult(this.storeValue.value, this.trigger.getKey()); + var change = false; + var map = self._makeMap(this.storeValue.value); + BI.each(BI.concat(result.match, result.find), function (i, v) { + if (BI.isNotNull(map[v])) { + change = true; + self.storeValue.assist && self.storeValue.assist.push(map[v]); + delete map[v]; + } + }); + change && (this.storeValue.value = BI.values(map)); + this._adjust(callback); + return; + } o.itemsCreator({ type: BI.MultiSelectNoBarCombo.REQ_GET_ALL_DATA, - keywords: [this.trigger.getKey()] + keywords: [this.trigger.getKey()], + selectedValues: this.storeValue.value, }, function (ob) { var items = BI.map(ob.items, "value"); - if (self.storeValue.type === res.type) { - var change = false; - var map = self._makeMap(self.storeValue.value); - BI.each(items, function (i, v) { - if (BI.isNotNull(map[v])) { - change = true; - self.storeValue.assist && self.storeValue.assist.push(map[v]); - delete map[v]; - } - }); - change && (self.storeValue.value = BI.values(map)); - self._adjust(callback); - return; - } var selectedMap = self._makeMap(self.storeValue.value); var notSelectedMap = self._makeMap(res.value); var newItems = []; diff --git a/src/widget/multiselect/multiselect.insert.combo.js b/src/widget/multiselect/multiselect.insert.combo.js index 479f9891c..4a84e5123 100644 --- a/src/widget/multiselect/multiselect.insert.combo.js +++ b/src/widget/multiselect/multiselect.insert.combo.js @@ -352,10 +352,16 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { this.requesting = true; if (this.storeValue.type === res.type) { var result = BI.Func.getSearchResult(this.storeValue.value, this.trigger.getKey()); - var resultArray = BI.concat(result.match, result.find); - this.storeValue.value = BI.filter(this.storeValue.value, function (i, value) { - return !BI.contains(resultArray, value); - }) || []; + var change = false; + var map = this._makeMap(this.storeValue.value); + BI.each(BI.concat(result.match, result.find), function (i, v) { + if (BI.isNotNull(map[v])) { + change = true; + self.storeValue.assist && self.storeValue.assist.push(map[v]); + delete map[v]; + } + }); + change && (this.storeValue.value = BI.values(map)); this._adjust(callback); return; } diff --git a/src/widget/multiselect/multiselect.insert.combo.nobar.js b/src/widget/multiselect/multiselect.insert.combo.nobar.js index 0bd836397..a4a67579d 100644 --- a/src/widget/multiselect/multiselect.insert.combo.nobar.js +++ b/src/widget/multiselect/multiselect.insert.combo.nobar.js @@ -348,25 +348,27 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, { var self = this, o = this.options; this._assertValue(res); this.requesting = true; + if (this.storeValue.type === res.type) { + var result = BI.Func.getSearchResult(this.storeValue.value, this.trigger.getKey()); + var change = false; + var map = this._makeMap(this.storeValue.value); + BI.each(BI.concat(result.match, result.find), function (i, v) { + if (BI.isNotNull(map[v])) { + change = true; + self.storeValue.assist && self.storeValue.assist.push(map[v]); + delete map[v]; + } + }); + change && (this.storeValue.value = BI.values(map)); + this._adjust(callback); + return; + } o.itemsCreator({ type: BI.MultiSelectInsertNoBarCombo.REQ_GET_ALL_DATA, - keywords: [this.trigger.getKey()] + keywords: [this.trigger.getKey()], + selectedValues: this.storeValue.value, }, function (ob) { var items = BI.map(ob.items, "value"); - if (self.storeValue.type === res.type) { - var change = false; - var map = self._makeMap(self.storeValue.value); - BI.each(items, function (i, v) { - if (BI.isNotNull(map[v])) { - change = true; - self.storeValue.assist && self.storeValue.assist.push(map[v]); - delete map[v]; - } - }); - change && (self.storeValue.value = BI.values(map)); - self._adjust(callback); - return; - } var selectedMap = self._makeMap(self.storeValue.value); var notSelectedMap = self._makeMap(res.value); var newItems = []; diff --git a/src/widget/multiselectlist/multiselectlist.insert.js b/src/widget/multiselectlist/multiselectlist.insert.js index 419e96eb3..a7b5bf274 100644 --- a/src/widget/multiselectlist/multiselectlist.insert.js +++ b/src/widget/multiselectlist/multiselectlist.insert.js @@ -239,24 +239,26 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, { _joinAll: function (res, callback) { var self = this, o = this.options; this._assertValue(res); + if (this.storeValue.type === res.type) { + var result = BI.Func.getSearchResult(this.storeValue.value, this.trigger.getKey()); + var change = false; + var map = this._makeMap(this.storeValue.value); + BI.each(BI.concat(result.match, result.find), function (i, v) { + if (BI.isNotNull(map[v])) { + change = true; + delete map[v]; + } + }); + change && (this.storeValue.value = BI.values(map)); + callback(); + return; + } o.itemsCreator({ type: BI.MultiSelectInsertList.REQ_GET_ALL_DATA, - keywords: [self.trigger.getKeyword()] + keywords: [this.trigger.getKeyword()], + selectedValues: this.storeValue.value, }, function (ob) { var items = BI.map(ob.items, "value"); - if (self.storeValue.type === res.type) { - var change = false; - var map = self._makeMap(self.storeValue.value); - BI.each(items, function (i, v) { - if (BI.isNotNull(map[v])) { - change = true; - delete map[v]; - } - }); - change && (self.storeValue.value = BI.values(map)); - callback(); - return; - } var selectedMap = self._makeMap(self.storeValue.value); var notSelectedMap = self._makeMap(res.value); var newItems = []; diff --git a/src/widget/multiselectlist/multiselectlist.insert.nobar.js b/src/widget/multiselectlist/multiselectlist.insert.nobar.js index 9b0e7b21e..80f55f1d0 100644 --- a/src/widget/multiselectlist/multiselectlist.insert.nobar.js +++ b/src/widget/multiselectlist/multiselectlist.insert.nobar.js @@ -243,24 +243,26 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, { _joinAll: function (res, callback) { var self = this, o = this.options; this._assertValue(res); + if (this.storeValue.type === res.type) { + var result = BI.Func.getSearchResult(this.storeValue.value, this.trigger.getKey()); + var change = false; + var map = this._makeMap(this.storeValue.value); + BI.each(BI.concat(result.match, result.find), function (i, v) { + if (BI.isNotNull(map[v])) { + change = true; + delete map[v]; + } + }); + change && (this.storeValue.value = BI.values(map)); + callback(); + return; + } o.itemsCreator({ type: BI.MultiSelectInsertNoBarList.REQ_GET_ALL_DATA, - keywords: [self.trigger.getKeyword()] + keywords: [this.trigger.getKeyword()], + selectedValues: this.storeValue.value, }, function (ob) { var items = BI.map(ob.items, "value"); - if (self.storeValue.type === res.type) { - var change = false; - var map = self._makeMap(self.storeValue.value); - BI.each(items, function (i, v) { - if (BI.isNotNull(map[v])) { - change = true; - delete map[v]; - } - }); - change && (self.storeValue.value = BI.values(map)); - callback(); - return; - } var selectedMap = self._makeMap(self.storeValue.value); var notSelectedMap = self._makeMap(res.value); var newItems = []; diff --git a/src/widget/multiselectlist/multiselectlist.js b/src/widget/multiselectlist/multiselectlist.js index feea0fb2f..3eafb0269 100644 --- a/src/widget/multiselectlist/multiselectlist.js +++ b/src/widget/multiselectlist/multiselectlist.js @@ -229,24 +229,26 @@ BI.MultiSelectList = BI.inherit(BI.Widget, { _joinAll: function (res, callback) { var self = this, o = this.options; this._assertValue(res); + if (this.storeValue.type === res.type) { + var result = BI.Func.getSearchResult(this.storeValue.value, this.trigger.getKey()); + var change = false; + var map = this._makeMap(this.storeValue.value); + BI.each(BI.concat(result.match, result.find), function (i, v) { + if (BI.isNotNull(map[v])) { + change = true; + delete map[v]; + } + }); + change && (this.storeValue.value = BI.values(map)); + this._adjust(callback); + return; + } o.itemsCreator({ type: BI.MultiSelectList.REQ_GET_ALL_DATA, - keywords: [this.trigger.getKey()] + keywords: [this.trigger.getKey()], + selectedValues: this.storeValue.value, }, function (ob) { var items = BI.map(ob.items, "value"); - if (self.storeValue.type === res.type) { - var change = false; - var map = self._makeMap(self.storeValue.value); - BI.each(items, function (i, v) { - if (BI.isNotNull(map[v])) { - change = true; - delete map[v]; - } - }); - change && (self.storeValue.value = BI.values(map)); - self._adjust(callback); - return; - } var selectedMap = self._makeMap(self.storeValue.value); var notSelectedMap = self._makeMap(res.value); var newItems = [];