material-react-table 0.22.0 → 0.22.1

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.
@@ -48,27 +48,27 @@ import { MRT_SortingFns } from './sortingFns';
48
48
 
49
49
  type LiteralUnion<T extends U, U = string> = T | (U & Record<never, never>);
50
50
 
51
- export type MRT_TableOptions<D extends Record<string, any> = {}> = Partial<
51
+ export type MRT_TableOptions<TData extends Record<string, any> = {}> = Partial<
52
52
  Omit<
53
- TableOptions<D>,
53
+ TableOptions<TData>,
54
54
  'columns' | 'data' | 'initialState' | 'state' | 'expandRowsFn'
55
55
  >
56
56
  > & {
57
- columns: MRT_ColumnDef<D>[];
58
- data: D[];
59
- expandRowsFn?: (dataRow: D) => D[];
60
- initialState?: Partial<MRT_TableState<D>>;
61
- state?: Partial<MRT_TableState<D>>;
57
+ columns: MRT_ColumnDef<TData>[];
58
+ data: TData[];
59
+ expandRowsFn?: (dataRow: TData) => TData[];
60
+ initialState?: Partial<MRT_TableState<TData>>;
61
+ state?: Partial<MRT_TableState<TData>>;
62
62
  };
63
63
 
64
- export interface MRT_RowModel<D extends Record<string, any> = {}> {
65
- flatRows: MRT_Row<D>[];
66
- rows: MRT_Row<D>[];
67
- rowsById: { [key: string]: MRT_Row<D> };
64
+ export interface MRT_RowModel<TData extends Record<string, any> = {}> {
65
+ flatRows: MRT_Row<TData>[];
66
+ rows: MRT_Row<TData>[];
67
+ rowsById: { [key: string]: MRT_Row<TData> };
68
68
  }
69
69
 
70
- export type MRT_TableInstance<D extends Record<string, any> = {}> = Omit<
71
- Table<D>,
70
+ export type MRT_TableInstance<TData extends Record<string, any> = {}> = Omit<
71
+ Table<TData>,
72
72
  | 'getAllColumns'
73
73
  | 'getAllFlatColumns'
74
74
  | 'getAllLeafColumns'
@@ -86,22 +86,22 @@ export type MRT_TableInstance<D extends Record<string, any> = {}> = Omit<
86
86
  | 'getState'
87
87
  | 'options'
88
88
  > & {
89
- getAllColumns: () => MRT_Column<D>[];
90
- getAllFlatColumns: () => MRT_Column<D>[];
91
- getAllLeafColumns: () => MRT_Column<D>[];
92
- getCenterLeafColumns: () => MRT_Column<D>[];
93
- getColumn: (columnId: string) => MRT_Column<D>;
94
- getExpandedRowModel: () => MRT_RowModel<D>;
95
- getFlatHeaders: () => MRT_Header<D>[];
96
- getLeftLeafColumns: () => MRT_Column<D>[];
97
- getPaginationRowModel: () => MRT_RowModel<D>;
98
- getPreFilteredRowModel: () => MRT_RowModel<D>;
99
- getPrePaginationRowModel: () => MRT_RowModel<D>;
100
- getRightLeafColumns: () => MRT_Column<D>[];
101
- getRowModel: () => MRT_RowModel<D>;
102
- getSelectedRowModel: () => MRT_RowModel<D>;
103
- getState: () => MRT_TableState<D>;
104
- options: MaterialReactTableProps<D> & {
89
+ getAllColumns: () => MRT_Column<TData>[];
90
+ getAllFlatColumns: () => MRT_Column<TData>[];
91
+ getAllLeafColumns: () => MRT_Column<TData>[];
92
+ getCenterLeafColumns: () => MRT_Column<TData>[];
93
+ getColumn: (columnId: string) => MRT_Column<TData>;
94
+ getExpandedRowModel: () => MRT_RowModel<TData>;
95
+ getFlatHeaders: () => MRT_Header<TData>[];
96
+ getLeftLeafColumns: () => MRT_Column<TData>[];
97
+ getPaginationRowModel: () => MRT_RowModel<TData>;
98
+ getPreFilteredRowModel: () => MRT_RowModel<TData>;
99
+ getPrePaginationRowModel: () => MRT_RowModel<TData>;
100
+ getRightLeafColumns: () => MRT_Column<TData>[];
101
+ getRowModel: () => MRT_RowModel<TData>;
102
+ getSelectedRowModel: () => MRT_RowModel<TData>;
103
+ getState: () => MRT_TableState<TData>;
104
+ options: MaterialReactTableProps<TData> & {
105
105
  icons: MRT_Icons;
106
106
  tableId: string;
107
107
  localization: MRT_Localization;
@@ -121,23 +121,24 @@ export type MRT_TableInstance<D extends Record<string, any> = {}> = Omit<
121
121
  setShowGlobalFilter: Dispatch<SetStateAction<boolean>>;
122
122
  };
123
123
 
124
- export type MRT_TableState<D extends Record<string, any> = {}> = TableState & {
125
- currentEditingCell: MRT_Cell<D> | null;
126
- currentEditingRow: MRT_Row<D> | null;
127
- currentFilterFns: Record<string, MRT_FilterOption>;
128
- currentGlobalFilterFn: Record<string, MRT_FilterOption>;
129
- density: 'comfortable' | 'compact' | 'spacious';
130
- isLoading: boolean;
131
- isFullScreen: boolean;
132
- showAlertBanner: boolean;
133
- showFilters: boolean;
134
- showGlobalFilter: boolean;
135
- showProgressBars: boolean;
136
- showSkeletons: boolean;
137
- };
124
+ export type MRT_TableState<TData extends Record<string, any> = {}> =
125
+ TableState & {
126
+ currentEditingCell: MRT_Cell<TData> | null;
127
+ currentEditingRow: MRT_Row<TData> | null;
128
+ currentFilterFns: Record<string, MRT_FilterOption>;
129
+ currentGlobalFilterFn: Record<string, MRT_FilterOption>;
130
+ density: 'comfortable' | 'compact' | 'spacious';
131
+ isLoading: boolean;
132
+ isFullScreen: boolean;
133
+ showAlertBanner: boolean;
134
+ showFilters: boolean;
135
+ showGlobalFilter: boolean;
136
+ showProgressBars: boolean;
137
+ showSkeletons: boolean;
138
+ };
138
139
 
139
- export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
140
- ColumnDef<D>,
140
+ export type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<
141
+ ColumnDef<TData>,
141
142
  | 'accessorFn'
142
143
  | 'accessorKey'
143
144
  | 'aggregatedCell'
@@ -153,29 +154,29 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
153
154
  cell,
154
155
  table,
155
156
  }: {
156
- cell: MRT_Cell<D>;
157
- table: MRT_TableInstance<D>;
157
+ cell: MRT_Cell<TData>;
158
+ table: MRT_TableInstance<TData>;
158
159
  }) => ReactNode;
159
160
  Cell?: ({
160
161
  cell,
161
162
  table,
162
163
  }: {
163
- cell: MRT_Cell<D>;
164
- table: MRT_TableInstance<D>;
164
+ cell: MRT_Cell<TData>;
165
+ table: MRT_TableInstance<TData>;
165
166
  }) => ReactNode;
166
167
  Edit?: ({
167
168
  cell,
168
169
  table,
169
170
  }: {
170
- cell: MRT_Cell<D>;
171
- table: MRT_TableInstance<D>;
171
+ cell: MRT_Cell<TData>;
172
+ table: MRT_TableInstance<TData>;
172
173
  }) => ReactNode;
173
174
  Filter?: ({
174
175
  header,
175
176
  table,
176
177
  }: {
177
- header: MRT_Header<D>;
178
- table: MRT_TableInstance<D>;
178
+ header: MRT_Header<TData>;
179
+ table: MRT_TableInstance<TData>;
179
180
  }) => ReactNode;
180
181
  Footer?:
181
182
  | ReactNode
@@ -183,8 +184,8 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
183
184
  footer,
184
185
  table,
185
186
  }: {
186
- footer: MRT_Header<D>;
187
- table: MRT_TableInstance<D>;
187
+ footer: MRT_Header<TData>;
188
+ table: MRT_TableInstance<TData>;
188
189
  }) => ReactNode);
