refactor: filter FilterTargetKeys options based on titleUsable (#4981)

This commit is contained in:
Katherine 2024-08-02 21:26:45 +08:00 committed by GitHub
parent 44e74a46f0
commit c8b0ebb03e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,6 +17,7 @@ import {
useAPIClient,
useCurrentAppInfo,
useRecord,
useApp,
SchemaComponent,
SchemaComponentContext,
useCompile,
@ -112,6 +113,7 @@ export const ConfigurationTable = () => {
const resource = api.resource('dbViews');
const compile = useCompile();
const form = useForm();
const app = useApp();
/**
*
@ -169,7 +171,20 @@ export const ConfigurationTable = () => {
return Promise.resolve({
data: fields,
}).then(({ data }) => {
return data?.map((item: any) => {
return data
.filter((field) => {
if (!field.interface) {
return false;
}
const interfaceOptions = app.dataSourceManager.collectionFieldInterfaceManager.getFieldInterface(
field.interface,
);
if (interfaceOptions.titleUsable) {
return true;
}
return false;
})
?.map((item: any) => {
return {
label: compile(item.uiSchema?.title) || item.name,
value: item.name,