mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-02 03:02:19 +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,
|
exists: !!schema,
|
||||||
remove() {
|
remove() {
|
||||||
removeActiveFieldName?.(schema.name);
|
removeActiveFieldName?.(schema.name);
|
||||||
form?.query(schema.name).forEach((field: Field) => {
|
form?.query(new RegExp(`${schema.parent.name}.${schema.name}$`)).forEach((field: Field) => {
|
||||||
field.setInitialValue?.(null);
|
// 如果字段被删掉,那么在提交的时候不应该提交这个字段
|
||||||
field.reset?.();
|
field.setValue?.(undefined);
|
||||||
});
|
});
|
||||||
schema && rm(schema, remove);
|
schema && rm(schema, remove);
|
||||||
},
|
},
|
||||||
|
@ -581,10 +581,10 @@ export const SchemaSettingsRemove: FC<SchemaSettingsRemoveProps> = (props) => {
|
|||||||
await confirm?.onOk?.();
|
await confirm?.onOk?.();
|
||||||
delete form.values[fieldSchema.name];
|
delete form.values[fieldSchema.name];
|
||||||
removeActiveFieldName?.(fieldSchema.name as string);
|
removeActiveFieldName?.(fieldSchema.name as string);
|
||||||
if (field?.setInitialValue && field?.reset) {
|
form?.query(new RegExp(`${fieldSchema.parent.name}.${fieldSchema.name}$`)).forEach((field: Field) => {
|
||||||
field.setInitialValue(null);
|
// 如果字段被删掉,那么在提交的时候不应该提交这个字段
|
||||||
field.reset();
|
field.setValue?.(undefined);
|
||||||
}
|
});
|
||||||
removeDataBlock(fieldSchema['x-uid']);
|
removeDataBlock(fieldSchema['x-uid']);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user