@agile-team/mach-table 0.5.0 → 0.14.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 +62 -3
- package/dist/index.cjs +6 -8873
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +815 -60
- package/dist/index.d.ts +815 -60
- package/dist/index.js +6 -8795
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/styles/mach-table.css +517 -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: {
|
|
@@ -257,6 +303,15 @@ declare const DEFAULT_LOCALE: {
|
|
|
257
303
|
readonly pagePrev: "上一页";
|
|
258
304
|
readonly pageNext: "下一页";
|
|
259
305
|
readonly pageLast: "末页";
|
|
306
|
+
readonly requestFailed: "数据加载失败";
|
|
307
|
+
readonly requestFailedHint: "请检查网络后重试";
|
|
308
|
+
readonly actionView: "查看";
|
|
309
|
+
readonly actionEdit: "编辑";
|
|
310
|
+
readonly actionDelete: "删除";
|
|
311
|
+
readonly actionConfirm: "确认";
|
|
312
|
+
readonly actionSave: "保存";
|
|
313
|
+
readonly actionCancel: "取消";
|
|
314
|
+
readonly actionMore: "更多操作";
|
|
260
315
|
};
|
|
261
316
|
type RgLocaleKey = keyof typeof DEFAULT_LOCALE;
|
|
262
317
|
type RgLocale = Partial<Record<RgLocaleKey, string>>;
|
|
@@ -265,10 +320,56 @@ declare function matchLocaleKey(match: string): RgLocaleKey;
|
|
|
265
320
|
declare function formatText(template: string, n: number | string): string;
|
|
266
321
|
declare function formatTwo(template: string, a: number | string, b: number | string): string;
|
|
267
322
|
|
|
323
|
+
/** Serializable snapshot of user-visible grid state. */
|
|
324
|
+
interface GridState {
|
|
325
|
+
/** State schema version, independent from the package version. */
|
|
326
|
+
version: 1;
|
|
327
|
+
columns: ColumnState[];
|
|
328
|
+
sortModel: SortModel;
|
|
329
|
+
filterModel: FilterModel;
|
|
330
|
+
quickFilterText: string | null;
|
|
331
|
+
pagination: {
|
|
332
|
+
enabled: boolean;
|
|
333
|
+
page: number;
|
|
334
|
+
pageSize: number;
|
|
335
|
+
};
|
|
336
|
+
selectedRowIds: string[];
|
|
337
|
+
expandedRowIds: string[];
|
|
338
|
+
expandedGroupIds: string[];
|
|
339
|
+
}
|
|
340
|
+
type GridStateSection = "columns" | "sort" | "filter" | "pagination" | "selection" | "expansion";
|
|
341
|
+
interface ApplyGridStateOptions {
|
|
342
|
+
/** Applies all sections when omitted. */
|
|
343
|
+
sections?: readonly GridStateSection[];
|
|
344
|
+
/** Emit the standard sort/filter/pagination events after restoration. */
|
|
345
|
+
emitEvents?: boolean;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
type Callable = (...args: never[]) => unknown;
|
|
349
|
+
type Primitive = string | number | boolean | bigint | symbol | null | undefined | Date | Callable;
|
|
350
|
+
type Depth = 0 | 1 | 2 | 3 | 4;
|
|
351
|
+
type Previous = {
|
|
352
|
+
0: 0;
|
|
353
|
+
1: 0;
|
|
354
|
+
2: 1;
|
|
355
|
+
3: 2;
|
|
356
|
+
4: 3;
|
|
357
|
+
};
|
|
358
|
+
/** Dot-separated path to a serializable field, capped to keep editor inference fast. */
|
|
359
|
+
type FieldPath<T, D extends Depth = 4> = D extends 0 ? never : T extends Primitive ? never : {
|
|
360
|
+
[K in keyof T & string]: NonNullable<T[K]> extends Primitive | readonly unknown[] ? K : K | `${K}.${FieldPath<NonNullable<T[K]>, Previous[D]>}`;
|
|
361
|
+
}[keyof T & string];
|
|
362
|
+
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;
|
|
363
|
+
|
|
268
364
|
interface ColumnStateStore {
|
|
269
365
|
load(key: string): ColumnState[] | null | Promise<ColumnState[] | null>;
|
|
270
366
|
save(key: string, state: ColumnState[]): void | Promise<void>;
|
|
271
367
|
}
|
|
368
|
+
interface GridStateStore {
|
|
369
|
+
load(key: string): GridState | null | Promise<GridState | null>;
|
|
370
|
+
save(key: string, state: GridState): void | Promise<void>;
|
|
371
|
+
clear?(key: string): void | Promise<void>;
|
|
372
|
+
}
|
|
272
373
|
/** Per-grid component overrides. These take precedence over the global registry. */
|
|
273
374
|
interface GridComponents {
|
|
274
375
|
cellRenderers?: Readonly<Record<string, CellRendererFn>>;
|
|
@@ -279,6 +380,11 @@ interface GridFeatureContext<TData = any> {
|
|
|
279
380
|
readonly root: HTMLElement;
|
|
280
381
|
getOptions(): Readonly<ResolvedGridOptions<TData>>;
|
|
281
382
|
addEventListener<K extends keyof GridEventMap<TData>>(type: K, listener: (event: GridEventMap<TData>[K]) => void): () => void;
|
|
383
|
+
/** Registers cleanup even when setup later throws or the feature is hot-replaced. */
|
|
384
|
+
onCleanup(cleanup: () => void): void;
|
|
385
|
+
addManagedDomListener(target: EventTarget, type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
386
|
+
setManagedTimeout(handler: () => void, delayMs: number): ReturnType<typeof setTimeout>;
|
|
387
|
+
createAbortController(): AbortController;
|
|
282
388
|
reportError(error: unknown, source: string, context?: Record<string, unknown>): void;
|
|
283
389
|
}
|
|
284
390
|
/** Composable extension point; feature instances are scoped to one grid. */
|
|
@@ -291,7 +397,8 @@ interface GridFeature<TData = any> {
|
|
|
291
397
|
* Safe overlay content. Strings render as text unless
|
|
292
398
|
* `allowUnsafeOverlayHtml` is explicitly enabled.
|
|
293
399
|
*/
|
|
294
|
-
type
|
|
400
|
+
type OverlayContent = string | HTMLElement | ICellRendererResult;
|
|
401
|
+
type OverlayTemplate = OverlayContent | (() => OverlayContent);
|
|
295
402
|
type StatusBarPanel = "rowCount" | "selectedRowCount" | "rangeAggregate";
|
|
296
403
|
interface StatusBarConfig {
|
|
297
404
|
panels?: StatusBarPanel[];
|
|
@@ -314,13 +421,38 @@ type EventHandlers<TData = any> = {
|
|
|
314
421
|
};
|
|
315
422
|
type RowSelectionMode = "none" | "single" | "multiple";
|
|
316
423
|
type GridSize = "compact" | "normal" | "large";
|
|
424
|
+
type ColumnLayoutMode = "normal" | "fit";
|
|
425
|
+
type DomLayoutMode = "normal" | "autoHeight";
|
|
317
426
|
type ThemeMode = "light" | "dark" | "auto";
|
|
427
|
+
type GridEditType = "cell" | "fullRow";
|
|
428
|
+
type EditableIndicator = "hover" | "always" | "none";
|
|
429
|
+
interface RowEditValidationParams<TData = any> {
|
|
430
|
+
data: TData;
|
|
431
|
+
node: RowNode<TData>;
|
|
432
|
+
/** Draft values keyed by colId, including unchanged editable cells. */
|
|
433
|
+
values: Readonly<Record<string, unknown>>;
|
|
434
|
+
changes: readonly RowEditChange[];
|
|
435
|
+
api: GridApi<TData>;
|
|
436
|
+
}
|
|
437
|
+
type RowEditValidationResult = true | null | undefined | string | Readonly<Record<string, string>>;
|
|
318
438
|
interface DetailRowRendererParams<TData = any> {
|
|
319
439
|
data: TData | null;
|
|
320
440
|
node: RowNode<TData>;
|
|
321
441
|
api: GridApi<TData>;
|
|
322
442
|
}
|
|
443
|
+
interface TreeDataLoadParams<TData = any> {
|
|
444
|
+
data: TData;
|
|
445
|
+
node: RowNode<TData>;
|
|
446
|
+
api: GridApi<TData>;
|
|
447
|
+
signal: AbortSignal;
|
|
448
|
+
}
|
|
323
449
|
interface PaginationConfig {
|
|
450
|
+
/** `server` displays the supplied page as-is and uses `total` for navigation. */
|
|
451
|
+
mode?: "client" | "server";
|
|
452
|
+
/** Controlled current page for server mode. */
|
|
453
|
+
page?: number;
|
|
454
|
+
/** Total rows across all server pages. */
|
|
455
|
+
total?: number;
|
|
324
456
|
pageSize?: number;
|
|
325
457
|
pageSizeOptions?: number[];
|
|
326
458
|
showTotal?: boolean;
|
|
@@ -334,14 +466,38 @@ interface WatermarkConfig {
|
|
|
334
466
|
gap?: number;
|
|
335
467
|
angle?: number;
|
|
336
468
|
}
|
|
469
|
+
interface ActionPolicyContext<TData = any> {
|
|
470
|
+
/** Stable business action identifier, for example `order.delete`. */
|
|
471
|
+
actionId?: string;
|
|
472
|
+
permissions: readonly string[];
|
|
473
|
+
message?: string;
|
|
474
|
+
params: CellRendererParams<TData>;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Application-wide UI action policy. This centralises permission, confirmation
|
|
478
|
+
* and error handling while the backend remains the final security boundary.
|
|
479
|
+
*/
|
|
480
|
+
interface ActionPolicy<TData = any> {
|
|
481
|
+
canAccess?(context: ActionPolicyContext<TData>): boolean;
|
|
482
|
+
confirm?(context: ActionPolicyContext<TData>): boolean | Promise<boolean>;
|
|
483
|
+
onError?(error: unknown, context: ActionPolicyContext<TData>): void;
|
|
484
|
+
}
|
|
337
485
|
interface GridOptions<TData = any> extends EventHandlers<TData> {
|
|
338
486
|
columnDefs?: (ColDef<TData> | ColDefGroup<TData>)[] | null;
|
|
339
487
|
rowData?: TData[] | null;
|
|
340
488
|
defaultColDef?: Partial<ColDef<TData>>;
|
|
489
|
+
/** Reusable semantic column definitions referenced through `colDef.type`. */
|
|
490
|
+
columnTypes?: Readonly<Record<string, Partial<ColDef<TData>>>>;
|
|
341
491
|
getRowId?: (params: GetRowIdParams<TData>) => string;
|
|
492
|
+
/** Stable business key shorthand. `getRowId` takes precedence when both are set. */
|
|
493
|
+
rowKey?: FieldPath<TData> | ((row: TData) => string | number);
|
|
342
494
|
rowHeight?: number;
|
|
343
495
|
headerHeight?: number;
|
|
344
496
|
rowBuffer?: number;
|
|
497
|
+
/** `fit` continuously fills the container without grid-ready glue code. */
|
|
498
|
+
columnLayout?: ColumnLayoutMode;
|
|
499
|
+
/** Lets small grids grow with their rows. Avoid for large or infinite datasets. */
|
|
500
|
+
domLayout?: DomLayoutMode;
|
|
345
501
|
rowSelection?: RowSelectionMode;
|
|
346
502
|
multiSort?: boolean;
|
|
347
503
|
size?: GridSize;
|
|
@@ -359,8 +515,22 @@ interface GridOptions<TData = any> extends EventHandlers<TData> {
|
|
|
359
515
|
columnStateStore?: ColumnStateStore;
|
|
360
516
|
aggFuncs?: Record<string, (values: any[]) => any>;
|
|
361
517
|
components?: GridComponents;
|
|
518
|
+
/** Shared policy consumed by action column helpers. */
|
|
519
|
+
actionPolicy?: ActionPolicy<TData>;
|
|
362
520
|
features?: readonly GridFeature<TData>[];
|
|
521
|
+
/** State restored atomically after columns and initial rows are available. */
|
|
522
|
+
initialState?: GridState;
|
|
523
|
+
/** Persist the complete user-visible GridState with a versioned store. */
|
|
524
|
+
stateKey?: string | null;
|
|
525
|
+
stateStore?: GridStateStore;
|
|
526
|
+
stateSaveDebounceMs?: number;
|
|
363
527
|
locale?: RgLocale;
|
|
528
|
+
/** Cell editing is isolated; fullRow stages every editable cell and commits them together. */
|
|
529
|
+
editType?: GridEditType;
|
|
530
|
+
/** Visibility of the subtle pencil affordance on editable cells. */
|
|
531
|
+
editableIndicator?: EditableIndicator;
|
|
532
|
+
/** Cross-field full-row validation. Return a message or a colId -> message map. */
|
|
533
|
+
rowEditValidator?: (params: RowEditValidationParams<TData>) => RowEditValidationResult | Promise<RowEditValidationResult>;
|
|
364
534
|
singleClickEdit?: boolean;
|
|
365
535
|
manualSorting?: boolean;
|
|
366
536
|
manualFiltering?: boolean;
|
|
@@ -372,11 +542,17 @@ interface GridOptions<TData = any> extends EventHandlers<TData> {
|
|
|
372
542
|
}) => string;
|
|
373
543
|
treeData?: boolean;
|
|
374
544
|
childrenKey?: string;
|
|
545
|
+
/** Marks rows that can load children even when `childrenKey` is currently empty. */
|
|
546
|
+
isTreeRowExpandable?: (params: Omit<TreeDataLoadParams<TData>, "signal">) => boolean;
|
|
547
|
+
/** Loads children once on first expansion; use the API retry/force methods to reload. */
|
|
548
|
+
loadTreeChildren?: (params: TreeDataLoadParams<TData>) => Promise<readonly TData[]>;
|
|
375
549
|
autoCheckedChildren?: boolean;
|
|
376
550
|
defaultExpandAll?: boolean;
|
|
377
551
|
indexOffset?: number;
|
|
378
552
|
applyRowDrag?: boolean;
|
|
379
553
|
undoStackSize?: number;
|
|
554
|
+
/** Milliseconds used to coalesce applyTransactionAsync calls. */
|
|
555
|
+
asyncTransactionWaitMillis?: number;
|
|
380
556
|
getRowHeight?: (params: GetRowHeightParams<TData>) => number;
|
|
381
557
|
pinnedTopRowData?: TData[] | null;
|
|
382
558
|
pinnedBottomRowData?: TData[] | null;
|
|
@@ -395,13 +571,26 @@ interface GridOptions<TData = any> extends EventHandlers<TData> {
|
|
|
395
571
|
datasource?: GridDatasource<TData>;
|
|
396
572
|
blockSize?: number;
|
|
397
573
|
infiniteBufferRows?: number;
|
|
574
|
+
/** Number of automatic retries after an infinite datasource request fails. */
|
|
575
|
+
datasourceRetryCount?: number;
|
|
576
|
+
/** Base retry delay in milliseconds. Retries use capped exponential backoff. */
|
|
577
|
+
datasourceRetryDelay?: number;
|
|
398
578
|
suppressCellFocus?: boolean;
|
|
399
579
|
suppressRowHoverHighlight?: boolean;
|
|
400
580
|
suppressNoRowsOverlay?: boolean;
|
|
401
581
|
suppressHeaderFocus?: boolean;
|
|
582
|
+
/** Accessible name applied to the element with role="grid"/"treegrid". */
|
|
583
|
+
ariaLabel?: string;
|
|
584
|
+
/** ID of an external element that labels the grid. Takes precedence over ariaLabel. */
|
|
585
|
+
ariaLabelledBy?: string;
|
|
586
|
+
/** ID of an external element that provides additional grid instructions. */
|
|
587
|
+
ariaDescribedBy?: string;
|
|
402
588
|
loading?: boolean;
|
|
589
|
+
/** Non-null errors take precedence over the empty state and remain retryable by the host. */
|
|
590
|
+
error?: unknown | null;
|
|
403
591
|
overlayNoRowsTemplate?: OverlayTemplate;
|
|
404
592
|
overlayLoadingTemplate?: OverlayTemplate;
|
|
593
|
+
overlayErrorTemplate?: OverlayTemplate;
|
|
405
594
|
/** Opt in only for trusted overlay strings. Prefer HTMLElement factories. */
|
|
406
595
|
allowUnsafeOverlayHtml?: boolean;
|
|
407
596
|
className?: string;
|
|
@@ -410,10 +599,14 @@ interface ResolvedGridOptions<TData = any> extends EventHandlers<TData> {
|
|
|
410
599
|
columnDefs: (ColDef<TData> | ColDefGroup<TData>)[];
|
|
411
600
|
rowData: TData[];
|
|
412
601
|
defaultColDef: Partial<ColDef<TData>>;
|
|
602
|
+
columnTypes: Readonly<Record<string, Partial<ColDef<TData>>>>;
|
|
413
603
|
getRowId?: (params: GetRowIdParams<TData>) => string;
|
|
604
|
+
rowKey?: FieldPath<TData> | ((row: TData) => string | number);
|
|
414
605
|
rowHeight: number;
|
|
415
606
|
headerHeight: number;
|
|
416
607
|
rowBuffer: number;
|
|
608
|
+
columnLayout: ColumnLayoutMode;
|
|
609
|
+
domLayout: DomLayoutMode;
|
|
417
610
|
rowSelection: RowSelectionMode;
|
|
418
611
|
multiSort: boolean;
|
|
419
612
|
size: GridSize;
|
|
@@ -431,8 +624,16 @@ interface ResolvedGridOptions<TData = any> extends EventHandlers<TData> {
|
|
|
431
624
|
columnStateStore?: ColumnStateStore;
|
|
432
625
|
aggFuncs?: Record<string, (values: any[]) => any>;
|
|
433
626
|
components?: GridComponents;
|
|
627
|
+
actionPolicy?: ActionPolicy<TData>;
|
|
434
628
|
features: readonly GridFeature<TData>[];
|
|
629
|
+
initialState?: GridState;
|
|
630
|
+
stateKey: string | null;
|
|
631
|
+
stateStore?: GridStateStore;
|
|
632
|
+
stateSaveDebounceMs: number;
|
|
435
633
|
locale: RgLocale;
|
|
634
|
+
editType: GridEditType;
|
|
635
|
+
editableIndicator: EditableIndicator;
|
|
636
|
+
rowEditValidator?: (params: RowEditValidationParams<TData>) => RowEditValidationResult | Promise<RowEditValidationResult>;
|
|
436
637
|
singleClickEdit: boolean;
|
|
437
638
|
manualSorting: boolean;
|
|
438
639
|
manualFiltering: boolean;
|
|
@@ -444,15 +645,21 @@ interface ResolvedGridOptions<TData = any> extends EventHandlers<TData> {
|
|
|
444
645
|
}) => string;
|
|
445
646
|
treeData: boolean;
|
|
446
647
|
childrenKey: string;
|
|
648
|
+
isTreeRowExpandable?: (params: Omit<TreeDataLoadParams<TData>, "signal">) => boolean;
|
|
649
|
+
loadTreeChildren?: (params: TreeDataLoadParams<TData>) => Promise<readonly TData[]>;
|
|
447
650
|
autoCheckedChildren: boolean;
|
|
448
651
|
defaultExpandAll: boolean;
|
|
449
652
|
indexOffset: number;
|
|
450
653
|
applyRowDrag: boolean;
|
|
451
654
|
undoStackSize: number;
|
|
655
|
+
asyncTransactionWaitMillis: number;
|
|
452
656
|
getRowHeight?: (params: GetRowHeightParams<TData>) => number;
|
|
453
657
|
pinnedTopRowData: TData[];
|
|
454
658
|
pinnedBottomRowData: TData[];
|
|
455
659
|
paginationEnabled: boolean;
|
|
660
|
+
paginationMode: "client" | "server";
|
|
661
|
+
paginationPage: number;
|
|
662
|
+
paginationTotal: number;
|
|
456
663
|
paginationPageSize: number;
|
|
457
664
|
paginationPageSizeOptions: number[];
|
|
458
665
|
paginationShowTotal: boolean;
|
|
@@ -473,13 +680,20 @@ interface ResolvedGridOptions<TData = any> extends EventHandlers<TData> {
|
|
|
473
680
|
datasource?: GridDatasource<TData>;
|
|
474
681
|
blockSize: number;
|
|
475
682
|
infiniteBufferRows: number;
|
|
683
|
+
datasourceRetryCount: number;
|
|
684
|
+
datasourceRetryDelay: number;
|
|
476
685
|
suppressCellFocus: boolean;
|
|
477
686
|
suppressRowHoverHighlight: boolean;
|
|
478
687
|
suppressNoRowsOverlay: boolean;
|
|
479
688
|
suppressHeaderFocus: boolean;
|
|
689
|
+
ariaLabel: string;
|
|
690
|
+
ariaLabelledBy: string;
|
|
691
|
+
ariaDescribedBy: string;
|
|
480
692
|
loading: boolean;
|
|
693
|
+
error: unknown | null;
|
|
481
694
|
overlayNoRowsTemplate: OverlayTemplate;
|
|
482
695
|
overlayLoadingTemplate: OverlayTemplate;
|
|
696
|
+
overlayErrorTemplate: OverlayTemplate;
|
|
483
697
|
allowUnsafeOverlayHtml: boolean;
|
|
484
698
|
className: string;
|
|
485
699
|
}
|
|
@@ -515,9 +729,65 @@ interface RowTransaction<TData = any> {
|
|
|
515
729
|
remove?: TData[];
|
|
516
730
|
update?: TData[];
|
|
517
731
|
}
|
|
732
|
+
interface GridCellChange {
|
|
733
|
+
colId: string;
|
|
734
|
+
originalValue: unknown;
|
|
735
|
+
value: unknown;
|
|
736
|
+
}
|
|
737
|
+
interface GridChange<TData = any> {
|
|
738
|
+
rowId: string;
|
|
739
|
+
data: TData;
|
|
740
|
+
cells: GridCellChange[];
|
|
741
|
+
}
|
|
742
|
+
interface GridDiagnosticError {
|
|
743
|
+
code: GridErrorCode;
|
|
744
|
+
source: string;
|
|
745
|
+
message: string;
|
|
746
|
+
timestamp: number;
|
|
747
|
+
context?: Record<string, unknown>;
|
|
748
|
+
}
|
|
749
|
+
interface ColumnWorkbenchItem {
|
|
750
|
+
colId: string;
|
|
751
|
+
label: string;
|
|
752
|
+
visible: boolean;
|
|
753
|
+
pinned: "left" | "right" | null;
|
|
754
|
+
width: number;
|
|
755
|
+
movable: boolean;
|
|
756
|
+
hideable: boolean;
|
|
757
|
+
}
|
|
758
|
+
interface GridDiagnostics {
|
|
759
|
+
gridId: number;
|
|
760
|
+
version: string;
|
|
761
|
+
destroyed: boolean;
|
|
762
|
+
infinite: boolean;
|
|
763
|
+
loading: boolean;
|
|
764
|
+
rowCount: number;
|
|
765
|
+
renderedRowCount: number;
|
|
766
|
+
columnCount: number;
|
|
767
|
+
selectedRowCount: number;
|
|
768
|
+
dirtyRowCount: number;
|
|
769
|
+
recentErrors: readonly GridDiagnosticError[];
|
|
770
|
+
}
|
|
771
|
+
interface SaveChangesResult {
|
|
772
|
+
/** Omit to acknowledge every submitted row; return a subset for partial batch success. */
|
|
773
|
+
savedRowIds?: readonly string[];
|
|
774
|
+
}
|
|
775
|
+
type SaveChangesHandler<TData = any> = (changes: readonly GridChange<TData>[]) => void | SaveChangesResult | Promise<void | SaveChangesResult>;
|
|
518
776
|
interface GridApi<TData = any> {
|
|
777
|
+
/** Resolves after the first layout frame and gridReady emission. */
|
|
778
|
+
whenReady(): Promise<GridApi<TData>>;
|
|
779
|
+
/** Stable grid root for portals, measurements and fullscreen targets; null after destroy. */
|
|
780
|
+
getRootElement(): HTMLElement | null;
|
|
781
|
+
/** Reads the currently resolved value after application, preset and table overrides. */
|
|
782
|
+
getGridOption<K extends keyof GridOptions<TData>>(key: K): GridOptions<TData>[K];
|
|
783
|
+
/** Typed shorthand for updating one runtime option. */
|
|
784
|
+
setGridOption<K extends keyof GridOptions<TData>>(key: K, value: GridOptions<TData>[K]): void;
|
|
519
785
|
setRowData(rows: TData[] | null | undefined): void;
|
|
520
786
|
applyTransaction(transaction: RowTransaction<TData>): void;
|
|
787
|
+
/** Coalesces rapid transactions and refreshes the row pipeline once per batch. */
|
|
788
|
+
applyTransactionAsync(transaction: RowTransaction<TData>): Promise<void>;
|
|
789
|
+
/** Immediately applies transactions currently waiting in the async queue. */
|
|
790
|
+
flushAsyncTransactions(): void;
|
|
521
791
|
getColumnDefs(): (ColDef<TData> | ColDefGroup<TData>)[] | null;
|
|
522
792
|
setColumnDefs(colDefs: (ColDef<TData> | ColDefGroup<TData>)[] | null | undefined): void;
|
|
523
793
|
getColumnState(): ColumnState[];
|
|
@@ -555,6 +825,12 @@ interface GridApi<TData = any> {
|
|
|
555
825
|
isRowExpanded(rowId: string): boolean;
|
|
556
826
|
expandAllDetails(): void;
|
|
557
827
|
collapseAllDetails(): void;
|
|
828
|
+
/** Loads and caches lazy tree children. Concurrent calls for one row are deduplicated. */
|
|
829
|
+
loadTreeChildren(rowId: string, options?: {
|
|
830
|
+
force?: boolean;
|
|
831
|
+
}): Promise<readonly TData[]>;
|
|
832
|
+
retryTreeChildren(rowId: string): Promise<readonly TData[]>;
|
|
833
|
+
isTreeRowLoading(rowId: string): boolean;
|
|
558
834
|
toggleRowGroup(groupId: string): boolean;
|
|
559
835
|
isGroupExpanded(groupId: string): boolean;
|
|
560
836
|
expandAllGroups(): void;
|
|
@@ -567,6 +843,12 @@ interface GridApi<TData = any> {
|
|
|
567
843
|
redo(): boolean;
|
|
568
844
|
canUndo(): boolean;
|
|
569
845
|
canRedo(): boolean;
|
|
846
|
+
getDirtyRowIds(): string[];
|
|
847
|
+
getChanges(): GridChange<TData>[];
|
|
848
|
+
markChangesSaved(rowIds?: readonly string[]): void;
|
|
849
|
+
/** Saves a stable snapshot; supports partial success and preserves edits made in flight. */
|
|
850
|
+
saveChanges(handler: SaveChangesHandler<TData>, rowIds?: readonly string[]): Promise<GridChange<TData>[]>;
|
|
851
|
+
rollbackChanges(rowIds?: readonly string[]): boolean;
|
|
570
852
|
setPinnedTopRowData(rows: TData[] | null): void;
|
|
571
853
|
getPinnedTopRowData(): TData[];
|
|
572
854
|
setPinnedBottomRowData(rows: TData[] | null): void;
|
|
@@ -574,6 +856,11 @@ interface GridApi<TData = any> {
|
|
|
574
856
|
getRangeSelection(): GridCellRange | null;
|
|
575
857
|
clearRangeSelection(): void;
|
|
576
858
|
copyRangeToClipboard(): Promise<boolean>;
|
|
859
|
+
/** Opens the built-in searchable column workbench. */
|
|
860
|
+
openColumnWorkbench(anchor?: HTMLElement): void;
|
|
861
|
+
closeColumnWorkbench(): void;
|
|
862
|
+
getColumnWorkbenchItems(): ColumnWorkbenchItem[];
|
|
863
|
+
/** @deprecated Use openColumnWorkbench. Kept during the 0.x compatibility window. */
|
|
577
864
|
openColumnPanel(anchor?: HTMLElement): void;
|
|
578
865
|
refreshLayout(): void;
|
|
579
866
|
isInfinite(): boolean;
|
|
@@ -593,11 +880,23 @@ interface GridApi<TData = any> {
|
|
|
593
880
|
colId: string;
|
|
594
881
|
keyPress?: string;
|
|
595
882
|
}): boolean;
|
|
883
|
+
/** Starts staged editing for every editable cell in one displayed row. */
|
|
884
|
+
startEditingRow(rowIndex: number): boolean;
|
|
885
|
+
/** Returns whether any row, or the requested displayed row, is in full-row edit mode. */
|
|
886
|
+
isRowEditing(rowIndex?: number): boolean;
|
|
596
887
|
stopEditing(cancel?: boolean): void;
|
|
888
|
+
/** Stops editing and resolves after synchronous or asynchronous validation. */
|
|
889
|
+
stopEditingAsync(cancel?: boolean): Promise<boolean>;
|
|
890
|
+
/** Explicit full-row counterpart; aliases stopEditingAsync when a row is active. */
|
|
891
|
+
stopEditingRow(cancel?: boolean): Promise<boolean>;
|
|
597
892
|
refreshCells(): void;
|
|
598
893
|
updateOptions(options: Partial<GridOptions<TData>>): void;
|
|
599
894
|
getDataAsCsv(params?: CsvExportParams): string;
|
|
600
|
-
|
|
895
|
+
getState(): GridState;
|
|
896
|
+
applyState(state: GridState, options?: ApplyGridStateOptions): void;
|
|
897
|
+
/** Lightweight runtime snapshot suitable for support logs and health panels. */
|
|
898
|
+
getDiagnostics(): GridDiagnostics;
|
|
899
|
+
setOverlay(type: "loading" | "noRows" | "error" | null): void;
|
|
601
900
|
hideOverlays(): void;
|
|
602
901
|
addEventListener<K extends GridEventType>(eventType: K, listener: (event: GridEventMap<TData>[K]) => void): () => void;
|
|
603
902
|
removeEventListener<K extends GridEventType>(eventType: K, listener: (event: GridEventMap<TData>[K]) => void): void;
|
|
@@ -770,6 +1069,8 @@ interface ColDef<TData = any, TValue = any> {
|
|
|
770
1069
|
minWidth?: number;
|
|
771
1070
|
maxWidth?: number;
|
|
772
1071
|
flex?: number;
|
|
1072
|
+
/** Excludes the column from `columnLayout: "fit"` scaling. */
|
|
1073
|
+
suppressSizeToFit?: boolean;
|
|
773
1074
|
hide?: boolean;
|
|
774
1075
|
pinned?: PinnedDirection | boolean;
|
|
775
1076
|
sortable?: boolean;
|
|
@@ -792,7 +1093,7 @@ interface ColDef<TData = any, TValue = any> {
|
|
|
792
1093
|
autoRowSpan?: boolean;
|
|
793
1094
|
colSpan?: (params: CellClassParams<TData, TValue>) => number;
|
|
794
1095
|
autoHeight?: boolean;
|
|
795
|
-
validate?: (newValue: TValue, params: ValueSetterParams<TData, TValue>) => string | true | null | undefined
|
|
1096
|
+
validate?: (newValue: TValue, params: ValueSetterParams<TData, TValue>) => string | true | null | undefined | Promise<string | true | null | undefined>;
|
|
796
1097
|
rowDrag?: boolean;
|
|
797
1098
|
valueGetter?: (params: ValueGetterParams<TData, TValue>) => TValue;
|
|
798
1099
|
valueSetter?: (params: ValueSetterParams<TData, TValue>) => boolean;
|
|
@@ -801,7 +1102,8 @@ interface ColDef<TData = any, TValue = any> {
|
|
|
801
1102
|
cellRendererParams?: Record<string, any>;
|
|
802
1103
|
cellClass?: CellClassRule;
|
|
803
1104
|
comparator?: (valueA: any, valueB: any, nodeA: RowNode<TData>, nodeB: RowNode<TData>) => number;
|
|
804
|
-
type
|
|
1105
|
+
/** Named column type(s), resolved left-to-right before this column definition. */
|
|
1106
|
+
type?: string | readonly string[];
|
|
805
1107
|
initialSort?: SortDirection;
|
|
806
1108
|
onCellClick?: (event: CellClickEvent<TData, TValue>) => void;
|
|
807
1109
|
onCellDoubleClick?: (event: CellDoubleClickEvent<TData, TValue>) => void;
|
|
@@ -884,7 +1186,7 @@ declare class ColumnModel {
|
|
|
884
1186
|
cycleSort(column: Column, additive: boolean): void;
|
|
885
1187
|
}
|
|
886
1188
|
|
|
887
|
-
type RowModelContext = Pick<GridCore<any>, "bodyRenderer" | "columnModel" | "emit" | "getApi" | "getCellValue" | "getLocaleText" | "headerRenderer" | "isDestroyed" | "nextId" | "options" | "relayout" | "reportError" | "selectionService" | "skeleton" | "undoService">;
|
|
1189
|
+
type RowModelContext = Pick<GridCore<any>, "bodyRenderer" | "changeTracker" | "columnModel" | "emit" | "getApi" | "getCellValue" | "getLocaleText" | "headerRenderer" | "isDestroyed" | "nextId" | "options" | "relayout" | "reportError" | "selectionService" | "skeleton" | "undoService">;
|
|
888
1190
|
declare class RowModel<TData = any> {
|
|
889
1191
|
private core;
|
|
890
1192
|
private all;
|
|
@@ -904,9 +1206,12 @@ declare class RowModel<TData = any> {
|
|
|
904
1206
|
private infiniteLoading;
|
|
905
1207
|
private infiniteSeq;
|
|
906
1208
|
private infiniteAbort;
|
|
1209
|
+
private infiniteRetryTimer;
|
|
907
1210
|
private infinitePendingResolve;
|
|
908
1211
|
private treeDepth;
|
|
909
1212
|
private rowSequence;
|
|
1213
|
+
private treeLoadControllers;
|
|
1214
|
+
private treeLoadPromises;
|
|
910
1215
|
constructor(core: RowModelContext);
|
|
911
1216
|
resolveRowId(data: TData, index: number, fallback: string): string;
|
|
912
1217
|
get isTree(): boolean;
|
|
@@ -927,7 +1232,13 @@ declare class RowModel<TData = any> {
|
|
|
927
1232
|
getChildrenIds(id: string): string[];
|
|
928
1233
|
getChildrenCount(id: string): number;
|
|
929
1234
|
hasChildren(id: string): boolean;
|
|
930
|
-
|
|
1235
|
+
isTreeRowLoading(id: string): boolean;
|
|
1236
|
+
private cancelTreeLoads;
|
|
1237
|
+
loadTreeChildren(id: string, force?: boolean): Promise<readonly TData[]>;
|
|
1238
|
+
private replaceTreeChildren;
|
|
1239
|
+
private validateTreeChildren;
|
|
1240
|
+
applyTransaction(transaction: RowTransaction<TData>, refresh?: boolean): void;
|
|
1241
|
+
applyTransactions(transactions: readonly RowTransaction<TData>[]): void;
|
|
931
1242
|
private buildChildNodes;
|
|
932
1243
|
private reindexAll;
|
|
933
1244
|
setFilterModel(filterModel: FilterModel | null): boolean;
|
|
@@ -948,6 +1259,7 @@ declare class RowModel<TData = any> {
|
|
|
948
1259
|
getPipelineRows(): RowNode<TData>[];
|
|
949
1260
|
setPage(page: number, silent?: boolean): void;
|
|
950
1261
|
setPageSize(size: number): void;
|
|
1262
|
+
restorePagination(page: number, pageSize: number): void;
|
|
951
1263
|
setPaginationEnabled(enabled: boolean): void;
|
|
952
1264
|
onPaginationOptionsChanged(): void;
|
|
953
1265
|
private emitPaginationChanged;
|
|
@@ -959,6 +1271,9 @@ declare class RowModel<TData = any> {
|
|
|
959
1271
|
private buildGrouped;
|
|
960
1272
|
isRowExpandable(node: RowNode<TData>): boolean;
|
|
961
1273
|
isRowExpanded(id: string): boolean;
|
|
1274
|
+
getExpandedRowIds(): string[];
|
|
1275
|
+
getExpandedGroupIds(): string[];
|
|
1276
|
+
restoreExpansion(rowIds: readonly string[], groupIds: readonly string[]): void;
|
|
962
1277
|
expandRow(id: string): boolean;
|
|
963
1278
|
collapseRow(id: string): boolean;
|
|
964
1279
|
toggleDetail(id: string): boolean;
|
|
@@ -996,6 +1311,7 @@ declare class SelectionService {
|
|
|
996
1311
|
getSelectedNodes(): RowNode<any>[];
|
|
997
1312
|
getSelectedRows(): any[];
|
|
998
1313
|
getSelectedIds(): string[];
|
|
1314
|
+
restoreSelection(ids: readonly string[]): void;
|
|
999
1315
|
onRowsRebuilt(preserveIds: boolean): void;
|
|
1000
1316
|
getGroupSelectionState(groupNode: RowNode<any>): {
|
|
1001
1317
|
all: boolean;
|
|
@@ -1065,22 +1381,61 @@ declare class KeyboardService {
|
|
|
1065
1381
|
private onCut;
|
|
1066
1382
|
private onPaste;
|
|
1067
1383
|
private onKeyDown;
|
|
1384
|
+
private handleSelectAll;
|
|
1385
|
+
private handleHistoryShortcut;
|
|
1386
|
+
private handleRangeCommand;
|
|
1387
|
+
private focusFirstCell;
|
|
1388
|
+
private handleFocusedKey;
|
|
1389
|
+
private resolveKeyPosition;
|
|
1390
|
+
private movePosition;
|
|
1391
|
+
private validSkippedRow;
|
|
1392
|
+
private movePage;
|
|
1393
|
+
private activateEditor;
|
|
1394
|
+
private toggleFocusedRow;
|
|
1395
|
+
private moveToEditable;
|
|
1068
1396
|
}
|
|
1069
1397
|
|
|
1070
|
-
type EditingContext = Pick<GridCore<any>, "bodyRenderer" | "emit" | "getApi" | "getCellValue" | "keyboardService" | "reportError" | "resolveCellEditor" | "rowModel" | "setCellValue">;
|
|
1398
|
+
type EditingContext = Pick<GridCore<any>, "bodyRenderer" | "columnModel" | "emit" | "getApi" | "getCellValue" | "keyboardService" | "notifyCellValueChanged" | "options" | "reportError" | "resolveCellEditor" | "rowModel" | "setCellValue" | "statusBarService" | "summaryRenderer" | "undoService" | "writeValue">;
|
|
1071
1399
|
declare class EditingService {
|
|
1072
1400
|
private core;
|
|
1073
|
-
private
|
|
1401
|
+
private cellEditing;
|
|
1402
|
+
private rowEditing;
|
|
1403
|
+
private stopPromise;
|
|
1404
|
+
private stopToken;
|
|
1074
1405
|
constructor(core: EditingContext);
|
|
1075
1406
|
isEditing(rowIndex?: number, colId?: string): boolean;
|
|
1407
|
+
isCellEditing(): boolean;
|
|
1408
|
+
isRowEditing(rowIndex?: number): boolean;
|
|
1076
1409
|
isEditable(node: RowNode<any>, column: Column): boolean;
|
|
1077
1410
|
start(rowIndex: number, column: Column, keyPress?: string | null): boolean;
|
|
1411
|
+
startRow(rowIndex: number, preferredColId?: string): boolean;
|
|
1412
|
+
/** Called by BodyRenderer so row editors survive horizontal/vertical virtualization. */
|
|
1413
|
+
renderEditor(rowIndex: number, node: RowNode<any>, column: Column, cell: HTMLElement): boolean;
|
|
1414
|
+
/** Captures a staged value before a pooled/virtual cell is reused. */
|
|
1415
|
+
releaseCell(rowIndex: number, colId: string, cell: HTMLElement): void;
|
|
1078
1416
|
stop(cancel?: boolean): void;
|
|
1417
|
+
stopAsync(cancel?: boolean): Promise<boolean>;
|
|
1418
|
+
stopRowAsync(cancel?: boolean): Promise<boolean>;
|
|
1419
|
+
private finishCellStop;
|
|
1420
|
+
private finishRowStop;
|
|
1421
|
+
private commitRowDrafts;
|
|
1422
|
+
private mountRowDraft;
|
|
1423
|
+
private unmountRowDraft;
|
|
1424
|
+
private captureRowDraft;
|
|
1425
|
+
private createCellEditor;
|
|
1079
1426
|
private validateValue;
|
|
1427
|
+
private validateRowDraft;
|
|
1428
|
+
private showRowErrors;
|
|
1080
1429
|
private showError;
|
|
1430
|
+
private setCellBusy;
|
|
1431
|
+
private setRowBusy;
|
|
1081
1432
|
private applyValue;
|
|
1082
|
-
private
|
|
1083
|
-
private
|
|
1433
|
+
private focusEditor;
|
|
1434
|
+
private destroyMountedEditor;
|
|
1435
|
+
private currentRowIndex;
|
|
1436
|
+
private onCellEditorKeyDown;
|
|
1437
|
+
private onRowEditorKeyDown;
|
|
1438
|
+
private onCellEditorBlur;
|
|
1084
1439
|
destroy(): void;
|
|
1085
1440
|
}
|
|
1086
1441
|
|
|
@@ -1107,6 +1462,7 @@ declare class ColumnMenuService {
|
|
|
1107
1462
|
private panel;
|
|
1108
1463
|
private openColId;
|
|
1109
1464
|
private standaloneAnchor;
|
|
1465
|
+
private searchText;
|
|
1110
1466
|
constructor(core: ColumnMenuContext);
|
|
1111
1467
|
toggle(column: Column, anchor: HTMLElement): void;
|
|
1112
1468
|
openStandalone(anchor?: HTMLElement): void;
|
|
@@ -1116,6 +1472,7 @@ declare class ColumnMenuService {
|
|
|
1116
1472
|
private docKeyDown;
|
|
1117
1473
|
private open;
|
|
1118
1474
|
private rebuildListStates;
|
|
1475
|
+
private renderColumnList;
|
|
1119
1476
|
}
|
|
1120
1477
|
|
|
1121
1478
|
type ContextMenuContext = Pick<GridCore<any>, "bodyRenderer" | "clearRangeValues" | "columnModel" | "copyActiveRange" | "getApi" | "getCellValue" | "getLocaleText" | "options" | "pasteFromSystemClipboard" | "reportError" | "rowModel">;
|
|
@@ -1192,6 +1549,26 @@ declare class UndoRedoService {
|
|
|
1192
1549
|
clear(): void;
|
|
1193
1550
|
}
|
|
1194
1551
|
|
|
1552
|
+
type ChangeTrackingContext = Pick<GridCore<any>, "bodyRenderer" | "columnModel" | "emit" | "eventBus" | "getCellValue" | "rowModel" | "statusBarService" | "summaryRenderer" | "writeValue">;
|
|
1553
|
+
declare class ChangeTrackingService<TData = any> {
|
|
1554
|
+
private core;
|
|
1555
|
+
private changes;
|
|
1556
|
+
private rollingBack;
|
|
1557
|
+
private unsubscribe;
|
|
1558
|
+
constructor(core: ChangeTrackingContext);
|
|
1559
|
+
init(): void;
|
|
1560
|
+
private record;
|
|
1561
|
+
getDirtyRowIds(): string[];
|
|
1562
|
+
getChanges(): GridChange<TData>[];
|
|
1563
|
+
markSaved(rowIds?: readonly string[]): void;
|
|
1564
|
+
acknowledge(saved: readonly GridChange<TData>[]): void;
|
|
1565
|
+
rollback(rowIds?: readonly string[]): boolean;
|
|
1566
|
+
clearRows(rowIds: readonly string[]): void;
|
|
1567
|
+
clear(): void;
|
|
1568
|
+
destroy(): void;
|
|
1569
|
+
private emitChanged;
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1195
1572
|
type SkeletonContext = Pick<GridCore<any>, "options" | "relayout" | "reportError">;
|
|
1196
1573
|
declare class GridSkeleton {
|
|
1197
1574
|
private core;
|
|
@@ -1213,12 +1590,15 @@ declare class GridSkeleton {
|
|
|
1213
1590
|
private currentOverlay;
|
|
1214
1591
|
private currentOverlayContent;
|
|
1215
1592
|
private currentOverlayAllowsHtml;
|
|
1593
|
+
private overlayCleanup;
|
|
1216
1594
|
private customClassTokens;
|
|
1217
1595
|
private resizeObserver;
|
|
1218
1596
|
private headerDepth;
|
|
1219
1597
|
constructor(core: SkeletonContext);
|
|
1220
1598
|
init(container: HTMLElement, options: ResolvedGridOptions): void;
|
|
1599
|
+
applyAriaLabels(options: Pick<ResolvedGridOptions, "ariaLabel" | "ariaLabelledBy" | "ariaDescribedBy">): void;
|
|
1221
1600
|
setHeaderRowCount(depth: number): void;
|
|
1601
|
+
getHeaderRowCount(): number;
|
|
1222
1602
|
private applyHeaderHeight;
|
|
1223
1603
|
setPaneWidths(left: number, right: number): void;
|
|
1224
1604
|
private applyPaneWidth;
|
|
@@ -1230,11 +1610,14 @@ declare class GridSkeleton {
|
|
|
1230
1610
|
private systemPrefersDark;
|
|
1231
1611
|
setStriped(on: boolean): void;
|
|
1232
1612
|
setCellBorders(on: boolean): void;
|
|
1613
|
+
applyDomLayout(layout: DomLayoutMode): void;
|
|
1233
1614
|
setCustomClass(className: string | null | undefined): void;
|
|
1234
|
-
showOverlay(type: "loading" | "noRows", content: OverlayTemplate, allowUnsafeHtml?: boolean): void;
|
|
1615
|
+
showOverlay(type: "loading" | "noRows" | "error", content: OverlayTemplate, allowUnsafeHtml?: boolean): void;
|
|
1235
1616
|
hideOverlay(): void;
|
|
1617
|
+
private applyOverlayRole;
|
|
1236
1618
|
setInfiniteLoading(active: boolean, text: string): void;
|
|
1237
1619
|
destroy(): void;
|
|
1620
|
+
private cleanupOverlayContent;
|
|
1238
1621
|
}
|
|
1239
1622
|
|
|
1240
1623
|
type HeaderContext = Pick<GridCore<any>, "columnDragService" | "columnMenu" | "columnModel" | "cycleSort" | "emit" | "filterPopup" | "getApi" | "isDestroyed" | "moveColumn" | "options" | "relayoutColumns" | "reportError" | "resizeService" | "rowModel" | "selectionService" | "skeleton">;
|
|
@@ -1250,6 +1633,7 @@ declare class HeaderRenderer {
|
|
|
1250
1633
|
applyLayout(): void;
|
|
1251
1634
|
private visiblePaneLeaves;
|
|
1252
1635
|
private onHeaderKeyDown;
|
|
1636
|
+
private focusHeaderCell;
|
|
1253
1637
|
refreshSortIndicators(): void;
|
|
1254
1638
|
refreshFilterIcons(): void;
|
|
1255
1639
|
refreshSelectAllCheckbox(): void;
|
|
@@ -1263,7 +1647,7 @@ interface NormalizedRange {
|
|
|
1263
1647
|
c2: number;
|
|
1264
1648
|
}
|
|
1265
1649
|
|
|
1266
|
-
type BodyContext = Pick<GridCore<any>, "buildDefaultEmptyState" | "columnModel" | "contextMenuService" | "editingService" | "emit" | "getApi" | "getCellValue" | "gridId" | "isDestroyed" | "options" | "pinnedRowsRenderer" | "reportError" | "resolveCellRenderer" | "rowModel" | "selectionService" | "setCellValue" | "skeleton" | "summaryRenderer" | "toggleDetail" | "tooltipService" | "undoService">;
|
|
1650
|
+
type BodyContext = Pick<GridCore<any>, "buildDefaultEmptyState" | "buildDefaultErrorState" | "columnModel" | "contextMenuService" | "editingService" | "emit" | "getApi" | "getCellValue" | "gridId" | "isDestroyed" | "options" | "pinnedRowsRenderer" | "reportError" | "resolveCellRenderer" | "rowModel" | "selectionService" | "setCellValue" | "skeleton" | "summaryRenderer" | "toggleDetail" | "tooltipService" | "undoService">;
|
|
1267
1651
|
interface FocusedCell {
|
|
1268
1652
|
rowIndex: number;
|
|
1269
1653
|
colId: string;
|
|
@@ -1297,6 +1681,7 @@ declare class BodyRenderer {
|
|
|
1297
1681
|
private measureCanvas;
|
|
1298
1682
|
applyContainerSizes(): void;
|
|
1299
1683
|
invalidateRowHeight(node: RowNode<any>): void;
|
|
1684
|
+
private applyDomLayoutHeight;
|
|
1300
1685
|
invalidateAllRowHeights(): void;
|
|
1301
1686
|
private collectAutoHeightColumns;
|
|
1302
1687
|
private get hasAnyAutoHeight();
|
|
@@ -1305,10 +1690,15 @@ declare class BodyRenderer {
|
|
|
1305
1690
|
flushFlash(): void;
|
|
1306
1691
|
relayout(): void;
|
|
1307
1692
|
private growPool;
|
|
1693
|
+
private activePaneColumns;
|
|
1694
|
+
private createCell;
|
|
1695
|
+
private reconcilePaneCells;
|
|
1308
1696
|
rebuildPool(): void;
|
|
1309
1697
|
applyCellLayout(): void;
|
|
1310
1698
|
private computeColWindow;
|
|
1311
1699
|
updateRange(force?: boolean): void;
|
|
1700
|
+
private reconcileColumnWindow;
|
|
1701
|
+
private renderAutoHeightRange;
|
|
1312
1702
|
private hideSlot;
|
|
1313
1703
|
private assignSlot;
|
|
1314
1704
|
private renderPaneCells;
|
|
@@ -1317,6 +1707,8 @@ declare class BodyRenderer {
|
|
|
1317
1707
|
private renderDetailContent;
|
|
1318
1708
|
private cleanupDetail;
|
|
1319
1709
|
private renderCell;
|
|
1710
|
+
private appendEditableIndicator;
|
|
1711
|
+
private releaseSlotEditors;
|
|
1320
1712
|
private treeColumnCache;
|
|
1321
1713
|
private getTreeColumn;
|
|
1322
1714
|
private renderTreeCell;
|
|
@@ -1372,6 +1764,7 @@ declare class BodyRenderer {
|
|
|
1372
1764
|
focusGridRoot(): void;
|
|
1373
1765
|
private resolveEventTarget;
|
|
1374
1766
|
private onBodyClick;
|
|
1767
|
+
private handleTreeToggleClick;
|
|
1375
1768
|
private firstCheckboxColId;
|
|
1376
1769
|
private onBodyDblClick;
|
|
1377
1770
|
private onContextMenu;
|
|
@@ -1465,6 +1858,7 @@ declare class GridCore<TData = any> {
|
|
|
1465
1858
|
readonly keyboardService: KeyboardService;
|
|
1466
1859
|
readonly editingService: EditingService;
|
|
1467
1860
|
readonly undoService: UndoRedoService;
|
|
1861
|
+
readonly changeTracker: ChangeTrackingService<TData>;
|
|
1468
1862
|
readonly filterPopup: FilterPopupService;
|
|
1469
1863
|
readonly columnMenu: ColumnMenuService;
|
|
1470
1864
|
readonly contextMenuService: ContextMenuService;
|
|
@@ -1478,10 +1872,18 @@ declare class GridCore<TData = any> {
|
|
|
1478
1872
|
private destroyed;
|
|
1479
1873
|
private autoIdCounter;
|
|
1480
1874
|
private readyRafId;
|
|
1875
|
+
private readySettled;
|
|
1876
|
+
private readonly readyPromise;
|
|
1877
|
+
private readonly resolveReady;
|
|
1481
1878
|
private lastColumnLayoutSignature;
|
|
1482
1879
|
private activeFeatures;
|
|
1880
|
+
private recentErrors;
|
|
1881
|
+
private stateSaveTimer;
|
|
1882
|
+
private gridStateLoadToken;
|
|
1483
1883
|
constructor(container: HTMLElement, options: GridOptions<TData>);
|
|
1484
1884
|
getApi(): GridApi<TData>;
|
|
1885
|
+
whenReady(): Promise<GridApi<TData>>;
|
|
1886
|
+
private settleReady;
|
|
1485
1887
|
resolveCellRenderer(name: string): CellRendererFn | undefined;
|
|
1486
1888
|
resolveCellEditor(name: string): CellEditorFactory | undefined;
|
|
1487
1889
|
setFeatures(features: readonly GridFeature<TData>[] | null | undefined): void;
|
|
@@ -1492,6 +1894,8 @@ declare class GridCore<TData = any> {
|
|
|
1492
1894
|
getLocaleText(key: RgLocaleKey): string;
|
|
1493
1895
|
writeValue(node: RowNode<any>, column: Column, newValue: any, oldValue?: any): boolean;
|
|
1494
1896
|
setCellValue(node: RowNode<any>, column: Column, newValue: any, oldValue: any): boolean;
|
|
1897
|
+
/** Emits the shared value-change side effects after a caller has written data transactionally. */
|
|
1898
|
+
notifyCellValueChanged(node: RowNode<any>, column: Column, oldValue: any, newValue: any): void;
|
|
1495
1899
|
buildRangeTsv(range: {
|
|
1496
1900
|
r1: number;
|
|
1497
1901
|
c1: number;
|
|
@@ -1510,22 +1914,29 @@ declare class GridCore<TData = any> {
|
|
|
1510
1914
|
refreshSummary(): void;
|
|
1511
1915
|
emit<K extends GridEventType>(type: K, extra?: Partial<GridEventMap<TData>[K]>): GridEventMap<TData>[K];
|
|
1512
1916
|
reportError(error: unknown, source: string, context?: Record<string, unknown>): void;
|
|
1917
|
+
private errorCodeFor;
|
|
1918
|
+
getDiagnostics(): GridDiagnostics;
|
|
1513
1919
|
cycleSort(column: Column, additive: boolean): void;
|
|
1514
1920
|
applySortModel(): void;
|
|
1515
1921
|
applyColumnFilter(column: Column, filter: ColumnFilter | null): void;
|
|
1516
1922
|
applyQuickFilter(): void;
|
|
1517
1923
|
moveColumn(colId: string, toIndex: number): void;
|
|
1518
1924
|
toggleDetail(rowId: string): boolean;
|
|
1519
|
-
private
|
|
1925
|
+
private columnStateLoadToken;
|
|
1520
1926
|
loadPersistedColumnState(): void;
|
|
1521
1927
|
persistColumnState(): void;
|
|
1928
|
+
loadPersistedGridState(): void;
|
|
1929
|
+
scheduleGridStateSave(): void;
|
|
1930
|
+
persistGridState(): void;
|
|
1931
|
+
buildDefaultErrorState(): HTMLElement;
|
|
1522
1932
|
buildDefaultEmptyState(): HTMLElement;
|
|
1523
1933
|
private lastValidatedDefs;
|
|
1524
1934
|
private issuedWarningSignatures;
|
|
1525
|
-
checkWarnings(): void;
|
|
1935
|
+
checkWarnings(inputOptions?: Partial<GridOptions<any>> | Record<string, unknown>): void;
|
|
1526
1936
|
validateDefs(defs: (ColDef<any> | ColDefGroup<any>)[] | null | undefined): void;
|
|
1527
1937
|
onColumnsStructureChanged(): void;
|
|
1528
1938
|
relayout(): void;
|
|
1939
|
+
refreshAriaState(): void;
|
|
1529
1940
|
relayoutColumns(invalidateRowHeights?: boolean): void;
|
|
1530
1941
|
destroy(): void;
|
|
1531
1942
|
}
|
|
@@ -1543,6 +1954,8 @@ interface WidthInput {
|
|
|
1543
1954
|
flex?: number;
|
|
1544
1955
|
}
|
|
1545
1956
|
declare function computeColumnWidths(cols: WidthInput[], availableWidth: number): number[];
|
|
1957
|
+
/** Fits columns into a viewport while honoring every min/max bound. */
|
|
1958
|
+
declare function fitColumnWidths(cols: WidthInput[], availableWidth: number): number[];
|
|
1546
1959
|
|
|
1547
1960
|
interface GridSizePreset {
|
|
1548
1961
|
rowHeight: number;
|
|
@@ -1581,10 +1994,18 @@ declare const GRID_OPTION_META: {
|
|
|
1581
1994
|
readonly kind: "object";
|
|
1582
1995
|
readonly update: "options";
|
|
1583
1996
|
};
|
|
1997
|
+
readonly columnTypes: {
|
|
1998
|
+
readonly kind: "object";
|
|
1999
|
+
readonly update: "options";
|
|
2000
|
+
};
|
|
1584
2001
|
readonly getRowId: {
|
|
1585
2002
|
readonly kind: "function";
|
|
1586
2003
|
readonly update: "options";
|
|
1587
2004
|
};
|
|
2005
|
+
readonly rowKey: {
|
|
2006
|
+
readonly kind: "unknown";
|
|
2007
|
+
readonly update: "options";
|
|
2008
|
+
};
|
|
1588
2009
|
readonly rowHeight: {
|
|
1589
2010
|
readonly kind: "number";
|
|
1590
2011
|
readonly update: "options";
|
|
@@ -1597,6 +2018,14 @@ declare const GRID_OPTION_META: {
|
|
|
1597
2018
|
readonly kind: "number";
|
|
1598
2019
|
readonly update: "options";
|
|
1599
2020
|
};
|
|
2021
|
+
readonly columnLayout: {
|
|
2022
|
+
readonly kind: "string";
|
|
2023
|
+
readonly update: "options";
|
|
2024
|
+
};
|
|
2025
|
+
readonly domLayout: {
|
|
2026
|
+
readonly kind: "string";
|
|
2027
|
+
readonly update: "options";
|
|
2028
|
+
};
|
|
1600
2029
|
readonly rowSelection: {
|
|
1601
2030
|
readonly kind: "string";
|
|
1602
2031
|
readonly update: "options";
|
|
@@ -1665,14 +2094,46 @@ declare const GRID_OPTION_META: {
|
|
|
1665
2094
|
readonly kind: "object";
|
|
1666
2095
|
readonly update: "options";
|
|
1667
2096
|
};
|
|
2097
|
+
readonly actionPolicy: {
|
|
2098
|
+
readonly kind: "object";
|
|
2099
|
+
readonly update: "options";
|
|
2100
|
+
};
|
|
1668
2101
|
readonly features: {
|
|
1669
2102
|
readonly kind: "array";
|
|
1670
2103
|
readonly update: "options";
|
|
1671
2104
|
};
|
|
2105
|
+
readonly initialState: {
|
|
2106
|
+
readonly kind: "object";
|
|
2107
|
+
readonly update: "options";
|
|
2108
|
+
};
|
|
2109
|
+
readonly stateKey: {
|
|
2110
|
+
readonly kind: "string";
|
|
2111
|
+
readonly update: "options";
|
|
2112
|
+
};
|
|
2113
|
+
readonly stateStore: {
|
|
2114
|
+
readonly kind: "object";
|
|
2115
|
+
readonly update: "options";
|
|
2116
|
+
};
|
|
2117
|
+
readonly stateSaveDebounceMs: {
|
|
2118
|
+
readonly kind: "number";
|
|
2119
|
+
readonly update: "options";
|
|
2120
|
+
};
|
|
1672
2121
|
readonly locale: {
|
|
1673
2122
|
readonly kind: "object";
|
|
1674
2123
|
readonly update: "options";
|
|
1675
2124
|
};
|
|
2125
|
+
readonly editType: {
|
|
2126
|
+
readonly kind: "string";
|
|
2127
|
+
readonly update: "options";
|
|
2128
|
+
};
|
|
2129
|
+
readonly editableIndicator: {
|
|
2130
|
+
readonly kind: "string";
|
|
2131
|
+
readonly update: "options";
|
|
2132
|
+
};
|
|
2133
|
+
readonly rowEditValidator: {
|
|
2134
|
+
readonly kind: "function";
|
|
2135
|
+
readonly update: "options";
|
|
2136
|
+
};
|
|
1676
2137
|
readonly singleClickEdit: {
|
|
1677
2138
|
readonly kind: "boolean";
|
|
1678
2139
|
readonly update: "options";
|
|
@@ -1701,6 +2162,14 @@ declare const GRID_OPTION_META: {
|
|
|
1701
2162
|
readonly kind: "string";
|
|
1702
2163
|
readonly update: "options";
|
|
1703
2164
|
};
|
|
2165
|
+
readonly isTreeRowExpandable: {
|
|
2166
|
+
readonly kind: "function";
|
|
2167
|
+
readonly update: "options";
|
|
2168
|
+
};
|
|
2169
|
+
readonly loadTreeChildren: {
|
|
2170
|
+
readonly kind: "function";
|
|
2171
|
+
readonly update: "options";
|
|
2172
|
+
};
|
|
1704
2173
|
readonly autoCheckedChildren: {
|
|
1705
2174
|
readonly kind: "boolean";
|
|
1706
2175
|
readonly update: "options";
|
|
@@ -1721,6 +2190,10 @@ declare const GRID_OPTION_META: {
|
|
|
1721
2190
|
readonly kind: "number";
|
|
1722
2191
|
readonly update: "options";
|
|
1723
2192
|
};
|
|
2193
|
+
readonly asyncTransactionWaitMillis: {
|
|
2194
|
+
readonly kind: "number";
|
|
2195
|
+
readonly update: "options";
|
|
2196
|
+
};
|
|
1724
2197
|
readonly getRowHeight: {
|
|
1725
2198
|
readonly kind: "function";
|
|
1726
2199
|
readonly update: "options";
|
|
@@ -1793,6 +2266,14 @@ declare const GRID_OPTION_META: {
|
|
|
1793
2266
|
readonly kind: "number";
|
|
1794
2267
|
readonly update: "options";
|
|
1795
2268
|
};
|
|
2269
|
+
readonly datasourceRetryCount: {
|
|
2270
|
+
readonly kind: "number";
|
|
2271
|
+
readonly update: "options";
|
|
2272
|
+
};
|
|
2273
|
+
readonly datasourceRetryDelay: {
|
|
2274
|
+
readonly kind: "number";
|
|
2275
|
+
readonly update: "options";
|
|
2276
|
+
};
|
|
1796
2277
|
readonly suppressCellFocus: {
|
|
1797
2278
|
readonly kind: "boolean";
|
|
1798
2279
|
readonly update: "options";
|
|
@@ -1809,10 +2290,26 @@ declare const GRID_OPTION_META: {
|
|
|
1809
2290
|
readonly kind: "boolean";
|
|
1810
2291
|
readonly update: "options";
|
|
1811
2292
|
};
|
|
2293
|
+
readonly ariaLabel: {
|
|
2294
|
+
readonly kind: "string";
|
|
2295
|
+
readonly update: "options";
|
|
2296
|
+
};
|
|
2297
|
+
readonly ariaLabelledBy: {
|
|
2298
|
+
readonly kind: "string";
|
|
2299
|
+
readonly update: "options";
|
|
2300
|
+
};
|
|
2301
|
+
readonly ariaDescribedBy: {
|
|
2302
|
+
readonly kind: "string";
|
|
2303
|
+
readonly update: "options";
|
|
2304
|
+
};
|
|
1812
2305
|
readonly loading: {
|
|
1813
2306
|
readonly kind: "boolean";
|
|
1814
2307
|
readonly update: "options";
|
|
1815
2308
|
};
|
|
2309
|
+
readonly error: {
|
|
2310
|
+
readonly kind: "unknown";
|
|
2311
|
+
readonly update: "options";
|
|
2312
|
+
};
|
|
1816
2313
|
readonly overlayNoRowsTemplate: {
|
|
1817
2314
|
readonly kind: "unknown";
|
|
1818
2315
|
readonly update: "options";
|
|
@@ -1821,6 +2318,10 @@ declare const GRID_OPTION_META: {
|
|
|
1821
2318
|
readonly kind: "unknown";
|
|
1822
2319
|
readonly update: "options";
|
|
1823
2320
|
};
|
|
2321
|
+
readonly overlayErrorTemplate: {
|
|
2322
|
+
readonly kind: "unknown";
|
|
2323
|
+
readonly update: "options";
|
|
2324
|
+
};
|
|
1824
2325
|
readonly allowUnsafeOverlayHtml: {
|
|
1825
2326
|
readonly kind: "boolean";
|
|
1826
2327
|
readonly update: "options";
|
|
@@ -1835,6 +2336,16 @@ declare const DIRECT_GRID_OPTION_KEYS: readonly GridOptionKey[];
|
|
|
1835
2336
|
|
|
1836
2337
|
declare function describeFilter(filter: ColumnFilter): string;
|
|
1837
2338
|
|
|
2339
|
+
type GridValidationCode = "UNKNOWN_OPTION" | "INVALID_OPTION_VALUE" | "OPTION_CONFLICT" | "MISSING_STABLE_ROW_ID";
|
|
2340
|
+
interface GridValidationIssue {
|
|
2341
|
+
code: GridValidationCode;
|
|
2342
|
+
message: string;
|
|
2343
|
+
option?: string;
|
|
2344
|
+
suggestion?: string;
|
|
2345
|
+
}
|
|
2346
|
+
/** Runtime validation for JavaScript, JSON/schema driven and dynamic options. */
|
|
2347
|
+
declare function validateGridOptions(options: Partial<GridOptions<any>> | Record<string, unknown>): GridValidationIssue[];
|
|
2348
|
+
|
|
1838
2349
|
type GridSchemaFieldType = "string" | "number" | "date" | "select" | "boolean";
|
|
1839
2350
|
interface SchemaSelectOption {
|
|
1840
2351
|
label: string;
|
|
@@ -1868,10 +2379,71 @@ interface GridSchema {
|
|
|
1868
2379
|
}
|
|
1869
2380
|
declare function buildColDefsFromSchema<TData = any>(schema: GridSchema): (ColDef<TData> | ColDefGroup<TData>)[];
|
|
1870
2381
|
|
|
2382
|
+
interface ColumnStateStorage {
|
|
2383
|
+
getItem(key: string): string | null;
|
|
2384
|
+
setItem(key: string, value: string): void;
|
|
2385
|
+
removeItem(key: string): void;
|
|
2386
|
+
}
|
|
2387
|
+
interface StoredColumnState {
|
|
2388
|
+
version: number;
|
|
2389
|
+
savedAt: number;
|
|
2390
|
+
columns: ColumnState[];
|
|
2391
|
+
}
|
|
2392
|
+
interface LocalColumnStateStoreOptions {
|
|
2393
|
+
/** Storage prefix. Separate applications or environments with different values. */
|
|
2394
|
+
namespace?: string;
|
|
2395
|
+
/** Schema version for migrations when column identifiers or meanings change. */
|
|
2396
|
+
version?: number;
|
|
2397
|
+
storage?: ColumnStateStorage;
|
|
2398
|
+
maxColumns?: number;
|
|
2399
|
+
migrate?(columns: readonly ColumnState[], fromVersion: number, toVersion: number): ColumnState[] | null;
|
|
2400
|
+
onError?(error: unknown, operation: "load" | "save" | "clear", key: string): void;
|
|
2401
|
+
}
|
|
2402
|
+
interface ManagedColumnStateStore extends ColumnStateStore {
|
|
2403
|
+
clear(key: string): void;
|
|
2404
|
+
storageKey(key: string): string;
|
|
2405
|
+
}
|
|
2406
|
+
interface ColumnStateKeyParts {
|
|
2407
|
+
app?: string;
|
|
2408
|
+
tenant?: string | number;
|
|
2409
|
+
user?: string | number;
|
|
2410
|
+
route?: string;
|
|
2411
|
+
table: string;
|
|
2412
|
+
schema?: string | number;
|
|
2413
|
+
}
|
|
2414
|
+
/** Builds a collision-resistant key for per-user/per-route table preferences. */
|
|
2415
|
+
declare function createColumnStateKey(parts: ColumnStateKeyParts): string;
|
|
2416
|
+
/**
|
|
2417
|
+
* Creates a versioned local state adapter. Legacy array payloads are read as
|
|
2418
|
+
* version 0, so existing users can migrate without losing preferences.
|
|
2419
|
+
*/
|
|
2420
|
+
declare function createLocalColumnStateStore(options?: LocalColumnStateStoreOptions): ManagedColumnStateStore;
|
|
1871
2421
|
declare function saveColumnState(key: string, state: ColumnState[]): void;
|
|
1872
2422
|
declare function loadColumnState(key: string): ColumnState[] | null;
|
|
1873
2423
|
declare function clearColumnState(key: string): void;
|
|
1874
2424
|
|
|
2425
|
+
interface StoredGridState {
|
|
2426
|
+
schemaVersion: 1;
|
|
2427
|
+
savedAt: number;
|
|
2428
|
+
state: GridState;
|
|
2429
|
+
}
|
|
2430
|
+
interface LocalGridStateStoreOptions {
|
|
2431
|
+
namespace?: string;
|
|
2432
|
+
storage?: ColumnStateStorage;
|
|
2433
|
+
/** Reject unexpectedly large or corrupted payloads. Defaults to 512 KiB. */
|
|
2434
|
+
maxBytes?: number;
|
|
2435
|
+
onError?(error: unknown, operation: "load" | "save" | "clear", key: string): void;
|
|
2436
|
+
}
|
|
2437
|
+
interface ManagedGridStateStore extends GridStateStore {
|
|
2438
|
+
clear(key: string): void;
|
|
2439
|
+
storageKey(key: string): string;
|
|
2440
|
+
}
|
|
2441
|
+
/** Safe, versioned localStorage adapter for full grid state. */
|
|
2442
|
+
declare function createLocalGridStateStore(options?: LocalGridStateStoreOptions): ManagedGridStateStore;
|
|
2443
|
+
declare function saveGridState(key: string, state: GridState): void;
|
|
2444
|
+
declare function loadGridState(key: string): GridState | null;
|
|
2445
|
+
declare function clearGridState(key: string): void;
|
|
2446
|
+
|
|
1875
2447
|
type AggValues = Record<string, any>;
|
|
1876
2448
|
type AggFunction = (values: any[]) => any;
|
|
1877
2449
|
declare const BUILTIN_AGG_FUNCS: Record<string, AggFunction>;
|
|
@@ -1885,6 +2457,29 @@ declare function parseDelimited(text: string, separator: string): string[][];
|
|
|
1885
2457
|
declare function escapeHtml(value: any): string;
|
|
1886
2458
|
declare function downloadFile(filename: string, content: string, mime?: string): boolean;
|
|
1887
2459
|
|
|
2460
|
+
interface MachTableCommandOptions<TData = any> {
|
|
2461
|
+
getApi(): GridApi<TData> | null;
|
|
2462
|
+
/** Overrides refresh for remote-query workflows. */
|
|
2463
|
+
reload?: () => void | Promise<void>;
|
|
2464
|
+
/** Fullscreen target. Defaults to the grid root's parent when available. */
|
|
2465
|
+
getFullscreenElement?: () => HTMLElement | null;
|
|
2466
|
+
}
|
|
2467
|
+
interface MachTableCommands {
|
|
2468
|
+
search(text: string | null | undefined): void;
|
|
2469
|
+
refresh(): Promise<void>;
|
|
2470
|
+
openColumns(anchor?: HTMLElement): void;
|
|
2471
|
+
setDensity(size: GridSize): void;
|
|
2472
|
+
resetColumns(): void;
|
|
2473
|
+
undo(): boolean;
|
|
2474
|
+
redo(): boolean;
|
|
2475
|
+
canUndo(): boolean;
|
|
2476
|
+
canRedo(): boolean;
|
|
2477
|
+
exportCsv(filename?: string): boolean;
|
|
2478
|
+
toggleFullscreen(): Promise<boolean>;
|
|
2479
|
+
}
|
|
2480
|
+
/** Framework-neutral command surface used by Vue/React controllers and toolbars. */
|
|
2481
|
+
declare function createMachTableCommands<TData = any>(options: MachTableCommandOptions<TData>): MachTableCommands;
|
|
2482
|
+
|
|
1888
2483
|
declare function sanitizeFormulaCell(value: any): any;
|
|
1889
2484
|
|
|
1890
2485
|
declare function registerCellRenderer(name: string, renderer: CellRendererFn): () => void;
|
|
@@ -1907,33 +2502,193 @@ interface ProgressConfig {
|
|
|
1907
2502
|
}
|
|
1908
2503
|
declare function createProgressBarRenderer(config?: ProgressConfig): CellRendererFn;
|
|
1909
2504
|
declare function linkRenderer(params: CellRendererParams): string | HTMLElement;
|
|
2505
|
+
declare const ICON_PATHS: {
|
|
2506
|
+
readonly edit: "<path d=\"M11.5 2.5l2 2L5 13H3v-2l8.5-8.5z\"/>";
|
|
2507
|
+
readonly delete: "<path d=\"M3 5h10M6 5V3h4v2M5 5l.7 8h4.6L11 5\"/>";
|
|
2508
|
+
readonly view: "<path d=\"M1.5 8s2.4-4.2 6.5-4.2S14.5 8 14.5 8s-2.4 4.2-6.5 4.2S1.5 8 1.5 8z\"/><circle cx=\"8\" cy=\"8\" r=\"1.8\"/>";
|
|
2509
|
+
readonly copy: "<rect x=\"5\" y=\"5\" width=\"8\" height=\"8\" rx=\"1\"/><path d=\"M3 11V3h8\"/>";
|
|
2510
|
+
readonly download: "<path d=\"M8 2v8m0 0l-3-3m3 3l3-3M2.5 13.5h11\"/>";
|
|
2511
|
+
readonly refresh: "<path d=\"M13 3v4h-4M3 13V9h4\"/><path d=\"M13 7a5.5 5.5 0 00-9.7-2.6M3 9a5.5 5.5 0 009.7 2.6\"/>";
|
|
2512
|
+
readonly close: "<path d=\"M3.5 3.5l9 9m0-9l-9 9\"/>";
|
|
2513
|
+
readonly check: "<path d=\"M2.5 8.5l3.5 3.5 7.5-8\"/>";
|
|
2514
|
+
readonly plus: "<path d=\"M8 2.5v11M2.5 8h11\"/>";
|
|
2515
|
+
readonly search: "<circle cx=\"7\" cy=\"7\" r=\"4.5\"/><path d=\"M10.5 10.5L14 14\"/>";
|
|
2516
|
+
readonly more: "<circle cx=\"3\" cy=\"8\" r=\".9\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"8\" cy=\"8\" r=\".9\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"13\" cy=\"8\" r=\".9\" fill=\"currentColor\" stroke=\"none\"/>";
|
|
2517
|
+
};
|
|
2518
|
+
type BuiltInActionIcon = keyof typeof ICON_PATHS;
|
|
2519
|
+
type ActionVariant = "default" | "primary" | "warning" | "success" | "danger";
|
|
2520
|
+
type ActionOverflowMode = "menu" | "drawer" | "inline";
|
|
1910
2521
|
interface ActionItem<TData = any> {
|
|
1911
|
-
|
|
2522
|
+
/** Stable identifier used by permission, telemetry and error policies. */
|
|
2523
|
+
id?: string;
|
|
2524
|
+
icon?: BuiltInActionIcon;
|
|
1912
2525
|
label?: string;
|
|
1913
2526
|
title?: string;
|
|
2527
|
+
/** Backwards-compatible shorthand for variant="danger". */
|
|
1914
2528
|
danger?: boolean;
|
|
2529
|
+
variant?: ActionVariant;
|
|
1915
2530
|
show?: (params: CellRendererParams<TData>) => boolean;
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
2531
|
+
disabled?: boolean | ((params: CellRendererParams<TData>) => boolean);
|
|
2532
|
+
loading?: boolean | ((params: CellRendererParams<TData>) => boolean);
|
|
2533
|
+
/** One or more UI permissions. Access is resolved by GridOptions.actionPolicy. */
|
|
2534
|
+
permission?: string | readonly string[];
|
|
2535
|
+
/** Ask for confirmation before running. A string becomes the confirmation message. */
|
|
2536
|
+
confirm?: boolean | string | ((params: CellRendererParams<TData>) => boolean | string | Promise<boolean | string>);
|
|
2537
|
+
onClick: (params: CellRendererParams<TData>) => unknown | Promise<unknown>;
|
|
2538
|
+
}
|
|
2539
|
+
interface ActionButtonsConfig<TData = any> {
|
|
2540
|
+
actions: ActionItem<TData>[];
|
|
1920
2541
|
max?: number;
|
|
1921
|
-
|
|
1922
|
-
|
|
2542
|
+
/** menu is compact, drawer suits touch/complex actions, inline never renders an ellipsis. */
|
|
2543
|
+
overflow?: ActionOverflowMode;
|
|
2544
|
+
moreLabel?: string;
|
|
2545
|
+
drawerTitle?: string;
|
|
2546
|
+
}
|
|
2547
|
+
interface RowActionsConfig<TData = any> extends Omit<ActionButtonsConfig<TData>, "actions"> {
|
|
2548
|
+
onView?: (params: CellRendererParams<TData>) => unknown | Promise<unknown>;
|
|
2549
|
+
onDelete?: (params: CellRendererParams<TData>) => unknown | Promise<unknown>;
|
|
2550
|
+
/** Persists the just-validated row. Failures reopen row editing and keep the change dirty. */
|
|
2551
|
+
onSave?: (params: CellRendererParams<TData>, changes: readonly GridChange<TData>[]) => unknown | Promise<unknown>;
|
|
2552
|
+
/** Set false when this table has no full-row edit workflow. */
|
|
2553
|
+
edit?: boolean;
|
|
2554
|
+
extraActions?: ActionItem<TData>[];
|
|
2555
|
+
labels?: Partial<Record<"view" | "edit" | "delete" | "confirm" | "save" | "cancel", string>>;
|
|
2556
|
+
permissions?: Partial<Record<"view" | "edit" | "delete", string | readonly string[]>>;
|
|
2557
|
+
/** Defaults to the translated delete label when true. */
|
|
2558
|
+
confirmDelete?: boolean | string | ((params: CellRendererParams<TData>) => boolean | string | Promise<boolean | string>);
|
|
2559
|
+
}
|
|
2560
|
+
declare function createActionButtonsRenderer<TData = any>(config: ActionButtonsConfig<TData>): CellRendererFn;
|
|
2561
|
+
declare function createRowActionsRenderer<TData = any>(config?: RowActionsConfig<TData>): CellRendererFn;
|
|
1923
2562
|
declare function registerBuiltinRenderers(register: (name: string, fn: CellRendererFn) => void): void;
|
|
1924
2563
|
|
|
1925
2564
|
declare function selectionColumn<TData = any>(overrides?: Partial<ColDef<TData>>): ColDef<TData>;
|
|
1926
2565
|
declare function indexColumn<TData = any>(overrides?: Partial<ColDef<TData>>): ColDef<TData>;
|
|
1927
2566
|
declare function dragColumn<TData = any>(overrides?: Partial<ColDef<TData>>): ColDef<TData>;
|
|
1928
|
-
declare function actionsColumn<TData = any>(config?: ActionButtonsConfig & {
|
|
2567
|
+
declare function actionsColumn<TData = any>(config?: ActionButtonsConfig<TData> & {
|
|
2568
|
+
width?: number;
|
|
2569
|
+
pinned?: "left" | "right";
|
|
2570
|
+
}): ColDef<TData>;
|
|
2571
|
+
declare function rowActionsColumn<TData = any>(config?: RowActionsConfig<TData> & {
|
|
1929
2572
|
width?: number;
|
|
1930
2573
|
pinned?: "left" | "right";
|
|
1931
2574
|
}): ColDef<TData>;
|
|
1932
2575
|
|
|
2576
|
+
interface ColumnHelper<TData> {
|
|
2577
|
+
accessor<TPath extends FieldPath<TData>>(field: TPath, definition?: Omit<ColDef<TData, FieldPathValue<TData, TPath>>, "field">): ColDef<TData, FieldPathValue<TData, TPath>>;
|
|
2578
|
+
display<TValue = unknown>(definition: Omit<ColDef<TData, TValue>, "field"> & Required<Pick<ColDef<TData, TValue>, "colId">>): ColDef<TData, TValue>;
|
|
2579
|
+
group(definition: ColDefGroup<TData>): ColDefGroup<TData>;
|
|
2580
|
+
}
|
|
2581
|
+
/** Creates strongly typed column definitions without repeating TData/TValue. */
|
|
2582
|
+
declare function createColumnHelper<TData>(): ColumnHelper<TData>;
|
|
2583
|
+
/** Identity helper that retains literal types while checking GridOptions elsewhere. */
|
|
2584
|
+
declare function defineColumns<TData>(columns: readonly (ColDef<TData> | ColDefGroup<TData>)[]): (ColDef<TData> | ColDefGroup<TData>)[];
|
|
2585
|
+
|
|
2586
|
+
/** Merges reusable defaults left-to-right with nested defaults handled safely. */
|
|
2587
|
+
declare function createMachTablePreset<TData>(...sources: readonly Partial<GridOptions<TData>>[]): GridOptions<TData>;
|
|
2588
|
+
/** Recommended defaults for editable enterprise back-office screens. */
|
|
2589
|
+
declare function createEnterprisePreset<TData>(overrides?: Partial<GridOptions<TData>>): GridOptions<TData>;
|
|
2590
|
+
/** Compile-time helper for a reusable partial preset. */
|
|
2591
|
+
declare function defineMachTablePreset<TData>(preset: Partial<GridOptions<TData>>): Partial<GridOptions<TData>>;
|
|
2592
|
+
/** Compile-time helper for reusable, typed grid option objects. */
|
|
2593
|
+
declare function defineGridOptions<TData>(options: GridOptions<TData>): GridOptions<TData>;
|
|
2594
|
+
|
|
2595
|
+
type MachTablePresetSelection = string | readonly string[] | false | null;
|
|
2596
|
+
interface MachTableConfigWarning {
|
|
2597
|
+
code: "UNKNOWN_PRESET";
|
|
2598
|
+
message: string;
|
|
2599
|
+
preset?: string;
|
|
2600
|
+
}
|
|
2601
|
+
interface MachTableRuntimeConfig {
|
|
2602
|
+
/** Defaults inherited by every table in this application or subtree. */
|
|
2603
|
+
defaults?: Partial<GridOptions<any>>;
|
|
2604
|
+
/** Application-wide semantic column types. Kept separate for config readability. */
|
|
2605
|
+
columnTypes?: Readonly<Record<string, Partial<ColDef<any>>>>;
|
|
2606
|
+
/** Application-wide renderer/editor registry. Per-table components can override it. */
|
|
2607
|
+
components?: GridComponents;
|
|
2608
|
+
/** Named, reusable behavior profiles such as `list`, `crud` or `picker`. */
|
|
2609
|
+
presets?: Readonly<Record<string, Partial<GridOptions<any>>>>;
|
|
2610
|
+
/** Preset used when a table does not declare its own preset. Set false to disable. */
|
|
2611
|
+
defaultPreset?: MachTablePresetSelection;
|
|
2612
|
+
onConfigWarning?: (warning: MachTableConfigWarning) => void;
|
|
2613
|
+
}
|
|
2614
|
+
interface ResolvedMachTableConfig {
|
|
2615
|
+
readonly defaults: Partial<GridOptions<any>>;
|
|
2616
|
+
readonly presets: Readonly<Record<string, Partial<GridOptions<any>>>>;
|
|
2617
|
+
readonly defaultPreset: MachTablePresetSelection;
|
|
2618
|
+
readonly onConfigWarning?: (warning: MachTableConfigWarning) => void;
|
|
2619
|
+
}
|
|
2620
|
+
interface MachTableOptionExplanation {
|
|
2621
|
+
readonly key: keyof GridOptions<any> | string;
|
|
2622
|
+
readonly value: unknown;
|
|
2623
|
+
readonly source: string;
|
|
2624
|
+
readonly layers: readonly {
|
|
2625
|
+
name: string;
|
|
2626
|
+
value: unknown;
|
|
2627
|
+
}[];
|
|
2628
|
+
}
|
|
2629
|
+
interface ResolvedMachTableGridOptions<TData = any> {
|
|
2630
|
+
readonly options: GridOptions<TData>;
|
|
2631
|
+
explain(key: keyof GridOptions<TData> | string): MachTableOptionExplanation;
|
|
2632
|
+
}
|
|
2633
|
+
/** Type-checks a dedicated `mach-table.config.ts` without runtime work. */
|
|
2634
|
+
declare function defineMachTableConfig<const TConfig extends MachTableRuntimeConfig>(config: TConfig): TConfig;
|
|
2635
|
+
declare function normalizeMachTableConfig(config?: MachTableRuntimeConfig): ResolvedMachTableConfig;
|
|
2636
|
+
/** Merges app, route and layout configuration while preserving named presets. */
|
|
2637
|
+
declare function mergeMachTableConfig(parent: ResolvedMachTableConfig, child: MachTableRuntimeConfig): ResolvedMachTableConfig;
|
|
2638
|
+
declare function resolveMachTableGridOptions<TData>(config: ResolvedMachTableConfig, requestedPreset: MachTablePresetSelection | undefined, explicit: Partial<GridOptions<TData>>, reportWarning?: (warning: MachTableConfigWarning) => void): ResolvedMachTableGridOptions<TData>;
|
|
2639
|
+
|
|
2640
|
+
type BusinessColumnType = "text" | "number" | "integer" | "money" | "percent" | "percentage" | "date" | "datetime" | "boolean" | "status" | "link";
|
|
2641
|
+
interface BusinessColumnTypeOptions {
|
|
2642
|
+
locale?: string | readonly string[];
|
|
2643
|
+
currency?: string;
|
|
2644
|
+
currencyDisplay?: "symbol" | "narrowSymbol" | "code" | "name";
|
|
2645
|
+
timeZone?: string;
|
|
2646
|
+
emptyText?: string;
|
|
2647
|
+
invalidText?: string;
|
|
2648
|
+
trueText?: string;
|
|
2649
|
+
falseText?: string;
|
|
2650
|
+
maximumFractionDigits?: number;
|
|
2651
|
+
}
|
|
2652
|
+
/**
|
|
2653
|
+
* Production-oriented semantic column types. Register once in
|
|
2654
|
+
* `mach-table.config.ts`, then pages only declare `type: "money"` etc.
|
|
2655
|
+
*/
|
|
2656
|
+
declare function createBusinessColumnTypes<TData = any>(options?: BusinessColumnTypeOptions): Readonly<Record<BusinessColumnType, Partial<ColDef<TData>>>>;
|
|
2657
|
+
type DictionaryKey = string | number;
|
|
2658
|
+
interface DictionaryEntry<TKey extends DictionaryKey = DictionaryKey> {
|
|
2659
|
+
value: TKey;
|
|
2660
|
+
label: string;
|
|
2661
|
+
}
|
|
2662
|
+
interface CachedDictionaryOptions<TKey extends DictionaryKey = DictionaryKey> {
|
|
2663
|
+
load(keys: readonly TKey[], signal: AbortSignal): Promise<readonly DictionaryEntry<TKey>[]>;
|
|
2664
|
+
ttlMs?: number;
|
|
2665
|
+
maxSize?: number;
|
|
2666
|
+
batchDelayMs?: number;
|
|
2667
|
+
onError?(error: unknown, keys: readonly TKey[]): void;
|
|
2668
|
+
}
|
|
2669
|
+
interface CachedDictionary<TKey extends DictionaryKey = DictionaryKey> {
|
|
2670
|
+
get(key: TKey): string | undefined;
|
|
2671
|
+
resolve(key: TKey): Promise<string | undefined>;
|
|
2672
|
+
resolveMany(keys: readonly TKey[]): Promise<ReadonlyMap<TKey, string>>;
|
|
2673
|
+
prime(entries: readonly DictionaryEntry<TKey>[]): void;
|
|
2674
|
+
invalidate(keys?: readonly TKey[]): void;
|
|
2675
|
+
destroy(): void;
|
|
2676
|
+
readonly size: number;
|
|
2677
|
+
}
|
|
2678
|
+
/** Batched, de-duplicated TTL/LRU dictionary resolver for code-to-label fields. */
|
|
2679
|
+
declare function createCachedDictionary<TKey extends DictionaryKey = DictionaryKey>(options: CachedDictionaryOptions<TKey>): CachedDictionary<TKey>;
|
|
2680
|
+
interface DictionaryRendererOptions {
|
|
2681
|
+
loadingText?: string;
|
|
2682
|
+
emptyText?: string;
|
|
2683
|
+
fallback?: (value: DictionaryKey) => string;
|
|
2684
|
+
}
|
|
2685
|
+
/** Async-safe renderer backed by createCachedDictionary; stale pooled cells are not mutated. */
|
|
2686
|
+
declare function createDictionaryRenderer<TKey extends DictionaryKey = DictionaryKey>(dictionary: CachedDictionary<TKey>, options?: DictionaryRendererOptions): CellRendererFn;
|
|
2687
|
+
|
|
1933
2688
|
declare function evaluateColumnFilter(value: any, filter: ColumnFilter): boolean;
|
|
1934
2689
|
|
|
1935
2690
|
declare function sortNodes<TData>(nodes: RowNode<TData>[], sortModel: SortModel, columns: Column[], getCellValue: (node: RowNode<TData>, column: Column) => any): RowNode<TData>[];
|
|
1936
2691
|
|
|
1937
2692
|
declare const version: string;
|
|
1938
2693
|
|
|
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 };
|
|
2694
|
+
export { type ActionButtonsConfig, type ActionItem, type ActionOverflowMode, type ActionPolicy, type ActionPolicyContext, type ActionVariant, type AggFunction, type AggValues, type ApplyGridStateOptions, BUILTIN_AGG_FUNCS, type BuiltInActionIcon, 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, type DomLayoutMode, 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 GridStateStore, type GridValidationCode, type GridValidationIssue, type HeaderComponentParams, type ICellEditor, type ICellRendererResult, type ImportCsvOptions, type InfiniteGetRowsParams, LOCALE_EN, type LocalColumnStateStoreOptions, type LocalGridStateStoreOptions, type MachTableCommandOptions, type MachTableCommands, type MachTableConfigWarning, type MachTableOptionExplanation, type MachTablePresetSelection, type MachTableRuntimeConfig, type ManagedColumnStateStore, type ManagedGridStateStore, 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 ResolvedMachTableConfig, type ResolvedMachTableGridOptions, 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 StoredGridState, 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, clearGridState, computeColumnWidths, createActionButtonsRenderer, createAggResolver, createBusinessColumnTypes, createCachedDictionary, createColumnHelper, createColumnStateKey, createDictionaryRenderer, createEnterprisePreset, createGrid, createLocalColumnStateStore, createLocalGridStateStore, createMachTableCommands, createMachTablePreset, createProgressBarRenderer, createRowActionsRenderer, createStatusTagRenderer, defaultComparator, defineColumns, defineGridOptions, defineMachTableConfig, defineMachTablePreset, describeFilter, downloadFile, dragColumn, escapeHtml, evaluateColumnFilter, fitColumnWidths, formatText, formatTwo, getByPath, getCellEditor, getCellRenderer, indexColumn, isColDefGroup, isSafePath, linkRenderer, loadColumnState, loadGridState, matchLocaleKey, mergeMachTableConfig, normalizeMachTableConfig, parseCsv, parseDelimited, parseTsv, registerBuiltinRenderers, registerCellEditor, registerCellRenderer, resolveMachTableGridOptions, resolveTagVariant, rowActionsColumn, sanitizeFormulaCell, saveColumnState, saveGridState, selectionColumn, setByPath, sortNodes, toTsv, validateGridOptions, version };
|