189
190
  Header?:
190
191
  | ReactNode
@@ -192,8 +193,8 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
192
193
  header,
193
194
  table,
194
195
  }: {
195
- header: MRT_Header<D>;
196
- table: MRT_TableInstance<D>;
196
+ header: MRT_Header<TData>;
197
+ table: MRT_TableInstance<TData>;
197
198
  }) => ReactNode);
198
199
  /**
199
200
  * Either an `accessorKey` or a combination of an `accessorFn` and `id` are required for a data column definition.
@@ -201,14 +202,14 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
201
202
  *
202
203
  * @example accessorFn: (row) => row.username
203
204
  */
204
- accessorFn?: (row: D) => any;
205
+ accessorFn?: (row: TData) => any;
205
206
  /**
206
207
  * Either an `accessorKey` or a combination of an `accessorFn` and `id` are required for a data column definition.
207
208
  * Specify which key in the row this column should use to access the correct data.
208
209
  *
209
210
  * @example accessorKey: 'username'
210
211
  */
211
- accessorKey?: LiteralUnion<string & keyof D>;
212
+ accessorKey?: LiteralUnion<string & keyof TData>;
212
213
  /**
213
214
  * Specify what type of column this is. Either `data`, `display`, or `group`. Defaults to `data`.
214
215
  * Leave this blank if you are just creating a normal data column.
@@ -218,16 +219,22 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
218
219
  * @example columnDefType: 'display'
219
220
  */
