material-react-table 0.6.2 → 0.6.5

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.
Files changed (33) hide show
  1. package/dist/MaterialReactTable.d.ts +11 -11
  2. package/dist/filtersFNs.d.ts +10 -10
  3. package/dist/material-react-table.cjs.development.js +179 -143
  4. package/dist/material-react-table.cjs.development.js.map +1 -1
  5. package/dist/material-react-table.cjs.production.min.js +1 -1
  6. package/dist/material-react-table.cjs.production.min.js.map +1 -1
  7. package/dist/material-react-table.esm.js +181 -145
  8. package/dist/material-react-table.esm.js.map +1 -1
  9. package/dist/menus/MRT_ColumnActionMenu.d.ts +0 -1
  10. package/dist/toolbar/MRT_LinearProgressBar.d.ts +5 -0
  11. package/dist/toolbar/MRT_ToolbarTop.d.ts +11 -0
  12. package/dist/useMRT.d.ts +1 -1
  13. package/dist/utils.d.ts +2 -0
  14. package/package.json +1 -1
  15. package/src/MaterialReactTable.tsx +14 -12
  16. package/src/body/MRT_TableBody.tsx +3 -1
  17. package/src/body/MRT_TableBodyCell.tsx +2 -1
  18. package/src/body/MRT_TableBodyRow.tsx +2 -9
  19. package/src/buttons/MRT_ExpandButton.tsx +9 -1
  20. package/src/filtersFNs.ts +30 -30
  21. package/src/inputs/MRT_EditCellTextField.tsx +1 -1
  22. package/src/inputs/MRT_FilterTextField.tsx +24 -12
  23. package/src/menus/MRT_ColumnActionMenu.tsx +30 -15
  24. package/src/menus/MRT_FilterTypeMenu.tsx +20 -20
  25. package/src/menus/MRT_RowActionMenu.tsx +11 -4
  26. package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +3 -0
  27. package/src/table/MRT_TableContainer.tsx +4 -28
  28. package/src/toolbar/MRT_LinearProgressBar.tsx +25 -0
  29. package/src/toolbar/MRT_TablePagination.tsx +1 -1
  30. package/src/toolbar/MRT_ToolbarBottom.tsx +18 -21
  31. package/src/toolbar/MRT_ToolbarTop.tsx +21 -10
  32. package/src/useMRT.tsx +21 -20
  33. package/src/utils.ts +17 -0
@@ -1,6 +1,6 @@
1
- import React, { useState, useCallback, useMemo, useContext, createContext, Fragment, useRef, useEffect } from 'react';
1
+ import React, { useState, useCallback, useMemo, useContext, createContext, Fragment, useEffect } from 'react';
2
2
  import { useTable, useFilters, useGlobalFilter, useGroupBy, useSortBy, useExpanded, usePagination, useRowSelect, useResizeColumns, useFlexLayout, useAsyncDebounce } from 'react-table';
3
- import { Menu, MenuItem, TextField, InputAdornment, Tooltip, IconButton, Chip, FormControlLabel, Switch, Box, Button, Divider, TableCell, TableSortLabel, Collapse, Skeleton, Checkbox, TableRow, TableHead, alpha, TableBody, TableFooter, Table, TablePagination, useMediaQuery, Alert, Toolbar, TableContainer, Paper, LinearProgress } from '@mui/material';
3
+ import { Menu, MenuItem, TextField, InputAdornment, Tooltip, IconButton, Chip, FormControlLabel, Switch, Box, Button, Divider, ListItemIcon, TableCell, TableSortLabel, Collapse, Skeleton, Checkbox, TableRow, TableHead, TableBody, TableFooter, Table, TablePagination, useMediaQuery, Alert, LinearProgress, Toolbar, alpha, TableContainer, Paper } from '@mui/material';
4
4
  import { matchSorter } from 'match-sorter';
5
5
  import ArrowRightIcon from '@mui/icons-material/ArrowRight';
6
6
  import CancelIcon from '@mui/icons-material/Cancel';
@@ -97,6 +97,35 @@ function _objectWithoutPropertiesLoose(source, excluded) {
97
97
  return target;
98
98
  }
99
99
 
100
+ var findLowestLevelCols = function findLowestLevelCols(columns) {
101
+ var lowestLevelColumns = columns;
102
+ var currentCols = columns;
103
+
104
+ while (!!((_currentCols = currentCols) != null && _currentCols.length) && currentCols.some(function (col) {
105
+ return col.columns;
106
+ })) {
107
+ var _currentCols;
108
+
109
+ var nextCols = currentCols.filter(function (col) {
110
+ return !!col.columns;
111
+ }).map(function (col) {
112
+ return col.columns;
113
+ }).flat();
114
+
115
+ if (nextCols.every(function (col) {
116
+ return !(col != null && col.columns);
117
+ })) {
118
+ lowestLevelColumns = [].concat(lowestLevelColumns, nextCols);
119
+ }
120
+
121
+ currentCols = nextCols;
122
+ }
123
+
124
+ return lowestLevelColumns.filter(function (col) {
125
+ return !col.columns;
126
+ });
127
+ };
128
+
100
129
  var MaterialReactTableContext = /*#__PURE__*/function () {
101
130
  return createContext({});
102
131
  }();
