fix: view collection interface missing (#3658)

This commit is contained in:
katherinehhh 2024-03-08 12:00:59 +08:00 committed by GitHub
parent 2fc13c180c
commit db045c61d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -60,12 +60,12 @@ const PreviewCom = (props) => {
const children = collection.fields const children = collection.fields
.filter((v) => !['hasOne', 'hasMany', 'belongsToMany'].includes(v?.type)) .filter((v) => !['hasOne', 'hasMany', 'belongsToMany'].includes(v?.type))
?.map((v) => { ?.map((v) => {
return { value: v.name, key: v.name, label: t(v.uiSchema?.title) }; return { value: v.name, key: v.name, label: t(v.uiSchema?.title || v.name) };
}) })
.concat(result); .concat(result);
data.push({ data.push({
value: item, value: item,
label: t(collection.title), label: t(collection.title || collection.name),
children, children,
}); });
}); });
@ -187,7 +187,7 @@ const PreviewCom = (props) => {
{data.map((group) => ( {data.map((group) => (
<Select.OptGroup key={group.key} label={compile(group.label)}> <Select.OptGroup key={group.key} label={compile(group.label)}>
{group.children.map((item) => ( {group.children.map((item) => (
<Select.Option key={item.value} value={item.value}> <Select.Option key={item.value} value={item.name}>
{compile(item.label)} {compile(item.label)}
</Select.Option> </Select.Option>
))} ))}