Browse Source

Merge pull request #214043 in DEC/fineui from release/11.0 to bugfix/11.0

* commit 'ea776c0be708f36dc71b8eb27a43abe6d3ff19e4':
  BI-119128 fix: 【自适应迭代发散】小屏编辑,高度适应+自定义(1366*449),直接预览,文本控件下拉选项偏离
  BI-119112 fix:editor弹出errorbubble位置修改
  Revert "BI-119112 fix:editor可以自定义error bubble位置"
  BI-119112 fix:editor可以自定义error bubble位置
  BI-119217 fix: 【6.0.6冒烟】等比自适应-高清屏-宽度自适应预览,下拉树查看已选展示异常
  REPORT-87371 fix: 【BI6.0】【目录管理-管理首页】添加首页时模板类型的下拉框为空
research/test
superman 2 years ago
parent
commit
a4ae1138df
  1. 4
      src/base/combination/combo.js
  2. 5
      src/core/controller/controller.bubbles.js
  3. 78
      src/core/platform/web/dom.js

4
src/base/combination/combo.js

@ -310,8 +310,8 @@
var scaleX = positonedRect.width / positionRelativeElement.offsetWidth; var scaleX = positonedRect.width / positionRelativeElement.offsetWidth;
var scaleY = positonedRect.height / positionRelativeElement.offsetHeight; var scaleY = positonedRect.height / positionRelativeElement.offsetHeight;
p.top && (p.top = Math.round(p.top / scaleY)); p.top && (p.top = Math.round(p.top / scaleY + positionRelativeElement.scrollTop));
p.left && (p.left = Math.round(p.left / scaleX)); p.left && (p.left = Math.round(p.left / scaleX + positionRelativeElement.scrollLeft));
p.adaptHeight && (p.adaptHeight = Math.round(p.adaptHeight / scaleY)); p.adaptHeight && (p.adaptHeight = Math.round(p.adaptHeight / scaleY));
} }

5
src/core/controller/controller.bubbles.js

@ -71,10 +71,7 @@ BI.BubblesController = BI.inherit(BI.Controller, {
{ {
name: "preventOverflow", name: "preventOverflow",
enabled: false enabled: false
}, { }
name: "flip",
enabled: false
},
] ]
}); });
return this; return this;

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

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

Loading…
Cancel
Save