From f2145cbefdb77e61063e518fee6be475c051b985 Mon Sep 17 00:00:00 2001 From: zsmj Date: Sat, 10 Dec 2022 13:53:42 +0800 Subject: [PATCH 1/3] =?UTF-8?q?KERNEL-11877=20feat:=20container=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=87=BD=E6=95=B0,=20=E4=BF=AE=E5=A4=8D=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/case/combo/bubblecombo/combo.bubble.js | 1 + src/core/platform/web/dom.js | 29 +++++++++++----------- src/less/core/utils/motion/zoom.less | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/case/combo/bubblecombo/combo.bubble.js b/src/case/combo/bubblecombo/combo.bubble.js index 5f0a4c720..7f2448ac0 100644 --- a/src/case/combo/bubblecombo/combo.bubble.js +++ b/src/case/combo/bubblecombo/combo.bubble.js @@ -53,6 +53,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, { offsetStyle: o.offsetStyle, showArrow: true, comboClass: o.comboClass, + supportCSSTransform: o.supportCSSTransform, el: o.el, popup: () => BI.extend({ type: "bi.bubble_popup_view", diff --git a/src/core/platform/web/dom.js b/src/core/platform/web/dom.js index bab3d7042..d45ccc3b2 100644 --- a/src/core/platform/web/dom.js +++ b/src/core/platform/web/dom.js @@ -219,9 +219,9 @@ }, isRightSpaceEnough: function (combo, popup, extraWidth) { - var viewBounds = popup.element.bounds(), - windowBounds = BI.Widget._renderEngine.createElement("body").bounds(); - return BI.DOM.getRightPosition(combo, popup, extraWidth).left + viewBounds.width <= windowBounds.width; + var viewBounds = popup.element[0].getBoundingClientRect(), + viewportBounds = document.documentElement.getBoundingClientRect(); + return BI.DOM.getRightPosition(combo, popup, extraWidth).left + viewBounds.width <= viewportBounds.width; }, isInnerRightSpaceEnough: function (combo, popup, extraWidth) { @@ -233,9 +233,9 @@ }, isBottomSpaceEnough: function (combo, popup, extraHeight) { - var viewBounds = popup.element.bounds(), - windowBounds = BI.Widget._renderEngine.createElement("body").bounds(); - return BI.DOM.getBottomPosition(combo, popup, extraHeight).top + viewBounds.height <= windowBounds.height; + var viewBounds = popup.element[0].getBoundingClientRect(), + viewportBounds = document.documentElement.getBoundingClientRect(); + return BI.DOM.getBottomPosition(combo, popup, extraHeight).top + viewBounds.height <= viewportBounds.height; }, isRightSpaceLarger: function (combo) { @@ -318,23 +318,24 @@ getTopAlignPosition: function (combo, popup, extraHeight, needAdaptHeight, container) { var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), - windowBounds = BI.Widget._renderEngine.createElement("body").bounds(), + var comboBounds = combo.element[0].getBoundingClientRect(), + popupBounds = popup.element[0].getBoundingClientRect(), + viewportBounds = document.documentElement.getBoundingClientRect(), containerBounds = container ? container.getBoundingClientRect() : { top: 0 }; var top, adaptHeight, dir; if (BI.DOM.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { top = comboOffset.top - containerBounds.top + extraHeight; } else if (needAdaptHeight) { - top = comboOffset.top + extraHeight; - adaptHeight = windowBounds.height - top; + top = comboBounds.top - containerBounds.top + extraHeight; + adaptHeight = viewportBounds.height - top; } else if (BI.DOM.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { // 下方空间不足且不允许调整高度的情况下,优先使用上对齐 - top = comboOffset.top + comboBounds.height - popupBounds.height - extraHeight; + top = comboBounds.top + comboBounds.height - popupBounds.height - containerBounds.top - extraHeight; dir = "top"; } else { - top = windowBounds.height - popupBounds.height; + top = viewportBounds.height - popupBounds.height; if (top < extraHeight) { - adaptHeight = windowBounds.height - extraHeight; + adaptHeight = viewportBounds.height - extraHeight; } } if (top < extraHeight) { @@ -657,7 +658,7 @@ firstDir = "top"; } if (leftRight[0] === "right") { - pos = BI.DOM.getLeftAlignPosition(combo, popup, extraWidth, needAdaptHeight); + pos = BI.DOM.getLeftAlignPosition(combo, popup, extraWidth); pos.top = top; pos.dir = firstDir + "," + pos.dir; return pos; diff --git a/src/less/core/utils/motion/zoom.less b/src/less/core/utils/motion/zoom.less index 7e0e0ec44..edeab6df4 100644 --- a/src/less/core/utils/motion/zoom.less +++ b/src/less/core/utils/motion/zoom.less @@ -4,7 +4,7 @@ .make-motion(@className, @keyframeName, @duration); .@{className}-enter, .@{className}-appear { - transform: scale(0); // need this by yiminghe + //transform: scale(0); // need this by yiminghe, but dailer did not need this opacity: 0; animation-timing-function: @ease-out-circ; From c486970d507ae7796af2c2804a7e18d8d0f6494b Mon Sep 17 00:00:00 2001 From: zsmj Date: Sat, 10 Dec 2022 14:20:58 +0800 Subject: [PATCH 2/3] =?UTF-8?q?KERNEL-11877=20feat:=20direction:bottom?= =?UTF-8?q?=E5=92=8Cdirection:top=E7=A9=BA=E9=97=B4=E4=B8=8D=E5=A4=9F?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E8=B0=83=E6=95=B4=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/platform/web/dom.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/platform/web/dom.js b/src/core/platform/web/dom.js index d45ccc3b2..66e970b56 100644 --- a/src/core/platform/web/dom.js +++ b/src/core/platform/web/dom.js @@ -384,11 +384,11 @@ if (BI.DOM.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { top = comboOffset.top + comboBounds.height - containerBounds.top - popupBounds.height; } else if (needAdaptHeight) { - top = 0; - adaptHeight = comboOffset.top + comboBounds.height - extraHeight; + top = 0 - containerBounds.top; + adaptHeight = comboBounds.top + comboBounds.height - extraHeight; } else if (BI.DOM.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { // 上方空间不足且不允许调整高度的情况下,优先使用下对齐 - top = comboOffset.top + extraHeight; + top = comboOffset.top - containerBounds.top + extraHeight; dir = "bottom"; } else { top = 0; @@ -396,7 +396,7 @@ adaptHeight = windowBounds.height - extraHeight; } } - if (top < 0) { + if (top + containerBounds.top < 0) { top = 0; } return adaptHeight ? { From 972a22215ca1b7ec54fad4b6fd39bb790edd276c Mon Sep 17 00:00:00 2001 From: data Date: Sat, 10 Dec 2022 19:37:29 +0800 Subject: [PATCH 3/3] auto upgrade version to 2.0.20221210193709 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4bcb297d3..157b1a766 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20221209162625", + "version": "2.0.20221210193709", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts",