🐛 fix(data-grid/table-designer/about): 修复空表横向滚动、索引编辑回显及关于弹窗按钮间距

- 空表滚动:虚拟模式下空数据表缺少 virtual-holder 元素时,回退到直接滚动表头实现横向滚动
- 索引回显:修复修改索引后再次编辑时被删除的字段仍然显示的问题,selectedIndex 随 groupedIndexes 同步更新
- 按钮间距:关于弹窗 footer 增加 flex-wrap 和 gap,解决关闭按钮与上方操作按钮行重叠
- refs #258
This commit is contained in:
Syngnat
2026-03-19 08:59:49 +08:00
parent 8efa7e2de6
commit 0adc8411fa
4 changed files with 30 additions and 8 deletions

View File

@@ -1 +1 @@
d0f9366af59a6367ad3c7e2d4185ead4
5b8157374dae5f9340e31b2d0bd2c00e

View File

@@ -1641,7 +1641,7 @@ function App() {
title={renderUtilityModalTitle(<InfoCircleOutlined />, '关于 GoNavi', '查看版本信息、仓库地址、更新状态与下载入口。')}
open={isAboutOpen}
onCancel={() => setIsAboutOpen(false)}
styles={{ content: utilityModalShellStyle, header: { background: 'transparent', borderBottom: 'none', paddingBottom: 8 }, body: { paddingTop: 8 }, footer: { background: 'transparent', borderTop: 'none', paddingTop: 10 } }}
styles={{ content: utilityModalShellStyle, header: { background: 'transparent', borderBottom: 'none', paddingBottom: 8 }, body: { paddingTop: 8 }, footer: { background: 'transparent', borderTop: 'none', paddingTop: 10, display: 'flex', flexWrap: 'wrap', gap: 10, justifyContent: 'flex-end' } }}
footer={[
canShowProgressEntry ? (
<Button key="progress" icon={<DownloadOutlined />} onClick={showUpdateDownloadProgress}></Button>

View File

@@ -3900,12 +3900,28 @@ const DataGrid: React.FC<DataGridProps> = ({
// 虚拟表格路径:通过合成 WheelEvent 驱动 rc-virtual-list 内部状态,
// rc-table 自动同步 header scrollLeft。
if (enableVirtual && tableContainer instanceof HTMLElement) {
applyVirtualHorizontalOffset(tableContainer, externalScroll.scrollLeft);
// WheelEvent 经 rc-virtual-list 处理后状态异步更新,延迟同步 ref
requestAnimationFrame(() => {
lastTableScrollLeftRef.current = readVirtualHorizontalOffset(tableContainer);
const applied = applyVirtualHorizontalOffset(tableContainer, externalScroll.scrollLeft);
if (applied) {
// WheelEvent 经 rc-virtual-list 处理后状态异步更新,延迟同步 ref
requestAnimationFrame(() => {
lastTableScrollLeftRef.current = readVirtualHorizontalOffset(tableContainer);
horizontalSyncSourceRef.current = '';
});
return;
}
// 空数据回退virtual-holder 不存在时,直接滚动表头
const headerEl = tableContainer.querySelector('.ant-table-header') as HTMLElement | null;
const contentEl = tableContainer.querySelector('.ant-table-content') as HTMLElement | null;
const fallbackTargets = [headerEl, contentEl].filter((el): el is HTMLElement => el instanceof HTMLElement && el.scrollWidth > el.clientWidth + 1);
if (fallbackTargets.length > 0) {
fallbackTargets.forEach((target) => {
target.scrollLeft = externalScroll.scrollLeft;
});
lastTableScrollLeftRef.current = externalScroll.scrollLeft;
horizontalSyncSourceRef.current = '';
});
return;
}
horizontalSyncSourceRef.current = '';
return;
}
// 非虚拟表格路径:依赖 liveTargets 进行 scrollLeft 同步

View File

@@ -1162,8 +1162,14 @@ ${selectedTrigger.statement}`;
useEffect(() => {
if (!selectedIndex) return;
if (!groupedIndexes.some(idx => idx.key === selectedIndex.key)) {
const freshIndex = groupedIndexes.find(idx => idx.key === selectedIndex.key);
if (!freshIndex) {
setSelectedIndex(null);
return;
}
// 索引仍存在但内容可能已变(如字段列表),同步为最新对象
if (freshIndex !== selectedIndex) {
setSelectedIndex(freshIndex);
}
}, [groupedIndexes, selectedIndex]);