import { IRowNode } from 'ag-grid-enterprise'; import { RowScope } from '../AdaptableState/Common/RowScope'; import { AdaptableButton, BaseContext } from '../types'; /** * Options related to Action Columns in AdapTable */ export interface ActionColumnOptions { /** * Columns which contain an AdapTable Button - used for performing Actions * @defaultValue undefined */ actionColumns?: ActionColumn[]; } /** * A Special Column that wraps an AdapTable Button */ export interface ActionColumn { /** * Mandatory 'Id'; if no value set for `FriendlyName`, this will also be Column name */ columnId: string; /** * How Column appears in Column Header, Menus; if no value set, `ColumnId` is used */ friendlyName?: string; /** * Button (or list of buttons) to display in the Column */ actionColumnButton: ActionColumnButton> | ActionColumnButton>[]; /** * Which types of Rows should contain buttons (i.e. data, grouped, summary) */ rowScope?: RowScope; /** * Optional properties to configure the Column (e.g. filterable, resizable) */ actionColumnSettings?: ActionColumnSettings; } /** * Context required by functions when using an Action Column Button */ export interface ActionColumnContext extends BaseContext { /** * Action Column in question */ actionColumn: ActionColumn; /** * Primary Key Value in current row */ primaryKeyValue: any; /** * Current AG Grid Row Node */ rowNode: IRowNode; /** * The current row's data */ data: TData; } /** * Set of optional properties that define an Action Columns behaviour */ export interface ActionColumnSettings { /** * Preferred width (in pixels) for Column; if unset, calculated dynamically by AG Grid */ width?: number; /** * Whether Column can be resized (by dragging column header edges) * @defaultValue true */ resizable?: boolean; /** * Whether no menu should be shown for this Column header. * @defaultValue false */ suppressMenu?: boolean; /** * Whether if this Column should be movable via dragging * @defaultValue false */ suppressMovable?: boolean; } /** * Button that is displayed inside an Action Column */ export interface ActionColumnButton extends AdaptableButton> { /** * Command to assign to Action Column Button that displays a Row Form */ command?: ActionButtonCommand; } /** * Commands to assign to Action Buttons that open Row Forms: 'create', 'clone', 'edit' or 'delete' */ export type ActionButtonCommand = 'create' | 'clone' | 'edit' | 'delete';