fix: assign field with delete field (#1850)
This commit is contained in:
parent
3a8db04161
commit
77b7adb97c
@ -71,10 +71,16 @@ const InternalField: React.FC = (props) => {
|
|||||||
return React.createElement(component, props, props.children);
|
return React.createElement(component, props, props.children);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 当字段被删除时,显示一个提示占位符
|
||||||
|
const DeletedField = () => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
return <div style={{ color: '#ccc' }}>{t('The field has bee deleted')}</div>;
|
||||||
|
};
|
||||||
|
|
||||||
const CollectionField = connect((props) => {
|
const CollectionField = connect((props) => {
|
||||||
const fieldSchema = useFieldSchema();
|
const fieldSchema = useFieldSchema();
|
||||||
return (
|
return (
|
||||||
<CollectionFieldProvider name={fieldSchema.name}>
|
<CollectionFieldProvider name={fieldSchema.name} fallback={<DeletedField />}>
|
||||||
<InternalField {...props} />
|
<InternalField {...props} />
|
||||||
</CollectionFieldProvider>
|
</CollectionFieldProvider>
|
||||||
);
|
);
|
||||||
@ -123,7 +129,7 @@ export const AssignedField = (props: any) => {
|
|||||||
title: t('Current user'),
|
title: t('Current user'),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
if (dateTimeFields.includes(collectionField.interface)) {
|
if (dateTimeFields.includes(collectionField?.interface)) {
|
||||||
opt.unshift({
|
opt.unshift({
|
||||||
name: 'currentTime',
|
name: 'currentTime',
|
||||||
title: t('Current time'),
|
title: t('Current time'),
|
||||||
|
Loading…
Reference in New Issue
Block a user