|
|
|
@ -1,12 +1,25 @@
|
|
|
|
|
import { PopupView } from "../layer"; |
|
|
|
|
import { Bubble } from "./bubble"; |
|
|
|
|
import { |
|
|
|
|
shortcut, |
|
|
|
|
Widget, |
|
|
|
|
Controller, |
|
|
|
|
extend, |
|
|
|
|
createWidget, |
|
|
|
|
nextTick, |
|
|
|
|
bind, |
|
|
|
|
isNotNull, |
|
|
|
|
isNull, |
|
|
|
|
isFunction, |
|
|
|
|
each |
|
|
|
|
} from "@/core"; |
|
|
|
|
import { Resizers } from "@/base/0.base"; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @class BI.Combo |
|
|
|
|
* @extends BI.Widget |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
import { shortcut, Widget, Controller, extend, createWidget, nextTick, bind, isNotNull, isNull, isFunction, each } from "../../core"; |
|
|
|
|
import { Bubble } from "./bubble"; |
|
|
|
|
import { Resizers } from "../0.base"; |
|
|
|
|
|
|
|
|
|
let needHideWhenAnotherComboOpen = {}; |
|
|
|
|
let currentOpenedCombos = {}; |
|
|
|
|
|
|
|
|
@ -29,7 +42,7 @@ export class Combo extends Bubble {
|
|
|
|
|
const conf = super._defaultConfig(...arguments); |
|
|
|
|
|
|
|
|
|
return extend(conf, { |
|
|
|
|
baseCls: (conf.baseCls || "") + " bi-combo" + (BI.isIE() ? " hack" : ""), |
|
|
|
|
baseCls: `${conf.baseCls || ""} bi-combo${BI.isIE() ? " hack" : ""}`, |
|
|
|
|
attributes: { |
|
|
|
|
tabIndex: -1, |
|
|
|
|
}, |
|
|
|
@ -96,42 +109,55 @@ export class Combo extends Bubble {
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.element.on("mouseenter." + this.getName(), (e) => { |
|
|
|
|
this.element.on(`mouseenter.${this.getName()}`, e => { |
|
|
|
|
if (this.isEnabled() && this.isValid() && this.combo.isEnabled() && this.combo.isValid()) { |
|
|
|
|
this.element.addClass(hoverClass); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
this.element.on("mouseleave." + this.getName(), (e) => { |
|
|
|
|
this.element.on(`mouseleave.${this.getName()}`, e => { |
|
|
|
|
if (this.isEnabled() && this.isValid() && this.combo.isEnabled() && this.combo.isValid()) { |
|
|
|
|
this.element.removeClass(hoverClass); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
createWidget(extend({ |
|
|
|
|
createWidget( |
|
|
|
|
extend( |
|
|
|
|
{ |
|
|
|
|
element: this, |
|
|
|
|
scrolly: false, |
|
|
|
|
}, BI.LogicFactory.createLogic("vertical", extend(logic, { |
|
|
|
|
items: [ |
|
|
|
|
{ el: this.combo } |
|
|
|
|
], |
|
|
|
|
})))); |
|
|
|
|
isDefaultInit && (this._assertPopupView()); |
|
|
|
|
Resizers.add(this.getName(), bind((e) => { |
|
|
|
|
}, |
|
|
|
|
BI.LogicFactory.createLogic( |
|
|
|
|
"vertical", |
|
|
|
|
extend(logic, { |
|
|
|
|
items: [{ el: this.combo }], |
|
|
|
|
}) |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
isDefaultInit && this._assertPopupView(); |
|
|
|
|
Resizers.add( |
|
|
|
|
this.getName(), |
|
|
|
|
bind(e => { |
|
|
|
|
// 如果resize对象是combo的子元素,则不应该收起,或交由hideChecker去处理
|
|
|
|
|
if (this.isViewVisible()) { |
|
|
|
|
isNotNull(e) ? this._hideIf(e) : this._hideView(); |
|
|
|
|
} |
|
|
|
|
}, this)); |
|
|
|
|
}, this) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_assertPopupView() { |
|
|
|
|
const { showArrow, value, hideWhenClickOutside, hideWhenBlur } = this.options; |
|
|
|
|
if (isNull(this.popupView)) { |
|
|
|
|
this.popupView = createWidget(isFunction(this.options.popup) ? this.options.popup() : this.options.popup, { |
|
|
|
|
type: "bi.popup_view", |
|
|
|
|
this.popupView = createWidget( |
|
|
|
|
isFunction(this.options.popup) ? this.options.popup() : this.options.popup, |
|
|
|
|
{ |
|
|
|
|
type: PopupView.xtype, |
|
|
|
|
showArrow, |
|
|
|
|
value, |
|
|
|
|
}, this); |
|
|
|
|
}, |
|
|
|
|
this |
|
|
|
|
); |
|
|
|
|
this.popupView.on(Controller.EVENT_CHANGE, (type, value, obj, ...args) => { |
|
|
|
|
if (type === BI.Events.CLICK) { |
|
|
|
|
this.combo.setValue(this.getValue()); |
|
|
|
@ -167,8 +193,12 @@ export class Combo extends Bubble {
|
|
|
|
|
delete needHideWhenAnotherComboOpen[this.getName()]; |
|
|
|
|
delete currentOpenedCombos[this.getName()]; |
|
|
|
|
|
|
|
|
|
hideWhenClickOutside && Widget._renderEngine.createElement(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName()); |
|
|
|
|
BI.EVENT_BLUR && hideWhenBlur && Widget._renderEngine.createElement(window).unbind("blur." + this.getName()); |
|
|
|
|
hideWhenClickOutside && |
|
|
|
|
Widget._renderEngine |
|
|
|
|
.createElement(document) |
|
|
|
|
.unbind(`mousedown.${this.getName()}`) |
|
|
|
|
.unbind(`mousewheel.${this.getName()}`); |
|
|
|
|
BI.EVENT_BLUR && hideWhenBlur && Widget._renderEngine.createElement(window).unbind(`blur.${this.getName()}`); |
|
|
|
|
this.fireEvent(Combo.EVENT_AFTER_HIDEVIEW, e); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -192,25 +222,49 @@ export class Combo extends Bubble {
|
|
|
|
|
this.adjustHeight(e); |
|
|
|
|
|
|
|
|
|
this.element.addClass(this.options.comboClass); |
|
|
|
|
hideWhenClickOutside && Widget._renderEngine.createElement(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName()); |
|
|
|
|
hideWhenClickOutside && Widget._renderEngine.createElement(document).unbind("mousewheel." + this.getName()); |
|
|
|
|
BI.EVENT_BLUR && hideWhenBlur && Widget._renderEngine.createElement(window).unbind("blur." + this.getName()); |
|
|
|
|
hideWhenClickOutside && |
|
|
|
|
Widget._renderEngine |
|
|
|
|
.createElement(document) |
|
|
|
|
.unbind(`mousedown.${this.getName()}`) |
|
|
|
|
.unbind(`mousewheel.${this.getName()}`); |
|
|
|
|
hideWhenClickOutside && Widget._renderEngine.createElement(document).unbind(`mousewheel.${this.getName()}`); |
|
|
|
|
BI.EVENT_BLUR && hideWhenBlur && Widget._renderEngine.createElement(window).unbind(`blur.${this.getName()}`); |
|
|
|
|
|
|
|
|
|
hideWhenClickOutside && Widget._renderEngine.createElement(document).bind("mousewheel." + this.getName(), bind(this._hideIf, this)); |
|
|
|
|
hideWhenClickOutside && Widget._renderEngine.createElement(document).bind("mousedown." + this.getName(), bind(this._hideIf, this)).bind("mousewheel." + this.getName(), bind(this._hideIf, this)); |
|
|
|
|
BI.EVENT_BLUR && hideWhenBlur && Widget._renderEngine.createElement(window).bind("blur." + this.getName(), bind(this._hideIf, this)); |
|
|
|
|
hideWhenClickOutside && |
|
|
|
|
Widget._renderEngine.createElement(document).bind(`mousewheel.${this.getName()}`, bind(this._hideIf, this)); |
|
|
|
|
hideWhenClickOutside && |
|
|
|
|
Widget._renderEngine |
|
|
|
|
.createElement(document) |
|
|
|
|
.bind(`mousedown.${this.getName()}`, bind(this._hideIf, this)) |
|
|
|
|
.bind(`mousewheel.${this.getName()}`, bind(this._hideIf, this)); |
|
|
|
|
BI.EVENT_BLUR && |
|
|
|
|
hideWhenBlur && |
|
|
|
|
Widget._renderEngine.createElement(window).bind(`blur.${this.getName()}`, bind(this._hideIf, this)); |
|
|
|
|
this.fireEvent(Combo.EVENT_AFTER_POPUPVIEW); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
adjustHeight(e) { |
|
|
|
|
const { belowMouse, supportCSSTransform, container, direction, adjustXOffset, adjustYOffset, adjustLength, showArrow, isNeedAdjustHeight, offsetStyle } = this.options; |
|
|
|
|
const { |
|
|
|
|
belowMouse, |
|
|
|
|
supportCSSTransform, |
|
|
|
|
container, |
|
|
|
|
direction, |
|
|
|
|
adjustXOffset, |
|
|
|
|
adjustYOffset, |
|
|
|
|
adjustLength, |
|
|
|
|
showArrow, |
|
|
|
|
isNeedAdjustHeight, |
|
|
|
|
offsetStyle, |
|
|
|
|
} = this.options; |
|
|
|
|
let p = {}; |
|
|
|
|
if (!this.popupView) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
const isVisible = this.popupView.isVisible(); |
|
|
|
|
this.popupView.visible(); |
|
|
|
|
const combo = (belowMouse && isNotNull(e)) ? { |
|
|
|
|
const combo = |
|
|
|
|
belowMouse && isNotNull(e) |
|
|
|
|
? { |
|
|
|
|
element: { |
|
|
|
|
0: e.target, |
|
|
|
|
offset: () => { |
|
|
|
@ -228,77 +282,206 @@ export class Combo extends Bubble {
|
|
|
|
|
height: 24, |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
outerWidth: () => { |
|
|
|
|
return 0; |
|
|
|
|
outerWidth: () => 0, |
|
|
|
|
outerHeight: () => 24, |
|
|
|
|
}, |
|
|
|
|
outerHeight: () => { |
|
|
|
|
return 24; |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
} : this.combo; |
|
|
|
|
const positionRelativeElement = supportCSSTransform ? BI.DOM.getPositionRelativeContainingBlock(isNull(container) ? this.element[0] : Widget._renderEngine.createElement(isFunction(container) ? container() : container)[0]) : null; |
|
|
|
|
} |
|
|
|
|
: this.combo; |
|
|
|
|
const positionRelativeElement = supportCSSTransform |
|
|
|
|
? BI.DOM.getPositionRelativeContainingBlock( |
|
|
|
|
isNull(container) |
|
|
|
|
? this.element[0] |
|
|
|
|
: Widget._renderEngine.createElement(isFunction(container) ? container() : container)[0] |
|
|
|
|
) |
|
|
|
|
: null; |
|
|
|
|
const TRIANGLE_LENGTH = 12; |
|
|
|
|
switch (direction) { |
|
|
|
|
case "bottom": |
|
|
|
|
case "bottom,right": |
|
|
|
|
p = BI.DOM.getComboPosition(combo, this.popupView, adjustXOffset, (adjustYOffset + adjustLength) + (showArrow ? TRIANGLE_LENGTH : 0), isNeedAdjustHeight, ["bottom", "top", "right", "left"], offsetStyle, positionRelativeElement); |
|
|
|
|
p = BI.DOM.getComboPosition( |
|
|
|
|
combo, |
|
|
|
|
this.popupView, |
|
|
|
|
adjustXOffset, |
|
|
|
|
adjustYOffset + adjustLength + (showArrow ? TRIANGLE_LENGTH : 0), |
|
|
|
|
isNeedAdjustHeight, |
|
|
|
|
["bottom", "top", "right", "left"], |
|
|
|
|
offsetStyle, |
|
|
|
|
positionRelativeElement |
|
|
|
|
); |
|
|
|
|
break; |
|
|
|
|
case "top": |
|
|
|
|
case "top,right": |
|
|
|
|
p = BI.DOM.getComboPosition(combo, this.popupView, adjustXOffset, (adjustYOffset + adjustLength) + (showArrow ? TRIANGLE_LENGTH : 0), isNeedAdjustHeight, ["top", "bottom", "right", "left"], offsetStyle, positionRelativeElement); |
|
|
|
|
p = BI.DOM.getComboPosition( |
|
|
|
|
combo, |
|
|
|
|
this.popupView, |
|
|
|
|
adjustXOffset, |
|
|
|
|
adjustYOffset + adjustLength + (showArrow ? TRIANGLE_LENGTH : 0), |
|
|
|
|
isNeedAdjustHeight, |
|
|
|
|
["top", "bottom", "right", "left"], |
|
|
|
|
offsetStyle, |
|
|
|
|
positionRelativeElement |
|
|
|
|
); |
|
|
|
|
break; |
|
|
|
|
case "left": |
|
|
|
|
case "left,bottom": |
|
|
|
|
p = BI.DOM.getComboPosition(combo, this.popupView, (adjustXOffset + adjustLength) + (showArrow ? TRIANGLE_LENGTH : 0), adjustYOffset, isNeedAdjustHeight, ["left", "right", "bottom", "top"], offsetStyle, positionRelativeElement); |
|
|
|
|
p = BI.DOM.getComboPosition( |
|
|
|
|
combo, |
|
|
|
|
this.popupView, |
|
|
|
|
adjustXOffset + adjustLength + (showArrow ? TRIANGLE_LENGTH : 0), |
|
|
|
|
adjustYOffset, |
|
|
|
|
isNeedAdjustHeight, |
|
|
|
|
["left", "right", "bottom", "top"], |
|
|
|
|
offsetStyle, |
|
|
|
|
positionRelativeElement |
|
|
|
|
); |
|
|
|
|
break; |
|
|
|
|
case "right": |
|
|
|
|
case "right,bottom": |
|
|
|
|
p = BI.DOM.getComboPosition(combo, this.popupView, (adjustXOffset + adjustLength) + (showArrow ? TRIANGLE_LENGTH : 0), adjustYOffset, isNeedAdjustHeight, ["right", "left", "bottom", "top"], offsetStyle, positionRelativeElement); |
|
|
|
|
p = BI.DOM.getComboPosition( |
|
|
|
|
combo, |
|
|
|
|
this.popupView, |
|
|
|
|
adjustXOffset + adjustLength + (showArrow ? TRIANGLE_LENGTH : 0), |
|
|
|
|
adjustYOffset, |
|
|
|
|
isNeedAdjustHeight, |
|
|
|
|
["right", "left", "bottom", "top"], |
|
|
|
|
offsetStyle, |
|
|
|
|
positionRelativeElement |
|
|
|
|
); |
|
|
|
|
break; |
|
|
|
|
case "top,left": |
|
|
|
|
p = BI.DOM.getComboPosition(combo, this.popupView, adjustXOffset, (adjustYOffset + adjustLength) + (showArrow ? TRIANGLE_LENGTH : 0), isNeedAdjustHeight, ["top", "bottom", "left", "right"], offsetStyle, positionRelativeElement); |
|
|
|
|
p = BI.DOM.getComboPosition( |
|
|
|
|
combo, |
|
|
|
|
this.popupView, |
|
|
|
|
adjustXOffset, |
|
|
|
|
adjustYOffset + adjustLength + (showArrow ? TRIANGLE_LENGTH : 0), |
|
|
|
|
isNeedAdjustHeight, |
|
|
|
|
["top", "bottom", "left", "right"], |
|
|
|
|
offsetStyle, |
|
|
|
|
positionRelativeElement |
|
|
|
|
); |
|
|
|
|
break; |
|
|
|
|
case "bottom,left": |
|
|
|
|
p = BI.DOM.getComboPosition(combo, this.popupView, adjustXOffset, (adjustYOffset + adjustLength) + (showArrow ? TRIANGLE_LENGTH : 0), isNeedAdjustHeight, ["bottom", "top", "left", "right"], offsetStyle, positionRelativeElement); |
|
|
|
|
p = BI.DOM.getComboPosition( |
|
|
|
|
combo, |
|
|
|
|
this.popupView, |
|
|
|
|
adjustXOffset, |
|
|
|
|
adjustYOffset + adjustLength + (showArrow ? TRIANGLE_LENGTH : 0), |
|
|
|
|
isNeedAdjustHeight, |
|
|
|
|
["bottom", "top", "left", "right"], |
|
|
|
|
offsetStyle, |
|
|
|
|
positionRelativeElement |
|
|
|
|
); |
|
|
|
|
break; |
|
|
|
|
case "left,top": |
|
|
|
|
p = BI.DOM.getComboPosition(combo, this.popupView, (adjustXOffset + adjustLength) + (showArrow ? TRIANGLE_LENGTH : 0), adjustYOffset, isNeedAdjustHeight, ["left", "right", "top", "bottom"], offsetStyle, positionRelativeElement); |
|
|
|
|
p = BI.DOM.getComboPosition( |
|
|
|
|
combo, |
|
|
|
|
this.popupView, |
|
|
|
|
adjustXOffset + adjustLength + (showArrow ? TRIANGLE_LENGTH : 0), |
|
|
|
|
adjustYOffset, |
|
|
|
|
isNeedAdjustHeight, |
|
|
|
|
["left", "right", "top", "bottom"], |
|
|
|
|
offsetStyle, |
|
|
|
|
positionRelativeElement |
|
|
|
|
); |
|
|
|
|
break; |
|
|
|
|
case "right,top": |
|
|
|
|
p = BI.DOM.getComboPosition(combo, this.popupView, (adjustXOffset + adjustLength) + (showArrow ? TRIANGLE_LENGTH : 0), adjustYOffset, isNeedAdjustHeight, ["right", "left", "top", "bottom"], offsetStyle, positionRelativeElement); |
|
|
|
|
p = BI.DOM.getComboPosition( |
|
|
|
|
combo, |
|
|
|
|
this.popupView, |
|
|
|
|
adjustXOffset + adjustLength + (showArrow ? TRIANGLE_LENGTH : 0), |
|
|
|
|
adjustYOffset, |
|
|
|
|
isNeedAdjustHeight, |
|
|
|
|
["right", "left", "top", "bottom"], |
|
|
|
|
offsetStyle, |
|
|
|
|
positionRelativeElement |
|
|
|
|
); |
|
|
|
|
break; |
|
|
|
|
case "right,innerRight": |
|
|
|
|
p = BI.DOM.getComboPosition(combo, this.popupView, (adjustXOffset + adjustLength) + (showArrow ? TRIANGLE_LENGTH : 0), adjustYOffset, isNeedAdjustHeight, ["right", "left", "innerRight", "innerLeft", "bottom", "top"], offsetStyle, positionRelativeElement); |
|
|
|
|
p = BI.DOM.getComboPosition( |
|
|
|
|
combo, |
|
|
|
|
this.popupView, |
|
|
|
|
adjustXOffset + adjustLength + (showArrow ? TRIANGLE_LENGTH : 0), |
|
|
|
|
adjustYOffset, |
|
|
|
|
isNeedAdjustHeight, |
|
|
|
|
["right", "left", "innerRight", "innerLeft", "bottom", "top"], |
|
|
|
|
offsetStyle, |
|
|
|
|
positionRelativeElement |
|
|
|
|
); |
|
|
|
|
break; |
|
|
|
|
case "right,innerLeft": |
|
|
|
|
p = BI.DOM.getComboPosition(combo, this.popupView, (adjustXOffset + adjustLength) + (showArrow ? TRIANGLE_LENGTH : 0), adjustYOffset, isNeedAdjustHeight, ["right", "left", "innerLeft", "innerRight", "bottom", "top"], offsetStyle, positionRelativeElement); |
|
|
|
|
p = BI.DOM.getComboPosition( |
|
|
|
|
combo, |
|
|
|
|
this.popupView, |
|
|
|
|
adjustXOffset + adjustLength + (showArrow ? TRIANGLE_LENGTH : 0), |
|
|
|
|
adjustYOffset, |
|
|
|
|
isNeedAdjustHeight, |
|
|
|
|
["right", "left", "innerLeft", "innerRight", "bottom", "top"], |
|
|
|
|
offsetStyle, |
|
|
|
|
positionRelativeElement |
|
|
|
|
); |
|
|
|
|
break; |
|
|
|
|
case "innerRight": |
|
|
|
|
p = BI.DOM.getComboPosition(combo, this.popupView, (adjustXOffset + adjustLength) + (showArrow ? TRIANGLE_LENGTH : 0), adjustYOffset, isNeedAdjustHeight, ["innerRight", "innerLeft", "right", "left", "bottom", "top"], offsetStyle, positionRelativeElement); |
|
|
|
|
p = BI.DOM.getComboPosition( |
|
|
|
|
combo, |
|
|
|
|
this.popupView, |
|
|
|
|
adjustXOffset + adjustLength + (showArrow ? TRIANGLE_LENGTH : 0), |
|
|
|
|
adjustYOffset, |
|
|
|
|
isNeedAdjustHeight, |
|
|
|
|
["innerRight", "innerLeft", "right", "left", "bottom", "top"], |
|
|
|
|
offsetStyle, |
|
|
|
|
positionRelativeElement |
|
|
|
|
); |
|
|
|
|
break; |
|
|
|
|
case "innerLeft": |
|
|
|
|
p = BI.DOM.getComboPosition(combo, this.popupView, (adjustXOffset + adjustLength) + (showArrow ? TRIANGLE_LENGTH : 0), adjustYOffset, isNeedAdjustHeight, ["innerLeft", "innerRight", "left", "right", "bottom", "top"], offsetStyle, positionRelativeElement); |
|
|
|
|
p = BI.DOM.getComboPosition( |
|
|
|
|
combo, |
|
|
|
|
this.popupView, |
|
|
|
|
adjustXOffset + adjustLength + (showArrow ? TRIANGLE_LENGTH : 0), |
|
|
|
|
adjustYOffset, |
|
|
|
|
isNeedAdjustHeight, |
|
|
|
|
["innerLeft", "innerRight", "left", "right", "bottom", "top"], |
|
|
|
|
offsetStyle, |
|
|
|
|
positionRelativeElement |
|
|
|
|
); |
|
|
|
|
break; |
|
|
|
|
case "top,custom": |
|
|
|
|
case "custom,top": |
|
|
|
|
p = BI.DOM.getTopAdaptPosition(combo, this.popupView, (adjustYOffset + adjustLength) + (showArrow ? TRIANGLE_LENGTH : 0), isNeedAdjustHeight); |
|
|
|
|
p = BI.DOM.getTopAdaptPosition( |
|
|
|
|
combo, |
|
|
|
|
this.popupView, |
|
|
|
|
adjustYOffset + adjustLength + (showArrow ? TRIANGLE_LENGTH : 0), |
|
|
|
|
isNeedAdjustHeight |
|
|
|
|
); |
|
|
|
|
p.dir = "top"; |
|
|
|
|
break; |
|
|
|
|
case "custom,bottom": |
|
|
|
|
case "bottom,custom": |
|
|
|
|
p = BI.DOM.getBottomAdaptPosition(combo, this.popupView, (adjustYOffset + adjustLength) + (showArrow ? TRIANGLE_LENGTH : 0), isNeedAdjustHeight); |
|
|
|
|
p = BI.DOM.getBottomAdaptPosition( |
|
|
|
|
combo, |
|
|
|
|
this.popupView, |
|
|
|
|
adjustYOffset + adjustLength + (showArrow ? TRIANGLE_LENGTH : 0), |
|
|
|
|
isNeedAdjustHeight |
|
|
|
|
); |
|
|
|
|
p.dir = "bottom"; |
|
|
|
|
break; |
|
|
|
|
case "left,custom": |
|
|
|
|
case "custom,left": |
|
|
|
|
p = BI.DOM.getLeftAdaptPosition(combo, this.popupView, (adjustXOffset + adjustLength) + (showArrow ? TRIANGLE_LENGTH : 0)); |
|
|
|
|
p = BI.DOM.getLeftAdaptPosition( |
|
|
|
|
combo, |
|
|
|
|
this.popupView, |
|
|
|
|
adjustXOffset + adjustLength + (showArrow ? TRIANGLE_LENGTH : 0) |
|
|
|
|
); |
|
|
|
|
delete p.top; |
|
|
|
|
delete p.adaptHeight; |
|
|
|
|
p.dir = "left"; |
|
|
|
|
break; |
|
|
|
|
case "custom,right": |
|
|
|
|
case "right,custom": |
|
|
|
|
p = BI.DOM.getRightAdaptPosition(combo, this.popupView, (adjustXOffset + adjustLength) + (showArrow ? TRIANGLE_LENGTH : 0)); |
|
|
|
|
p = BI.DOM.getRightAdaptPosition( |
|
|
|
|
combo, |
|
|
|
|
this.popupView, |
|
|
|
|
adjustXOffset + adjustLength + (showArrow ? TRIANGLE_LENGTH : 0) |
|
|
|
|
); |
|
|
|
|
delete p.top; |
|
|
|
|
delete p.adaptHeight; |
|
|
|
|
p.dir = "right"; |
|
|
|
@ -313,7 +496,8 @@ export class Combo extends Bubble {
|
|
|
|
|
|
|
|
|
|
const width = this.combo.element.outerWidth(); |
|
|
|
|
const height = this.combo.element.outerHeight(); |
|
|
|
|
this.popupView.setDirection && this.popupView.setDirection(p.dir, { |
|
|
|
|
this.popupView.setDirection && |
|
|
|
|
this.popupView.setDirection(p.dir, { |
|
|
|
|
width, |
|
|
|
|
height, |
|
|
|
|
offsetStyle, |
|
|
|
@ -323,7 +507,6 @@ export class Combo extends Bubble {
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
if (supportCSSTransform) { |
|
|
|
|
|
|
|
|
|
const positonedRect = positionRelativeElement.getBoundingClientRect(); |
|
|
|
|
|
|
|
|
|
const scaleX = positonedRect.width / positionRelativeElement.offsetWidth; |
|
|
|
@ -348,14 +531,14 @@ export class Combo extends Bubble {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
destroyed() { |
|
|
|
|
Widget._renderEngine.createElement(document) |
|
|
|
|
.unbind("click." + this.getName()) |
|
|
|
|
.unbind("mousedown." + this.getName()) |
|
|
|
|
.unbind("mousewheel." + this.getName()) |
|
|
|
|
.unbind("mouseenter." + this.getName()) |
|
|
|
|
.unbind("mouseleave." + this.getName()); |
|
|
|
|
Widget._renderEngine.createElement(window) |
|
|
|
|
.unbind("blur." + this.getName()); |
|
|
|
|
Widget._renderEngine |
|
|
|
|
.createElement(document) |
|
|
|
|
.unbind(`click.${this.getName()}`) |
|
|
|
|
.unbind(`mousedown.${this.getName()}`) |
|
|
|
|
.unbind(`mousewheel.${this.getName()}`) |
|
|
|
|
.unbind(`mouseenter.${this.getName()}`) |
|
|
|
|
.unbind(`mouseleave.${this.getName()}`); |
|
|
|
|
Widget._renderEngine.createElement(window).unbind(`blur.${this.getName()}`); |
|
|
|
|
Resizers.remove(this.getName()); |
|
|
|
|
this.popupView && this.popupView._destroy(); |
|
|
|
|
delete needHideWhenAnotherComboOpen[this.getName()]; |
|
|
|
|