Browse Source

Revert "DEC-15325 fix: 解决click-blur popup挂在body上和IE11子元素触发blur场景"

This reverts commit 28bf2c834d.
es6
zsmj1994 4 years ago
parent
commit
09a8f9453a
  1. 33
      src/base/combination/combo.js

33
src/base/combination/combo.js

@ -81,7 +81,7 @@
element: this element: this
}, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, { }, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, {
items: [ items: [
{ el: this.combo } {el: this.combo}
] ]
})))); }))));
o.isDefaultInit && (this._assertPopupView()); o.isDefaultInit && (this._assertPopupView());
@ -117,7 +117,7 @@
var enterPopup = false; var enterPopup = false;
function hide(e) { function hide (e) {
if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid() && o.toggle === true) { if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid() && o.toggle === true) {
self._hideView(e); self._hideView(e);
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, "", self.combo); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, "", self.combo);
@ -223,17 +223,13 @@
var debounce = BI.debounce(function (e) { var debounce = BI.debounce(function (e) {
if (self.combo.element.__isMouseInBounds__(e)) { if (self.combo.element.__isMouseInBounds__(e)) {
if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) { if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) {
// if (!o.toggle && self.isViewVisible()) {
// return;
// }
o.toggle ? self._toggle(e) : self._popupView(e); o.toggle ? self._toggle(e) : self._popupView(e);
if (self.isViewVisible()) { if (self.isViewVisible()) {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo);
self.fireEvent(BI.Combo.EVENT_EXPAND); self.fireEvent(BI.Combo.EVENT_EXPAND);
self.popupView.element.off("mouseenter." + self.getName()).on("mouseenter." + self.getName(), function (e) {
enterPopup = true;
self.popupView.element.on("mouseleave." + self.getName(), function (e) {
enterPopup = false;
self.popupView.element.off("mouseleave." + self.getName());
});
});
} else { } else {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, "", self.combo); self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, "", self.combo);
self.fireEvent(BI.Combo.EVENT_COLLAPSE); self.fireEvent(BI.Combo.EVENT_COLLAPSE);
@ -247,30 +243,15 @@
self.element.off("click." + self.getName()).on("click." + self.getName(), function (e) { self.element.off("click." + self.getName()).on("click." + self.getName(), function (e) {
debounce(e); debounce(e);
try { try {
self.element.focus(); self.element[0].focus();
} catch (e) { } catch (e) {
} }
st(e); st(e);
}); });
var enterCombo = false;
self.combo.element.off("mouseenter." + self.getName()).on("mouseenter." + self.getName(), function (e) {
enterCombo = true;
self.combo.element.on("mouseleave." + self.getName(), function (e) {
enterCombo = false;
self.combo.element.off("mouseleave." + self.getName());
});
});
self.element.off("blur." + self.getName()).on("blur." + self.getName(), function (e) { self.element.off("blur." + self.getName()).on("blur." + self.getName(), function (e) {
if (self.isViewVisible()) { if (self.isViewVisible()) {
if (!enterCombo && !enterPopup) {
self._hideView(e); self._hideView(e);
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, "", self.combo);
self.fireEvent(BI.Combo.EVENT_COLLAPSE);
}
} }
st(e); st(e);
}); });
@ -314,7 +295,7 @@
scrolly: false, scrolly: false,
element: this.options.container || this, element: this.options.container || this,
items: [ items: [
{ el: this.popupView } {el: this.popupView}
] ]
}); });
this._rendered = true; this._rendered = true;

Loading…
Cancel
Save