@agile-team/mach-table 0.4.1 → 0.13.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.
- package/LICENSE +110 -21
- package/README.md +46 -2
- package/dist/index.cjs +6 -8873
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +628 -55
- package/dist/index.d.ts +628 -55
- package/dist/index.js +6 -8795
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/styles/mach-table.css +410 -3
package/dist/index.d.ts
CHANGED
|
@@ -39,25 +39,30 @@ interface RowNode<TData = any> {
|
|
|
39
39
|
groupKey?: string;
|
|
40
40
|
leafNodes?: RowNode<TData>[];
|
|
41
41
|
aggValues?: Record<string, any>;
|
|
42
|
+
/** Lazy tree request state. These fields are read-only from application code. */
|
|
43
|
+
treeLoading?: boolean;
|
|
44
|
+
treeChildrenLoaded?: boolean;
|
|
45
|
+
treeLoadError?: unknown;
|
|
42
46
|
}
|
|
43
47
|
|
|
44
|
-
declare const EVENT_TYPES: readonly ["gridReady", "gridDestroyed", "modelUpdated", "cellClicked", "cellDoubleClicked", "cellContextMenu", "rowClicked", "rowDoubleClicked", "selectionChanged", "sortChanged", "filterChanged", "columnResized", "columnMoved", "columnVisibilityChanged", "cellValueChanged", "cellEditingStarted", "cellEditingStopped", "detailToggled", "rowDragEnd", "rangeSelectionChanged", "paginationChanged", "displayedColumnsChanged", "gridError"];
|
|
48
|
+
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"];
|
|
45
49
|
type GridEventType = (typeof EVENT_TYPES)[number];
|
|
46
|
-
|
|
50
|
+
type GridErrorCode = "DATA_SOURCE_ERROR" | "DATA_INTEGRITY_ERROR" | "VALIDATION_ERROR" | "RENDERER_ERROR" | "EDITOR_ERROR" | "FEATURE_ERROR" | "STATE_ERROR" | "EVENT_HANDLER_ERROR" | "GRID_ERROR";
|
|
51
|
+
interface GridEventBase<TData = any> {
|
|
47
52
|
type: GridEventType;
|
|
48
|
-
api: GridApi<
|
|
53
|
+
api: GridApi<TData>;
|
|
49
54
|
}
|
|
50
|
-
interface GridReadyEvent extends GridEventBase {
|
|
55
|
+
interface GridReadyEvent<TData = any> extends GridEventBase<TData> {
|
|
51
56
|
type: "gridReady";
|
|
52
57
|
}
|
|
53
|
-
interface GridDestroyedEvent extends GridEventBase {
|
|
58
|
+
interface GridDestroyedEvent<TData = any> extends GridEventBase<TData> {
|
|
54
59
|
type: "gridDestroyed";
|
|
55
60
|
}
|
|
56
|
-
interface ModelUpdatedEvent extends GridEventBase {
|
|
61
|
+
interface ModelUpdatedEvent<TData = any> extends GridEventBase<TData> {
|
|
57
62
|
type: "modelUpdated";
|
|
58
63
|
rowCount: number;
|
|
59
64
|
}
|
|
60
|
-
interface CellClickEvent<TData = any, TValue = any> extends GridEventBase {
|
|
65
|
+
interface CellClickEvent<TData = any, TValue = any> extends GridEventBase<TData> {
|
|
61
66
|
type: "cellClicked";
|
|
62
67
|
event: MouseEvent;
|
|
63
68
|
rowNode: RowNode<TData>;
|
|
@@ -66,7 +71,7 @@ interface CellClickEvent<TData = any, TValue = any> extends GridEventBase {
|
|
|
66
71
|
colDef: ColDef<TData, TValue>;
|
|
67
72
|
value: TValue;
|
|
68
73
|
}
|
|
69
|
-
interface CellDoubleClickEvent<TData = any, TValue = any> extends GridEventBase {
|
|
74
|
+
interface CellDoubleClickEvent<TData = any, TValue = any> extends GridEventBase<TData> {
|
|
70
75
|
type: "cellDoubleClicked";
|
|
71
76
|
event: MouseEvent;
|
|
72
77
|
rowNode: RowNode<TData>;
|
|
@@ -75,7 +80,7 @@ interface CellDoubleClickEvent<TData = any, TValue = any> extends GridEventBase
|
|
|
75
80
|
colDef: ColDef<TData, TValue>;
|
|
76
81
|
value: TValue;
|
|
77
82
|
}
|
|
78
|
-
interface CellContextMenuEvent<TData = any, TValue = any> extends GridEventBase {
|
|
83
|
+
interface CellContextMenuEvent<TData = any, TValue = any> extends GridEventBase<TData> {
|
|
79
84
|
type: "cellContextMenu";
|
|
80
85
|
event: MouseEvent;
|
|
81
86
|
rowNode: RowNode<TData>;
|
|
@@ -84,42 +89,42 @@ interface CellContextMenuEvent<TData = any, TValue = any> extends GridEventBase
|
|
|
84
89
|
colDef: ColDef<TData, TValue>;
|
|
85
90
|
value: TValue;
|
|
86
91
|
}
|
|
87
|
-
interface RowClickEvent<TData = any> extends GridEventBase {
|
|
92
|
+
interface RowClickEvent<TData = any> extends GridEventBase<TData> {
|
|
88
93
|
type: "rowClicked" | "rowDoubleClicked";
|
|
89
94
|
event: MouseEvent;
|
|
90
95
|
rowNode: RowNode<TData>;
|
|
91
96
|
rowIndex: number;
|
|
92
97
|
}
|
|
93
|
-
interface SelectionChangedEvent<TData = any> extends GridEventBase {
|
|
98
|
+
interface SelectionChangedEvent<TData = any> extends GridEventBase<TData> {
|
|
94
99
|
type: "selectionChanged";
|
|
95
100
|
selectedNodes: RowNode<TData>[];
|
|
96
101
|
selectedRows: TData[];
|
|
97
102
|
}
|
|
98
|
-
interface SortChangedEvent extends GridEventBase {
|
|
103
|
+
interface SortChangedEvent<TData = any> extends GridEventBase<TData> {
|
|
99
104
|
type: "sortChanged";
|
|
100
105
|
sortModel: SortModel;
|
|
101
106
|
}
|
|
102
|
-
interface FilterChangedEvent extends GridEventBase {
|
|
107
|
+
interface FilterChangedEvent<TData = any> extends GridEventBase<TData> {
|
|
103
108
|
type: "filterChanged";
|
|
104
109
|
filterModel: FilterModel;
|
|
105
110
|
}
|
|
106
|
-
interface ColumnResizedEvent extends GridEventBase {
|
|
111
|
+
interface ColumnResizedEvent<TData = any> extends GridEventBase<TData> {
|
|
107
112
|
type: "columnResized";
|
|
108
113
|
colId: string;
|
|
109
114
|
width: number;
|
|
110
115
|
finished: boolean;
|
|
111
116
|
}
|
|
112
|
-
interface ColumnMovedEvent extends GridEventBase {
|
|
117
|
+
interface ColumnMovedEvent<TData = any> extends GridEventBase<TData> {
|
|
113
118
|
type: "columnMoved";
|
|
114
119
|
colId: string;
|
|
115
120
|
toIndex: number;
|
|
116
121
|
}
|
|
117
|
-
interface ColumnVisibilityChangedEvent extends GridEventBase {
|
|
122
|
+
interface ColumnVisibilityChangedEvent<TData = any> extends GridEventBase<TData> {
|
|
118
123
|
type: "columnVisibilityChanged";
|
|
119
124
|
colId: string;
|
|
120
125
|
visible: boolean;
|
|
121
126
|
}
|
|
122
|
-
interface CellValueChangedEvent<TData = any, TValue = any> extends GridEventBase {
|
|
127
|
+
interface CellValueChangedEvent<TData = any, TValue = any> extends GridEventBase<TData> {
|
|
123
128
|
type: "cellValueChanged";
|
|
124
129
|
oldValue: TValue;
|
|
125
130
|
newValue: TValue;
|
|
@@ -129,13 +134,13 @@ interface CellValueChangedEvent<TData = any, TValue = any> extends GridEventBase
|
|
|
129
134
|
colDef: ColDef<TData, TValue>;
|
|
130
135
|
data: TData;
|
|
131
136
|
}
|
|
132
|
-
interface CellEditingStartedEvent<TData = any> extends GridEventBase {
|
|
137
|
+
interface CellEditingStartedEvent<TData = any> extends GridEventBase<TData> {
|
|
133
138
|
type: "cellEditingStarted";
|
|
134
139
|
rowIndex: number;
|
|
135
140
|
colId: string;
|
|
136
141
|
rowNode: RowNode<TData>;
|
|
137
142
|
}
|
|
138
|
-
interface CellEditingStoppedEvent<TData = any> extends GridEventBase {
|
|
143
|
+
interface CellEditingStoppedEvent<TData = any> extends GridEventBase<TData> {
|
|
139
144
|
type: "cellEditingStopped";
|
|
140
145
|
rowIndex: number;
|
|
141
146
|
colId: string;
|
|
@@ -143,68 +148,109 @@ interface CellEditingStoppedEvent<TData = any> extends GridEventBase {
|
|
|
143
148
|
oldValue: any;
|
|
144
149
|
newValue: any;
|
|
145
150
|
}
|
|
146
|
-
interface
|
|
151
|
+
interface RowEditChange {
|
|
152
|
+
colId: string;
|
|
153
|
+
oldValue: unknown;
|
|
154
|
+
newValue: unknown;
|
|
155
|
+
}
|
|
156
|
+
interface RowEditingStartedEvent<TData = any> extends GridEventBase<TData> {
|
|
157
|
+
type: "rowEditingStarted";
|
|
158
|
+
rowIndex: number;
|
|
159
|
+
rowNode: RowNode<TData>;
|
|
160
|
+
data: TData;
|
|
161
|
+
}
|
|
162
|
+
interface RowEditingStoppedEvent<TData = any> extends GridEventBase<TData> {
|
|
163
|
+
type: "rowEditingStopped";
|
|
164
|
+
rowIndex: number;
|
|
165
|
+
rowNode: RowNode<TData>;
|
|
166
|
+
data: TData;
|
|
167
|
+
cancelled: boolean;
|
|
168
|
+
changes: RowEditChange[];
|
|
169
|
+
}
|
|
170
|
+
interface DetailToggledEvent<TData = any> extends GridEventBase<TData> {
|
|
147
171
|
type: "detailToggled";
|
|
148
172
|
rowId: string;
|
|
149
173
|
rowNode: RowNode<TData>;
|
|
150
174
|
expanded: boolean;
|
|
151
175
|
}
|
|
176
|
+
interface TreeChildrenLoadedEvent<TData = any> extends GridEventBase<TData> {
|
|
177
|
+
type: "treeChildrenLoaded";
|
|
178
|
+
rowId: string;
|
|
179
|
+
rowNode: RowNode<TData>;
|
|
180
|
+
children: readonly TData[];
|
|
181
|
+
}
|
|
182
|
+
interface TreeChildrenLoadFailedEvent<TData = any> extends GridEventBase<TData> {
|
|
183
|
+
type: "treeChildrenLoadFailed";
|
|
184
|
+
rowId: string;
|
|
185
|
+
rowNode: RowNode<TData>;
|
|
186
|
+
error: unknown;
|
|
187
|
+
}
|
|
152
188
|
interface GridCellRange {
|
|
153
189
|
row1: number;
|
|
154
190
|
row2: number;
|
|
155
191
|
colId1: string;
|
|
156
192
|
colId2: string;
|
|
157
193
|
}
|
|
158
|
-
interface RangeSelectionChangedEvent extends GridEventBase {
|
|
194
|
+
interface RangeSelectionChangedEvent<TData = any> extends GridEventBase<TData> {
|
|
159
195
|
type: "rangeSelectionChanged";
|
|
160
196
|
range: GridCellRange | null;
|
|
161
197
|
}
|
|
162
|
-
interface RowDragEndEvent<TData = any> extends GridEventBase {
|
|
198
|
+
interface RowDragEndEvent<TData = any> extends GridEventBase<TData> {
|
|
163
199
|
type: "rowDragEnd";
|
|
164
200
|
rowNode: RowNode<TData>;
|
|
165
201
|
fromIndex: number;
|
|
166
202
|
toIndex: number;
|
|
167
203
|
}
|
|
168
|
-
interface PaginationChangedEvent extends GridEventBase {
|
|
204
|
+
interface PaginationChangedEvent<TData = any> extends GridEventBase<TData> {
|
|
169
205
|
type: "paginationChanged";
|
|
170
206
|
page: number;
|
|
171
207
|
pageSize: number;
|
|
172
208
|
pageCount: number;
|
|
173
209
|
total: number;
|
|
174
210
|
}
|
|
175
|
-
interface DisplayedColumnsChangedEvent extends GridEventBase {
|
|
211
|
+
interface DisplayedColumnsChangedEvent<TData = any> extends GridEventBase<TData> {
|
|
176
212
|
type: "displayedColumnsChanged";
|
|
177
213
|
}
|
|
178
|
-
interface GridErrorEvent extends GridEventBase {
|
|
214
|
+
interface GridErrorEvent<TData = any> extends GridEventBase<TData> {
|
|
179
215
|
type: "gridError";
|
|
216
|
+
code: GridErrorCode;
|
|
180
217
|
error: unknown;
|
|
181
218
|
source: string;
|
|
182
219
|
context?: Record<string, unknown>;
|
|
183
220
|
}
|
|
221
|
+
interface DirtyStateChangedEvent<TData = any> extends GridEventBase<TData> {
|
|
222
|
+
type: "dirtyStateChanged";
|
|
223
|
+
dirtyRowIds: string[];
|
|
224
|
+
}
|
|
184
225
|
interface GridEventMap<TData = any> {
|
|
185
|
-
gridReady: GridReadyEvent
|
|
186
|
-
gridDestroyed: GridDestroyedEvent
|
|
187
|
-
modelUpdated: ModelUpdatedEvent
|
|
226
|
+
gridReady: GridReadyEvent<TData>;
|
|
227
|
+
gridDestroyed: GridDestroyedEvent<TData>;
|
|
228
|
+
modelUpdated: ModelUpdatedEvent<TData>;
|
|
188
229
|
cellClicked: CellClickEvent<TData>;
|
|
189
230
|
cellDoubleClicked: CellDoubleClickEvent<TData>;
|
|
190
231
|
cellContextMenu: CellContextMenuEvent<TData>;
|
|
191
232
|
rowClicked: RowClickEvent<TData>;
|
|
192
233
|
rowDoubleClicked: RowClickEvent<TData>;
|
|
193
234
|
selectionChanged: SelectionChangedEvent<TData>;
|
|
194
|
-
sortChanged: SortChangedEvent
|
|
195
|
-
filterChanged: FilterChangedEvent
|
|
196
|
-
columnResized: ColumnResizedEvent
|
|
197
|
-
columnMoved: ColumnMovedEvent
|
|
198
|
-
columnVisibilityChanged: ColumnVisibilityChangedEvent
|
|
235
|
+
sortChanged: SortChangedEvent<TData>;
|
|
236
|
+
filterChanged: FilterChangedEvent<TData>;
|
|
237
|
+
columnResized: ColumnResizedEvent<TData>;
|
|
238
|
+
columnMoved: ColumnMovedEvent<TData>;
|
|
239
|
+
columnVisibilityChanged: ColumnVisibilityChangedEvent<TData>;
|
|
199
240
|
cellValueChanged: CellValueChangedEvent<TData>;
|
|
200
241
|
cellEditingStarted: CellEditingStartedEvent<TData>;
|
|
201
242
|
cellEditingStopped: CellEditingStoppedEvent<TData>;
|
|
243
|
+
rowEditingStarted: RowEditingStartedEvent<TData>;
|
|
244
|
+
rowEditingStopped: RowEditingStoppedEvent<TData>;
|
|
202
245
|
detailToggled: DetailToggledEvent<TData>;
|
|
246
|
+
treeChildrenLoaded: TreeChildrenLoadedEvent<TData>;
|
|
247
|
+
treeChildrenLoadFailed: TreeChildrenLoadFailedEvent<TData>;
|
|
203
248
|
rowDragEnd: RowDragEndEvent<TData>;
|
|
204
|
-
rangeSelectionChanged: RangeSelectionChangedEvent
|
|
205
|
-
paginationChanged: PaginationChangedEvent
|
|
206
|
-
displayedColumnsChanged: DisplayedColumnsChangedEvent
|
|
207
|
-
gridError: GridErrorEvent
|
|
249
|
+
rangeSelectionChanged: RangeSelectionChangedEvent<TData>;
|
|
250
|
+
paginationChanged: PaginationChangedEvent<TData>;
|
|
251
|
+
displayedColumnsChanged: DisplayedColumnsChangedEvent<TData>;
|
|
252
|
+
gridError: GridErrorEvent<TData>;
|
|
253
|
+
dirtyStateChanged: DirtyStateChangedEvent<TData>;
|
|
208
254
|
}
|
|
209
255
|
|
|
210
256
|
declare const DEFAULT_LOCALE: {
|
|
@@ -265,6 +311,31 @@ declare function matchLocaleKey(match: string): RgLocaleKey;
|
|
|
265
311
|
declare function formatText(template: string, n: number | string): string;
|
|
266
312
|
declare function formatTwo(template: string, a: number | string, b: number | string): string;
|
|
267
313
|
|
|
314
|
+
/** Serializable snapshot of user-visible grid state. */
|
|
315
|
+
interface GridState {
|
|
316
|
+
/** State schema version, independent from the package version. */
|
|
317
|
+
version: 1;
|
|
318
|
+
columns: ColumnState[];
|
|
319
|
+
sortModel: SortModel;
|
|
320
|
+
filterModel: FilterModel;
|
|
321
|
+
quickFilterText: string | null;
|
|
322
|
+
pagination: {
|
|
323
|
+
enabled: boolean;
|
|
324
|
+
page: number;
|
|
325
|
+
pageSize: number;
|
|
326
|
+
};
|
|
327
|
+
selectedRowIds: string[];
|
|
328
|
+
expandedRowIds: string[];
|
|
329
|
+
expandedGroupIds: string[];
|
|
330
|
+
}
|
|
331
|
+
type GridStateSection = "columns" | "sort" | "filter" | "pagination" | "selection" | "expansion";
|
|
332
|
+
interface ApplyGridStateOptions {
|
|
333
|
+
/** Applies all sections when omitted. */
|
|
334
|
+
sections?: readonly GridStateSection[];
|
|
335
|
+
/** Emit the standard sort/filter/pagination events after restoration. */
|
|
336
|
+
emitEvents?: boolean;
|
|
337
|
+
}
|
|
338
|
+
|
|
268
339
|
interface ColumnStateStore {
|
|
269
340
|
load(key: string): ColumnState[] | null | Promise<ColumnState[] | null>;
|
|
270
341
|
save(key: string, state: ColumnState[]): void | Promise<void>;
|
|
@@ -279,6 +350,11 @@ interface GridFeatureContext<TData = any> {
|
|
|
279
350
|
readonly root: HTMLElement;
|
|
280
351
|
getOptions(): Readonly<ResolvedGridOptions<TData>>;
|
|
281
352
|
addEventListener<K extends keyof GridEventMap<TData>>(type: K, listener: (event: GridEventMap<TData>[K]) => void): () => void;
|
|
353
|
+
/** Registers cleanup even when setup later throws or the feature is hot-replaced. */
|
|
354
|
+
onCleanup(cleanup: () => void): void;
|
|
355
|
+
addManagedDomListener(target: EventTarget, type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
356
|
+
setManagedTimeout(handler: () => void, delayMs: number): ReturnType<typeof setTimeout>;
|
|
357
|
+
createAbortController(): AbortController;
|
|
282
358
|
reportError(error: unknown, source: string, context?: Record<string, unknown>): void;
|
|
283
359
|
}
|
|
284
360
|
/** Composable extension point; feature instances are scoped to one grid. */
|
|
@@ -291,7 +367,8 @@ interface GridFeature<TData = any> {
|
|
|
291
367
|
* Safe overlay content. Strings render as text unless
|
|
292
368
|
* `allowUnsafeOverlayHtml` is explicitly enabled.
|
|
293
369
|
*/
|
|
294
|
-
type
|
|
370
|
+
type OverlayContent = string | HTMLElement | ICellRendererResult;
|
|
371
|
+
type OverlayTemplate = OverlayContent | (() => OverlayContent);
|
|
295
372
|
type StatusBarPanel = "rowCount" | "selectedRowCount" | "rangeAggregate";
|
|
296
373
|
interface StatusBarConfig {
|
|
297
374
|
panels?: StatusBarPanel[];
|
|
@@ -314,13 +391,37 @@ type EventHandlers<TData = any> = {
|
|
|
314
391
|
};
|
|
315
392
|
type RowSelectionMode = "none" | "single" | "multiple";
|
|
316
393
|
type GridSize = "compact" | "normal" | "large";
|
|
394
|
+
type ColumnLayoutMode = "normal" | "fit";
|
|
317
395
|
type ThemeMode = "light" | "dark" | "auto";
|
|
396
|
+
type GridEditType = "cell" | "fullRow";
|
|
397
|
+
type EditableIndicator = "hover" | "always" | "none";
|
|
398
|
+
interface RowEditValidationParams<TData = any> {
|
|
399
|
+
data: TData;
|
|
400
|
+
node: RowNode<TData>;
|
|
401
|
+
/** Draft values keyed by colId, including unchanged editable cells. */
|
|
402
|
+
values: Readonly<Record<string, unknown>>;
|
|
403
|
+
changes: readonly RowEditChange[];
|
|
404
|
+
api: GridApi<TData>;
|
|
405
|
+
}
|
|
406
|
+
type RowEditValidationResult = true | null | undefined | string | Readonly<Record<string, string>>;
|
|
318
407
|
interface DetailRowRendererParams<TData = any> {
|
|
319
408
|
data: TData | null;
|
|
320
409
|
node: RowNode<TData>;
|
|
321
410
|
api: GridApi<TData>;
|
|
322
411
|
}
|
|
412
|
+
interface TreeDataLoadParams<TData = any> {
|
|
413
|
+
data: TData;
|
|
414
|
+
node: RowNode<TData>;
|
|
415
|
+
api: GridApi<TData>;
|
|
416
|
+
signal: AbortSignal;
|
|
417
|
+
}
|
|
323
418
|
interface PaginationConfig {
|
|
419
|
+
/** `server` displays the supplied page as-is and uses `total` for navigation. */
|
|
420
|
+
mode?: "client" | "server";
|
|
421
|
+
/** Controlled current page for server mode. */
|
|
422
|
+
page?: number;
|
|
423
|
+
/** Total rows across all server pages. */
|
|
424
|
+
total?: number;
|
|
324
425
|
pageSize?: number;
|
|
325
426
|
pageSizeOptions?: number[];
|
|
326
427
|
showTotal?: boolean;
|
|
@@ -334,14 +435,34 @@ interface WatermarkConfig {
|
|
|
334
435
|
gap?: number;
|
|
335
436
|
angle?: number;
|
|
336
437
|
}
|
|
438
|
+
interface ActionPolicyContext<TData = any> {
|
|
439
|
+
/** Stable business action identifier, for example `order.delete`. */
|
|
440
|
+
actionId?: string;
|
|
441
|
+
permissions: readonly string[];
|
|
442
|
+
message?: string;
|
|
443
|
+
params: CellRendererParams<TData>;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Application-wide UI action policy. This centralises permission, confirmation
|
|
447
|
+
* and error handling while the backend remains the final security boundary.
|
|
448
|
+
*/
|
|
449
|
+
interface ActionPolicy<TData = any> {
|
|
450
|
+
canAccess?(context: ActionPolicyContext<TData>): boolean;
|
|
451
|
+
confirm?(context: ActionPolicyContext<TData>): boolean | Promise<boolean>;
|
|
452
|
+
onError?(error: unknown, context: ActionPolicyContext<TData>): void;
|
|
453
|
+
}
|
|
337
454
|
interface GridOptions<TData = any> extends EventHandlers<TData> {
|
|
338
455
|
columnDefs?: (ColDef<TData> | ColDefGroup<TData>)[] | null;
|
|
339
456
|
rowData?: TData[] | null;
|
|
340
457
|
defaultColDef?: Partial<ColDef<TData>>;
|
|
458
|
+
/** Reusable semantic column definitions referenced through `colDef.type`. */
|
|
459
|
+
columnTypes?: Readonly<Record<string, Partial<ColDef<TData>>>>;
|
|
341
460
|
getRowId?: (params: GetRowIdParams<TData>) => string;
|
|
342
461
|
rowHeight?: number;
|
|
343
462
|
headerHeight?: number;
|
|
344
463
|
rowBuffer?: number;
|
|
464
|
+
/** `fit` continuously fills the container without grid-ready glue code. */
|
|
465
|
+
columnLayout?: ColumnLayoutMode;
|
|
345
466
|
rowSelection?: RowSelectionMode;
|
|
346
467
|
multiSort?: boolean;
|
|
347
468
|
size?: GridSize;
|
|
@@ -359,8 +480,18 @@ interface GridOptions<TData = any> extends EventHandlers<TData> {
|
|
|
359
480
|
columnStateStore?: ColumnStateStore;
|
|
360
481
|
aggFuncs?: Record<string, (values: any[]) => any>;
|
|
361
482
|
components?: GridComponents;
|
|
483
|
+
/** Shared policy consumed by action column helpers. */
|
|
484
|
+
actionPolicy?: ActionPolicy<TData>;
|
|
362
485
|
features?: readonly GridFeature<TData>[];
|
|
486
|
+
/** State restored atomically after columns and initial rows are available. */
|
|
487
|
+
initialState?: GridState;
|
|
363
488
|
locale?: RgLocale;
|
|
489
|
+
/** Cell editing is isolated; fullRow stages every editable cell and commits them together. */
|
|
490
|
+
editType?: GridEditType;
|
|
491
|
+
/** Visibility of the subtle pencil affordance on editable cells. */
|
|
492
|
+
editableIndicator?: EditableIndicator;
|
|
493
|
+
/** Cross-field full-row validation. Return a message or a colId -> message map. */
|
|
494
|
+
rowEditValidator?: (params: RowEditValidationParams<TData>) => RowEditValidationResult | Promise<RowEditValidationResult>;
|
|
364
495
|
singleClickEdit?: boolean;
|
|
365
496
|
manualSorting?: boolean;
|
|
366
497
|
manualFiltering?: boolean;
|
|
@@ -372,11 +503,17 @@ interface GridOptions<TData = any> extends EventHandlers<TData> {
|
|
|
372
503
|
}) => string;
|
|
373
504
|
treeData?: boolean;
|
|
374
505
|
childrenKey?: string;
|
|
506
|
+
/** Marks rows that can load children even when `childrenKey` is currently empty. */
|
|
507
|
+
isTreeRowExpandable?: (params: Omit<TreeDataLoadParams<TData>, "signal">) => boolean;
|
|
508
|
+
/** Loads children once on first expansion; use the API retry/force methods to reload. */
|
|
509
|
+
loadTreeChildren?: (params: TreeDataLoadParams<TData>) => Promise<readonly TData[]>;
|
|
375
510
|
autoCheckedChildren?: boolean;
|
|
376
511
|
defaultExpandAll?: boolean;
|
|
377
512
|
indexOffset?: number;
|
|
378
513
|
applyRowDrag?: boolean;
|
|
379
514
|
undoStackSize?: number;
|
|
515
|
+
/** Milliseconds used to coalesce applyTransactionAsync calls. */
|
|
516
|
+
asyncTransactionWaitMillis?: number;
|
|
380
517
|
getRowHeight?: (params: GetRowHeightParams<TData>) => number;
|
|
381
518
|
pinnedTopRowData?: TData[] | null;
|
|
382
519
|
pinnedBottomRowData?: TData[] | null;
|
|
@@ -395,10 +532,20 @@ interface GridOptions<TData = any> extends EventHandlers<TData> {
|
|
|
395
532
|
datasource?: GridDatasource<TData>;
|
|
396
533
|
blockSize?: number;
|
|
397
534
|
infiniteBufferRows?: number;
|
|
535
|
+
/** Number of automatic retries after an infinite datasource request fails. */
|
|
536
|
+
datasourceRetryCount?: number;
|
|
537
|
+
/** Base retry delay in milliseconds. Retries use capped exponential backoff. */
|
|
538
|
+
datasourceRetryDelay?: number;
|
|
398
539
|
suppressCellFocus?: boolean;
|
|
399
540
|
suppressRowHoverHighlight?: boolean;
|
|
400
541
|
suppressNoRowsOverlay?: boolean;
|
|
401
542
|
suppressHeaderFocus?: boolean;
|
|
543
|
+
/** Accessible name applied to the element with role="grid"/"treegrid". */
|
|
544
|
+
ariaLabel?: string;
|
|
545
|
+
/** ID of an external element that labels the grid. Takes precedence over ariaLabel. */
|
|
546
|
+
ariaLabelledBy?: string;
|
|
547
|
+
/** ID of an external element that provides additional grid instructions. */
|
|
548
|
+
ariaDescribedBy?: string;
|
|
402
549
|
loading?: boolean;
|
|
403
550
|
overlayNoRowsTemplate?: OverlayTemplate;
|
|
404
551
|
overlayLoadingTemplate?: OverlayTemplate;
|
|
@@ -410,10 +557,12 @@ interface ResolvedGridOptions<TData = any> extends EventHandlers<TData> {
|
|
|
410
557
|
columnDefs: (ColDef<TData> | ColDefGroup<TData>)[];
|
|
411
558
|
rowData: TData[];
|
|
412
559
|
defaultColDef: Partial<ColDef<TData>>;
|
|
560
|
+
columnTypes: Readonly<Record<string, Partial<ColDef<TData>>>>;
|
|
413
561
|
getRowId?: (params: GetRowIdParams<TData>) => string;
|
|
414
562
|
rowHeight: number;
|
|
415
563
|
headerHeight: number;
|
|
416
564
|
rowBuffer: number;
|
|
565
|
+
columnLayout: ColumnLayoutMode;
|
|
417
566
|
rowSelection: RowSelectionMode;
|
|
418
567
|
multiSort: boolean;
|
|
419
568
|
size: GridSize;
|
|
@@ -431,8 +580,13 @@ interface ResolvedGridOptions<TData = any> extends EventHandlers<TData> {
|
|
|
431
580
|
columnStateStore?: ColumnStateStore;
|
|
432
581
|
aggFuncs?: Record<string, (values: any[]) => any>;
|
|
433
582
|
components?: GridComponents;
|
|
583
|
+
actionPolicy?: ActionPolicy<TData>;
|
|
434
584
|
features: readonly GridFeature<TData>[];
|
|
585
|
+
initialState?: GridState;
|
|
435
586
|
locale: RgLocale;
|
|
587
|
+
editType: GridEditType;
|
|
588
|
+
editableIndicator: EditableIndicator;
|
|
589
|
+
rowEditValidator?: (params: RowEditValidationParams<TData>) => RowEditValidationResult | Promise<RowEditValidationResult>;
|
|
436
590
|
singleClickEdit: boolean;
|
|
437
591
|
manualSorting: boolean;
|
|
438
592
|
manualFiltering: boolean;
|
|
@@ -444,15 +598,21 @@ interface ResolvedGridOptions<TData = any> extends EventHandlers<TData> {
|
|
|
444
598
|
}) => string;
|
|
445
599
|
treeData: boolean;
|
|
446
600
|
childrenKey: string;
|
|
601
|
+
isTreeRowExpandable?: (params: Omit<TreeDataLoadParams<TData>, "signal">) => boolean;
|
|
602
|
+
loadTreeChildren?: (params: TreeDataLoadParams<TData>) => Promise<readonly TData[]>;
|
|
447
603
|
autoCheckedChildren: boolean;
|
|
448
604
|
defaultExpandAll: boolean;
|
|
449
605
|
indexOffset: number;
|
|
450
606
|
applyRowDrag: boolean;
|
|
451
607
|
undoStackSize: number;
|
|
608
|
+
asyncTransactionWaitMillis: number;
|
|
452
609
|
getRowHeight?: (params: GetRowHeightParams<TData>) => number;
|
|
453
610
|
pinnedTopRowData: TData[];
|
|
454
611
|
pinnedBottomRowData: TData[];
|
|
455
612
|
paginationEnabled: boolean;
|
|
613
|
+
paginationMode: "client" | "server";
|
|
614
|
+
paginationPage: number;
|
|
615
|
+
paginationTotal: number;
|
|
456
616
|
paginationPageSize: number;
|
|
457
617
|
paginationPageSizeOptions: number[];
|
|
458
618
|
paginationShowTotal: boolean;
|
|
@@ -473,10 +633,15 @@ interface ResolvedGridOptions<TData = any> extends EventHandlers<TData> {
|
|
|
473
633
|
datasource?: GridDatasource<TData>;
|
|
474
634
|
blockSize: number;
|
|
475
635
|
infiniteBufferRows: number;
|
|
636
|
+
datasourceRetryCount: number;
|
|
637
|
+
datasourceRetryDelay: number;
|
|
476
638
|
suppressCellFocus: boolean;
|
|
477
639
|
suppressRowHoverHighlight: boolean;
|
|
478
640
|
suppressNoRowsOverlay: boolean;
|
|
479
641
|
suppressHeaderFocus: boolean;
|
|
642
|
+
ariaLabel: string;
|
|
643
|
+
ariaLabelledBy: string;
|
|
644
|
+
ariaDescribedBy: string;
|
|
480
645
|
loading: boolean;
|
|
481
646
|
overlayNoRowsTemplate: OverlayTemplate;
|
|
482
647
|
overlayLoadingTemplate: OverlayTemplate;
|
|
@@ -515,9 +680,63 @@ interface RowTransaction<TData = any> {
|
|
|
515
680
|
remove?: TData[];
|
|
516
681
|
update?: TData[];
|
|
517
682
|
}
|
|
683
|
+
interface GridCellChange {
|
|
684
|
+
colId: string;
|
|
685
|
+
originalValue: unknown;
|
|
686
|
+
value: unknown;
|
|
687
|
+
}
|
|
688
|
+
interface GridChange<TData = any> {
|
|
689
|
+
rowId: string;
|
|
690
|
+
data: TData;
|
|
691
|
+
cells: GridCellChange[];
|
|
692
|
+
}
|
|
693
|
+
interface GridDiagnosticError {
|
|
694
|
+
code: GridErrorCode;
|
|
695
|
+
source: string;
|
|
696
|
+
message: string;
|
|
697
|
+
timestamp: number;
|
|
698
|
+
context?: Record<string, unknown>;
|
|
699
|
+
}
|
|
700
|
+
interface ColumnWorkbenchItem {
|
|
701
|
+
colId: string;
|
|
702
|
+
label: string;
|
|
703
|
+
visible: boolean;
|
|
704
|
+
pinned: "left" | "right" | null;
|
|
705
|
+
width: number;
|
|
706
|
+
movable: boolean;
|
|
707
|
+
hideable: boolean;
|
|
708
|
+
}
|
|
709
|
+
interface GridDiagnostics {
|
|
710
|
+
gridId: number;
|
|
711
|
+
version: string;
|
|
712
|
+
destroyed: boolean;
|
|
713
|
+
infinite: boolean;
|
|
714
|
+
loading: boolean;
|
|
715
|
+
rowCount: number;
|
|
716
|
+
renderedRowCount: number;
|
|
717
|
+
columnCount: number;
|
|
718
|
+
selectedRowCount: number;
|
|
719
|
+
dirtyRowCount: number;
|
|
720
|
+
recentErrors: readonly GridDiagnosticError[];
|
|
721
|
+
}
|
|
722
|
+
interface SaveChangesResult {
|
|
723
|
+
/** Omit to acknowledge every submitted row; return a subset for partial batch success. */
|
|
724
|
+
savedRowIds?: readonly string[];
|
|
725
|
+
}
|
|
726
|
+
type SaveChangesHandler<TData = any> = (changes: readonly GridChange<TData>[]) => void | SaveChangesResult | Promise<void | SaveChangesResult>;
|
|
518
727
|
interface GridApi<TData = any> {
|
|
728
|
+
/** Resolves after the first layout frame and gridReady emission. */
|
|
729
|
+
whenReady(): Promise<GridApi<TData>>;
|
|
730
|
+
/** Reads the currently resolved value after application, preset and table overrides. */
|
|
731
|
+
getGridOption<K extends keyof GridOptions<TData>>(key: K): GridOptions<TData>[K];
|
|
732
|
+
/** Typed shorthand for updating one runtime option. */
|
|
733
|
+
setGridOption<K extends keyof GridOptions<TData>>(key: K, value: GridOptions<TData>[K]): void;
|
|
519
734
|
setRowData(rows: TData[] | null | undefined): void;
|
|
520
735
|
applyTransaction(transaction: RowTransaction<TData>): void;
|
|
736
|
+
/** Coalesces rapid transactions and refreshes the row pipeline once per batch. */
|
|
737
|
+
applyTransactionAsync(transaction: RowTransaction<TData>): Promise<void>;
|
|
738
|
+
/** Immediately applies transactions currently waiting in the async queue. */
|
|
739
|
+
flushAsyncTransactions(): void;
|
|
521
740
|
getColumnDefs(): (ColDef<TData> | ColDefGroup<TData>)[] | null;
|
|
522
741
|
setColumnDefs(colDefs: (ColDef<TData> | ColDefGroup<TData>)[] | null | undefined): void;
|
|
523
742
|
getColumnState(): ColumnState[];
|
|
@@ -555,6 +774,12 @@ interface GridApi<TData = any> {
|
|
|
555
774
|
isRowExpanded(rowId: string): boolean;
|
|
556
775
|
expandAllDetails(): void;
|
|
557
776
|
collapseAllDetails(): void;
|
|
777
|
+
/** Loads and caches lazy tree children. Concurrent calls for one row are deduplicated. */
|
|
778
|
+
loadTreeChildren(rowId: string, options?: {
|
|
779
|
+
force?: boolean;
|
|
780
|
+
}): Promise<readonly TData[]>;
|
|
781
|
+
retryTreeChildren(rowId: string): Promise<readonly TData[]>;
|
|
782
|
+
isTreeRowLoading(rowId: string): boolean;
|
|
558
783
|
toggleRowGroup(groupId: string): boolean;
|
|
559
784
|
isGroupExpanded(groupId: string): boolean;
|
|
560
785
|
expandAllGroups(): void;
|
|
@@ -567,6 +792,12 @@ interface GridApi<TData = any> {
|
|
|
567
792
|
redo(): boolean;
|
|
568
793
|
canUndo(): boolean;
|
|
569
794
|
canRedo(): boolean;
|
|
795
|
+
getDirtyRowIds(): string[];
|
|
796
|
+
getChanges(): GridChange<TData>[];
|
|
797
|
+
markChangesSaved(rowIds?: readonly string[]): void;
|
|
798
|
+
/** Saves a stable snapshot; supports partial success and preserves edits made in flight. */
|
|
799
|
+
saveChanges(handler: SaveChangesHandler<TData>, rowIds?: readonly string[]): Promise<GridChange<TData>[]>;
|
|
800
|
+
rollbackChanges(rowIds?: readonly string[]): boolean;
|
|
570
801
|
setPinnedTopRowData(rows: TData[] | null): void;
|
|
571
802
|
getPinnedTopRowData(): TData[];
|
|
572
803
|
setPinnedBottomRowData(rows: TData[] | null): void;
|
|
@@ -574,6 +805,11 @@ interface GridApi<TData = any> {
|
|
|
574
805
|
getRangeSelection(): GridCellRange | null;
|
|
575
806
|
clearRangeSelection(): void;
|
|
576
807
|
copyRangeToClipboard(): Promise<boolean>;
|
|
808
|
+
/** Opens the built-in searchable column workbench. */
|
|
809
|
+
openColumnWorkbench(anchor?: HTMLElement): void;
|
|
810
|
+
closeColumnWorkbench(): void;
|
|
811
|
+
getColumnWorkbenchItems(): ColumnWorkbenchItem[];
|
|
812
|
+
/** @deprecated Use openColumnWorkbench. Kept during the 0.x compatibility window. */
|
|
577
813
|
openColumnPanel(anchor?: HTMLElement): void;
|
|
578
814
|
refreshLayout(): void;
|
|
579
815
|
isInfinite(): boolean;
|
|
@@ -593,10 +829,22 @@ interface GridApi<TData = any> {
|
|
|
593
829
|
colId: string;
|
|
594
830
|
keyPress?: string;
|
|
595
831
|
}): boolean;
|
|
832
|
+
/** Starts staged editing for every editable cell in one displayed row. */
|
|
833
|
+
startEditingRow(rowIndex: number): boolean;
|
|
834
|
+
/** Returns whether any row, or the requested displayed row, is in full-row edit mode. */
|
|
835
|
+
isRowEditing(rowIndex?: number): boolean;
|
|
596
836
|
stopEditing(cancel?: boolean): void;
|
|
837
|
+
/** Stops editing and resolves after synchronous or asynchronous validation. */
|
|
838
|
+
stopEditingAsync(cancel?: boolean): Promise<boolean>;
|
|
839
|
+
/** Explicit full-row counterpart; aliases stopEditingAsync when a row is active. */
|
|
840
|
+
stopEditingRow(cancel?: boolean): Promise<boolean>;
|
|
597
841
|
refreshCells(): void;
|
|
598
842
|
updateOptions(options: Partial<GridOptions<TData>>): void;
|
|
599
843
|
getDataAsCsv(params?: CsvExportParams): string;
|
|
844
|
+
getState(): GridState;
|
|
845
|
+
applyState(state: GridState, options?: ApplyGridStateOptions): void;
|
|
846
|
+
/** Lightweight runtime snapshot suitable for support logs and health panels. */
|
|
847
|
+
getDiagnostics(): GridDiagnostics;
|
|
600
848
|
setOverlay(type: "loading" | "noRows" | null): void;
|
|
601
849
|
hideOverlays(): void;
|
|
602
850
|
addEventListener<K extends GridEventType>(eventType: K, listener: (event: GridEventMap<TData>[K]) => void): () => void;
|
|
@@ -770,6 +1018,8 @@ interface ColDef<TData = any, TValue = any> {
|
|
|
770
1018
|
minWidth?: number;
|
|
771
1019
|
maxWidth?: number;
|
|
772
1020
|
flex?: number;
|
|
1021
|
+
/** Excludes the column from `columnLayout: "fit"` scaling. */
|
|
1022
|
+
suppressSizeToFit?: boolean;
|
|
773
1023
|
hide?: boolean;
|
|
774
1024
|
pinned?: PinnedDirection | boolean;
|
|
775
1025
|
sortable?: boolean;
|
|
@@ -792,7 +1042,7 @@ interface ColDef<TData = any, TValue = any> {
|
|
|
792
1042
|
autoRowSpan?: boolean;
|
|
793
1043
|
colSpan?: (params: CellClassParams<TData, TValue>) => number;
|
|
794
1044
|
autoHeight?: boolean;
|
|
795
|
-
validate?: (newValue: TValue, params: ValueSetterParams<TData, TValue>) => string | true | null | undefined
|
|
1045
|
+
validate?: (newValue: TValue, params: ValueSetterParams<TData, TValue>) => string | true | null | undefined | Promise<string | true | null | undefined>;
|
|
796
1046
|
rowDrag?: boolean;
|
|
797
1047
|
valueGetter?: (params: ValueGetterParams<TData, TValue>) => TValue;
|
|
798
1048
|
valueSetter?: (params: ValueSetterParams<TData, TValue>) => boolean;
|
|
@@ -801,7 +1051,8 @@ interface ColDef<TData = any, TValue = any> {
|
|
|
801
1051
|
cellRendererParams?: Record<string, any>;
|
|
802
1052
|
cellClass?: CellClassRule;
|
|
803
1053
|
comparator?: (valueA: any, valueB: any, nodeA: RowNode<TData>, nodeB: RowNode<TData>) => number;
|
|
804
|
-
type
|
|
1054
|
+
/** Named column type(s), resolved left-to-right before this column definition. */
|
|
1055
|
+
type?: string | readonly string[];
|
|
805
1056
|
initialSort?: SortDirection;
|
|
806
1057
|
onCellClick?: (event: CellClickEvent<TData, TValue>) => void;
|
|
807
1058
|
onCellDoubleClick?: (event: CellDoubleClickEvent<TData, TValue>) => void;
|
|
@@ -884,7 +1135,7 @@ declare class ColumnModel {
|
|
|
884
1135
|
cycleSort(column: Column, additive: boolean): void;
|
|
885
1136
|
}
|
|
886
1137
|
|
|
887
|
-
type RowModelContext = Pick<GridCore<any>, "bodyRenderer" | "columnModel" | "emit" | "getApi" | "getCellValue" | "getLocaleText" | "headerRenderer" | "isDestroyed" | "nextId" | "options" | "relayout" | "reportError" | "selectionService" | "skeleton" | "undoService">;
|
|
1138
|
+
type RowModelContext = Pick<GridCore<any>, "bodyRenderer" | "changeTracker" | "columnModel" | "emit" | "getApi" | "getCellValue" | "getLocaleText" | "headerRenderer" | "isDestroyed" | "nextId" | "options" | "relayout" | "reportError" | "selectionService" | "skeleton" | "undoService">;
|
|
888
1139
|
declare class RowModel<TData = any> {
|
|
889
1140
|
private core;
|
|
890
1141
|
private all;
|
|
@@ -904,9 +1155,12 @@ declare class RowModel<TData = any> {
|
|
|
904
1155
|
private infiniteLoading;
|
|
905
1156
|
private infiniteSeq;
|
|
906
1157
|
private infiniteAbort;
|
|
1158
|
+
private infiniteRetryTimer;
|
|
907
1159
|
private infinitePendingResolve;
|
|
908
1160
|
private treeDepth;
|
|
909
1161
|
private rowSequence;
|
|
1162
|
+
private treeLoadControllers;
|
|
1163
|
+
private treeLoadPromises;
|
|
910
1164
|
constructor(core: RowModelContext);
|
|
911
1165
|
resolveRowId(data: TData, index: number, fallback: string): string;
|
|
912
1166
|
get isTree(): boolean;
|
|
@@ -927,7 +1181,13 @@ declare class RowModel<TData = any> {
|
|
|
927
1181
|
getChildrenIds(id: string): string[];
|
|
928
1182
|
getChildrenCount(id: string): number;
|
|
929
1183
|
hasChildren(id: string): boolean;
|
|
930
|
-
|
|
1184
|
+
isTreeRowLoading(id: string): boolean;
|
|
1185
|
+
private cancelTreeLoads;
|
|
1186
|
+
loadTreeChildren(id: string, force?: boolean): Promise<readonly TData[]>;
|
|
1187
|
+
private replaceTreeChildren;
|
|
1188
|
+
private validateTreeChildren;
|
|
1189
|
+
applyTransaction(transaction: RowTransaction<TData>, refresh?: boolean): void;
|
|
1190
|
+
applyTransactions(transactions: readonly RowTransaction<TData>[]): void;
|
|
931
1191
|
private buildChildNodes;
|
|
932
1192
|
private reindexAll;
|
|
933
1193
|
setFilterModel(filterModel: FilterModel | null): boolean;
|
|
@@ -948,6 +1208,7 @@ declare class RowModel<TData = any> {
|
|
|
948
1208
|
getPipelineRows(): RowNode<TData>[];
|
|
949
1209
|
setPage(page: number, silent?: boolean): void;
|
|
950
1210
|
setPageSize(size: number): void;
|
|
1211
|
+
restorePagination(page: number, pageSize: number): void;
|
|
951
1212
|
setPaginationEnabled(enabled: boolean): void;
|
|
952
1213
|
onPaginationOptionsChanged(): void;
|
|
953
1214
|
private emitPaginationChanged;
|
|
@@ -959,6 +1220,9 @@ declare class RowModel<TData = any> {
|
|
|
959
1220
|
private buildGrouped;
|
|
960
1221
|
isRowExpandable(node: RowNode<TData>): boolean;
|
|
961
1222
|
isRowExpanded(id: string): boolean;
|
|
1223
|
+
getExpandedRowIds(): string[];
|
|
1224
|
+
getExpandedGroupIds(): string[];
|
|
1225
|
+
restoreExpansion(rowIds: readonly string[], groupIds: readonly string[]): void;
|
|
962
1226
|
expandRow(id: string): boolean;
|
|
963
1227
|
collapseRow(id: string): boolean;
|
|
964
1228
|
toggleDetail(id: string): boolean;
|
|
@@ -996,6 +1260,7 @@ declare class SelectionService {
|
|
|
996
1260
|
getSelectedNodes(): RowNode<any>[];
|
|
997
1261
|
getSelectedRows(): any[];
|
|
998
1262
|
getSelectedIds(): string[];
|
|
1263
|
+
restoreSelection(ids: readonly string[]): void;
|
|
999
1264
|
onRowsRebuilt(preserveIds: boolean): void;
|
|
1000
1265
|
getGroupSelectionState(groupNode: RowNode<any>): {
|
|
1001
1266
|
all: boolean;
|
|
@@ -1065,22 +1330,61 @@ declare class KeyboardService {
|
|
|
1065
1330
|
private onCut;
|
|
1066
1331
|
private onPaste;
|
|
1067
1332
|
private onKeyDown;
|
|
1333
|
+
private handleSelectAll;
|
|
1334
|
+
private handleHistoryShortcut;
|
|
1335
|
+
private handleRangeCommand;
|
|
1336
|
+
private focusFirstCell;
|
|
1337
|
+
private handleFocusedKey;
|
|
1338
|
+
private resolveKeyPosition;
|
|
1339
|
+
private movePosition;
|
|
1340
|
+
private validSkippedRow;
|
|
1341
|
+
private movePage;
|
|
1342
|
+
private activateEditor;
|
|
1343
|
+
private toggleFocusedRow;
|
|
1344
|
+
private moveToEditable;
|
|
1068
1345
|
}
|
|
1069
1346
|
|
|
1070
|
-
type EditingContext = Pick<GridCore<any>, "bodyRenderer" | "emit" | "getApi" | "getCellValue" | "keyboardService" | "reportError" | "resolveCellEditor" | "rowModel" | "setCellValue">;
|
|
1347
|
+
type EditingContext = Pick<GridCore<any>, "bodyRenderer" | "columnModel" | "emit" | "getApi" | "getCellValue" | "keyboardService" | "notifyCellValueChanged" | "options" | "reportError" | "resolveCellEditor" | "rowModel" | "setCellValue" | "statusBarService" | "summaryRenderer" | "undoService" | "writeValue">;
|
|
1071
1348
|
declare class EditingService {
|
|
1072
1349
|
private core;
|
|
1073
|
-
private
|
|
1350
|
+
private cellEditing;
|
|
1351
|
+
private rowEditing;
|
|
1352
|
+
private stopPromise;
|
|
1353
|
+
private stopToken;
|
|
1074
1354
|
constructor(core: EditingContext);
|
|
1075
1355
|
isEditing(rowIndex?: number, colId?: string): boolean;
|
|
1356
|
+
isCellEditing(): boolean;
|
|
1357
|
+
isRowEditing(rowIndex?: number): boolean;
|
|
1076
1358
|
isEditable(node: RowNode<any>, column: Column): boolean;
|
|
1077
1359
|
start(rowIndex: number, column: Column, keyPress?: string | null): boolean;
|
|
1360
|
+
startRow(rowIndex: number, preferredColId?: string): boolean;
|
|
1361
|
+
/** Called by BodyRenderer so row editors survive horizontal/vertical virtualization. */
|
|
1362
|
+
renderEditor(rowIndex: number, node: RowNode<any>, column: Column, cell: HTMLElement): boolean;
|
|
1363
|
+
/** Captures a staged value before a pooled/virtual cell is reused. */
|
|
1364
|
+
releaseCell(rowIndex: number, colId: string, cell: HTMLElement): void;
|
|
1078
1365
|
stop(cancel?: boolean): void;
|
|
1366
|
+
stopAsync(cancel?: boolean): Promise<boolean>;
|
|
1367
|
+
stopRowAsync(cancel?: boolean): Promise<boolean>;
|
|
1368
|
+
private finishCellStop;
|
|
1369
|
+
private finishRowStop;
|
|
1370
|
+
private commitRowDrafts;
|
|
1371
|
+
private mountRowDraft;
|
|
1372
|
+
private unmountRowDraft;
|
|
1373
|
+
private captureRowDraft;
|
|
1374
|
+
private createCellEditor;
|
|
1079
1375
|
private validateValue;
|
|
1376
|
+
private validateRowDraft;
|
|
1377
|
+
private showRowErrors;
|
|
1080
1378
|
private showError;
|
|
1379
|
+
private setCellBusy;
|
|
1380
|
+
private setRowBusy;
|
|
1081
1381
|
private applyValue;
|
|
1082
|
-
private
|
|
1083
|
-
private
|
|
1382
|
+
private focusEditor;
|
|
1383
|
+
private destroyMountedEditor;
|
|
1384
|
+
private currentRowIndex;
|
|
1385
|
+
private onCellEditorKeyDown;
|
|
1386
|
+
private onRowEditorKeyDown;
|
|
1387
|
+
private onCellEditorBlur;
|
|
1084
1388
|
destroy(): void;
|
|
1085
1389
|
}
|
|
1086
1390
|
|
|
@@ -1107,6 +1411,7 @@ declare class ColumnMenuService {
|
|
|
1107
1411
|
private panel;
|
|
1108
1412
|
private openColId;
|
|
1109
1413
|
private standaloneAnchor;
|
|
1414
|
+
private searchText;
|
|
1110
1415
|
constructor(core: ColumnMenuContext);
|
|
1111
1416
|
toggle(column: Column, anchor: HTMLElement): void;
|
|
1112
1417
|
openStandalone(anchor?: HTMLElement): void;
|
|
@@ -1116,6 +1421,7 @@ declare class ColumnMenuService {
|
|
|
1116
1421
|
private docKeyDown;
|
|
1117
1422
|
private open;
|
|
1118
1423
|
private rebuildListStates;
|
|
1424
|
+
private renderColumnList;
|
|
1119
1425
|
}
|
|
1120
1426
|
|
|
1121
1427
|
type ContextMenuContext = Pick<GridCore<any>, "bodyRenderer" | "clearRangeValues" | "columnModel" | "copyActiveRange" | "getApi" | "getCellValue" | "getLocaleText" | "options" | "pasteFromSystemClipboard" | "reportError" | "rowModel">;
|
|
@@ -1192,6 +1498,26 @@ declare class UndoRedoService {
|
|
|
1192
1498
|
clear(): void;
|
|
1193
1499
|
}
|
|
1194
1500
|
|
|
1501
|
+
type ChangeTrackingContext = Pick<GridCore<any>, "bodyRenderer" | "columnModel" | "emit" | "eventBus" | "getCellValue" | "rowModel" | "statusBarService" | "summaryRenderer" | "writeValue">;
|
|
1502
|
+
declare class ChangeTrackingService<TData = any> {
|
|
1503
|
+
private core;
|
|
1504
|
+
private changes;
|
|
1505
|
+
private rollingBack;
|
|
1506
|
+
private unsubscribe;
|
|
1507
|
+
constructor(core: ChangeTrackingContext);
|
|
1508
|
+
init(): void;
|
|
1509
|
+
private record;
|
|
1510
|
+
getDirtyRowIds(): string[];
|
|
1511
|
+
getChanges(): GridChange<TData>[];
|
|
1512
|
+
markSaved(rowIds?: readonly string[]): void;
|
|
1513
|
+
acknowledge(saved: readonly GridChange<TData>[]): void;
|
|
1514
|
+
rollback(rowIds?: readonly string[]): boolean;
|
|
1515
|
+
clearRows(rowIds: readonly string[]): void;
|
|
1516
|
+
clear(): void;
|
|
1517
|
+
destroy(): void;
|
|
1518
|
+
private emitChanged;
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1195
1521
|
type SkeletonContext = Pick<GridCore<any>, "options" | "relayout" | "reportError">;
|
|
1196
1522
|
declare class GridSkeleton {
|
|
1197
1523
|
private core;
|
|
@@ -1213,12 +1539,15 @@ declare class GridSkeleton {
|
|
|
1213
1539
|
private currentOverlay;
|
|
1214
1540
|
private currentOverlayContent;
|
|
1215
1541
|
private currentOverlayAllowsHtml;
|
|
1542
|
+
private overlayCleanup;
|
|
1216
1543
|
private customClassTokens;
|
|
1217
1544
|
private resizeObserver;
|
|
1218
1545
|
private headerDepth;
|
|
1219
1546
|
constructor(core: SkeletonContext);
|
|
1220
1547
|
init(container: HTMLElement, options: ResolvedGridOptions): void;
|
|
1548
|
+
applyAriaLabels(options: Pick<ResolvedGridOptions, "ariaLabel" | "ariaLabelledBy" | "ariaDescribedBy">): void;
|
|
1221
1549
|
setHeaderRowCount(depth: number): void;
|
|
1550
|
+
getHeaderRowCount(): number;
|
|
1222
1551
|
private applyHeaderHeight;
|
|
1223
1552
|
setPaneWidths(left: number, right: number): void;
|
|
1224
1553
|
private applyPaneWidth;
|
|
@@ -1235,6 +1564,7 @@ declare class GridSkeleton {
|
|
|
1235
1564
|
hideOverlay(): void;
|
|
1236
1565
|
setInfiniteLoading(active: boolean, text: string): void;
|
|
1237
1566
|
destroy(): void;
|
|
1567
|
+
private cleanupOverlayContent;
|
|
1238
1568
|
}
|
|
1239
1569
|
|
|
1240
1570
|
type HeaderContext = Pick<GridCore<any>, "columnDragService" | "columnMenu" | "columnModel" | "cycleSort" | "emit" | "filterPopup" | "getApi" | "isDestroyed" | "moveColumn" | "options" | "relayoutColumns" | "reportError" | "resizeService" | "rowModel" | "selectionService" | "skeleton">;
|
|
@@ -1250,6 +1580,7 @@ declare class HeaderRenderer {
|
|
|
1250
1580
|
applyLayout(): void;
|
|
1251
1581
|
private visiblePaneLeaves;
|
|
1252
1582
|
private onHeaderKeyDown;
|
|
1583
|
+
private focusHeaderCell;
|
|
1253
1584
|
refreshSortIndicators(): void;
|
|
1254
1585
|
refreshFilterIcons(): void;
|
|
1255
1586
|
refreshSelectAllCheckbox(): void;
|
|
@@ -1305,6 +1636,9 @@ declare class BodyRenderer {
|
|
|
1305
1636
|
flushFlash(): void;
|
|
1306
1637
|
relayout(): void;
|
|
1307
1638
|
private growPool;
|
|
1639
|
+
private activePaneColumns;
|
|
1640
|
+
private createCell;
|
|
1641
|
+
private reconcilePaneCells;
|
|
1308
1642
|
rebuildPool(): void;
|
|
1309
1643
|
applyCellLayout(): void;
|
|
1310
1644
|
private computeColWindow;
|
|
@@ -1317,6 +1651,8 @@ declare class BodyRenderer {
|
|
|
1317
1651
|
private renderDetailContent;
|
|
1318
1652
|
private cleanupDetail;
|
|
1319
1653
|
private renderCell;
|
|
1654
|
+
private appendEditableIndicator;
|
|
1655
|
+
private releaseSlotEditors;
|
|
1320
1656
|
private treeColumnCache;
|
|
1321
1657
|
private getTreeColumn;
|
|
1322
1658
|
private renderTreeCell;
|
|
@@ -1372,6 +1708,7 @@ declare class BodyRenderer {
|
|
|
1372
1708
|
focusGridRoot(): void;
|
|
1373
1709
|
private resolveEventTarget;
|
|
1374
1710
|
private onBodyClick;
|
|
1711
|
+
private handleTreeToggleClick;
|
|
1375
1712
|
private firstCheckboxColId;
|
|
1376
1713
|
private onBodyDblClick;
|
|
1377
1714
|
private onContextMenu;
|
|
@@ -1465,6 +1802,7 @@ declare class GridCore<TData = any> {
|
|
|
1465
1802
|
readonly keyboardService: KeyboardService;
|
|
1466
1803
|
readonly editingService: EditingService;
|
|
1467
1804
|
readonly undoService: UndoRedoService;
|
|
1805
|
+
readonly changeTracker: ChangeTrackingService<TData>;
|
|
1468
1806
|
readonly filterPopup: FilterPopupService;
|
|
1469
1807
|
readonly columnMenu: ColumnMenuService;
|
|
1470
1808
|
readonly contextMenuService: ContextMenuService;
|
|
@@ -1478,10 +1816,16 @@ declare class GridCore<TData = any> {
|
|
|
1478
1816
|
private destroyed;
|
|
1479
1817
|
private autoIdCounter;
|
|
1480
1818
|
private readyRafId;
|
|
1819
|
+
private readySettled;
|
|
1820
|
+
private readonly readyPromise;
|
|
1821
|
+
private readonly resolveReady;
|
|
1481
1822
|
private lastColumnLayoutSignature;
|
|
1482
1823
|
private activeFeatures;
|
|
1824
|
+
private recentErrors;
|
|
1483
1825
|
constructor(container: HTMLElement, options: GridOptions<TData>);
|
|
1484
1826
|
getApi(): GridApi<TData>;
|
|
1827
|
+
whenReady(): Promise<GridApi<TData>>;
|
|
1828
|
+
private settleReady;
|
|
1485
1829
|
resolveCellRenderer(name: string): CellRendererFn | undefined;
|
|
1486
1830
|
resolveCellEditor(name: string): CellEditorFactory | undefined;
|
|
1487
1831
|
setFeatures(features: readonly GridFeature<TData>[] | null | undefined): void;
|
|
@@ -1492,6 +1836,8 @@ declare class GridCore<TData = any> {
|
|
|
1492
1836
|
getLocaleText(key: RgLocaleKey): string;
|
|
1493
1837
|
writeValue(node: RowNode<any>, column: Column, newValue: any, oldValue?: any): boolean;
|
|
1494
1838
|
setCellValue(node: RowNode<any>, column: Column, newValue: any, oldValue: any): boolean;
|
|
1839
|
+
/** Emits the shared value-change side effects after a caller has written data transactionally. */
|
|
1840
|
+
notifyCellValueChanged(node: RowNode<any>, column: Column, oldValue: any, newValue: any): void;
|
|
1495
1841
|
buildRangeTsv(range: {
|
|
1496
1842
|
r1: number;
|
|
1497
1843
|
c1: number;
|
|
@@ -1510,6 +1856,8 @@ declare class GridCore<TData = any> {
|
|
|
1510
1856
|
refreshSummary(): void;
|
|
1511
1857
|
emit<K extends GridEventType>(type: K, extra?: Partial<GridEventMap<TData>[K]>): GridEventMap<TData>[K];
|
|
1512
1858
|
reportError(error: unknown, source: string, context?: Record<string, unknown>): void;
|
|
1859
|
+
private errorCodeFor;
|
|
1860
|
+
getDiagnostics(): GridDiagnostics;
|
|
1513
1861
|
cycleSort(column: Column, additive: boolean): void;
|
|
1514
1862
|
applySortModel(): void;
|
|
1515
1863
|
applyColumnFilter(column: Column, filter: ColumnFilter | null): void;
|
|
@@ -1522,10 +1870,11 @@ declare class GridCore<TData = any> {
|
|
|
1522
1870
|
buildDefaultEmptyState(): HTMLElement;
|
|
1523
1871
|
private lastValidatedDefs;
|
|
1524
1872
|
private issuedWarningSignatures;
|
|
1525
|
-
checkWarnings(): void;
|
|
1873
|
+
checkWarnings(inputOptions?: Partial<GridOptions<any>> | Record<string, unknown>): void;
|
|
1526
1874
|
validateDefs(defs: (ColDef<any> | ColDefGroup<any>)[] | null | undefined): void;
|
|
1527
1875
|
onColumnsStructureChanged(): void;
|
|
1528
1876
|
relayout(): void;
|
|
1877
|
+
refreshAriaState(): void;
|
|
1529
1878
|
relayoutColumns(invalidateRowHeights?: boolean): void;
|
|
1530
1879
|
destroy(): void;
|
|
1531
1880
|
}
|
|
@@ -1543,6 +1892,8 @@ interface WidthInput {
|
|
|
1543
1892
|
flex?: number;
|
|
1544
1893
|
}
|
|
1545
1894
|
declare function computeColumnWidths(cols: WidthInput[], availableWidth: number): number[];
|
|
1895
|
+
/** Fits columns into a viewport while honoring every min/max bound. */
|
|
1896
|
+
declare function fitColumnWidths(cols: WidthInput[], availableWidth: number): number[];
|
|
1546
1897
|
|
|
1547
1898
|
interface GridSizePreset {
|
|
1548
1899
|
rowHeight: number;
|
|
@@ -1581,6 +1932,10 @@ declare const GRID_OPTION_META: {
|
|
|
1581
1932
|
readonly kind: "object";
|
|
1582
1933
|
readonly update: "options";
|
|
1583
1934
|
};
|
|
1935
|
+
readonly columnTypes: {
|
|
1936
|
+
readonly kind: "object";
|
|
1937
|
+
readonly update: "options";
|
|
1938
|
+
};
|
|
1584
1939
|
readonly getRowId: {
|
|
1585
1940
|
readonly kind: "function";
|
|
1586
1941
|
readonly update: "options";
|
|
@@ -1597,6 +1952,10 @@ declare const GRID_OPTION_META: {
|
|
|
1597
1952
|
readonly kind: "number";
|
|
1598
1953
|
readonly update: "options";
|
|
1599
1954
|
};
|
|
1955
|
+
readonly columnLayout: {
|
|
1956
|
+
readonly kind: "string";
|
|
1957
|
+
readonly update: "options";
|
|
1958
|
+
};
|
|
1600
1959
|
readonly rowSelection: {
|
|
1601
1960
|
readonly kind: "string";
|
|
1602
1961
|
readonly update: "options";
|
|
@@ -1665,14 +2024,34 @@ declare const GRID_OPTION_META: {
|
|
|
1665
2024
|
readonly kind: "object";
|
|
1666
2025
|
readonly update: "options";
|
|
1667
2026
|
};
|
|
2027
|
+
readonly actionPolicy: {
|
|
2028
|
+
readonly kind: "object";
|
|
2029
|
+
readonly update: "options";
|
|
2030
|
+
};
|
|
1668
2031
|
readonly features: {
|
|
1669
2032
|
readonly kind: "array";
|
|
1670
2033
|
readonly update: "options";
|
|
1671
2034
|
};
|
|
2035
|
+
readonly initialState: {
|
|
2036
|
+
readonly kind: "object";
|
|
2037
|
+
readonly update: "options";
|
|
2038
|
+
};
|
|
1672
2039
|
readonly locale: {
|
|
1673
2040
|
readonly kind: "object";
|
|
1674
2041
|
readonly update: "options";
|
|
1675
2042
|
};
|
|
2043
|
+
readonly editType: {
|
|
2044
|
+
readonly kind: "string";
|
|
2045
|
+
readonly update: "options";
|
|
2046
|
+
};
|
|
2047
|
+
readonly editableIndicator: {
|
|
2048
|
+
readonly kind: "string";
|
|
2049
|
+
readonly update: "options";
|
|
2050
|
+
};
|
|
2051
|
+
readonly rowEditValidator: {
|
|
2052
|
+
readonly kind: "function";
|
|
2053
|
+
readonly update: "options";
|
|
2054
|
+
};
|
|
1676
2055
|
readonly singleClickEdit: {
|
|
1677
2056
|
readonly kind: "boolean";
|
|
1678
2057
|
readonly update: "options";
|
|
@@ -1701,6 +2080,14 @@ declare const GRID_OPTION_META: {
|
|
|
1701
2080
|
readonly kind: "string";
|
|
1702
2081
|
readonly update: "options";
|
|
1703
2082
|
};
|
|
2083
|
+
readonly isTreeRowExpandable: {
|
|
2084
|
+
readonly kind: "function";
|
|
2085
|
+
readonly update: "options";
|
|
2086
|
+
};
|
|
2087
|
+
readonly loadTreeChildren: {
|
|
2088
|
+
readonly kind: "function";
|
|
2089
|
+
readonly update: "options";
|
|
2090
|
+
};
|
|
1704
2091
|
readonly autoCheckedChildren: {
|
|
1705
2092
|
readonly kind: "boolean";
|
|
1706
2093
|
readonly update: "options";
|
|
@@ -1721,6 +2108,10 @@ declare const GRID_OPTION_META: {
|
|
|
1721
2108
|
readonly kind: "number";
|
|
1722
2109
|
readonly update: "options";
|
|
1723
2110
|
};
|
|
2111
|
+
readonly asyncTransactionWaitMillis: {
|
|
2112
|
+
readonly kind: "number";
|
|
2113
|
+
readonly update: "options";
|
|
2114
|
+
};
|
|
1724
2115
|
readonly getRowHeight: {
|
|
1725
2116
|
readonly kind: "function";
|
|
1726
2117
|
readonly update: "options";
|
|
@@ -1793,6 +2184,14 @@ declare const GRID_OPTION_META: {
|
|
|
1793
2184
|
readonly kind: "number";
|
|
1794
2185
|
readonly update: "options";
|
|
1795
2186
|
};
|
|
2187
|
+
readonly datasourceRetryCount: {
|
|
2188
|
+
readonly kind: "number";
|
|
2189
|
+
readonly update: "options";
|
|
2190
|
+
};
|
|
2191
|
+
readonly datasourceRetryDelay: {
|
|
2192
|
+
readonly kind: "number";
|
|
2193
|
+
readonly update: "options";
|
|
2194
|
+
};
|
|
1796
2195
|
readonly suppressCellFocus: {
|
|
1797
2196
|
readonly kind: "boolean";
|
|
1798
2197
|
readonly update: "options";
|
|
@@ -1809,6 +2208,18 @@ declare const GRID_OPTION_META: {
|
|
|
1809
2208
|
readonly kind: "boolean";
|
|
1810
2209
|
readonly update: "options";
|
|
1811
2210
|
};
|
|
2211
|
+
readonly ariaLabel: {
|
|
2212
|
+
readonly kind: "string";
|
|
2213
|
+
readonly update: "options";
|
|
2214
|
+
};
|
|
2215
|
+
readonly ariaLabelledBy: {
|
|
2216
|
+
readonly kind: "string";
|
|
2217
|
+
readonly update: "options";
|
|
2218
|
+
};
|
|
2219
|
+
readonly ariaDescribedBy: {
|
|
2220
|
+
readonly kind: "string";
|
|
2221
|
+
readonly update: "options";
|
|
2222
|
+
};
|
|
1812
2223
|
readonly loading: {
|
|
1813
2224
|
readonly kind: "boolean";
|
|
1814
2225
|
readonly update: "options";
|
|
@@ -1835,6 +2246,16 @@ declare const DIRECT_GRID_OPTION_KEYS: readonly GridOptionKey[];
|
|
|
1835
2246
|
|
|
1836
2247
|
declare function describeFilter(filter: ColumnFilter): string;
|
|
1837
2248
|
|
|
2249
|
+
type GridValidationCode = "UNKNOWN_OPTION" | "INVALID_OPTION_VALUE" | "OPTION_CONFLICT" | "MISSING_STABLE_ROW_ID";
|
|
2250
|
+
interface GridValidationIssue {
|
|
2251
|
+
code: GridValidationCode;
|
|
2252
|
+
message: string;
|
|
2253
|
+
option?: string;
|
|
2254
|
+
suggestion?: string;
|
|
2255
|
+
}
|
|
2256
|
+
/** Runtime validation for JavaScript, JSON/schema driven and dynamic options. */
|
|
2257
|
+
declare function validateGridOptions(options: Partial<GridOptions<any>> | Record<string, unknown>): GridValidationIssue[];
|
|
2258
|
+
|
|
1838
2259
|
type GridSchemaFieldType = "string" | "number" | "date" | "select" | "boolean";
|
|
1839
2260
|
interface SchemaSelectOption {
|
|
1840
2261
|
label: string;
|
|
@@ -1868,6 +2289,45 @@ interface GridSchema {
|
|
|
1868
2289
|
}
|
|
1869
2290
|
declare function buildColDefsFromSchema<TData = any>(schema: GridSchema): (ColDef<TData> | ColDefGroup<TData>)[];
|
|
1870
2291
|
|
|
2292
|
+
interface ColumnStateStorage {
|
|
2293
|
+
getItem(key: string): string | null;
|
|
2294
|
+
setItem(key: string, value: string): void;
|
|
2295
|
+
removeItem(key: string): void;
|
|
2296
|
+
}
|
|
2297
|
+
interface StoredColumnState {
|
|
2298
|
+
version: number;
|
|
2299
|
+
savedAt: number;
|
|
2300
|
+
columns: ColumnState[];
|
|
2301
|
+
}
|
|
2302
|
+
interface LocalColumnStateStoreOptions {
|
|
2303
|
+
/** Storage prefix. Separate applications or environments with different values. */
|
|
2304
|
+
namespace?: string;
|
|
2305
|
+
/** Schema version for migrations when column identifiers or meanings change. */
|
|
2306
|
+
version?: number;
|
|
2307
|
+
storage?: ColumnStateStorage;
|
|
2308
|
+
maxColumns?: number;
|
|
2309
|
+
migrate?(columns: readonly ColumnState[], fromVersion: number, toVersion: number): ColumnState[] | null;
|
|
2310
|
+
onError?(error: unknown, operation: "load" | "save" | "clear", key: string): void;
|
|
2311
|
+
}
|
|
2312
|
+
interface ManagedColumnStateStore extends ColumnStateStore {
|
|
2313
|
+
clear(key: string): void;
|
|
2314
|
+
storageKey(key: string): string;
|
|
2315
|
+
}
|
|
2316
|
+
interface ColumnStateKeyParts {
|
|
2317
|
+
app?: string;
|
|
2318
|
+
tenant?: string | number;
|
|
2319
|
+
user?: string | number;
|
|
2320
|
+
route?: string;
|
|
2321
|
+
table: string;
|
|
2322
|
+
schema?: string | number;
|
|
2323
|
+
}
|
|
2324
|
+
/** Builds a collision-resistant key for per-user/per-route table preferences. */
|
|
2325
|
+
declare function createColumnStateKey(parts: ColumnStateKeyParts): string;
|
|
2326
|
+
/**
|
|
2327
|
+
* Creates a versioned local state adapter. Legacy array payloads are read as
|
|
2328
|
+
* version 0, so existing users can migrate without losing preferences.
|
|
2329
|
+
*/
|
|
2330
|
+
declare function createLocalColumnStateStore(options?: LocalColumnStateStoreOptions): ManagedColumnStateStore;
|
|
1871
2331
|
declare function saveColumnState(key: string, state: ColumnState[]): void;
|
|
1872
2332
|
declare function loadColumnState(key: string): ColumnState[] | null;
|
|
1873
2333
|
declare function clearColumnState(key: string): void;
|
|
@@ -1907,28 +2367,141 @@ interface ProgressConfig {
|
|
|
1907
2367
|
}
|
|
1908
2368
|
declare function createProgressBarRenderer(config?: ProgressConfig): CellRendererFn;
|
|
1909
2369
|
declare function linkRenderer(params: CellRendererParams): string | HTMLElement;
|
|
2370
|
+
type ActionVariant = "default" | "primary" | "warning" | "success" | "danger";
|
|
2371
|
+
type ActionOverflowMode = "menu" | "drawer" | "inline";
|
|
1910
2372
|
interface ActionItem<TData = any> {
|
|
2373
|
+
/** Stable identifier used by permission, telemetry and error policies. */
|
|
2374
|
+
id?: string;
|
|
1911
2375
|
icon?: string;
|
|
1912
2376
|
label?: string;
|
|
1913
2377
|
title?: string;
|
|
2378
|
+
/** Backwards-compatible shorthand for variant="danger". */
|
|
1914
2379
|
danger?: boolean;
|
|
2380
|
+
variant?: ActionVariant;
|
|
1915
2381
|
show?: (params: CellRendererParams<TData>) => boolean;
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
2382
|
+
disabled?: boolean | ((params: CellRendererParams<TData>) => boolean);
|
|
2383
|
+
loading?: boolean | ((params: CellRendererParams<TData>) => boolean);
|
|
2384
|
+
/** One or more UI permissions. Access is resolved by GridOptions.actionPolicy. */
|
|
2385
|
+
permission?: string | readonly string[];
|
|
2386
|
+
/** Ask for confirmation before running. A string becomes the confirmation message. */
|
|
2387
|
+
confirm?: boolean | string | ((params: CellRendererParams<TData>) => boolean | string | Promise<boolean | string>);
|
|
2388
|
+
onClick: (params: CellRendererParams<TData>) => unknown | Promise<unknown>;
|
|
2389
|
+
}
|
|
2390
|
+
interface ActionButtonsConfig<TData = any> {
|
|
2391
|
+
actions: ActionItem<TData>[];
|
|
1920
2392
|
max?: number;
|
|
1921
|
-
|
|
1922
|
-
|
|
2393
|
+
/** menu is compact, drawer suits touch/complex actions, inline never renders an ellipsis. */
|
|
2394
|
+
overflow?: ActionOverflowMode;
|
|
2395
|
+
moreLabel?: string;
|
|
2396
|
+
drawerTitle?: string;
|
|
2397
|
+
}
|
|
2398
|
+
interface RowActionsConfig<TData = any> extends Omit<ActionButtonsConfig<TData>, "actions"> {
|
|
2399
|
+
onView?: (params: CellRendererParams<TData>) => unknown | Promise<unknown>;
|
|
2400
|
+
onDelete?: (params: CellRendererParams<TData>) => unknown | Promise<unknown>;
|
|
2401
|
+
/** Set false when this table has no full-row edit workflow. */
|
|
2402
|
+
edit?: boolean;
|
|
2403
|
+
extraActions?: ActionItem<TData>[];
|
|
2404
|
+
labels?: Partial<Record<"view" | "edit" | "delete" | "save" | "cancel", string>>;
|
|
2405
|
+
permissions?: Partial<Record<"view" | "edit" | "delete", string | readonly string[]>>;
|
|
2406
|
+
/** Defaults to the translated delete label when true. */
|
|
2407
|
+
confirmDelete?: boolean | string | ((params: CellRendererParams<TData>) => boolean | string | Promise<boolean | string>);
|
|
2408
|
+
}
|
|
2409
|
+
declare function createActionButtonsRenderer<TData = any>(config: ActionButtonsConfig<TData>): CellRendererFn;
|
|
2410
|
+
declare function createRowActionsRenderer<TData = any>(config?: RowActionsConfig<TData>): CellRendererFn;
|
|
1923
2411
|
declare function registerBuiltinRenderers(register: (name: string, fn: CellRendererFn) => void): void;
|
|
1924
2412
|
|
|
1925
2413
|
declare function selectionColumn<TData = any>(overrides?: Partial<ColDef<TData>>): ColDef<TData>;
|
|
1926
2414
|
declare function indexColumn<TData = any>(overrides?: Partial<ColDef<TData>>): ColDef<TData>;
|
|
1927
2415
|
declare function dragColumn<TData = any>(overrides?: Partial<ColDef<TData>>): ColDef<TData>;
|
|
1928
|
-
declare function actionsColumn<TData = any>(config?: ActionButtonsConfig & {
|
|
2416
|
+
declare function actionsColumn<TData = any>(config?: ActionButtonsConfig<TData> & {
|
|
1929
2417
|
width?: number;
|
|
1930
2418
|
pinned?: "left" | "right";
|
|
1931
2419
|
}): ColDef<TData>;
|
|
2420
|
+
declare function rowActionsColumn<TData = any>(config?: RowActionsConfig<TData> & {
|
|
2421
|
+
width?: number;
|
|
2422
|
+
pinned?: "left" | "right";
|
|
2423
|
+
}): ColDef<TData>;
|
|
2424
|
+
|
|
2425
|
+
type Callable = (...args: never[]) => unknown;
|
|
2426
|
+
type Primitive = string | number | boolean | bigint | symbol | null | undefined | Date | Callable;
|
|
2427
|
+
type Depth = 0 | 1 | 2 | 3 | 4;
|
|
2428
|
+
type Previous = {
|
|
2429
|
+
0: 0;
|
|
2430
|
+
1: 0;
|
|
2431
|
+
2: 1;
|
|
2432
|
+
3: 2;
|
|
2433
|
+
4: 3;
|
|
2434
|
+
};
|
|
2435
|
+
type FieldPath<T, D extends Depth = 4> = D extends 0 ? never : T extends Primitive ? never : {
|
|
2436
|
+
[K in keyof T & string]: NonNullable<T[K]> extends Primitive | readonly unknown[] ? K : K | `${K}.${FieldPath<NonNullable<T[K]>, Previous[D]>}`;
|
|
2437
|
+
}[keyof T & string];
|
|
2438
|
+
type FieldPathValue<T, P extends string> = P extends keyof T ? T[P] : P extends `${infer Head}.${infer Tail}` ? Head extends keyof T ? FieldPathValue<NonNullable<T[Head]>, Tail> : unknown : unknown;
|
|
2439
|
+
interface ColumnHelper<TData> {
|
|
2440
|
+
accessor<TPath extends FieldPath<TData>>(field: TPath, definition?: Omit<ColDef<TData, FieldPathValue<TData, TPath>>, "field">): ColDef<TData, FieldPathValue<TData, TPath>>;
|
|
2441
|
+
display<TValue = unknown>(definition: Omit<ColDef<TData, TValue>, "field"> & Required<Pick<ColDef<TData, TValue>, "colId">>): ColDef<TData, TValue>;
|
|
2442
|
+
group(definition: ColDefGroup<TData>): ColDefGroup<TData>;
|
|
2443
|
+
}
|
|
2444
|
+
/** Creates strongly typed column definitions without repeating TData/TValue. */
|
|
2445
|
+
declare function createColumnHelper<TData>(): ColumnHelper<TData>;
|
|
2446
|
+
/** Identity helper that retains literal types while checking GridOptions elsewhere. */
|
|
2447
|
+
declare function defineColumns<TData>(columns: readonly (ColDef<TData> | ColDefGroup<TData>)[]): (ColDef<TData> | ColDefGroup<TData>)[];
|
|
2448
|
+
|
|
2449
|
+
/** Merges reusable defaults left-to-right with nested defaults handled safely. */
|
|
2450
|
+
declare function createMachTablePreset<TData>(...sources: readonly Partial<GridOptions<TData>>[]): GridOptions<TData>;
|
|
2451
|
+
/** Recommended defaults for editable enterprise back-office screens. */
|
|
2452
|
+
declare function createEnterprisePreset<TData>(overrides?: Partial<GridOptions<TData>>): GridOptions<TData>;
|
|
2453
|
+
/** Compile-time helper for a reusable partial preset. */
|
|
2454
|
+
declare function defineMachTablePreset<TData>(preset: Partial<GridOptions<TData>>): Partial<GridOptions<TData>>;
|
|
2455
|
+
/** Compile-time helper for reusable, typed grid option objects. */
|
|
2456
|
+
declare function defineGridOptions<TData>(options: GridOptions<TData>): GridOptions<TData>;
|
|
2457
|
+
|
|
2458
|
+
type BusinessColumnType = "text" | "number" | "integer" | "money" | "percent" | "percentage" | "date" | "datetime" | "boolean" | "status" | "link";
|
|
2459
|
+
interface BusinessColumnTypeOptions {
|
|
2460
|
+
locale?: string | readonly string[];
|
|
2461
|
+
currency?: string;
|
|
2462
|
+
currencyDisplay?: "symbol" | "narrowSymbol" | "code" | "name";
|
|
2463
|
+
timeZone?: string;
|
|
2464
|
+
emptyText?: string;
|
|
2465
|
+
invalidText?: string;
|
|
2466
|
+
trueText?: string;
|
|
2467
|
+
falseText?: string;
|
|
2468
|
+
maximumFractionDigits?: number;
|
|
2469
|
+
}
|
|
2470
|
+
/**
|
|
2471
|
+
* Production-oriented semantic column types. Register once in
|
|
2472
|
+
* `mach-table.config.ts`, then pages only declare `type: "money"` etc.
|
|
2473
|
+
*/
|
|
2474
|
+
declare function createBusinessColumnTypes<TData = any>(options?: BusinessColumnTypeOptions): Readonly<Record<BusinessColumnType, Partial<ColDef<TData>>>>;
|
|
2475
|
+
type DictionaryKey = string | number;
|
|
2476
|
+
interface DictionaryEntry<TKey extends DictionaryKey = DictionaryKey> {
|
|
2477
|
+
value: TKey;
|
|
2478
|
+
label: string;
|
|
2479
|
+
}
|
|
2480
|
+
interface CachedDictionaryOptions<TKey extends DictionaryKey = DictionaryKey> {
|
|
2481
|
+
load(keys: readonly TKey[], signal: AbortSignal): Promise<readonly DictionaryEntry<TKey>[]>;
|
|
2482
|
+
ttlMs?: number;
|
|
2483
|
+
maxSize?: number;
|
|
2484
|
+
batchDelayMs?: number;
|
|
2485
|
+
onError?(error: unknown, keys: readonly TKey[]): void;
|
|
2486
|
+
}
|
|
2487
|
+
interface CachedDictionary<TKey extends DictionaryKey = DictionaryKey> {
|
|
2488
|
+
get(key: TKey): string | undefined;
|
|
2489
|
+
resolve(key: TKey): Promise<string | undefined>;
|
|
2490
|
+
resolveMany(keys: readonly TKey[]): Promise<ReadonlyMap<TKey, string>>;
|
|
2491
|
+
prime(entries: readonly DictionaryEntry<TKey>[]): void;
|
|
2492
|
+
invalidate(keys?: readonly TKey[]): void;
|
|
2493
|
+
destroy(): void;
|
|
2494
|
+
readonly size: number;
|
|
2495
|
+
}
|
|
2496
|
+
/** Batched, de-duplicated TTL/LRU dictionary resolver for code-to-label fields. */
|
|
2497
|
+
declare function createCachedDictionary<TKey extends DictionaryKey = DictionaryKey>(options: CachedDictionaryOptions<TKey>): CachedDictionary<TKey>;
|
|
2498
|
+
interface DictionaryRendererOptions {
|
|
2499
|
+
loadingText?: string;
|
|
2500
|
+
emptyText?: string;
|
|
2501
|
+
fallback?: (value: DictionaryKey) => string;
|
|
2502
|
+
}
|
|
2503
|
+
/** Async-safe renderer backed by createCachedDictionary; stale pooled cells are not mutated. */
|
|
2504
|
+
declare function createDictionaryRenderer<TKey extends DictionaryKey = DictionaryKey>(dictionary: CachedDictionary<TKey>, options?: DictionaryRendererOptions): CellRendererFn;
|
|
1932
2505
|
|
|
1933
2506
|
declare function evaluateColumnFilter(value: any, filter: ColumnFilter): boolean;
|
|
1934
2507
|
|
|
@@ -1936,4 +2509,4 @@ declare function sortNodes<TData>(nodes: RowNode<TData>[], sortModel: SortModel,
|
|
|
1936
2509
|
|
|
1937
2510
|
declare const version: string;
|
|
1938
2511
|
|
|
1939
|
-
export { type ActionButtonsConfig, type ActionItem, type AggFunction, type AggValues, BUILTIN_AGG_FUNCS, type CellAlign, type CellClassParams, type CellClassRule, type CellClickEvent, type CellContextMenuEvent, type CellDoubleClickEvent, type CellEditingStartedEvent, type CellEditingStoppedEvent, type CellEditorFactory, type CellEditorParams, type CellRendererFn, type CellRendererOutput, type CellRendererParams, type CellStyleRule, type CellValueChangedEvent, type ColDef, type ColDefGroup, type ColDefOrGroup, Column, type ColumnFilter, type ColumnMovedEvent, type ColumnResizedEvent, type ColumnState, type ColumnStateStore, type ColumnVisibilityChangedEvent, type ContextMenuItem, type ContextMenuParams, type CsvExportParams, DEFAULT_LOCALE, DIRECT_GRID_OPTION_KEYS, type DateFilterCondition, type DateFilterMatch, type DetailRowRendererParams, type DetailToggledEvent, EVENT_TYPES, type EditableParams, EventBus, type EventHandlers, type FilterChangedEvent, type FilterModel, type FilterType, GRID_OPTION_KEYS, GRID_OPTION_META, GRID_SIZE_PRESETS, type GetRowHeightParams, type GetRowIdParams, type GridApi, type GridCellRange, type GridComponents, GridCore, type GridDatasource, type GridErrorEvent, type GridEventBase, type GridEventMap, type GridEventType, type GridFeature, type GridFeatureContext, type GridOptionKey, type GridOptionMetadata, type GridOptionUpdateMode, type GridOptionValueKind, type GridOptions, type GridReadyEvent, type GridSchema, type GridSchemaField, type GridSchemaFieldType, type GridSchemaGroup, type GridSize, type GridSizePreset, type HeaderComponentParams, type ICellEditor, type ICellRendererResult, type ImportCsvOptions, type InfiniteGetRowsParams, LOCALE_EN, type ModelUpdatedEvent, type NumberFilterCondition, type NumberFilterMatch, type OverlayTemplate, type PaginationChangedEvent, type PaginationConfig, type PinnedDirection, type PrintOptions, type ProgressConfig, type RangeSelectionChangedEvent, type ResolvedGridOptions, type RgLocale, type RgLocaleKey, type RowClickEvent, type RowDragEndEvent, type RowNode, type RowSelectionMode, type RowTransaction, type SchemaSelectOption, type SelectEditorParams, type SelectionChangedEvent, type SetFilterCondition, type SetFilterParams, type SortChangedEvent, type SortDirection, type SortModel, type SortModelItem, type StatusBarConfig, type StatusBarPanel, type StatusTagConfig, type TagVariant, type TextFilterCondition, type TextFilterMatch, type ThemeMode, type TooltipParams, type ValueFormatterParams, type ValueGetterParams, type ValueSetterParams, type WatermarkConfig, type WidthInput, actionsColumn, buildColDefsFromSchema, clearColumnState, clearComponentRegistries, computeColumnWidths, createActionButtonsRenderer, createAggResolver, createGrid, createProgressBarRenderer, createStatusTagRenderer, defaultComparator, describeFilter, downloadFile, dragColumn, escapeHtml, evaluateColumnFilter, formatText, formatTwo, getByPath, getCellEditor, getCellRenderer, indexColumn, isColDefGroup, isSafePath, linkRenderer, loadColumnState, matchLocaleKey, parseCsv, parseDelimited, parseTsv, registerBuiltinRenderers, registerCellEditor, registerCellRenderer, resolveTagVariant, sanitizeFormulaCell, saveColumnState, selectionColumn, setByPath, sortNodes, toTsv, version };
|
|
2512
|
+
export { type ActionButtonsConfig, type ActionItem, type ActionOverflowMode, type ActionPolicy, type ActionPolicyContext, type ActionVariant, type AggFunction, type AggValues, type ApplyGridStateOptions, BUILTIN_AGG_FUNCS, type BusinessColumnType, type BusinessColumnTypeOptions, type CachedDictionary, type CachedDictionaryOptions, type CellAlign, type CellClassParams, type CellClassRule, type CellClickEvent, type CellContextMenuEvent, type CellDoubleClickEvent, type CellEditingStartedEvent, type CellEditingStoppedEvent, type CellEditorFactory, type CellEditorParams, type CellRendererFn, type CellRendererOutput, type CellRendererParams, type CellStyleRule, type CellValueChangedEvent, type ColDef, type ColDefGroup, type ColDefOrGroup, Column, type ColumnFilter, type ColumnHelper, type ColumnLayoutMode, type ColumnMovedEvent, type ColumnResizedEvent, type ColumnState, type ColumnStateKeyParts, type ColumnStateStorage, type ColumnStateStore, type ColumnVisibilityChangedEvent, type ColumnWorkbenchItem, type ContextMenuItem, type ContextMenuParams, type CsvExportParams, DEFAULT_LOCALE, DIRECT_GRID_OPTION_KEYS, type DateFilterCondition, type DateFilterMatch, type DetailRowRendererParams, type DetailToggledEvent, type DictionaryEntry, type DictionaryKey, type DictionaryRendererOptions, type DirtyStateChangedEvent, EVENT_TYPES, type EditableIndicator, type EditableParams, EventBus, type EventHandlers, type FieldPath, type FieldPathValue, type FilterChangedEvent, type FilterModel, type FilterType, GRID_OPTION_KEYS, GRID_OPTION_META, GRID_SIZE_PRESETS, type GetRowHeightParams, type GetRowIdParams, type GridApi, type GridCellChange, type GridCellRange, type GridChange, type GridComponents, GridCore, type GridDatasource, type GridDiagnosticError, type GridDiagnostics, type GridEditType, type GridErrorCode, type GridErrorEvent, type GridEventBase, type GridEventMap, type GridEventType, type GridFeature, type GridFeatureContext, type GridOptionKey, type GridOptionMetadata, type GridOptionUpdateMode, type GridOptionValueKind, type GridOptions, type GridReadyEvent, type GridSchema, type GridSchemaField, type GridSchemaFieldType, type GridSchemaGroup, type GridSize, type GridSizePreset, type GridState, type GridStateSection, type GridValidationCode, type GridValidationIssue, type HeaderComponentParams, type ICellEditor, type ICellRendererResult, type ImportCsvOptions, type InfiniteGetRowsParams, LOCALE_EN, type LocalColumnStateStoreOptions, type ManagedColumnStateStore, type ModelUpdatedEvent, type NumberFilterCondition, type NumberFilterMatch, type OverlayContent, type OverlayTemplate, type PaginationChangedEvent, type PaginationConfig, type PinnedDirection, type PrintOptions, type ProgressConfig, type RangeSelectionChangedEvent, type ResolvedGridOptions, type RgLocale, type RgLocaleKey, type RowActionsConfig, type RowClickEvent, type RowDragEndEvent, type RowEditChange, type RowEditValidationParams, type RowEditValidationResult, type RowEditingStartedEvent, type RowEditingStoppedEvent, type RowNode, type RowSelectionMode, type RowTransaction, type SaveChangesHandler, type SaveChangesResult, type SchemaSelectOption, type SelectEditorParams, type SelectionChangedEvent, type SetFilterCondition, type SetFilterParams, type SortChangedEvent, type SortDirection, type SortModel, type SortModelItem, type StatusBarConfig, type StatusBarPanel, type StatusTagConfig, type StoredColumnState, type TagVariant, type TextFilterCondition, type TextFilterMatch, type ThemeMode, type TooltipParams, type TreeChildrenLoadFailedEvent, type TreeChildrenLoadedEvent, type TreeDataLoadParams, type ValueFormatterParams, type ValueGetterParams, type ValueSetterParams, type WatermarkConfig, type WidthInput, actionsColumn, buildColDefsFromSchema, clearColumnState, clearComponentRegistries, computeColumnWidths, createActionButtonsRenderer, createAggResolver, createBusinessColumnTypes, createCachedDictionary, createColumnHelper, createColumnStateKey, createDictionaryRenderer, createEnterprisePreset, createGrid, createLocalColumnStateStore, createMachTablePreset, createProgressBarRenderer, createRowActionsRenderer, createStatusTagRenderer, defaultComparator, defineColumns, defineGridOptions, defineMachTablePreset, describeFilter, downloadFile, dragColumn, escapeHtml, evaluateColumnFilter, fitColumnWidths, formatText, formatTwo, getByPath, getCellEditor, getCellRenderer, indexColumn, isColDefGroup, isSafePath, linkRenderer, loadColumnState, matchLocaleKey, parseCsv, parseDelimited, parseTsv, registerBuiltinRenderers, registerCellEditor, registerCellRenderer, resolveTagVariant, rowActionsColumn, sanitizeFormulaCell, saveColumnState, selectionColumn, setByPath, sortNodes, toTsv, validateGridOptions, version };
|