|
|
|
@ -219,9 +219,9 @@
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
isRightSpaceEnough: function (combo, popup, extraWidth) { |
|
|
|
|
var viewBounds = popup.element.bounds(), |
|
|
|
|
windowBounds = BI.Widget._renderEngine.createElement("body").bounds(); |
|
|
|
|
return BI.DOM.getRightPosition(combo, popup, extraWidth).left + viewBounds.width <= windowBounds.width; |
|
|
|
|
var viewBounds = popup.element[0].getBoundingClientRect(), |
|
|
|
|
viewportBounds = document.documentElement.getBoundingClientRect(); |
|
|
|
|
return BI.DOM.getRightPosition(combo, popup, extraWidth).left + viewBounds.width <= viewportBounds.width; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
isInnerRightSpaceEnough: function (combo, popup, extraWidth) { |
|
|
|
@ -233,9 +233,9 @@
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
isBottomSpaceEnough: function (combo, popup, extraHeight) { |
|
|
|
|
var viewBounds = popup.element.bounds(), |
|
|
|
|
windowBounds = BI.Widget._renderEngine.createElement("body").bounds(); |
|
|
|
|
return BI.DOM.getBottomPosition(combo, popup, extraHeight).top + viewBounds.height <= windowBounds.height; |
|
|
|
|
var viewBounds = popup.element[0].getBoundingClientRect(), |
|
|
|
|
viewportBounds = document.documentElement.getBoundingClientRect(); |
|
|
|
|
return BI.DOM.getBottomPosition(combo, popup, extraHeight).top + viewBounds.height <= viewportBounds.height; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
isRightSpaceLarger: function (combo) { |
|
|
|
@ -318,23 +318,24 @@
|
|
|
|
|
|
|
|
|
|
getTopAlignPosition: function (combo, popup, extraHeight, needAdaptHeight, container) { |
|
|
|
|
var comboOffset = combo.element.offset(); |
|
|
|
|
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), |
|
|
|
|
windowBounds = BI.Widget._renderEngine.createElement("body").bounds(), |
|
|
|
|
var comboBounds = combo.element[0].getBoundingClientRect(), |
|
|
|
|
popupBounds = popup.element[0].getBoundingClientRect(), |
|
|
|
|
viewportBounds = document.documentElement.getBoundingClientRect(), |
|
|
|
|
containerBounds = container ? container.getBoundingClientRect() : { top: 0 }; |
|
|
|
|
var top, adaptHeight, dir; |
|
|
|
|
if (BI.DOM.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { |
|
|
|
|
top = comboOffset.top - containerBounds.top + extraHeight; |
|
|
|
|
} else if (needAdaptHeight) { |
|
|
|
|
top = comboOffset.top + extraHeight; |
|
|
|
|
adaptHeight = windowBounds.height - top; |
|
|
|
|
top = comboBounds.top - containerBounds.top + extraHeight; |
|
|
|
|
adaptHeight = viewportBounds.height - top; |
|
|
|
|
} else if (BI.DOM.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { |
|
|
|
|
// 下方空间不足且不允许调整高度的情况下,优先使用上对齐
|
|
|
|
|
top = comboOffset.top + comboBounds.height - popupBounds.height - extraHeight; |
|
|
|
|
top = comboBounds.top + comboBounds.height - popupBounds.height - containerBounds.top - extraHeight; |
|
|
|
|
dir = "top"; |
|
|
|
|
} else { |
|
|
|
|
top = windowBounds.height - popupBounds.height; |
|
|
|
|
top = viewportBounds.height - popupBounds.height; |
|
|
|
|
if (top < extraHeight) { |
|
|
|
|
adaptHeight = windowBounds.height - extraHeight; |
|
|
|
|
adaptHeight = viewportBounds.height - extraHeight; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (top < extraHeight) { |
|
|
|
@ -657,7 +658,7 @@
|
|
|
|
|
firstDir = "top"; |
|
|
|
|
} |
|
|
|
|
if (leftRight[0] === "right") { |
|
|
|
|
pos = BI.DOM.getLeftAlignPosition(combo, popup, extraWidth, needAdaptHeight); |
|
|
|
|
pos = BI.DOM.getLeftAlignPosition(combo, popup, extraWidth); |
|
|
|
|
pos.top = top; |
|
|
|
|
pos.dir = firstDir + "," + pos.dir; |
|
|
|
|
return pos; |
|
|
|
|