= ({
copyRowsForPaste([rowKey]);
}}
onPasteCopiedRowsAsNew={handlePasteCopiedRowsAsNew}
+ onUndoCellChange={handleUndoContextMenuCellChange}
onSetNull={handleCellSetNull}
onEditRow={handleOpenContextMenuRowEditor}
onFillToSelected={() => {
diff --git a/frontend/src/components/DataGridLegacyCellContextMenu.tsx b/frontend/src/components/DataGridLegacyCellContextMenu.tsx
index 7167aaa..ed79685 100644
--- a/frontend/src/components/DataGridLegacyCellContextMenu.tsx
+++ b/frontend/src/components/DataGridLegacyCellContextMenu.tsx
@@ -1,6 +1,6 @@
import React from 'react';
import { createPortal } from 'react-dom';
-import { CopyOutlined, EditOutlined, VerticalAlignBottomOutlined } from '@ant-design/icons';
+import { CopyOutlined, EditOutlined, UndoOutlined, VerticalAlignBottomOutlined } from '@ant-design/icons';
interface CellContextMenuState {
visible: boolean;
@@ -19,12 +19,14 @@ interface DataGridLegacyCellContextMenuProps {
copiedRowsForPasteLength: number;
selectedRowKeysLength: number;
copiedCellPatchAvailable: boolean;
+ canUndoCellChange: boolean;
supportsCopyInsert: boolean;
onClose: () => void;
onCopyFieldName: () => void;
onCopyRowData: () => void;
onCopyRowForPaste: () => void;
onPasteCopiedRowsAsNew: () => void;
+ onUndoCellChange: () => void;
onSetNull: () => void;
onEditRow: () => void;
onFillToSelected: () => void;
@@ -62,12 +64,14 @@ const DataGridLegacyCellContextMenu: React.FC
{canModifyData && (
<>
+ {
+ if (canUndoCellChange) {
+ onUndoCellChange();
+ }
+ }}
+ >
+
+ 撤销此单元格修改
+
设置为 NULL
diff --git a/frontend/src/components/V2TableContextMenu.tsx b/frontend/src/components/V2TableContextMenu.tsx
index 38747f9..d8ccb79 100644
--- a/frontend/src/components/V2TableContextMenu.tsx
+++ b/frontend/src/components/V2TableContextMenu.tsx
@@ -27,6 +27,7 @@ import {
FolderAddOutlined,
HddOutlined,
PushpinOutlined,
+ UndoOutlined,
SortAscendingOutlined,
SortDescendingOutlined,
VerticalAlignBottomOutlined,
@@ -543,6 +544,7 @@ export type V2CellContextMenuActionKey =
| 'copy-row-for-paste'
| 'paste-row-as-new'
| 'copy-column-data'
+ | 'undo-cell-change'
| 'set-null'
| 'edit-row'
| 'fill-selected'
@@ -652,6 +654,7 @@ export const V2CellContextMenuView: React.FC<{
rowLabel?: string;
selectedRowCount?: number;
canModifyData?: boolean;
+ canUndoCellChange?: boolean;
copiedRowCount?: number;
canPasteCopiedColumns?: boolean;
supportsCopyInsert?: boolean;
@@ -663,6 +666,7 @@ export const V2CellContextMenuView: React.FC<{
rowLabel,
selectedRowCount = 0,
canModifyData = false,
+ canUndoCellChange = false,
copiedRowCount = 0,
canPasteCopiedColumns = false,
supportsCopyInsert = true,
@@ -694,6 +698,12 @@ export const V2CellContextMenuView: React.FC<{
<>
编辑
{renderItems([
+ {
+ action: 'undo-cell-change',
+ icon: ,
+ title: '撤销此单元格修改',
+ disabled: !canUndoCellChange,
+ },
{ action: 'set-null', icon: , title: '设置为 NULL' },
{ action: 'edit-row', icon: , title: '编辑本行', kbd: '↵' },
{ action: 'copy-row-for-paste', icon: , title: '复制本行为新增行' },