Browse Source

combo的hidewhenanothercomboopen

master
guy 4 years ago
parent
commit
60a7456741
  1. 34
      src/base/combination/combo.js

34
src/base/combination/combo.js

@ -88,13 +88,13 @@
}, this)); }, this));
}, },
_toggle: function () { _toggle: function (e) {
this._assertPopupViewRender(); this._assertPopupViewRender();
if (this.popupView.isVisible()) { if (this.popupView.isVisible()) {
this._hideView(); this._hideView(e);
} else { } else {
if (this.isEnabled()) { if (this.isEnabled()) {
this._popupView(); this._popupView(e);
} }
} }
}, },
@ -113,9 +113,9 @@
var enterPopup = false; var enterPopup = false;
function hide () { 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(); 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);
self.fireEvent(BI.Combo.EVENT_COLLAPSE); self.fireEvent(BI.Combo.EVENT_COLLAPSE);
} }
@ -128,7 +128,7 @@
case "hover": case "hover":
self.element.on("mouseenter." + self.getName(), function (e) { self.element.on("mouseenter." + self.getName(), function (e) {
if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) { if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) {
self._popupView(); self._popupView(e);
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);
} }
@ -138,13 +138,13 @@
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(); hide(e);
}); });
self.popupView.element.off("mouseenter." + self.getName()); self.popupView.element.off("mouseenter." + self.getName());
}); });
BI.defer(function () { BI.defer(function () {
if (!enterPopup) { if (!enterPopup) {
hide(); hide(e);
} }
}, 50); }, 50);
} }
@ -157,7 +157,7 @@
// if (!o.toggle && self.isViewVisible()) { // if (!o.toggle && self.isViewVisible()) {
// return; // return;
// } // }
o.toggle ? self._toggle() : self._popupView(); 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);
@ -183,7 +183,7 @@
// if (self.isViewVisible()) { // if (self.isViewVisible()) {
// return; // return;
// } // }
self._popupView(); 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);
@ -203,13 +203,13 @@
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(); hide(e);
}); });
self.popupView.element.off("mouseenter." + self.getName()); self.popupView.element.off("mouseenter." + self.getName());
}); });
BI.defer(function () { BI.defer(function () {
if (!enterPopup) { if (!enterPopup) {
hide(); hide(e);
} }
}, 50); }, 50);
} }
@ -261,17 +261,17 @@
} }
}, },
_hideIf: function (e) { _hideIf: function (e, skipTriggerChecker) {
// if (this.element.__isMouseInBounds__(e) || (this.popupView && this.popupView.element.__isMouseInBounds__(e))) { // if (this.element.__isMouseInBounds__(e) || (this.popupView && this.popupView.element.__isMouseInBounds__(e))) {
// return; // return;
// } // }
// BI-10290 公式combo双击公式内容会收起 // BI-10290 公式combo双击公式内容会收起
if ((this.element.find(e.target).length > 0) if (e && ((!skipTriggerChecker && this.element.find(e.target).length > 0)
|| (this.popupView && this.popupView.element.find(e.target).length > 0) || (this.popupView && this.popupView.element.find(e.target).length > 0)
|| e.target.className === "CodeMirror-cursor" || BI.Widget._renderEngine.createElement(e.target).closest(".CodeMirror-hints").length > 0) {// BI-9887 CodeMirror的公式弹框需要特殊处理下 || e.target.className === "CodeMirror-cursor" || BI.Widget._renderEngine.createElement(e.target).closest(".CodeMirror-hints").length > 0)) {// BI-9887 CodeMirror的公式弹框需要特殊处理下
var directions = this.options.direction.split(","); var directions = this.options.direction.split(",");
if (BI.contains(directions, "innerLeft") || BI.contains(directions, "innerRight")) { if (BI.contains(directions, "innerLeft") || BI.contains(directions, "innerRight")) {
// popup可以出现trigger内部的combo,滚动时不需要消失,而是调整位置 // popup可以出现trigger内部的combo,滚动时不需要消失,而是调整位置
this.adjustWidth(); this.adjustWidth();
this.adjustHeight(); this.adjustHeight();
} }
@ -309,7 +309,7 @@
this.popupView.visible(); this.popupView.visible();
BI.each(needHideWhenAnotherComboOpen, function (i, combo) { BI.each(needHideWhenAnotherComboOpen, function (i, combo) {
if (i !== self.getName()) { if (i !== self.getName()) {
if (combo && combo._hideIf(e)) { if (combo && combo._hideIf(e, true)) {
delete needHideWhenAnotherComboOpen[i]; delete needHideWhenAnotherComboOpen[i];
} }
} }

Loading…
Cancel
Save