Skip to content

Commit 734bc48

Browse files
committed
i18n Right click of cell
1 parent d18ef0a commit 734bc48

10 files changed

Lines changed: 250 additions & 135 deletions

File tree

CHANGELOG.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,29 @@
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
77
- ⭐【New Features】Edit data to support cell-level undo changes
8-
- ⭐【New Features】Query data supports single-row replication of Insert, Update, table header, and row data
9-
- ⚡️【Optimize】
8+
- ⭐【New Features】 Edit data support right click operation
9+
1. Supports single-row replication of Insert, Update, table header fields, and row data
10+
2. Clone the selected row
11+
3. Replication of cell data is supported
12+
4. You can set the cell to Null or Default
13+
5. Row deletion is supported
14+
- ⭐【New Features】History is added to the foldable panel on the right
15+
- ⚡️【Optimize】Edit the table structure to add loading
1016
- 🐞【Fixed】Fixed table structure editing floating-point decimal Settings display exception
1117

1218
**更新日志**
1319
- ⭐【新功能】树节点操作菜单支持右键唤出
1420
- ⭐【新功能】树节点操作菜单支持复制表、字段、key、index、函数等名称
1521
- ⭐【新功能】编辑表结构支持在列中设置主键
1622
- ⭐【新功能】编辑数据支持单元格级别撤销修改
17-
- ⭐【新功能】查询数据支持单行复制Insert、Update、表头、行数据
18-
- ⚡️【优化】
23+
- ⭐【新功能】编辑数据支持右键操作
24+
1. 支持单行复制 Insert、Update、表头字段、行数据
25+
2. 支持克隆选中行
26+
3. 支持复制单元格数据
27+
4. 支持设置单元格为Null和Default
28+
5. 支持删除行
29+
- ⭐【新功能】右侧可折叠面板中增加历史记录
30+
- ⚡️【优化】编辑表结构添加loading
1931
- 🐞【修复】修复表结构编辑浮点数小数位设置显示异常
2032

2133