220
221
  columnDefType?: 'data' | 'display' | 'group';
221
- columns?: MRT_ColumnDef<D>[];
222
+ columns?: MRT_ColumnDef<TData>[];
222
223
  enableClickToCopy?: boolean;
223
224
  enableColumnActions?: boolean;
224
225
  enableColumnFilterChangeMode?: boolean;
225
226
  enableColumnOrdering?: boolean;
226
227
  enableEditing?: boolean;
227
228
  enabledColumnFilterOptions?: MRT_FilterOption[] | null;
228
- filterFn?: MRT_FilterFn<D>;
229
+ filterFn?: MRT_FilterFn<TData>;
229
230
  filterSelectOptions?: (string | { text: string; value: string })[];
231
+ /**
232
+ * footer must be a string. If you want custom JSX to render the footer, you can also specify a `Footer` option. (Capital F)
233
+ */
230
234
  footer?: string;
235
+ /**
236
+ * header must be a string. If you want custom JSX to render the header, you can also specify a `Header` option. (Capital H)
237
+ */
231
238
  header: string;
232
239
  /**
233
240
  * Either an `accessorKey` or a combination of an `accessorFn` and `id` are required for a data column definition.
@@ -238,15 +245,15 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
238
245
  *
239
246
  * @default gets set to the same value as `accessorKey` by default
240
247
  */
241
- id?: LiteralUnion<string & keyof D>;
248
+ id?: LiteralUnion<string & keyof TData>;
242
249
  muiTableBodyCellCopyButtonProps?:
243
250
  | ButtonProps
244
251
  | (({
245
252
  table,
246
253
  cell,
247
254
  }: {
248
- table: MRT_TableInstance<D>;
249
- cell: MRT_Cell<D>;
255
+ table: MRT_TableInstance<TData>;
256
+ cell: MRT_Cell<TData>;
250
257
  }) => ButtonProps);
251
258
  muiTableBodyCellEditTextFieldProps?:
252
259
  | TextFieldProps
@@ -254,8 +261,8 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
254
261
  table,
255
262
  cell,
256
263
  }: {
257
- table: MRT_TableInstance<D>;
258
- cell: MRT_Cell<D>;
264
+ table: MRT_TableInstance<TData>;
265
+ cell: MRT_Cell<TData>;
259
266
  }) => TextFieldProps);
260
267
  muiTableBodyCellProps?:
261
268
  | TableCellProps
@@ -263,8 +270,8 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
263
270
  table,
264
271
  cell,
265
272
  }: {
266
- table: MRT_TableInstance<D>;
267
- cell: MRT_Cell<D>;
273
+ table: MRT_TableInstance<TData>;
274
+ cell: MRT_Cell<TData>;
268
275
  }) => TableCellProps);
269
276
  muiTableFooterCellProps?:
270
277
  | TableCellProps
@@ -272,8 +279,8 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
272
279
  table,
273
280
  column,
274
281
  }: {
275
- table: MRT_TableInstance<D>;
276
- column: MRT_Column<D>;
282
+ table: MRT_TableInstance<TData>;
283
+ column: MRT_Column<TData>;
277
284
  }) => TableCellProps);
278
285
  muiTableHeadCellColumnActionsButtonProps?:
279
286
  | IconButtonProps
@@ -281,8 +288,8 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
281
288
  table,
282
289
  column,
