fix(findSchema): table operation action and detail operation action interact with each other (#2446)

* fix: table operation action  and detail operation action  interact with each other

* refactor: code imrove
This commit is contained in:
katherinehhh 2023-08-14 15:53:28 +08:00 committed by GitHub
parent 8b75738c90
commit dcafbb10c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -563,10 +563,10 @@ export const useFilterInheritsFormItemInitializerFields = (options?) => {
const { getInterface, getInheritCollections, getCollection, getParentCollectionFields } = useCollectionManager();
const inherits = getInheritCollections(name);
const { snapshot } = useActionContext();
const form = useForm();
return inherits?.map((v) => {
const fields = getParentCollectionFields(v, name);
const form = useForm();
const { readPretty = form.readPretty, block = 'Form' } = options || {};
const targetCollection = getCollection(v);
return {
@ -710,10 +710,13 @@ const findSchema = (schema: Schema, key: string, action: string) => {
if (s[key] === action) {
return s;
}
const c = findSchema(s, key, action);
if (c) {
return c;
if (s['x-component'] !== 'Action.Container') {
const c = findSchema(s, key, action);
if (c) {
return c;
}
}
return buf;
});
};
@ -741,7 +744,6 @@ export const useCurrentSchema = (action: string, key: string, find = findSchema,
const { remove } = useDesignable();
const schema = find(fieldSchema, key, action);
const ctx = useContext(BlockRequestContext);
return {
schema,
exists: !!schema,