Setting the file. One moment.
Subchapter 2.11
references/auto-patterns-dashboard/collection-page-actions.mdMarkdown3 KBView on GitHub
interface CollectionPageActions {
primaryActions?: ActionGroup;
secondaryActions?: ActionGroup;
}
type ActionGroup = | { type: 'action'; action: { item: ActionItem } } | { type: 'menu'; menu: { label: string; items: (ActionItem | DividerItem)[] } };
interface DividerItem {
type: 'divider';
}
interface ActionItem {
id: string; // Must match custom resolver name if custom
type: 'create' | 'custom';
label?: string;
biName: string; // MANDATORY
collection?: {
collectionId: string;
entityTypeSource: 'cms' | 'custom';
};
create?: {
mode: 'page';
page: { id: string };
};
}
// Row Click Action (Table level)
interface OnRowClickConfig {
id: string;
type: 'custom';
}
// Row Click Resolver Signature - NOTE: item is nested under actionParams
type CustomActionCollectionPageActionOnRowClickResolver = (params: {
actionParams: { item: any }; // The clicked row's data - nested under actionParams
sdk: AutoPatternsSDK;
}) => ResolvedAction;type: 'create' THEN create config with page.id is REQUIRED.type: 'custom' THEN id must match a registered resolver name.onRowClick is configured THEN matching custom resolver is MANDATORY.onRowClick is configured THEN default navigation is DISABLED.onRowClick resolver accesses row data THEN use actionParams.item (NOT direct item param).create action in primaryActions for every collection page.biName for every action (kebab-case).CustomActionCollectionPageActionResolver.CustomActionCollectionPageActionOnRowClickResolver returning ResolvedAction.components/actions/ folder (same as other custom actions).useActions hook pattern (see custom_actions_override).create logic with custom action types.schema or optimisticActions exist without checking.{
primaryActions: {
type: 'action',
action: {
item: {
id: 'create-pet',
type: 'create',
label: 'Add Pet',
biName: 'create-pet-action',
collection: { collectionId: 'pets', entityTypeSource: 'cms' },
create: {
mode: 'page',
page: { id: 'pet-details' }
}
}
}
},
secondaryActions: {
type: 'menu',
menu: {
label: 'More',
items: [
{
id: 'exportCollection',
type: 'custom',
label: 'Export',
biName: 'export-action',
collection: { collectionId: 'pets', entityTypeSource: 'cms' }
}
]
}
}
}// Config
{
"onRowClick": {
"id": "myRowClickAction",
"type": "custom"
}
}
// Resolver (if custom) - see custom_actions_override for full registration pattern
export const myRowClickAction: CustomActionCollectionPageActionOnRowClickResolver = ({
actionParams: { item }, // item is nested under actionParams
}) => ({
label: 'Custom Action',
icon: <MyIcon />,
biName: 'my-row-click-action',
onClick: () => {
// Custom onClick logic using item
}
});