From 818b75b6914b033564cd62f1b55dc641a80daba0 Mon Sep 17 00:00:00 2001 From: Syngnat Date: Thu, 23 Jul 2026 08:45:48 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(overlay):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=B5=AE=E7=AA=97=E4=B8=8E=E5=BC=B9=E5=B1=82=E5=B1=82?= =?UTF-8?q?=E7=BA=A7=E9=81=AE=E6=8C=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 统一分离窗口、弹出层和弹窗的层级常量 - 将浮动窗口通过 Portal 挂载到 body 并隔离 AntD 弹层 - 补充右键菜单和分离窗口层级回归测试 --- .../DataGridLegacyCellContextMenu.tsx | 3 +- frontend/src/components/DataGridShell.tsx | 3 +- .../src/components/FloatingAIChatWindow.tsx | 16 +++++-- .../components/FloatingQueryResultWindows.tsx | 21 ++++++--- .../components/FloatingWorkbenchWindows.tsx | 21 ++++++--- frontend/src/components/Sidebar.tsx | 3 +- frontend/src/components/TableOverview.tsx | 3 +- .../components/resultDiff/ResultDiffPanel.tsx | 21 ++++++--- frontend/src/utils/detachedWindow.test.ts | 15 +++++-- frontend/src/utils/detachedWindow.ts | 4 +- frontend/src/utils/overlayZIndex.test.ts | 44 +++++++++++++++++-- frontend/src/utils/overlayZIndex.ts | 11 ++--- .../resultDiff/detachedBoundsMemory.test.ts | 2 + .../utils/resultDiff/detachedBoundsMemory.ts | 3 +- 14 files changed, 133 insertions(+), 37 deletions(-) diff --git a/frontend/src/components/DataGridLegacyCellContextMenu.tsx b/frontend/src/components/DataGridLegacyCellContextMenu.tsx index dda612cc..c8afbc00 100644 --- a/frontend/src/components/DataGridLegacyCellContextMenu.tsx +++ b/frontend/src/components/DataGridLegacyCellContextMenu.tsx @@ -2,6 +2,7 @@ import React from 'react'; import { createPortal } from 'react-dom'; import { CopyOutlined, EditOutlined, UndoOutlined, VerticalAlignBottomOutlined } from '@ant-design/icons'; import { t } from '../i18n'; +import { APP_POPUP_Z_INDEX } from '../utils/overlayZIndex'; interface CellContextMenuState { visible: boolean; @@ -125,7 +126,7 @@ const DataGridLegacyCellContextMenu: React.FC ( position: 'fixed', left: cellContextMenu.x, top: cellContextMenu.y, - zIndex: 10000, + zIndex: APP_POPUP_Z_INDEX, }} onClick={(e) => e.stopPropagation()} > diff --git a/frontend/src/components/FloatingAIChatWindow.tsx b/frontend/src/components/FloatingAIChatWindow.tsx index b885df83..4ce6c191 100644 --- a/frontend/src/components/FloatingAIChatWindow.tsx +++ b/frontend/src/components/FloatingAIChatWindow.tsx @@ -1,5 +1,6 @@ import React, { useCallback, useMemo, useRef } from 'react'; -import { Button, Spin } from 'antd'; +import { createPortal } from 'react-dom'; +import { Button, ConfigProvider, Spin } from 'antd'; import { useStore } from '../store'; import { t } from '../i18n'; import { @@ -10,6 +11,7 @@ import { } from '../utils/detachedWindow'; import type { OverlayWorkbenchTheme } from '../utils/overlayWorkbenchTheme'; import { hasNativeDetachedWindowManager } from '../utils/nativeDetachedWindowHost'; +import { APP_POPUP_Z_INDEX } from '../utils/overlayZIndex'; import { useManagedPointerInteraction } from '../hooks/useManagedPointerInteraction'; import AIPanelErrorBoundary from './ai/AIPanelErrorBoundary'; @@ -129,8 +131,9 @@ const FloatingAIChatWindow: React.FC = ({ const isDark = theme === 'dark'; const bounds = windowState; - return ( -
+ const floatingWindow = ( + +