chat2db-client/src/components/Iconfont/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ if (__ENV__ === 'local') {
99
/* 在线链接服务仅供平台体验和调试使用,平台不承诺服务的稳定性,企业客户需下载字体包自行发布使用并做好备份。 */
1010
@font-face {
1111
font-family: 'iconfont'; /* Project id 3633546 */
12-
src: url('//at.alicdn.com/t/c/font_3633546_201093ssteq.woff2?t=1698848610675') format('woff2'),
13-
url('//at.alicdn.com/t/c/font_3633546_201093ssteq.woff?t=1698848610675') format('woff'),
14-
url('//at.alicdn.com/t/c/font_3633546_201093ssteq.ttf?t=1698848610675') format('truetype');
12+
src: url('//at.alicdn.com/t/c/font_3633546_fb1ux1e03iu.woff2?t=1699016556952') format('woff2'),
13+
url('//at.alicdn.com/t/c/font_3633546_fb1ux1e03iu.woff?t=1699016556952') format('woff'),
14+
url('//at.alicdn.com/t/c/font_3633546_fb1ux1e03iu.ttf?t=1699016556952') format('truetype');
1515
}
1616
`;
1717
const style = document.createElement('style');

chat2db-client/src/components/MenuLabel/index.less

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
.menuLabel {
44
display: flex;
55
align-items: center;
6+
.menuLabelIconBox{
7+
width: 22px;
8+
display: flex;
9+
align-items: center;
10+
}
611
.menuLabelIcon {
712
}
813
.menuLabelTitle {
9-
margin-left: 14px;
1014
}
1115
:global {
1216
.ant-dropdown {

chat2db-client/src/components/MenuLabel/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ import styles from './index.less';
55

66
interface IProps {
77
className?: string;
8-
icon: string;
8+
icon?: string;
99
label: string;
1010
}
1111

1212
export default memo<IProps>((props) => {
1313
const { className, icon, label } = props;
1414
return <div className={classnames(styles.menuLabel, className)}>
15-
{icon && <Iconfont className={styles.menuLabelIcon} code={icon} />}
15+
<div className={styles.menuLabelIconBox}>
16+
{icon && <Iconfont className={styles.menuLabelIcon} code={icon} />}
17+
</div>
1618
<div className={styles.menuLabelTitle}>{label}</div>
1719
</div>;
1820
});

chat2db-client/src/components/Output/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ export default memo<IProps>((props) => {
7272
<div className={classnames(styles.iconBox, { [styles.failureIconBox]: item.status !== 'success' })}>
7373
<Iconfont code="&#xe650;" />
7474
</div>
75-
<span className={styles.timeSpan}>[{item.useTime}]</span>
76-
{!!item.operationRows && <span>{item.operationRows} rows</span>}
77-
{!!item.useTime && <span>affected in {item.useTime} ms</span>}
75+
<span className={styles.timeSpan}>[{item.gmtCreate}]</span>
76+
{/* {!!item.operationRows && <span>{item.operationRows} rows</span>} */}
77+
{!!item.useTime && <span>{i18n('common.text.executionTime',item.useTime)}</span>}
7878
</div>
7979
<div className={styles.sqlPlace}>{nameList.filter((name) => name).join(' > ')}</div>
8080
<div className={styles.sqlBox} dangerouslySetInnerHTML={{ __html: item.highlightedCode }} />

chat2db-client/src/components/SearchResult/RightClickMenu/index.tsx

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export interface IMenu {
1414
callback?: () => void;
1515
children?: {
1616
callback: () => void;
17+
hide?: boolean;
1718
}[]
1819
}
1920

@@ -22,50 +23,59 @@ export enum AllSupportedMenusType {
2223
CopyRow = 'copy-row',
2324
CloneRow = 'clone-row',
2425
DeleteRow = 'delete-row',
26+
SetDefault = 'set-default',
27+
SetNull = 'set-null',
2528
}
2629

2730
export default memo<IProps>((props) => {
2831
const { children, menuList } = props;
2932
const allSupportedMenus = {
3033
[AllSupportedMenusType.CopyCell]: {
31-
label: <MenuLabel icon="&#xec7a;" label="拷贝" />,
34+
label: <MenuLabel icon="&#xec7a;" label={i18n('common.button.copy')} />,
3235
key: AllSupportedMenusType.CopyCell,
3336
},
3437
[AllSupportedMenusType.CopyRow]: {
35-
label: <MenuLabel icon="&#xec7a;" label="拷贝行" />,
38+
label: <MenuLabel icon="&#xec7a;" label={i18n('common.button.copyRowAs')} />,
3639
key: AllSupportedMenusType.CopyRow,
3740
children: [
3841
{
39-
label: 'Insert 语句',
42+
label: i18n('common.button.insertSql'),
4043
key: 'copy-row-1',
4144
},
4245
{
43-
label: 'Update 语句',
46+
label: i18n('common.button.updateSql'),
4447
key: 'copy-row-2',
4548
},
4649
{
47-
label: '制表符分隔值(数据)',
50+
label: i18n('common.button.tabularSeparatedValues'),
4851
key: 'copy-row-3',
4952
},
5053
{
51-
label: '制表符分隔值(字段名)',
54+
label: i18n('common.button.tabularSeparatedValuesFieldName'),
5255
key: 'copy-row-4',
5356
},
5457
{
55-
label: '制表符分隔值(字段名和数据)',
58+
label: i18n('common.button.tabularSeparatedValuesFieldNameAndData'),
5659
key: 'copy-row-5',
5760
},
5861
]
5962
},
6063
[AllSupportedMenusType.CloneRow]: {
61-
label: <MenuLabel icon="&#xec7a;" label="克隆行" />,
64+
label: <MenuLabel icon="&#xec7a;" label={i18n('common.button.cloneRow')} />,
6265
key: AllSupportedMenusType.CloneRow,
6366
},
64-
6567
[AllSupportedMenusType.DeleteRow]: {
66-
label: <MenuLabel icon="&#xe6a7;" label="删除行" />,
68+
label: <MenuLabel icon="&#xe6a7;" label={i18n('common.button.deleteRow')} />,
6769
key: AllSupportedMenusType.DeleteRow,
68-
}
70+
},
71+
[AllSupportedMenusType.SetDefault]: {
72+
label: <MenuLabel label={i18n('common.button.setDefault')} />,
73+
key: AllSupportedMenusType.SetDefault,
74+
},
75+
[AllSupportedMenusType.SetNull]: {
76+
label: <MenuLabel label={i18n('common.button.setNull')} />,
77+
key: AllSupportedMenusType.SetNull,
78+
},
6979
}
7080

7181
const items = useMemo(()=>{
@@ -74,6 +84,7 @@ export default memo<IProps>((props) => {
7484
...allSupportedMenus[menu.key],
7585
onClick: menu.callback,
7686
children: menu.children?.map((child,index) => {
87+
if (child.hide) return null;
7788
return {
7889
...allSupportedMenus[menu.key]['children'][index],
7990
onClick: child.callback,

0 commit comments

Comments
 (0)