From 8e3ff9347da2d9026dfe468d8b6b970fbbf7aa90 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 17 Jan 2022 20:14:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?chore:=20=E6=95=B4=E7=90=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/combination/combo.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/base/combination/combo.js b/src/base/combination/combo.js index e42cabb1e..2c4074e87 100644 --- a/src/base/combination/combo.js +++ b/src/base/combination/combo.js @@ -142,7 +142,9 @@ this.element.removeClass(this.options.comboClass); delete needHideWhenAnotherComboOpen[this.getName()]; - currentOpenedCombo = null; + if (currentOpenedCombo === this) { + currentOpenedCombo = null; + } BI.Widget._renderEngine.createElement(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName()); BI.EVENT_BLUR && o.hideWhenBlur && BI.Widget._renderEngine.createElement(window).unbind("blur." + this.getName()); From 7950575c93c4b628310c92c6fccc3d92736cf623 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 17 Jan 2022 20:17:30 +0800 Subject: [PATCH 2/2] =?UTF-8?q?chore:=20=E6=95=B4=E7=90=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/combination/combo.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/base/combination/combo.js b/src/base/combination/combo.js index 2c4074e87..58f1b23cd 100644 --- a/src/base/combination/combo.js +++ b/src/base/combination/combo.js @@ -1,6 +1,6 @@ !(function () { var needHideWhenAnotherComboOpen = {}; - var currentOpenedCombo; + var currentOpenedCombos = {}; /** * @class BI.Combo * @extends BI.Widget @@ -142,9 +142,7 @@ this.element.removeClass(this.options.comboClass); delete needHideWhenAnotherComboOpen[this.getName()]; - if (currentOpenedCombo === this) { - currentOpenedCombo = null; - } + delete currentOpenedCombos[this.getName()]; BI.Widget._renderEngine.createElement(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName()); BI.EVENT_BLUR && o.hideWhenBlur && BI.Widget._renderEngine.createElement(window).unbind("blur." + this.getName()); @@ -165,7 +163,7 @@ } } }); - !this.options.hideWhenAnotherComboOpen && (currentOpenedCombo = this); + currentOpenedCombos[this.getName()] = this; this.options.hideWhenAnotherComboOpen && (needHideWhenAnotherComboOpen[this.getName()] = this); this.adjustWidth(e); this.adjustHeight(e); @@ -305,19 +303,16 @@ BI.Resizers.remove(this.getName()); this.popupView && this.popupView._destroy(); delete needHideWhenAnotherComboOpen[this.getName()]; - if (currentOpenedCombo === this) { - currentOpenedCombo = null; - } + delete currentOpenedCombos[this.getName()]; } }); BI.Combo.closeAll = function () { - currentOpenedCombo && currentOpenedCombo.hideView(); - BI.each(needHideWhenAnotherComboOpen, function (i, combo) { + BI.each(currentOpenedCombos, function (i, combo) { if (combo) { combo.hideView(); } }); - currentOpenedCombo = null; + currentOpenedCombos = {}; needHideWhenAnotherComboOpen = {}; }; BI.Combo.EVENT_TRIGGER_CHANGE = "EVENT_TRIGGER_CHANGE";