|
|
|
@ -239,13 +239,15 @@
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
isRightSpaceLarger: function (combo) { |
|
|
|
|
var windowBounds = BI.Widget._renderEngine.createElement("body").bounds(); |
|
|
|
|
return windowBounds.width - combo.element.offset().left - combo.element.bounds().width >= combo.element.offset().left; |
|
|
|
|
var comboBounds = combo.element[0].getBoundingClientRect(), |
|
|
|
|
viewportBounds = document.documentElement.getBoundingClientRect(); |
|
|
|
|
return viewportBounds.width - comboBounds.right >= comboBounds.left; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
isBottomSpaceLarger: function (combo) { |
|
|
|
|
var windowBounds = BI.Widget._renderEngine.createElement("body").bounds(); |
|
|
|
|
return windowBounds.height - combo.element.offset().top - combo.element.bounds().height >= combo.element.offset().top; |
|
|
|
|
var comboBounds = combo.element[0].getBoundingClientRect(), |
|
|
|
|
viewportBounds = document.documentElement.getBoundingClientRect(); |
|
|
|
|
return viewportBounds.height - comboBounds.bottom >= comboBounds.top; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_getLeftAlignPosition: function (combo, popup, extraWidth, container) { |
|
|
|
@ -279,9 +281,9 @@
|
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
getLeftAdaptPosition: function (combo, popup, extraWidth) { |
|
|
|
|
if (BI.DOM.isLeftSpaceEnough(combo, popup, extraWidth)) { |
|
|
|
|
return BI.DOM.getLeftPosition(combo, popup, extraWidth); |
|
|
|
|
getLeftAdaptPosition: function (combo, popup, extraWidth, container) { |
|
|
|
|
if (BI.DOM.isLeftSpaceEnough(combo, popup, extraWidth, container)) { |
|
|
|
|
return BI.DOM.getLeftPosition(combo, popup, extraWidth, container); |
|
|
|
|
} |
|
|
|
|
return { |
|
|
|
|
left: 0 |
|
|
|
@ -312,12 +314,12 @@
|
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
getRightAdaptPosition: function (combo, popup, extraWidth) { |
|
|
|
|
if (BI.DOM.isRightSpaceEnough(combo, popup, extraWidth)) { |
|
|
|
|
return BI.DOM.getRightPosition(combo, popup, extraWidth); |
|
|
|
|
getRightAdaptPosition: function (combo, popup, extraWidth, container) { |
|
|
|
|
if (BI.DOM.isRightSpaceEnough(combo, popup, extraWidth, container)) { |
|
|
|
|
return BI.DOM.getRightPosition(combo, popup, extraWidth, container); |
|
|
|
|
} |
|
|
|
|
return { |
|
|
|
|
left: BI.Widget._renderEngine.createElement("body").bounds().width - popup.element.bounds().width |
|
|
|
|
left: document.documentElement.getBoundingClientRect().width - popup.element[0].getBoundingClientRect().width - container.getBoundingClientRect().left |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -355,26 +357,28 @@
|
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
getTopAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) { |
|
|
|
|
var popupBounds = popup.element.bounds(), |
|
|
|
|
windowBounds = BI.Widget._renderEngine.createElement("body").bounds(); |
|
|
|
|
getTopAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight, positionRelativeElement) { |
|
|
|
|
var comboBounds = combo.element[0].getBoundingClientRect(), |
|
|
|
|
popupBounds = popup.element[0].getBoundingClientRect(), |
|
|
|
|
positionRelativeElementRect = positionRelativeElement.getBoundingClientRect(), |
|
|
|
|
viewportBounds = document.documentElement.getBoundingClientRect(); |
|
|
|
|
if (BI.DOM.isTopSpaceEnough(combo, popup, extraHeight)) { |
|
|
|
|
return BI.DOM.getTopPosition(combo, popup, extraHeight); |
|
|
|
|
} |
|
|
|
|
if (needAdaptHeight) { |
|
|
|
|
return { |
|
|
|
|
top: 0, |
|
|
|
|
adaptHeight: combo.element.offset().top - extraHeight |
|
|
|
|
top: 0 - positionRelativeElementRect.top, |
|
|
|
|
adaptHeight: comboBounds.top - extraHeight |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
if (popupBounds.height + extraHeight > windowBounds.height) { |
|
|
|
|
if (popupBounds.height + extraHeight > viewportBounds.height) { |
|
|
|
|
return { |
|
|
|
|
top: 0, |
|
|
|
|
adaptHeight: windowBounds.height - extraHeight |
|
|
|
|
top: 0 - positionRelativeElementRect.top, |
|
|
|
|
adaptHeight: viewportBounds.height - extraHeight |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
return { |
|
|
|
|
top: 0 |
|
|
|
|
top: 0 - positionRelativeElementRect.top |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -413,7 +417,8 @@
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
getBottomAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) { |
|
|
|
|
var comboBounds = combo.element[0].getBoundingClientRect(), popupBounds = popup.element[0].getBoundingClientRect(), |
|
|
|
|
var comboBounds = combo.element[0].getBoundingClientRect(), |
|
|
|
|
popupBounds = popup.element[0].getBoundingClientRect(), |
|
|
|
|
windowBounds = BI.Widget._renderEngine.createElement("body").bounds(); |
|
|
|
|
if (BI.DOM.isBottomSpaceEnough(combo, popup, extraHeight)) { |
|
|
|
|
return BI.DOM.getBottomPosition(combo, popup, extraHeight); |
|
|
|
@ -638,10 +643,10 @@
|
|
|
|
|
case "left": |
|
|
|
|
case "right": |
|
|
|
|
if (BI.DOM.isRightSpaceLarger(combo)) { |
|
|
|
|
left = BI.DOM.getRightAdaptPosition(combo, popup, extraWidth).left; |
|
|
|
|
left = BI.DOM.getRightAdaptPosition(combo, popup, extraWidth, container).left; |
|
|
|
|
firstDir = "right"; |
|
|
|
|
} else { |
|
|
|
|
left = BI.DOM.getLeftAdaptPosition(combo, popup, extraWidth).left; |
|
|
|
|
left = BI.DOM.getLeftAdaptPosition(combo, popup, extraWidth, container).left; |
|
|
|
|
firstDir = "left"; |
|
|
|
|
} |
|
|
|
|
if (topBottom[0] === "bottom") { |
|
|
|
@ -656,19 +661,19 @@
|
|
|
|
|
return pos; |
|
|
|
|
default : |
|
|
|
|
if (BI.DOM.isBottomSpaceLarger(combo)) { |
|
|
|
|
top = BI.DOM.getBottomAdaptPosition(combo, popup, extraHeight, needAdaptHeight).top; |
|
|
|
|
top = BI.DOM.getBottomAdaptPosition(combo, popup, extraHeight, needAdaptHeight, container).top; |
|
|
|
|
firstDir = "bottom"; |
|
|
|
|
} else { |
|
|
|
|
top = BI.DOM.getTopAdaptPosition(combo, popup, extraHeight, needAdaptHeight).top; |
|
|
|
|
top = BI.DOM.getTopAdaptPosition(combo, popup, extraHeight, needAdaptHeight, container).top; |
|
|
|
|
firstDir = "top"; |
|
|
|
|
} |
|
|
|
|
if (leftRight[0] === "right") { |
|
|
|
|
pos = BI.DOM.getLeftAlignPosition(combo, popup, extraWidth); |
|
|
|
|
pos = BI.DOM.getLeftAlignPosition(combo, popup, extraWidth, container); |
|
|
|
|
pos.top = top; |
|
|
|
|
pos.dir = firstDir + "," + pos.dir; |
|
|
|
|
return pos; |
|
|
|
|
} |
|
|
|
|
pos = BI.DOM.getRightAlignPosition(combo, popup, extraWidth); |
|
|
|
|
pos = BI.DOM.getRightAlignPosition(combo, popup, extraWidth, container); |
|
|
|
|
pos.top = top; |
|
|
|
|
pos.dir = firstDir + "," + pos.dir; |
|
|
|
|
return pos; |
|
|
|
|