283
290
  }: {
284
- table: MRT_TableInstance<D>;
285
- column: MRT_Column<D>;
291
+ table: MRT_TableInstance<TData>;
292
+ column: MRT_Column<TData>;
286
293
  }) => IconButtonProps);
287
294
  muiTableHeadCellFilterTextFieldProps?:
288
295
  | TextFieldProps
@@ -290,8 +297,8 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
290
297
  table,
291
298
  column,
292
299
  }: {
293
- table: MRT_TableInstance<D>;
294
- column: MRT_Column<D>;
300
+ table: MRT_TableInstance<TData>;
301
+ column: MRT_Column<TData>;
295
302
  }) => TextFieldProps);
296
303
  muiTableHeadCellProps?:
297
304
  | TableCellProps
@@ -299,8 +306,8 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
299
306
  table,
300
307
  column,
301
308
  }: {
302
- table: MRT_TableInstance<D>;
303
- column: MRT_Column<D>;
309
+ table: MRT_TableInstance<TData>;
310
+ column: MRT_Column<TData>;
304
311
  }) => TableCellProps);
305
312
  onCellEditBlur?: ({
306
313
  cell,
@@ -308,8 +315,8 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
308
315
  table,
309
316
  }: {
310
317
  event: FocusEvent<HTMLInputElement>;
311
- cell: MRT_Cell<D>;
312
- table: MRT_TableInstance<D>;
318
+ cell: MRT_Cell<TData>;
319
+ table: MRT_TableInstance<TData>;
313
320
  }) => void;
314
321
  onCellEditChange?: ({
315
322
  cell,
@@ -317,77 +324,77 @@ export type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<
317
324
  table,
318
325
  }: {
319
326
  event: ChangeEvent<HTMLInputElement>;
320
- cell: MRT_Cell<D>;
321
- table: MRT_TableInstance<D>;
327
+ cell: MRT_Cell<TData>;
328
+ table: MRT_TableInstance<TData>;
322
329
  }) => void;
323
330
  sortingFn?: MRT_SortingFn;
324
331
  };
325
332
 
326
- export type MRT_DefinedColumnDef<D extends Record<string, any> = {}> = Omit<
327
- MRT_ColumnDef<D>,
333
+ export type MRT_DefinedColumnDef<TData extends Record<string, any> = {}> = Omit<
334
+ MRT_ColumnDef<TData>,
328
335
  'id'
329
336
  > & {
330
337
  id: string;
331
338
  };
332
339
 
333
- export type MRT_Column<D extends Record<string, any> = {}> = Omit<
334
- Column<D>,
340
+ export type MRT_Column<TData extends Record<string, any> = {}> = Omit<
341
+ Column<TData>,
335
342
  'header' | 'footer' | 'columns' | 'columnDef' | 'filterFn'
336
343
  > & {
337
- columnDef: MRT_DefinedColumnDef<D>;
338
- columns?: MRT_Column<D>[];
339
- filterFn?: MRT_FilterFn<D>;
344
+ columnDef: MRT_DefinedColumnDef<TData>;
345
+ columns?: MRT_Column<TData>[];
346
+ filterFn?: MRT_FilterFn<TData>;
340
347
  footer: string;
341
348
  header: string;
342
349
  };
343
350
 
344
- export type MRT_Header<D extends Record<string, any> = {}> = Omit<
345
- Header<D>,
351
+ export type MRT_Header<TData extends Record<string, any> = {}> = Omit<
352
+ Header<TData>,
346
353
  'column'
347
354
  > & {
348
- column: MRT_Column<D>;
355
+ column: MRT_Column<TData>;
349
356
  };
350
357
 
351
- export type MRT_HeaderGroup<D extends Record<string, any> = {}> = Omit<
352
- HeaderGroup<D>,
358
+ export type MRT_HeaderGroup<TData extends Record<string, any> = {}> = Omit<
359
+ HeaderGroup<TData>,
353
360
  'headers'
354
361
  > & {
355
- headers: MRT_Header<D>[];
362
+ headers: MRT_Header<TData>[];
356
363
  };
357
364
 
358
- export type MRT_Row<D extends Record<string, any> = {}> = Omit<
359
- Row<D>,
365
+ export type MRT_Row<TData extends Record<string, any> = {}> = Omit<
366
+ Row<TData>,
360
367
  'getVisibleCells' | 'getAllCells' | 'subRows' | 'original' | '_valuesCache'
