From 57ca936991aa83cb7c598d4935e9c799df2a4206 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 30 Sep 2020 16:52:34 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0focus=E8=A7=A6=E5=8F=91co?= =?UTF-8?q?mbo=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/combination/combo.js | 49 +++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/src/base/combination/combo.js b/src/base/combination/combo.js index 62dde79f8..03f42e939 100644 --- a/src/base/combination/combo.js +++ b/src/base/combination/combo.js @@ -9,6 +9,9 @@ var conf = BI.Combo.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-combo" + (BI.isIE() ? " hack" : ""), + attributes: { + tabIndex: 0 + }, trigger: "click", toggle: true, direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right||right,innerRight||right,innerLeft||innerRight||innerLeft @@ -216,6 +219,44 @@ } }); break; + case "focus": + var debounce = BI.debounce(function (e) { + if (self.combo.element.__isMouseInBounds__(e)) { + if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) { + // if (!o.toggle && self.isViewVisible()) { + // return; + // } + self._popupView(e); + if (self.isViewVisible()) { + self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo); + self.fireEvent(BI.Combo.EVENT_EXPAND); + } else { + self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, "", self.combo); + self.fireEvent(BI.Combo.EVENT_COLLAPSE); + } + } + } + }, BI.EVENT_RESPONSE_TIME, { + "leading": true, + "trailing": false + }); + self.element.off("click." + self.getName()).on("click." + self.getName(), function (e) { + try { + self.element[0].focus(); + } catch (e) { + + } + st(e); + }); + self.element.off("focus." + self.getName()).on("focus." + self.getName(), function (e) { + debounce(e); + st(e); + }); + self.element.off("blur." + self.getName()).on("blur." + self.getName(), function (e) { + self._hideView(e); + st(e); + }); + break; } }); }, @@ -528,11 +569,15 @@ }, destroyed: function () { - BI.Widget._renderEngine.createElement(document).unbind("mousedown." + this.getName()) + BI.Widget._renderEngine.createElement(document) + .unbind("click." + this.getName()) + .unbind("mousedown." + this.getName()) .unbind("mousewheel." + this.getName()) .unbind("mouseenter." + this.getName()) .unbind("mousemove." + this.getName()) - .unbind("mouseleave." + this.getName()); + .unbind("mouseleave." + this.getName()) + .unbind("focus." + this.getName()) + .unbind("blur." + this.getName()); BI.Resizers.remove(this.getName()); this.popupView && this.popupView._destroy(); delete needHideWhenAnotherComboOpen[this.getName()]; From 80a2e49bb77200272caecb833c025204339cf24c Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 30 Sep 2020 16:53:25 +0800 Subject: [PATCH 2/2] bugfix --- changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index 43a9a70ce..be8d9b9a7 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # 更新日志 2.0(2020-09) +- combo增加focus作为触发条件功能 - allCountPager支持是否显示总行数 - 修复区间滑块setEnable(false)滑块不灰化的问题 - 修复同步复选下拉框系列setValue所有值后触发器不显示全选的问题