-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
DataGridProps.ts
711 lines (703 loc) · 27.2 KB
/
DataGridProps.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
import * as React from 'react';
import { SxProps } from '@mui/system';
import { Theme } from '@mui/material/styles';
import { CommonProps } from '@mui/material/OverridableComponent';
import { GridDensity } from '../gridDensity';
import { GridEditMode, GridEditRowsModel } from '../gridEditRowModel';
import { GridFeatureMode } from '../gridFeatureMode';
import { Logger } from '../logger';
import { GridSortDirection, GridSortModel } from '../gridSortModel';
import { GridSlotsComponent } from '../gridSlotsComponent';
import { GridRowIdGetter, GridRowsProp, GridRowModel } from '../gridRows';
import { GridEventListener, GridEvents } from '../events';
import { GridCallbackDetails, GridLocaleText } from '../api';
import { GridApiCommunity } from '../api/gridApiCommunity';
import type { GridColumnTypesRecord } from '../colDef';
import type { GridColumns } from '../colDef/gridColDef';
import { GridClasses } from '../../constants/gridClasses';
import {
GridRowHeightParams,
GridRowHeightReturnValue,
GridRowParams,
GridRowSpacing,
GridRowSpacingParams,
GridRowClassNameParams,
} from '../params';
import { GridCellParams } from '../params/gridCellParams';
import { GridFilterModel } from '../gridFilterModel';
import { GridInputSelectionModel, GridSelectionModel } from '../gridSelectionModel';
import { GridInitialStateCommunity } from '../gridStateCommunity';
import { GridSlotsComponentsProps } from '../gridSlotsComponentsProps';
import { GridColumnVisibilityModel } from '../../hooks/features/columns/gridColumnsInterfaces';
export interface GridExperimentalFeatures {
/**
* Will be part of the premium-plan when fully ready.
*/
preventCommitWhileValidating: boolean;
/**
* Enables the new API for cell editing and row editing.
*/
newEditingApi: boolean;
/**
* Emits a warning if the cell receives focus without also syncing the focus state.
* Only works if NODE_ENV=test.
*/
warnIfFocusStateIsNotSynced: boolean;
}
/**
* The props users can give to the `DataGrid` component.
*/
export type DataGridProps = Omit<
Partial<DataGridPropsWithDefaultValues> &
DataGridPropsWithComplexDefaultValueBeforeProcessing &
DataGridPropsWithoutDefaultValue,
DataGridForcedPropsKey
> & {
pagination?: true;
};
/**
* The props of the `DataGrid` component after the pre-processing phase.
*/
export interface DataGridProcessedProps
extends DataGridPropsWithDefaultValues,
DataGridPropsWithComplexDefaultValueAfterProcessing,
DataGridPropsWithoutDefaultValue {}
/**
* The props of the `DataGrid` component after the pre-processing phase that the user should not be able to override.
* Those are usually used in feature-hook for which the pro-plan has more advanced features (eg: multi-sorting, multi-filtering, ...).
*/
export type DataGridForcedPropsKey =
| 'apiRef'
| 'checkboxSelectionVisibleOnly'
| 'disableMultipleColumnsFiltering'
| 'disableMultipleColumnsSorting'
| 'disableMultipleSelection'
| 'disableColumnReorder'
| 'disableColumnResize'
| 'throttleRowsMs'
| 'hideFooterRowCount'
| 'pagination'
| 'signature';
/**
* The `DataGrid` options with a default value that must be merged with the value given through props.
*/
export interface DataGridPropsWithComplexDefaultValueAfterProcessing {
components: GridSlotsComponent;
localeText: GridLocaleText;
}
/**
* The `DataGrid` options with a default value that must be merged with the value given through props.
*/
export interface DataGridPropsWithComplexDefaultValueBeforeProcessing {
/**
* Overrideable components.
*/
components?: Partial<GridSlotsComponent>;
/**
* Set the locale text of the grid.
* You can find all the translation keys supported in [the source](https://github.com/mui/mui-x/blob/HEAD/packages/grid/x-data-grid/src/constants/localeTextConstants.ts) in the GitHub repository.
*/
localeText?: Partial<GridLocaleText>;
}
/**
* The `DataGrid` options with a default value overridable through props
* None of the entry of this interface should be optional, they all have default values and `DataGridProps` already applies a `Partial<DataGridSimpleOptions>` for the public interface
* The controlled model do not have a default value at the prop processing level, so they must be defined in `DataGridOtherProps`
* TODO: add multiSortKey
*/
export interface DataGridPropsWithDefaultValues {
/**
* If `true`, the grid height is dynamic and follow the number of rows in the grid.
* @default false
*/
autoHeight: boolean;
/**
* If `true`, the pageSize is calculated according to the container size and the max number of rows to avoid rendering a vertical scroll bar.
* @default false
*/
autoPageSize: boolean;
/**
* If `true`, the grid get a first column with a checkbox that allows to select rows.
* @default false
*/
checkboxSelection: boolean;
/**
* If `true`, the "Select All" header checkbox selects only the rows on the current page. To be used in combination with `checkboxSelection`.
* It only works if the pagination is enabled.
* @default false
*/
checkboxSelectionVisibleOnly: boolean;
/**
* Number of extra columns to be rendered before/after the visible slice.
* @default 3
*/
columnBuffer: number;
/**
* Number of extra rows to be rendered before/after the visible slice.
* @default 3
*/
rowBuffer: number;
/**
* Number of rows from the `rowBuffer` that can be visible before a new slice is rendered.
* @default 3
*/
rowThreshold: number;
/**
* Number of rows from the `columnBuffer` that can be visible before a new slice is rendered.
* @default 3
*/
columnThreshold: number;
/**
* Set the density of the grid.
* @default "standard"
*/
density: GridDensity;
/**
* If `true`, rows will not be extended to fill the full width of the grid container.
* @default false
*/
disableExtendRowFullWidth: boolean;
/**
* If `true`, column filters are disabled.
* @default false
*/
disableColumnFilter: boolean;
/**
* If `true`, the column menu is disabled.
* @default false
*/
disableColumnMenu: boolean;
/**
* If `true`, hiding/showing columns is disabled.
* @default false
*/
disableColumnSelector: boolean;
/**
* If `true`, the density selector is disabled.
* @default false
*/
disableDensitySelector: boolean;
/**
* If `true`, filtering with multiple columns is disabled.
* @default false
*/
disableMultipleColumnsFiltering: boolean;
/**
* If `true`, multiple selection using the CTRL or CMD key is disabled.
* @default false
*/
disableMultipleSelection: boolean;
/**
* If `true`, sorting with multiple columns is disabled.
* @default false
*/
disableMultipleColumnsSorting: boolean;
/**
* If `true`, the selection on click on a row or cell is disabled.
* @default false
*/
disableSelectionOnClick: boolean;
/**
* If `true`, the virtualization is disabled.
* @default false
*/
disableVirtualization: boolean;
/**
* Controls whether to use the cell or row editing.
* @default "cell"
*/
editMode: GridEditMode;
/**
* Filtering can be processed on the server or client-side.
* Set it to 'server' if you would like to handle filtering on the server-side.
* @default "client"
*/
filterMode: GridFeatureMode;
/**
* Set the height in pixel of the column headers in the grid.
* @default 56
*/
headerHeight: number;
/**
* If `true`, the footer component is hidden.
* @default false
*/
hideFooter: boolean;
/**
* If `true`, the pagination component in the footer is hidden.
* @default false
*/
hideFooterPagination: boolean;
/**
* If `true`, the row count in the footer is hidden.
* It has no effect if the pagination is enabled.
* @default false
*/
hideFooterRowCount: boolean;
/**
* If `true`, the selected row count in the footer is hidden.
* @default false
*/
hideFooterSelectedRowCount: boolean;
/**
* Pass a custom logger in the components that implements the [[Logger]] interface.
* @default console
*/
logger: Logger;
/**
* Allows to pass the logging level or false to turn off logging.
* @default "debug"
*/
logLevel: keyof Logger | false;
/**
* If `true`, pagination is enabled.
* @default false
*/
pagination: boolean;
/**
* Pagination can be processed on the server or client-side.
* Set it to 'client' if you would like to handle the pagination on the client-side.
* Set it to 'server' if you would like to handle the pagination on the server-side.
* @default "client"
*/
paginationMode: GridFeatureMode;
/**
* Set the height in pixel of a row in the grid.
* @default 52
*/
rowHeight: number;
/**
* Select the pageSize dynamically using the component UI.
* @default [25, 50, 100]
*/
rowsPerPageOptions: number[];
/**
* Sets the type of space between rows added by `getRowSpacing`.
* @default "margin"
*/
rowSpacingType: 'margin' | 'border';
/**
* If `true`, the right border of the cells are displayed.
* @default false
*/
showCellRightBorder: boolean;
/**
* If `true`, the right border of the column headers are displayed.
* @default false
*/
showColumnRightBorder: boolean;
/**
* The order of the sorting sequence.
* @default ['asc', 'desc', null]
*/
sortingOrder: GridSortDirection[];
/**
* Sorting can be processed on the server or client-side.
* Set it to 'client' if you would like to handle sorting on the client-side.
* Set it to 'server' if you would like to handle sorting on the server-side.
* @default "client"
*/
sortingMode: GridFeatureMode;
/**
* If positive, the Grid will throttle updates coming from `apiRef.current.updateRows` and `apiRef.current.setRows`.
* It can be useful if you have a high update rate but do not want to do heavy work like filtering / sorting or rendering on each individual update.
* @default 0
*/
throttleRowsMs: number;
/**
* If `true`, reordering columns is disabled.
* @default false
*/
disableColumnReorder: boolean;
/**
* If `true`, resizing columns is disabled.
* @default false
*/
disableColumnResize: boolean;
}
/**
* The `DataGrid` props with no default value.
*/
export interface DataGridPropsWithoutDefaultValue extends CommonProps {
/**
* The ref object that allows grid manipulation. Can be instantiated with [[useGridApiRef()]].
* TODO: Remove `@internal` when opening `apiRef` to Community plan
* @internal
*/
apiRef?: React.MutableRefObject<GridApiCommunity>;
/**
* Signal to the underlying logic what version of the public component API
* of the data grid is exposed [[GridSignature]].
* @internal
*/
signature?: string;
/**
* Override or extend the styles applied to the component.
*/
classes?: Partial<GridClasses>;
/**
* Extend native column types with your new column types.
*/
columnTypes?: GridColumnTypesRecord;
/**
* Set the total number of rows, if it is different from the length of the value `rows` prop.
* If some rows have children (for instance in the tree data), this number represents the amount of top level rows.
*/
rowCount?: number;
/**
* Override the height/width of the grid inner scrollbar.
*/
scrollbarSize?: number;
/**
* Function that applies CSS classes dynamically on cells.
* @param {GridCellParams} params With all properties from [[GridCellParams]].
* @returns {string} The CSS class to apply to the cell.
*/
getCellClassName?: (params: GridCellParams) => string;
/**
* Function that applies CSS classes dynamically on rows.
* @param {GridRowClassNameParams} params With all properties from [[GridRowClassNameParams]].
* @returns {string} The CSS class to apply to the row.
*/
getRowClassName?: (params: GridRowClassNameParams) => string;
/**
* Function that sets the row height per row.
* @param {GridRowHeightParams} params With all properties from [[GridRowHeightParams]].
* @returns {GridRowHeightReturnValue} The row height value. If `null` or `undefined` then the default row height is applied.
*/
getRowHeight?: (params: GridRowHeightParams) => GridRowHeightReturnValue;
/**
* Function that allows to specify the spacing between rows.
* @param {GridRowSpacingParams} params With all properties from [[GridRowSpacingParams]].
* @returns {GridRowSpacing} The row spacing values.
*/
getRowSpacing?: (params: GridRowSpacingParams) => GridRowSpacing;
/**
* Function that returns the element to render in row detail.
* @param {GridRowParams} params With all properties from [[GridRowParams]].
* @returns {JSX.Element} The row detail element.
*/
getDetailPanelContent?: (params: GridRowParams) => React.ReactNode;
/**
* Callback fired when a cell is rendered, returns true if the cell is editable.
* @param {GridCellParams} params With all properties from [[GridCellParams]].
* @returns {boolean} A boolean indicating if the cell is editable.
*/
isCellEditable?: (params: GridCellParams) => boolean;
/**
* Determines if a row can be selected.
* @param {GridRowParams} params With all properties from [[GridRowParams]].
* @returns {boolean} A boolean indicating if the cell is selectable.
*/
isRowSelectable?: (params: GridRowParams) => boolean;
/**
* Callback fired when the edit cell value changes.
* @param {GridEditCellPropsParams} params With all properties from [[GridEditCellPropsParams]].
* @param {MuiEvent<React.SyntheticEvent>} event The event that caused this prop to be called.
* @param {GridCallbackDetails} details Additional details for this callback.
* @deprecated use `preProcessEditCellProps` from the [`GridColDef`](/api/data-grid/grid-col-def/)
*/
onEditCellPropsChange?: GridEventListener<GridEvents.editCellPropsChange>;
/**
* Callback fired when the cell changes are committed.
* @param {GridCellEditCommitParams} params With all properties from [[GridCellEditCommitParams]].
* @param {MuiEvent<MuiBaseEvent>} event The event that caused this prop to be called.
* @param {GridCallbackDetails} details Additional details for this callback.
*/
onCellEditCommit?: GridEventListener<GridEvents.cellEditCommit>;
/**
* Callback fired when the cell turns to edit mode.
* @param {GridCellParams} params With all properties from [[GridCellParams]].
* @param {MuiEvent<React.KeyboardEvent | React.MouseEvent>} event The event that caused this prop to be called.
*/
onCellEditStart?: GridEventListener<GridEvents.cellEditStart>;
/**
* Callback fired when the cell turns to view mode.
* @param {GridCellParams} params With all properties from [[GridCellParams]].
* @param {MuiEvent<MuiBaseEvent>} event The event that caused this prop to be called.
*/
onCellEditStop?: GridEventListener<GridEvents.cellEditStop>;
/**
* Callback fired when the row changes are committed.
* @param {GridRowId} id The row id.
* @param {MuiEvent<MuiBaseEvent>} event The event that caused this prop to be called.
*/
onRowEditCommit?: GridEventListener<GridEvents.rowEditCommit>;
/**
* Callback fired when the row turns to edit mode.
* @param {GridRowParams} params With all properties from [[GridRowParams]].
* @param {MuiEvent<React.KeyboardEvent | React.MouseEvent>} event The event that caused this prop to be called.
*/
onRowEditStart?: GridEventListener<GridEvents.rowEditStart>;
/**
* Callback fired when the row turns to view mode.
* @param {GridRowParams} params With all properties from [[GridRowParams]].
* @param {MuiEvent<MuiBaseEvent>} event The event that caused this prop to be called.
*/
onRowEditStop?: GridEventListener<GridEvents.rowEditStop>;
/**
* Callback fired when an exception is thrown in the grid.
* @param {any} args The arguments passed to the `showError` call.
* @param {MuiEvent<{}>} event The event object.
* @param {GridCallbackDetails} details Additional details for this callback.
*/
onError?: GridEventListener<GridEvents.componentError>;
/**
* Callback fired when any cell is clicked.
* @param {GridCellParams} params With all properties from [[GridCellParams]].
* @param {MuiEvent<React.MouseEvent>} event The event object.
* @param {GridCallbackDetails} details Additional details for this callback.
*/
onCellClick?: GridEventListener<GridEvents.cellClick>;
/**
* Callback fired when a double click event comes from a cell element.
* @param {GridCellParams} params With all properties from [[GridCellParams]].
* @param {MuiEvent<React.MouseEvent>} event The event object.
* @param {GridCallbackDetails} details Additional details for this callback.
*/
onCellDoubleClick?: GridEventListener<GridEvents.cellDoubleClick>;
/**
* Callback fired when a cell loses focus.
* @param {GridCellParams} params With all properties from [[GridCellParams]].
* @param {MuiEvent<MuiBaseEvent>} event The event object.
* @param {GridCallbackDetails} details Additional details for this callback.
*/
onCellFocusOut?: GridEventListener<GridEvents.cellFocusOut>;
/**
* Callback fired when a keydown event comes from a cell element.
* @param {GridCellParams} params With all properties from [[GridCellParams]].
* @param {MuiEvent<React.KeyboardEvent>} event The event object.
* @param {GridCallbackDetails} details Additional details for this callback.
*/
onCellKeyDown?: GridEventListener<GridEvents.cellKeyDown>;
/**
* Callback fired when a click event comes from a column header element.
* @param {GridColumnHeaderParams} params With all properties from [[GridColumnHeaderParams]].
* @param {MuiEvent<React.MouseEvent>} event The event object.
* @param {GridCallbackDetails} details Additional details for this callback.
*/
onColumnHeaderClick?: GridEventListener<GridEvents.columnHeaderClick>;
/**
* Callback fired when a double click event comes from a column header element.
* @param {GridColumnHeaderParams} params With all properties from [[GridColumnHeaderParams]].
* @param {MuiEvent<React.MouseEvent>} event The event object.
* @param {GridCallbackDetails} details Additional details for this callback.
*/
onColumnHeaderDoubleClick?: GridEventListener<GridEvents.columnHeaderDoubleClick>;
/**
* Callback fired when a mouseover event comes from a column header element.
* @param {GridColumnHeaderParams} params With all properties from [[GridColumnHeaderParams]].
* @param {MuiEvent<React.MouseEvent>} event The event object.
* @param {GridCallbackDetails} details Additional details for this callback.
*/
onColumnHeaderOver?: GridEventListener<GridEvents.columnHeaderOver>;
/**
* Callback fired when a mouseout event comes from a column header element.
* @param {GridColumnHeaderParams} params With all properties from [[GridColumnHeaderParams]].
* @param {MuiEvent<React.MouseEvent>} event The event object.
* @param {GridCallbackDetails} details Additional details for this callback.
*/
onColumnHeaderOut?: GridEventListener<GridEvents.columnHeaderOut>;
/**
* Callback fired when a mouse enter event comes from a column header element.
* @param {GridColumnHeaderParams} params With all properties from [[GridColumnHeaderParams]].
* @param {MuiEvent<React.MouseEvent>} event The event object.
* @param {GridCallbackDetails} details Additional details for this callback.
*/
onColumnHeaderEnter?: GridEventListener<GridEvents.columnHeaderEnter>;
/**
* Callback fired when a mouse leave event comes from a column header element.
* @param {GridColumnHeaderParams} params With all properties from [[GridColumnHeaderParams]].
* @param {MuiEvent<React.MouseEvent>} event The event object.
* @param {GridCallbackDetails} details Additional details for this callback.
*/
onColumnHeaderLeave?: GridEventListener<GridEvents.columnHeaderLeave>;
/**
* Callback fired when a column is reordered.
* @param {GridColumnOrderChangeParams} params With all properties from [[GridColumnOrderChangeParams]].
* @param {MuiEvent<{}>} event The event object.
* @param {GridCallbackDetails} details Additional details for this callback.
*/
onColumnOrderChange?: GridEventListener<GridEvents.columnOrderChange>;
/**
* Callback fired when a column visibility changes.
* Only works when no `columnVisibilityModel` is provided and if we change the visibility of a single column at a time.
* @param {GridColumnVisibilityChangeParams} params With all properties from [[GridColumnVisibilityChangeParams]].
* @param {MuiEvent<{}>} event The event object.
* @param {GridCallbackDetails} details Additional details for this callback.
* @deprecated Use `onColumnVisibilityModelChange` instead.
*/
onColumnVisibilityChange?: GridEventListener<GridEvents.columnVisibilityChange>;
/**
* Callback fired when a row is clicked.
* Not called if the target clicked is an interactive element added by the built-in columns.
* @param {GridRowParams} params With all properties from [[GridRowParams]].
* @param {MuiEvent<React.MouseEvent>} event The event object.
* @param {GridCallbackDetails} details Additional details for this callback.
*/
onRowClick?: GridEventListener<GridEvents.rowClick>;
/**
* Callback fired when a double click event comes from a row container element.
* @param {GridRowParams} params With all properties from [[RowParams]].
* @param {MuiEvent<React.MouseEvent>} event The event object.
* @param {GridCallbackDetails} details Additional details for this callback.
*/
onRowDoubleClick?: GridEventListener<GridEvents.rowDoubleClick>;
/**
* Callback fired when the grid is resized.
* @param {ElementSize} containerSize With all properties from [[ElementSize]].
* @param {MuiEvent<{}>} event The event object.
* @param {GridCallbackDetails} details Additional details for this callback.
*/
onResize?: GridEventListener<GridEvents.debouncedResize>;
/**
* Callback fired when the state of the grid is updated.
* @param {GridState} state The new state.
* @param {MuiEvent<{}>} event The event object.
* @param {GridCallbackDetails} details Additional details for this callback.
* @internal
*/
onStateChange?: GridEventListener<GridEvents.stateChange>;
/**
* The zero-based index of the current page.
* @default 0
*/
page?: number;
/**
* Callback fired when the current page has changed.
* @param {number} page Index of the page displayed on the Grid.
* @param {GridCallbackDetails} details Additional details for this callback.
*/
onPageChange?: (page: number, details: GridCallbackDetails) => void;
/**
* Set the number of rows in one page.
* If some of the rows have children (for instance in the tree data), this number represents the amount of top level rows wanted on each page.
* @default 100
*/
pageSize?: number;
/**
* Callback fired when the page size has changed.
* @param {number} pageSize Size of the page displayed on the Grid.
* @param {GridCallbackDetails} details Additional details for this callback.
*/
onPageSizeChange?: (pageSize: number, details: GridCallbackDetails) => void;
/**
* Set the edit rows model of the grid.
*/
editRowsModel?: GridEditRowsModel;
/**
* Callback fired when the `editRowsModel` changes.
* @param {GridEditRowsModel} editRowsModel With all properties from [[GridEditRowsModel]].
* @param {GridCallbackDetails} details Additional details for this callback.
*/
onEditRowsModelChange?: (editRowsModel: GridEditRowsModel, details: GridCallbackDetails) => void;
/**
* Set the filter model of the grid.
*/
filterModel?: GridFilterModel;
/**
* Callback fired when the Filter model changes before the filters are applied.
* @param {GridFilterModel} model With all properties from [[GridFilterModel]].
* @param {GridCallbackDetails} details Additional details for this callback.
*/
onFilterModelChange?: (model: GridFilterModel, details: GridCallbackDetails) => void;
/**
* Set the selection model of the grid.
*/
selectionModel?: GridInputSelectionModel;
/**
* Callback fired when the selection state of one or multiple rows changes.
* @param {GridSelectionModel} selectionModel With all the row ids [[GridSelectionModel]].
* @param {GridCallbackDetails} details Additional details for this callback.
*/
onSelectionModelChange?: (
selectionModel: GridSelectionModel,
details: GridCallbackDetails,
) => void;
/**
* Set the column visibility model of the grid.
* If defined, the grid will ignore the `hide` property in [[GridColDef]].
*/
columnVisibilityModel?: GridColumnVisibilityModel;
/**
* Callback fired when the column visibility model changes.
* @param {GridColumnVisibilityModel} model The new model.
* @param {GridCallbackDetails} details Additional details for this callback.
*/
onColumnVisibilityModelChange?: (
model: GridColumnVisibilityModel,
details: GridCallbackDetails,
) => void;
/**
* Set the sort model of the grid.
*/
sortModel?: GridSortModel;
/**
* Callback fired when the sort model changes before a column is sorted.
* @param {GridSortModel} model With all properties from [[GridSortModel]].
* @param {GridCallbackDetails} details Additional details for this callback.
*/
onSortModelChange?: (model: GridSortModel, details: GridCallbackDetails) => void;
/**
* The label of the grid.
*/
'aria-label'?: string;
/**
* The id of the element containing a label for the grid.
*/
'aria-labelledby'?: string;
/**
* Set of columns of type [[GridColumns]].
*/
columns: GridColumns;
/**
* An error that will turn the grid into its error state and display the error component.
*/
error?: any;
/**
* Return the id of a given [[GridRowModel]].
*/
getRowId?: GridRowIdGetter;
/**
* If `true`, a loading overlay is displayed.
*/
loading?: boolean;
/**
* Nonce of the inline styles for [Content Security Policy](https://www.w3.org/TR/2016/REC-CSP2-20161215/#script-src-the-nonce-attribute).
*/
nonce?: string;
/**
* Set of rows of type [[GridRowsProp]].
*/
rows: GridRowsProp;
/**
* The initial state of the DataGrid.
* The data in it will be set in the state on initialization but will not be controlled.
* If one of the data in `initialState` is also being controlled, then the control state wins.
*/
initialState?: GridInitialStateCommunity;
/**
* Overrideable components props dynamically passed to the component at rendering.
*/
componentsProps?: GridSlotsComponentsProps;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx?: SxProps<Theme>;
/**
* Features under development.
* For each feature, if the flag is not explicitly set to `true`, the feature will be fully disabled and any property / method call will not have any effect.
*/
experimentalFeatures?: Partial<GridExperimentalFeatures>;
/**
* Callback called before updating a row with new values in the row and cell editing.
* Only applied if `props.experimentalFeatures.newEditingApi: true`.
* @param {GridRowModel} newRow Row object with the new values.
* @param {GridRowModel} oldRow Row object with the old values.
* @returns {Promise<GridRowModel> | GridRowModel} The final values to update the row.
*/
processRowUpdate?: (
newRow: GridRowModel,
oldRow: GridRowModel,
) => Promise<GridRowModel> | GridRowModel;
}