mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 14:56:00 +00:00
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:
parent
8b75738c90
commit
dcafbb10c8
@ -563,10 +563,10 @@ export const useFilterInheritsFormItemInitializerFields = (options?) => {
|
|||||||
const { getInterface, getInheritCollections, getCollection, getParentCollectionFields } = useCollectionManager();
|
const { getInterface, getInheritCollections, getCollection, getParentCollectionFields } = useCollectionManager();
|
||||||
const inherits = getInheritCollections(name);
|
const inherits = getInheritCollections(name);
|
||||||
const { snapshot } = useActionContext();
|
const { snapshot } = useActionContext();
|
||||||
|
const form = useForm();
|
||||||
|
|
||||||
return inherits?.map((v) => {
|
return inherits?.map((v) => {
|
||||||
const fields = getParentCollectionFields(v, name);
|
const fields = getParentCollectionFields(v, name);
|
||||||
const form = useForm();
|
|
||||||
const { readPretty = form.readPretty, block = 'Form' } = options || {};
|
const { readPretty = form.readPretty, block = 'Form' } = options || {};
|
||||||
const targetCollection = getCollection(v);
|
const targetCollection = getCollection(v);
|
||||||
return {
|
return {
|
||||||
@ -710,10 +710,13 @@ const findSchema = (schema: Schema, key: string, action: string) => {
|
|||||||
if (s[key] === action) {
|
if (s[key] === action) {
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
if (s['x-component'] !== 'Action.Container') {
|
||||||
const c = findSchema(s, key, action);
|
const c = findSchema(s, key, action);
|
||||||
if (c) {
|
if (c) {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -741,7 +744,6 @@ export const useCurrentSchema = (action: string, key: string, find = findSchema,
|
|||||||
const { remove } = useDesignable();
|
const { remove } = useDesignable();
|
||||||
const schema = find(fieldSchema, key, action);
|
const schema = find(fieldSchema, key, action);
|
||||||
const ctx = useContext(BlockRequestContext);
|
const ctx = useContext(BlockRequestContext);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
schema,
|
schema,
|
||||||
exists: !!schema,
|
exists: !!schema,
|
||||||
|
Loading…
Reference in New Issue
Block a user