@@ -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
2730export default memo < IProps > ( ( props ) => {
2831 const { children, menuList } = props ;
2932 const allSupportedMenus = {
3033 [ AllSupportedMenusType . CopyCell ] : {
31- label : < MenuLabel icon = "" label = "拷贝" /> ,
34+ label : < MenuLabel icon = "" label = { i18n ( 'common.button.copy' ) } /> ,
3235 key : AllSupportedMenusType . CopyCell ,
3336 } ,
3437 [ AllSupportedMenusType . CopyRow ] : {
35- label : < MenuLabel icon = "" label = "拷贝行" /> ,
38+ label : < MenuLabel icon = "" 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 = "" label = "克隆行" /> ,
64+ label : < MenuLabel icon = "" label = { i18n ( 'common.button.cloneRow' ) } /> ,
6265 key : AllSupportedMenusType . CloneRow ,
6366 } ,
64-
6567 [ AllSupportedMenusType . DeleteRow ] : {
66- label : < MenuLabel icon = "" label = "删除行" /> ,
68+ label : < MenuLabel icon = "" 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