|
|
@ -45,6 +45,24 @@ const [useProvideColumnCreateStore, useColumnCreateStore] = createInjectionState |
|
|
|
required: true, |
|
|
|
required: true, |
|
|
|
message: 'Column name is required', |
|
|
|
message: 'Column name is required', |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
// validation for unique column name
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
validator: (rule: any, value: any, callback: (errMsg?: string) => void) => { |
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
|
|
meta.value?.columns?.some( |
|
|
|
|
|
|
|
(c) => |
|
|
|
|
|
|
|
c.id !== formState.value.id && // ignore current column
|
|
|
|
|
|
|
|
// compare against column_name and title
|
|
|
|
|
|
|
|
((value || '').toLowerCase() === (c.column_name || '').toLowerCase() || |
|
|
|
|
|
|
|
(value || '').toLowerCase() === (c.title || '').toLowerCase()), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
callback('Duplicate column name') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
callback() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
], |
|
|
|
], |
|
|
|
uidt: [ |
|
|
|
uidt: [ |
|
|
|
{ |
|
|
|
{ |
|
|
|