|
|
@ -288,13 +288,13 @@ BI.Combo = BI.inherit(BI.Widget, { |
|
|
|
this.fireEvent(BI.Combo.EVENT_AFTER_HIDEVIEW); |
|
|
|
this.fireEvent(BI.Combo.EVENT_AFTER_HIDEVIEW); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_popupView: function () { |
|
|
|
_popupView: function (e) { |
|
|
|
this._assertPopupViewRender(); |
|
|
|
this._assertPopupViewRender(); |
|
|
|
this.fireEvent(BI.Combo.EVENT_BEFORE_POPUPVIEW); |
|
|
|
this.fireEvent(BI.Combo.EVENT_BEFORE_POPUPVIEW); |
|
|
|
|
|
|
|
|
|
|
|
this.popupView.visible(); |
|
|
|
this.popupView.visible(); |
|
|
|
this.adjustWidth(); |
|
|
|
this.adjustWidth(e); |
|
|
|
this.adjustHeight(); |
|
|
|
this.adjustHeight(e); |
|
|
|
|
|
|
|
|
|
|
|
this.element.addClass(this.options.comboClass); |
|
|
|
this.element.addClass(this.options.comboClass); |
|
|
|
BI.Widget._renderEngine.createElement(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName()); |
|
|
|
BI.Widget._renderEngine.createElement(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName()); |
|
|
@ -302,7 +302,7 @@ BI.Combo = BI.inherit(BI.Widget, { |
|
|
|
this.fireEvent(BI.Combo.EVENT_AFTER_POPUPVIEW); |
|
|
|
this.fireEvent(BI.Combo.EVENT_AFTER_POPUPVIEW); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
adjustWidth: function () { |
|
|
|
adjustWidth: function (e) { |
|
|
|
var o = this.options; |
|
|
|
var o = this.options; |
|
|
|
if (!this.popupView) { |
|
|
|
if (!this.popupView) { |
|
|
|
return; |
|
|
|
return; |
|
|
@ -320,59 +320,84 @@ BI.Combo = BI.inherit(BI.Widget, { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
adjustHeight: function () { |
|
|
|
adjustHeight: function (e) { |
|
|
|
var o = this.options, p = {}; |
|
|
|
var o = this.options, p = {}; |
|
|
|
if (!this.popupView) { |
|
|
|
if (!this.popupView) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
var isVisible = this.popupView.isVisible(); |
|
|
|
var isVisible = this.popupView.isVisible(); |
|
|
|
this.popupView.visible(); |
|
|
|
this.popupView.visible(); |
|
|
|
|
|
|
|
var combo = BI.isNotNull(e) ? { |
|
|
|
|
|
|
|
element: { |
|
|
|
|
|
|
|
offset: function () { |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
left: e.pageX, |
|
|
|
|
|
|
|
top: e.pageY |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
bounds: function () { |
|
|
|
|
|
|
|
// offset为其相对于父定位元素的偏移
|
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
x: e.offsetX, |
|
|
|
|
|
|
|
y: e.offsetY, |
|
|
|
|
|
|
|
width: 0, |
|
|
|
|
|
|
|
height: 24 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
outerWidth: function () { |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
outerHeight: function () { |
|
|
|
|
|
|
|
return 24; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} : this.combo; |
|
|
|
switch (o.direction) { |
|
|
|
switch (o.direction) { |
|
|
|
case "bottom": |
|
|
|
case "bottom": |
|
|
|
case "bottom,right": |
|
|
|
case "bottom,right": |
|
|
|
p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ["bottom", "top", "right", "left"], o.offsetStyle); |
|
|
|
p = $.getComboPosition(combo, this.popupView, o.adjustXOffset, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ["bottom", "top", "right", "left"], o.offsetStyle); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case "top": |
|
|
|
case "top": |
|
|
|
case "top,right": |
|
|
|
case "top,right": |
|
|
|
p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ["top", "bottom", "right", "left"], o.offsetStyle); |
|
|
|
p = $.getComboPosition(combo, this.popupView, o.adjustXOffset, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ["top", "bottom", "right", "left"], o.offsetStyle); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case "left": |
|
|
|
case "left": |
|
|
|
case "left,bottom": |
|
|
|
case "left,bottom": |
|
|
|
p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["left", "right", "bottom", "top"], o.offsetStyle); |
|
|
|
p = $.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["left", "right", "bottom", "top"], o.offsetStyle); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case "right": |
|
|
|
case "right": |
|
|
|
case "right,bottom": |
|
|
|
case "right,bottom": |
|
|
|
p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "bottom", "top"], o.offsetStyle); |
|
|
|
p = $.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "bottom", "top"], o.offsetStyle); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case "top,left": |
|
|
|
case "top,left": |
|
|
|
p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ["top", "bottom", "left", "right"], o.offsetStyle); |
|
|
|
p = $.getComboPosition(combo, this.popupView, o.adjustXOffset, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ["top", "bottom", "left", "right"], o.offsetStyle); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case "bottom,left": |
|
|
|
case "bottom,left": |
|
|
|
p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ["bottom", "top", "left", "right"], o.offsetStyle); |
|
|
|
p = $.getComboPosition(combo, this.popupView, o.adjustXOffset, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight, ["bottom", "top", "left", "right"], o.offsetStyle); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case "left,top": |
|
|
|
case "left,top": |
|
|
|
p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["left", "right", "top", "bottom"], o.offsetStyle); |
|
|
|
p = $.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["left", "right", "top", "bottom"], o.offsetStyle); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case "right,top": |
|
|
|
case "right,top": |
|
|
|
p = $.getComboPosition(this.combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "top", "bottom"], o.offsetStyle); |
|
|
|
p = $.getComboPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength, o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "top", "bottom"], o.offsetStyle); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case "top,custom": |
|
|
|
case "top,custom": |
|
|
|
case "custom,top": |
|
|
|
case "custom,top": |
|
|
|
p = $.getTopAdaptPosition(this.combo, this.popupView, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight); |
|
|
|
p = $.getTopAdaptPosition(combo, this.popupView, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case "custom,bottom": |
|
|
|
case "custom,bottom": |
|
|
|
case "bottom,custom": |
|
|
|
case "bottom,custom": |
|
|
|
p = $.getBottomAdaptPosition(this.combo, this.popupView, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight); |
|
|
|
p = $.getBottomAdaptPosition(combo, this.popupView, o.adjustYOffset || o.adjustLength, o.isNeedAdjustHeight); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case "left,custom": |
|
|
|
case "left,custom": |
|
|
|
case "custom,left": |
|
|
|
case "custom,left": |
|
|
|
p = $.getLeftAdaptPosition(this.combo, this.popupView, o.adjustXOffset || o.adjustLength); |
|
|
|
p = $.getLeftAdaptPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength); |
|
|
|
delete p.top; |
|
|
|
delete p.top; |
|
|
|
delete p.adaptHeight; |
|
|
|
delete p.adaptHeight; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case "custom,right": |
|
|
|
case "custom,right": |
|
|
|
case "right,custom": |
|
|
|
case "right,custom": |
|
|
|
p = $.getRightAdaptPosition(this.combo, this.popupView, o.adjustXOffset || o.adjustLength); |
|
|
|
p = $.getRightAdaptPosition(combo, this.popupView, o.adjustXOffset || o.adjustLength); |
|
|
|
delete p.top; |
|
|
|
delete p.top; |
|
|
|
delete p.adaptHeight; |
|
|
|
delete p.adaptHeight; |
|
|
|
break; |
|
|
|
break; |
|
|
@ -443,9 +468,9 @@ BI.Combo = BI.inherit(BI.Widget, { |
|
|
|
return this.isEnabled() && this.combo.isEnabled() && !!this.popupView && this.popupView.isVisible(); |
|
|
|
return this.isEnabled() && this.combo.isEnabled() && !!this.popupView && this.popupView.isVisible(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
showView: function () { |
|
|
|
showView: function (e) { |
|
|
|
if (this.isEnabled() && this.combo.isEnabled()) { |
|
|
|
if (this.isEnabled() && this.combo.isEnabled()) { |
|
|
|
this._popupView(); |
|
|
|
this._popupView(e); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|