361
368
  > & {
362
- getAllCells: () => MRT_Cell<D>[];
363
- getVisibleCells: () => MRT_Cell<D>[];
364
- subRows?: MRT_Row<D>[];
365
- original: D;
366
- _valuesCache?: D;
369
+ getAllCells: () => MRT_Cell<TData>[];
370
+ getVisibleCells: () => MRT_Cell<TData>[];
371
+ subRows?: MRT_Row<TData>[];
372
+ original: TData;
373
+ _valuesCache?: TData;
367
374
  };
368
375
 
369
- export type MRT_Cell<D extends Record<string, any> = {}> = Omit<
370
- Cell<D>,
376
+ export type MRT_Cell<TData extends Record<string, any> = {}> = Omit<
377
+ Cell<TData>,
371
378
  'column' | 'row'
372
379
  > & {
373
- column: MRT_Column<D>;
374
- row: MRT_Row<D>;
380
+ column: MRT_Column<TData>;
381
+ row: MRT_Row<TData>;
375
382
  };
376
383
 
377
384
  export type MRT_SortingOption = keyof typeof MRT_SortingFns;
378
385
 
379
- export type MRT_SortingFn<D extends Record<string, any> = {}> =
380
- | SortingFn<D>
386
+ export type MRT_SortingFn<TData extends Record<string, any> = {}> =
387
+ | SortingFn<TData>
381
388
  | MRT_SortingOption;
382
389
 
383
390
  export type MRT_FilterOption = keyof typeof MRT_FilterFns;
384
391
 
385
- export type MRT_FilterFn<D extends Record<string, any> = {}> =
386
- | FilterFn<D>
392
+ export type MRT_FilterFn<TData extends Record<string, any> = {}> =
393
+ | FilterFn<TData>
387
394
  | MRT_FilterOption;
388
395
 
389
- export type MaterialReactTableProps<D extends Record<string, any> = {}> =
390
- MRT_TableOptions<D> & {
396
+ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
397
+ MRT_TableOptions<TData> & {
391
398
  editingMode?: 'table' | 'row' | 'cell';
392
399
  enableClickToCopy?: boolean;
393
400
  enableColumnActions?: boolean;
@@ -416,32 +423,36 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
416
423
  localization?: Partial<MRT_Localization>;
417
424
  muiExpandAllButtonProps?:
418
425
  | IconButtonProps
419
- | (({ table }: { table: MRT_TableInstance<D> }) => IconButtonProps);
426
+ | (({ table }: { table: MRT_TableInstance<TData> }) => IconButtonProps);
420
427
  muiExpandButtonProps?:
421
428
  | IconButtonProps
422
429
  | (({
423
430
  table,
424
431
  }: {
425
- table: MRT_TableInstance<D>;
426
- row: MRT_Row<D>;
432
+ table: MRT_TableInstance<TData>;
433
+ row: MRT_Row<TData>;
427
434
  }) => IconButtonProps);
428
435
  muiLinearProgressProps?:
429
436
  | LinearProgressProps
430
- | (({ table }: { table: MRT_TableInstance<D> }) => LinearProgressProps);
437
+ | (({
438
+ table,
439
+ }: {
440
+ table: MRT_TableInstance<TData>;
441
+ }) => LinearProgressProps);
431
442
  muiSearchTextFieldProps?:
432
443
  | TextFieldProps
433
- | (({ table }: { table: MRT_TableInstance<D> }) => TextFieldProps);
444
+ | (({ table }: { table: MRT_TableInstance<TData> }) => TextFieldProps);
434
445
  muiSelectAllCheckboxProps?:
435
446
  | CheckboxProps
436
- | (({ table }: { table: MRT_TableInstance<D> }) => CheckboxProps);
447
+ | (({ table }: { table: MRT_TableInstance<TData> }) => CheckboxProps);
437
448
  muiSelectCheckboxProps?:
438
449
  | CheckboxProps
439
450
  | (({
440
451
  table,
441
452
  row,
442
453
  }: {
443
- table: MRT_TableInstance<D>;
444
- row: MRT_Row<D>;
454
+ table: MRT_TableInstance<TData>;
455
+ row: MRT_Row<TData>;
445
456
  }) => CheckboxProps);
446
457
  muiTableBodyCellCopyButtonProps?:
447
458
  | ButtonProps
@@ -449,8 +460,8 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
449
460
  table,
450
461
  cell,
451
462
  }: {
452
- table: MRT_TableInstance<D>;
453
- cell: MRT_Cell<D>;
463
+ table: MRT_TableInstance<TData>;
464
+ cell: MRT_Cell<TData>;
454
465
  }) => ButtonProps);
