@@ -10,7 +10,7 @@ import { CSS } from '@dnd-kit/utilities';
1010import { Context } from '../index' ;
1111import { IColumnItemNew , IColumnTypes } from '@/typings' ;
1212import i18n from '@/i18n' ;
13- import { EditColumnOperationType } from '@/constants' ;
13+ import { EditColumnOperationType , DatabaseTypeCode } from '@/constants' ;
1414import CustomSelect from '@/components/CustomSelect' ;
1515import Iconfont from '@/components/Iconfont' ;
1616
@@ -93,7 +93,7 @@ const createInitialData = () => {
9393} ;
9494
9595const ColumnList = forwardRef ( ( props : IProps , ref : ForwardedRef < IColumnListRef > ) => {
96- const { databaseSupportField, databaseName, schemaName, tableDetails } = useContext ( Context ) ;
96+ const { databaseSupportField, databaseName, schemaName, tableDetails, databaseType } = useContext ( Context ) ;
9797 const [ dataSource , setDataSource ] = useState < IColumnItemNew [ ] > ( [ createInitialData ( ) ] ) ;
9898 const [ form ] = Form . useForm ( ) ;
9999 const [ editingData , setEditingData ] = useState < IColumnItemNew | null > ( null ) ;
@@ -246,6 +246,10 @@ const ColumnList = forwardRef((props: IProps, ref: ForwardedRef<IColumnListRef>)
246246 {
247247 width : '40px' ,
248248 render : ( text : string , record : IColumnItemNew ) => {
249+ // sqlLite不支持删除字段,新增的字段可以删除
250+ if ( databaseType === DatabaseTypeCode . SQLITE && record . editStatus !== EditColumnOperationType . Add ) {
251+ return null ;
252+ }
249253 return (
250254 < div
251255 className = { styles . operationBar }
@@ -384,6 +388,27 @@ const ColumnList = forwardRef((props: IProps, ref: ForwardedRef<IColumnListRef>)
384388 < Checkbox />
385389 </ Form . Item >
386390 ) }
391+ { databaseType === DatabaseTypeCode . SQLSERVER && (
392+ < Form . Item labelCol = { labelCol } label = { i18n ( 'editTable.label.sparse' ) } name = "sparse" valuePropName = "checked" >
393+ < Checkbox />
394+ </ Form . Item >
395+ ) }
396+ { editingConfig ?. supportDefaultValue && (
397+ < Form . Item labelCol = { labelCol } label = { i18n ( 'editTable.label.defaultValue' ) } name = "defaultValue" >
398+ < CustomSelect
399+ options = { [
400+ {
401+ label : 'EMPTY_STRING' ,
402+ value : 'EMPTY_STRING' ,
403+ } ,
404+ {
405+ label : 'NULL' ,
406+ value : 'NULL' ,
407+ } ,
408+ ] }
409+ />
410+ </ Form . Item >
411+ ) }
387412 { editingConfig ?. supportDefaultValue && (
388413 < Form . Item labelCol = { labelCol } label = { i18n ( 'editTable.label.defaultValue' ) } name = "defaultValue" >
389414 < CustomSelect
@@ -415,6 +440,17 @@ const ColumnList = forwardRef((props: IProps, ref: ForwardedRef<IColumnListRef>)
415440 < Input autoComplete = "off" />
416441 </ Form . Item >
417442 ) }
443+ { editingConfig ?. supportUnit && (
444+ < Form . Item labelCol = { labelCol } label = { i18n ( 'editTable.label.unit' ) } name = "unit" >
445+ < Select style = { { width : '100%' } } >
446+ { [ 'CHAR' , 'BYTE' ] . map ( ( i ) => (
447+ < Select . Option key = { i } value = { i } >
448+ { i }
449+ </ Select . Option >
450+ ) ) }
451+ </ Select >
452+ </ Form . Item >
453+ ) }
418454 { editingConfig ?. supportValue && (
419455 < Form . Item labelCol = { labelCol } label = { i18n ( 'editTable.label.value' ) } name = "value" >
420456 < Input autoComplete = "off" />
@@ -427,6 +463,10 @@ const ColumnList = forwardRef((props: IProps, ref: ForwardedRef<IColumnListRef>)
427463 const onRow = ( record : any ) => {
428464 return {
429465 onClick : ( ) => {
466+ // sqlLite不支持修改字段,新增的字段可以修改
467+ if ( databaseType === DatabaseTypeCode . SQLITE && record . editStatus !== EditColumnOperationType . Add ) {
468+ return ;
469+ }
430470 if ( editingData ?. key !== record . key ) {
431471 edit ( record ) ;
432472 }
0 commit comments