1 import { CdTableSelection } from './cd-table-selection';
3 export class CdTableAction {
4 // It's possible to assign a string
5 // or a function that returns the link if it has to be dynamic
6 // or none if it's not needed
7 routerLink?: string | Function;
9 preserveFragment? = false;
11 // This is the function that will be triggered on a click event if defined
14 permission: 'create' | 'update' | 'delete' | 'read';
16 // The name of the action
19 // The font awesome icon that will be used
22 // You can define the condition to disable the action.
23 // By default all 'update' and 'delete' actions will only be enabled
24 // if one selection is made and no task is running on the selected item.
25 disable?: (_: CdTableSelection) => boolean;
28 * In some cases you might want to give the user a hint why a button is
29 * disabled. The specified message will be shown to the user as a button
32 disableDesc?: (_: CdTableSelection) => string | undefined;
35 * Defines if the button can become 'primary' (displayed as button and not
36 * 'hidden' in the menu). Only one button can be primary at a time. By
37 * default all 'create' actions can be the action button if no or multiple
38 * items are selected. Also, all 'update' and 'delete' actions can be the
39 * action button by default, provided only one item is selected.
41 canBePrimary?: (_: CdTableSelection) => boolean;
43 // In some rare cases you want to hide a action that can be used by the user for example
44 // if one action can lock the item and another action unlocks it
45 visible?: (_: CdTableSelection) => boolean;