diff --git a/changelog.md b/changelog.md index be8d9b9a7d..d250d3e416 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,6 @@ # 更新日志 2.0(2020-09) -- combo增加focus作为触发条件功能 +- combo增加click-blur(点击显示,blur消失)作为触发条件功能 - allCountPager支持是否显示总行数 - 修复区间滑块setEnable(false)滑块不灰化的问题 - 修复同步复选下拉框系列setValue所有值后触发器不显示全选的问题 diff --git a/src/base/combination/combo.js b/src/base/combination/combo.js index 03f42e9390..481a550d05 100644 --- a/src/base/combination/combo.js +++ b/src/base/combination/combo.js @@ -219,14 +219,14 @@ } }); break; - case "focus": + case "click-blur": 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); + o.toggle ? self._toggle(e) : self._popupView(e); if (self.isViewVisible()) { self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo); self.fireEvent(BI.Combo.EVENT_EXPAND); @@ -241,6 +241,7 @@ "trailing": false }); self.element.off("click." + self.getName()).on("click." + self.getName(), function (e) { + debounce(e); try { self.element[0].focus(); } catch (e) { @@ -248,10 +249,6 @@ } 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); @@ -576,7 +573,6 @@ .unbind("mouseenter." + this.getName()) .unbind("mousemove." + this.getName()) .unbind("mouseleave." + this.getName()) - .unbind("focus." + this.getName()) .unbind("blur." + this.getName()); BI.Resizers.remove(this.getName()); this.popupView && this.popupView._destroy();