455
466
  muiTableBodyCellEditTextFieldProps?:
456
467
  | TextFieldProps
@@ -458,8 +469,8 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
458
469
  table,
459
470
  cell,
460
471
  }: {
461
- table: MRT_TableInstance<D>;
462
- cell: MRT_Cell<D>;
472
+ table: MRT_TableInstance<TData>;
473
+ cell: MRT_Cell<TData>;
463
474
  }) => TextFieldProps);
464
475
  muiTableBodyCellProps?:
465
476
  | TableCellProps
@@ -467,8 +478,8 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
467
478
  table,
468
479
  cell,
469
480
  }: {
470
- table: MRT_TableInstance<D>;
471
- cell: MRT_Cell<D>;
481
+ table: MRT_TableInstance<TData>;
482
+ cell: MRT_Cell<TData>;
472
483
  }) => TableCellProps);
473
484
  muiTableBodyCellSkeletonProps?:
474
485
  | SkeletonProps
@@ -476,32 +487,36 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
476
487
  table,
477
488
  cell,
478
489
  }: {
479
- table: MRT_TableInstance<D>;
480
- cell: MRT_Cell<D>;
490
+ table: MRT_TableInstance<TData>;
491
+ cell: MRT_Cell<TData>;
481
492
  }) => SkeletonProps);
482
493
  muiTableBodyProps?:
483
494
  | TableBodyProps
484
- | (({ table }: { table: MRT_TableInstance<D> }) => TableBodyProps);
495
+ | (({ table }: { table: MRT_TableInstance<TData> }) => TableBodyProps);
485
496
  muiTableBodyRowProps?:
486
497
  | TableRowProps
487
498
  | (({
488
499
  table,
489
500
  row,
490
501
  }: {
491
- table: MRT_TableInstance<D>;
492
- row: MRT_Row<D>;
502
+ table: MRT_TableInstance<TData>;
503
+ row: MRT_Row<TData>;
493
504
  }) => TableRowProps);
494
505
  muiTableContainerProps?:
495
506
  | TableContainerProps
496
- | (({ table }: { table: MRT_TableInstance<D> }) => TableContainerProps);
507
+ | (({
508
+ table,
509
+ }: {
510
+ table: MRT_TableInstance<TData>;
511
+ }) => TableContainerProps);
497
512
  muiTableDetailPanelProps?:
498
513
  | TableCellProps
499
514
  | (({
500
515
  table,
501
516
  row,
502
517
  }: {
503
- table: MRT_TableInstance<D>;
504
- row: MRT_Row<D>;
518
+ table: MRT_TableInstance<TData>;
519
+ row: MRT_Row<TData>;
505
520
  }) => TableCellProps);
506
521
  muiTableFooterCellProps?:
507
522
  | TableCellProps
@@ -509,20 +524,20 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
509
524
  table,
510
525
  column,
511
526
  }: {
512
- table: MRT_TableInstance<D>;
513
- column: MRT_Column<D>;
527
+ table: MRT_TableInstance<TData>;
528
+ column: MRT_Column<TData>;
514
529
  }) => TableCellProps);
515
530
  muiTableFooterProps?:
516
531
  | TableFooterProps
517
- | (({ table }: { table: MRT_TableInstance<D> }) => TableFooterProps);
532
+ | (({ table }: { table: MRT_TableInstance<TData> }) => TableFooterProps);
518
533
  muiTableFooterRowProps?:
519
534
  | TableRowProps
520
535
  | (({
521
536
  table,
522
537
  footerGroup,
523
538
  }: {
524
- table: MRT_TableInstance<D>;
525
- footerGroup: MRT_HeaderGroup<D>;
539
+ table: MRT_TableInstance<TData>;
540
+ footerGroup: MRT_HeaderGroup<TData>;
526
541
  }) => TableRowProps);
527
542
  muiTableHeadCellColumnActionsButtonProps?:
528
543
  | IconButtonProps
@@ -530,8 +545,8 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
530
545
  table,
531
546
  column,
532
547
  }: {
533
- table: MRT_TableInstance<D>;
534
- column: MRT_Column<D>;
548
+ table: MRT_TableInstance<TData>;
549
+ column: MRT_Column<TData>;
535
550
  }) => IconButtonProps);
