refactor: collection template support forbidDeletion setting (#3139)
This commit is contained in:
parent
cb200de34e
commit
d573e6ff17
@ -64,7 +64,7 @@ const CurrentFields = (props) => {
|
||||
const { [targetKey]: filterByTk, titleField, template } = useRecord();
|
||||
const [loadingRecord, setLoadingRecord] = React.useState<any>(null);
|
||||
const { refreshCM, isTitleField, getTemplate } = useCollectionManager();
|
||||
|
||||
const targetTemplate = getTemplate(template);
|
||||
const columns: TableColumnProps<any>[] = [
|
||||
{
|
||||
dataIndex: ['uiSchema', 'rawTitle'],
|
||||
@ -130,7 +130,7 @@ const CurrentFields = (props) => {
|
||||
content: t('Are you sure you want to delete it?'),
|
||||
},
|
||||
useAction: useDestroyActionAndRefreshCM,
|
||||
disabled: isDeleteButtonDisabled(record),
|
||||
disabled: isDeleteButtonDisabled(record) || targetTemplate?.forbidDeletion,
|
||||
title: t('Delete'),
|
||||
};
|
||||
|
||||
@ -405,6 +405,7 @@ export const CollectionFields = () => {
|
||||
useAction: useBulkDestroyActionAndRefreshCM,
|
||||
title: t('Delete'),
|
||||
icon: 'DeleteOutlined',
|
||||
disabled: targetTemplate?.forbidDeletion,
|
||||
confirm: {
|
||||
title: t('Delete record'),
|
||||
content: t('Are you sure you want to delete it?'),
|
||||
|
@ -20,6 +20,8 @@ export interface ICollectionTemplate {
|
||||
description?: string;
|
||||
/**配置字段中的操作按钮 */
|
||||
configureActions?: Record<string, ISchema>;
|
||||
//是否禁止删除字段
|
||||
forbidDeletion?: boolean;
|
||||
}
|
||||
|
||||
interface AvailableFieldInterfacesInclude {
|
||||
|
Loading…
Reference in New Issue
Block a user