@agile-team/mach-table 0.31.2 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +27 -1
  2. package/dist/adapter.cjs +1 -1
  3. package/dist/adapter.d.cts +20 -3
  4. package/dist/adapter.d.ts +20 -3
  5. package/dist/adapter.js +1 -1
  6. package/dist/analysis.cjs +3 -0
  7. package/dist/analysis.d.cts +60 -0
  8. package/dist/analysis.d.ts +60 -0
  9. package/dist/analysis.js +3 -0
  10. package/dist/{options-Bi_m5kXL.d.cts → api-pOhyuSQk.d.cts} +780 -754
  11. package/dist/{options-Bi_m5kXL.d.ts → api-pOhyuSQk.d.ts} +780 -754
  12. package/dist/{configuration-C9KYeIy1.d.ts → configuration-SYWVjGft.d.ts} +1 -1
  13. package/dist/{configuration-Bj_JwdTd.d.cts → configuration-gAE1eZuB.d.cts} +1 -1
  14. package/dist/index.cjs +6 -6
  15. package/dist/index.d.cts +3 -3
  16. package/dist/index.d.ts +3 -3
  17. package/dist/index.js +6 -6
  18. package/dist/mach-table.css +1 -1
  19. package/dist/multi-range.cjs +4 -0
  20. package/dist/multi-range.d.cts +13 -0
  21. package/dist/multi-range.d.ts +13 -0
  22. package/dist/multi-range.js +4 -0
  23. package/dist/ordering.cjs +1 -0
  24. package/dist/ordering.d.cts +93 -0
  25. package/dist/ordering.d.ts +93 -0
  26. package/dist/ordering.js +1 -0
  27. package/dist/preferences.cjs +1 -0
  28. package/dist/preferences.d.cts +71 -0
  29. package/dist/preferences.d.ts +71 -0
  30. package/dist/preferences.js +1 -0
  31. package/dist/server-side.cjs +1 -0
  32. package/dist/server-side.css +1 -0
  33. package/dist/server-side.css.d.ts +2 -0
  34. package/dist/server-side.d.cts +132 -0
  35. package/dist/server-side.d.ts +132 -0
  36. package/dist/server-side.js +1 -0
  37. package/dist/shared-Bi8hAuzn.d.cts +12 -0
  38. package/dist/shared-Bn77TiBm.d.ts +12 -0
  39. package/dist/workbench.cjs +1 -0
  40. package/dist/workbench.css +1 -0
  41. package/dist/workbench.css.d.ts +2 -0
  42. package/dist/workbench.d.cts +72 -0
  43. package/dist/workbench.d.ts +72 -0
  44. package/dist/workbench.js +1 -0
  45. package/dist/worker.d.cts +2 -2
  46. package/dist/worker.d.ts +2 -2
  47. package/package.json +72 -5
  48. /package/{styles → dist}/mach-table.css.d.ts +0 -0