536
551
  muiTableHeadCellFilterTextFieldProps?:
537
552
  | TextFieldProps
@@ -539,8 +554,8 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
539
554
  table,
540
555
  column,
541
556
  }: {
542
- table: MRT_TableInstance<D>;
543
- column: MRT_Column<D>;
557
+ table: MRT_TableInstance<TData>;
558
+ column: MRT_Column<TData>;
544
559
  }) => TextFieldProps);
545
560
  muiTableHeadCellProps?:
546
561
  | TableCellProps
@@ -548,51 +563,51 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
548
563
  table,
549
564
  column,
550
565
  }: {
551
- table: MRT_TableInstance<D>;
552
- column: MRT_Column<D>;
566
+ table: MRT_TableInstance<TData>;
567
+ column: MRT_Column<TData>;
553
568
  }) => TableCellProps);
554
569
  muiTableHeadProps?:
555
570
  | TableHeadProps
556
- | (({ table }: { table: MRT_TableInstance<D> }) => TableHeadProps);
571
+ | (({ table }: { table: MRT_TableInstance<TData> }) => TableHeadProps);
557
572
  muiTableHeadRowProps?:
558
573
  | TableRowProps
559
574
  | (({
560
575
  table,
561
576
  headerGroup,
562
577
  }: {
563
- table: MRT_TableInstance<D>;
564
- headerGroup: MRT_HeaderGroup<D>;
578
+ table: MRT_TableInstance<TData>;
579
+ headerGroup: MRT_HeaderGroup<TData>;
565
580
  }) => TableRowProps);
566
581
  muiTablePaginationProps?:
567
582
  | Partial<TablePaginationProps>
568
583
  | (({
569
584
  table,
570
585
  }: {
571
- table: MRT_TableInstance<D>;
586
+ table: MRT_TableInstance<TData>;
572
587
  }) => Partial<TablePaginationProps>);
573
588
  muiTablePaperProps?:
574
589
  | PaperProps
575
- | (({ table }: { table: MRT_TableInstance<D> }) => PaperProps);
590
+ | (({ table }: { table: MRT_TableInstance<TData> }) => PaperProps);
576
591
  muiTableProps?:
577
592
  | TableProps
578
- | (({ table }: { table: MRT_TableInstance<D> }) => TableProps);
593
+ | (({ table }: { table: MRT_TableInstance<TData> }) => TableProps);
579
594
  muiTableToolbarAlertBannerProps?:
580
595
  | AlertProps
581
- | (({ table }: { table: MRT_TableInstance<D> }) => AlertProps);
596
+ | (({ table }: { table: MRT_TableInstance<TData> }) => AlertProps);
582
597
  muiTableToolbarBottomProps?:
583
598
  | ToolbarProps
584
- | (({ table }: { table: MRT_TableInstance<D> }) => ToolbarProps);
599
+ | (({ table }: { table: MRT_TableInstance<TData> }) => ToolbarProps);
585
600
  muiTableToolbarTopProps?:
586
601
  | ToolbarProps
587
- | (({ table }: { table: MRT_TableInstance<D> }) => ToolbarProps);
602
+ | (({ table }: { table: MRT_TableInstance<TData> }) => ToolbarProps);
588
603
  onCellEditBlur?: ({
589
604
  cell,
590
605
  event,
591
606
  table,
592
607
  }: {
593
608
  event: FocusEvent<HTMLInputElement>;
594
- cell: MRT_Cell<D>;
595
- table: MRT_TableInstance<D>;
609
+ cell: MRT_Cell<TData>;
610
+ table: MRT_TableInstance<TData>;
596
611
  }) => void;
597
612
  onCellEditChange?: ({
598
613
  cell,
@@ -600,8 +615,8 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
600
615
  table,
601
616
  }: {
602
617
  event: ChangeEvent<HTMLInputElement>;
603
- cell: MRT_Cell<D>;
604
- table: MRT_TableInstance<D>;
618
+ cell: MRT_Cell<TData>;
619
+ table: MRT_TableInstance<TData>;
605
620
  }) => void;
606
621
  onCurrentEditingCellChange?: OnChangeFn<MRT_Cell>;
607
622
  onCurrentEditingRowChange?: OnChangeFn<MRT_Row>;
@@ -611,8 +626,8 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
611
626
  row,
612
627
  table,