@@ -127,35 +156,8 @@ var MaterialReactTableProvider = function MaterialReactTableProvider(props) {
127
156
  showSearch = _useState5[0],
128
157
  setShowSearch = _useState5[1];
129
158
 
130
- var findLowestLevelCols = useCallback(function () {
131
- var lowestLevelColumns = props.columns;
132
- var currentCols = props.columns;
133
-
134
- while (!!currentCols.length && currentCols.some(function (col) {
135
- return col.columns;
136
- })) {
137
- var nextCols = currentCols.filter(function (col) {
138
- return !!col.columns;
139
- }).map(function (col) {
140
- return col.columns;
141
- }).flat();
142
-
143
- if (nextCols.every(function (col) {
144
- return !col.columns;
145
- })) {
146
- lowestLevelColumns = [].concat(lowestLevelColumns, nextCols);
147
- }
148
-
149
- currentCols = nextCols;
150
- }
151
-
152
- return lowestLevelColumns.filter(function (col) {
153
- return !col.columns;
154
- });
155
- }, [props.columns]);
156
-
157
159
  var _useState6 = useState(function () {
158
- return Object.assign.apply(Object, [{}].concat(findLowestLevelCols().map(function (c) {
160
+ return Object.assign.apply(Object, [{}].concat(findLowestLevelCols(props.columns).map(function (c) {
159
161
  var _ref, _c$filter, _props$initialState5, _props$initialState5$, _ref2;
160
162
 
161
163
  return _ref2 = {}, _ref2[c.accessor] = (_ref = (_c$filter = c.filter) != null ? _c$filter : props == null ? void 0 : (_props$initialState5 = props.initialState) == null ? void 0 : (_props$initialState5$ = _props$initialState5.filters) == null ? void 0 : _props$initialState5$[c.accessor]) != null ? _ref : !!c.filterSelectOptions ? 'equals' : 'fuzzy', _ref2;
@@ -180,10 +182,20 @@ var MaterialReactTableProvider = function MaterialReactTableProvider(props) {
180
182
  var columns = useMemo(function () {
181
183
  return applyFiltersToColumns(props.columns);
182
184
  }, [props.columns, applyFiltersToColumns]);
185
+ var data = useMemo(function () {
186
+ return !props.isLoading || !!props.data.length ? props.data : [].concat(Array(10).fill(null)).map(function (_) {
187
+ return Object.assign.apply(Object, [{}].concat(findLowestLevelCols(props.columns).map(function (c) {
188
+ var _ref3;
189
+
190
+ return _ref3 = {}, _ref3[c.accessor] = null, _ref3;
191
+ })));
192
+ });
193
+ }, [props.data, props.isLoading]);
183
194
  var tableInstance = useTable.apply(void 0, [// @ts-ignore
184
195
  _extends({}, props, {
185
196
  // @ts-ignore
186
197
  columns: columns,
198
+ data: data,
187
199
  useControlledState: function useControlledState(state) {
188
200
  return useMemo(function () {
189
201
  return _extends({}, state, {
@@ -248,7 +260,7 @@ var MRT_FILTER_TYPE;
248
260
  MRT_FILTER_TYPE["STARTS_WITH"] = "startsWith";
249
261
  })(MRT_FILTER_TYPE || (MRT_FILTER_TYPE = {}));
250
262
 
251
- var fuzzyFilterFN = function fuzzyFilterFN(rows, columnIds, filterValue) {
263
+ var fuzzy = function fuzzy(rows, columnIds, filterValue) {
252
264
  return matchSorter(rows, filterValue.toString().trim(), {
253
265
  keys: Array.isArray(columnIds) ? columnIds.map(function (c) {
254
266
  return "values." + c;
@@ -259,111 +271,111 @@ var fuzzyFilterFN = function fuzzyFilterFN(rows, columnIds, filterValue) {
259
271
  });
260
272
  };
261
273
 
262
- fuzzyFilterFN.autoRemove = function (val) {
274
+ fuzzy.autoRemove = function (val) {
263
275
  return !val;
264
276
  };
265
277
 
266
- var containsFilterFN = function containsFilterFN(rows, id, filterValue) {
278
+ var contains = function contains(rows, id, filterValue) {
267
279
  return rows.filter(function (row) {
268
280
  return row.values[id].toString().toLowerCase().trim().includes(filterValue.toString().toLowerCase().trim());
269
281
  });
270
282
  };
271
283
 
272
- containsFilterFN.autoRemove = function (val) {
284
+ contains.autoRemove = function (val) {
273
285
  return !val;
274
286
  };
275
287
 
276
- var startsWithFilterFN = function startsWithFilterFN(rows, id, filterValue) {
288
+ var startsWith = function startsWith(rows, id, filterValue) {
277
289
  return rows.filter(function (row) {
278
290
  return row.values[id].toString().toLowerCase().trim().startsWith(filterValue.toString().toLowerCase().trim());
279
291
  });
280
292
  };
281
293
 
282
- startsWithFilterFN.autoRemove = function (val) {
294
+ startsWith.autoRemove = function (val) {
283
295
  return !val;
284
296
  };
285
297
 
286
- var endsWithFilterFN = function endsWithFilterFN(rows, id, filterValue) {
298
+ var endsWith = function endsWith(rows, id, filterValue) {
287
299
  return rows.filter(function (row) {
288
300
  return row.values[id].toString().toLowerCase().trim().endsWith(filterValue.toString().toLowerCase().trim());
289
301
  });
290
302
  };
291
303
 
292
- endsWithFilterFN.autoRemove = function (val) {
304
+ endsWith.autoRemove = function (val) {
293
305
  return !val;
294
306
  };
295
307
 
296
- var equalsFilterFN = function equalsFilterFN(rows, id, filterValue) {
308
+ var equals = function equals(rows, id, filterValue) {
297
309
  return rows.filter(function (row) {
298
310
  return row.values[id].toString().toLowerCase().trim() === filterValue.toString().toLowerCase().trim();
299
311
  });
300
312
  };
301
313
 
302
- equalsFilterFN.autoRemove = function (val) {
314
+ equals.autoRemove = function (val) {
303
315
  return !val;
304
316
  };
305
317
 
306
- var notEqualsFilterFN = function notEqualsFilterFN(rows, id, filterValue) {
318
+ var notEquals = function notEquals(rows, id, filterValue) {
307
319
  return rows.filter(function (row) {
308
320
  return row.values[id].toString().toLowerCase().trim() !== filterValue.toString().toLowerCase().trim();
309
321
  });
310
322
  };
311
323
 
312
- notEqualsFilterFN.autoRemove = function (val) {
324
+ notEquals.autoRemove = function (val) {
313
325
  return !val;
314
326
  };
315
327
 
316
- var greaterThanFilterFN = function greaterThanFilterFN(rows, id, filterValue) {
328
+ var greaterThan = function greaterThan(rows, id, filterValue) {
317
329
  return rows.filter(function (row) {
318
330
  return !isNaN(+filterValue) && !isNaN(+row.values[id]) ? +row.values[id] > +filterValue : row.values[id].toString().toLowerCase().trim() > filterValue.toString().toLowerCase().trim();
319
331
  });
320
332
  };
321
333
 
322
- greaterThanFilterFN.autoRemove = function (val) {
334
+ greaterThan.autoRemove = function (val) {
323
335
  return !val;
324
336
  };
325
337
 
326
- var lessThanFilterFN = function lessThanFilterFN(rows, id, filterValue) {
338
+ var lessThan = function lessThan(rows, id, filterValue) {
327
339
  return rows.filter(function (row) {
328
340
  return !isNaN(+filterValue) && !isNaN(+row.values[id]) ? +row.values[id] < +filterValue : row.values[id].toString().toLowerCase().trim() < filterValue.toString().toLowerCase().trim();
329
341
  });
330
342
  };
331
343
 
332
- lessThanFilterFN.autoRemove = function (val) {
344
+ lessThan.autoRemove = function (val) {
333
345
  return !val;
334
346
  };
335
347
 
336
- var emptyFilterFN = function emptyFilterFN(rows, id, _filterValue) {
348
+ var empty = function empty(rows, id, _filterValue) {
337
349
  return rows.filter(function (row) {
338
350
  return !row.values[id].toString().toLowerCase().trim();
339
351
  });
340
352
  };
341
353
 
342
- emptyFilterFN.autoRemove = function (val) {
354
+ empty.autoRemove = function (val) {
343
355
  return !val;
344
356
  };
345
357
 
346
- var notEmptyFilterFN = function notEmptyFilterFN(rows, id, _filterValue) {
358
+ var notEmpty = function notEmpty(rows, id, _filterValue) {
347
359
  return rows.filter(function (row) {
348
360
  return !!row.values[id].toString().toLowerCase().trim();
349
361
  });
350
362
  };
351
363
 
352
- notEmptyFilterFN.autoRemove = function (val) {
364
+ notEmpty.autoRemove = function (val) {
353
365
  return !val;
354
366
  };
355
367
 
356
368
  var defaultFilterFNs = {
357
- contains: containsFilterFN,
358
- empty: emptyFilterFN,
359
- endsWith: endsWithFilterFN,
360
- equals: equalsFilterFN,
361
- fuzzy: fuzzyFilterFN,
362
- greaterThan: greaterThanFilterFN,
363
- lessThan: lessThanFilterFN,
364
- notEmpty: notEmptyFilterFN,
365
- notEquals: notEqualsFilterFN,
366
- startsWith: startsWithFilterFN
369
+ contains: contains,
370
+ empty: empty,
371
+ endsWith: endsWith,
372
+ equals: equals,
373
+ fuzzy: fuzzy,
374
+ greaterThan: greaterThan,
375
+ lessThan: lessThan,
376
+ notEmpty: notEmpty,
377
+ notEquals: notEquals,
378
+ startsWith: startsWith
367
379
  };
368
380
 
369
381
  var commonMenuItemStyles = {
@@ -387,52 +399,52 @@ var MRT_FilterTypeMenu = function MRT_FilterTypeMenu(_ref) {
387
399
  type: MRT_FILTER_TYPE.FUZZY,
388
400
  label: localization.filterFuzzy,
389
401
  divider: false,
390
- fn: fuzzyFilterFN
402
+ fn: fuzzy
391
403
  }, {
392
404
  type: MRT_FILTER_TYPE.CONTAINS,
393
405
  label: localization.filterContains,
394
406
  divider: true,
395
- fn: containsFilterFN
407
+ fn: contains
396
408
  }, {
397
409
  type: MRT_FILTER_TYPE.STARTS_WITH,
398
410
  label: localization.filterStartsWith,
399
411
  divider: false,
400
- fn: startsWithFilterFN
412
+ fn: startsWith
401
413
  }, {
402
414
  type: MRT_FILTER_TYPE.ENDS_WITH,
403
415
  label: localization.filterEndsWith,
404
416
  divider: true,
405
- fn: endsWithFilterFN
417
+ fn: endsWith
406
418
  }, {
407
419
  type: MRT_FILTER_TYPE.EQUALS,
408
420
  label: localization.filterEquals,
409
421
  divider: false,
410
- fn: equalsFilterFN
422
+ fn: equals
411
423
  }, {
412
424
  type: MRT_FILTER_TYPE.NOT_EQUALS,
413
425
  label: localization.filterNotEquals,
414
426
  divider: true,
415
- fn: notEqualsFilterFN
427
+ fn: notEquals
416
428
  }, {
417
429
  type: MRT_FILTER_TYPE.GREATER_THAN,
418
430
  label: localization.filterGreaterThan,
419
431
  divider: false,
420
- fn: greaterThanFilterFN
432
+ fn: greaterThan
421
433
  }, {
422
434
  type: MRT_FILTER_TYPE.LESS_THAN,
423
435
  label: localization.filterLessThan,
424
436
  divider: true,
425
- fn: lessThanFilterFN
437
+ fn: lessThan
426
438
  }, {
427
439
  type: MRT_FILTER_TYPE.EMPTY,
428
440
  label: localization.filterEmpty,
429
441
  divider: false,
430
- fn: emptyFilterFN
442
+ fn: empty
431
443
  }, {
432
444
  type: MRT_FILTER_TYPE.NOT_EMPTY,
433
445
  label: localization.filterNotEmpty,
434
446
  divider: false,
435
- fn: notEmptyFilterFN
447
+ fn: notEmpty
436
448
  }];
437
449
  }, []);
438
450
 
@@ -484,7 +496,7 @@ var MRT_FilterTypeMenu = function MRT_FilterTypeMenu(_ref) {
484
496
  };
485
497
 
486
498
  var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
487
- var _localization$filterB, _localization$clearFi, _column$filterSelectO;
499
+ var _localization$filterB, _localization$filterM, _localization$, _localization$clearFi, _column$filterSelectO;
488
500
 
489
501
  var column = _ref.column;
490
502
 
@@ -542,6 +554,7 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
542
554
  }));
543
555
  }
544
556
 
557
+ var filterId = "mrt-" + idPrefix + "-" + column.id + "-filter-text-field";
545
558
  var filterType = tableInstance.state.currentFilterTypes[column.id];
546
559
  var isSelectFilter = !!column.filterSelectOptions;
547
560
  var filterChipLabel = !(filterType instanceof Function) && [MRT_FILTER_TYPE.EMPTY, MRT_FILTER_TYPE.NOT_EMPTY].includes(filterType) ? //@ts-ignore
@@ -549,7 +562,7 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
549
562
  var filterPlaceholder = (_localization$filterB = localization.filterByColumn) == null ? void 0 : _localization$filterB.replace('{column}', String(column.Header));
550
563
  return React.createElement(React.Fragment, null, React.createElement(TextField, Object.assign({
551
564
  fullWidth: true,
552
- id: "mrt-" + idPrefix + "-" + column.id + "-filter-text-field",
565
+ id: filterId,
553
566
  inputProps: {
554
567
  disabled: !!filterChipLabel,
555
568
  sx: {
@@ -558,8 +571,11 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
558
571
  },
559
572
  title: filterPlaceholder
560
573
  },
561
- helperText: filterType instanceof Function ? '' : localization.filterMode.replace('{filterType}', // @ts-ignore
562
- localization["filter" + (filterType.charAt(0).toUpperCase() + filterType.slice(1))]),
574
+ helperText: React.createElement("label", {
575
+ htmlFor: filterId
576
+ }, filterType instanceof Function ? (_localization$filterM = localization.filterMode.replace('{filterType}', // @ts-ignore
577
+ (_localization$ = localization["filter" + (filterType.name.charAt(0).toUpperCase() + filterType.name.slice(1))]) != null ? _localization$ : '')) != null ? _localization$filterM : '' : localization.filterMode.replace('{filterType}', // @ts-ignore
578
+ localization["filter" + (filterType.charAt(0).toUpperCase() + filterType.slice(1))])),
563
579
  FormHelperTextProps: {
564
580
  sx: {
565
581
  fontSize: '0.6rem',
@@ -667,6 +683,11 @@ var MRT_ShowHideColumnsMenuItems = function MRT_ShowHideColumnsMenuItems(_ref) {
667
683
 
668
684
  var column = _ref.column,
669
685
  isSubMenu = _ref.isSubMenu;
686
+
687
+ var _useMRT = useMRT(),
688
+ onColumnHide = _useMRT.onColumnHide,
689
+ tableInstance = _useMRT.tableInstance;
690
+
670
691
  var isParentHeader = !!(column != null && (_column$columns = column.columns) != null && _column$columns.length);
671
692
  var allChildColumnsVisible = isParentHeader && !!((_column$columns2 = column.columns) != null && _column$columns2.every(function (childColumn) {
672
693
  return childColumn.isVisible;
@@ -683,6 +704,8 @@ var MRT_ShowHideColumnsMenuItems = function MRT_ShowHideColumnsMenuItems(_ref) {
683
704
  } else {
684
705
  column.toggleHidden();
685
706
  }
707
+
708
+ onColumnHide == null ? void 0 : onColumnHide(column, tableInstance.state.hiddenColumns);
686
709
  };
687
710
 
688
711
  return React.createElement(React.Fragment, null, React.createElement(MenuItem, {
@@ -765,7 +788,6 @@ var commonMenuItemStyles$1 = {
765
788
  };
766
789
  var commonListItemStyles = {
767
790
  display: 'flex',
768
- gap: '0.75rem',
769
791
  alignItems: 'center'
770
792
  };
771
793
  var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
@@ -843,15 +865,16 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
843
865
  setAnchorEl(null);
844
866
  };
845
867
 
868
+ var handleShowAllColumns = function handleShowAllColumns() {
869
+ tableInstance.toggleHideAllColumns(false);
870
+ setAnchorEl(null);
871
+ };
872
+
846
873
  var handleOpenFilterModeMenu = function handleOpenFilterModeMenu(event) {
847
874
  event.stopPropagation();
848
875
  setFilterMenuAnchorEl(event.currentTarget);
849
876
  };
850
877
 
851
- var handleShowAllColumns = function handleShowAllColumns() {
852
- tableInstance.toggleHideAllColumns(false);
853
- };
854
-
855
878
  var handleOpenShowHideColumnsMenu = function handleOpenShowHideColumnsMenu(event) {
856
879
  event.stopPropagation();
857
880
  setShowHideColumnsMenuAnchorEl(event.currentTarget);
@@ -873,14 +896,14 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
873
896
  sx: commonMenuItemStyles$1
874
897
  }, React.createElement(Box, {
875
898
  sx: commonListItemStyles
876
- }, React.createElement(ClearAllIcon, null), localization.clearSort)), React.createElement(MenuItem, {
899
+ }, React.createElement(ListItemIcon, null, React.createElement(ClearAllIcon, null)), localization.clearSort)), React.createElement(MenuItem, {
877
900
  disabled: column.isSorted && !column.isSortedDesc,
878
901
  key: 1,
879
902
  onClick: handleSortAsc,
880
903
  sx: commonMenuItemStyles$1
881
904
  }, React.createElement(Box, {
882
905
  sx: commonListItemStyles
883
- }, React.createElement(SortIcon, null), (_localization$sortByC = localization.sortByColumnAsc) == null ? void 0 : _localization$sortByC.replace('{column}', String(column.Header)))), React.createElement(MenuItem, {
906
+ }, React.createElement(ListItemIcon, null, React.createElement(SortIcon, null)), (_localization$sortByC = localization.sortByColumnAsc) == null ? void 0 : _localization$sortByC.replace('{column}', String(column.Header)))), React.createElement(MenuItem, {
884
907
  divider: !disableFilters || enableColumnGrouping || !disableColumnHiding,
885
908
  key: 2,
886
909
  disabled: column.isSorted && column.isSortedDesc,
@@ -888,25 +911,25 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
888
911
  sx: commonMenuItemStyles$1
889
912
  }, React.createElement(Box, {
890
913
  sx: commonListItemStyles
891
- }, React.createElement(SortIcon, {
914
+ }, React.createElement(ListItemIcon, null, React.createElement(SortIcon, {
892
915
  style: {
893
916
  transform: 'rotate(180deg) scaleX(-1)'
894
917
  }
895
- }), (_localization$sortByC2 = localization.sortByColumnDesc) == null ? void 0 : _localization$sortByC2.replace('{column}', String(column.Header))))], !disableFilters && column.canFilter && [React.createElement(MenuItem, {
918
+ })), (_localization$sortByC2 = localization.sortByColumnDesc) == null ? void 0 : _localization$sortByC2.replace('{column}', String(column.Header))))], !disableFilters && column.canFilter && [React.createElement(MenuItem, {
896
919
  disabled: !column.filterValue,
897
920
  key: 0,
898
921
  onClick: handleClearFilter,
899
922
  sx: commonMenuItemStyles$1
900
923
  }, React.createElement(Box, {
901
924
  sx: commonListItemStyles
902
- }, React.createElement(FilterListOffIcon, null), localization.clearFilter)), React.createElement(MenuItem, {
925
+ }, React.createElement(ListItemIcon, null, React.createElement(FilterListOffIcon, null)), localization.clearFilter)), React.createElement(MenuItem, {
903
926
  divider: enableColumnGrouping || !disableColumnHiding,
904
927
  key: 1,
905
928
  onClick: handleFilterByColumn,
906
929
  sx: commonMenuItemStyles$1
907
930
  }, React.createElement(Box, {
908
931
  sx: commonListItemStyles
909
- }, React.createElement(FilterListIcon, null), (_localization$filterB = localization.filterByColumn) == null ? void 0 : _localization$filterB.replace('{column}', String(column.Header))), !column.filterSelectOptions && React.createElement(IconButton, {
932
+ }, React.createElement(ListItemIcon, null, React.createElement(FilterListIcon, null)), (_localization$filterB = localization.filterByColumn) == null ? void 0 : _localization$filterB.replace('{column}', String(column.Header))), !column.filterSelectOptions && React.createElement(IconButton, {
910
933
  onClick: handleOpenFilterModeMenu,
911
934
  onMouseEnter: handleOpenFilterModeMenu,
912
935
  size: "small",
@@ -926,20 +949,20 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
926
949
  sx: commonMenuItemStyles$1
927
950
  }, React.createElement(Box, {
928
951
  sx: commonListItemStyles
929
- }, React.createElement(DynamicFeedIcon, null), (_localization = localization[column.isGrouped ? 'ungroupByColumn' : 'groupByColumn']) == null ? void 0 : _localization.replace('{column}', String(column.Header))))], !disableColumnHiding && [React.createElement(MenuItem, {
952
+ }, React.createElement(ListItemIcon, null, React.createElement(DynamicFeedIcon, null)), (_localization = localization[column.isGrouped ? 'ungroupByColumn' : 'groupByColumn']) == null ? void 0 : _localization.replace('{column}', String(column.Header))))], !disableColumnHiding && [React.createElement(MenuItem, {
930
953
  key: 0,
931
954
  onClick: handleHideColumn,
932
955
  sx: commonMenuItemStyles$1
933
956
  }, React.createElement(Box, {
934
957
  sx: commonListItemStyles
935
- }, React.createElement(VisibilityOffIcon, null), (_localization$hideCol = localization.hideColumn) == null ? void 0 : _localization$hideCol.replace('{column}', String(column.Header)))), React.createElement(MenuItem, {
958
+ }, React.createElement(ListItemIcon, null, React.createElement(VisibilityOffIcon, null)), (_localization$hideCol = localization.hideColumn) == null ? void 0 : _localization$hideCol.replace('{column}', String(column.Header)))), React.createElement(MenuItem, {
936
959
  disabled: !((_tableInstance$state$ = tableInstance.state.hiddenColumns) != null && _tableInstance$state$.length),
937
960
  key: 1,
938
961
  onClick: handleShowAllColumns,
939
962
  sx: commonMenuItemStyles$1
940
963
  }, React.createElement(Box, {
941
964
  sx: commonListItemStyles
942
- }, React.createElement(ViewColumnIcon, null), (_localization$showAll = localization.showAllColumns) == null ? void 0 : _localization$showAll.replace('{column}', String(column.Header))), !column.filterSelectOptions && React.createElement(IconButton, {
965
+ }, React.createElement(ListItemIcon, null, React.createElement(ViewColumnIcon, null)), (_localization$showAll = localization.showAllColumns) == null ? void 0 : _localization$showAll.replace('{column}', String(column.Header))), !column.filterSelectOptions && React.createElement(IconButton, {
943
966
  onClick: handleOpenShowHideColumnsMenu,
944
967
  onMouseEnter: handleOpenShowHideColumnsMenu,
945
968
  size: "small",
@@ -1144,7 +1167,7 @@ var MRT_EditCellTextField = function MRT_EditCellTextField(_ref) {
1144
1167
  style: _extends({}, muiTableBodyCellEditTextFieldProps == null ? void 0 : muiTableBodyCellEditTextFieldProps.style, (_cell$column$muiTable = cell.column.muiTableBodyCellEditTextFieldProps) == null ? void 0 : _cell$column$muiTable.style)
1145
1168
  });
1146
1169
 
1147
- if (cell.column.editable && cell.column.Edit) {
1170
+ if (!cell.column.disableEditing && cell.column.Edit) {
1148
1171
  return React.createElement(React.Fragment, null, cell.column.Edit(_extends({}, textFieldProps, {
1149
1172
  cell: cell
1150
1173
  })));
@@ -1205,7 +1228,7 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
1205
1228
  animation: "wave",
1206
1229
  height: 20,
1207
1230
  width: Math.random() * (120 - 60) + 60
1208
- }, muiTableBodyCellSkeletonProps)) : (currentEditingRow == null ? void 0 : currentEditingRow.id) === cell.row.id ? React.createElement(MRT_EditCellTextField, {
1231
+ }, muiTableBodyCellSkeletonProps)) : !cell.column.disableEditing && (currentEditingRow == null ? void 0 : currentEditingRow.id) === cell.row.id ? React.createElement(MRT_EditCellTextField, {
1209
1232
  cell: cell
1210
1233
  }) : cell.isPlaceholder ? null : cell.isAggregated ? cell.render('Aggregated') : cell.isGrouped ? React.createElement("span", null, cell.render('Cell'), " (", cell.row.subRows.length, ")") : cell.render('Cell'));
1211
1234
  };
@@ -1401,9 +1424,18 @@ var MRT_ExpandButton = function MRT_ExpandButton(_ref) {
1401
1424
  var _useMRT = useMRT(),
1402
1425
  ExpandMoreIcon = _useMRT.icons.ExpandMoreIcon,
1403
1426
  localization = _useMRT.localization,
1427
+ onRowExpandChange = _useMRT.onRowExpandChange,
1404
1428
  renderDetailPanel = _useMRT.renderDetailPanel,
1405
1429
  densePadding = _useMRT.tableInstance.state.densePadding;
1406
1430
 
1431
+ var handleToggleExpand = function handleToggleExpand(event) {
1432
+ var _row$getToggleRowExpa;
1433
+
1434
+ // @ts-ignore
1435
+ (_row$getToggleRowExpa = row.getToggleRowExpandedProps()) == null ? void 0 : _row$getToggleRowExpa.onClick(event);
1436
+ onRowExpandChange == null ? void 0 : onRowExpandChange(event, row);
1437
+ };
1438
+
1407
1439
  return React.createElement(TableCell, {
1408
1440
  size: "small",
1409
1441
  sx: _extends({}, commonTableBodyButtonCellStyles(densePadding), {
@@ -1414,7 +1446,9 @@ var MRT_ExpandButton = function MRT_ExpandButton(_ref) {
1414
1446
  "aria-label": localization.expand,
1415
1447
  disabled: !row.canExpand && !renderDetailPanel,
1416
1448
  title: localization.expand
1417
- }, row.getToggleRowExpandedProps()), React.createElement(ExpandMoreIcon, {
1449
+ }, row.getToggleRowExpandedProps(), {
1450
+ onClick: handleToggleExpand
1451
+ }), React.createElement(ExpandMoreIcon, {
1418
1452
  style: {
1419
1453
  transform: "rotate(" + (!row.canExpand && !renderDetailPanel ? -90 : row.isExpanded ? -180 : 0) + "deg)",
1420
1454
  transition: 'transform 0.2s'
@@ -1449,7 +1483,9 @@ var MRT_RowActionMenu = function MRT_RowActionMenu(_ref) {
1449
1483
  }, enableRowEditing && React.createElement(MenuItem, {
1450
1484
  onClick: handleEdit,
1451
1485
  sx: commonMenuItemStyles$1
1452
- }, React.createElement(EditIcon, null), localization.edit), (_renderRowActionMenuI = renderRowActionMenuItems == null ? void 0 : renderRowActionMenuItems(row, tableInstance, function () {
1486
+ }, React.createElement(Box, {
1487
+ sx: commonListItemStyles
1488
+ }, React.createElement(ListItemIcon, null, React.createElement(EditIcon, null)), localization.edit)), (_renderRowActionMenuI = renderRowActionMenuItems == null ? void 0 : renderRowActionMenuItems(row, tableInstance, function () {
1453
1489
  return setAnchorEl(null);
1454
1490
  })) != null ? _renderRowActionMenuI : null);
1455
1491
  };
@@ -2372,14 +2408,9 @@ var MRT_TableBodyRow = function MRT_TableBodyRow(_ref) {
2372
2408
  hover: true,
2373
2409
  onClick: function onClick(event) {
2374
2410
  return onRowClick == null ? void 0 : onRowClick(event, row);
2375
- }
2376
- }, tableRowProps, {
2377
- sx: function sx(theme) {
2378
- return _extends({
2379
- backgroundColor: row.isSelected ? alpha(theme.palette.primary.light, 0.1) : 'transparent'
2380
- }, tableRowProps == null ? void 0 : tableRowProps.sx);
2381
- }
2382
- }), enableRowNumbers && React.createElement(TableCell, {
2411
+ },
2412
+ selected: row.isSelected
2413
+ }, tableRowProps), enableRowNumbers && React.createElement(TableCell, {
2383
2414
  sx: _extends({}, commonTableBodyCellStyles(densePadding))
2384
2415
  }, row.index + 1), (enableRowActions || enableRowEditing) && positionActionsColumn === 'first' && React.createElement(MRT_ToggleRowActionMenuButton, {
2385
2416
  row: row
@@ -2413,9 +2444,7 @@ var MRT_TableBody = function MRT_TableBody() {
2413
2444
  });
2414
2445
 
2415
2446
  return React.createElement(TableBody, Object.assign({}, tableBodyProps, {
2416
- sx: _extends({
2417
- overflowY: 'hidden'
2418
- }, tableBodyProps == null ? void 0 : tableBodyProps.sx)
2447
+ sx: _extends({}, tableBodyProps == null ? void 0 : tableBodyProps.sx)
2419
2448
  }), rows.map(function (row) {
2420
2449
  tableInstance.prepareRow(row);
2421
2450
  return React.createElement(MRT_TableBodyRow, {
@@ -2775,7 +2804,7 @@ var MRT_TablePagination = function MRT_TablePagination() {
2775
2804
  showLastButton: tableInstance.rows.length / tableInstance.state.pageSize > 2
2776
2805
  }, tablePaginationProps, {
2777
2806
  sx: _extends({
2778
- p: 0,
2807
+ m: '0 0.5rem',
2779
2808
  position: 'relative',
2780
2809
  zIndex: 2
2781
2810
  }, tablePaginationProps == null ? void 0 : tablePaginationProps.sx)
@@ -2837,6 +2866,34 @@ var MRT_ToolbarAlertBanner = function MRT_ToolbarAlertBanner() {
2837
2866
  }, selectMessage, groupedByMessage)));
2838
2867
  };
2839
2868
 
2869
+ var MRT_LinearProgressBar = function MRT_LinearProgressBar() {
2870
+ var _useMRT = useMRT(),
2871
+ muiLinearProgressProps = _useMRT.muiLinearProgressProps,
2872
+ isFetching = _useMRT.isFetching,
2873
+ isLoading = _useMRT.isLoading,
2874
+ tableInstance = _useMRT.tableInstance;
2875
+
2876
+ var linearProgressProps = muiLinearProgressProps instanceof Function ? muiLinearProgressProps(tableInstance) : muiLinearProgressProps;
2877
+ return React.createElement(Collapse, {
2878
+ "in": isFetching || isLoading,
2879
+ unmountOnExit: true
2880
+ }, React.createElement(LinearProgress, Object.assign({
2881
+ "aria-label": "Loading",
2882
+ "aria-busy": "true"
2883
+ }, linearProgressProps)));
2884
+ };
2885
+
2886
+ var commonToolbarStyles = function commonToolbarStyles(theme, tableInstance) {
2887
+ return {
2888
+ backgroundColor: theme.palette.background["default"],
2889
+ backgroundImage: "linear-gradient(" + alpha(theme.palette.common.white, 0.05) + "," + alpha(theme.palette.common.white, 0.05) + ")",
2890
+ display: 'grid',
2891
+ opacity: tableInstance.state.fullScreen ? 0.95 : 1,
2892
+ p: '0 !important',
2893
+ width: '100%',
2894
+ zIndex: 1
2895
+ };
2896
+ };
2840
2897
  var MRT_ToolbarTop = function MRT_ToolbarTop() {
2841
2898
  var _renderToolbarCustomA;
2842
2899
 
@@ -2857,15 +2914,9 @@ var MRT_ToolbarTop = function MRT_ToolbarTop() {
2857
2914
  }, toolbarProps, {
2858
2915
  sx: function sx(theme) {
2859
2916
  return _extends({
2860
- backgroundColor: theme.palette.background["default"],
2861
- backgroundImage: "linear-gradient(" + alpha(theme.palette.common.white, 0.05) + "," + alpha(theme.palette.common.white, 0.05) + ")",
2862
- display: 'grid',
2863
- p: '0 !important',
2864
2917
  position: tableInstance.state.fullScreen ? 'sticky' : undefined,
2865
- top: tableInstance.state.fullScreen ? '0' : undefined,
2866
- width: '100%',
2867
- zIndex: 1
2868
- }, toolbarProps == null ? void 0 : toolbarProps.sx);
2918
+ top: tableInstance.state.fullScreen ? '0' : undefined
2919
+ }, commonToolbarStyles(theme, tableInstance), toolbarProps == null ? void 0 : toolbarProps.sx);
2869
2920
  }
2870
2921
  }), positionToolbarAlertBanner === 'top' && React.createElement(MRT_ToolbarAlertBanner, null), React.createElement(Box, {
2871
2922
  sx: {
@@ -2880,7 +2931,7 @@ var MRT_ToolbarTop = function MRT_ToolbarTop() {
2880
2931
  position: 'relative',
2881
2932
  zIndex: 3
2882
2933
  }
2883
- }, !disableGlobalFilter && React.createElement(MRT_SearchTextField, null), !hideToolbarInternalActions && positionToolbarActions === 'top' && React.createElement(MRT_ToolbarInternalButtons, null))), React.createElement("div", null, !manualPagination && ['top', 'both'].includes(positionPagination != null ? positionPagination : '') && React.createElement(MRT_TablePagination, null)));
2934
+ }, !disableGlobalFilter && React.createElement(MRT_SearchTextField, null), !hideToolbarInternalActions && positionToolbarActions === 'top' && React.createElement(MRT_ToolbarInternalButtons, null))), React.createElement("div", null, !manualPagination && ['top', 'both'].includes(positionPagination != null ? positionPagination : '') && React.createElement(MRT_TablePagination, null)), React.createElement(MRT_LinearProgressBar, null));
2884
2935
  };
2885
2936
 
2886
2937
  var MRT_ToolbarBottom = function MRT_ToolbarBottom() {
@@ -2899,53 +2950,37 @@ var MRT_ToolbarBottom = function MRT_ToolbarBottom() {
2899
2950
  }, toolbarProps, {
2900
2951
  sx: function sx(theme) {
2901
2952
  return _extends({
2902
- backgroundColor: theme.palette.background["default"],
2903
- backgroundImage: "linear-gradient(" + alpha(theme.palette.common.white, 0.05) + "," + alpha(theme.palette.common.white, 0.05) + ")",
2904
2953
  bottom: tableInstance.state.fullScreen ? '0' : undefined,
2905
- display: 'flex',
2906
- justifyContent: 'space-between',
2907
- overflowY: 'hidden',
2908
- p: '0 0.5rem !important',
2909
- position: tableInstance.state.fullScreen ? 'fixed' : undefined,
2910
- width: 'calc(100% - 1rem)',
2911
- zIndex: 1
2912
- }, toolbarProps == null ? void 0 : toolbarProps.sx);
2954
+ position: tableInstance.state.fullScreen ? 'fixed' : undefined
2955
+ }, commonToolbarStyles(theme, tableInstance), toolbarProps == null ? void 0 : toolbarProps.sx);
2956
+ }
2957
+ }), React.createElement(MRT_LinearProgressBar, null), React.createElement(Box, {
2958
+ sx: {
2959
+ display: 'flex',
2960
+ justifyContent: 'space-between',
2961
+ width: '100%'
2913
2962
  }
2914
- }), !hideToolbarInternalActions && positionToolbarActions === 'bottom' ? React.createElement(MRT_ToolbarInternalButtons, null) : React.createElement("span", null), positionToolbarAlertBanner === 'bottom' && React.createElement(MRT_ToolbarAlertBanner, null), !manualPagination && ['bottom', 'both'].includes(positionPagination != null ? positionPagination : '') && React.createElement(MRT_TablePagination, null));
2963
+ }, !hideToolbarInternalActions && positionToolbarActions === 'bottom' ? React.createElement(MRT_ToolbarInternalButtons, null) : React.createElement("span", null), positionToolbarAlertBanner === 'bottom' && React.createElement(MRT_ToolbarAlertBanner, null), !manualPagination && ['bottom', 'both'].includes(positionPagination != null ? positionPagination : '') && React.createElement(MRT_TablePagination, null)));
2915
2964
  };
2916
2965
 
2917
2966
  var MRT_TableContainer = function MRT_TableContainer() {
2918
2967
  var _useMRT = useMRT(),
2919
2968
  hideToolbarBottom = _useMRT.hideToolbarBottom,
2920
2969
  hideToolbarTop = _useMRT.hideToolbarTop,
2921
- isFetching = _useMRT.isFetching,
2922
- isLoading = _useMRT.isLoading,
2923
- muiLinearProgressProps = _useMRT.muiLinearProgressProps,
2924
2970
  muiTableContainerProps = _useMRT.muiTableContainerProps,
2925
2971
  tableInstance = _useMRT.tableInstance;
2926
2972
 
2927
2973
  var fullScreen = tableInstance.state.fullScreen;
2928
- var originalBodyOverflowStyle = useRef();
2929
- useEffect(function () {
2930
- if (typeof window !== 'undefined') {
2931
- var _document, _document$body, _document$body$style;
2932
-
2933
- originalBodyOverflowStyle.current = (_document = document) == null ? void 0 : (_document$body = _document.body) == null ? void 0 : (_document$body$style = _document$body.style) == null ? void 0 : _document$body$style.overflow;
2934
- }
2935
- }, []);
2936
2974
  useEffect(function () {
2937
2975
  if (typeof window !== 'undefined') {
2938
2976
  if (fullScreen) {
2939
2977
  document.body.style.overflow = 'hidden';
2940
2978
  } else {
2941
- var _originalBodyOverflow;
2942
-
2943
- document.body.style.overflow = (_originalBodyOverflow = originalBodyOverflowStyle.current) != null ? _originalBodyOverflow : 'auto';
2979
+ document.body.style.overflow = 'auto';
2944
2980
  }
2945
2981
  }
2946
2982
  }, [fullScreen]);
2947
2983
  var tableContainerProps = muiTableContainerProps instanceof Function ? muiTableContainerProps(tableInstance) : muiTableContainerProps;
2948
- var linearProgressProps = muiLinearProgressProps instanceof Function ? muiLinearProgressProps(tableInstance) : muiLinearProgressProps;
2949
2984
  return React.createElement(TableContainer, Object.assign({
2950
2985
  component: Paper
2951
2986
  }, tableContainerProps, {
@@ -2954,6 +2989,7 @@ var MRT_TableContainer = function MRT_TableContainer() {
2954
2989
  height: fullScreen ? '100%' : undefined,
2955
2990
  left: fullScreen ? '0' : undefined,
2956
2991
  m: fullScreen ? '0' : undefined,
2992
+ overflowY: !fullScreen ? 'hidden' : undefined,
2957
2993
  position: fullScreen ? 'fixed' : undefined,
2958
2994
  right: fullScreen ? '0' : undefined,
2959
2995
  top: fullScreen ? '0' : undefined,
@@ -2961,10 +2997,7 @@ var MRT_TableContainer = function MRT_TableContainer() {
2961
2997
  width: fullScreen ? '100vw' : undefined,
2962
2998
  zIndex: fullScreen ? 1200 : 1
2963
2999
  }, tableContainerProps == null ? void 0 : tableContainerProps.sx)
2964
- }), !hideToolbarTop && React.createElement(MRT_ToolbarTop, null), React.createElement(Collapse, {
2965
- "in": isFetching || isLoading,
2966
- unmountOnExit: true
2967
- }, React.createElement(LinearProgress, Object.assign({}, linearProgressProps))), React.createElement(Box, {
3000
+ }), !hideToolbarTop && React.createElement(MRT_ToolbarTop, null), React.createElement(Box, {
2968
3001
  sx: {
2969
3002
  maxWidth: '100%',
2970
3003
  overflowX: 'auto'
@@ -3069,10 +3102,13 @@ var MaterialReactTable = (function (_ref) {
3069
3102
  positionToolbarAlertBanner = _ref$positionToolbarA2 === void 0 ? 'top' : _ref$positionToolbarA2,
3070
3103
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
3071
3104
 
3072
- return React.createElement(MaterialReactTableProvider, Object.assign({
3105
+ return React.createElement(MaterialReactTableProvider //@ts-ignore
3106
+ , Object.assign({
3107
+ //@ts-ignore
3073
3108
  defaultColumn: defaultColumn,
3074
- // @ts-ignore
3109
+ //@ts-ignore
3075
3110
  filterTypes: _extends({}, defaultFilterFNs, filterTypes),
3111
+ //@ts-ignore
3076
3112
  globalFilter: globalFilter,
3077
3113
  icons: _extends({}, MRT_Default_Icons, icons),
3078
3114
  localization: _extends({}, MRT_DefaultLocalization_EN, localization),