UNPKG

ag-grid-enterprise

Version:

Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue

92 lines (91 loc) • 3.64 kB
import type { AgColumn, ColAggFunc, ColumnEventType, ColumnState, ColumnToolPanelAction, SortDef, SortDirection } from 'ag-grid-community'; export type ColumnStateUpdateParams = { buttons?: ColumnToolPanelAction[]; suppressSyncLayoutWithGrid?: boolean; }; export interface ColumnStateConcreteUpdateStrategy { applyColumnState(state: ColumnState[], eventType: ColumnEventType): void; commit(): void; hasPendingChanges(): boolean; moveColumns(columns: AgColumn[], targetIndex: number, eventType: ColumnEventType): void; reset(): void; setColumnsVisible(columns: AgColumn[], visible: boolean, eventType: ColumnEventType): void; isColumnVisibleInToolPanel(column: AgColumn): boolean; setRowGroupColumns(columns: AgColumn[], eventType: ColumnEventType): void; /** Deactivate just these cols, leaving the rest of the active list alone — unlike * {@link setRowGroupColumns}, which re-derives the list and so re-seats hierarchy levels. */ removeRowGroupColumns(columns: AgColumn[], eventType: ColumnEventType): void; getRowGroupColumns(): AgColumn[]; getPrimaryColumns(): AgColumn[]; hasDeferredColumnOrder(): boolean; setValueColumns(columns: AgColumn[], eventType: ColumnEventType): void; getValueColumns(): AgColumn[]; setColumnAggFunc(column: AgColumn, aggFunc: ColAggFunc, eventType: ColumnEventType): void; getColumnAggFunc(column: AgColumn): ColAggFunc; setPivotColumns(columns: AgColumn[], eventType: ColumnEventType): void; /** Pivot counterpart of {@link removeRowGroupColumns}. */ removePivotColumns(columns: AgColumn[], eventType: ColumnEventType): void; getPivotColumns(): AgColumn[]; setPivotMode(pivotMode: boolean, eventType: ColumnEventType): void; getPivotMode(): boolean; isColumnSelectedInPivotModeToolPanel(column: AgColumn): boolean; progressSortFromEvent(column: AgColumn, event: MouseEvent | KeyboardEvent): void; getSortDef(column: AgColumn): SortDef | null; progressPivotSortFromEvent(column: AgColumn): void; getPivotSort(column: AgColumn): SortDirection | undefined; } type Seq = { seq: number; eventType: ColumnEventType; }; type ColIdsDraft = { colIds: string[]; } & Seq; /** A role draft (`rowGroup` / `pivot`) also carries the columns the user explicitly removed. Commit * replays `setColumns(colIds)`, which re-seats each source column's hierarchy virtuals, so an * explicit removal has to be re-applied afterwards or the pill returns on Apply. */ export type RoleColIdsDraft = ColIdsDraft & { removedColIds?: string[]; }; type ColumnStateDraft = { patches: Map<string, ColumnState>; } & Seq; type PivotModeDraft = { pivotMode: boolean; } & Seq; type SortDraft = { sortDefsByColId: Map<string, SortDef | null>; baselineCleared: boolean; } & Seq; type AggFuncsDraft = { values: Map<string, ColAggFunc>; } & Seq; export type DeferredState = { columnState?: ColumnStateDraft; columnOrder?: ColIdsDraft; rowGroup?: RoleColIdsDraft; aggregation?: ColIdsDraft; pivot?: RoleColIdsDraft; pivotMode?: PivotModeDraft; sort?: SortDraft; aggFuncs?: AggFuncsDraft; }; export type CommitOperation = ({ type: 'columnState'; } & ColumnStateDraft) | ({ type: 'columnOrder'; } & ColIdsDraft) | ({ type: 'rowGroup'; } & RoleColIdsDraft) | ({ type: 'aggregation'; } & ColIdsDraft) | ({ type: 'pivot'; } & RoleColIdsDraft) | ({ type: 'pivotMode'; } & PivotModeDraft) | ({ type: 'sort'; } & SortDraft) | ({ type: 'aggFuncs'; } & AggFuncsDraft); export type CommitOperations = CommitOperation[]; export {};