mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 11:56:29 +00:00
fix: associationSelect
This commit is contained in:
parent
c785beb865
commit
d6d2a81523
@ -1097,7 +1097,7 @@ export const useAssociationNames = (collection) => {
|
|||||||
}, new Schema({}));
|
}, new Schema({}));
|
||||||
|
|
||||||
const getAssociationAppends = (schema, arr = []) => {
|
const getAssociationAppends = (schema, arr = []) => {
|
||||||
return schema.reduceProperties((buf, s) => {
|
const data = schema.reduceProperties((buf, s) => {
|
||||||
const collectionfield = s['x-collection-field'] && getCollectionJoinField(s['x-collection-field']);
|
const collectionfield = s['x-collection-field'] && getCollectionJoinField(s['x-collection-field']);
|
||||||
if (
|
if (
|
||||||
collectionfield &&
|
collectionfield &&
|
||||||
@ -1121,7 +1121,9 @@ export const useAssociationNames = (collection) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, arr);
|
}, arr);
|
||||||
|
return data || [];
|
||||||
};
|
};
|
||||||
|
|
||||||
function flattenNestedList(nestedList) {
|
function flattenNestedList(nestedList) {
|
||||||
const flattenedList = [];
|
const flattenedList = [];
|
||||||
function flattenHelper(list, prefix) {
|
function flattenHelper(list, prefix) {
|
||||||
@ -1146,7 +1148,7 @@ export const useAssociationNames = (collection) => {
|
|||||||
}, data);
|
}, data);
|
||||||
return data.filter((g) => g.length);
|
return data.filter((g) => g.length);
|
||||||
};
|
};
|
||||||
const data = getAssociationAppends(formSchema)||[];
|
const data = getAssociationAppends(formSchema);
|
||||||
const associations = data.filter((g) => g.length);
|
const associations = data.filter((g) => g.length);
|
||||||
const appends = flattenNestedList(associations);
|
const appends = flattenNestedList(associations);
|
||||||
return { appends, updateAssociationValues: appends.filter((v) => associationValues.includes(v)) };
|
return { appends, updateAssociationValues: appends.filter((v) => associationValues.includes(v)) };
|
||||||
|
@ -74,7 +74,7 @@ const InternalAssociationSelect = observer((props: AssociationSelectProps) => {
|
|||||||
</Input.Group>
|
</Input.Group>
|
||||||
|
|
||||||
<ActionContext.Provider value={{ openMode: 'drawer', visible: visibleAddNewer, setVisible: setVisibleAddNewer }}>
|
<ActionContext.Provider value={{ openMode: 'drawer', visible: visibleAddNewer, setVisible: setVisibleAddNewer }}>
|
||||||
<CollectionProvider name={collectionField.target}>
|
<CollectionProvider name={collectionField?.target}>
|
||||||
<RecursionField
|
<RecursionField
|
||||||
onlyRenderProperties
|
onlyRenderProperties
|
||||||
basePath={field.address}
|
basePath={field.address}
|
||||||
|
Loading…
Reference in New Issue
Block a user