chore: add group title to Table item action settings (#4516)

This commit is contained in:
Zeke Zhang 2024-05-29 13:08:53 +08:00 committed by GitHub
parent fb2504257b
commit e03b5b873b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -155,111 +155,118 @@ const commonOptions = {
}, },
items: [ items: [
{ {
type: 'item', type: 'itemGroup',
title: '{{t("View")}}', name: 'actions',
name: 'view', title: '{{t("Configure actions")}}',
Component: 'ViewActionInitializer', children: [
schema: { {
'x-component': 'Action.Link', type: 'item',
'x-action': 'view', title: '{{t("View")}}',
'x-decorator': 'ACLActionProvider', name: 'view',
}, Component: 'ViewActionInitializer',
}, schema: {
{ 'x-component': 'Action.Link',
type: 'item', 'x-action': 'view',
name: 'edit', 'x-decorator': 'ACLActionProvider',
title: '{{t("Edit")}}', },
Component: 'UpdateActionInitializer', },
schema: { {
'x-component': 'Action.Link', type: 'item',
'x-action': 'update', name: 'edit',
'x-decorator': 'ACLActionProvider', title: '{{t("Edit")}}',
}, Component: 'UpdateActionInitializer',
useVisible() { schema: {
const collection = useCollection_deprecated(); 'x-component': 'Action.Link',
return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; 'x-action': 'update',
}, 'x-decorator': 'ACLActionProvider',
}, },
{ useVisible() {
type: 'item', const collection = useCollection_deprecated();
title: '{{t("Delete")}}', return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql';
name: 'delete', },
Component: 'DestroyActionInitializer', },
schema: { {
'x-component': 'Action.Link', type: 'item',
'x-action': 'destroy', title: '{{t("Delete")}}',
'x-decorator': 'ACLActionProvider', name: 'delete',
}, Component: 'DestroyActionInitializer',
useVisible() { schema: {
const collection = useCollection_deprecated(); 'x-component': 'Action.Link',
return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; 'x-action': 'destroy',
}, 'x-decorator': 'ACLActionProvider',
}, },
{ useVisible() {
type: 'item', const collection = useCollection_deprecated();
title: '{{t("Disassociate")}}', return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql';
name: 'disassociate', },
Component: 'DisassociateActionInitializer', },
schema: { {
'x-component': 'Action.Link', type: 'item',
'x-action': 'disassociate', title: '{{t("Disassociate")}}',
'x-acl-action': 'destroy', name: 'disassociate',
'x-decorator': 'ACLActionProvider', Component: 'DisassociateActionInitializer',
}, schema: {
useVisible() { 'x-component': 'Action.Link',
const props = useDataBlockProps(); 'x-action': 'disassociate',
const collection = useCollection_deprecated(); 'x-acl-action': 'destroy',
return ( 'x-decorator': 'ACLActionProvider',
!!props?.association && },
(collection.template !== 'view' || collection?.writableView) && useVisible() {
collection.template !== 'sql' const props = useDataBlockProps();
); const collection = useCollection_deprecated();
}, return (
}, !!props?.association &&
{ (collection.template !== 'view' || collection?.writableView) &&
type: 'item', collection.template !== 'sql'
title: '{{t("Add child")}}', );
name: 'addChildren', },
Component: 'CreateChildInitializer', },
schema: { {
'x-component': 'Action.Link', type: 'item',
'x-action': 'create', title: '{{t("Add child")}}',
'x-decorator': 'ACLActionProvider', name: 'addChildren',
}, Component: 'CreateChildInitializer',
useVisible() { schema: {
const fieldSchema = useFieldSchema(); 'x-component': 'Action.Link',
const collection = useCollection_deprecated(); 'x-action': 'create',
const { treeTable } = fieldSchema?.parent?.parent['x-decorator-props'] || {}; 'x-decorator': 'ACLActionProvider',
return collection.tree && treeTable; },
}, useVisible() {
}, const fieldSchema = useFieldSchema();
{ const collection = useCollection_deprecated();
type: 'item', const { treeTable } = fieldSchema?.parent?.parent['x-decorator-props'] || {};
title: '{{t("Popup")}}', return collection.tree && treeTable;
name: 'popup', },
Component: 'PopupActionInitializer', },
}, {
{ type: 'item',
type: 'item', title: '{{t("Popup")}}',
title: '{{t("Update record")}}', name: 'popup',
name: 'updateRecord', Component: 'PopupActionInitializer',
Component: 'UpdateRecordActionInitializer', },
useVisible() { {
const collection = useCollection_deprecated(); type: 'item',
return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; title: '{{t("Update record")}}',
}, name: 'updateRecord',
}, Component: 'UpdateRecordActionInitializer',
{ useVisible() {
name: 'customRequest', const collection = useCollection_deprecated();
title: '{{t("Custom request")}}', return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql';
Component: 'CustomRequestInitializer', },
schema: { },
'x-action': 'customize:table:request', {
}, name: 'customRequest',
useVisible() { title: '{{t("Custom request")}}',
const collection = useCollection_deprecated(); Component: 'CustomRequestInitializer',
return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; schema: {
}, 'x-action': 'customize:table:request',
},
useVisible() {
const collection = useCollection_deprecated();
return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql';
},
},
],
}, },
{ {
name: 'divider', name: 'divider',