Browse Source

增加一个可以外部暴露的方法

es6
guy 5 years ago
parent
commit
d80c0c7696
  1. 39
      src/base/combination/combo.js

39
src/base/combination/combo.js

@ -1,8 +1,10 @@
/**
!(function () {
var needHideWhenAnotherComboOpen = {};
/**
* @class BI.Combo
* @extends BI.Widget
*/
BI.Combo = BI.inherit(BI.Widget, {
BI.Combo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.Combo.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
@ -16,6 +18,7 @@ BI.Combo = BI.inherit(BI.Widget, {
container: null, // popupview放置的容器,默认为this.element
isDefaultInit: false,
destroyWhenHide: false,
hideWhenAnotherComboOpen: false,
isNeedAdjustHeight: true, // 是否需要高度调整
isNeedAdjustWidth: true,
stopEvent: false,
@ -74,7 +77,7 @@ BI.Combo = BI.inherit(BI.Widget, {
element: this
}, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, {
items: [
{ el: this.combo }
{el: this.combo}
]
}))));
o.isDefaultInit && (this._assertPopupView());
@ -291,6 +294,7 @@ BI.Combo = BI.inherit(BI.Widget, {
this.popupView && this.popupView.invisible();
}
this.element.removeClass(this.options.comboClass);
delete needHideWhenAnotherComboOpen[this.getName()];
BI.Widget._renderEngine.createElement(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName());
this.fireEvent(BI.Combo.EVENT_AFTER_HIDEVIEW);
@ -301,6 +305,11 @@ BI.Combo = BI.inherit(BI.Widget, {
this.fireEvent(BI.Combo.EVENT_BEFORE_POPUPVIEW);
this.popupView.visible();
BI.each(needHideWhenAnotherComboOpen, function(i, combo){
combo && combo.hideView();
});
needHideWhenAnotherComboOpen = {};
this.options.hideWhenAnotherComboOpen && (needHideWhenAnotherComboOpen[this.getName()] = this);
this.adjustWidth(e);
this.adjustHeight(e);
@ -519,18 +528,20 @@ BI.Combo = BI.inherit(BI.Widget, {
.unbind("mouseleave." + this.getName());
BI.Resizers.remove(this.getName());
this.popupView && this.popupView._destroy();
delete needHideWhenAnotherComboOpen[this.getName()];
}
});
BI.Combo.EVENT_TRIGGER_CHANGE = "EVENT_TRIGGER_CHANGE";
BI.Combo.EVENT_CHANGE = "EVENT_CHANGE";
BI.Combo.EVENT_EXPAND = "EVENT_EXPAND";
BI.Combo.EVENT_COLLAPSE = "EVENT_COLLAPSE";
BI.Combo.EVENT_AFTER_INIT = "EVENT_AFTER_INIT";
});
BI.Combo.EVENT_TRIGGER_CHANGE = "EVENT_TRIGGER_CHANGE";
BI.Combo.EVENT_CHANGE = "EVENT_CHANGE";
BI.Combo.EVENT_EXPAND = "EVENT_EXPAND";
BI.Combo.EVENT_COLLAPSE = "EVENT_COLLAPSE";
BI.Combo.EVENT_AFTER_INIT = "EVENT_AFTER_INIT";
BI.Combo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.Combo.EVENT_AFTER_POPUPVIEW = "EVENT_AFTER_POPUPVIEW";
BI.Combo.EVENT_BEFORE_HIDEVIEW = "EVENT_BEFORE_HIDEVIEW";
BI.Combo.EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW";
BI.Combo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.Combo.EVENT_AFTER_POPUPVIEW = "EVENT_AFTER_POPUPVIEW";
BI.Combo.EVENT_BEFORE_HIDEVIEW = "EVENT_BEFORE_HIDEVIEW";
BI.Combo.EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW";
BI.shortcut("bi.combo", BI.Combo);
BI.shortcut("bi.combo", BI.Combo);
}());

Loading…
Cancel
Save