mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-09 15:39:24 +08:00
fix: error when overriding sorting field (#4752)
This commit is contained in:
parent
0c7d697774
commit
9669d56d84
@ -113,7 +113,7 @@ const getIsOverriding = (currentFields, record) => {
|
|||||||
export const OverridingFieldAction = (props) => {
|
export const OverridingFieldAction = (props) => {
|
||||||
const { scope, getContainer, item: record, parentItem: parentRecord, children, currentCollection } = props;
|
const { scope, getContainer, item: record, parentItem: parentRecord, children, currentCollection } = props;
|
||||||
const { target, through } = record;
|
const { target, through } = record;
|
||||||
const { getInterface, getCurrentCollectionFields, getChildrenCollections, collections } =
|
const { getInterface, getCollection, getCurrentCollectionFields, getChildrenCollections, collections } =
|
||||||
useCollectionManager_deprecated();
|
useCollectionManager_deprecated();
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
const [schema, setSchema] = useState({});
|
const [schema, setSchema] = useState({});
|
||||||
@ -171,6 +171,23 @@ export const OverridingFieldAction = (props) => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const scopeKeyOptions = useMemo(() => {
|
||||||
|
return (
|
||||||
|
record?.fields ||
|
||||||
|
getCollection(record.collectionName)
|
||||||
|
?.options.fields.filter((v) => {
|
||||||
|
return ['string', 'bigInt', 'integer'].includes(v.type);
|
||||||
|
})
|
||||||
|
.map((k) => {
|
||||||
|
return {
|
||||||
|
value: k.name,
|
||||||
|
label: compile(k.uiSchema?.title),
|
||||||
|
};
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}, [record.name]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RecordProvider record={{ ...record, collectionName: parentRecord.name }} parent={parentRecord}>
|
<RecordProvider record={{ ...record, collectionName: parentRecord.name }} parent={parentRecord}>
|
||||||
<ActionContextProvider value={{ visible, setVisible }}>
|
<ActionContextProvider value={{ visible, setVisible }}>
|
||||||
@ -221,6 +238,7 @@ export const OverridingFieldAction = (props) => {
|
|||||||
isOverride: true,
|
isOverride: true,
|
||||||
targetScope: { target: getFilterCollections(target), through: getFilterCollections(through) },
|
targetScope: { target: getFilterCollections(target), through: getFilterCollections(through) },
|
||||||
collections: currentCollections,
|
collections: currentCollections,
|
||||||
|
scopeKeyOptions,
|
||||||
...scope,
|
...scope,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user