material-react-table 0.13.1 → 0.13.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/README.md +9 -5
- package/dist/MaterialReactTable.d.ts +44 -35
- package/dist/material-react-table.cjs.development.js +28 -13
- 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 +28 -13
- package/dist/material-react-table.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/MaterialReactTable.tsx +47 -35
- package/src/buttons/MRT_ExpandAllButton.tsx +8 -0
- package/src/buttons/MRT_ExpandButton.tsx +8 -0
- package/src/inputs/MRT_SelectCheckbox.tsx +14 -5
package/README.md
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
# Material React Table
|
|
2
2
|
|
|
3
|
-
<a href="https://bundlephobia.com/result?p=material-react-table" target="
|
|
4
|
-
<img alt="" src="https://badgen.net/bundlephobia/minzip/material-react-table" />
|
|
3
|
+
<a href="https://bundlephobia.com/result?p=material-react-table" target="_blank_">
|
|
4
|
+
<img alt="" src="https://badgen.net/bundlephobia/minzip/material-react-table@latest" />
|
|
5
5
|
</a>
|
|
6
6
|
|
|
7
|
-
<a href="https://npmjs.com/package/material-react-table" target="
|
|
7
|
+
<a href="https://npmjs.com/package/material-react-table" target="_blank_">
|
|
8
8
|
<img alt="" src="https://img.shields.io/npm/dm/material-react-table.svg" />
|
|
9
9
|
</a>
|
|
10
10
|
|
|
11
|
+
<a href="https://github.com/KevinVandy/material-react-table" target="_blank_">
|
|
12
|
+
<img alt="" src="https://img.shields.io/github/stars/KevinVandy/material-react-table.svg?style=social&label=Star" />
|
|
13
|
+
</a>
|
|
14
|
+
|
|
11
15
|
> This Project is based on `@tanstack/react-table` v8, which itself is still in beta, so therefore this package is also still in alpha/beta
|
|
12
16
|
|
|
13
17
|
- A fully featured Material UI V5 implementation of Tanstack React Table v8 (beta)
|
|
@@ -46,7 +50,7 @@ _All features can easily be enabled/disabled_
|
|
|
46
50
|
- [x] Filtering and multiple built-in filter modes
|
|
47
51
|
- [x] Full Screen mode
|
|
48
52
|
- [x] Global Filtering (Search across all columns, rank by best match)
|
|
49
|
-
- [x]
|
|
53
|
+
- [x] Header Groups & Footers
|
|
50
54
|
- [x] Localization (i18n) support
|
|
51
55
|
- [x] Manage your own state
|
|
52
56
|
- [x] Pagination (supports client-side and server-side)
|
|
@@ -58,7 +62,7 @@ _All features can easily be enabled/disabled_
|
|
|
58
62
|
- [x] Sorting
|
|
59
63
|
- [x] Theming (Respects your Material UI Theme)
|
|
60
64
|
- [x] Toolbars (Add your own action buttons)
|
|
61
|
-
- [x] Tree Data / Expanding
|
|
65
|
+
- [x] Tree Data / Expanding Sub-rows
|
|
62
66
|
- [x] Virtualization (react-virtual)
|
|
63
67
|
|
|
64
68
|
### Installation
|
|
@@ -106,31 +106,31 @@ export declare type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<Col
|
|
|
106
106
|
header: string;
|
|
107
107
|
id: keyof D | string;
|
|
108
108
|
muiTableBodyCellCopyButtonProps?: ButtonProps | (({ instance, cell, }: {
|
|
109
|
-
instance: MRT_TableInstance
|
|
109
|
+
instance: MRT_TableInstance<D>;
|
|
110
110
|
cell: MRT_Cell<D>;
|
|
111
111
|
}) => ButtonProps);
|
|
112
112
|
muiTableBodyCellEditTextFieldProps?: TextFieldProps | (({ instance, cell, }: {
|
|
113
|
-
instance: MRT_TableInstance
|
|
113
|
+
instance: MRT_TableInstance<D>;
|
|
114
114
|
cell: MRT_Cell<D>;
|
|
115
115
|
}) => TextFieldProps);
|
|
116
116
|
muiTableBodyCellProps?: TableCellProps | (({ instance, cell, }: {
|
|
117
|
-
instance: MRT_TableInstance
|
|
117
|
+
instance: MRT_TableInstance<D>;
|
|
118
118
|
cell: MRT_Cell<D>;
|
|
119
119
|
}) => TableCellProps);
|
|
120
120
|
muiTableFooterCellProps?: TableCellProps | (({ instance, column, }: {
|
|
121
|
-
instance: MRT_TableInstance
|
|
121
|
+
instance: MRT_TableInstance<D>;
|
|
122
122
|
column: MRT_Column<D>;
|
|
123
123
|
}) => TableCellProps);
|
|
124
124
|
muiTableHeadCellColumnActionsButtonProps?: IconButtonProps | (({ instance, column, }: {
|
|
125
|
-
instance: MRT_TableInstance
|
|
125
|
+
instance: MRT_TableInstance<D>;
|
|
126
126
|
column: MRT_Column<D>;
|
|
127
127
|
}) => IconButtonProps);
|
|
128
128
|
muiTableHeadCellFilterTextFieldProps?: TextFieldProps | (({ instance, column, }: {
|
|
129
|
-
instance: MRT_TableInstance
|
|
129
|
+
instance: MRT_TableInstance<D>;
|
|
130
130
|
column: MRT_Column<D>;
|
|
131
131
|
}) => TextFieldProps);
|
|
132
132
|
muiTableHeadCellProps?: TableCellProps | (({ instance, column, }: {
|
|
133
|
-
instance: MRT_TableInstance
|
|
133
|
+
instance: MRT_TableInstance<D>;
|
|
134
134
|
column: MRT_Column<D>;
|
|
135
135
|
}) => TableCellProps);
|
|
136
136
|
onCellEditBlur?: ({ cell, event, instance, }: {
|
|
@@ -206,94 +206,103 @@ export declare type MaterialReactTableProps<D extends Record<string, any> = {}>
|
|
|
206
206
|
enabledGlobalFilterOptions?: (MRT_FILTER_OPTION | string)[] | null;
|
|
207
207
|
icons?: Partial<MRT_Icons>;
|
|
208
208
|
localization?: Partial<MRT_Localization>;
|
|
209
|
+
muiExpandAllButtonProps?: IconButtonProps | (({ instance }: {
|
|
210
|
+
instance: MRT_TableInstance<D>;
|
|
211
|
+
}) => IconButtonProps);
|
|
212
|
+
muiExpandButtonProps?: IconButtonProps | (({ instance, }: {
|
|
213
|
+
instance: MRT_TableInstance<D>;
|
|
214
|
+
row: MRT_Row<D>;
|
|
215
|
+
}) => IconButtonProps);
|
|
209
216
|
muiLinearProgressProps?: LinearProgressProps | (({ instance, }: {
|
|
210
|
-
instance: MRT_TableInstance
|
|
217
|
+
instance: MRT_TableInstance<D>;
|
|
211
218
|
}) => LinearProgressProps);
|
|
212
219
|
muiSearchTextFieldProps?: TextFieldProps | (({ instance }: {
|
|
213
|
-
instance: MRT_TableInstance
|
|
220
|
+
instance: MRT_TableInstance<D>;
|
|
214
221
|
}) => TextFieldProps);
|
|
215
|
-
|
|
216
|
-
instance: MRT_TableInstance
|
|
217
|
-
|
|
218
|
-
|
|
222
|
+
muiSelectAllCheckboxProps?: CheckboxProps | (({ instance }: {
|
|
223
|
+
instance: MRT_TableInstance<D>;
|
|
224
|
+
}) => CheckboxProps);
|
|
225
|
+
muiSelectCheckboxProps?: CheckboxProps | (({ instance, row, }: {
|
|
226
|
+
instance: MRT_TableInstance<D>;
|
|
227
|
+
row: MRT_Row<D>;
|
|
219
228
|
}) => CheckboxProps);
|
|
220
229
|
muiTableBodyCellCopyButtonProps?: ButtonProps | (({ instance, cell, }: {
|
|
221
|
-
instance: MRT_TableInstance
|
|
230
|
+
instance: MRT_TableInstance<D>;
|
|
222
231
|
cell: MRT_Cell<D>;
|
|
223
232
|
}) => ButtonProps);
|
|
224
233
|
muiTableBodyCellEditTextFieldProps?: TextFieldProps | (({ instance, cell, }: {
|
|
225
|
-
instance: MRT_TableInstance
|
|
234
|
+
instance: MRT_TableInstance<D>;
|
|
226
235
|
cell: MRT_Cell<D>;
|
|
227
236
|
}) => TextFieldProps);
|
|
228
237
|
muiTableBodyCellProps?: TableCellProps | (({ instance, cell, }: {
|
|
229
|
-
instance: MRT_TableInstance
|
|
238
|
+
instance: MRT_TableInstance<D>;
|
|
230
239
|
cell: MRT_Cell<D>;
|
|
231
240
|
}) => TableCellProps);
|
|
232
241
|
muiTableBodyCellSkeletonProps?: SkeletonProps | (({ instance, cell, }: {
|
|
233
|
-
instance: MRT_TableInstance
|
|
242
|
+
instance: MRT_TableInstance<D>;
|
|
234
243
|
cell: MRT_Cell<D>;
|
|
235
244
|
}) => SkeletonProps);
|
|
236
245
|
muiTableBodyProps?: TableBodyProps | (({ instance }: {
|
|
237
|
-
instance: MRT_TableInstance
|
|
246
|
+
instance: MRT_TableInstance<D>;
|
|
238
247
|
}) => TableBodyProps);
|
|
239
248
|
muiTableBodyRowProps?: TableRowProps | (({ instance, row, }: {
|
|
240
|
-
instance: MRT_TableInstance
|
|
249
|
+
instance: MRT_TableInstance<D>;
|
|
241
250
|
row: MRT_Row<D>;
|
|
242
251
|
}) => TableRowProps);
|
|
243
252
|
muiTableContainerProps?: TableContainerProps | (({ instance, }: {
|
|
244
|
-
instance: MRT_TableInstance
|
|
253
|
+
instance: MRT_TableInstance<D>;
|
|
245
254
|
}) => TableContainerProps);
|
|
246
255
|
muiTableDetailPanelProps?: TableCellProps | (({ instance, row, }: {
|
|
247
|
-
instance: MRT_TableInstance
|
|
256
|
+
instance: MRT_TableInstance<D>;
|
|
248
257
|
row: MRT_Row<D>;
|
|
249
258
|
}) => TableCellProps);
|
|
250
259
|
muiTableFooterCellProps?: TableCellProps | (({ instance, column, }: {
|
|
251
|
-
instance: MRT_TableInstance
|
|
260
|
+
instance: MRT_TableInstance<D>;
|
|
252
261
|
column: MRT_Column<D>;
|
|
253
262
|
}) => TableCellProps);
|
|
254
263
|
muiTableFooterProps?: TableFooterProps | (({ instance }: {
|
|
255
|
-
instance: MRT_TableInstance
|
|
264
|
+
instance: MRT_TableInstance<D>;
|
|
256
265
|
}) => TableFooterProps);
|
|
257
266
|
muiTableFooterRowProps?: TableRowProps | (({ instance, footerGroup, }: {
|
|
258
|
-
instance: MRT_TableInstance
|
|
267
|
+
instance: MRT_TableInstance<D>;
|
|
259
268
|
footerGroup: MRT_HeaderGroup<D>;
|
|
260
269
|
}) => TableRowProps);
|
|
261
270
|
muiTableHeadCellColumnActionsButtonProps?: IconButtonProps | (({ instance, column, }: {
|
|
262
|
-
instance: MRT_TableInstance
|
|
271
|
+
instance: MRT_TableInstance<D>;
|
|
263
272
|
column: MRT_Column<D>;
|
|
264
273
|
}) => IconButtonProps);
|
|
265
274
|
muiTableHeadCellFilterTextFieldProps?: TextFieldProps | (({ instance, column, }: {
|
|
266
|
-
instance: MRT_TableInstance
|
|
275
|
+
instance: MRT_TableInstance<D>;
|
|
267
276
|
column: MRT_Column<D>;
|
|
268
277
|
}) => TextFieldProps);
|
|
269
278
|
muiTableHeadCellProps?: TableCellProps | (({ instance, column, }: {
|
|
270
|
-
instance: MRT_TableInstance
|
|
279
|
+
instance: MRT_TableInstance<D>;
|
|
271
280
|
column: MRT_Column<D>;
|
|
272
281
|
}) => TableCellProps);
|
|
273
282
|
muiTableHeadProps?: TableHeadProps | (({ instance }: {
|
|
274
|
-
instance: MRT_TableInstance
|
|
283
|
+
instance: MRT_TableInstance<D>;
|
|
275
284
|
}) => TableHeadProps);
|
|
276
285
|
muiTableHeadRowProps?: TableRowProps | (({ instance, headerGroup, }: {
|
|
277
|
-
instance: MRT_TableInstance
|
|
286
|
+
instance: MRT_TableInstance<D>;
|
|
278
287
|
headerGroup: MRT_HeaderGroup<D>;
|
|
279
288
|
}) => TableRowProps);
|
|
280
289
|
muiTablePaginationProps?: Partial<TablePaginationProps> | (({ instance, }: {
|
|
281
|
-
instance: MRT_TableInstance
|
|
290
|
+
instance: MRT_TableInstance<D>;
|
|
282
291
|
}) => Partial<TablePaginationProps>);
|
|
283
292
|
muiTablePaperProps?: PaperProps | (({ instance }: {
|
|
284
|
-
instance: MRT_TableInstance
|
|
293
|
+
instance: MRT_TableInstance<D>;
|
|
285
294
|
}) => PaperProps);
|
|
286
295
|
muiTableProps?: TableProps | (({ instance }: {
|
|
287
|
-
instance: MRT_TableInstance
|
|
296
|
+
instance: MRT_TableInstance<D>;
|
|
288
297
|
}) => TableProps);
|
|
289
298
|
muiTableToolbarAlertBannerProps?: AlertProps | (({ instance }: {
|
|
290
|
-
instance: MRT_TableInstance
|
|
299
|
+
instance: MRT_TableInstance<D>;
|
|
291
300
|
}) => AlertProps);
|
|
292
301
|
muiTableToolbarBottomProps?: ToolbarProps | (({ instance }: {
|
|
293
|
-
instance: MRT_TableInstance
|
|
302
|
+
instance: MRT_TableInstance<D>;
|
|
294
303
|
}) => ToolbarProps);
|
|
295
304
|
muiTableToolbarTopProps?: ToolbarProps | (({ instance }: {
|
|
296
|
-
instance: MRT_TableInstance
|
|
305
|
+
instance: MRT_TableInstance<D>;
|
|
297
306
|
}) => ToolbarProps);
|
|
298
307
|
onCellClick?: ({ cell, event, instance, }: {
|
|
299
308
|
cell: MRT_Cell<D>;
|
|
@@ -158,28 +158,33 @@ var MRT_ExpandAllButton = function MRT_ExpandAllButton(_ref) {
|
|
|
158
158
|
_instance$options = instance.options,
|
|
159
159
|
KeyboardDoubleArrowDownIcon = _instance$options.icons.KeyboardDoubleArrowDownIcon,
|
|
160
160
|
localization = _instance$options.localization,
|
|
161
|
+
muiExpandAllButtonProps = _instance$options.muiExpandAllButtonProps,
|
|
161
162
|
renderDetailPanel = _instance$options.renderDetailPanel,
|
|
162
163
|
toggleAllRowsExpanded = instance.toggleAllRowsExpanded;
|
|
163
164
|
|
|
164
165
|
var _getState = getState(),
|
|
165
166
|
density = _getState.density;
|
|
166
167
|
|
|
168
|
+
var iconButtonProps = muiExpandAllButtonProps instanceof Function ? muiExpandAllButtonProps({
|
|
169
|
+
instance: instance
|
|
170
|
+
}) : muiExpandAllButtonProps;
|
|
167
171
|
return React__default.createElement(material.Tooltip, {
|
|
168
172
|
arrow: true,
|
|
169
173
|
enterDelay: 1000,
|
|
170
174
|
enterNextDelay: 1000,
|
|
171
175
|
title: localization.expandAll
|
|
172
|
-
}, React__default.createElement(material.IconButton, {
|
|
176
|
+
}, React__default.createElement(material.IconButton, Object.assign({
|
|
173
177
|
"aria-label": localization.expandAll,
|
|
174
178
|
disabled: !getCanSomeRowsExpand() && !renderDetailPanel,
|
|
175
179
|
onClick: function onClick() {
|
|
176
180
|
return toggleAllRowsExpanded(!getIsAllRowsExpanded());
|
|
177
|
-
}
|
|
178
|
-
|
|
181
|
+
}
|
|
182
|
+
}, iconButtonProps, {
|
|
183
|
+
sx: _extends({
|
|
179
184
|
height: density === 'compact' ? '1.75rem' : '2.25rem',
|
|
180
185
|
width: density === 'compact' ? '1.75rem' : '2.25rem'
|
|
181
|
-
}
|
|
182
|
-
}, React__default.createElement(KeyboardDoubleArrowDownIcon, {
|
|
186
|
+
}, iconButtonProps == null ? void 0 : iconButtonProps.sx)
|
|
187
|
+
}), React__default.createElement(KeyboardDoubleArrowDownIcon, {
|
|
183
188
|
style: {
|
|
184
189
|
transform: "rotate(" + (getIsAllRowsExpanded() ? -180 : getIsSomeRowsExpanded() ? -90 : 0) + "deg)",
|
|
185
190
|
transition: 'transform 0.2s'
|
|
@@ -194,12 +199,18 @@ var MRT_ExpandButton = function MRT_ExpandButton(_ref) {
|
|
|
194
199
|
_instance$options = instance.options,
|
|
195
200
|
ExpandMoreIcon = _instance$options.icons.ExpandMoreIcon,
|
|
196
201
|
localization = _instance$options.localization,
|
|
202
|
+
muiExpandButtonProps = _instance$options.muiExpandButtonProps,
|
|
197
203
|
onExpandChanged = _instance$options.onExpandChanged,
|
|
198
204
|
renderDetailPanel = _instance$options.renderDetailPanel;
|
|
199
205
|
|
|
200
206
|
var _getState = getState(),
|
|
201
207
|
density = _getState.density;
|
|
202
208
|
|
|
209
|
+
var iconButtonProps = muiExpandButtonProps instanceof Function ? muiExpandButtonProps({
|
|
210
|
+
instance: instance,
|
|
211
|
+
row: row
|
|
212
|
+
}) : muiExpandButtonProps;
|
|
213
|
+
|
|
203
214
|
var handleToggleExpand = function handleToggleExpand(event) {
|
|
204
215
|
row.toggleExpanded();
|
|
205
216
|
onExpandChanged == null ? void 0 : onExpandChanged({
|
|
@@ -214,15 +225,16 @@ var MRT_ExpandButton = function MRT_ExpandButton(_ref) {
|
|
|
214
225
|
enterDelay: 1000,
|
|
215
226
|
enterNextDelay: 1000,
|
|
216
227
|
title: localization.expand
|
|
217
|
-
}, React__default.createElement(material.IconButton, {
|
|
228
|
+
}, React__default.createElement(material.IconButton, Object.assign({
|
|
218
229
|
"aria-label": localization.expand,
|
|
219
230
|
disabled: !row.getCanExpand() && !renderDetailPanel,
|
|
220
|
-
onClick: handleToggleExpand
|
|
221
|
-
|
|
231
|
+
onClick: handleToggleExpand
|
|
232
|
+
}, iconButtonProps, {
|
|
233
|
+
sx: _extends({
|
|
222
234
|
height: density === 'compact' ? '1.75rem' : '2.25rem',
|
|
223
235
|
width: density === 'compact' ? '1.75rem' : '2.25rem'
|
|
224
|
-
}
|
|
225
|
-
}, React__default.createElement(ExpandMoreIcon, {
|
|
236
|
+
}, iconButtonProps == null ? void 0 : iconButtonProps.sx)
|
|
237
|
+
}), React__default.createElement(ExpandMoreIcon, {
|
|
226
238
|
style: {
|
|
227
239
|
transform: "rotate(" + (!row.getCanExpand() && !renderDetailPanel ? -90 : row.getIsExpanded() ? -180 : 0) + "deg)",
|
|
228
240
|
transition: 'transform 0.2s'
|
|
@@ -4048,11 +4060,13 @@ var MRT_SelectCheckbox = function MRT_SelectCheckbox(_ref) {
|
|
|
4048
4060
|
selectAll = _ref.selectAll,
|
|
4049
4061
|
instance = _ref.instance;
|
|
4050
4062
|
var getRowModel = instance.getRowModel,
|
|
4063
|
+
getPaginationRowModel = instance.getPaginationRowModel,
|
|
4051
4064
|
getSelectedRowModel = instance.getSelectedRowModel,
|
|
4052
4065
|
getState = instance.getState,
|
|
4053
4066
|
_instance$options = instance.options,
|
|
4054
4067
|
localization = _instance$options.localization,
|
|
4055
4068
|
muiSelectCheckboxProps = _instance$options.muiSelectCheckboxProps,
|
|
4069
|
+
muiSelectAllCheckboxProps = _instance$options.muiSelectAllCheckboxProps,
|
|
4056
4070
|
onRowSelectionChanged = _instance$options.onRowSelectionChanged,
|
|
4057
4071
|
onRowSelectAllChanged = _instance$options.onRowSelectAllChanged,
|
|
4058
4072
|
selectAllMode = _instance$options.selectAllMode;
|
|
@@ -4070,7 +4084,7 @@ var MRT_SelectCheckbox = function MRT_SelectCheckbox(_ref) {
|
|
|
4070
4084
|
|
|
4071
4085
|
onRowSelectAllChanged == null ? void 0 : onRowSelectAllChanged({
|
|
4072
4086
|
event: event,
|
|
4073
|
-
selectedRows: event.target.checked ? getRowModel().flatRows : [],
|
|
4087
|
+
selectedRows: event.target.checked ? selectAllMode === 'all' ? getRowModel().flatRows : getPaginationRowModel().flatRows : [],
|
|
4074
4088
|
instance: instance
|
|
4075
4089
|
});
|
|
4076
4090
|
} else if (row) {
|
|
@@ -4086,8 +4100,9 @@ var MRT_SelectCheckbox = function MRT_SelectCheckbox(_ref) {
|
|
|
4086
4100
|
}
|
|
4087
4101
|
};
|
|
4088
4102
|
|
|
4089
|
-
var checkboxProps =
|
|
4090
|
-
|
|
4103
|
+
var checkboxProps = selectAll ? muiSelectAllCheckboxProps instanceof Function ? muiSelectAllCheckboxProps({
|
|
4104
|
+
instance: instance
|
|
4105
|
+
}) : muiSelectAllCheckboxProps : muiSelectCheckboxProps instanceof Function ? muiSelectCheckboxProps({
|
|
4091
4106
|
row: row,
|
|
4092
4107
|
instance: instance
|
|
4093
4108
|
}) : muiSelectCheckboxProps;
|