refactor: fields for table sorting cannot select sorting fields with scopekey (#3984)

* refactor: fields for table sorting cannot select sorting fields with scopeke y

* refactor: sort field

* refactor: sort field
This commit is contained in:
katherinehhh 2024-04-10 16:37:18 +08:00 committed by GitHub
parent b7fc50e47e
commit e9f0e32a26
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1477,14 +1477,18 @@ export const SchemaSettingsSortField = () => {
const { t } = useTranslation();
const { dn } = useDesignable();
const compile = useCompile();
const { service } = useTableBlockContext();
const { service, association } = useTableBlockContext();
const { getCollectionJoinField } = useCollectionManager_deprecated();
const collectionField = getCollectionJoinField(association);
const options = fields
.filter((field) => !field?.target && field.interface === 'sort')
.map((field) => ({
value: field?.name,
label: compile(field?.uiSchema?.title) || field?.name,
}));
.map((field) => {
return {
value: field?.name,
label: compile(field?.uiSchema?.title) || field?.name,
disabled: field?.scopeKey && collectionField?.foreignKey !== field.scopeKey,
};
});
return (
<SchemaSettingsSelectItem