Browse Source

Pull request #1521: 无JIRA任务 增加focus触发combo功能

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit '80a2e49bb77200272caecb833c025204339cf24c':
  bugfix
  增加focus触发combo功能
es6
guy 4 years ago
parent
commit
eaa475fdb4
  1. 1
      changelog.md
  2. 49
      src/base/combination/combo.js

1
changelog.md

@ -1,5 +1,6 @@
# 更新日志 # 更新日志
2.0(2020-09) 2.0(2020-09)
- combo增加focus作为触发条件功能
- allCountPager支持是否显示总行数 - allCountPager支持是否显示总行数
- 修复区间滑块setEnable(false)滑块不灰化的问题 - 修复区间滑块setEnable(false)滑块不灰化的问题
- 修复同步复选下拉框系列setValue所有值后触发器不显示全选的问题 - 修复同步复选下拉框系列setValue所有值后触发器不显示全选的问题

49
src/base/combination/combo.js

@ -9,6 +9,9 @@
var conf = BI.Combo.superclass._defaultConfig.apply(this, arguments); var conf = BI.Combo.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-combo" + (BI.isIE() ? " hack" : ""), baseCls: (conf.baseCls || "") + " bi-combo" + (BI.isIE() ? " hack" : ""),
attributes: {
tabIndex: 0
},
trigger: "click", trigger: "click",
toggle: true, toggle: true,
direction: "bottom", // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right||right,innerRight||right,innerLeft||innerRight||innerLeft 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; 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 () { 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("mousewheel." + this.getName())
.unbind("mouseenter." + this.getName()) .unbind("mouseenter." + this.getName())
.unbind("mousemove." + 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()); BI.Resizers.remove(this.getName());
this.popupView && this.popupView._destroy(); this.popupView && this.popupView._destroy();
delete needHideWhenAnotherComboOpen[this.getName()]; delete needHideWhenAnotherComboOpen[this.getName()];

Loading…
Cancel
Save