Browse Source

BI-144444 fix: 【v5】过滤组件向下展示不下,向上弹出的时候会挡住仪表板的tab栏,体验不好,看下能不能优化

将needAtaptHeight的修正逻辑细化不遮挡el
research/test
翠屏山最速下山传说 9 months ago
parent
commit
7c5c12856e
  1. 14
      packages/fineui/src/core/utils/dom.js

14
packages/fineui/src/core/utils/dom.js

@ -66,10 +66,10 @@ export function preloadImages(srcArray, onload) {
each(srcArray, (i, src) => { each(srcArray, (i, src) => {
images[i] = new Image(); images[i] = new Image();
images[i].src = src; images[i].src = src;
images[i].onload = function() { images[i].onload = function () {
complete(); complete();
}; };
images[i].onerror = function() { images[i].onerror = function () {
complete(); complete();
}; };
}); });
@ -741,8 +741,14 @@ export function getComboPosition(combo, popup, extraWidth, extraHeight, needAdap
default: default:
break; break;
} }
if (needAdaptHeight === true) { if (needAdaptHeight === true && popup.resetHeight) {
popup.resetHeight && popup.resetHeight(Math.min(viewportBounds.height - position.top - (positionRelativeElement ? positionRelativeElement.getBoundingClientRect().top : 0), maxHeight)); const comboRect = combo.element[0].getBoundingClientRect();
const relativeOffset = positionRelativeElement ? positionRelativeElement.getBoundingClientRect().top : 0;
if (position.top < comboRect.top) {
popup.resetHeight(Math.min(viewportBounds.height - position.top - relativeOffset, comboRect.top, maxHeight));
} else if (position.top > comboRect.bottom) {
popup.resetHeight(Math.min(viewportBounds.height - position.top - relativeOffset, viewportBounds.height - comboRect.bottom, maxHeight));
}
} }
return position; return position;

Loading…
Cancel
Save