@@ -1,3 +1,35 @@
1
+ declare class ColumnGroup<TData = any> {
2
+ readonly groupId: string;
3
+ readonly def: ColDefGroup<TData>;
4
+ parent: ColumnGroup<TData> | null;
5
+ children: (ColumnGroup<TData> | Column<TData>)[];
6
+ constructor(groupId: string, def: ColDefGroup<TData>);
7
+ get headerName(): string;
8
+ getLeafColumns(out?: Column<TData>[]): Column<TData>[];
9
+ }
10
+
11
+ declare class Column<TData = any> {
12
+ readonly id: string;
13
+ readonly colDef: ColDef<TData>;
14
+ hide: boolean;
15
+ pinned: PinnedDirection | null;
16
+ manualWidth: number | null;
17
+ contentWidth: number | null;
18
+ flex: number | null;
19
+ currentWidth: number;
20
+ parentGroup: ColumnGroup<TData> | null;
21
+ level: number;
22
+ isDetailToggle: boolean;
23
+ constructor(id: string, colDef: ColDef<TData>);
24
+ get sortable(): boolean;
25
+ get resizable(): boolean;
26
+ get movable(): boolean;
27
+ get filterable(): boolean;
28
+ get filterType(): FilterType;
29
+ get hasCheckbox(): boolean;
30
+ resetWidth(): void;
31
+ }
32
+
1
33
  interface RowNode<TData = any> {
2
34
  id: string;
3
35
  data: TData | null;
@@ -18,840 +50,484 @@ interface RowNode<TData = any> {
18
50
  treeLoadError?: unknown;
19
51
  }
20
52
 
21
- interface AdvancedFilterCondition {
22
- kind: "condition";
23
- colId: string;
24
- filter: ColumnFilter;
25
- }
26
- interface AdvancedFilterGroup {
27
- kind: "group";
28
- operator: "and" | "or";
29
- children: AdvancedFilterNode[];
30
- /** Negates the complete group without changing its children. */
31
- not?: boolean;
32
- }
33
- type AdvancedFilterNode = AdvancedFilterCondition | AdvancedFilterGroup;
34
- /** Serializable, backend-friendly nested filter expression. */
35
- interface AdvancedFilterModel {
36
- version: 1;
37
- root: AdvancedFilterNode;
38
- }
39
-
40
- declare const EVENT_TYPES: readonly ["gridReady", "gridDestroyed", "modelUpdated", "cellClicked", "cellDoubleClicked", "cellContextMenu", "rowClicked", "rowDoubleClicked", "selectionChanged", "sortChanged", "filterChanged", "columnResized", "columnMoved", "columnVisibilityChanged", "cellValueChanged", "cellEditingStarted", "cellEditingStopped", "rowEditingStarted", "rowEditingStopped", "detailToggled", "treeChildrenLoaded", "treeChildrenLoadFailed", "rowDragEnd", "rangeSelectionChanged", "paginationChanged", "displayedColumnsChanged", "gridError", "dirtyStateChanged"];
41
- type GridEventType = (typeof EVENT_TYPES)[number];
42
- type GridErrorCode = "DATA_SOURCE_ERROR" | "DATA_INTEGRITY_ERROR" | "VALIDATION_ERROR" | "RENDERER_ERROR" | "EDITOR_ERROR" | "FEATURE_ERROR" | "STATE_ERROR" | "EVENT_HANDLER_ERROR" | "GRID_ERROR";
43
- interface GridEventBase<TData = any> {
44
- type: GridEventType;
53
+ interface ValueGetterParams<TData = any, TValue = any> {
54
+ data: TData | null;
55
+ node: RowNode<TData>;
56
+ colDef: ColDef<TData, TValue>;
57
+ column: Column<TData>;
45
58
  api: GridApi<TData>;
46
59
  }
47
- interface GridReadyEvent<TData = any> extends GridEventBase<TData> {
48
- type: "gridReady";
49
- }
50
- interface GridDestroyedEvent<TData = any> extends GridEventBase<TData> {
51
- type: "gridDestroyed";
52
- }
53
- interface ModelUpdatedEvent<TData = any> extends GridEventBase<TData> {
54
- type: "modelUpdated";
55
- rowCount: number;
56
- }
57
- interface CellClickEvent<TData = any, TValue = any> extends GridEventBase<TData> {
58
- type: "cellClicked";
59
- event: MouseEvent;
60
- rowNode: RowNode<TData>;
61
- rowIndex: number;
62
- column: Column<TData>;
63
- colDef: ColDef<TData, TValue>;
60
+ interface ValueFormatterParams<TData = any, TValue = any> extends ValueGetterParams<TData, TValue> {
64
61
  value: TValue;
65
62
  }
66
- interface CellDoubleClickEvent<TData = any, TValue = any> extends GridEventBase<TData> {
67
- type: "cellDoubleClicked";
68
- event: MouseEvent;
69
- rowNode: RowNode<TData>;
70
- rowIndex: number;
71
- column: Column<TData>;
72
- colDef: ColDef<TData, TValue>;
63
+ interface CellRendererParams<TData = any, TValue = any> extends ValueGetterParams<TData, TValue> {
73
64
  value: TValue;
74
- }
75
- interface CellContextMenuEvent<TData = any, TValue = any> extends GridEventBase<TData> {
76
- type: "cellContextMenu";
77
- event: MouseEvent;
78
- rowNode: RowNode<TData>;
65
+ formatted: string;
79
66
  rowIndex: number;
80
- column: Column<TData>;
81
- colDef: ColDef<TData, TValue>;
82
- value: TValue;
67
+ rendererParams?: Record<string, any>;
83
68
  }
84
- interface RowClickEvent<TData = any> extends GridEventBase<TData> {
85
- type: "rowClicked" | "rowDoubleClicked";
86
- event: MouseEvent;
87
- rowNode: RowNode<TData>;
69
+ interface CellClassParams<TData = any, TValue = any> extends ValueGetterParams<TData, TValue> {
70
+ value: TValue;
88
71
  rowIndex: number;
89
72
  }
90
- interface SelectionChangedEvent<TData = any> extends GridEventBase<TData> {
91
- type: "selectionChanged";
92
- selectedNodes: RowNode<TData>[];
93
- selectedRows: TData[];
94
- }
95
- interface SortChangedEvent<TData = any> extends GridEventBase<TData> {
96
- type: "sortChanged";
97
- sortModel: SortModel;
98
- }
99
- interface FilterChangedEvent<TData = any> extends GridEventBase<TData> {
100
- type: "filterChanged";
101
- filterModel: FilterModel;
102
- advancedFilterModel: AdvancedFilterModel | null;
103
- }
104
- interface ColumnResizedEvent<TData = any> extends GridEventBase<TData> {
105
- type: "columnResized";
106
- colId: string;
107
- width: number;
108
- finished: boolean;
109
- }
110
- interface ColumnMovedEvent<TData = any> extends GridEventBase<TData> {
111
- type: "columnMoved";
112
- colId: string;
113
- toIndex: number;
73
+ interface EditableParams<TData = any, TValue = any> extends ValueGetterParams<TData, TValue> {
74
+ value: TValue;
75
+ rowIndex: number;
114
76
  }
115
- interface ColumnVisibilityChangedEvent<TData = any> extends GridEventBase<TData> {
116
- type: "columnVisibilityChanged";
117
- colId: string;
118
- visible: boolean;
77
+ interface CellEditorParams<TData = any, TValue = any> extends ValueGetterParams<TData, TValue> {
78
+ value: TValue;
79
+ rowIndex: number;
80
+ keyPress?: string | null;
119
81
  }
120
- interface CellValueChangedEvent<TData = any, TValue = any> extends GridEventBase<TData> {
121
- type: "cellValueChanged";
82
+ interface ValueSetterParams<TData = any, TValue = any> {
122
83
  oldValue: TValue;
123
84
  newValue: TValue;
124
- rowNode: RowNode<TData>;
125
- rowIndex: number;
126
- column: Column<TData>;
85
+ data: TData;
86
+ node: RowNode<TData>;
127
87
  colDef: ColDef<TData, TValue>;
88
+ column: Column<TData>;
89
+ api: GridApi<TData>;
90
+ }
91
+ interface GetRowIdParams<TData = any> {
128
92
  data: TData;
93
+ index: number;
94
+ api: GridApi<TData>;
129
95
  }
130
- interface CellEditingStartedEvent<TData = any> extends GridEventBase<TData> {
131
- type: "cellEditingStarted";
132
- rowIndex: number;
133
- colId: string;
134
- rowNode: RowNode<TData>;
96
+ interface GetRowHeightParams<TData = any> {
97
+ data: TData | null;
98
+ node: RowNode<TData>;
99
+ api: GridApi<TData>;
135
100
  }
136
- interface CellEditingStoppedEvent<TData = any> extends GridEventBase<TData> {
137
- type: "cellEditingStopped";
138
- rowIndex: number;
101
+ interface TooltipParams<TData = any> {
102
+ data: TData | null;
103
+ node: RowNode<TData>;
104
+ api: GridApi<TData>;
139
105
  colId: string;
140
- rowNode: RowNode<TData>;
141
- oldValue: any;
142
- newValue: any;
106
+ value: any;
107
+ formatted: string;
108
+ rowIndex: number;
143
109
  }
144
- interface RowEditChange {
110
+ interface ContextMenuParams<TData = any> {
111
+ data: TData | null;
112
+ node: RowNode<TData>;
113
+ api: GridApi<TData>;
145
114
  colId: string;
146
- oldValue: unknown;
147
- newValue: unknown;
148
- }
149
- interface RowEditingStartedEvent<TData = any> extends GridEventBase<TData> {
150
- type: "rowEditingStarted";
115
+ value: any;
151
116
  rowIndex: number;
152
- rowNode: RowNode<TData>;
153
- data: TData;
154
117
  }
155
- interface RowEditingStoppedEvent<TData = any> extends GridEventBase<TData> {
156
- type: "rowEditingStopped";
157
- rowIndex: number;
158
- rowNode: RowNode<TData>;
159
- data: TData;
160
- cancelled: boolean;
161
- changes: RowEditChange[];
118
+ interface ContextMenuItem {
119
+ label?: string;
120
+ action?: () => void;
121
+ danger?: boolean;
122
+ disabled?: boolean;
123
+ separator?: boolean;
162
124
  }
163
- interface DetailToggledEvent<TData = any> extends GridEventBase<TData> {
164
- type: "detailToggled";
165
- rowId: string;
166
- rowNode: RowNode<TData>;
167
- expanded: boolean;
125
+ interface HeaderComponentParams<TData = any> {
126
+ colDef: ColDef<TData>;
127
+ column: Column<TData>;
128
+ api: GridApi<TData>;
168
129
  }
169
- interface TreeChildrenLoadedEvent<TData = any> extends GridEventBase<TData> {
170
- type: "treeChildrenLoaded";
171
- rowId: string;
172
- rowNode: RowNode<TData>;
173
- children: readonly TData[];
130
+ interface ICellRendererResult {
131
+ el: HTMLElement;
132
+ /** Reuses the mounted renderer for an update. Return false to request recreation. */
133
+ refresh?(params: CellRendererParams): boolean | void;
134
+ destroy?: () => void;
174
135
  }
175
- interface TreeChildrenLoadFailedEvent<TData = any> extends GridEventBase<TData> {
176
- type: "treeChildrenLoadFailed";
177
- rowId: string;
178
- rowNode: RowNode<TData>;
179
- error: unknown;
136
+ type CellRendererOutput = string | HTMLElement | ICellRendererResult | null | undefined;
137
+ interface ICellEditor<TValue = any> {
138
+ el: HTMLElement;
139
+ getValue(): TValue | null | undefined;
140
+ focus?(): void;
141
+ destroy?(): void;
142
+ isCancelBeforeStart?(): boolean;
143
+ isCancelAfterEnd?(value: TValue | null | undefined): boolean;
180
144
  }
181
- interface GridCellRange {
182
- row1: number;
183
- row2: number;
184
- colId1: string;
185
- colId2: string;
145
+
146
+ type SortDirection = "asc" | "desc";
147
+ type PinnedDirection = "left" | "right";
148
+ type FilterType = "text" | "number" | "date" | "set";
149
+ type CellAlign = "left" | "center" | "right";
150
+ type TextFilterMatch = "contains" | "notContains" | "equals" | "notEquals" | "startsWith" | "endsWith" | "blank" | "notBlank";
151
+ type NumberFilterMatch = "equals" | "notEquals" | "lessThan" | "lessThanOrEqual" | "greaterThan" | "greaterThanOrEqual" | "inRange" | "blank" | "notBlank";
152
+ type DateFilterMatch = "equals" | "notEquals" | "lessThan" | "greaterThan" | "inRange" | "blank" | "notBlank";
153
+ interface TextFilterCondition {
154
+ match: TextFilterMatch;
155
+ value?: string;
186
156
  }
187
- interface RangeSelectionChangedEvent<TData = any> extends GridEventBase<TData> {
188
- type: "rangeSelectionChanged";
189
- range: GridCellRange | null;
157
+ interface NumberFilterCondition {
158
+ match: NumberFilterMatch;
159
+ value?: number;
160
+ value2?: number;
190
161
  }
191
- interface RowDragEndEvent<TData = any> extends GridEventBase<TData> {
192
- type: "rowDragEnd";
193
- rowNode: RowNode<TData>;
194
- fromIndex: number;
195
- /** Legacy insertion boundary, before removing the source row. */
196
- toIndex: number;
197
- /** Final displayed index after removing and inserting the source row. */
198
- targetIndex: number;
199
- /** True when the grid applied the move before emitting this event. */
200
- applied: boolean;
162
+ interface DateFilterCondition {
163
+ match: DateFilterMatch;
164
+ value?: string;
165
+ value2?: string;
201
166
  }
202
- interface PaginationChangedEvent<TData = any> extends GridEventBase<TData> {
203
- type: "paginationChanged";
204
- page: number;
205
- pageSize: number;
206
- pageCount: number;
207
- total: number;
167
+ interface SetFilterCondition {
168
+ values: (string | number | null)[];
208
169
  }
209
- interface DisplayedColumnsChangedEvent<TData = any> extends GridEventBase<TData> {
210
- type: "displayedColumnsChanged";
170
+ interface TextColumnFilter {
171
+ type: "text";
172
+ operator?: "and" | "or";
173
+ conditions: TextFilterCondition[];
211
174
  }
212
- interface GridErrorEvent<TData = any> extends GridEventBase<TData> {
213
- type: "gridError";
214
- code: GridErrorCode;
215
- error: unknown;
216
- source: string;
217
- context?: Record<string, unknown>;
175
+ interface NumberColumnFilter {
176
+ type: "number";
177
+ operator?: "and" | "or";
178
+ conditions: NumberFilterCondition[];
218
179
  }
219
- interface DirtyStateChangedEvent<TData = any> extends GridEventBase<TData> {
220
- type: "dirtyStateChanged";
221
- dirtyRowIds: string[];
180
+ interface DateColumnFilter {
181
+ type: "date";
182
+ operator?: "and" | "or";
183
+ conditions: DateFilterCondition[];
222
184
  }
223
- interface GridEventMap<TData = any> {
224
- gridReady: GridReadyEvent<TData>;
225
- gridDestroyed: GridDestroyedEvent<TData>;
226
- modelUpdated: ModelUpdatedEvent<TData>;
227
- cellClicked: CellClickEvent<TData>;
228
- cellDoubleClicked: CellDoubleClickEvent<TData>;
229
- cellContextMenu: CellContextMenuEvent<TData>;
230
- rowClicked: RowClickEvent<TData>;
231
- rowDoubleClicked: RowClickEvent<TData>;
232
- selectionChanged: SelectionChangedEvent<TData>;
233
- sortChanged: SortChangedEvent<TData>;
234
- filterChanged: FilterChangedEvent<TData>;
235
- columnResized: ColumnResizedEvent<TData>;
236
- columnMoved: ColumnMovedEvent<TData>;
237
- columnVisibilityChanged: ColumnVisibilityChangedEvent<TData>;
238
- cellValueChanged: CellValueChangedEvent<TData>;
239
- cellEditingStarted: CellEditingStartedEvent<TData>;
240
- cellEditingStopped: CellEditingStoppedEvent<TData>;
241
- rowEditingStarted: RowEditingStartedEvent<TData>;
242
- rowEditingStopped: RowEditingStoppedEvent<TData>;
243
- detailToggled: DetailToggledEvent<TData>;
244
- treeChildrenLoaded: TreeChildrenLoadedEvent<TData>;
245
- treeChildrenLoadFailed: TreeChildrenLoadFailedEvent<TData>;
246
- rowDragEnd: RowDragEndEvent<TData>;
247
- rangeSelectionChanged: RangeSelectionChangedEvent<TData>;
248
- paginationChanged: PaginationChangedEvent<TData>;
249
- displayedColumnsChanged: DisplayedColumnsChangedEvent<TData>;
250
- gridError: GridErrorEvent<TData>;
251
- dirtyStateChanged: DirtyStateChangedEvent<TData>;
185
+ interface SetColumnFilter {
186
+ type: "set";
187
+ values: (string | number | null)[];
252
188
  }
253
-
254
- interface GridStateBase {
255
- columns: ColumnState[];
256
- sortModel: SortModel;
257
- filterModel: FilterModel;
258
- quickFilterText: string | null;
259
- pagination: {
260
- enabled: boolean;
261
- page: number;
262
- pageSize: number;
263
- };
264
- selectedRowIds: string[];
265
- expandedRowIds: string[];
266
- expandedGroupIds: string[];
189
+ type ColumnFilter = TextColumnFilter | NumberColumnFilter | DateColumnFilter | SetColumnFilter;
190
+ type FilterModel = Record<string, ColumnFilter>;
191
+ interface SortModelItem {
192
+ colId: string;
193
+ direction: SortDirection;
267
194
  }
268
- /** Serializable snapshot of user-visible grid state. */
269
- interface GridState extends GridStateBase {
270
- /** State schema version, independent from the package version. */
271
- version: 2;
272
- advancedFilterModel: AdvancedFilterModel | null;
195
+ type SortModel = SortModelItem[];
196
+ interface SelectEditorOption {
197
+ label: string;
198
+ value: string | number;
199
+ disabled?: boolean;
273
200
  }
274
- type GridStateInput = GridState;
275
- type GridStateSection = "columns" | "sort" | "filter" | "pagination" | "selection" | "expansion";
276
- interface ApplyGridStateOptions {
277
- /** Applies all sections when omitted. */
278
- sections?: readonly GridStateSection[];
279
- /** Emit the standard sort/filter/pagination events after restoration. */
280
- emitEvents?: boolean;
201
+ interface SelectEditorParams {
202
+ /** Primitive options kept for concise same-label/same-value selects. */
203
+ values?: readonly (string | number)[];
204
+ /** Label/value options for dictionary fields whose stored value differs from its display text. */
205
+ options?: readonly SelectEditorOption[];
281
206
  }
282
-
283
- interface CsvExportParams {
284
- includeHeader?: boolean;
285
- columnSeparator?: string;
286
- prependBOM?: boolean;
287
- onlySelected?: boolean;
288
- onlyAllDisplayed?: boolean;
289
- protectFormulas?: boolean;
290
- headersOnly?: boolean;
207
+ interface SetFilterParams {
208
+ values?: (string | number | null)[];
209
+ maxValues?: number;
291
210
  }
292
- interface ImportCsvOptions {
293
- separator?: string;
294
- mode?: "replace" | "append" | "paste";
295
- headerRowIndex?: number;
296
- coerceNumbers?: boolean;
297
- parseValue?: (params: {
298
- value: string;
299
- field: string;
300
- rowIndex: number;
301
- columnIndex: number;
302
- }) => any;
211
+ type CellEditorFactory = (params: CellEditorParams) => ICellEditor;
212
+ type CellRendererFn = (params: CellRendererParams) => string | HTMLElement | ICellRendererResult | null | undefined;
213
+ type CellClassRule = string | string[] | ((params: CellClassParams) => string | string[] | null | undefined);
214
+ type CellStyleRule = Partial<CSSStyleDeclaration> | ((params: CellClassParams<any, any>) => Partial<CSSStyleDeclaration> | null | undefined);
215
+ interface ColDef<TData = any, TValue = any> {
216
+ colId?: string;
217
+ field?: string;
218
+ headerName?: string;
219
+ align?: CellAlign;
220
+ headerAlign?: CellAlign;
221
+ headerClass?: string | string[];
222
+ headerTooltip?: string;
223
+ headerComponent?: (params: HeaderComponentParams<TData>) => string | HTMLElement | ICellRendererResult | null | undefined;
224
+ width?: number;
225
+ minWidth?: number;
226
+ maxWidth?: number;
227
+ flex?: number;
228
+ /** Excludes the column from `columnLayout: "fit"` scaling. */
229
+ suppressSizeToFit?: boolean;
230
+ /** Hides the per-column tools trigger while keeping the global column workbench available. */
231
+ suppressColumnMenu?: boolean;
232
+ hide?: boolean;
233
+ pinned?: PinnedDirection | boolean;
234
+ sortable?: boolean;
235
+ resizable?: boolean;
236
+ movable?: boolean;
237
+ filter?: boolean | FilterType;
238
+ filterParams?: SetFilterParams;
239
+ editable?: boolean | ((params: EditableParams<TData, TValue>) => boolean);
240
+ cellEditor?: "text" | "number" | "date" | "select" | CellEditorFactory | string;
241
+ cellEditorParams?: SelectEditorParams;
242
+ wrapText?: boolean;
243
+ checkboxSelection?: boolean;
244
+ rowGroup?: boolean;
245
+ aggFunc?: string;
246
+ cellStyle?: CellStyleRule;
247
+ selectable?: (params: CellClassParams<TData, TValue>) => boolean;
248
+ singleClickEdit?: boolean;
249
+ tooltipValueGetter?: (params: ValueFormatterParams<TData, TValue>) => string | null | undefined;
250
+ rowSpan?: (params: CellClassParams<TData, TValue>) => number;
251
+ autoRowSpan?: boolean;
252
+ colSpan?: (params: CellClassParams<TData, TValue>) => number;
253
+ autoHeight?: boolean;
254
+ validate?: (newValue: TValue, params: ValueSetterParams<TData, TValue>) => string | true | null | undefined | Promise<string | true | null | undefined>;
255
+ rowDrag?: boolean;
256
+ valueGetter?: (params: ValueGetterParams<TData, TValue>) => TValue;
257
+ valueSetter?: (params: ValueSetterParams<TData, TValue>) => boolean;
258
+ valueFormatter?: (params: ValueFormatterParams<TData, TValue>) => any;
259
+ cellRenderer?: CellRendererFn | string;
260
+ cellRendererParams?: Record<string, any>;
261
+ cellClass?: CellClassRule;
262
+ comparator?: (valueA: any, valueB: any, nodeA: RowNode<TData>, nodeB: RowNode<TData>) => number;
263
+ /** Named column type(s), resolved left-to-right before this column definition. */
264
+ type?: string | readonly string[];
265
+ initialSort?: SortDirection;
266
+ onCellClick?: (event: CellClickEvent<TData, TValue>) => void;
267
+ onCellDoubleClick?: (event: CellDoubleClickEvent<TData, TValue>) => void;
303
268
  }
304
- interface PrintOptions {
305
- title?: string;
306
- includeHeader?: boolean;
269
+ interface ColDefGroup<TData = any> {
270
+ groupId?: string;
271
+ headerName?: string;
272
+ headerClass?: string | string[];
273
+ children: (ColDefGroup<TData> | ColDef<TData>)[];
307
274
  }
308
- interface RowTransaction<TData = any> {
309
- add?: TData[];
310
- addIndex?: number;
311
- remove?: TData[];
312
- update?: TData[];
275
+ type ColDefOrGroup<TData = any> = ColDefGroup<TData> | ColDef<TData>;
276
+ declare function isColDefGroup<TData = any>(def: ColDefOrGroup<TData>): def is ColDefGroup<TData>;
277
+ interface ColumnState {
278
+ colId: string;
279
+ hide?: boolean;
280
+ width?: number;
281
+ /** Active flex weight. A resize clears flex and turns width into a manual override. */
282
+ flex?: number | null;
283
+ /** Distinguishes responsive/definition width from an explicit user or API override. */
284
+ widthMode?: "auto" | "manual";
285
+ /** Measured content basis for responsive fit sizing; independent of the rendered width. */
286
+ contentWidth?: number;
287
+ pinned?: "left" | "right" | null;
313
288
  }
314
- interface GridCellChange {
289
+
290
+ interface AdvancedFilterCondition {
291
+ kind: "condition";
315
292
  colId: string;
316
- originalValue: unknown;
317
- value: unknown;
293
+ filter: ColumnFilter;
318
294
  }
319
- interface GridChange<TData = any> {
320
- rowId: string;
321
- data: TData;
322
- cells: GridCellChange[];
295
+ interface AdvancedFilterGroup {
296
+ kind: "group";
297
+ operator: "and" | "or";
298
+ children: AdvancedFilterNode[];
299
+ /** Negates the complete group without changing its children. */
300
+ not?: boolean;
323
301
  }
324
- interface GridDiagnosticError {
325
- code: GridErrorCode;
326
- source: string;
327
- message: string;
328
- timestamp: number;
329
- context?: Record<string, unknown>;
302
+ type AdvancedFilterNode = AdvancedFilterCondition | AdvancedFilterGroup;
303
+ /** Serializable, backend-friendly nested filter expression. */
304
+ interface AdvancedFilterModel {
305
+ version: 1;
306
+ root: AdvancedFilterNode;
330
307
  }
331
- interface GridPerformanceSnapshot {
332
- sampleCount: number;
333
- lastRenderMs: number;
334
- averageRenderMs: number;
335
- maxRenderMs: number;
336
- p95RenderMs: number;
337
- longRenderCount: number;
338
- renderedRows: number;
339
- renderedColumns: number;
340
- renderedCells: number;
341
- layoutSampleCount: number;
342
- p95LayoutMs: number;
343
- modelSampleCount: number;
344
- p95ModelMs: number;
345
- longTaskCount: number;
346
- longTaskTotalMs: number;
347
- usedHeapBytes: number | null;
348
- }
349
- interface GridUpdateSchedulerSnapshot {
350
- batchDepth: number;
351
- flushCount: number;
352
- requestCount: number;
353
- coalescedRequestCount: number;
354
- pending: boolean;
355
- }
356
- interface RemoteBlockCacheSnapshot {
357
- cachedBlockCount: number;
358
- loadingBlockCount: number;
359
- activeRequestCount: number;
360
- queuedRequestCount: number;
361
- cachedRowCount: number;
362
- hitCount: number;
363
- missCount: number;
364
- evictionCount: number;
365
- }
366
- interface GridAsyncOptions {
367
- signal?: AbortSignal;
308
+
309
+ declare const EVENT_TYPES: readonly ["gridReady", "gridDestroyed", "modelUpdated", "cellClicked", "cellDoubleClicked", "cellContextMenu", "rowClicked", "rowDoubleClicked", "selectionChanged", "sortChanged", "filterChanged", "columnResized", "columnMoved", "columnVisibilityChanged", "cellValueChanged", "cellEditingStarted", "cellEditingStopped", "rowEditingStarted", "rowEditingStopped", "detailToggled", "treeChildrenLoaded", "treeChildrenLoadFailed", "rowDragEnd", "rangeSelectionChanged", "paginationChanged", "displayedColumnsChanged", "gridError", "dirtyStateChanged"];
310
+ type GridEventType = (typeof EVENT_TYPES)[number];
311
+ type GridErrorCode = "DATA_SOURCE_ERROR" | "DATA_INTEGRITY_ERROR" | "VALIDATION_ERROR" | "RENDERER_ERROR" | "EDITOR_ERROR" | "FEATURE_ERROR" | "STATE_ERROR" | "EVENT_HANDLER_ERROR" | "GRID_ERROR";
312
+ interface GridEventBase<TData = any> {
313
+ type: GridEventType;
314
+ api: GridApi<TData>;
368
315
  }
369
- interface RefreshCellsParams {
370
- /** Stable row identifiers. Omit together with rowIndexes to target every rendered row. */
371
- rowIds?: readonly string[];
372
- /** Displayed row indexes. Omit together with rowIds to target every rendered row. */
373
- rowIndexes?: readonly number[];
374
- /** Column IDs. Omit to target every rendered column in matching rows. */
375
- columns?: readonly string[];
376
- /** Bypasses renderer refresh hooks and recreates matching cell content. */
377
- force?: boolean;
378
- /** Also refreshes pinned rows. Defaults to true only for an unscoped refresh. */
379
- includePinned?: boolean;
316
+ interface GridReadyEvent<TData = any> extends GridEventBase<TData> {
317
+ type: "gridReady";
380
318
  }
381
- interface ColumnWorkbenchItem {
382
- colId: string;
383
- label: string;
384
- visible: boolean;
385
- pinned: "left" | "right" | null;
386
- width: number;
387
- movable: boolean;
388
- hideable: boolean;
319
+ interface GridDestroyedEvent<TData = any> extends GridEventBase<TData> {
320
+ type: "gridDestroyed";
389
321
  }
390
- interface GridDiagnostics {
391
- gridId: number;
392
- version: string;
393
- destroyed: boolean;
394
- infinite: boolean;
395
- loading: boolean;
322
+ interface ModelUpdatedEvent<TData = any> extends GridEventBase<TData> {
323
+ type: "modelUpdated";
396
324
  rowCount: number;
397
- renderedRowCount: number;
398
- columnCount: number;
399
- selectedRowCount: number;
400
- dirtyRowCount: number;
401
- activeFeatures: ReadonlyArray<{
402
- key: string;
403
- version?: string;
404
- }>;
405
- performance: GridPerformanceSnapshot;
406
- updates: GridUpdateSchedulerSnapshot;
407
- recentErrors: readonly GridDiagnosticError[];
408
325
  }
409
- interface GridRowsApi<TData = any> {
410
- setData(rows: TData[] | null | undefined): void;
411
- transact(transaction: RowTransaction<TData>): void;
412
- transactAsync(transaction: RowTransaction<TData>, options?: GridAsyncOptions): Promise<void>;
413
- flushTransactions(): void;
414
- getCount(): number;
415
- getAt(index: number): RowNode<TData> | undefined;
416
- getById(id: string): RowNode<TData> | undefined;
417
- forEach(callback: (node: RowNode<TData>, index: number) => void): void;
418
- forEachDisplayed(callback: (node: RowNode<TData>, index: number) => void): void;
419
- reorder(fromIndex: number, toIndex: number): boolean;
420
- isRemote(): boolean;
421
- reload(options?: GridAsyncOptions): Promise<void>;
422
- ensureLoaded(startRow: number, endRow: number, options?: GridAsyncOptions): Promise<void>;
423
- purgeCache(): void;
424
- getCacheSnapshot(): RemoteBlockCacheSnapshot;
326
+ interface CellClickEvent<TData = any, TValue = any> extends GridEventBase<TData> {
327
+ type: "cellClicked";
328
+ event: MouseEvent;
329
+ rowNode: RowNode<TData>;
330
+ rowIndex: number;
331
+ column: Column<TData>;
332
+ colDef: ColDef<TData, TValue>;
333
+ value: TValue;
425
334
  }
426
- interface GridColumnsApi<TData = any> {
427
- getDefinitions(): (ColDef<TData> | ColDefGroup<TData>)[] | null;
428
- setDefinitions(definitions: (ColDef<TData> | ColDefGroup<TData>)[] | null | undefined): void;
429
- getState(): ColumnState[];
430
- setState(state: ColumnState[]): void;
431
- resetState(): void;
432
- setVisible(colId: string, visible: boolean): void;
433
- setPinned(colId: string, pinned: "left" | "right" | null): void;
434
- move(colId: string, toIndex: number): void;
435
- setWidth(colId: string, width: number): boolean;
436
- fit(width?: number): void;
437
- autoSize(colId: string, skipHeader?: boolean): void;
438
- autoSizeAll(skipHeader?: boolean): void;
439
- getWorkbenchItems(): ColumnWorkbenchItem[];
440
- openWorkbench(anchor?: HTMLElement): void;
441
- closeWorkbench(): void;
335
+ interface CellDoubleClickEvent<TData = any, TValue = any> extends GridEventBase<TData> {
336
+ type: "cellDoubleClicked";
337
+ event: MouseEvent;
338
+ rowNode: RowNode<TData>;
339
+ rowIndex: number;
340
+ column: Column<TData>;
341
+ colDef: ColDef<TData, TValue>;
342
+ value: TValue;
442
343
  }
443
- interface GridSelectionApi<TData = any> {
444
- getRows(): TData[];
445
- getVisibleRows(): TData[];
446
- getNodes(): RowNode<TData>[];
447
- getIds(): string[];
448
- setRows(rows: TData[], clearOthers?: boolean): void;
449
- setById(nodeId: string, selected?: boolean, clearOthers?: boolean): void;
450
- selectAll(filteredOnly?: boolean): void;
451
- clear(): void;
452
- getMode(): RowSelectionMode;
453
- setMode(mode: RowSelectionMode): void;
454
- getRange(): GridCellRange | null;
455
- clearRange(): void;
344
+ interface CellContextMenuEvent<TData = any, TValue = any> extends GridEventBase<TData> {
345
+ type: "cellContextMenu";
346
+ event: MouseEvent;
347
+ rowNode: RowNode<TData>;
348
+ rowIndex: number;
349
+ column: Column<TData>;
350
+ colDef: ColDef<TData, TValue>;
351
+ value: TValue;
456
352
  }
457
- interface GridEditingApi<TData = any> {
458
- startCell(params: {
459
- rowIndex: number;
460
- colId: string;
461
- keyPress?: string;
462
- }): boolean;
463
- startRow(rowIndex: number): boolean;
464
- isRowActive(rowIndex?: number): boolean;
465
- stop(options?: {
466
- cancel?: boolean;
467
- }): Promise<boolean>;
468
- getChanges(): GridChange<TData>[];
469
- getDirtyRowIds(): string[];
470
- markSaved(rowIds?: readonly string[]): void;
471
- rollback(rowIds?: readonly string[]): boolean;
472
- save(handler: SaveChangesHandler<TData>, rowIds?: readonly string[]): Promise<GridBatchSaveResult<TData>>;
473
- undo(): boolean;
474
- redo(): boolean;
475
- canUndo(): boolean;
476
- canRedo(): boolean;
353
+ interface RowClickEvent<TData = any> extends GridEventBase<TData> {
354
+ type: "rowClicked" | "rowDoubleClicked";
355
+ event: MouseEvent;
356
+ rowNode: RowNode<TData>;
357
+ rowIndex: number;
477
358
  }
478
- interface GridStateApi {
479
- get(): GridState;
480
- apply(state: GridStateInput, options?: ApplyGridStateOptions): void;
359
+ interface SelectionChangedEvent<TData = any> extends GridEventBase<TData> {
360
+ type: "selectionChanged";
361
+ selectedNodes: RowNode<TData>[];
362
+ selectedRows: TData[];
481
363
  }
482
- interface GridDiagnosticsApi {
483
- get(): GridDiagnostics;
484
- getPerformance(): GridPerformanceSnapshot;
485
- resetPerformance(): void;
364
+ interface SortChangedEvent<TData = any> extends GridEventBase<TData> {
365
+ type: "sortChanged";
366
+ sortModel: SortModel;
486
367
  }
487
- /** Filtering owns filter state only; server requests remain in the host query layer. */
488
- interface GridFilteringApi {
489
- getModel(): FilterModel;
490
- setModel(model: FilterModel | null): void;
491
- getAdvancedModel(): AdvancedFilterModel | null;
492
- setAdvancedModel(model: AdvancedFilterModel | null): void;
493
- getQuickText(): string | null;
494
- setQuickText(text: string | null | undefined): void;
495
- isPresent(colId?: string): boolean;
368
+ interface FilterChangedEvent<TData = any> extends GridEventBase<TData> {
369
+ type: "filterChanged";
370
+ filterModel: FilterModel;
371
+ advancedFilterModel: AdvancedFilterModel | null;
496
372
  }
497
- interface GridPaginationApi {
498
- isEnabled(): boolean;
499
- setEnabled(enabled: boolean): void;
500
- getPage(): number;
501
- setPage(page: number): void;
502
- getPageSize(): number;
503
- setPageSize(size: number): void;
504
- getPageCount(): number;
505
- getTotalRowCount(): number;
373
+ interface ColumnResizedEvent<TData = any> extends GridEventBase<TData> {
374
+ type: "columnResized";
375
+ colId: string;
376
+ width: number;
377
+ finished: boolean;
506
378
  }
507
- interface GridSortingApi {
508
- getModel(): SortModel;
509
- setModel(model: SortModel | null): void;
379
+ interface ColumnMovedEvent<TData = any> extends GridEventBase<TData> {
380
+ type: "columnMoved";
381
+ colId: string;
382
+ toIndex: number;
510
383
  }
511
- interface GridHierarchyApi<TData = any> {
512
- isRowExpanded(rowId: string): boolean;
513
- setRowExpanded(rowId: string, expanded: boolean): boolean;
514
- isTreeRowLoading(rowId: string): boolean;
515
- loadTreeChildren(rowId: string, options?: {
516
- force?: boolean;
517
- }): Promise<readonly TData[]>;
518
- isGroupExpanded(groupId: string): boolean;
519
- setGroupExpanded(groupId: string, expanded: boolean): boolean;
520
- setAllGroupsExpanded(expanded: boolean): void;
521
- setAllDetailsExpanded(expanded: boolean): void;
384
+ interface ColumnVisibilityChangedEvent<TData = any> extends GridEventBase<TData> {
385
+ type: "columnVisibilityChanged";
386
+ colId: string;
387
+ visible: boolean;
522
388
  }
523
- interface GridViewApi<TData = any> {
524
- getRoot(): HTMLElement | null;
525
- scrollToRow(index: number, position?: "top" | "bottom" | "middle" | "nearest"): void;
526
- refreshCells(params?: RefreshCellsParams): void;
527
- refreshLayout(): void;
528
- flush(): void;
529
- setOverlay(type: "loading" | "noRows" | "error" | null): void;
530
- getPinnedRows(position: "top" | "bottom"): TData[];
531
- setPinnedRows(position: "top" | "bottom", rows: TData[] | null): void;
389
+ interface CellValueChangedEvent<TData = any, TValue = any> extends GridEventBase<TData> {
390
+ type: "cellValueChanged";
391
+ oldValue: TValue;
392
+ newValue: TValue;
393
+ rowNode: RowNode<TData>;
394
+ rowIndex: number;
395
+ column: Column<TData>;
396
+ colDef: ColDef<TData, TValue>;
397
+ data: TData;
532
398
  }
533
- interface GridIoApi {
534
- exportCsv(params?: CsvExportParams): string;
535
- importCsv(text: string, options?: ImportCsvOptions): boolean;
536
- print(options?: PrintOptions): boolean;
537
- copyRange(): Promise<boolean>;
538
- }
539
- interface SaveChangeIssue {
540
- rowId: string;
541
- code?: string;
542
- message: string;
543
- colIds?: readonly string[];
544
- retryable?: boolean;
545
- }
546
- interface SaveChangeConflict<TData = any> extends SaveChangeIssue {
547
- serverData?: TData;
548
- serverVersion?: string | number;
549
- }
550
- interface SaveChangesResult<TData = any> {
551
- /** Omit to acknowledge every submitted row; return a subset for partial batch success. */
552
- savedRowIds?: readonly string[];
553
- failures?: readonly SaveChangeIssue[];
554
- conflicts?: readonly SaveChangeConflict<TData>[];
555
- }
556
- interface GridBatchSaveResult<TData = any> {
557
- submitted: GridChange<TData>[];
558
- saved: GridChange<TData>[];
559
- failures: SaveChangeIssue[];
560
- conflicts: SaveChangeConflict<TData>[];
561
- }
562
- type SaveChangesHandler<TData = any> = (changes: readonly GridChange<TData>[]) => void | SaveChangesResult<TData> | Promise<void | SaveChangesResult<TData>>;
563
- interface GridApi<TData = any> {
564
- readonly rows: GridRowsApi<TData>;
565
- readonly columns: GridColumnsApi<TData>;
566
- readonly selection: GridSelectionApi<TData>;
567
- readonly editing: GridEditingApi<TData>;
568
- readonly filtering: GridFilteringApi;
569
- readonly sorting: GridSortingApi;
570
- readonly pagination: GridPaginationApi;
571
- readonly hierarchy: GridHierarchyApi<TData>;
572
- readonly view: GridViewApi<TData>;
573
- readonly state: GridStateApi;
574
- readonly io: GridIoApi;
575
- readonly diagnostics: GridDiagnosticsApi;
576
- /** Coalesces model/layout/render work from nested synchronous API calls. */
577
- batch<TResult>(callback: (api: GridApi<TData>) => TResult): TResult;
578
- /** Resolves after the first layout frame and gridReady emission. */
579
- whenReady(): Promise<GridApi<TData>>;
580
- /** Reads the currently resolved value after application, preset and table overrides. */
581
- getOption<K extends keyof GridOptions<TData>>(key: K): GridOptions<TData>[K];
582
- updateOptions(options: Partial<GridOptions<TData>>): void;
583
- on<K extends GridEventType>(eventType: K, listener: (event: GridEventMap<TData>[K]) => void): () => void;
584
- destroy(): void;
585
- isDestroyed(): boolean;
586
- }
587
-
588
- interface ValueGetterParams<TData = any, TValue = any> {
589
- data: TData | null;
590
- node: RowNode<TData>;
591
- colDef: ColDef<TData, TValue>;
592
- column: Column<TData>;
593
- api: GridApi<TData>;
594
- }
595
- interface ValueFormatterParams<TData = any, TValue = any> extends ValueGetterParams<TData, TValue> {
596
- value: TValue;
597
- }
598
- interface CellRendererParams<TData = any, TValue = any> extends ValueGetterParams<TData, TValue> {
599
- value: TValue;
600
- formatted: string;
399
+ interface CellEditingStartedEvent<TData = any> extends GridEventBase<TData> {
400
+ type: "cellEditingStarted";
601
401
  rowIndex: number;
602
- rendererParams?: Record<string, any>;
402
+ colId: string;
403
+ rowNode: RowNode<TData>;
603
404
  }
604
- interface CellClassParams<TData = any, TValue = any> extends ValueGetterParams<TData, TValue> {
605
- value: TValue;
405
+ interface CellEditingStoppedEvent<TData = any> extends GridEventBase<TData> {
406
+ type: "cellEditingStopped";
606
407
  rowIndex: number;
408
+ colId: string;
409
+ rowNode: RowNode<TData>;
410
+ oldValue: any;
411
+ newValue: any;
607
412
  }
608
- interface EditableParams<TData = any, TValue = any> extends ValueGetterParams<TData, TValue> {
609
- value: TValue;
610
- rowIndex: number;
413
+ interface RowEditChange {
414
+ colId: string;
415
+ oldValue: unknown;
416
+ newValue: unknown;
611
417
  }
612
- interface CellEditorParams<TData = any, TValue = any> extends ValueGetterParams<TData, TValue> {
613
- value: TValue;
418
+ interface RowEditingStartedEvent<TData = any> extends GridEventBase<TData> {
419
+ type: "rowEditingStarted";
614
420
  rowIndex: number;
615
- keyPress?: string | null;
616
- }
617
- interface ValueSetterParams<TData = any, TValue = any> {
618
- oldValue: TValue;
619
- newValue: TValue;
620
- data: TData;
621
- node: RowNode<TData>;
622
- colDef: ColDef<TData, TValue>;
623
- column: Column<TData>;
624
- api: GridApi<TData>;
625
- }
626
- interface GetRowIdParams<TData = any> {
421
+ rowNode: RowNode<TData>;
627
422
  data: TData;
628
- index: number;
629
- api: GridApi<TData>;
630
- }
631
- interface GetRowHeightParams<TData = any> {
632
- data: TData | null;
633
- node: RowNode<TData>;
634
- api: GridApi<TData>;
635
423
  }
636
- interface TooltipParams<TData = any> {
637
- data: TData | null;
638
- node: RowNode<TData>;
639
- api: GridApi<TData>;
640
- colId: string;
641
- value: any;
642
- formatted: string;
643
- rowIndex: number;
644
- }
645
- interface ContextMenuParams<TData = any> {
646
- data: TData | null;
647
- node: RowNode<TData>;
648
- api: GridApi<TData>;
649
- colId: string;
650
- value: any;
424
+ interface RowEditingStoppedEvent<TData = any> extends GridEventBase<TData> {
425
+ type: "rowEditingStopped";
651
426
  rowIndex: number;
427
+ rowNode: RowNode<TData>;
428
+ data: TData;
429
+ cancelled: boolean;
430
+ changes: RowEditChange[];
652
431
  }
653
- interface ContextMenuItem {
654
- label?: string;
655
- action?: () => void;
656
- danger?: boolean;
657
- disabled?: boolean;
658
- separator?: boolean;
659
- }
660
- interface HeaderComponentParams<TData = any> {
661
- colDef: ColDef<TData>;
662
- column: Column<TData>;
663
- api: GridApi<TData>;
664
- }
665
- interface ICellRendererResult {
666
- el: HTMLElement;
667
- /** Reuses the mounted renderer for an update. Return false to request recreation. */
668
- refresh?(params: CellRendererParams): boolean | void;
669
- destroy?: () => void;
670
- }
671
- type CellRendererOutput = string | HTMLElement | ICellRendererResult | null | undefined;
672
- interface ICellEditor<TValue = any> {
673
- el: HTMLElement;
674
- getValue(): TValue | null | undefined;
675
- focus?(): void;
676
- destroy?(): void;
677
- isCancelBeforeStart?(): boolean;
678
- isCancelAfterEnd?(value: TValue | null | undefined): boolean;
432
+ interface DetailToggledEvent<TData = any> extends GridEventBase<TData> {
433
+ type: "detailToggled";
434
+ rowId: string;
435
+ rowNode: RowNode<TData>;
436
+ expanded: boolean;
679
437
  }
680
-
681
- type SortDirection = "asc" | "desc";
682
- type PinnedDirection = "left" | "right";
683
- type FilterType = "text" | "number" | "date" | "set";
684
- type CellAlign = "left" | "center" | "right";
685
- type TextFilterMatch = "contains" | "notContains" | "equals" | "notEquals" | "startsWith" | "endsWith" | "blank" | "notBlank";
686
- type NumberFilterMatch = "equals" | "notEquals" | "lessThan" | "lessThanOrEqual" | "greaterThan" | "greaterThanOrEqual" | "inRange" | "blank" | "notBlank";
687
- type DateFilterMatch = "equals" | "notEquals" | "lessThan" | "greaterThan" | "inRange" | "blank" | "notBlank";
688
- interface TextFilterCondition {
689
- match: TextFilterMatch;
690
- value?: string;
438
+ interface TreeChildrenLoadedEvent<TData = any> extends GridEventBase<TData> {
439
+ type: "treeChildrenLoaded";
440
+ rowId: string;
441
+ rowNode: RowNode<TData>;
442
+ children: readonly TData[];
691
443
  }
692
- interface NumberFilterCondition {
693
- match: NumberFilterMatch;
694
- value?: number;
695
- value2?: number;
444
+ interface TreeChildrenLoadFailedEvent<TData = any> extends GridEventBase<TData> {
445
+ type: "treeChildrenLoadFailed";
446
+ rowId: string;
447
+ rowNode: RowNode<TData>;
448
+ error: unknown;
696
449
  }
697
- interface DateFilterCondition {
698
- match: DateFilterMatch;
699
- value?: string;
700
- value2?: string;
450
+ interface GridCellRange {
451
+ row1: number;
452
+ row2: number;
453
+ colId1: string;
454
+ colId2: string;
701
455
  }
702
- interface SetFilterCondition {
703
- values: (string | number | null)[];
456
+ interface RangeSelectionChangedEvent<TData = any> extends GridEventBase<TData> {
457
+ type: "rangeSelectionChanged";
458
+ range: GridCellRange | null;
704
459
  }
705
- interface TextColumnFilter {
706
- type: "text";
707
- operator?: "and" | "or";
708
- conditions: TextFilterCondition[];
460
+ /** Stable identities for persistence; displayed indexes remain presentation only. */
461
+ interface RowDragIntent {
462
+ rowIds: readonly string[];
463
+ targetId: string | null;
464
+ position: "before" | "after" | "inside";
465
+ beforeId: string | null;
466
+ afterId: string | null;
467
+ expectedRevision?: string | number;
709
468
  }
710
- interface NumberColumnFilter {
711
- type: "number";
712
- operator?: "and" | "or";
713
- conditions: NumberFilterCondition[];
469
+ interface RowDragEndEvent<TData = any> extends GridEventBase<TData> {
470
+ type: "rowDragEnd";
471
+ rowNode: RowNode<TData>;
472
+ fromIndex: number;
473
+ /** Legacy insertion boundary, before removing the source row. */
474
+ toIndex: number;
475
+ /** Final displayed index after removing and inserting the source row. */
476
+ targetIndex: number;
477
+ /** True when the grid applied the move before emitting this event. */
478
+ applied: boolean;
479
+ intent?: RowDragIntent;
714
480
  }
715
- interface DateColumnFilter {
716
- type: "date";
717
- operator?: "and" | "or";
718
- conditions: DateFilterCondition[];
481
+ interface PaginationChangedEvent<TData = any> extends GridEventBase<TData> {
482
+ type: "paginationChanged";
483
+ page: number;
484
+ pageSize: number;
485
+ pageCount: number;
486
+ total: number;
719
487
  }
720
- interface SetColumnFilter {
721
- type: "set";
722
- values: (string | number | null)[];
488
+ interface DisplayedColumnsChangedEvent<TData = any> extends GridEventBase<TData> {
489
+ type: "displayedColumnsChanged";
723
490
  }
724
- type ColumnFilter = TextColumnFilter | NumberColumnFilter | DateColumnFilter | SetColumnFilter;
725
- type FilterModel = Record<string, ColumnFilter>;
726
- interface SortModelItem {
727
- colId: string;
728
- direction: SortDirection;
491
+ interface GridErrorEvent<TData = any> extends GridEventBase<TData> {
492
+ type: "gridError";
493
+ code: GridErrorCode;
494
+ error: unknown;
495
+ source: string;
496
+ context?: Record<string, unknown>;
729
497
  }
730
- type SortModel = SortModelItem[];
731
- interface SelectEditorOption {
732
- label: string;
733
- value: string | number;
734
- disabled?: boolean;
498
+ interface DirtyStateChangedEvent<TData = any> extends GridEventBase<TData> {
499
+ type: "dirtyStateChanged";
500
+ dirtyRowIds: string[];
735
501
  }
736
- interface SelectEditorParams {
737
- /** Primitive options kept for concise same-label/same-value selects. */
738
- values?: readonly (string | number)[];
739
- /** Label/value options for dictionary fields whose stored value differs from its display text. */
740
- options?: readonly SelectEditorOption[];
741
- }
742
- interface SetFilterParams {
743
- values?: (string | number | null)[];
744
- maxValues?: number;
745
- }
746
- type CellEditorFactory = (params: CellEditorParams) => ICellEditor;
747
- type CellRendererFn = (params: CellRendererParams) => string | HTMLElement | ICellRendererResult | null | undefined;
748
- type CellClassRule = string | string[] | ((params: CellClassParams) => string | string[] | null | undefined);
749
- type CellStyleRule = Partial<CSSStyleDeclaration> | ((params: CellClassParams<any, any>) => Partial<CSSStyleDeclaration> | null | undefined);
750
- interface ColDef<TData = any, TValue = any> {
751
- colId?: string;
752
- field?: string;
753
- headerName?: string;
754
- align?: CellAlign;
755
- headerAlign?: CellAlign;
756
- headerClass?: string | string[];
757
- headerTooltip?: string;
758
- headerComponent?: (params: HeaderComponentParams<TData>) => string | HTMLElement | ICellRendererResult | null | undefined;
759
- width?: number;
760
- minWidth?: number;
761
- maxWidth?: number;
762
- flex?: number;
763
- /** Excludes the column from `columnLayout: "fit"` scaling. */
764
- suppressSizeToFit?: boolean;
765
- /** Hides the per-column tools trigger while keeping the global column workbench available. */
766
- suppressColumnMenu?: boolean;
767
- hide?: boolean;
768
- pinned?: PinnedDirection | boolean;
769
- sortable?: boolean;
770
- resizable?: boolean;
771
- movable?: boolean;
772
- filter?: boolean | FilterType;
773
- filterParams?: SetFilterParams;
774
- editable?: boolean | ((params: EditableParams<TData, TValue>) => boolean);
775
- cellEditor?: "text" | "number" | "date" | "select" | CellEditorFactory | string;
776
- cellEditorParams?: SelectEditorParams;
777
- wrapText?: boolean;
778
- checkboxSelection?: boolean;
779
- rowGroup?: boolean;
780
- aggFunc?: string;
781
- cellStyle?: CellStyleRule;
782
- selectable?: (params: CellClassParams<TData, TValue>) => boolean;
783
- singleClickEdit?: boolean;
784
- tooltipValueGetter?: (params: ValueFormatterParams<TData, TValue>) => string | null | undefined;
785
- rowSpan?: (params: CellClassParams<TData, TValue>) => number;
786
- autoRowSpan?: boolean;
787
- colSpan?: (params: CellClassParams<TData, TValue>) => number;
788
- autoHeight?: boolean;
789
- validate?: (newValue: TValue, params: ValueSetterParams<TData, TValue>) => string | true | null | undefined | Promise<string | true | null | undefined>;
790
- rowDrag?: boolean;
791
- valueGetter?: (params: ValueGetterParams<TData, TValue>) => TValue;
792
- valueSetter?: (params: ValueSetterParams<TData, TValue>) => boolean;
793
- valueFormatter?: (params: ValueFormatterParams<TData, TValue>) => any;
794
- cellRenderer?: CellRendererFn | string;
795
- cellRendererParams?: Record<string, any>;
796
- cellClass?: CellClassRule;
797
- comparator?: (valueA: any, valueB: any, nodeA: RowNode<TData>, nodeB: RowNode<TData>) => number;
798
- /** Named column type(s), resolved left-to-right before this column definition. */
799
- type?: string | readonly string[];
800
- initialSort?: SortDirection;
801
- onCellClick?: (event: CellClickEvent<TData, TValue>) => void;
802
- onCellDoubleClick?: (event: CellDoubleClickEvent<TData, TValue>) => void;
803
- }
804
- interface ColDefGroup<TData = any> {
805
- groupId?: string;
806
- headerName?: string;
807
- headerClass?: string | string[];
808
- children: (ColDefGroup<TData> | ColDef<TData>)[];
809
- }
810
- type ColDefOrGroup<TData = any> = ColDefGroup<TData> | ColDef<TData>;
811
- declare function isColDefGroup<TData = any>(def: ColDefOrGroup<TData>): def is ColDefGroup<TData>;
812
- interface ColumnState {
813
- colId: string;
814
- hide?: boolean;
815
- width?: number;
816
- /** Active flex weight. A resize clears flex and turns width into a manual override. */
817
- flex?: number | null;
818
- /** Distinguishes responsive/definition width from an explicit user or API override. */
819
- widthMode?: "auto" | "manual";
820
- /** Measured content basis for responsive fit sizing; independent of the rendered width. */
821
- contentWidth?: number;
822
- pinned?: "left" | "right" | null;
823
- }
824
-
825
- declare class ColumnGroup<TData = any> {
826
- readonly groupId: string;
827
- readonly def: ColDefGroup<TData>;
828
- parent: ColumnGroup<TData> | null;
829
- children: (ColumnGroup<TData> | Column<TData>)[];
830
- constructor(groupId: string, def: ColDefGroup<TData>);
831
- get headerName(): string;
832
- getLeafColumns(out?: Column<TData>[]): Column<TData>[];
833
- }
834
-
835
- declare class Column<TData = any> {
836
- readonly id: string;
837
- readonly colDef: ColDef<TData>;
838
- hide: boolean;
839
- pinned: PinnedDirection | null;
840
- manualWidth: number | null;
841
- contentWidth: number | null;
842
- flex: number | null;
843
- currentWidth: number;
844
- parentGroup: ColumnGroup<TData> | null;
845
- level: number;
846
- isDetailToggle: boolean;
847
- constructor(id: string, colDef: ColDef<TData>);
848
- get sortable(): boolean;
849
- get resizable(): boolean;
850
- get movable(): boolean;
851
- get filterable(): boolean;
852
- get filterType(): FilterType;
853
- get hasCheckbox(): boolean;
854
- resetWidth(): void;
502
+ interface GridEventMap<TData = any> {
503
+ gridReady: GridReadyEvent<TData>;
504
+ gridDestroyed: GridDestroyedEvent<TData>;
505
+ modelUpdated: ModelUpdatedEvent<TData>;
506
+ cellClicked: CellClickEvent<TData>;
507
+ cellDoubleClicked: CellDoubleClickEvent<TData>;
508
+ cellContextMenu: CellContextMenuEvent<TData>;
509
+ rowClicked: RowClickEvent<TData>;
510
+ rowDoubleClicked: RowClickEvent<TData>;
511
+ selectionChanged: SelectionChangedEvent<TData>;
512
+ sortChanged: SortChangedEvent<TData>;
513
+ filterChanged: FilterChangedEvent<TData>;
514
+ columnResized: ColumnResizedEvent<TData>;
515
+ columnMoved: ColumnMovedEvent<TData>;
516
+ columnVisibilityChanged: ColumnVisibilityChangedEvent<TData>;
517
+ cellValueChanged: CellValueChangedEvent<TData>;
518
+ cellEditingStarted: CellEditingStartedEvent<TData>;
519
+ cellEditingStopped: CellEditingStoppedEvent<TData>;
520
+ rowEditingStarted: RowEditingStartedEvent<TData>;
521
+ rowEditingStopped: RowEditingStoppedEvent<TData>;
522
+ detailToggled: DetailToggledEvent<TData>;
523
+ treeChildrenLoaded: TreeChildrenLoadedEvent<TData>;
524
+ treeChildrenLoadFailed: TreeChildrenLoadFailedEvent<TData>;
525
+ rowDragEnd: RowDragEndEvent<TData>;
526
+ rangeSelectionChanged: RangeSelectionChangedEvent<TData>;
527
+ paginationChanged: PaginationChangedEvent<TData>;
528
+ displayedColumnsChanged: DisplayedColumnsChangedEvent<TData>;
529
+ gridError: GridErrorEvent<TData>;
530
+ dirtyStateChanged: DirtyStateChangedEvent<TData>;
855
531
  }
856
532
 
857
533
  declare const DEFAULT_LOCALE: {
@@ -919,12 +595,41 @@ declare const DEFAULT_LOCALE: {
919
595
  readonly rowDragOutside: "移回表格内放置 · Esc 取消";
920
596
  };
921
597
  type MachTableLocaleKey = keyof typeof DEFAULT_LOCALE;
922
- type MachTableLocale = Partial<Record<MachTableLocaleKey, string>>;
598
+ type MachTableLocale = Partial<Record<MachTableLocaleKey | "rowDragSelection" | "rowDragBefore" | "rowDragAfter" | "rowDragInside" | "rowDragRejected", string>>;
923
599
  declare const LOCALE_EN: MachTableLocale;
924
600
  declare function matchLocaleKey(match: string): MachTableLocaleKey;
925
601
  declare function formatText(template: string, n: number | string): string;
926
602
  declare function formatTwo(template: string, a: number | string, b: number | string): string;
927
603
 
604
+ interface GridStateBase {
605
+ columns: ColumnState[];
606
+ sortModel: SortModel;
607
+ filterModel: FilterModel;
608
+ quickFilterText: string | null;
609
+ pagination: {
610
+ enabled: boolean;
611
+ page: number;
612
+ pageSize: number;
613
+ };
614
+ selectedRowIds: string[];
615
+ expandedRowIds: string[];
616
+ expandedGroupIds: string[];
617
+ }
618
+ /** Serializable snapshot of user-visible grid state. */
619
+ interface GridState extends GridStateBase {
620
+ /** State schema version, independent from the package version. */
621
+ version: 2;
622
+ advancedFilterModel: AdvancedFilterModel | null;
623
+ }
624
+ type GridStateInput = GridState;
625
+ type GridStateSection = "columns" | "sort" | "filter" | "pagination" | "selection" | "expansion";
626
+ interface ApplyGridStateOptions {
627
+ /** Applies all sections when omitted. */
628
+ sections?: readonly GridStateSection[];
629
+ /** Emit the standard sort/filter/pagination events after restoration. */
630
+ emitEvents?: boolean;
631
+ }
632
+
928
633
  type Callable = (...args: never[]) => unknown;
929
634
  type Primitive = string | number | boolean | bigint | symbol | null | undefined | Date | Callable;
930
635
  type Depth = 0 | 1 | 2 | 3 | 4;
@@ -1121,6 +826,20 @@ interface ActionPolicy<TData = any> {
1121
826
  confirm?(context: ActionPolicyContext<TData>): boolean | Promise<boolean>;
1122
827
  onError?(error: unknown, context: ActionPolicyContext<TData>): void;
1123
828
  }
829
+ interface RowDragPolicy<TData = any> {
830
+ /** Return a reason to disable the handle and explain the restriction. */
831
+ canDrag?(params: {
832
+ node: RowNode<TData>;
833
+ api: GridApi<TData>;
834
+ }): boolean | string;
835
+ canDrop?(params: {
836
+ node: RowNode<TData>;
837
+ api: GridApi<TData>;
838
+ targetNode: RowNode<TData> | undefined;
839
+ intent: RowDragIntent;
840
+ }): boolean | string;
841
+ getRevision?(): string | number | undefined;
842
+ }
1124
843
  interface GridOptions<TData = any> extends EventHandlers<TData> {
1125
844
  columnDefs?: (ColDef<TData> | ColDefGroup<TData>)[] | null;
1126
845
  rowData?: TData[] | null;
@@ -1190,6 +909,7 @@ interface GridOptions<TData = any> extends EventHandlers<TData> {
1190
909
  indexOffset?: number;
1191
910
  /** Apply flat local row moves automatically (default true). False emits intent for server-controlled ordering. */
1192
911
  applyRowDrag?: boolean;
912
+ rowDragPolicy?: RowDragPolicy<TData>;
1193
913
  undoStackSize?: number;
1194
914
  /** Milliseconds used to coalesce applyTransactionAsync calls. */
1195
915
  asyncTransactionWaitMillis?: number;
@@ -1307,6 +1027,7 @@ interface ResolvedGridOptions<TData = any> extends EventHandlers<TData> {
1307
1027
  defaultExpandAll: boolean;
1308
1028
  indexOffset: number;
1309
1029
  applyRowDrag: boolean;
1030
+ rowDragPolicy?: RowDragPolicy<TData>;
1310
1031
  undoStackSize: number;
1311
1032
  asyncTransactionWaitMillis: number;
1312
1033
  getRowHeight?: (params: GetRowHeightParams<TData>) => number;
@@ -1362,4 +1083,309 @@ interface ResolvedGridOptions<TData = any> extends EventHandlers<TData> {
1362
1083
  className: string;
1363
1084
  }
1364
1085
 
1365
- export { type DateFilterMatch as $, type AdvancedFilterModel as A, type CellClickEvent as B, type ColDef as C, type CellContextMenuEvent as D, type CellDoubleClickEvent as E, type FilterModel as F, type GridOptions as G, type CellEditingStartedEvent as H, type CellEditingStoppedEvent as I, type CellEditorFactory as J, type CellEditorParams as K, type CellRendererOutput as L, type CellStyleRule as M, type CellValueChangedEvent as N, type ColDefOrGroup as O, type ColumnLayoutMode as P, type ColumnMovedEvent as Q, type ColumnResizedEvent as R, type SortModel as S, type ColumnVisibilityChangedEvent as T, type ColumnWorkbenchItem as U, type ContextMenuItem as V, type ContextMenuParams as W, type CsvExportParams as X, DEFAULT_LOCALE as Y, type DatasourceMode as Z, type DateFilterCondition as _, type GridComponents as a, type RangeSelectionChangedEvent as a$, type DetailRowRendererParams as a0, type DetailToggledEvent as a1, type DirtyStateChangedEvent as a2, type DomLayoutMode as a3, EVENT_TYPES as a4, type EditableIndicator as a5, type EditableParams as a6, type EventHandlers as a7, type FilterChangedEvent as a8, type FilterType as a9, type GridPerformanceSnapshot as aA, type GridPersistenceOptions as aB, type GridReadyEvent as aC, type GridRowsApi as aD, type GridSelectionApi as aE, type GridSortingApi as aF, type GridStateApi as aG, type GridStateSection as aH, type GridUpdateSchedulerSnapshot as aI, type GridViewApi as aJ, type HeaderComponentParams as aK, type ICellEditor as aL, type ICellRendererResult as aM, type ImportCsvOptions as aN, type InfiniteGetRowsParams as aO, LOCALE_EN as aP, type MachTableLocale as aQ, type MachTableLocaleKey as aR, type ModelUpdatedEvent as aS, type NumberFilterCondition as aT, type NumberFilterMatch as aU, type OverlayContent as aV, type OverlayTemplate as aW, type PaginationChangedEvent as aX, type PaginationConfig as aY, type PinnedDirection as aZ, type PrintOptions as a_, type GetRowHeightParams as aa, type GridAsyncOptions as ab, type GridBatchSaveResult as ac, type GridCellChange as ad, type GridCellRange as ae, type GridColumnsApi as af, type GridDataProcessor as ag, type GridDataProcessorColumn as ah, type GridDataProcessorRequest as ai, type GridDataProcessorResult as aj, type GridDataProcessorRow as ak, type GridDatasource as al, type GridDiagnosticError as am, type GridDiagnostics as an, type GridDiagnosticsApi as ao, type GridEditType as ap, type GridEditingApi as aq, type GridErrorCode as ar, type GridErrorEvent as as, type GridEventBase as at, type GridEventMap as au, type GridFeatureContext as av, type GridFilteringApi as aw, type GridHierarchyApi as ax, type GridIoApi as ay, type GridPaginationApi as az, type GridEventType as b, type RefreshCellsParams as b0, type RemoteBlockCacheSnapshot as b1, type ResolvedGridOptions as b2, type RowClickEvent as b3, type RowDragEndEvent as b4, type RowEditChange as b5, type RowEditValidationParams as b6, type RowEditValidationResult as b7, type RowEditingStartedEvent as b8, type RowEditingStoppedEvent as b9, type ValueFormatterParams as bA, type ValueGetterParams as bB, type ValueSetterParams as bC, type WatermarkConfig as bD, formatText as bE, formatTwo as bF, isColDefGroup as bG, matchLocaleKey as bH, type RowNode as ba, type RowSelectionMode as bb, type RowStyleParams as bc, type RowStyleRule as bd, type RowTone as be, type RowTransaction as bf, type SaveChangeIssue as bg, type SaveChangesHandler as bh, type SaveChangesResult as bi, type SelectEditorOption as bj, type SelectEditorParams as bk, type SelectionChangedEvent as bl, type SetFilterCondition as bm, type SetFilterParams as bn, type SortChangedEvent as bo, type SortDirection as bp, type SortModelItem as bq, type StatusBarConfig as br, type StatusBarPanel as bs, type TextFilterCondition as bt, type TextFilterMatch as bu, type ThemeMode as bv, type TooltipParams as bw, type TreeChildrenLoadFailedEvent as bx, type TreeChildrenLoadedEvent as by, type TreeDataLoadParams as bz, type GridApi as c, type ColumnFilter as d, type AdvancedFilterCondition as e, type AdvancedFilterNode as f, type AdvancedFilterGroup as g, type GridFeature as h, type ColDefGroup as i, type GridStateStore as j, type GridState as k, type GridStateInput as l, type GridSize as m, type CellRendererParams as n, type GridChange as o, type CellRendererFn as p, type FieldPath as q, type FieldPathValue as r, type SaveChangeConflict as s, type ColumnState as t, type ActionPolicy as u, type ActionPolicyContext as v, type ApplyGridStateOptions as w, type CellAlign as x, type CellClassParams as y, type CellClassRule as z };
1086
+ interface CsvExportParams {
1087
+ includeHeader?: boolean;
1088
+ columnSeparator?: string;
1089
+ prependBOM?: boolean;
1090
+ onlySelected?: boolean;
1091
+ onlyAllDisplayed?: boolean;
1092
+ protectFormulas?: boolean;
1093
+ headersOnly?: boolean;
1094
+ }
1095
+ interface ImportCsvOptions {
1096
+ separator?: string;
1097
+ mode?: "replace" | "append" | "paste";
1098
+ headerRowIndex?: number;
1099
+ coerceNumbers?: boolean;
1100
+ parseValue?: (params: {
1101
+ value: string;
1102
+ field: string;
1103
+ rowIndex: number;
1104
+ columnIndex: number;
1105
+ }) => any;
1106
+ }
1107
+ interface PrintOptions {
1108
+ title?: string;
1109
+ includeHeader?: boolean;
1110
+ }
1111
+ interface RowTransaction<TData = any> {
1112
+ add?: TData[];
1113
+ addIndex?: number;
1114
+ remove?: TData[];
1115
+ update?: TData[];
1116
+ }
1117
+ interface GridCellChange {
1118
+ colId: string;
1119
+ originalValue: unknown;
1120
+ value: unknown;
1121
+ }
1122
+ interface GridChange<TData = any> {
1123
+ rowId: string;
1124
+ data: TData;
1125
+ cells: GridCellChange[];
1126
+ }
1127
+ interface GridDiagnosticError {
1128
+ code: GridErrorCode;
1129
+ source: string;
1130
+ message: string;
1131
+ timestamp: number;
1132
+ context?: Record<string, unknown>;
1133
+ }
1134
+ interface GridPerformanceSnapshot {
1135
+ sampleCount: number;
1136
+ lastRenderMs: number;
1137
+ averageRenderMs: number;
1138
+ maxRenderMs: number;
1139
+ p95RenderMs: number;
1140
+ longRenderCount: number;
1141
+ renderedRows: number;
1142
+ renderedColumns: number;
1143
+ renderedCells: number;
1144
+ layoutSampleCount: number;
1145
+ p95LayoutMs: number;
1146
+ modelSampleCount: number;
1147
+ p95ModelMs: number;
1148
+ longTaskCount: number;
1149
+ longTaskTotalMs: number;
1150
+ usedHeapBytes: number | null;
1151
+ }
1152
+ interface GridUpdateSchedulerSnapshot {
1153
+ batchDepth: number;
1154
+ flushCount: number;
1155
+ requestCount: number;
1156
+ coalescedRequestCount: number;
1157
+ pending: boolean;
1158
+ }
1159
+ interface RemoteBlockCacheSnapshot {
1160
+ cachedBlockCount: number;
1161
+ loadingBlockCount: number;
1162
+ activeRequestCount: number;
1163
+ queuedRequestCount: number;
1164
+ cachedRowCount: number;
1165
+ hitCount: number;
1166
+ missCount: number;
1167
+ evictionCount: number;
1168
+ }
1169
+ interface GridAsyncOptions {
1170
+ signal?: AbortSignal;
1171
+ }
1172
+ interface RefreshCellsParams {
1173
+ /** Stable row identifiers. Omit together with rowIndexes to target every rendered row. */
1174
+ rowIds?: readonly string[];
1175
+ /** Displayed row indexes. Omit together with rowIds to target every rendered row. */
1176
+ rowIndexes?: readonly number[];
1177
+ /** Column IDs. Omit to target every rendered column in matching rows. */
1178
+ columns?: readonly string[];
1179
+ /** Bypasses renderer refresh hooks and recreates matching cell content. */
1180
+ force?: boolean;
1181
+ /** Also refreshes pinned rows. Defaults to true only for an unscoped refresh. */
1182
+ includePinned?: boolean;
1183
+ }
1184
+ interface ColumnWorkbenchItem {
1185
+ colId: string;
1186
+ label: string;
1187
+ visible: boolean;
1188
+ pinned: "left" | "right" | null;
1189
+ width: number;
1190
+ movable: boolean;
1191
+ hideable: boolean;
1192
+ }
1193
+ interface GridDiagnostics {
1194
+ gridId: number;
1195
+ version: string;
1196
+ destroyed: boolean;
1197
+ infinite: boolean;
1198
+ loading: boolean;
1199
+ rowCount: number;
1200
+ renderedRowCount: number;
1201
+ columnCount: number;
1202
+ selectedRowCount: number;
1203
+ dirtyRowCount: number;
1204
+ activeFeatures: ReadonlyArray<{
1205
+ key: string;
1206
+ version?: string;
1207
+ }>;
1208
+ performance: GridPerformanceSnapshot;
1209
+ updates: GridUpdateSchedulerSnapshot;
1210
+ recentErrors: readonly GridDiagnosticError[];
1211
+ }
1212
+ interface GridRowsApi<TData = any> {
1213
+ setData(rows: TData[] | null | undefined): void;
1214
+ transact(transaction: RowTransaction<TData>): void;
1215
+ transactAsync(transaction: RowTransaction<TData>, options?: GridAsyncOptions): Promise<void>;
1216
+ flushTransactions(): void;
1217
+ getCount(): number;
1218
+ getAt(index: number): RowNode<TData> | undefined;
1219
+ getById(id: string): RowNode<TData> | undefined;
1220
+ forEach(callback: (node: RowNode<TData>, index: number) => void): void;
1221
+ forEachDisplayed(callback: (node: RowNode<TData>, index: number) => void): void;
1222
+ reorder(fromIndex: number, toIndex: number): boolean;
1223
+ isRemote(): boolean;
1224
+ reload(options?: GridAsyncOptions): Promise<void>;
1225
+ ensureLoaded(startRow: number, endRow: number, options?: GridAsyncOptions): Promise<void>;
1226
+ purgeCache(): void;
1227
+ getCacheSnapshot(): RemoteBlockCacheSnapshot;
1228
+ }
1229
+ interface GridColumnsApi<TData = any> {
1230
+ getDefinitions(): (ColDef<TData> | ColDefGroup<TData>)[] | null;
1231
+ setDefinitions(definitions: (ColDef<TData> | ColDefGroup<TData>)[] | null | undefined): void;
1232
+ getState(): ColumnState[];
1233
+ setState(state: ColumnState[]): void;
1234
+ resetState(): void;
1235
+ setVisible(colId: string, visible: boolean): void;
1236
+ setPinned(colId: string, pinned: "left" | "right" | null): void;
1237
+ move(colId: string, toIndex: number): void;
1238
+ setWidth(colId: string, width: number): boolean;
1239
+ fit(width?: number): void;
1240
+ autoSize(colId: string, skipHeader?: boolean): void;
1241
+ autoSizeAll(skipHeader?: boolean): void;
1242
+ getWorkbenchItems(): ColumnWorkbenchItem[];
1243
+ openWorkbench(anchor?: HTMLElement): void;
1244
+ closeWorkbench(): void;
1245
+ }
1246
+ interface GridSelectionApi<TData = any> {
1247
+ getRows(): TData[];
1248
+ getVisibleRows(): TData[];
1249
+ getNodes(): RowNode<TData>[];
1250
+ getIds(): string[];
1251
+ setRows(rows: TData[], clearOthers?: boolean): void;
1252
+ setById(nodeId: string, selected?: boolean, clearOthers?: boolean): void;
1253
+ selectAll(filteredOnly?: boolean): void;
1254
+ clear(): void;
1255
+ getMode(): RowSelectionMode;
1256
+ setMode(mode: RowSelectionMode): void;
1257
+ getRange(): GridCellRange | null;
1258
+ clearRange(): void;
1259
+ }
1260
+ interface GridEditingApi<TData = any> {
1261
+ startCell(params: {
1262
+ rowIndex: number;
1263
+ colId: string;
1264
+ keyPress?: string;
1265
+ }): boolean;
1266
+ startRow(rowIndex: number): boolean;
1267
+ isRowActive(rowIndex?: number): boolean;
1268
+ stop(options?: {
1269
+ cancel?: boolean;
1270
+ }): Promise<boolean>;
1271
+ getChanges(): GridChange<TData>[];
1272
+ getDirtyRowIds(): string[];
1273
+ markSaved(rowIds?: readonly string[]): void;
1274
+ rollback(rowIds?: readonly string[]): boolean;
1275
+ save(handler: SaveChangesHandler<TData>, rowIds?: readonly string[]): Promise<GridBatchSaveResult<TData>>;
1276
+ undo(): boolean;
1277
+ redo(): boolean;
1278
+ canUndo(): boolean;
1279
+ canRedo(): boolean;
1280
+ }
1281
+ interface GridStateApi {
1282
+ get(): GridState;
1283
+ apply(state: GridStateInput, options?: ApplyGridStateOptions): void;
1284
+ }
1285
+ interface GridDiagnosticsApi {
1286
+ get(): GridDiagnostics;
1287
+ getPerformance(): GridPerformanceSnapshot;
1288
+ resetPerformance(): void;
1289
+ }
1290
+ /** Filtering owns filter state only; server requests remain in the host query layer. */
1291
+ interface GridFilteringApi {
1292
+ getModel(): FilterModel;
1293
+ setModel(model: FilterModel | null): void;
1294
+ getAdvancedModel(): AdvancedFilterModel | null;
1295
+ setAdvancedModel(model: AdvancedFilterModel | null): void;
1296
+ getQuickText(): string | null;
1297
+ setQuickText(text: string | null | undefined): void;
1298
+ isPresent(colId?: string): boolean;
1299
+ }
1300
+ interface GridPaginationApi {
1301
+ isEnabled(): boolean;
1302
+ setEnabled(enabled: boolean): void;
1303
+ getPage(): number;
1304
+ setPage(page: number): void;
1305
+ getPageSize(): number;
1306
+ setPageSize(size: number): void;
1307
+ getPageCount(): number;
1308
+ getTotalRowCount(): number;
1309
+ }
1310
+ interface GridSortingApi {
1311
+ getModel(): SortModel;
1312
+ setModel(model: SortModel | null): void;
1313
+ }
1314
+ interface GridHierarchyApi<TData = any> {
1315
+ isRowExpanded(rowId: string): boolean;
1316
+ setRowExpanded(rowId: string, expanded: boolean): boolean;
1317
+ isTreeRowLoading(rowId: string): boolean;
1318
+ loadTreeChildren(rowId: string, options?: {
1319
+ force?: boolean;
1320
+ }): Promise<readonly TData[]>;
1321
+ isGroupExpanded(groupId: string): boolean;
1322
+ setGroupExpanded(groupId: string, expanded: boolean): boolean;
1323
+ setAllGroupsExpanded(expanded: boolean): void;
1324
+ setAllDetailsExpanded(expanded: boolean): void;
1325
+ }
1326
+ interface GridViewApi<TData = any> {
1327
+ getRoot(): HTMLElement | null;
1328
+ scrollToRow(index: number, position?: "top" | "bottom" | "middle" | "nearest"): void;
1329
+ refreshCells(params?: RefreshCellsParams): void;
1330
+ refreshLayout(): void;
1331
+ flush(): void;
1332
+ setOverlay(type: "loading" | "noRows" | "error" | null): void;
1333
+ getPinnedRows(position: "top" | "bottom"): TData[];
1334
+ setPinnedRows(position: "top" | "bottom", rows: TData[] | null): void;
1335
+ }
1336
+ interface GridIoApi {
1337
+ exportCsv(params?: CsvExportParams): string;
1338
+ importCsv(text: string, options?: ImportCsvOptions): boolean;
1339
+ print(options?: PrintOptions): boolean;
1340
+ copyRange(): Promise<boolean>;
1341
+ }
1342
+ interface SaveChangeIssue {
1343
+ rowId: string;
1344
+ code?: string;
1345
+ message: string;
1346
+ colIds?: readonly string[];
1347
+ retryable?: boolean;
1348
+ }
1349
+ interface SaveChangeConflict<TData = any> extends SaveChangeIssue {
1350
+ serverData?: TData;
1351
+ serverVersion?: string | number;
1352
+ }
1353
+ interface SaveChangesResult<TData = any> {
1354
+ /** Omit to acknowledge every submitted row; return a subset for partial batch success. */
1355
+ savedRowIds?: readonly string[];
1356
+ failures?: readonly SaveChangeIssue[];
1357
+ conflicts?: readonly SaveChangeConflict<TData>[];
1358
+ }
1359
+ interface GridBatchSaveResult<TData = any> {
1360
+ submitted: GridChange<TData>[];
1361
+ saved: GridChange<TData>[];
1362
+ failures: SaveChangeIssue[];
1363
+ conflicts: SaveChangeConflict<TData>[];
1364
+ }
1365
+ type SaveChangesHandler<TData = any> = (changes: readonly GridChange<TData>[]) => void | SaveChangesResult<TData> | Promise<void | SaveChangesResult<TData>>;
1366
+ interface GridApi<TData = any> {
1367
+ readonly rows: GridRowsApi<TData>;
1368
+ readonly columns: GridColumnsApi<TData>;
1369
+ readonly selection: GridSelectionApi<TData>;
1370
+ readonly editing: GridEditingApi<TData>;
1371
+ readonly filtering: GridFilteringApi;
1372
+ readonly sorting: GridSortingApi;
1373
+ readonly pagination: GridPaginationApi;
1374
+ readonly hierarchy: GridHierarchyApi<TData>;
1375
+ readonly view: GridViewApi<TData>;
1376
+ readonly state: GridStateApi;
1377
+ readonly io: GridIoApi;
1378
+ readonly diagnostics: GridDiagnosticsApi;
1379
+ /** Coalesces model/layout/render work from nested synchronous API calls. */
1380
+ batch<TResult>(callback: (api: GridApi<TData>) => TResult): TResult;
1381
+ /** Resolves after the first layout frame and gridReady emission. */
1382
+ whenReady(): Promise<GridApi<TData>>;
1383
+ /** Reads the currently resolved value after application, preset and table overrides. */
1384
+ getOption<K extends keyof GridOptions<TData>>(key: K): GridOptions<TData>[K];
1385
+ updateOptions(options: Partial<GridOptions<TData>>): void;
1386
+ on<K extends GridEventType>(eventType: K, listener: (event: GridEventMap<TData>[K]) => void): () => void;
1387
+ destroy(): void;
1388
+ isDestroyed(): boolean;
1389
+ }
1390
+
1391
+ export { DEFAULT_LOCALE as $, type AdvancedFilterModel as A, type CellAlign as B, type ColDef as C, type CellClassParams as D, type CellClassRule as E, type FilterType as F, type GridFeature as G, type CellClickEvent as H, type CellContextMenuEvent as I, type CellDoubleClickEvent as J, type CellEditingStartedEvent as K, type CellEditingStoppedEvent as L, type CellEditorFactory as M, type CellEditorParams as N, type CellRendererOutput as O, type CellStyleRule as P, type CellValueChangedEvent as Q, type ColDefOrGroup as R, type SortModel as S, type ColumnLayoutMode as T, type ColumnMovedEvent as U, type ColumnResizedEvent as V, type ColumnVisibilityChangedEvent as W, type ColumnWorkbenchItem as X, type ContextMenuItem as Y, type ContextMenuParams as Z, type CsvExportParams as _, type GridCellRange as a, type PrintOptions as a$, type DatasourceMode as a0, type DateFilterCondition as a1, type DateFilterMatch as a2, type DetailRowRendererParams as a3, type DetailToggledEvent as a4, type DirtyStateChangedEvent as a5, type DomLayoutMode as a6, EVENT_TYPES as a7, type EditableIndicator as a8, type EditableParams as a9, type GridPaginationApi as aA, type GridPerformanceSnapshot as aB, type GridPersistenceOptions as aC, type GridReadyEvent as aD, type GridRowsApi as aE, type GridSelectionApi as aF, type GridSortingApi as aG, type GridStateApi as aH, type GridStateSection as aI, type GridUpdateSchedulerSnapshot as aJ, type GridViewApi as aK, type HeaderComponentParams as aL, type ICellEditor as aM, type ICellRendererResult as aN, type ImportCsvOptions as aO, type InfiniteGetRowsParams as aP, LOCALE_EN as aQ, type MachTableLocale as aR, type MachTableLocaleKey as aS, type ModelUpdatedEvent as aT, type NumberFilterCondition as aU, type NumberFilterMatch as aV, type OverlayContent as aW, type OverlayTemplate as aX, type PaginationChangedEvent as aY, type PaginationConfig as aZ, type PinnedDirection as a_, type EventHandlers as aa, type FilterChangedEvent as ab, type GetRowHeightParams as ac, type GridAsyncOptions as ad, type GridBatchSaveResult as ae, type GridCellChange as af, type GridColumnsApi as ag, type GridDataProcessor as ah, type GridDataProcessorColumn as ai, type GridDataProcessorRequest as aj, type GridDataProcessorResult as ak, type GridDataProcessorRow as al, type GridDatasource as am, type GridDiagnosticError as an, type GridDiagnostics as ao, type GridDiagnosticsApi as ap, type GridEditType as aq, type GridEditingApi as ar, type GridErrorCode as as, type GridErrorEvent as at, type GridEventBase as au, type GridEventMap as av, type GridFeatureContext as aw, type GridFilteringApi as ax, type GridHierarchyApi as ay, type GridIoApi as az, type GridApi as b, type RangeSelectionChangedEvent as b0, type RefreshCellsParams as b1, type RemoteBlockCacheSnapshot as b2, type ResolvedGridOptions as b3, type RowClickEvent as b4, type RowDragEndEvent as b5, type RowDragIntent as b6, type RowDragPolicy as b7, type RowEditChange as b8, type RowEditValidationParams as b9, type TreeChildrenLoadedEvent as bA, type TreeDataLoadParams as bB, type ValueFormatterParams as bC, type ValueGetterParams as bD, type ValueSetterParams as bE, type WatermarkConfig as bF, formatText as bG, formatTwo as bH, isColDefGroup as bI, matchLocaleKey as bJ, type RowEditValidationResult as ba, type RowEditingStartedEvent as bb, type RowEditingStoppedEvent as bc, type RowNode as bd, type RowSelectionMode as be, type RowStyleParams as bf, type RowStyleRule as bg, type RowTone as bh, type RowTransaction as bi, type SaveChangeIssue as bj, type SaveChangesResult as bk, type SelectEditorOption as bl, type SelectEditorParams as bm, type SelectionChangedEvent as bn, type SetFilterCondition as bo, type SetFilterParams as bp, type SortChangedEvent as bq, type SortDirection as br, type SortModelItem as bs, type StatusBarConfig as bt, type StatusBarPanel as bu, type TextFilterCondition as bv, type TextFilterMatch as bw, type ThemeMode as bx, type TooltipParams as by, type TreeChildrenLoadFailedEvent as bz, type GridOptions as c, type GridComponents as d, type GridEventType as e, type GridState as f, type GridStateStore as g, type FilterModel as h, type FieldPath as i, type SaveChangesHandler as j, type ColumnFilter as k, type AdvancedFilterCondition as l, type AdvancedFilterNode as m, type AdvancedFilterGroup as n, type ColDefGroup as o, type GridStateInput as p, type GridSize as q, type CellRendererParams as r, type GridChange as s, type CellRendererFn as t, type FieldPathValue as u, type SaveChangeConflict as v, type ColumnState as w, type ActionPolicy as x, type ActionPolicyContext as y, type ApplyGridStateOptions as z };