argent-grid 0.2.0 → 0.3.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/AGENTS.md +70 -27
- package/e2e/advanced.spec.ts +1 -1
- package/e2e/benchmark.spec.ts +7 -7
- package/e2e/cell-renderers.spec.ts +152 -0
- package/e2e/debug-streaming.spec.ts +31 -0
- package/e2e/dnd.spec.ts +73 -0
- package/e2e/screenshots.spec.ts +1 -1
- package/e2e/visual.spec.ts +30 -9
- package/e2e/visual.spec.ts-snapshots/checkbox-renderer-mixed.png +0 -0
- package/e2e/visual.spec.ts-snapshots/debug.png +0 -0
- package/e2e/visual.spec.ts-snapshots/grid-column-group-headers.png +0 -0
- package/e2e/visual.spec.ts-snapshots/grid-default.png +0 -0
- package/e2e/visual.spec.ts-snapshots/grid-empty-state.png +0 -0
- package/e2e/visual.spec.ts-snapshots/grid-filter-popup.png +0 -0
- package/e2e/visual.spec.ts-snapshots/grid-scroll-borders.png +0 -0
- package/e2e/visual.spec.ts-snapshots/grid-sidebar-buttons.png +0 -0
- package/e2e/visual.spec.ts-snapshots/grid-text-filter.png +0 -0
- package/e2e/visual.spec.ts-snapshots/grid-with-selection.png +0 -0
- package/e2e/visual.spec.ts-snapshots/rating-renderer-varied.png +0 -0
- package/package.json +5 -5
- package/plan.md +30 -34
- package/src/lib/components/argent-grid.component.css +258 -549
- package/src/lib/components/argent-grid.component.html +272 -306
- package/src/lib/components/argent-grid.component.ts +585 -135
- package/src/lib/components/argent-grid.regressions.spec.ts +301 -0
- package/src/lib/components/argent-grid.selection.spec.ts +2 -2
- package/src/lib/components/set-filter/set-filter.component.spec.ts +191 -0
- package/src/lib/components/set-filter/set-filter.component.ts +7 -2
- package/src/lib/rendering/canvas-renderer.spec.ts +148 -1
- package/src/lib/rendering/canvas-renderer.ts +177 -286
- package/src/lib/rendering/render/cells.ts +122 -5
- package/src/lib/rendering/render/column-utils.ts +27 -5
- package/src/lib/rendering/render/hit-test.ts +6 -11
- package/src/lib/rendering/render/index.ts +15 -6
- package/src/lib/rendering/render/lines.ts +12 -6
- package/src/lib/rendering/render/primitives.ts +269 -7
- package/src/lib/rendering/render/types.ts +2 -1
- package/src/lib/rendering/render/walk.ts +39 -19
- package/src/lib/services/grid.service.spec.ts +76 -0
- package/src/lib/services/grid.service.ts +451 -114
- package/src/lib/themes/theme-quartz.ts +2 -2
- package/src/lib/types/ag-grid-types.ts +500 -0
- package/src/stories/Advanced.stories.ts +78 -17
- package/src/stories/ArgentGrid.stories.ts +50 -26
- package/src/stories/Benchmark.stories.ts +17 -15
- package/src/stories/CellRenderers.stories.ts +205 -31
- package/src/stories/Filtering.stories.ts +56 -16
- package/src/stories/Grouping.stories.ts +86 -13
- package/src/stories/Streaming.stories.ts +57 -0
- package/src/stories/Theming.stories.ts +23 -10
- package/src/stories/Tooltips.stories.ts +381 -0
- package/src/stories/benchmark-wrapper.component.ts +69 -29
- package/src/stories/story-utils.ts +88 -0
- package/src/stories/streaming-wrapper.component.ts +441 -0
- package/tsconfig.json +1 -0
|
@@ -12,144 +12,247 @@
|
|
|
12
12
|
|
|
13
13
|
export interface GridOptions<TData = any> {
|
|
14
14
|
// === COLUMN DEFINITIONS ===
|
|
15
|
+
/** Array of Column or Column Group definitions. */
|
|
15
16
|
columnDefs?: (ColDef<TData> | ColGroupDef<TData>)[] | null;
|
|
17
|
+
/** A default column definition of all columns in the grid. */
|
|
16
18
|
defaultColDef?: ColDef<TData>;
|
|
19
|
+
/** A default column group definition for all column groups in the grid. */
|
|
17
20
|
defaultColGroupDef?: Partial<ColGroupDef<TData>>;
|
|
21
|
+
/** A map of column types to column definitions. */
|
|
18
22
|
columnTypes?: { [key: string]: ColDef<TData> };
|
|
23
|
+
/** Definitions for custom data types. */
|
|
19
24
|
dataTypeDefinitions?: DataTypeDefinitions<TData>;
|
|
25
|
+
/** If true, the grid will maintain the order of columns as they are provided in the `columnDefs`. */
|
|
20
26
|
maintainColumnOrder?: boolean;
|
|
27
|
+
/** If true, pivot column order will be strictly maintained. */
|
|
21
28
|
enableStrictPivotColumnOrder?: boolean;
|
|
29
|
+
/** If true, the grid will not use dot notation for field names. */
|
|
22
30
|
suppressFieldDotNotation?: boolean;
|
|
23
31
|
|
|
24
32
|
// === ROW DATA ===
|
|
33
|
+
/** Data to be displayed in the grid. */
|
|
25
34
|
rowData?: TData[] | null;
|
|
35
|
+
/** The type of row model to use. Defaults to 'clientSide'. */
|
|
26
36
|
rowModelType?: RowModelType;
|
|
37
|
+
/** Callback to get the ID for a row. */
|
|
27
38
|
getRowId?: GetRowIdFunc<TData>;
|
|
28
39
|
|
|
29
40
|
// === RENDERING ===
|
|
41
|
+
/** If true, rows will animate when their position changes. */
|
|
30
42
|
animateRows?: boolean;
|
|
43
|
+
/** Duration in milliseconds for cell flashing. */
|
|
31
44
|
cellFlashDuration?: number;
|
|
45
|
+
/** Duration in milliseconds for cell fading. */
|
|
32
46
|
cellFadeDuration?: number;
|
|
47
|
+
/** Set the layout for the grid. Defaults to 'normal'. */
|
|
33
48
|
domLayout?: DomLayoutType;
|
|
49
|
+
/** Default height in pixels for each row. */
|
|
34
50
|
rowHeight?: number;
|
|
51
|
+
/** Default height in pixels for each header row. */
|
|
52
|
+
headerHeight?: number;
|
|
53
|
+
/** Callback to get the height for a row. */
|
|
35
54
|
getRowHeight?: (params: RowHeightParams) => number | null | undefined;
|
|
55
|
+
/** CSS style to apply to all rows. */
|
|
36
56
|
rowStyle?: RowStyle;
|
|
57
|
+
/** Callback to get the style for a row. */
|
|
37
58
|
getRowStyle?: (params: RowClassParams) => RowStyle | undefined;
|
|
59
|
+
/** CSS class to apply to all rows. */
|
|
38
60
|
rowClass?: string | string[];
|
|
61
|
+
/** Callback to get the class for a row. */
|
|
39
62
|
getRowClass?: (params: RowClassParams) => string | string[] | undefined;
|
|
63
|
+
/** Rules for applying CSS classes to rows based on data. */
|
|
40
64
|
rowClassRules?: RowClassRules<TData>;
|
|
65
|
+
/** If true, row hover highlight will be suppressed. */
|
|
41
66
|
suppressRowHoverHighlight?: boolean;
|
|
67
|
+
/** If true, column hover highlight will be enabled. */
|
|
42
68
|
columnHoverHighlight?: boolean;
|
|
43
69
|
|
|
44
70
|
// === SELECTION ===
|
|
71
|
+
/** Row selection options. Can be 'single', 'multiple', or an options object. */
|
|
45
72
|
rowSelection?: RowSelectionOptions | 'single' | 'multiple';
|
|
73
|
+
/** Enable cell selection. */
|
|
46
74
|
cellSelection?: boolean | CellSelectionOptions;
|
|
75
|
+
/** Enable range selection. */
|
|
47
76
|
enableRangeSelection?: boolean;
|
|
77
|
+
/** Options for the selection column. */
|
|
48
78
|
selectionColumnDef?: SelectionColumnDef;
|
|
79
|
+
/** If true, cell focus will be suppressed. */
|
|
49
80
|
suppressCellFocus?: boolean;
|
|
81
|
+
/** If true, header focus will be suppressed. */
|
|
50
82
|
suppressHeaderFocus?: boolean;
|
|
83
|
+
/** If true, cell text selection will be enabled. */
|
|
51
84
|
enableCellTextSelection?: boolean;
|
|
52
85
|
|
|
53
86
|
// === SORTING ===
|
|
87
|
+
/** If true, accented characters will be treated as their unaccented equivalents for sorting. */
|
|
54
88
|
accentedSort?: boolean;
|
|
89
|
+
/** If true, multi-column sorting will be suppressed. */
|
|
55
90
|
suppressMultiSort?: boolean;
|
|
91
|
+
/** If true, multi-column sorting will always be enabled. */
|
|
56
92
|
alwaysMultiSort?: boolean;
|
|
93
|
+
/** The key used for multi-column sorting. Defaults to 'ctrl'. */
|
|
57
94
|
multiSortKey?: 'ctrl';
|
|
95
|
+
/** If true, the grid will not maintain the unsorted order of rows. */
|
|
58
96
|
suppressMaintainUnsortedOrder?: boolean;
|
|
97
|
+
/** Callback called after rows are sorted. */
|
|
59
98
|
postSortRows?: (params: PostSortRowsParams<TData>) => void;
|
|
99
|
+
/** If true, delta sorting will be enabled. */
|
|
60
100
|
deltaSort?: boolean;
|
|
61
101
|
|
|
62
102
|
// === FILTERING ===
|
|
103
|
+
/** Text to use for quick filtering. */
|
|
63
104
|
quickFilterText?: string;
|
|
105
|
+
/** If true, quick filter results will be cached. */
|
|
64
106
|
cacheQuickFilter?: boolean;
|
|
107
|
+
/** If true, hidden columns will be included in the quick filter. */
|
|
65
108
|
includeHiddenColumnsInQuickFilter?: boolean;
|
|
109
|
+
/** Callback to check if an external filter is present. */
|
|
66
110
|
isExternalFilterPresent?: () => boolean;
|
|
111
|
+
/** Callback to check if a row passes the external filter. */
|
|
67
112
|
doesExternalFilterPass?: (node: IRowNode<TData>) => boolean;
|
|
113
|
+
/** If true, children will be excluded when filtering tree data. */
|
|
68
114
|
excludeChildrenWhenTreeDataFiltering?: boolean;
|
|
115
|
+
/** Enable advanced filtering. */
|
|
69
116
|
enableAdvancedFilter?: boolean;
|
|
117
|
+
/** Enable floating filters. */
|
|
70
118
|
floatingFilter?: boolean;
|
|
71
119
|
|
|
72
120
|
// === SCROLLING ===
|
|
121
|
+
/** Always show horizontal scrollbar. */
|
|
73
122
|
alwaysShowHorizontalScroll?: boolean;
|
|
123
|
+
/** Always show vertical scrollbar. */
|
|
74
124
|
alwaysShowVerticalScroll?: boolean;
|
|
125
|
+
/** Suppress horizontal scrollbar. */
|
|
75
126
|
suppressHorizontalScroll?: boolean;
|
|
127
|
+
/** Width of the scrollbar in pixels. */
|
|
76
128
|
scrollbarWidth?: number;
|
|
77
129
|
|
|
78
130
|
// === EDITING ===
|
|
131
|
+
/** The type of editing to use. 'fullRow' or undefined. */
|
|
79
132
|
editType?: 'fullRow' | undefined;
|
|
133
|
+
/** If true, cells will start editing on a single click. */
|
|
80
134
|
singleClickEdit?: boolean;
|
|
135
|
+
/** If true, click editing will be suppressed. */
|
|
81
136
|
suppressClickEdit?: boolean;
|
|
137
|
+
/** If true, editing will stop when cells lose focus. */
|
|
82
138
|
stopEditingWhenCellsLoseFocus?: boolean;
|
|
139
|
+
/** If true, pressing Enter will navigate vertically. */
|
|
83
140
|
enterNavigatesVertically?: boolean;
|
|
141
|
+
/** If true, pressing Enter will navigate vertically after editing. */
|
|
84
142
|
enterNavigatesVerticallyAfterEdit?: boolean;
|
|
143
|
+
/** Enable undo/redo for cell editing. */
|
|
85
144
|
undoRedoCellEditing?: boolean;
|
|
145
|
+
/** The limit for undo/redo steps. */
|
|
86
146
|
undoRedoCellEditingLimit?: number;
|
|
87
147
|
|
|
88
148
|
// === PAGINATION ===
|
|
149
|
+
/** Enable pagination. */
|
|
89
150
|
pagination?: boolean;
|
|
151
|
+
/** The number of rows per page. */
|
|
90
152
|
paginationPageSize?: number;
|
|
153
|
+
/** Options for the page size selector. */
|
|
91
154
|
paginationPageSizeSelector?: number[] | boolean;
|
|
155
|
+
/** Automatically set the page size based on the grid height. */
|
|
92
156
|
paginationAutoPageSize?: boolean;
|
|
93
157
|
|
|
94
158
|
// === COLUMN SIZING ===
|
|
159
|
+
/** Default column resize behavior. */
|
|
95
160
|
colResizeDefault?: 'shift';
|
|
161
|
+
/** If true, auto-sizing will be suppressed. */
|
|
96
162
|
suppressAutoSize?: boolean;
|
|
163
|
+
/** Padding in pixels to add when auto-sizing columns. */
|
|
97
164
|
autoSizePadding?: number;
|
|
165
|
+
/** If true, column resizing will be animated. */
|
|
98
166
|
animateColumnResizing?: boolean;
|
|
99
167
|
|
|
100
168
|
// === COLUMN MOVING ===
|
|
169
|
+
/** If true, columns cannot be moved. */
|
|
101
170
|
suppressMovableColumns?: boolean;
|
|
171
|
+
/** If true, column move animation will be suppressed. */
|
|
102
172
|
suppressColumnMoveAnimation?: boolean;
|
|
103
173
|
|
|
104
174
|
// === ROW GROUPING ===
|
|
175
|
+
/** The display type for row grouping. */
|
|
105
176
|
groupDisplayType?: RowGroupingDisplayType;
|
|
177
|
+
/** Definition for the auto-group column. */
|
|
106
178
|
autoGroupColumnDef?: AutoGroupColumnDef<TData>;
|
|
179
|
+
/** Renderer for group rows. */
|
|
107
180
|
groupRowRenderer?: any;
|
|
181
|
+
/** Parameters for the group row renderer. */
|
|
108
182
|
groupRowRendererParams?: any;
|
|
183
|
+
/** If true, open parents will be hidden in groups. */
|
|
109
184
|
groupHideOpenParents?: boolean;
|
|
185
|
+
/** The default level to expand groups to. */
|
|
110
186
|
groupDefaultExpanded?: number;
|
|
187
|
+
/** When to show the row group panel. */
|
|
111
188
|
rowGroupPanelShow?: 'always' | 'onlyWhenGrouping' | 'never';
|
|
112
189
|
|
|
113
190
|
// === TREE DATA ===
|
|
191
|
+
/** Enable tree data. */
|
|
114
192
|
treeData?: boolean;
|
|
193
|
+
/** Callback to get the path for a row in tree data. */
|
|
115
194
|
getDataPath?: (data: TData) => string[];
|
|
195
|
+
/** Field to use for children in tree data. */
|
|
116
196
|
treeDataChildrenField?: string;
|
|
197
|
+
/** Field to use for parent ID in tree data. */
|
|
117
198
|
treeDataParentIdField?: string;
|
|
118
199
|
|
|
119
200
|
// === MASTER DETAIL ===
|
|
201
|
+
/** Enable master-detail. */
|
|
120
202
|
masterDetail?: boolean;
|
|
203
|
+
/** Callback to check if a row is a master row. */
|
|
121
204
|
isRowMaster?: (data: TData) => boolean;
|
|
205
|
+
/** Renderer for the detail cell. */
|
|
122
206
|
detailCellRenderer?: any;
|
|
207
|
+
/** Parameters for the detail cell renderer. */
|
|
123
208
|
detailCellRendererParams?: any;
|
|
209
|
+
/** Height in pixels for the detail row. */
|
|
124
210
|
detailRowHeight?: number;
|
|
125
211
|
|
|
126
212
|
// === PINNING ===
|
|
213
|
+
/** Enable row pinning. */
|
|
127
214
|
enableRowPinning?: boolean | 'top' | 'bottom';
|
|
215
|
+
/** Data for rows pinned to the top. */
|
|
128
216
|
pinnedTopRowData?: any[];
|
|
217
|
+
/** Data for rows pinned to the bottom. */
|
|
129
218
|
pinnedBottomRowData?: any[];
|
|
130
219
|
|
|
131
220
|
// === PIVOTING ===
|
|
221
|
+
/** Enable pivot mode. */
|
|
132
222
|
pivotMode?: boolean;
|
|
223
|
+
/** When to show the pivot panel. */
|
|
133
224
|
pivotPanelShow?: 'always' | 'onlyWhenPivoting' | 'never';
|
|
134
225
|
|
|
135
226
|
// === STYLING ===
|
|
227
|
+
/** Custom icons for the grid. */
|
|
136
228
|
icons?: Icons;
|
|
229
|
+
/** Theme for the grid. */
|
|
137
230
|
theme?: Theme | 'legacy';
|
|
231
|
+
/** Configuration for the side bar. */
|
|
138
232
|
sideBar?: any;
|
|
233
|
+
/** Component to use for the overlay. */
|
|
139
234
|
overlayComponent?: any;
|
|
235
|
+
/** Show loading overlay. */
|
|
140
236
|
loading?: boolean;
|
|
141
237
|
|
|
142
238
|
// === CONTEXT ===
|
|
239
|
+
/** Custom context object available in callbacks. */
|
|
143
240
|
context?: any;
|
|
241
|
+
/** Unique ID for the grid. */
|
|
144
242
|
gridId?: string;
|
|
243
|
+
/** Enable debug logging. */
|
|
145
244
|
debug?: boolean;
|
|
146
245
|
|
|
147
246
|
// === CALLBACKS ===
|
|
247
|
+
/** Callback to process a cell value before it's copied to the clipboard. */
|
|
148
248
|
processCellForClipboard?: (params: ProcessCellForClipboardParams<TData>) => any;
|
|
249
|
+
/** Callback to process a cell value after it's pasted from the clipboard. */
|
|
149
250
|
processCellFromClipboard?: (params: ProcessCellFromClipboardParams<TData>) => any;
|
|
251
|
+
/** Callback to get context menu items. */
|
|
150
252
|
getContextMenuItems?: (
|
|
151
253
|
params: GetContextMenuItemsParams<TData>
|
|
152
254
|
) => (DefaultMenuItem | MenuItemDef)[];
|
|
255
|
+
/** Callback to get main menu items. */
|
|
153
256
|
getMainMenuItems?: (params: GetMainMenuItemsParams<TData>) => (DefaultMenuItem | MenuItemDef)[];
|
|
154
257
|
}
|
|
155
258
|
|
|
@@ -159,182 +262,328 @@ export interface GridOptions<TData = any> {
|
|
|
159
262
|
|
|
160
263
|
export interface ColDef<TData = any, TValue = any> {
|
|
161
264
|
// === COLUMNS ===
|
|
265
|
+
/** The field of the row object to get the cell's data from. */
|
|
162
266
|
field?: keyof TData | string;
|
|
267
|
+
/** The unique ID for the column. */
|
|
163
268
|
colId?: string;
|
|
269
|
+
/** Column type or types. */
|
|
164
270
|
type?: string | string[];
|
|
271
|
+
/** The data type for the cell. */
|
|
165
272
|
cellDataType?: boolean | string;
|
|
273
|
+
/** Callback or string expression to get the cell value. */
|
|
166
274
|
valueGetter?: string | ValueGetterFunc<TData, TValue>;
|
|
275
|
+
/** Callback or string expression to format the cell value for display. */
|
|
167
276
|
valueFormatter?: string | ValueFormatterFunc<TData, TValue>;
|
|
277
|
+
/** Reference data for the column. */
|
|
168
278
|
refData?: { [key: string]: any };
|
|
279
|
+
/** Callback to create a key for the cell value. */
|
|
169
280
|
keyCreator?: KeyCreatorFunc<TValue>;
|
|
281
|
+
/** Callback to check if two values are equal. */
|
|
170
282
|
equals?: EqualsFunc<TValue>;
|
|
283
|
+
/** CSS class to apply to the tool panel for this column. */
|
|
171
284
|
toolPanelClass?: string | string[];
|
|
285
|
+
/** If true, this column will not be shown in the columns tool panel. */
|
|
172
286
|
suppressColumnsToolPanel?: boolean;
|
|
287
|
+
/** Whether to show the column when the group is open or closed. */
|
|
173
288
|
columnGroupShow?: 'open' | 'closed' | 'all';
|
|
289
|
+
/** Custom icons for the column. */
|
|
174
290
|
icons?: Icons;
|
|
291
|
+
/** If true, this column will not be navigable using the keyboard. */
|
|
175
292
|
suppressNavigable?: boolean | ((params: IsRowNavigableParams<TData>) => boolean);
|
|
293
|
+
/** Callback to suppress keyboard events for this column. */
|
|
176
294
|
suppressKeyboardEvent?: (params: SuppressKeyboardEventParams<TData>) => boolean;
|
|
295
|
+
/** If true, pasting into this column will be suppressed. */
|
|
177
296
|
suppressPaste?: boolean | ((params: SuppressPasteParams<TData>) => boolean);
|
|
297
|
+
/** If true, the fill handle will be suppressed for this column. */
|
|
178
298
|
suppressFillHandle?: boolean;
|
|
299
|
+
/** Context menu items for this column. */
|
|
179
300
|
contextMenuItems?:
|
|
180
301
|
| (DefaultMenuItem | MenuItemDef)[]
|
|
181
302
|
| ((params: any) => (DefaultMenuItem | MenuItemDef)[]);
|
|
303
|
+
/** Custom context object available in callbacks. */
|
|
182
304
|
context?: any;
|
|
183
305
|
|
|
184
306
|
// === SELECTION ===
|
|
307
|
+
/** If true, show a checkbox for row selection in this column. */
|
|
185
308
|
checkboxSelection?: boolean;
|
|
309
|
+
/** If true, show a checkbox in the header for selecting all rows. */
|
|
186
310
|
headerCheckboxSelection?: boolean;
|
|
311
|
+
/** If true, only filtered rows will be selected when the header checkbox is clicked. */
|
|
187
312
|
headerCheckboxSelectionFilteredOnly?: boolean;
|
|
188
313
|
|
|
189
314
|
// === ACCESSIBILITY ===
|
|
315
|
+
/** ARIA role for the cell. */
|
|
190
316
|
cellAriaRole?: string;
|
|
191
317
|
|
|
192
318
|
// === AGGREGATION ===
|
|
319
|
+
/** Aggregation function for the column. */
|
|
193
320
|
aggFunc?: string | IAggFunc<TData> | null;
|
|
321
|
+
/** Initial aggregation function for the column. */
|
|
194
322
|
initialAggFunc?: string | IAggFunc<TData>;
|
|
323
|
+
/** If true, enable value aggregation for this column. */
|
|
195
324
|
enableValue?: boolean;
|
|
325
|
+
/** Allowed aggregation functions for this column. */
|
|
196
326
|
allowedAggFuncs?: string[];
|
|
327
|
+
/** Default aggregation function for this column. */
|
|
197
328
|
defaultAggFunc?: string;
|
|
198
329
|
|
|
199
330
|
// === DISPLAY ===
|
|
331
|
+
/** If true, the column is hidden. */
|
|
200
332
|
hide?: boolean | null;
|
|
333
|
+
/** If true, the column is initially hidden. */
|
|
201
334
|
initialHide?: boolean;
|
|
335
|
+
/** If true, the column's visibility cannot be changed. */
|
|
202
336
|
lockVisible?: boolean;
|
|
337
|
+
/** If true, the column's position is locked. */
|
|
203
338
|
lockPosition?: boolean | 'left' | 'right';
|
|
339
|
+
/** If true, the column cannot be moved. */
|
|
204
340
|
suppressMovable?: boolean;
|
|
341
|
+
/** If true, the value formatter will be used for export. */
|
|
205
342
|
useValueFormatterForExport?: boolean;
|
|
206
343
|
|
|
207
344
|
// === EDITING ===
|
|
345
|
+
/** If true, the cell is editable. */
|
|
208
346
|
editable?: boolean | ((params: EditableCallbackParams<TData>) => boolean);
|
|
347
|
+
/** Callback or string expression to set the cell value. */
|
|
209
348
|
valueSetter?: string | ValueSetterFunc<TData, TValue>;
|
|
349
|
+
/** Callback or string expression to parse the cell value after editing. */
|
|
210
350
|
valueParser?: string | ValueParserFunc<TData, TValue>;
|
|
351
|
+
/** Cell editor component. */
|
|
211
352
|
cellEditor?: any;
|
|
353
|
+
/** Parameters for the cell editor. */
|
|
212
354
|
cellEditorParams?: any;
|
|
355
|
+
/** Selector for the cell editor. */
|
|
213
356
|
cellEditorSelector?: (params: any) => any;
|
|
357
|
+
/** If true, the cell editor will be shown in a popup. */
|
|
214
358
|
cellEditorPopup?: boolean;
|
|
359
|
+
/** The position of the cell editor popup. */
|
|
215
360
|
cellEditorPopupPosition?: 'over' | 'under';
|
|
361
|
+
/** If true, start editing on a single click. */
|
|
216
362
|
singleClickEdit?: boolean;
|
|
363
|
+
/** If true, the value parser will be used for import. */
|
|
217
364
|
useValueParserForImport?: boolean;
|
|
218
365
|
|
|
219
366
|
// === EVENTS ===
|
|
367
|
+
/** Callback called when a cell value changes. */
|
|
220
368
|
onCellValueChanged?: (params: NewValueParams<TData>) => void;
|
|
369
|
+
/** Callback called when a cell is clicked. */
|
|
221
370
|
onCellClicked?: (params: CellClickedEvent<TData>) => void;
|
|
371
|
+
/** Callback called when a cell is double clicked. */
|
|
222
372
|
onCellDoubleClicked?: (params: CellDoubleClickedEvent<TData>) => void;
|
|
373
|
+
/** Callback called when a cell context menu is triggered. */
|
|
223
374
|
onCellContextMenu?: (params: CellContextMenuEvent<TData>) => void;
|
|
224
375
|
|
|
225
376
|
// === FILTER ===
|
|
377
|
+
/** Filter component to use for this column. */
|
|
226
378
|
filter?: any;
|
|
379
|
+
/** Parameters for the filter. */
|
|
227
380
|
filterParams?: any;
|
|
381
|
+
/** Callback or string expression to get the value for filtering. */
|
|
228
382
|
filterValueGetter?: string | ValueGetterFunc<TData, any>;
|
|
383
|
+
/** Callback to get the text for quick filtering. */
|
|
229
384
|
getQuickFilterText?: (params: GetQuickFilterTextParams<TData>) => string;
|
|
385
|
+
/** If true, show a floating filter for this column. */
|
|
230
386
|
floatingFilter?: boolean;
|
|
387
|
+
/** Floating filter component. */
|
|
231
388
|
floatingFilterComponent?: any;
|
|
389
|
+
/** Parameters for the floating filter component. */
|
|
232
390
|
floatingFilterComponentParams?: any;
|
|
391
|
+
/** If true, this column will not be shown in the filters tool panel. */
|
|
233
392
|
suppressFiltersToolPanel?: boolean;
|
|
234
393
|
|
|
235
394
|
// === HEADER ===
|
|
395
|
+
/** The name of the header. */
|
|
236
396
|
headerName?: string;
|
|
397
|
+
/** Callback or string expression to get the header name. */
|
|
237
398
|
headerValueGetter?: string | HeaderValueGetterFunc<TData>;
|
|
399
|
+
/** Tooltip for the header. */
|
|
238
400
|
headerTooltip?: string;
|
|
401
|
+
/** CSS style for the header. */
|
|
239
402
|
headerStyle?: { [key: string]: any } | ((params: any) => { [key: string]: any });
|
|
403
|
+
/** CSS class for the header. */
|
|
240
404
|
headerClass?: string | string[] | ((params: any) => string | string[]);
|
|
405
|
+
/** Header component. */
|
|
241
406
|
headerComponent?: any;
|
|
407
|
+
/** Parameters for the header component. */
|
|
242
408
|
headerComponentParams?: any;
|
|
409
|
+
/** If true, wrap header text. */
|
|
243
410
|
wrapHeaderText?: boolean;
|
|
411
|
+
/** If true, automatically set header height. */
|
|
244
412
|
autoHeaderHeight?: boolean;
|
|
413
|
+
/** Menu tabs to show in the column menu. */
|
|
245
414
|
menuTabs?: ColumnMenuTab[];
|
|
415
|
+
/** If true, suppress the header menu button. */
|
|
246
416
|
suppressHeaderMenuButton?: boolean;
|
|
417
|
+
/** If true, suppress the header filter button. */
|
|
247
418
|
suppressHeaderFilterButton?: boolean;
|
|
419
|
+
/** If true, suppress the header context menu. */
|
|
248
420
|
suppressHeaderContextMenu?: boolean;
|
|
249
421
|
|
|
250
422
|
// === PINNED ===
|
|
423
|
+
/** Pin the column to 'left' or 'right'. */
|
|
251
424
|
pinned?: boolean | 'left' | 'right' | null;
|
|
425
|
+
/** Initial pinned state. */
|
|
252
426
|
initialPinned?: boolean | 'left' | 'right';
|
|
427
|
+
/** If true, the pinned state is locked. */
|
|
253
428
|
lockPinned?: boolean;
|
|
254
429
|
|
|
255
430
|
// === PIVOTING ===
|
|
431
|
+
/** If true, the column is a pivot column. */
|
|
256
432
|
pivot?: boolean | null;
|
|
433
|
+
/** Initial pivot state. */
|
|
257
434
|
initialPivot?: boolean;
|
|
435
|
+
/** Initial pivot index. */
|
|
258
436
|
pivotIndex?: number | null;
|
|
437
|
+
/** If true, enable pivoting for this column. */
|
|
259
438
|
enablePivot?: boolean;
|
|
260
439
|
|
|
261
440
|
// === RENDERING AND STYLING ===
|
|
441
|
+
/** CSS style for the cell. */
|
|
262
442
|
cellStyle?:
|
|
263
443
|
| { [key: string]: any }
|
|
264
444
|
| ((params: CellStyleParams<TData, TValue>) => { [key: string]: any });
|
|
445
|
+
/** CSS class for the cell. */
|
|
265
446
|
cellClass?: string | string[] | ((params: CellClassParams<TData, TValue>) => string | string[]);
|
|
447
|
+
/** Rules for applying CSS classes to cells based on data. */
|
|
266
448
|
cellClassRules?: { [key: string]: (params: CellClassParams<TData, TValue>) => boolean };
|
|
449
|
+
/** Cell renderer component. */
|
|
267
450
|
cellRenderer?: any;
|
|
451
|
+
/** Parameters for the cell renderer. */
|
|
268
452
|
cellRendererParams?: any;
|
|
453
|
+
/** Selector for the cell renderer. */
|
|
269
454
|
cellRendererSelector?: (params: any) => any;
|
|
455
|
+
/** If true, automatically set row height based on cell content. */
|
|
270
456
|
autoHeight?: boolean;
|
|
457
|
+
/** If true, wrap cell text. */
|
|
271
458
|
wrapText?: boolean;
|
|
459
|
+
/** If true, enable cell change flashing. */
|
|
272
460
|
enableCellChangeFlash?: boolean;
|
|
273
461
|
|
|
274
462
|
// === ROW DRAGGING ===
|
|
463
|
+
/** If true, enable row dragging for this column. */
|
|
275
464
|
rowDrag?: boolean | ((params: RowDragCallbackParams<TData>) => boolean);
|
|
465
|
+
/** Callback to get the text for row dragging. */
|
|
276
466
|
rowDragText?: (params: any) => string;
|
|
467
|
+
/** If true, this column is a drag and drop source. */
|
|
277
468
|
dndSource?: boolean | ((params: any) => boolean);
|
|
278
469
|
|
|
279
470
|
// === SPARKLINE ===
|
|
471
|
+
/** Options for sparkline rendering. */
|
|
280
472
|
sparklineOptions?: SparklineOptions;
|
|
281
473
|
|
|
474
|
+
// === PROGRESS BAR ===
|
|
475
|
+
/** Options for progress bar rendering. */
|
|
476
|
+
progressOptions?: ProgressOptions;
|
|
477
|
+
|
|
478
|
+
// === BADGE ===
|
|
479
|
+
/** Options for badge rendering. */
|
|
480
|
+
badgeOptions?: BadgeOptions;
|
|
481
|
+
|
|
482
|
+
// === BUTTON ===
|
|
483
|
+
/** Options for button rendering. */
|
|
484
|
+
buttonOptions?: ButtonOptions<TData>;
|
|
485
|
+
|
|
486
|
+
/** Options for rating (star) rendering. */
|
|
487
|
+
ratingOptions?: RatingOptions;
|
|
488
|
+
|
|
282
489
|
// === ROW GROUPING ===
|
|
490
|
+
/** If true, the column is a row group column. */
|
|
283
491
|
rowGroup?: boolean | null;
|
|
492
|
+
/** Initial row group state. */
|
|
284
493
|
initialRowGroup?: boolean;
|
|
494
|
+
/** Initial row group index. */
|
|
285
495
|
rowGroupIndex?: number | null;
|
|
496
|
+
/** If true, enable row grouping for this column. */
|
|
286
497
|
enableRowGroup?: boolean;
|
|
498
|
+
/** Field or boolean to show row group. */
|
|
287
499
|
showRowGroup?: string | boolean;
|
|
288
500
|
|
|
289
501
|
// === SORT ===
|
|
502
|
+
/** If true, the column is sortable. */
|
|
290
503
|
sortable?: boolean;
|
|
504
|
+
/** Initial sort direction or definition. */
|
|
291
505
|
sort?: SortDirection | SortDef;
|
|
506
|
+
/** Initial sort direction or definition. */
|
|
292
507
|
initialSort?: SortDirection | SortDef;
|
|
508
|
+
/** Initial sort index. */
|
|
293
509
|
sortIndex?: number | null;
|
|
510
|
+
/** Allowed sorting orders for this column. */
|
|
294
511
|
sortingOrder?: (SortDirection | SortDef)[];
|
|
512
|
+
/** Custom comparator for sorting. */
|
|
295
513
|
comparator?: SortComparatorFn<TValue>;
|
|
514
|
+
/** If true, show the unsort icon. */
|
|
296
515
|
unSortIcon?: boolean;
|
|
297
516
|
|
|
298
517
|
// === SPANNING ===
|
|
518
|
+
/** Callback to get the column span. */
|
|
299
519
|
colSpan?: (params: ColSpanParams<TData>) => number;
|
|
520
|
+
/** Whether to span rows. */
|
|
300
521
|
spanRows?: boolean | ((params: any) => boolean);
|
|
301
522
|
|
|
302
523
|
// === TOOLTIPS ===
|
|
524
|
+
/** The field to use for the tooltip. */
|
|
303
525
|
tooltipField?: keyof TData | string;
|
|
526
|
+
/** Callback to get the tooltip value. */
|
|
304
527
|
tooltipValueGetter?: (params: TooltipValueGetterParams<TData>) => string;
|
|
528
|
+
/** Tooltip component. */
|
|
305
529
|
tooltipComponent?: any;
|
|
530
|
+
/** Parameters for the tooltip component. */
|
|
306
531
|
tooltipComponentParams?: any;
|
|
307
532
|
|
|
308
533
|
// === WIDTH ===
|
|
534
|
+
/** The width of the column in pixels. */
|
|
309
535
|
width?: number;
|
|
536
|
+
/** Initial width of the column in pixels. */
|
|
310
537
|
initialWidth?: number;
|
|
538
|
+
/** Minimum width of the column in pixels. */
|
|
311
539
|
minWidth?: number;
|
|
540
|
+
/** Maximum width of the column in pixels. */
|
|
312
541
|
maxWidth?: number;
|
|
542
|
+
/** The flex factor for the column. */
|
|
313
543
|
flex?: number | null;
|
|
544
|
+
/** Initial flex factor for the column. */
|
|
314
545
|
initialFlex?: number;
|
|
546
|
+
/** If true, the column is resizable. */
|
|
315
547
|
resizable?: boolean;
|
|
548
|
+
/** If true, this column will be suppressed from size-to-fit. */
|
|
316
549
|
suppressSizeToFit?: boolean;
|
|
550
|
+
/** If true, this column will be suppressed from auto-sizing. */
|
|
317
551
|
suppressAutoSize?: boolean;
|
|
318
552
|
}
|
|
319
553
|
|
|
320
554
|
export interface ColGroupDef<TData = any> {
|
|
321
555
|
// === GROUPS (required) ===
|
|
556
|
+
/** The columns or column groups within this group. */
|
|
322
557
|
children: (ColDef<TData> | ColGroupDef<TData>)[];
|
|
558
|
+
/** The unique ID for the column group. */
|
|
323
559
|
groupId?: string;
|
|
560
|
+
/** If true, the children will be 'married' and move together. */
|
|
324
561
|
marryChildren?: boolean;
|
|
562
|
+
/** If true, the group will be open by default. */
|
|
325
563
|
openByDefault?: boolean;
|
|
564
|
+
/** Whether to show the column when the group is open or closed. */
|
|
326
565
|
columnGroupShow?: 'open' | 'closed' | 'all';
|
|
566
|
+
/** CSS class to apply to the tool panel for this group. */
|
|
327
567
|
toolPanelClass?: string | string[];
|
|
568
|
+
/** If true, this group will not be shown in the columns tool panel. */
|
|
328
569
|
suppressColumnsToolPanel?: boolean;
|
|
570
|
+
/** If true, this group will not be shown in the filters tool panel. */
|
|
329
571
|
suppressFiltersToolPanel?: boolean;
|
|
330
572
|
|
|
331
573
|
// === HEADER ===
|
|
574
|
+
/** The name of the group header. */
|
|
332
575
|
headerName?: string;
|
|
576
|
+
/** CSS class for the group header. */
|
|
333
577
|
headerClass?: string | string[] | ((params: any) => string | string[]);
|
|
578
|
+
/** Tooltip for the group header. */
|
|
334
579
|
headerTooltip?: string;
|
|
580
|
+
/** If true, automatically set header height. */
|
|
335
581
|
autoHeaderHeight?: boolean;
|
|
582
|
+
/** Header group component. */
|
|
336
583
|
headerGroupComponent?: any;
|
|
584
|
+
/** Parameters for the header group component. */
|
|
337
585
|
headerGroupComponentParams?: any;
|
|
586
|
+
/** If true, suppress the sticky label for this group. */
|
|
338
587
|
suppressStickyLabel?: boolean;
|
|
339
588
|
}
|
|
340
589
|
|
|
@@ -344,106 +593,199 @@ export interface ColGroupDef<TData = any> {
|
|
|
344
593
|
|
|
345
594
|
export interface GridApi<TData = any> {
|
|
346
595
|
// === COLUMN API ===
|
|
596
|
+
/** Returns the current column definitions. */
|
|
347
597
|
getColumnDefs(): (ColDef<TData> | ColGroupDef<TData>)[] | null;
|
|
598
|
+
/** Sets the column definitions. */
|
|
348
599
|
setColumnDefs(colDefs: (ColDef<TData> | ColGroupDef<TData>)[]): void;
|
|
600
|
+
/** Returns the column with the given key. */
|
|
349
601
|
getColumn(key: string | Column): Column | null;
|
|
602
|
+
/** Returns all columns. */
|
|
350
603
|
getAllColumns(): Column[];
|
|
604
|
+
/** Returns the row node at the given index. */
|
|
351
605
|
getDisplayedRowAtIndex(index: number): IRowNode<TData> | null;
|
|
606
|
+
/** Returns the header rows. */
|
|
607
|
+
getHeaderRows(): (Column | ColumnGroup)[][];
|
|
608
|
+
/** Returns the depth of the header. */
|
|
609
|
+
getHeaderDepth(): number;
|
|
610
|
+
/** Returns the height of the header. */
|
|
611
|
+
getHeaderHeight(): number;
|
|
612
|
+
/** Toggles the expansion state of a column group. */
|
|
613
|
+
toggleColumnGroup(groupId: string, expanded: boolean): void;
|
|
614
|
+
/** Adds a column to the row grouping. */
|
|
615
|
+
addRowGroupColumn(colId: string): void;
|
|
616
|
+
/** Removes a column from the row grouping. */
|
|
617
|
+
removeRowGroupColumn(colId: string): void;
|
|
618
|
+
/** Sets the columns to use for row grouping. */
|
|
619
|
+
setRowGroupColumns(colIds: string[]): void;
|
|
620
|
+
/** Returns the columns used for row grouping. */
|
|
621
|
+
getRowGroupColumns(): string[];
|
|
622
|
+
/** Sets the pinned state of a column. */
|
|
623
|
+
setColumnPinned(col: string | Column, pinned: 'left' | 'right' | boolean): void;
|
|
624
|
+
/** Moves a column to a new index. */
|
|
625
|
+
moveColumn(col: string | Column, toIndex: number): void;
|
|
626
|
+
/** Sets the visibility of a column. */
|
|
627
|
+
setColumnVisible(col: string | Column, visible: boolean): void;
|
|
628
|
+
/** Sets the width of a column. */
|
|
629
|
+
setColumnWidth(col: string | Column, width: number): void;
|
|
630
|
+
/** Sets the sort of a column. */
|
|
631
|
+
setColumnSort(col: string | Column, sort: SortDirection, multiSort?: boolean): void;
|
|
632
|
+
/** Notifies the grid that the sort has changed. */
|
|
633
|
+
onSortChanged(): void;
|
|
352
634
|
|
|
353
635
|
// === ROW DATA API ===
|
|
636
|
+
/** Returns all row data in the grid. */
|
|
354
637
|
getRowData(): TData[];
|
|
638
|
+
/** Sets the row data. */
|
|
355
639
|
setRowData(rowData: TData[]): void;
|
|
640
|
+
/** Applies a transaction to the row data. */
|
|
356
641
|
applyTransaction(transaction: RowDataTransaction<TData>): RowDataTransactionResult | null;
|
|
642
|
+
/** Returns the number of displayed rows. */
|
|
357
643
|
getDisplayedRowCount(): number;
|
|
644
|
+
/** Returns the Y position of the row at the given index. */
|
|
358
645
|
getRowY(index: number): number;
|
|
646
|
+
/** Returns the current aggregations. */
|
|
359
647
|
getAggregations(): { [field: string]: any };
|
|
648
|
+
/** Returns the row node with the given ID. */
|
|
360
649
|
getRowNode(id: string): IRowNode<TData> | null;
|
|
361
650
|
|
|
362
651
|
// === SELECTION API ===
|
|
652
|
+
/** Returns the data for the selected rows. */
|
|
363
653
|
getSelectedRows(): IRowNode<TData>[];
|
|
654
|
+
/** Returns the selected row nodes. */
|
|
364
655
|
getSelectedNodes(): IRowNode<TData>[];
|
|
656
|
+
/** Selects all rows. */
|
|
365
657
|
selectAll(): void;
|
|
658
|
+
/** Deselects all rows. */
|
|
366
659
|
deselectAll(): void;
|
|
367
660
|
|
|
368
661
|
// === FILTER API ===
|
|
662
|
+
/** Sets the filter model. */
|
|
369
663
|
setFilterModel(model: FilterModel): void;
|
|
664
|
+
/** Returns the filter model. */
|
|
370
665
|
getFilterModel(): FilterModel;
|
|
666
|
+
/** Notifies the grid that the filter has changed. */
|
|
371
667
|
onFilterChanged(): void;
|
|
668
|
+
/** Returns true if any filter is present. */
|
|
372
669
|
isFilterPresent(): boolean;
|
|
373
670
|
|
|
374
671
|
// === SORT API ===
|
|
672
|
+
/** Sets the sort model. */
|
|
375
673
|
setSortModel(model: SortModelItem[]): void;
|
|
674
|
+
/** Returns the sort model. */
|
|
376
675
|
getSortModel(): SortModelItem[];
|
|
676
|
+
/** Notifies the grid that the sort has changed. */
|
|
377
677
|
onSortChanged(): void;
|
|
378
678
|
|
|
379
679
|
// === PAGINATION API ===
|
|
680
|
+
/** Returns the current page size. */
|
|
380
681
|
paginationGetPageSize(): number;
|
|
682
|
+
/** Sets the page size. */
|
|
381
683
|
paginationSetPageSize(size: number): void;
|
|
684
|
+
/** Returns the current page index. */
|
|
382
685
|
paginationGetCurrentPage(): number;
|
|
686
|
+
/** Returns the total number of pages. */
|
|
383
687
|
paginationGetTotalPages(): number;
|
|
688
|
+
/** Goes to the first page. */
|
|
384
689
|
paginationGoToFirstPage(): void;
|
|
690
|
+
/** Goes to the last page. */
|
|
385
691
|
paginationGoToLastPage(): void;
|
|
692
|
+
/** Goes to the next page. */
|
|
386
693
|
paginationGoToNextPage(): void;
|
|
694
|
+
/** Goes to the previous page. */
|
|
387
695
|
paginationGoToPreviousPage(): void;
|
|
388
696
|
|
|
389
697
|
// === EXPORT API ===
|
|
698
|
+
/** Exports the grid data as CSV. */
|
|
390
699
|
exportDataAsCsv(params?: CsvExportParams): void;
|
|
700
|
+
/** Exports the grid data as Excel. */
|
|
391
701
|
exportDataAsExcel(params?: ExcelExportParams): void;
|
|
392
702
|
|
|
393
703
|
// === CLIPBOARD API ===
|
|
704
|
+
/** Copies the selected cells to the clipboard. */
|
|
394
705
|
copyToClipboard(): void;
|
|
706
|
+
/** Cuts the selected cells to the clipboard. */
|
|
395
707
|
cutToClipboard(): void;
|
|
396
708
|
|
|
397
709
|
// === STATE PERSISTENCE API ===
|
|
710
|
+
/** Returns the current grid state. */
|
|
398
711
|
getState(): GridState;
|
|
712
|
+
/** Sets the grid state. */
|
|
399
713
|
setState(state: GridState): void;
|
|
714
|
+
/** Saves the grid state. */
|
|
400
715
|
saveState(key?: string): void;
|
|
716
|
+
/** Restores the grid state. */
|
|
401
717
|
restoreState(key?: string): boolean;
|
|
718
|
+
/** Clears the grid state. */
|
|
402
719
|
clearState(key?: string): void;
|
|
720
|
+
/** Returns true if the grid has a saved state. */
|
|
403
721
|
hasState(key?: string): boolean;
|
|
722
|
+
/** Returns unique values for a field. */
|
|
404
723
|
getUniqueValues(field: string): any[];
|
|
724
|
+
/** Pastes from the clipboard. */
|
|
405
725
|
pasteFromClipboard(): void;
|
|
406
726
|
|
|
407
727
|
// === GRID STATE API ===
|
|
728
|
+
/** Returns the current grid state. */
|
|
408
729
|
getState(): GridState;
|
|
730
|
+
/** Applies a grid state. */
|
|
409
731
|
applyState(state: GridState): void;
|
|
410
732
|
|
|
411
733
|
// === FOCUS API ===
|
|
734
|
+
/** Sets the focus to the cell at the given row and column. */
|
|
412
735
|
setFocusedCell(rowIndex: number, colKey: string): void;
|
|
736
|
+
/** Returns the currently focused cell position. */
|
|
413
737
|
getFocusedCell(): CellPosition | null;
|
|
414
738
|
|
|
415
739
|
// === REFRESH API ===
|
|
740
|
+
/** Refreshes the given cells. */
|
|
416
741
|
refreshCells(params?: RefreshCellsParams): void;
|
|
742
|
+
/** Refreshes the given rows. */
|
|
417
743
|
refreshRows(params?: RefreshRowsParams): void;
|
|
744
|
+
/** Refreshes the header. */
|
|
418
745
|
refreshHeader(): void;
|
|
419
746
|
|
|
420
747
|
// === SCROLL API ===
|
|
748
|
+
/** Ensures the row at the given index is visible. */
|
|
421
749
|
ensureIndexVisible(index: number, position?: 'top' | 'bottom' | 'auto'): void;
|
|
750
|
+
/** Ensures the column with the given key is visible. */
|
|
422
751
|
ensureColumnVisible(key: string): void;
|
|
423
752
|
|
|
424
753
|
// === DESTROY API ===
|
|
754
|
+
/** Destroys the grid. */
|
|
425
755
|
destroy(): void;
|
|
426
756
|
|
|
427
757
|
// === GRID INFORMATION ===
|
|
758
|
+
/** Returns the grid ID. */
|
|
428
759
|
getGridId(): string;
|
|
760
|
+
/** Returns a grid option value. */
|
|
429
761
|
getGridOption<K extends keyof GridOptions<TData>>(key: K): GridOptions<TData>[K];
|
|
762
|
+
/** Sets a grid option value. */
|
|
430
763
|
setGridOption<K extends keyof GridOptions<TData>>(key: K, value: GridOptions<TData>[K]): void;
|
|
431
764
|
|
|
432
765
|
// === GROUP EXPANSION ===
|
|
766
|
+
/** Sets the expansion state of a row node. */
|
|
433
767
|
setRowNodeExpanded(node: IRowNode<TData>, expanded: boolean): void;
|
|
434
768
|
|
|
435
769
|
// === ROW HEIGHT API ===
|
|
770
|
+
/** Returns the Y position of the row at the given index. */
|
|
436
771
|
getRowY(index: number): number;
|
|
772
|
+
/** Returns the row index at the given Y position. */
|
|
437
773
|
getRowAtY(y: number): number;
|
|
774
|
+
/** Returns the total height of all rows. */
|
|
438
775
|
getTotalHeight(): number;
|
|
439
776
|
|
|
440
777
|
// === PIVOT API ===
|
|
778
|
+
/** Sets pivot mode. */
|
|
441
779
|
setPivotMode(pivotMode: boolean): void;
|
|
780
|
+
/** Returns true if pivot mode is enabled. */
|
|
442
781
|
isPivotMode(): boolean;
|
|
443
782
|
|
|
444
783
|
// === RANGE SELECTION ===
|
|
784
|
+
/** Returns the current cell ranges. */
|
|
445
785
|
getCellRanges(): CellRange[] | null;
|
|
786
|
+
/** Adds a cell range. */
|
|
446
787
|
addCellRange(params: CellRange): void;
|
|
788
|
+
/** Clears the range selection. */
|
|
447
789
|
clearRangeSelection(): void;
|
|
448
790
|
}
|
|
449
791
|
|
|
@@ -452,44 +794,102 @@ export interface GridApi<TData = any> {
|
|
|
452
794
|
// ============================================================================
|
|
453
795
|
|
|
454
796
|
export interface Column {
|
|
797
|
+
/** Unique ID for the column. */
|
|
455
798
|
colId: string;
|
|
799
|
+
/** The field of the row object this column represents. */
|
|
456
800
|
field?: string;
|
|
801
|
+
/** The header name for the column. */
|
|
457
802
|
headerName?: string;
|
|
803
|
+
/** The current width of the column in pixels. */
|
|
458
804
|
width: number;
|
|
805
|
+
/** The minimum width of the column in pixels. */
|
|
459
806
|
minWidth?: number;
|
|
807
|
+
/** The maximum width of the column in pixels. */
|
|
460
808
|
maxWidth?: number;
|
|
809
|
+
/** Pinned state of the column ('left', 'right', or false). */
|
|
461
810
|
pinned: 'left' | 'right' | false;
|
|
811
|
+
/** Visibility state of the column. */
|
|
462
812
|
visible: boolean;
|
|
813
|
+
/** Current sort direction ('asc', 'desc', or null). */
|
|
463
814
|
sort?: SortDirection;
|
|
815
|
+
/** Current sort index for multi-column sorting. */
|
|
464
816
|
sortIndex?: number;
|
|
817
|
+
/** Current aggregation function. */
|
|
465
818
|
aggFunc?: string | null;
|
|
819
|
+
/** True if checkbox selection is enabled for this column. */
|
|
466
820
|
checkboxSelection?: boolean;
|
|
821
|
+
/** True if header checkbox selection is enabled for this column. */
|
|
467
822
|
headerCheckboxSelection?: boolean;
|
|
823
|
+
/** Filter component or definition for this column. */
|
|
468
824
|
filter?: any;
|
|
825
|
+
/** Parent column group. */
|
|
826
|
+
parent?: ColumnGroup;
|
|
827
|
+
/** Whether to show the column when the group is open or closed. */
|
|
828
|
+
columnGroupShow?: 'open' | 'closed' | 'all';
|
|
829
|
+
/** The index of the column in the grid. */
|
|
830
|
+
colIndex?: number;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
export interface ColumnGroup {
|
|
834
|
+
groupId: string;
|
|
835
|
+
headerName?: string;
|
|
836
|
+
children: (Column | ColumnGroup)[];
|
|
837
|
+
displayedChildren: (Column | ColumnGroup)[];
|
|
838
|
+
visible: boolean;
|
|
839
|
+
expanded: boolean;
|
|
840
|
+
resizable?: boolean;
|
|
841
|
+
parent?: ColumnGroup;
|
|
842
|
+
pinned?: 'left' | 'right' | false;
|
|
843
|
+
level: number;
|
|
844
|
+
columnGroupShow?: 'open' | 'closed' | 'all';
|
|
845
|
+
marryChildren?: boolean;
|
|
846
|
+
colIndex?: number;
|
|
469
847
|
}
|
|
470
848
|
|
|
471
849
|
export interface IRowNode<TData = any> {
|
|
850
|
+
/** Unique ID for the row. */
|
|
472
851
|
id: string | null;
|
|
852
|
+
/** The row data. */
|
|
473
853
|
data: TData;
|
|
854
|
+
/** Pinned state of the row ('top', 'bottom', or false). */
|
|
474
855
|
rowPinned: 'top' | 'bottom' | false;
|
|
856
|
+
/** Height of the row in pixels. */
|
|
475
857
|
rowHeight: number | null;
|
|
858
|
+
/** True if the row is currently displayed. */
|
|
476
859
|
displayed: boolean;
|
|
860
|
+
/** True if the row is selected. */
|
|
477
861
|
selected: boolean;
|
|
862
|
+
/** True if the group row is expanded. */
|
|
478
863
|
expanded: boolean;
|
|
864
|
+
/** True if the row is a group row. */
|
|
479
865
|
group: boolean;
|
|
866
|
+
/** True if the row is a master row. */
|
|
480
867
|
master?: boolean;
|
|
868
|
+
/** True if the row is a detail row. */
|
|
481
869
|
detail?: boolean;
|
|
870
|
+
/** Reference to the master row node if this is a detail row. */
|
|
482
871
|
masterRowNode?: IRowNode<TData>;
|
|
872
|
+
/** The level of the row in grouping/tree data. */
|
|
483
873
|
level: number;
|
|
874
|
+
/** The parent row node. */
|
|
484
875
|
parent?: IRowNode<TData>;
|
|
876
|
+
/** Children row nodes if this is a group/master row. */
|
|
485
877
|
children?: IRowNode<TData>[];
|
|
878
|
+
/** Children row nodes after filtering. */
|
|
486
879
|
childrenAfterFilter?: IRowNode<TData>[];
|
|
880
|
+
/** Children row nodes after sorting. */
|
|
487
881
|
childrenAfterSort?: IRowNode<TData>[];
|
|
882
|
+
/** All leaf children row nodes. */
|
|
488
883
|
allLeafChildren?: IRowNode<TData>[];
|
|
884
|
+
/** True if this is the first child. */
|
|
489
885
|
firstChild: boolean;
|
|
886
|
+
/** True if this is the last child. */
|
|
490
887
|
lastChild: boolean;
|
|
888
|
+
/** The index of the row in the row model. */
|
|
491
889
|
rowIndex: number | null;
|
|
890
|
+
/** The index of the row as displayed. */
|
|
492
891
|
displayedRowIndex: number;
|
|
892
|
+
/** Sets the selection state of the row. */
|
|
493
893
|
setSelected(selected: boolean, clearSelection?: boolean): void;
|
|
494
894
|
}
|
|
495
895
|
|
|
@@ -610,6 +1010,100 @@ export interface RowDataTransactionResult {
|
|
|
610
1010
|
remove: IRowNode[];
|
|
611
1011
|
}
|
|
612
1012
|
|
|
1013
|
+
export interface ButtonCellRendererParams<TData = any> {
|
|
1014
|
+
/** The raw cell value */
|
|
1015
|
+
value: any;
|
|
1016
|
+
/** The row data object */
|
|
1017
|
+
data: TData;
|
|
1018
|
+
/** The row node */
|
|
1019
|
+
node: IRowNode<TData>;
|
|
1020
|
+
/** The grid API */
|
|
1021
|
+
api: GridApi<TData>;
|
|
1022
|
+
/** The column definition */
|
|
1023
|
+
colDef: ColDef<TData>;
|
|
1024
|
+
/** The original mouse event */
|
|
1025
|
+
event: MouseEvent;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
export interface ButtonOptions<TData = any> {
|
|
1029
|
+
/**
|
|
1030
|
+
* Button label. Can be a string or a function receiving cell params.
|
|
1031
|
+
* Compatible with AG Grid's cellRendererParams pattern.
|
|
1032
|
+
*/
|
|
1033
|
+
label: string | ((params: Omit<ButtonCellRendererParams<TData>, 'event'>) => string);
|
|
1034
|
+
/**
|
|
1035
|
+
* Visual style preset. Defaults to 'primary'.
|
|
1036
|
+
* - primary: filled blue
|
|
1037
|
+
* - secondary: outlined
|
|
1038
|
+
* - danger: filled red
|
|
1039
|
+
* - ghost: transparent with hover-style border
|
|
1040
|
+
*/
|
|
1041
|
+
variant?: 'primary' | 'secondary' | 'danger' | 'ghost';
|
|
1042
|
+
/** Override background fill color */
|
|
1043
|
+
fill?: string;
|
|
1044
|
+
/** Override text color */
|
|
1045
|
+
textColor?: string;
|
|
1046
|
+
/** Override border color (secondary/ghost variants) */
|
|
1047
|
+
borderColor?: string;
|
|
1048
|
+
/** Border radius in px (default: 4) */
|
|
1049
|
+
borderRadius?: number;
|
|
1050
|
+
/** Font size in px (default: 12) */
|
|
1051
|
+
fontSize?: number;
|
|
1052
|
+
/** Horizontal padding in px (default: 12) */
|
|
1053
|
+
paddingX?: number;
|
|
1054
|
+
/**
|
|
1055
|
+
* Click handler — receives AG Grid-compatible params.
|
|
1056
|
+
* Called instead of the row's onRowClicked event when the button is clicked.
|
|
1057
|
+
*/
|
|
1058
|
+
onClick?: (params: ButtonCellRendererParams<TData>) => void;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
export interface BadgeOptions {
|
|
1062
|
+
/**
|
|
1063
|
+
* Map of cell value → { fill, text } colors.
|
|
1064
|
+
* Falls back to `defaultColors` if value not found.
|
|
1065
|
+
*/
|
|
1066
|
+
colorMap?: Record<string, { fill: string; text: string }>;
|
|
1067
|
+
/** Fallback colors for values not in colorMap */
|
|
1068
|
+
defaultColors?: { fill: string; text: string };
|
|
1069
|
+
/** Border radius in px (default: 9999 for pill shape) */
|
|
1070
|
+
borderRadius?: number;
|
|
1071
|
+
/** Horizontal padding in px (default: 8) */
|
|
1072
|
+
paddingX?: number;
|
|
1073
|
+
/** Font size in px (default: 11) */
|
|
1074
|
+
fontSize?: number;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
export interface ProgressOptions {
|
|
1078
|
+
/** Minimum value (default: 0) */
|
|
1079
|
+
min?: number;
|
|
1080
|
+
/** Maximum value (default: 100) */
|
|
1081
|
+
max?: number;
|
|
1082
|
+
/** Bar fill color or function returning a color based on value */
|
|
1083
|
+
fill?: string | ((value: number) => string);
|
|
1084
|
+
/** Track background color (default: '#e5e7eb') */
|
|
1085
|
+
trackColor?: string;
|
|
1086
|
+
/** Bar height in px (default: 8) */
|
|
1087
|
+
barHeight?: number;
|
|
1088
|
+
/** Border radius in px (default: 4) */
|
|
1089
|
+
borderRadius?: number;
|
|
1090
|
+
/** Show text label after the bar (default: true) */
|
|
1091
|
+
showLabel?: boolean;
|
|
1092
|
+
/** Custom label formatter */
|
|
1093
|
+
labelFormatter?: (value: number) => string;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
export interface RatingOptions {
|
|
1097
|
+
/** Maximum number of stars (default: 5) */
|
|
1098
|
+
max?: number;
|
|
1099
|
+
/** Color of filled stars (default: '#ffb400') */
|
|
1100
|
+
color?: string;
|
|
1101
|
+
/** Color of empty stars (default: '#e5e7eb') */
|
|
1102
|
+
emptyColor?: string;
|
|
1103
|
+
/** Size of stars in px (default: 14) */
|
|
1104
|
+
size?: number;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
613
1107
|
export interface SparklineOptions {
|
|
614
1108
|
type?: 'line' | 'area' | 'column' | 'bar';
|
|
615
1109
|
line?: {
|
|
@@ -627,6 +1121,12 @@ export interface SparklineOptions {
|
|
|
627
1121
|
strokeWidth?: number;
|
|
628
1122
|
padding?: number;
|
|
629
1123
|
};
|
|
1124
|
+
bar?: {
|
|
1125
|
+
fill?: string;
|
|
1126
|
+
stroke?: string;
|
|
1127
|
+
strokeWidth?: number;
|
|
1128
|
+
padding?: number;
|
|
1129
|
+
};
|
|
630
1130
|
padding?: {
|
|
631
1131
|
top?: number;
|
|
632
1132
|
bottom?: number;
|