Browse Source

Pull request #213464: BI-119128 fix: 【自适应迭代发散】小屏编辑,高度适应+自定义(1366*449),直接预览,文本控件下拉选项偏离

Merge in DEC/fineui from ~DAILER/fineui-decision:release/11.0 to release/11.0

* commit 'e6f07ab36b4b22892bfa801bc1832e4d9ad61eb8':
  BI-119128 fix: 【自适应迭代发散】小屏编辑,高度适应+自定义(1366*449),直接预览,文本控件下拉选项偏离
research/test
Dailer-刘荣歆 2 years ago
parent
commit
7c8064d11a
  1. 19
      src/core/platform/web/dom.js

19
src/core/platform/web/dom.js

@ -416,27 +416,28 @@
}; };
}, },
getBottomAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) { getBottomAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight, positionRelativeElement) {
var comboBounds = combo.element[0].getBoundingClientRect(), var comboBounds = combo.element[0].getBoundingClientRect(),
popupBounds = popup.element[0].getBoundingClientRect(), popupBounds = popup.element[0].getBoundingClientRect(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds(); viewportBounds = document.documentElement.getBoundingClientRect(),
positionRelativeElementRect = positionRelativeElement.getBoundingClientRect();
if (BI.DOM.isBottomSpaceEnough(combo, popup, extraHeight)) { if (BI.DOM.isBottomSpaceEnough(combo, popup, extraHeight)) {
return BI.DOM.getBottomPosition(combo, popup, extraHeight); return BI.DOM.getBottomPosition(combo, popup, extraHeight, positionRelativeElement);
} }
if (needAdaptHeight) { if (needAdaptHeight) {
return { return {
top: comboBounds.top + comboBounds.height + extraHeight, top: comboBounds.top + comboBounds.height + extraHeight - positionRelativeElementRect.top,
adaptHeight: windowBounds.height - comboBounds.top - comboBounds.height - extraHeight adaptHeight: viewportBounds.height - comboBounds.top - comboBounds.height - extraHeight
}; };
} }
if (popupBounds.height + extraHeight > windowBounds.height) { if (popupBounds.height + extraHeight > viewportBounds.height) {
return { return {
top: extraHeight, top: extraHeight - positionRelativeElementRect.top,
adaptHeight: windowBounds.height - extraHeight adaptHeight: viewportBounds.height - extraHeight
}; };
} }
return { return {
top: windowBounds.height - popupBounds.height - extraHeight top: viewportBounds.height - popupBounds.height - extraHeight - positionRelativeElementRect.top
}; };
}, },

Loading…
Cancel
Save