mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-01 18:52:20 +08:00
fix: remove active field should not clear value (#4012)
* fix: remove active field * fix: fix field value submission on field removal --------- Co-authored-by: Zeke Zhang <958414905@qq.com>
This commit is contained in:
parent
fd2becd650
commit
6d7ecba59e
@ -750,9 +750,9 @@ export const useCurrentSchema = (action: string, key: string, find = findSchema,
|
||||
exists: !!schema,
|
||||
remove() {
|
||||
removeActiveFieldName?.(schema.name);
|
||||
form?.query(schema.name).forEach((field: Field) => {
|
||||
field.setInitialValue?.(null);
|
||||
field.reset?.();
|
||||
form?.query(new RegExp(`${schema.parent.name}.${schema.name}$`)).forEach((field: Field) => {
|
||||
// 如果字段被删掉,那么在提交的时候不应该提交这个字段
|
||||
field.setValue?.(undefined);
|
||||
});
|
||||
schema && rm(schema, remove);
|
||||
},
|
||||
|
@ -581,10 +581,10 @@ export const SchemaSettingsRemove: FC<SchemaSettingsRemoveProps> = (props) => {
|
||||
await confirm?.onOk?.();
|
||||
delete form.values[fieldSchema.name];
|
||||
removeActiveFieldName?.(fieldSchema.name as string);
|
||||
if (field?.setInitialValue && field?.reset) {
|
||||
field.setInitialValue(null);
|
||||
field.reset();
|
||||
}
|
||||
form?.query(new RegExp(`${fieldSchema.parent.name}.${fieldSchema.name}$`)).forEach((field: Field) => {
|
||||
// 如果字段被删掉,那么在提交的时候不应该提交这个字段
|
||||
field.setValue?.(undefined);
|
||||
});
|
||||
removeDataBlock(fieldSchema['x-uid']);
|
||||
},
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user