|
|
@ -327,7 +327,7 @@ |
|
|
|
top = comboOffset.top - containerBounds.top + extraHeight; |
|
|
|
top = comboOffset.top - containerBounds.top + extraHeight; |
|
|
|
} else if (needAdaptHeight) { |
|
|
|
} else if (needAdaptHeight) { |
|
|
|
top = comboBounds.top - containerBounds.top + extraHeight; |
|
|
|
top = comboBounds.top - containerBounds.top + extraHeight; |
|
|
|
adaptHeight = viewportBounds.height - top; |
|
|
|
adaptHeight = viewportBounds.height - comboBounds.top; |
|
|
|
} else if (BI.DOM.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { |
|
|
|
} else if (BI.DOM.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { |
|
|
|
// 下方空间不足且不允许调整高度的情况下,优先使用上对齐
|
|
|
|
// 下方空间不足且不允许调整高度的情况下,优先使用上对齐
|
|
|
|
top = comboBounds.top + comboBounds.height - popupBounds.height - containerBounds.top - extraHeight; |
|
|
|
top = comboBounds.top + comboBounds.height - popupBounds.height - containerBounds.top - extraHeight; |
|
|
@ -671,13 +671,13 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getComboPosition: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions, offsetStyle, container) { |
|
|
|
getComboPosition: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions, offsetStyle, positionRelativeElement) { |
|
|
|
extraWidth || (extraWidth = 0); |
|
|
|
extraWidth || (extraWidth = 0); |
|
|
|
extraHeight || (extraHeight = 0); |
|
|
|
extraHeight || (extraHeight = 0); |
|
|
|
var bodyHeight = BI.Widget._renderEngine.createElement("body").bounds().height - extraHeight; |
|
|
|
var bodyHeight = BI.Widget._renderEngine.createElement("body").bounds().height - extraHeight; |
|
|
|
var maxHeight = Math.min(popup.attr("maxHeight") || bodyHeight, bodyHeight); |
|
|
|
var maxHeight = Math.min(popup.attr("maxHeight") || bodyHeight, bodyHeight); |
|
|
|
popup.resetHeight && popup.resetHeight(maxHeight); |
|
|
|
popup.resetHeight && popup.resetHeight(maxHeight); |
|
|
|
var position = BI.DOM.getComboPositionByDirections(combo, popup, extraWidth, extraHeight, needAdaptHeight, directions || ["bottom", "top", "right", "left"], container); |
|
|
|
var position = BI.DOM.getComboPositionByDirections(combo, popup, extraWidth, extraHeight, needAdaptHeight, directions || ["bottom", "top", "right", "left"], positionRelativeElement); |
|
|
|
switch (offsetStyle) { |
|
|
|
switch (offsetStyle) { |
|
|
|
case "center": |
|
|
|
case "center": |
|
|
|
if (position.change) { |
|
|
|
if (position.change) { |
|
|
@ -699,7 +699,7 @@ |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (needAdaptHeight === true) { |
|
|
|
if (needAdaptHeight === true) { |
|
|
|
popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight)); |
|
|
|
popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top + (positionRelativeElement ? positionRelativeElement.getBoundingClientRect().top : 0), maxHeight)); |
|
|
|
} |
|
|
|
} |
|
|
|
return position; |
|
|
|
return position; |
|
|
|
}, |
|
|
|
}, |
|
|
|