refactor: view collection set name as default title when title is missing (#3719)

This commit is contained in:
katherinehhh 2024-03-14 21:51:48 +08:00 committed by GitHub
parent 286af35ff8
commit 032352985b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -84,10 +84,16 @@ const PreviewCom = (props) => {
const fieldsData = Object.values(data?.data?.fields)?.map((v: any) => {
if (v.source) {
const option = fields?.data.find((h) => h.name === v.name) || v;
return { ...v, uiSchema: omit(option.uiSchema, 'rawTitle') };
return {
...v,
uiSchema: { ...omit(option.uiSchema, 'rawTitle'), title: option.uiSchema?.title || option.name },
};
} else {
const option = fields?.data.find((h) => h.name === v.name) || v;
return { ...option, uiSchema: omit(option.uiSchema, 'rawTitle') };
return {
...option,
uiSchema: { ...omit(option.uiSchema, 'rawTitle'), title: option.uiSchema?.title || option.name },
};
}
});
field.value = fieldsData;