Browse Source

DEC-15275 fix: 平台菜单栏竟然不是移出不消失的,反人类

(cherry picked from commit a57812536db59b0a4dfb9b6a3fc9df9bd60fd60f)
es6
zsmj1994 4 years ago
parent
commit
2add8a4ed7
  1. 82
      src/base/combination/combo.js

82
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);
@ -181,45 +181,49 @@
}); });
break; break;
case "click-hover": case "click-hover":
var debounce = BI.debounce(function (e) { case "click-blur":
if (self.combo.element.__isMouseInBounds__(e)) { // IE走click-hover逻辑
if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) { if (BI.isIE() || ev === "click-hover") {
// if (self.isViewVisible()) { var debounce = BI.debounce(function (e) {
// return; if (self.combo.element.__isMouseInBounds__(e)) {
// } if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) {
self._popupView(e); // if (self.isViewVisible()) {
if (self.isViewVisible()) { // return;
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo); // }
self.fireEvent(BI.Combo.EVENT_EXPAND); self._popupView(e);
if (self.isViewVisible()) {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo);
self.fireEvent(BI.Combo.EVENT_EXPAND);
}
} }
} }
} }, BI.EVENT_RESPONSE_TIME, {
}, BI.EVENT_RESPONSE_TIME, { "leading": true,
"leading": true, "trailing": false
"trailing": false });
}); 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); st(e);
st(e); });
}); self.element.on("mouseleave." + self.getName(), function (e) {
self.element.on("mouseleave." + self.getName(), function (e) { if (self.popupView) {
if (self.popupView) { self.popupView.element.on("mouseenter." + self.getName(), function (e) {
self.popupView.element.on("mouseenter." + self.getName(), function (e) { enterPopup = true;
enterPopup = true; self.popupView.element.on("mouseleave." + self.getName(), function (e) {
self.popupView.element.on("mouseleave." + self.getName(), function (e) { hide(e);
hide(e); });
self.popupView.element.off("mouseenter." + self.getName());
}); });
self.popupView.element.off("mouseenter." + self.getName()); BI.defer(function () {
}); if (!enterPopup) {
BI.defer(function () { hide(e);
if (!enterPopup) { }
hide(e); }, 50);
} }
}, 50); });
} break;
}); }
break;
case "click-blur":
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()) {
@ -295,7 +299,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