|
|
@ -47,20 +47,21 @@ const [useProvideColumnCreateStore, useColumnCreateStore] = createInjectionState |
|
|
|
}, |
|
|
|
}, |
|
|
|
// validation for unique column name
|
|
|
|
// validation for unique column name
|
|
|
|
{ |
|
|
|
{ |
|
|
|
validator: (rule: any, value: any, callback: (errMsg?: string) => void) => { |
|
|
|
validator: (rule: any, value: any) => { |
|
|
|
if ( |
|
|
|
return new Promise<void>((resolve, reject) => { |
|
|
|
meta.value?.columns?.some( |
|
|
|
if ( |
|
|
|
(c) => |
|
|
|
meta.value?.columns?.some( |
|
|
|
c.id !== formState.value.id && // ignore current column
|
|
|
|
(c) => |
|
|
|
// compare against column_name and title
|
|
|
|
c.id !== formState.value.id && // ignore current column
|
|
|
|
((value || '').toLowerCase() === (c.column_name || '').toLowerCase() || |
|
|
|
// compare against column_name and title
|
|
|
|
(value || '').toLowerCase() === (c.title || '').toLowerCase()), |
|
|
|
((value || '').toLowerCase() === (c.column_name || '').toLowerCase() || |
|
|
|
) |
|
|
|
(value || '').toLowerCase() === (c.title || '').toLowerCase()), |
|
|
|
) { |
|
|
|
) |
|
|
|
callback('Duplicate column name') |
|
|
|
) { |
|
|
|
} |
|
|
|
return reject(new Error('Duplicate column name')) |
|
|
|
|
|
|
|
} |
|
|
|
callback() |
|
|
|
resolve() |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
], |
|
|
|
], |
|
|
|