material-react-table 0.7.0-alpha.1 → 0.7.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MaterialReactTable.d.ts +195 -58
- package/dist/material-react-table.cjs.development.js +239 -931
- package/dist/material-react-table.cjs.development.js.map +1 -1
- package/dist/material-react-table.cjs.production.min.js +1 -1
- package/dist/material-react-table.cjs.production.min.js.map +1 -1
- package/dist/material-react-table.esm.js +239 -931
- package/dist/material-react-table.esm.js.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +1 -1
- package/src/MaterialReactTable.tsx +364 -126
- package/src/body/MRT_TableBody.tsx +1 -1
- package/src/body/MRT_TableBodyCell.tsx +3 -3
- package/src/body/MRT_TableBodyRow.tsx +2 -2
- package/src/body/MRT_TableDetailPanel.tsx +6 -4
- package/src/buttons/MRT_CopyButton.tsx +2 -2
- package/src/buttons/MRT_EditActionButtons.tsx +4 -2
- package/src/buttons/MRT_ExpandButton.tsx +1 -1
- package/src/buttons/MRT_ToggleColumnActionMenuButton.tsx +5 -2
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +1 -1
- package/src/buttons/MRT_ToggleSearchButton.tsx +6 -1
- package/src/footer/MRT_TableFooter.tsx +1 -1
- package/src/footer/MRT_TableFooterCell.tsx +2 -2
- package/src/footer/MRT_TableFooterRow.tsx +1 -1
- package/src/head/MRT_TableHead.tsx +1 -1
- package/src/head/MRT_TableHeadCell.tsx +22 -29
- package/src/head/MRT_TableHeadRow.tsx +1 -1
- package/src/inputs/MRT_EditCellTextField.tsx +7 -7
- package/src/inputs/MRT_FilterTextField.tsx +2 -2
- package/src/inputs/MRT_SearchTextField.tsx +8 -3
- package/src/inputs/MRT_SelectCheckbox.tsx +9 -7
- package/src/menus/MRT_RowActionMenu.tsx +5 -3
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +4 -5
- package/src/table/MRT_Table.tsx +1 -1
- package/src/table/MRT_TableContainer.tsx +16 -20
- package/src/table/MRT_TablePaper.tsx +9 -5
- package/src/toolbar/MRT_LinearProgressBar.tsx +1 -1
- package/src/toolbar/MRT_TablePagination.tsx +3 -2
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +2 -1
- package/src/toolbar/MRT_ToolbarBottom.tsx +1 -1
- package/src/toolbar/MRT_ToolbarInternalButtons.tsx +5 -4
- package/src/toolbar/MRT_ToolbarTop.tsx +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChangeEvent, Dispatch, FC, MouseEvent, ReactNode, SetStateAction } from 'react';
|
|
2
2
|
import { AlertProps, ButtonProps, CheckboxProps, IconButtonProps, LinearProgressProps, PaperProps, SkeletonProps, TableBodyProps, TableCellProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, TableProps, TableRowProps, TextFieldProps, ToolbarProps } from '@mui/material';
|
|
3
|
-
import { Cell, Column, ColumnDef, DefaultGenerics, FilterType, Header, HeaderGroup, Options, Overwrite, PaginationState, Row, TableInstance, TableState } from '@tanstack/react-table';
|
|
3
|
+
import { Cell, Column, ColumnDef, DefaultGenerics, FilterType, Header, HeaderGroup, Options, Overwrite, PaginationState, Row, TableInstance, TableState, VisibilityState } from '@tanstack/react-table';
|
|
4
4
|
import { MRT_Localization } from './localization';
|
|
5
5
|
import { MRT_Icons } from './icons';
|
|
6
6
|
import { MRT_FILTER_TYPE } from './enums';
|
|
@@ -23,11 +23,11 @@ export declare type MRT_TableInstance<D extends Record<string, any> = {}> = Omit
|
|
|
23
23
|
}>>, 'getAllColumns' | 'getAllLeafColumns' | 'getExpandedRowModel' | 'getPaginationRowModel' | 'getPrePaginationRowModel' | 'getRowModel' | 'getSelectedRowModel' | 'getState' | 'options'> & {
|
|
24
24
|
getAllColumns: () => MRT_ColumnInstance<D>[];
|
|
25
25
|
getAllLeafColumns: () => MRT_ColumnInstance<D>[];
|
|
26
|
-
getExpandedRowModel: () => MRT_RowModel
|
|
27
|
-
getPaginationRowModel: () => MRT_RowModel
|
|
28
|
-
getPrePaginationRowModel: () => MRT_RowModel
|
|
29
|
-
getRowModel: () => MRT_RowModel
|
|
30
|
-
getSelectedRowModel: () => MRT_RowModel
|
|
26
|
+
getExpandedRowModel: () => MRT_RowModel<D>;
|
|
27
|
+
getPaginationRowModel: () => MRT_RowModel<D>;
|
|
28
|
+
getPrePaginationRowModel: () => MRT_RowModel<D>;
|
|
29
|
+
getRowModel: () => MRT_RowModel<D>;
|
|
30
|
+
getSelectedRowModel: () => MRT_RowModel<D>;
|
|
31
31
|
getState: () => MRT_TableState<D>;
|
|
32
32
|
options: MaterialReactTableProps<D> & {
|
|
33
33
|
icons: MRT_Icons;
|
|
@@ -58,10 +58,9 @@ export declare type MRT_TableState<D extends Record<string, any> = {}> = Omit<Ta
|
|
|
58
58
|
pagination: Partial<PaginationState>;
|
|
59
59
|
};
|
|
60
60
|
export declare type MRT_ColumnInterface<D extends Record<string, any> = {}> = Omit<ColumnDef<D>, 'header' | 'footer' | 'columns'> & {
|
|
61
|
-
Edit?: ({ cell, tableInstance,
|
|
61
|
+
Edit?: ({ cell, tableInstance, }: {
|
|
62
62
|
cell: MRT_Cell<D>;
|
|
63
63
|
tableInstance: MRT_TableInstance<D>;
|
|
64
|
-
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
65
64
|
}) => ReactNode;
|
|
66
65
|
Filter?: ({ header, tableInstance, }: {
|
|
67
66
|
header: MRT_Header<D>;
|
|
@@ -84,8 +83,6 @@ export declare type MRT_ColumnInterface<D extends Record<string, any> = {}> = Om
|
|
|
84
83
|
enableClickToCopy?: boolean;
|
|
85
84
|
enableColumnActions?: boolean;
|
|
86
85
|
enableEditing?: boolean;
|
|
87
|
-
enableColumnFilters?: boolean;
|
|
88
|
-
enableHiding?: boolean;
|
|
89
86
|
enabledFilterTypes?: (MRT_FILTER_TYPE | string)[];
|
|
90
87
|
filter?: MRT_FilterType | string | FilterType<D>;
|
|
91
88
|
filterSelectOptions?: (string | {
|
|
@@ -94,15 +91,43 @@ export declare type MRT_ColumnInterface<D extends Record<string, any> = {}> = Om
|
|
|
94
91
|
})[];
|
|
95
92
|
footer?: string;
|
|
96
93
|
header: string;
|
|
97
|
-
muiTableBodyCellCopyButtonProps?: ButtonProps | ((cell
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
94
|
+
muiTableBodyCellCopyButtonProps?: ButtonProps | (({ tableInstance, cell, }: {
|
|
95
|
+
tableInstance: MRT_TableInstance;
|
|
96
|
+
cell: MRT_Cell<D>;
|
|
97
|
+
}) => ButtonProps);
|
|
98
|
+
muiTableBodyCellEditTextFieldProps?: TextFieldProps | (({ tableInstance, cell, }: {
|
|
99
|
+
tableInstance: MRT_TableInstance;
|
|
100
|
+
cell: MRT_Cell<D>;
|
|
101
|
+
}) => TextFieldProps);
|
|
102
|
+
muiTableBodyCellProps?: TableCellProps | (({ tableInstance, cell, }: {
|
|
103
|
+
tableInstance: MRT_TableInstance;
|
|
104
|
+
cell: MRT_Cell<D>;
|
|
105
|
+
}) => TableCellProps);
|
|
106
|
+
muiTableFooterCellProps?: TableCellProps | (({ tableInstance, column, }: {
|
|
107
|
+
tableInstance: MRT_TableInstance;
|
|
108
|
+
column: MRT_ColumnInstance<D>;
|
|
109
|
+
}) => TableCellProps);
|
|
110
|
+
muiTableHeadCellColumnActionsButtonProps?: IconButtonProps | (({ tableInstance, column, }: {
|
|
111
|
+
tableInstance: MRT_TableInstance;
|
|
112
|
+
column: MRT_ColumnInstance<D>;
|
|
113
|
+
}) => IconButtonProps);
|
|
114
|
+
muiTableHeadCellFilterTextFieldProps?: TextFieldProps | (({ tableInstance, column, }: {
|
|
115
|
+
tableInstance: MRT_TableInstance;
|
|
116
|
+
column: MRT_ColumnInstance<D>;
|
|
117
|
+
}) => TextFieldProps);
|
|
118
|
+
muiTableHeadCellProps?: TableCellProps | (({ tableInstance, column, }: {
|
|
119
|
+
tableInstance: MRT_TableInstance;
|
|
120
|
+
column: MRT_ColumnInstance<D>;
|
|
121
|
+
}) => TableCellProps);
|
|
122
|
+
onCellEditChange?: ({ cell, event, tableInstance, }: {
|
|
123
|
+
event: ChangeEvent<HTMLInputElement>;
|
|
124
|
+
cell: MRT_Cell<D>;
|
|
125
|
+
tableInstance: MRT_TableInstance<D>;
|
|
126
|
+
}) => void;
|
|
127
|
+
onColumnFilterValueChange?: ({ event, filterValue, }: {
|
|
128
|
+
event: ChangeEvent<HTMLInputElement>;
|
|
129
|
+
filterValue: any;
|
|
130
|
+
}) => void;
|
|
106
131
|
};
|
|
107
132
|
export declare type MRT_ColumnInstance<D extends Record<string, any> = {}> = Omit<Column<D>, 'header' | 'footer' | 'columns'> & MRT_ColumnInterface<D> & {
|
|
108
133
|
columns?: MRT_ColumnInstance<D>[];
|
|
@@ -154,49 +179,161 @@ export declare type MaterialReactTableProps<D extends Record<string, any> = {}>
|
|
|
154
179
|
isReloading?: boolean;
|
|
155
180
|
isLoading?: boolean;
|
|
156
181
|
localization?: Partial<MRT_Localization>;
|
|
157
|
-
muiLinearProgressProps?: LinearProgressProps | ((tableInstance:
|
|
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
|
-
|
|
182
|
+
muiLinearProgressProps?: LinearProgressProps | (({ tableInstance, }: {
|
|
183
|
+
tableInstance: MRT_TableInstance;
|
|
184
|
+
}) => LinearProgressProps);
|
|
185
|
+
muiSearchTextFieldProps?: TextFieldProps | (({ tableInstance, }: {
|
|
186
|
+
tableInstance: MRT_TableInstance;
|
|
187
|
+
}) => TextFieldProps);
|
|
188
|
+
muiSelectCheckboxProps?: CheckboxProps | (({ tableInstance, isSelectAll, row, }: {
|
|
189
|
+
tableInstance: MRT_TableInstance;
|
|
190
|
+
isSelectAll: boolean;
|
|
191
|
+
row?: MRT_Row<D>;
|
|
192
|
+
}) => CheckboxProps);
|
|
193
|
+
muiTableBodyCellCopyButtonProps?: ButtonProps | (({ tableInstance, cell, }: {
|
|
194
|
+
tableInstance: MRT_TableInstance;
|
|
195
|
+
cell: MRT_Cell<D>;
|
|
196
|
+
}) => ButtonProps);
|
|
197
|
+
muiTableBodyCellEditTextFieldProps?: TextFieldProps | (({ tableInstance, cell, }: {
|
|
198
|
+
tableInstance: MRT_TableInstance;
|
|
199
|
+
cell: MRT_Cell<D>;
|
|
200
|
+
}) => TextFieldProps);
|
|
201
|
+
muiTableBodyCellProps?: TableCellProps | (({ tableInstance, cell, }: {
|
|
202
|
+
tableInstance: MRT_TableInstance;
|
|
203
|
+
cell: MRT_Cell<D>;
|
|
204
|
+
}) => TableCellProps);
|
|
205
|
+
muiTableBodyCellSkeletonProps?: SkeletonProps | (({ tableInstance, cell, }: {
|
|
206
|
+
tableInstance: MRT_TableInstance;
|
|
207
|
+
cell: MRT_Cell<D>;
|
|
208
|
+
}) => SkeletonProps);
|
|
209
|
+
muiTableBodyProps?: TableBodyProps | (({ tableInstance, }: {
|
|
210
|
+
tableInstance: MRT_TableInstance;
|
|
211
|
+
}) => TableBodyProps);
|
|
212
|
+
muiTableBodyRowProps?: TableRowProps | (({ tableInstance, row, }: {
|
|
213
|
+
tableInstance: MRT_TableInstance;
|
|
214
|
+
row: MRT_Row<D>;
|
|
215
|
+
}) => TableRowProps);
|
|
216
|
+
muiTableContainerProps?: TableContainerProps | (({ tableInstance, }: {
|
|
217
|
+
tableInstance: MRT_TableInstance;
|
|
218
|
+
}) => TableContainerProps);
|
|
219
|
+
muiTableDetailPanelProps?: TableCellProps | (({ tableInstance, row, }: {
|
|
220
|
+
tableInstance: MRT_TableInstance;
|
|
221
|
+
row: MRT_Row<D>;
|
|
222
|
+
}) => TableCellProps);
|
|
223
|
+
muiTableFooterCellProps?: TableCellProps | (({ tableInstance, column, }: {
|
|
224
|
+
tableInstance: MRT_TableInstance;
|
|
225
|
+
column: MRT_ColumnInstance<D>;
|
|
226
|
+
}) => TableCellProps);
|
|
227
|
+
muiTableFooterProps?: TableFooterProps | (({ tableInstance, }: {
|
|
228
|
+
tableInstance: MRT_TableInstance;
|
|
229
|
+
}) => TableFooterProps);
|
|
230
|
+
muiTableFooterRowProps?: TableRowProps | (({ tableInstance, footerGroup, }: {
|
|
231
|
+
tableInstance: MRT_TableInstance;
|
|
232
|
+
footerGroup: MRT_HeaderGroup<D>;
|
|
233
|
+
}) => TableRowProps);
|
|
234
|
+
muiTableHeadCellColumnActionsButtonProps?: IconButtonProps | (({ tableInstance, column, }: {
|
|
235
|
+
tableInstance: MRT_TableInstance;
|
|
236
|
+
column: MRT_ColumnInstance<D>;
|
|
237
|
+
}) => IconButtonProps);
|
|
238
|
+
muiTableHeadCellFilterTextFieldProps?: TextFieldProps | (({ tableInstance, column, }: {
|
|
239
|
+
tableInstance: MRT_TableInstance;
|
|
240
|
+
column: MRT_ColumnInstance<D>;
|
|
241
|
+
}) => TextFieldProps);
|
|
242
|
+
muiTableHeadCellProps?: TableCellProps | (({ tableInstance, column, }: {
|
|
243
|
+
tableInstance: MRT_TableInstance;
|
|
244
|
+
column: MRT_ColumnInstance<D>;
|
|
245
|
+
}) => TableCellProps);
|
|
246
|
+
muiTableHeadProps?: TableHeadProps | (({ tableInstance, }: {
|
|
247
|
+
tableInstance: MRT_TableInstance;
|
|
248
|
+
}) => TableHeadProps);
|
|
249
|
+
muiTableHeadRowProps?: TableRowProps | (({ tableInstance, headerGroup, }: {
|
|
250
|
+
tableInstance: MRT_TableInstance;
|
|
251
|
+
headerGroup: MRT_HeaderGroup<D>;
|
|
252
|
+
}) => TableRowProps);
|
|
253
|
+
muiTablePaperProps?: PaperProps | (({ tableInstance, }: {
|
|
254
|
+
tableInstance: MRT_TableInstance;
|
|
255
|
+
}) => PaperProps);
|
|
256
|
+
muiTablePaginationProps?: Partial<TablePaginationProps> | (({ tableInstance, }: {
|
|
257
|
+
tableInstance: MRT_TableInstance;
|
|
258
|
+
}) => Partial<TablePaginationProps>);
|
|
259
|
+
muiTableProps?: TableProps | (({ tableInstance, }: {
|
|
260
|
+
tableInstance: MRT_TableInstance;
|
|
261
|
+
}) => TableProps);
|
|
262
|
+
muiTableToolbarAlertBannerProps?: AlertProps | (({ tableInstance, }: {
|
|
263
|
+
tableInstance: MRT_TableInstance;
|
|
264
|
+
}) => AlertProps);
|
|
265
|
+
muiTableToolbarBottomProps?: ToolbarProps | (({ tableInstance, }: {
|
|
266
|
+
tableInstance: MRT_TableInstance;
|
|
267
|
+
}) => ToolbarProps);
|
|
268
|
+
muiTableToolbarTopProps?: ToolbarProps | (({ tableInstance, }: {
|
|
269
|
+
tableInstance: MRT_TableInstance;
|
|
270
|
+
}) => ToolbarProps);
|
|
271
|
+
onCellClick?: ({ cell, event, tableInstance, }: {
|
|
272
|
+
cell: MRT_Cell<D>;
|
|
273
|
+
tableInstance: MRT_TableInstance<D>;
|
|
274
|
+
event: MouseEvent<HTMLTableCellElement>;
|
|
275
|
+
}) => void;
|
|
276
|
+
onColumnHide?: ({ column, columnVisibility, tableInstance, }: {
|
|
277
|
+
column: MRT_ColumnInstance<D>;
|
|
278
|
+
columnVisibility: VisibilityState;
|
|
279
|
+
tableInstance: MRT_TableInstance<D>;
|
|
280
|
+
}) => void;
|
|
281
|
+
onDetailPanelClick?: ({ event, row, tableInstance, }: {
|
|
282
|
+
event: MouseEvent<HTMLTableCellElement>;
|
|
283
|
+
row: MRT_Row<D>;
|
|
284
|
+
tableInstance: MRT_TableInstance<D>;
|
|
285
|
+
}) => void;
|
|
286
|
+
onGlobalFilterChange?: ({ event, tableInstance, }: {
|
|
287
|
+
event: ChangeEvent<HTMLInputElement>;
|
|
288
|
+
tableInstance: MRT_TableInstance<D>;
|
|
289
|
+
}) => void;
|
|
290
|
+
onRowClick?: ({ event, row, tableInstance, }: {
|
|
291
|
+
event: MouseEvent<HTMLTableRowElement>;
|
|
292
|
+
row: MRT_Row<D>;
|
|
293
|
+
tableInstance: MRT_TableInstance<D>;
|
|
294
|
+
}) => void;
|
|
295
|
+
onRowEditSubmit?: ({ row, tableInstance, }: {
|
|
296
|
+
row: MRT_Row<D>;
|
|
297
|
+
tableInstance: MRT_TableInstance<D>;
|
|
298
|
+
}) => Promise<void> | void;
|
|
299
|
+
onRowExpandChange?: ({ event, row, }: {
|
|
300
|
+
event: MouseEvent<HTMLButtonElement>;
|
|
301
|
+
row: MRT_Row<D>;
|
|
302
|
+
tableInstance: MRT_TableInstance<D>;
|
|
303
|
+
}) => void;
|
|
304
|
+
onSelectAllChange?: ({ event, selectedRows, tableInstance, }: {
|
|
305
|
+
event: ChangeEvent;
|
|
306
|
+
selectedRows: MRT_Row<D>[];
|
|
307
|
+
tableInstance: MRT_TableInstance<D>;
|
|
308
|
+
}) => void;
|
|
309
|
+
onSelectChange?: ({ event, row, selectedRows, tableInstance, }: {
|
|
310
|
+
event: ChangeEvent;
|
|
311
|
+
row: MRT_Row<D>;
|
|
312
|
+
selectedRows: MRT_Row<D>[];
|
|
313
|
+
tableInstance: MRT_TableInstance<D>;
|
|
314
|
+
}) => void;
|
|
191
315
|
positionActionsColumn?: 'first' | 'last';
|
|
192
316
|
positionPagination?: 'bottom' | 'top' | 'both';
|
|
193
317
|
positionToolbarActions?: 'bottom' | 'top';
|
|
194
318
|
positionToolbarAlertBanner?: 'bottom' | 'top';
|
|
195
|
-
renderDetailPanel?: (row
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
319
|
+
renderDetailPanel?: ({ row, tableInstance, }: {
|
|
320
|
+
row: MRT_Row<D>;
|
|
321
|
+
tableInstance: MRT_TableInstance<D>;
|
|
322
|
+
}) => ReactNode;
|
|
323
|
+
renderRowActionMenuItems?: ({ closeMenu, row, tableInstance, }: {
|
|
324
|
+
closeMenu: () => void;
|
|
325
|
+
row: MRT_Row<D>;
|
|
326
|
+
tableInstance: MRT_TableInstance<D>;
|
|
327
|
+
}) => ReactNode[];
|
|
328
|
+
renderRowActions?: ({ row, tableInstance, }: {
|
|
329
|
+
row: MRT_Row<D>;
|
|
330
|
+
tableInstance: MRT_TableInstance<D>;
|
|
331
|
+
}) => ReactNode;
|
|
332
|
+
renderToolbarCustomActions?: ({ tableInstance, }: {
|
|
333
|
+
tableInstance: MRT_TableInstance<D>;
|
|
334
|
+
}) => ReactNode;
|
|
335
|
+
renderToolbarInternalActions?: ({ tableInstance, MRT_ToggleSearchButton, MRT_ToggleFiltersButton, MRT_ShowHideColumnsButton, MRT_ToggleDensePaddingButton, MRT_FullScreenToggleButton, }: {
|
|
336
|
+
tableInstance: MRT_TableInstance<D>;
|
|
200
337
|
MRT_ToggleSearchButton: FC<IconButtonProps & {
|
|
201
338
|
tableInstance: MRT_TableInstance<D>;
|
|
202
339
|
}>;
|