613
628
  }: {
614
- row: MRT_Row<D>;
615
- table: MRT_TableInstance<D>;
629
+ row: MRT_Row<TData>;
630
+ table: MRT_TableInstance<TData>;
616
631
  }) => Promise<void> | void;
617
632
  onDensityChange?: OnChangeFn<boolean>;
618
633
  onIsFullScreenChange?: OnChangeFn<boolean>;
@@ -627,8 +642,8 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
627
642
  row,
628
643
  table,
629
644
  }: {
630
- row: MRT_Row<D>;
631
- table: MRT_TableInstance<D>;
645
+ row: MRT_Row<TData>;
646
+ table: MRT_TableInstance<TData>;
632
647
  }) => ReactNode;
633
648
  renderRowActionMenuItems?: ({
634
649
  closeMenu,
@@ -636,25 +651,25 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
636
651
  table,
637
652
  }: {
638
653
  closeMenu: () => void;
639
- row: MRT_Row<D>;
640
- table: MRT_TableInstance<D>;
654
+ row: MRT_Row<TData>;
655
+ table: MRT_TableInstance<TData>;
641
656
  }) => ReactNode[];
642
657
  renderRowActions?: ({
643
658
  row,
644
659
  table,
645
660
  }: {
646
- row: MRT_Row<D>;
647
- table: MRT_TableInstance<D>;
661
+ row: MRT_Row<TData>;
662
+ table: MRT_TableInstance<TData>;
648
663
  }) => ReactNode;
649
664
  renderToolbarBottomCustomActions?: ({
650
665
  table,
651
666
  }: {
652
- table: MRT_TableInstance<D>;
667
+ table: MRT_TableInstance<TData>;
653
668
  }) => ReactNode;
654
669
  renderToolbarTopCustomActions?: ({
655
670
  table,
656
671
  }: {
657
- table: MRT_TableInstance<D>;
672
+ table: MRT_TableInstance<TData>;
658
673
  }) => ReactNode;
659
674
  renderToolbarInternalActions?: ({
660
675
  table,
@@ -664,21 +679,21 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
664
679
  MRT_ToggleDensePaddingButton,
665
680
  MRT_FullScreenToggleButton,
666
681
  }: {
667
- table: MRT_TableInstance<D>;
682
+ table: MRT_TableInstance<TData>;
668
683
  MRT_ToggleGlobalFilterButton: FC<
669
- IconButtonProps & { table: MRT_TableInstance<D> }
684
+ IconButtonProps & { table: MRT_TableInstance<TData> }
670
685
  >;
671
686
  MRT_ToggleFiltersButton: FC<
672
- IconButtonProps & { table: MRT_TableInstance<D> }
687
+ IconButtonProps & { table: MRT_TableInstance<TData> }
673
688
  >;
674
689
  MRT_ShowHideColumnsButton: FC<
675
- IconButtonProps & { table: MRT_TableInstance<D> }
690
+ IconButtonProps & { table: MRT_TableInstance<TData> }
676
691
  >;
677
692
  MRT_ToggleDensePaddingButton: FC<
678
- IconButtonProps & { table: MRT_TableInstance<D> }
693
+ IconButtonProps & { table: MRT_TableInstance<TData> }
679
694
  >;
680
695
  MRT_FullScreenToggleButton: FC<
681
- IconButtonProps & { table: MRT_TableInstance<D> }
696
+ IconButtonProps & { table: MRT_TableInstance<TData> }
682
697
  >;
683
698
  }) => ReactNode;
684
699
  rowCount?: number;
@@ -688,7 +703,7 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
688
703
  virtualizerProps?: Partial<VirtualizerOptions<HTMLDivElement>>;
689
704
  };
690
705
 
691
- export default <D extends Record<string, any> = {}>({
706
+ export default <TData extends Record<string, any> = {}>({
692
707
  autoResetExpanded = false,
693
708
  columnResizeMode = 'onEnd',
694
709
  defaultColumn = { minSize: 40, maxSize: 1000, size: 180 },
@@ -729,7 +744,7 @@ export default <D extends Record<string, any> = {}>({
729
744
  rowNumberMode = 'original',
730
745
  selectAllMode = 'all',
731
746
  ...rest
732
- }: MaterialReactTableProps<D>) => (
747
+ }: MaterialReactTableProps<TData>) => (
733
748
  <MRT_TableRoot
734
749
  autoResetExpanded={autoResetExpanded}
735
750
  columnResizeMode={columnResizeMode}