Skip to content

Commit 4a1dabf

Browse files
committed
【New Features】Edit data to support cell-level undo changes
1 parent b5b1297 commit 4a1dabf

8 files changed

Lines changed: 223 additions & 87 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
- ⭐【New Features】The tree node operation menu supports right-clicking
55
- ⭐【New Features】The tree node operation menu can copy the names of tables, fields, keys, indexes, and functions
66
- ⭐【New Features】Edit table structure supports setting primary keys in columns
7+
- ⭐【New Features】Edit data to support cell-level undo changes
78
- ⚡️【Optimize】
89
- 🐞【Fixed】Fixed table structure editing floating-point decimal Settings display exception
910

1011
**更新日志**
1112
- ⭐【新功能】树节点操作菜单支持右键唤出
1213
- ⭐【新功能】树节点操作菜单支持复制表、字段、key、index、函数等名称
1314
- ⭐【新功能】编辑表结构支持在列中设置主键
15+
- ⭐【新功能】编辑数据支持单元格级别撤销修改
1416
- ⚡️【优化】
1517
- 🐞【修复】修复表结构编辑浮点数小数位设置显示异常
1618

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@import '../../styles/var.less';
2+
3+
.menuLabel {
4+
display: flex;
5+
align-items: center;
6+
.menuLabelIcon {
7+
}
8+
.menuLabelTitle {
9+
margin-left: 14px;
10+
}
11+
:global {
12+
.ant-dropdown {
13+
z-index: 1080;
14+
}
15+
}
16+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React, { memo } from 'react';
2+
import classnames from 'classnames';
3+
import Iconfont from '@/components/Iconfont';
4+
import styles from './index.less';
5+
6+
interface IProps {
7+
className?: string;
8+
icon: string;
9+
label: string;
10+
}
11+
12+
export default memo<IProps>((props) => {
13+
const { className, icon, label } = props;
14+
return <div className={classnames(styles.menuLabel, className)}>
15+
{icon && <Iconfont className={styles.menuLabelIcon} code={icon} />}
16+
<div className={styles.menuLabelTitle}>{label}</div>
17+
</div>;
18+
});
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@import '../../styles/var.less';
2+
3+
.box {
4+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import React, { memo } from 'react';
2+
import { Dropdown } from 'antd';
3+
import i18n from '@/i18n';
4+
import MenuLabel from '@/components/MenuLabel';
5+
6+
interface IProps {
7+
className?: string;
8+
children?: React.ReactNode;
9+
}
10+
11+
export default memo<IProps>((props) => {
12+
const { children } = props;
13+
const items = [
14+
{
15+
label: <MenuLabel icon="&#xec7a;" label="拷贝" />,
16+
key: '0',
17+
},
18+
{
19+
label: <MenuLabel icon="&#xec7a;" label="拷贝行" />,
20+
key: '1',
21+
children: [
22+
{
23+
label: 'Insert 语句',
24+
key: '1-1',
25+
onClick: () => {},
26+
},
27+
{
28+
label: 'Update 语句',
29+
key: '1-2',
30+
onClick: () => {},
31+
},
32+
{
33+
label: '制表符分隔值(数据)',
34+
key: '1-3',
35+
onClick: () => {},
36+
},
37+
{
38+
label: '制表符分隔值(字段名)',
39+
key: '1-4',
40+
onClick: () => {},
41+
},
42+
{
43+
label: '制表符分隔值(字段名和数据)',
44+
key: '1-5',
45+
onClick: () => {},
46+
},
47+
]
48+
},
49+
{
50+
label: <MenuLabel icon="&#xec7a;" label="克隆行" />,
51+
key: '2',
52+
onClick: () => {},
53+
},
54+
{
55+
label: <MenuLabel icon="&#xe6a7;" label="删除行" />,
56+
key: '3',
57+
onClick: () => {},
58+
},
59+
]
60+
61+
return <Dropdown menu={{ items }} trigger={["contextMenu"]} >
62+
{children}
63+
</Dropdown>;
64+
});

chat2db-client/src/components/SearchResult/TableBox/index.less

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@
191191
}
192192

193193
.tableItem {
194-
height: 30px;
194+
height: 31px;
195195
cursor: pointer;
196196
display: flex;
197197
align-items: center;
@@ -202,8 +202,8 @@
202202
background-color: var(--color-bg-base);
203203

204204
.tableItemContent {
205-
max-height: 30px;
206-
line-height: 30px;
205+
max-height: 31px;
206+
line-height: 31px;
207207
flex: 1;
208208
width: 100%;
209209
overflow: hidden;
@@ -235,10 +235,17 @@
235235
background-color: var(--color-success-bg);
236236
}
237237
}
238-
.tableItemEditing {
239-
background-color: var(--color-primary-bg-hover);
238+
.tableItemHighlight {
239+
background-color: var(--color-bg-subtle);
240+
.tableHoverBox {
241+
background-color: var(--color-bg-subtle);
242+
}
243+
}
244+
.tableItemFocus {
245+
background-color: var(--color-primary-hover);
246+
color: var(--color-bg-base);
240247
.tableHoverBox {
241-
background-color: var(--color-primary-bg-hover);
248+
background-color: var(--color-primary-hover);
242249
}
243250
}
244251
.tableItemSuccess {
@@ -261,6 +268,7 @@
261268

262269
.tableHoverBox {
263270
position: sticky;
271+
height: 31px;
264272
top: 0px;
265273
bottom: 0px;
266274
right: 0px;
@@ -274,10 +282,6 @@
274282
font-size: 15px;
275283
margin: 0px 2px;
276284
}
277-
278-
i:hover {
279-
color: var(--color-primary);
280-
}
281285
}
282286

283287
.pagination {

0 commit comments

Comments
 (0)