-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
colDef.ts
718 lines (640 loc) · 34.3 KB
/
colDef.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
import { CellClickedEvent, CellContextMenuEvent, CellDoubleClickedEvent } from "../events";
import { ICellEditorParams } from "../interfaces/iCellEditor";
import { AgGridCommon } from "../interfaces/iCommon";
import { IFilterDef } from '../interfaces/iFilter';
import { ICellRendererComp, ICellRendererFunc, ICellRendererParams } from "../rendering/cellRenderers/iCellRenderer";
import { IRowDragItem } from "../rendering/row/rowDragComp";
import { ITooltipParams } from "../rendering/tooltipComponent";
import { Column } from "./column";
import { ColumnGroup } from "./columnGroup";
import { RowClassParams } from "./gridOptions";
import { ProvidedColumnGroup } from "./providedColumnGroup";
import { RowNode } from "./rowNode";
// ***********************************************************************
// * Don't forget to update ColDefUtil if changing this class. PLEASE! *
// ***********************************************************************/
/** AbstractColDef can be a group or a column definition */
export interface AbstractColDef<TData = any> {
/** The name to render in the column header. If not specified and field is specified, the field name will be used as the header name. */
headerName?: string;
/** Function or expression. Gets the value for display in the header. */
headerValueGetter?: string | HeaderValueGetterFunc<TData>;
/** Tooltip for the column header */
headerTooltip?: string;
/** CSS class to use for the header cell. Can be a string, array of strings, or function. */
headerClass?: HeaderClass;
/** Suppress the grid taking action for the relevant keyboard event when a header is focused. */
suppressHeaderKeyboardEvent?: (params: SuppressHeaderKeyboardEventParams<TData>) => boolean;
/** Whether to show the column when the group is open / closed. */
columnGroupShow?: string;
/** CSS class to use for the tool panel cell. Can be a string, array of strings, or function. */
toolPanelClass?: ToolPanelClass<TData>;
/** Set to `true` if you do not want this column or group to appear in the Columns Tool Panel. Default: `false` */
suppressColumnsToolPanel?: boolean;
/** Set to `true` if you do not want this column (filter) or group (filter group) to appear in the Filters Tool Panel. Default: `false` */
suppressFiltersToolPanel?: boolean;
/**
* Provide your own tooltip component for the column.
* See [Tooltip Component](https://www.ag-grid.com/javascript-data-grid/component-tooltip/) for framework specific implementation details.
*/
tooltipComponent?: any;
/** @deprecated As of v27, use `tooltipComponent` for framework components too. */
tooltipComponentFramework?: any;
/** The params used to configure `tooltipComponent`. */
tooltipComponentParams?: any;
/** Never set this, it is used internally by grid when doing in-grid pivoting */
pivotKeys?: string[];
}
/** Configuration options for column groups in AG Grid. */
export interface ColGroupDef<TData = any> extends AbstractColDef<TData> {
/** A list containing a mix of columns and column groups. */
children: (ColDef<TData> | ColGroupDef<TData>)[];
/** The unique ID to give the column. This is optional. If missing, a unique ID will be generated. This ID is used to identify the column group in the column API. */
groupId?: string;
/** Set to `true` if this group should be opened by default. Default: `false` */
openByDefault?: boolean;
/** Set to `true` to keep columns in this group beside each other in the grid. Moving the columns outside of the group (and hence breaking the group) is not allowed. Default: `false` */
marryChildren?: boolean;
/**
* The custom header group component to be used for rendering the component header. If none specified the default AG Grid is used.
* See [Header Group Component](https://www.ag-grid.com/javascript-data-grid/component-header/#header-group-components/) for framework specific implementation details.
*/
headerGroupComponent?: any;
/** @deprecated As of v27, use `headerGroupComponent` for framework components too. */
headerGroupComponentFramework?: any;
/** The params used to configure the `headerGroupComponent`. */
headerGroupComponentParams?: any;
}
export interface IAggFunc<TData = any, TValue = any> {
(params: IAggFuncParams<TData, TValue>): any;
}
export interface IAggFuncParams<TData = any, TValue = any> extends AgGridCommon<TData> {
/** Values to aggregate */
values: TValue[];
/** Column the aggregation function is working on */
column: Column;
/** ColDef of the aggregation column */
colDef: ColDef<TData>;
/** The parent RowNode, where the aggregation result will be shown */
rowNode: RowNode<TData>;
/** data (if any) of the parent RowNode */
data: TData;
}
export interface HeaderClassParams<TData = any> extends AgGridCommon<TData> {
colDef: AbstractColDef<TData>;
column?: Column | null;
columnGroup?: ColumnGroup | null;
}
export type HeaderClass<TData = any> = string | string[] | ((params: HeaderClassParams<TData>) => string | string[] | undefined);
export interface ToolPanelClassParams<TData = any> extends AgGridCommon<TData> {
colDef: AbstractColDef<TData>;
column?: Column | null;
columnGroup?: ProvidedColumnGroup | null;
}
export type ToolPanelClass<TData = any> = string | string[] | ((params: ToolPanelClassParams<TData>) => string | string[] | undefined);
// ***********************************************************************
// * Don't forget to update ColDefUtil if changing this class. PLEASE! *
// ***********************************************************************/
/** Configuration options for columns in AG Grid. */
export interface ColDef<TData = any> extends AbstractColDef<TData>, IFilterDef {
// *** Columns *** //
/** The unique ID to give the column. This is optional. If missing, the ID will default to the field.
* If both field and colId are missing, a unique ID will be generated.
* This ID is used to identify the column in the API for sorting, filtering etc. */
colId?: string;
/**
* The field of the row object to get the cell's data from.
* Deep references into a row object is supported via dot notation, i.e `'address.firstLine'`.
*/
field?: string;
/**
* A comma separated string or array of strings containing `ColumnType` keys which can be used as a template for a column.
* This helps to reduce duplication of properties when you have a lot of common column properties.
*/
type?: string | string[];
/** Function or expression. Gets the value from your data for display. */
valueGetter?: string | ValueGetterFunc<TData>;
/** A function or expression to format a value, should return a string. Not used for CSV export or copy to clipboard, only for UI cell rendering. */
valueFormatter?: string | ValueFormatterFunc<TData>;
/** Provided a reference data map to be used to map column values to their respective value from the map. */
refData?: { [key: string]: string; };
/**
* Function to return a string key for a value.
* This string is used for grouping, Set filtering, and searching within cell editor dropdowns.
* When filtering and searching the string is exposed to the user, so make sure to return a human-readable value. */
keyCreator?: (params: KeyCreatorParams<TData>) => string;
/**
* Custom comparator for values, used by renderer to know if values have changed. Cells who's values have not changed don't get refreshed.
* By default the grid uses `===` is used which should work for most use cases.
*/
equals?: (valueA: any, valueB: any) => boolean;
/** The field of the tooltip to apply to the cell. */
tooltipField?: string;
/**
* Callback that should return the string to use for a tooltip, `tooltipField` takes precedence if set.
* If using a custom `tooltipComponent` you may return any custom value to be passed to your tooltip component.
*/
tooltipValueGetter?: (params: ITooltipParams<TData>) => string | any;
/** Set to `true` (or return `true` from function) to render a selection checkbox in the column. Default: `false` */
checkboxSelection?: boolean | CheckboxSelectionCallback<TData>;
/** Set to `true` to display a disabled checkbox when row is not selectable and checkboxes are enabled. Default: `false` */
showDisabledCheckboxes?: boolean;
/** Icons to use inside the column instead of the grid's default icons. Leave undefined to use defaults. */
icons?: { [key: string]: Function | string; };
/**
* Set to `true` if this column is not navigable (i.e. cannot be tabbed into), otherwise `false`.
* Can also be a callback function to have different rows navigable.
* Default: `false`
*/
suppressNavigable?: boolean | SuppressNavigableCallback<TData>;
/** Allows the user to suppress certain keyboard events in the grid cell. Default: `false` */
suppressKeyboardEvent?: (params: SuppressKeyboardEventParams<TData>) => boolean;
/**
* Pasting is on by default as long as cells are editable (non-editable cells cannot be modified, even with a paste operation).
* Set to `true` turn paste operations off.
*/
suppressPaste?: boolean | SuppressPasteCallback<TData>;
/** Set to true to prevent the fillHandle from being rendered in any cell that belongs to this column */
suppressFillHandle?: boolean;
// *** Columns: Display *** //
/** Set to `true` for this column to be hidden. Default: `false` */
hide?: boolean;
/** Same as `hide`, except only applied when creating a new column. Not applied when updating column definitions. */
initialHide?: boolean;
/** Set to `true` to block making column visible / hidden via the UI (API will still work). Default: `false` */
lockVisible?: boolean;
/** Lock a column to position to `'left'` or`'right'` to always have this column displayed in that position. true is treated as `'left'` */
lockPosition?: boolean | 'left' | 'right';
/** Set to `true` if you do not want this column to be movable via dragging. Default: `false` */
suppressMovable?: boolean;
// *** Columns: Editing *** //
/** Set to `true` if this column is editable, otherwise `false`. Can also be a function to have different rows editable. Default: `false` */
editable?: boolean | EditableCallback<TData>;
/** Function or expression. Sets the value into your data for saving. Return `true` if the data changed. */
valueSetter?: string | ValueSetterFunc<TData>;
/** Function or expression. Parses the value for saving. */
valueParser?: string | ValueParserFunc<TData>;
/**
* Provide your own cell editor component for this column's cells.
* See [Cell Editor](https://www.ag-grid.com/javascript-data-grid/component-cell-editor/) for framework specific implementation detail.
*/
cellEditor?: any;
/** @deprecated As of v27, use `cellEditor` for framework components too. */
cellEditorFramework?: any;
/** Params to be passed to the `cellEditor` component. */
cellEditorParams?: any;
/** Callback to select which cell editor to be used for a given row within the same column. */
cellEditorSelector?: CellEditorSelectorFunc<TData>;
/** Set to `true` to have cells under this column enter edit mode after single click. Default: `false` */
singleClickEdit?: boolean;
/** @deprecated use `valueSetter` instead */
newValueHandler?: (params: NewValueParams<TData>) => boolean;
/**
* Set to `true`, to have the cell editor appear in a popup.
*/
cellEditorPopup?: boolean;
/**
* Set the position for the popup cell editor. Possible values are
* - `over` Popup will be positioned over the cell
* - `under` Popup will be positioned below the cell leaving the cell value visible.
*
* Default: `over`. */
cellEditorPopupPosition?: string;
// *** Columns: Events *** //
/** Callback for after the value of a cell has changed, either due to editing or the application calling `api.setValue()`. */
onCellValueChanged?: (event: NewValueParams<TData>) => void;
/** Callback called when a cell is clicked. */
onCellClicked?: (event: CellClickedEvent<TData>) => void;
/** Callback called when a cell is double clicked. */
onCellDoubleClicked?: (event: CellDoubleClickedEvent<TData>) => void;
/** Callback called when a cell is right clicked. */
onCellContextMenu?: (event: CellContextMenuEvent<TData>) => void;
// *** Columns: Filtering *** //
/** A function to tell the grid what quick filter text to use for this column if you don't want to use the default (which is calling `toString` on the value). */
getQuickFilterText?: (params: GetQuickFilterTextParams<TData>) => string;
/** Function or expression. Gets the value for filtering purposes. */
filterValueGetter?: string | ValueGetterFunc<TData>;
/** Whether to display a floating filter for this column. Default: `false` */
floatingFilter?: boolean;
// *** Column Headers *** //
/** If enabled then column header names that are too long for the column width will wrap onto the next line. Default `false` */
wrapHeaderText?: boolean;
/** If enabled then the column header row will automatically adjust height to acommodate the size of the header cell.
* This can be useful when using your own `headerComponent` or long header names in conjunction with `wrapHeaderText`.
* Default: `false`
*/
autoHeaderHeight?: boolean;
/**
* The custom header component to be used for rendering the component header. If none specified the default AG Grid header component is used.
* See [Header Component](https://www.ag-grid.com/javascript-data-grid/component-header/) for framework specific implementation detail.
*/
headerComponent?: any;
/** @deprecated As of v27, use `headerComponent` for framework components too. */
headerComponentFramework?: any;
/** The parameters to be passed to the `headerComponent`. */
headerComponentParams?: any;
/**
* Set to an array containing zero, one or many of the following options: `'filterMenuTab' | 'generalMenuTab' | 'columnsMenuTab'`.
* This is used to figure out which menu tabs are present and in which order the tabs are shown.
*/
menuTabs?: string[];
/** Params used to change the behaviour and appearance of the Columns Menu tab. */
columnsMenuParams?: ColumnsMenuParams;
/** Set to `true` if no menu should be shown for this column header. Default: `false` */
suppressMenu?: boolean;
/** If `true` or the callback returns `true`, a 'select all' checkbox will be put into the header. */
headerCheckboxSelection?: boolean | HeaderCheckboxSelectionCallback<TData>;
/** If `true`, the header checkbox selection will only select filtered items. */
headerCheckboxSelectionFilteredOnly?: boolean;
// *** Columns: Integrated Charts *** //
/** Defines the chart data type that should be used for a column. */
chartDataType?: 'category' | 'series' | 'time' | 'excluded';
// *** Columns: Pinned *** //
/** Pin a column to one side: `right` or `left`. A value of `true` is converted to `'left'`. */
pinned?: boolean | 'left' | 'right' | null;
/** Same as `pinned`, except only applied when creating a new column. Not applied when updating column definitions. */
initialPinned?: boolean | 'left' | 'right';
/** Set to true to block the user pinning the column, the column can only be pinned via definitions or API. Default: `false` */
lockPinned?: boolean;
/** @deprecated Use cellRendererSelector if you want a different Cell Renderer for pinned rows. Check params.node.rowPinned. */
pinnedRowCellRenderer?: { new(): ICellRendererComp; } | ICellRendererFunc | string;
/** @deprecated Use cellRendererSelector if you want a different Cell Renderer for pinned rows. Check params.node.rowPinned. */
pinnedRowCellRendererFramework?: any;
/** @deprecated Use cellRendererSelector if you want a different Cell Renderer for pinned rows. Check params.node.rowPinned. */
pinnedRowCellRendererParams?: any;
/** @deprecated Use valueFormatter for pinned rows, and check params.node.rowPinned. */
pinnedRowValueFormatter?: string | ValueFormatterFunc<TData>;
// *** Columns: Pivoting *** //
/** Set to true to pivot by this column. */
pivot?: boolean;
/** Same as `pivot`, except only applied when creating a new column. Not applied when updating column definitions. */
initialPivot?: boolean;
/**
* Set this in columns you want to pivot by.
* If only pivoting by one column, set this to any number (e.g. `0`).
* If pivoting by multiple columns, set this to where you want this column to be in the order of pivots (e.g. `0` for first, `1` for second, and so on).
*/
pivotIndex?: number | null;
/** Same as `pivotIndex`, except only applied when creating a new column. Not applied when updating column definitions. */
initialPivotIndex?: number;
/**
* Comparator to use when ordering the pivot columns, when this column is used to pivot on.
* The values will always be strings, as the pivot service uses strings as keys for the pivot groups.
*/
pivotComparator?: (valueA: string, valueB: string) => number;
/** Set to `true` if you want to be able to pivot by this column via the GUI. This will not block the API or properties being used to achieve pivot. Default: `false` */
enablePivot?: boolean;
// *** Columns: Rendering and Styling *** //
/** An object of css values / or function returning an object of css values for a particular cell. */
cellStyle?: CellStyle | CellStyleFunc<TData>;
/** Class to use for the cell. Can be string, array of strings, or function that returns a string or array of strings. */
cellClass?: string | string[] | CellClassFunc<TData>;
/** Rules which can be applied to include certain CSS classes. */
cellClassRules?: CellClassRules<TData>;
/**
* Provide your own cell Renderer component for this column's cells.
* See [Cell Renderer](https://www.ag-grid.com/javascript-data-grid/component-cell-renderer/) for framework specific implementation details.
*/
cellRenderer?: any;
/** @deprecated As of v27, use `cellRenderer` for framework components too. */
cellRendererFramework?: any;
/** Params to be passed to the `cellRenderer` component. */
cellRendererParams?: any;
/** Callback to select which cell renderer to be used for a given row within the same column. */
cellRendererSelector?: CellRendererSelectorFunc<TData>;
/** Set to `true` to have the grid calculate the height of a row based on contents of this column. Default: `false` */
autoHeight?: boolean;
/** Set to `true` to have the text wrap inside the cell - typically used with `autoHeight`. Default: `false` */
wrapText?: boolean;
/** Set to `true` to flash a cell when it's refreshed. Default: `false` */
enableCellChangeFlash?: boolean;
/** Set to `true` to prevent this column from flashing on changes. Only applicable if cell flashing is turned on for the grid. Default: `false` */
suppressCellFlash?: boolean;
// *** Columns: Row Dragging *** //
/** `boolean` or `Function`. Set to `true` (or return `true` from function) to allow row dragging. Default: `false` */
rowDrag?: boolean | RowDragCallback<TData>;
/**
* A callback that should return a string to be displayed by the `rowDragComp` while dragging a row.
* If this callback is not set, the `rowDragText` callback in the `gridOptions` will be used and
* if there is no callback in the `gridOptions` the current cell value will be used.
*/
rowDragText?: (params: IRowDragItem, dragItemCount: number) => string;
/** `boolean` or `Function`. Set to `true` (or return `true` from function) to allow dragging for native drag and drop. Default: `false` */
dndSource?: boolean | DndSourceCallback<TData>;
/** Function to allow custom drag functionality for native drag and drop. */
dndSourceOnRowDrag?: (params: DndSourceOnRowDragParams<TData>) => void;
// *** Columns: Row Grouping *** //
/** Set to `true` to row group by this column. Default: `false` */
rowGroup?: boolean;
/** Same as `rowGroup`, except only applied when creating a new column. Not applied when updating column definitions. */
initialRowGroup?: boolean;
/**
* Set this in columns you want to group by.
* If only grouping by one column, set this to any number (e.g. `0`).
* If grouping by multiple columns, set this to where you want this column to be in the group (e.g. `0` for first, `1` for second, and so on).
*/
rowGroupIndex?: number | null;
/** Same as `rowGroupIndex`, except only applied when creating a new column. Not applied when updating column definitions. */
initialRowGroupIndex?: number;
/**
* Set to `true` if you want to be able to row group by this column via the GUI.
* This will not block the API or properties being used to achieve row grouping.
* Default: `false`
*/
enableRowGroup?: boolean;
/**
* Set to `true` if you want to be able to aggregate by this column via the GUI.
* This will not block the API or properties being used to achieve aggregation.
* Default: `false`
*/
enableValue?: boolean;
/** Name of function to use for aggregation. You can also provide your own agg function. */
aggFunc?: string | IAggFunc<TData> | null;
/** Same as `aggFunc`, except only applied when creating a new column. Not applied when updating column definitions. */
initialAggFunc?: string | IAggFunc<TData>;
/**
* The name of the aggregation function to use for this column when it is enabled via the GUI.
* Note that this does not immediately apply the aggregation function like `aggFunc`
* Default: `sum`
*/
defaultAggFunc?: string;
/**
* Aggregation functions allowed on this column e.g. `['sum', 'avg']`.
* If missing, all installed functions are allowed.
* This will only restrict what the GUI allows a user to select, it does not impact when you set a function via the API. */
allowedAggFuncs?: string[];
/** Set to true to have the grid place the values for the group into the cell, or put the name of a grouped column to just show that group. */
showRowGroup?: string | boolean;
// *** Columns: Sort *** //
/** Set to `true` to allow sorting on this column. Default: `false` */
sortable?: boolean;
/** If sorting by default, set it here. Set to `asc` or `desc`. */
sort?: 'asc' | 'desc' | null;
/** Same as `sort`, except only applied when creating a new column. Not applied when updating column definitions. */
initialSort?: 'asc' | 'desc' | null;
/** If sorting more than one column by default, specifies order in which the sorting should be applied. */
sortIndex?: number | null;
/** Same as `sortIndex`, except only applied when creating a new column. Not applied when updating column definitions. */
initialSortIndex?: number;
/** Array defining the order in which sorting occurs (if sorting is enabled). An array with any of the following in any order `['asc','desc',null]` */
sortingOrder?: ('asc' | 'desc' | null)[];
/**
* Override the default sorting order by providing a custom sort comparator.
*
* - `valueA`, `valueB` are the values to compare.
* - `nodeA`, `nodeB` are the corresponding RowNodes. Useful if additional details are required by the sort.
* - `isDescending` - `true` if sort direction is `desc`. Not to be used for inverting the return value as the grid already applies `asc` or `desc` ordering.
*
* Return:
* - `0` valueA is the same as valueB
* - `> 0` Sort valueA after valueB
* - `< 0` Sort valueA before valueB
*/
comparator?: (valueA: any, valueB: any, nodeA: RowNode<TData>, nodeB: RowNode<TData>, isDescending: boolean) => number;
/** Set to `true` if you want the unsorted icon to be shown when no sort is applied to this column. Default: `false` */
unSortIcon?: boolean;
/** @deprecated since v24 - use sortIndex instead*/
sortedAt?: number;
// *** Columns: Spanning *** //
/** By default, each cell will take up the width of one column. You can change this behaviour to allow cells to span multiple columns. */
colSpan?: (params: ColSpanParams<TData>) => number;
/** By default, each cell will take up the height of one row. You can change this behaviour to allow cells to span multiple rows. */
rowSpan?: (params: RowSpanParams<TData>) => number;
// *** Columns: Widths *** //
/** Initial width in pixels for the cell. */
width?: number;
/** Same as `width`, except only applied when creating a new column. Not applied when updating column definitions. */
initialWidth?: number;
/** Minimum width in pixels for the cell. */
minWidth?: number;
/** Maximum width in pixels for the cell. */
maxWidth?: number;
/** Used instead of `width` when the goal is to fill the remaining empty space of the grid. */
flex?: number;
/** Same as `flex`, except only applied when creating a new column. Not applied when updating column definitions. */
initialFlex?: number;
/** Set to `true` to allow this column should be resized. Default: `false` */
resizable?: boolean;
/** Set to `true` if you want this column's width to be fixed during 'size to fit' operations. Default: `false` */
suppressSizeToFit?: boolean;
/** Set to `true` if you do not want this column to be auto-resizable by double clicking it's edge. Default: `false` */
suppressAutoSize?: boolean;
/** Never set this, it is used internally by grid when doing in-grid pivoting */
pivotValueColumn?: Column | null;
/** Never set this, it is used internally by grid when doing in-grid pivoting */
pivotTotalColumnIds?: string[];
}
export interface ColumnFunctionCallbackParams<TData = any> extends AgGridCommon<TData> {
/** Row node for the given row */
node: RowNode<TData>;
/** Data associated with the node. Will be `undefined` for group rows. */
data: TData | undefined;
/** Column for this callback */
column: Column;
/** ColDef provided for this column */
colDef: ColDef<TData>;
}
export interface CheckboxSelectionCallbackParams<TData = any> extends ColumnFunctionCallbackParams<TData> { }
export interface CheckboxSelectionCallback<TData = any> {
(params: CheckboxSelectionCallbackParams<TData>): boolean;
}
export interface RowDragCallbackParams<TData = any> extends ColumnFunctionCallbackParams<TData> { }
export interface RowDragCallback<TData = any> {
(params: RowDragCallbackParams<TData>): boolean;
}
export interface DndSourceCallbackParams<TData = any> extends ColumnFunctionCallbackParams<TData> { }
export interface DndSourceOnRowDragParams<TData = any> extends AgGridCommon<TData> {
/** Row node for the given row */
rowNode: RowNode<TData>;
/** The DOM event that represents a drag and drop interaction */
dragEvent: DragEvent;
}
export interface DndSourceCallback<TData = any> {
(params: DndSourceCallbackParams<TData>): boolean;
}
export interface EditableCallbackParams<TData = any> extends ColumnFunctionCallbackParams<TData> { }
export interface EditableCallback<TData = any> {
(params: EditableCallbackParams<TData>): boolean;
}
export interface SuppressPasteCallbackParams<TData = any> extends ColumnFunctionCallbackParams<TData> { }
export interface SuppressPasteCallback<TData = any> {
(params: SuppressPasteCallbackParams<TData>): boolean;
}
export interface SuppressNavigableCallbackParams<TData = any> extends ColumnFunctionCallbackParams<TData> { }
export interface SuppressNavigableCallback<TData = any> {
(params: SuppressNavigableCallbackParams<TData>): boolean;
}
export interface HeaderCheckboxSelectionCallbackParams<TData = any> extends AgGridCommon<TData> {
column: Column;
colDef: ColDef<TData>;
}
export interface HeaderCheckboxSelectionCallback<TData = any> {
(params: HeaderCheckboxSelectionCallbackParams<TData>): boolean;
}
/**
* @deprecated
* No longer in use. Replaced with (params: ColumnFunctionCallbackParams) => boolean.
*/
export interface IsColumnFunc<TData = any> {
(params: IsColumnFuncParams<TData>): boolean;
}
/**
* @deprecated
* Replaced with ColumnFunctionCallbackParams
*/
export interface IsColumnFuncParams<TData = any> extends ColumnFunctionCallbackParams<TData> { }
export interface GetQuickFilterTextParams<TData = any, TValue = any> extends AgGridCommon<TData> {
/** Value for the cell. */
value: TValue;
/** Row node for the given row */
node: RowNode<TData>;
/** Row data associated with the node. */
data: TData;
/** Column for this callback */
column: Column;
/** ColDef provided for this column */
colDef: ColDef<TData>;
}
export interface ColumnsMenuParams {
/** To suppress updating the layout of columns as they are rearranged in the grid */
suppressSyncLayoutWithGrid?: boolean;
/** To suppress Column Filter section*/
suppressColumnFilter?: boolean;
/** To suppress Select / Un-select all widget*/
suppressColumnSelectAll?: boolean;
/** To suppress Expand / Collapse all widget*/
suppressColumnExpandAll?: boolean;
/** By default, column groups start expanded.
* Pass true to default to contracted groups*/
contractColumnSelection?: boolean;
}
export interface BaseColDefParams<TData = any> extends AgGridCommon<TData> {
/** Row node for the given row */
node: RowNode<TData> | null;
/** Data associated with the node */
data: TData;
/** Column for this callback */
column: Column;
/** ColDef provided for this column */
colDef: ColDef<TData>;
}
export interface BaseColDefOptionalDataParams<TData = any> extends AgGridCommon<TData> {
/** Row node for the given row */
node: RowNode<TData> | null;
/** Data associated with the node */
data: TData | undefined;
/** Column for this callback */
column: Column;
/** ColDef provided for this column */
colDef: ColDef<TData>;
}
export interface ValueGetterParams<TData = any> extends BaseColDefOptionalDataParams<TData> {
/** A utility method for getting other column values */
getValue: (field: string) => any;
}
export interface ValueGetterFunc<TData = any> {
(params: ValueGetterParams<TData>): any;
}
export interface HeaderValueGetterParams<TData = any> extends AgGridCommon<TData> {
colDef: AbstractColDef<TData>;
/** Column for this callback if applicable*/
column?: Column | null;
/** ColumnGroup for this callback if applicable */
columnGroup?: ColumnGroup | ProvidedColumnGroup | null;
/** Original column group if applicable */
providedColumnGroup: ProvidedColumnGroup | null;
/** Where the column is going to appear */
location: string | null;
}
export interface HeaderValueGetterFunc<TData = any> {
(params: HeaderValueGetterParams<TData>): any;
}
export interface NewValueParams<TData = any> extends BaseColDefParams<TData> {
/** The value before the change */
oldValue: any;
/** The value after the change */
newValue: any;
}
export interface ValueSetterParams<TData = any> extends NewValueParams<TData> {
}
export interface ValueSetterFunc<TData = any> {
(params: ValueSetterParams<TData>): boolean;
}
export interface ValueParserParams<TData = any> extends NewValueParams<TData> {
}
export interface ValueParserFunc<TData = any, TValue = any> {
(params: ValueParserParams<TData>): TValue;
}
export interface ValueFormatterParams<TData = any, TValue = any> extends BaseColDefOptionalDataParams<TData> {
/** Value for the cell. */
value: TValue;
}
export interface ValueFormatterFunc<TData = any, TValue = any> {
(params: ValueFormatterParams<TData, TValue>): string;
}
export interface KeyCreatorParams<TData = any, TValue = any> extends BaseColDefParams<TData> {
/** Value for the cell. */
value: TValue;
}
export interface ColSpanParams<TData = any> extends BaseColDefOptionalDataParams<TData> {
}
export interface RowSpanParams<TData = any> extends BaseColDefOptionalDataParams<TData> {
}
export interface SuppressKeyboardEventParams<TData = any> extends ColumnFunctionCallbackParams<TData> {
/** The keyboard event the grid received */
event: KeyboardEvent;
/** Whether the cell is editing or not */
editing: boolean;
}
export interface SuppressHeaderKeyboardEventParams<TData = any> extends AgGridCommon<TData> {
column: Column | ColumnGroup;
colDef: ColDef<TData> | ColGroupDef<TData> | null;
/** The index of the header row of the current focused header */
headerRowIndex: number;
/** The keyboard event the grid received */
event: KeyboardEvent;
}
export interface CellClassParams<TData = any, TValue = any> extends RowClassParams<TData> {
/** Column for this callback */
column: Column;
/** The colDef associated with the column for this cell */
colDef: ColDef<TData>;
/** The value to be rendered */
value: TValue;
}
export interface CellClassFunc<TData = any> {
(cellClassParams: CellClassParams<TData>): string | string[] | null | undefined;
}
export interface CellStyleFunc<TData = any> {
(cellClassParams: CellClassParams<TData>): CellStyle | null | undefined;
}
export interface CellStyle { [cssProperty: string]: string | number; }
export interface CellClassRules<TData = any> {
[cssClassName: string]: (((params: CellClassParams<TData>) => boolean) | string);
}
export interface CellRendererSelectorFunc<TData = any> {
(params: ICellRendererParams<TData>): CellRendererSelectorResult | undefined;
}
export interface CellEditorSelectorFunc<TData = any> {
(params: ICellEditorParams<TData>): CellEditorSelectorResult | undefined;
}
export interface CellRendererSelectorResult {
/** Equivalent of setting `colDef.cellRenderer` */
component?: any;
/** @deprecated As of v27, use `component` for framework components too. */
frameworkComponent?: any;
/** Equivalent of setting `colDef.cellRendererParams` */
params?: any;
}
export interface CellEditorSelectorResult {
/** Equivalent of setting `colDef.cellEditor` */
component?: any;
/** @deprecated As of v27, use `component` for framework components too. */
frameworkComponent?: any;
/** Equivalent of setting `colDef.cellEditorParams` */
params?: any;
/** Equivalent of setting `colDef.cellEditorPopup` */
popup?: boolean;
/** Equivalent of setting `colDef.cellEditorPopupPosition` */
popupPosition?: string;
}