From 173a08db0fe24fba24efcbcd2d6710b20421ac9c Mon Sep 17 00:00:00 2001 From: yaobin Date: Thu, 20 Apr 2023 22:56:46 +0800 Subject: [PATCH] =?UTF-8?q?fix(OverlayTrigger):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=B5=8C=E5=A5=97=E5=BC=B9=E5=87=BA=E5=AF=BC=E8=87=B4=E5=85=83?= =?UTF-8?q?=E7=B4=A0=E5=B1=82=E7=BA=A7=E5=BC=82=E5=B8=B8=20(#960)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修复table展示问题 * fix: 修复table宽度 * fix(DatePicker): 修复日历年份选择异常 * chore(deps): update dependency lerna to v6.0.0 * fix(OverlayTrigger): 修复嵌套弹出导致元素层级异常 * remove other class --- packages/react-overlay-trigger/src/index.tsx | 14 ++++++++++++-- website/src/layouts/index.module.less | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/react-overlay-trigger/src/index.tsx b/packages/react-overlay-trigger/src/index.tsx index 52899dc593..7d52f7a4cd 100644 --- a/packages/react-overlay-trigger/src/index.tsx +++ b/packages/react-overlay-trigger/src/index.tsx @@ -251,13 +251,22 @@ export default React.forwardRef((props, function hide() { if (!isOpen) return; - zIndex.current -= 1; + if (zIndex.current <= 999) { + zIndex.current = 999; + } else { + zIndex.current -= 1; + } setIsOpen(false); } function show() { if (isOpen) return; - zIndex.current += 1; + const nodeIndex = triggerRef.current?.style.zIndex; + if (nodeIndex) { + zIndex.current = Number(nodeIndex) + 1; + } else { + zIndex.current += 1; + } setIsOpen(true); } @@ -305,6 +314,7 @@ export default React.forwardRef((props, Object.assign({}, child.props, { ...triggerProps, ref: triggerRef, + style: { zIndex: zIndex.current }, className: [child.props.className, disabled ? `${prefixCls}-disabled` : null] .filter(Boolean) .join(' ') diff --git a/website/src/layouts/index.module.less b/website/src/layouts/index.module.less index cb00a69ab5..2714ebfa9d 100755 --- a/website/src/layouts/index.module.less +++ b/website/src/layouts/index.module.less @@ -22,6 +22,8 @@ } .layoutWrap { + position: relative; + z-index: 1; background-color: #fff; min-height: calc(100vh - 53px); }