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
@@ -104,6 +104,35 @@ function _objectWithoutPropertiesLoose(source, excluded) {
104
104
  return target;
105
105
  }
106
106
 
107
+ var findLowestLevelCols = function findLowestLevelCols(columns) {
108
+ var lowestLevelColumns = columns;
109
+ var currentCols = columns;
110
+
111
+ while (!!((_currentCols = currentCols) != null && _currentCols.length) && currentCols.some(function (col) {
112
+ return col.columns;
113
+ })) {
114
+ var _currentCols;
115
+
116
+ var nextCols = currentCols.filter(function (col) {
117
+ return !!col.columns;
118
+ }).map(function (col) {
119
+ return col.columns;
120
+ }).flat();
121
+
122
+ if (nextCols.every(function (col) {
123
+ return !(col != null && col.columns);
124
+ })) {
125
+ lowestLevelColumns = [].concat(lowestLevelColumns, nextCols);
126
+ }
127
+
128
+ currentCols = nextCols;
129
+ }
130
+
131
+ return lowestLevelColumns.filter(function (col) {
132
+ return !col.columns;
133
+ });
134
+ };
135
+
107
136
  var MaterialReactTableContext = /*#__PURE__*/function () {
108
137
  return React.createContext({});
109
138
  }();
@@ -134,35 +163,8 @@ var MaterialReactTableProvider = function MaterialReactTableProvider(props) {
134
163
  showSearch = _useState5[0],
135
164
  setShowSearch = _useState5[1];
136
165
 
137
- var findLowestLevelCols = React.useCallback(function () {
138
- var lowestLevelColumns = props.columns;
139
- var currentCols = props.columns;
140
-
141
- while (!!currentCols.length && currentCols.some(function (col) {
142
- return col.columns;
143
- })) {
144
- var nextCols = currentCols.filter(function (col) {
145
- return !!col.columns;
146
- }).map(function (col) {
147
- return col.columns;
148
- }).flat();
149
-
150
- if (nextCols.every(function (col) {
151
- return !col.columns;
152
- })) {
153
- lowestLevelColumns = [].concat(lowestLevelColumns, nextCols);
154
- }
155
-
156
- currentCols = nextCols;
157
- }
158
-
159
- return lowestLevelColumns.filter(function (col) {
160
- return !col.columns;
161
- });
162
- }, [props.columns]);
163
-
164
166
  var _useState6 = React.useState(function () {
165
- return Object.assign.apply(Object, [{}].concat(findLowestLevelCols().map(function (c) {
167
+ return Object.assign.apply(Object, [{}].concat(findLowestLevelCols(props.columns).map(function (c) {
166
168
  var _ref, _c$filter, _props$initialState5, _props$initialState5$, _ref2;
167
169
 
168
170
  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;
@@ -187,10 +189,20 @@ var MaterialReactTableProvider = function MaterialReactTableProvider(props) {
187
189
  var columns = React.useMemo(function () {
188
190
  return applyFiltersToColumns(props.columns);
189
191
  }, [props.columns, applyFiltersToColumns]);
192
+ var data = React.useMemo(function () {
193
+ return !props.isLoading || !!props.data.length ? props.data : [].concat(Array(10).fill(null)).map(function (_) {
194
+ return Object.assign.apply(Object, [{}].concat(findLowestLevelCols(props.columns).map(function (c) {
195
+ var _ref3;
196
+
197
+ return _ref3 = {}, _ref3[c.accessor] = null, _ref3;
198
+ })));
199
+ });
200
+ }, [props.data, props.isLoading]);
190
201
  var tableInstance = reactTable.useTable.apply(void 0, [// @ts-ignore
191
202
  _extends({}, props, {
192
203
  // @ts-ignore
193
204
  columns: columns,
205
+ data: data,
194
206
  useControlledState: function useControlledState(state) {
195
207
  return React.useMemo(function () {
196
208
  return _extends({}, state, {
@@ -255,7 +267,7 @@ var MRT_FILTER_TYPE;
255
267
  MRT_FILTER_TYPE["STARTS_WITH"] = "startsWith";
256
268
  })(MRT_FILTER_TYPE || (MRT_FILTER_TYPE = {}));
257
269
 
258
- var fuzzyFilterFN = function fuzzyFilterFN(rows, columnIds, filterValue) {
270
+ var fuzzy = function fuzzy(rows, columnIds, filterValue) {
259
271
  return matchSorter.matchSorter(rows, filterValue.toString().trim(), {
260
272
  keys: Array.isArray(columnIds) ? columnIds.map(function (c) {
261
273
  return "values." + c;
@@ -266,111 +278,111 @@ var fuzzyFilterFN = function fuzzyFilterFN(rows, columnIds, filterValue) {
266
278
  });
267
279
  };
268
280
 
269
- fuzzyFilterFN.autoRemove = function (val) {
281
+ fuzzy.autoRemove = function (val) {
270
282
  return !val;
271
283
  };
272
284
 
273
- var containsFilterFN = function containsFilterFN(rows, id, filterValue) {
285
+ var contains = function contains(rows, id, filterValue) {
274
286
  return rows.filter(function (row) {
275
287
  return row.values[id].toString().toLowerCase().trim().includes(filterValue.toString().toLowerCase().trim());
276
288
  });
277
289
  };
278
290
 
279
- containsFilterFN.autoRemove = function (val) {
291
+ contains.autoRemove = function (val) {
280
292
  return !val;
281
293
  };
282
294
 
283
- var startsWithFilterFN = function startsWithFilterFN(rows, id, filterValue) {
295
+ var startsWith = function startsWith(rows, id, filterValue) {
284
296
  return rows.filter(function (row) {
285
297
  return row.values[id].toString().toLowerCase().trim().startsWith(filterValue.toString().toLowerCase().trim());
286
298
  });
287
299
  };
288
300
 
289
- startsWithFilterFN.autoRemove = function (val) {
301
+ startsWith.autoRemove = function (val) {
290
302
  return !val;
291
303
  };
292
304
 
293
- var endsWithFilterFN = function endsWithFilterFN(rows, id, filterValue) {
305
+ var endsWith = function endsWith(rows, id, filterValue) {
294
306
  return rows.filter(function (row) {
295
307
  return row.values[id].toString().toLowerCase().trim().endsWith(filterValue.toString().toLowerCase().trim());
296
308
  });
297
309
  };
298
310
 
299
- endsWithFilterFN.autoRemove = function (val) {
311
+ endsWith.autoRemove = function (val) {
300
312
  return !val;
301
313
  };
302
314
 
303
- var equalsFilterFN = function equalsFilterFN(rows, id, filterValue) {
315
+ var equals = function equals(rows, id, filterValue) {
304
316
  return rows.filter(function (row) {
305
317
  return row.values[id].toString().toLowerCase().trim() === filterValue.toString().toLowerCase().trim();
306
318
  });
307
319
  };
308
320
 
309
- equalsFilterFN.autoRemove = function (val) {
321
+ equals.autoRemove = function (val) {
310
322
  return !val;
311
323
  };
312
324
 
313
- var notEqualsFilterFN = function notEqualsFilterFN(rows, id, filterValue) {
325
+ var notEquals = function notEquals(rows, id, filterValue) {
314
326
  return rows.filter(function (row) {
315
327
  return row.values[id].toString().toLowerCase().trim() !== filterValue.toString().toLowerCase().trim();
316
328
  });
317
329
  };
318
330
 
319
- notEqualsFilterFN.autoRemove = function (val) {
331
+ notEquals.autoRemove = function (val) {
320
332
  return !val;
321
333
  };
322
334
 
323
- var greaterThanFilterFN = function greaterThanFilterFN(rows, id, filterValue) {
335
+ var greaterThan = function greaterThan(rows, id, filterValue) {
324
336
  return rows.filter(function (row) {
325
337
  return !isNaN(+filterValue) && !isNaN(+row.values[id]) ? +row.values[id] > +filterValue : row.values[id].toString().toLowerCase().trim() > filterValue.toString().toLowerCase().trim();
326
338
  });
327
339
  };
328
340
 
329
- greaterThanFilterFN.autoRemove = function (val) {
341
+ greaterThan.autoRemove = function (val) {
330
342
  return !val;
331
343
  };
332
344
 
333
- var lessThanFilterFN = function lessThanFilterFN(rows, id, filterValue) {
345
+ var lessThan = function lessThan(rows, id, filterValue) {
334
346
  return rows.filter(function (row) {
335
347
  return !isNaN(+filterValue) && !isNaN(+row.values[id]) ? +row.values[id] < +filterValue : row.values[id].toString().toLowerCase().trim() < filterValue.toString().toLowerCase().trim();
336
348
  });
337
349
  };
338
350
 
339
- lessThanFilterFN.autoRemove = function (val) {
351
+ lessThan.autoRemove = function (val) {
340
352
  return !val;
341
353
  };
342
354
 
343
- var emptyFilterFN = function emptyFilterFN(rows, id, _filterValue) {
355
+ var empty = function empty(rows, id, _filterValue) {
344
356
  return rows.filter(function (row) {
345
357
  return !row.values[id].toString().toLowerCase().trim();
346
358
  });
347
359
  };
348
360
 
349
- emptyFilterFN.autoRemove = function (val) {
361
+ empty.autoRemove = function (val) {
350
362
  return !val;
351
363
  };
352
364
 
353
- var notEmptyFilterFN = function notEmptyFilterFN(rows, id, _filterValue) {
365
+ var notEmpty = function notEmpty(rows, id, _filterValue) {
354
366
  return rows.filter(function (row) {
355
367
  return !!row.values[id].toString().toLowerCase().trim();
356
368
  });
357
369
  };
358
370
 
359
- notEmptyFilterFN.autoRemove = function (val) {
371
+ notEmpty.autoRemove = function (val) {
360
372
  return !val;
361
373
  };
362
374
 
363
375
  var defaultFilterFNs = {
364
- contains: containsFilterFN,
365
- empty: emptyFilterFN,
366
- endsWith: endsWithFilterFN,
367
- equals: equalsFilterFN,
368
- fuzzy: fuzzyFilterFN,
369
- greaterThan: greaterThanFilterFN,
370
- lessThan: lessThanFilterFN,
371
- notEmpty: notEmptyFilterFN,
372
- notEquals: notEqualsFilterFN,
373
- startsWith: startsWithFilterFN
376
+ contains: contains,
377
+ empty: empty,
378
+ endsWith: endsWith,
379
+ equals: equals,
380
+ fuzzy: fuzzy,
381
+ greaterThan: greaterThan,
382
+ lessThan: lessThan,
383
+ notEmpty: notEmpty,
384
+ notEquals: notEquals,
385
+ startsWith: startsWith
374
386
  };
375
387
 
376
388
  var commonMenuItemStyles = {
@@ -394,52 +406,52 @@ var MRT_FilterTypeMenu = function MRT_FilterTypeMenu(_ref) {
394
406
  type: MRT_FILTER_TYPE.FUZZY,
395
407
  label: localization.filterFuzzy,
396
408
  divider: false,
397
- fn: fuzzyFilterFN
409
+ fn: fuzzy
398
410
  }, {
399
411
  type: MRT_FILTER_TYPE.CONTAINS,
400
412
  label: localization.filterContains,
401
413
  divider: true,
402
- fn: containsFilterFN
414
+ fn: contains
403
415
  }, {
404
416
  type: MRT_FILTER_TYPE.STARTS_WITH,
405
417
  label: localization.filterStartsWith,
406
418
  divider: false,
407
- fn: startsWithFilterFN
419
+ fn: startsWith
408
420
  }, {
409
421
  type: MRT_FILTER_TYPE.ENDS_WITH,
410
422
  label: localization.filterEndsWith,
411
423
  divider: true,
412
- fn: endsWithFilterFN
424
+ fn: endsWith
413
425
  }, {
414
426
  type: MRT_FILTER_TYPE.EQUALS,
415
427
  label: localization.filterEquals,
416
428
  divider: false,
417
- fn: equalsFilterFN
429
+ fn: equals
418
430
  }, {
419
431
  type: MRT_FILTER_TYPE.NOT_EQUALS,
420
432
  label: localization.filterNotEquals,
421
433
  divider: true,
422
- fn: notEqualsFilterFN
434
+ fn: notEquals
423
435
  }, {
424
436
  type: MRT_FILTER_TYPE.GREATER_THAN,
425
437
  label: localization.filterGreaterThan,
426
438
  divider: false,
427
- fn: greaterThanFilterFN
439
+ fn: greaterThan
428
440
  }, {
429
441
  type: MRT_FILTER_TYPE.LESS_THAN,
430
442
  label: localization.filterLessThan,
431
443
  divider: true,
432
- fn: lessThanFilterFN
444
+ fn: lessThan
433
445
  }, {
434
446
  type: MRT_FILTER_TYPE.EMPTY,
435
447
  label: localization.filterEmpty,
436
448
  divider: false,
437
- fn: emptyFilterFN
449
+ fn: empty
438
450
  }, {
439
451
  type: MRT_FILTER_TYPE.NOT_EMPTY,
440
452
  label: localization.filterNotEmpty,
441
453
  divider: false,
442
- fn: notEmptyFilterFN
454
+ fn: notEmpty
443
455
  }];
444
456
  }, []);
445
457
 
@@ -491,7 +503,7 @@ var MRT_FilterTypeMenu = function MRT_FilterTypeMenu(_ref) {
491
503
  };
492
504
 
493
505
  var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
494
- var _localization$filterB, _localization$clearFi, _column$filterSelectO;
506
+ var _localization$filterB, _localization$filterM, _localization$, _localization$clearFi, _column$filterSelectO;
495
507
 
496
508
  var column = _ref.column;
497
509
 
@@ -549,6 +561,7 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
549
561
  }));
550
562
  }
551
563
 
564
+ var filterId = "mrt-" + idPrefix + "-" + column.id + "-filter-text-field";
552
565
  var filterType = tableInstance.state.currentFilterTypes[column.id];
553
566
  var isSelectFilter = !!column.filterSelectOptions;
554
567
  var filterChipLabel = !(filterType instanceof Function) && [MRT_FILTER_TYPE.EMPTY, MRT_FILTER_TYPE.NOT_EMPTY].includes(filterType) ? //@ts-ignore
@@ -556,7 +569,7 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
556
569
  var filterPlaceholder = (_localization$filterB = localization.filterByColumn) == null ? void 0 : _localization$filterB.replace('{column}', String(column.Header));
557
570
  return React__default.createElement(React__default.Fragment, null, React__default.createElement(material.TextField, Object.assign({
558
571
  fullWidth: true,
559
- id: "mrt-" + idPrefix + "-" + column.id + "-filter-text-field",
572
+ id: filterId,
560
573
  inputProps: {
561
574
  disabled: !!filterChipLabel,
562
575
  sx: {
@@ -565,8 +578,11 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
565
578
  },
566
579
  title: filterPlaceholder
567
580
  },
568
- helperText: filterType instanceof Function ? '' : localization.filterMode.replace('{filterType}', // @ts-ignore
569
- localization["filter" + (filterType.charAt(0).toUpperCase() + filterType.slice(1))]),
581
+ helperText: React__default.createElement("label", {
582
+ htmlFor: filterId
583
+ }, filterType instanceof Function ? (_localization$filterM = localization.filterMode.replace('{filterType}', // @ts-ignore
584
+ (_localization$ = localization["filter" + (filterType.name.charAt(0).toUpperCase() + filterType.name.slice(1))]) != null ? _localization$ : '')) != null ? _localization$filterM : '' : localization.filterMode.replace('{filterType}', // @ts-ignore
585
+ localization["filter" + (filterType.charAt(0).toUpperCase() + filterType.slice(1))])),
570
586
  FormHelperTextProps: {
571
587
  sx: {
572
588
  fontSize: '0.6rem',
@@ -674,6 +690,11 @@ var MRT_ShowHideColumnsMenuItems = function MRT_ShowHideColumnsMenuItems(_ref) {
674
690
 
675
691
  var column = _ref.column,
676
692
  isSubMenu = _ref.isSubMenu;
693
+
694
+ var _useMRT = useMRT(),
695
+ onColumnHide = _useMRT.onColumnHide,
696
+ tableInstance = _useMRT.tableInstance;
697
+
677
698
  var isParentHeader = !!(column != null && (_column$columns = column.columns) != null && _column$columns.length);
678
699
  var allChildColumnsVisible = isParentHeader && !!((_column$columns2 = column.columns) != null && _column$columns2.every(function (childColumn) {
679
700
  return childColumn.isVisible;
@@ -690,6 +711,8 @@ var MRT_ShowHideColumnsMenuItems = function MRT_ShowHideColumnsMenuItems(_ref) {
690
711
  } else {
691
712
  column.toggleHidden();
692
713
  }
714
+
715
+ onColumnHide == null ? void 0 : onColumnHide(column, tableInstance.state.hiddenColumns);
693
716
  };
694
717
 
695
718
  return React__default.createElement(React__default.Fragment, null, React__default.createElement(material.MenuItem, {
@@ -772,7 +795,6 @@ var commonMenuItemStyles$1 = {
772
795
  };
773
796
  var commonListItemStyles = {
774
797
  display: 'flex',
775
- gap: '0.75rem',
776
798
  alignItems: 'center'
777
799
  };
778
800
  var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
@@ -850,15 +872,16 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
850
872
  setAnchorEl(null);
851
873
  };
852
874
 
875
+ var handleShowAllColumns = function handleShowAllColumns() {
876
+ tableInstance.toggleHideAllColumns(false);
877
+ setAnchorEl(null);
878
+ };
879
+
853
880
  var handleOpenFilterModeMenu = function handleOpenFilterModeMenu(event) {
854
881
  event.stopPropagation();
855
882
  setFilterMenuAnchorEl(event.currentTarget);
856
883
  };
857
884
 
858
- var handleShowAllColumns = function handleShowAllColumns() {
859
- tableInstance.toggleHideAllColumns(false);
860
- };
861
-
862
885
  var handleOpenShowHideColumnsMenu = function handleOpenShowHideColumnsMenu(event) {
863
886
  event.stopPropagation();
864
887
  setShowHideColumnsMenuAnchorEl(event.currentTarget);
@@ -880,14 +903,14 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
880
903
  sx: commonMenuItemStyles$1
881
904
  }, React__default.createElement(material.Box, {
882
905
  sx: commonListItemStyles
883
- }, React__default.createElement(ClearAllIcon, null), localization.clearSort)), React__default.createElement(material.MenuItem, {
906
+ }, React__default.createElement(material.ListItemIcon, null, React__default.createElement(ClearAllIcon, null)), localization.clearSort)), React__default.createElement(material.MenuItem, {
884
907
  disabled: column.isSorted && !column.isSortedDesc,
885
908
  key: 1,
886
909
  onClick: handleSortAsc,
887
910
  sx: commonMenuItemStyles$1
888
911
  }, React__default.createElement(material.Box, {
889
912
  sx: commonListItemStyles
890
- }, React__default.createElement(SortIcon, null), (_localization$sortByC = localization.sortByColumnAsc) == null ? void 0 : _localization$sortByC.replace('{column}', String(column.Header)))), React__default.createElement(material.MenuItem, {
913
+ }, React__default.createElement(material.ListItemIcon, null, React__default.createElement(SortIcon, null)), (_localization$sortByC = localization.sortByColumnAsc) == null ? void 0 : _localization$sortByC.replace('{column}', String(column.Header)))), React__default.createElement(material.MenuItem, {
891
914
  divider: !disableFilters || enableColumnGrouping || !disableColumnHiding,
892
915
  key: 2,
893
916
  disabled: column.isSorted && column.isSortedDesc,
@@ -895,25 +918,25 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
895
918
  sx: commonMenuItemStyles$1
896
919
  }, React__default.createElement(material.Box, {
897
920
  sx: commonListItemStyles
898
- }, React__default.createElement(SortIcon, {
921
+ }, React__default.createElement(material.ListItemIcon, null, React__default.createElement(SortIcon, {
899
922
  style: {
900
923
  transform: 'rotate(180deg) scaleX(-1)'
901
924
  }
902
- }), (_localization$sortByC2 = localization.sortByColumnDesc) == null ? void 0 : _localization$sortByC2.replace('{column}', String(column.Header))))], !disableFilters && column.canFilter && [React__default.createElement(material.MenuItem, {
925
+ })), (_localization$sortByC2 = localization.sortByColumnDesc) == null ? void 0 : _localization$sortByC2.replace('{column}', String(column.Header))))], !disableFilters && column.canFilter && [React__default.createElement(material.MenuItem, {
903
926
  disabled: !column.filterValue,
904
927
  key: 0,
905
928
  onClick: handleClearFilter,
906
929
  sx: commonMenuItemStyles$1
907
930
  }, React__default.createElement(material.Box, {
908
931
  sx: commonListItemStyles
909
- }, React__default.createElement(FilterListOffIcon, null), localization.clearFilter)), React__default.createElement(material.MenuItem, {
932
+ }, React__default.createElement(material.ListItemIcon, null, React__default.createElement(FilterListOffIcon, null)), localization.clearFilter)), React__default.createElement(material.MenuItem, {
910
933
  divider: enableColumnGrouping || !disableColumnHiding,
911
934
  key: 1,
912
935
  onClick: handleFilterByColumn,
913
936
  sx: commonMenuItemStyles$1
914
937
  }, React__default.createElement(material.Box, {
915
938
  sx: commonListItemStyles
916
- }, React__default.createElement(FilterListIcon, null), (_localization$filterB = localization.filterByColumn) == null ? void 0 : _localization$filterB.replace('{column}', String(column.Header))), !column.filterSelectOptions && React__default.createElement(material.IconButton, {
939
+ }, React__default.createElement(material.ListItemIcon, null, React__default.createElement(FilterListIcon, null)), (_localization$filterB = localization.filterByColumn) == null ? void 0 : _localization$filterB.replace('{column}', String(column.Header))), !column.filterSelectOptions && React__default.createElement(material.IconButton, {
917
940
  onClick: handleOpenFilterModeMenu,
918
941
  onMouseEnter: handleOpenFilterModeMenu,
919
942
  size: "small",
@@ -933,20 +956,20 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
933
956
  sx: commonMenuItemStyles$1
934
957
  }, React__default.createElement(material.Box, {
935
958
  sx: commonListItemStyles
936
- }, React__default.createElement(DynamicFeedIcon, null), (_localization = localization[column.isGrouped ? 'ungroupByColumn' : 'groupByColumn']) == null ? void 0 : _localization.replace('{column}', String(column.Header))))], !disableColumnHiding && [React__default.createElement(material.MenuItem, {
959
+ }, React__default.createElement(material.ListItemIcon, null, React__default.createElement(DynamicFeedIcon, null)), (_localization = localization[column.isGrouped ? 'ungroupByColumn' : 'groupByColumn']) == null ? void 0 : _localization.replace('{column}', String(column.Header))))], !disableColumnHiding && [React__default.createElement(material.MenuItem, {
937
960
  key: 0,
938
961
  onClick: handleHideColumn,
939
962
  sx: commonMenuItemStyles$1
940
963
  }, React__default.createElement(material.Box, {
941
964
  sx: commonListItemStyles
942
- }, React__default.createElement(VisibilityOffIcon, null), (_localization$hideCol = localization.hideColumn) == null ? void 0 : _localization$hideCol.replace('{column}', String(column.Header)))), React__default.createElement(material.MenuItem, {
965
+ }, React__default.createElement(material.ListItemIcon, null, React__default.createElement(VisibilityOffIcon, null)), (_localization$hideCol = localization.hideColumn) == null ? void 0 : _localization$hideCol.replace('{column}', String(column.Header)))), React__default.createElement(material.MenuItem, {
943
966
  disabled: !((_tableInstance$state$ = tableInstance.state.hiddenColumns) != null && _tableInstance$state$.length),
944
967
  key: 1,
945
968
  onClick: handleShowAllColumns,
946
969
  sx: commonMenuItemStyles$1
947
970
  }, React__default.createElement(material.Box, {
948
971
  sx: commonListItemStyles
949
- }, React__default.createElement(ViewColumnIcon, null), (_localization$showAll = localization.showAllColumns) == null ? void 0 : _localization$showAll.replace('{column}', String(column.Header))), !column.filterSelectOptions && React__default.createElement(material.IconButton, {
972
+ }, React__default.createElement(material.ListItemIcon, null, React__default.createElement(ViewColumnIcon, null)), (_localization$showAll = localization.showAllColumns) == null ? void 0 : _localization$showAll.replace('{column}', String(column.Header))), !column.filterSelectOptions && React__default.createElement(material.IconButton, {
950
973
  onClick: handleOpenShowHideColumnsMenu,
951
974
  onMouseEnter: handleOpenShowHideColumnsMenu,
952
975
  size: "small",
@@ -1151,7 +1174,7 @@ var MRT_EditCellTextField = function MRT_EditCellTextField(_ref) {
1151
1174
  style: _extends({}, muiTableBodyCellEditTextFieldProps == null ? void 0 : muiTableBodyCellEditTextFieldProps.style, (_cell$column$muiTable = cell.column.muiTableBodyCellEditTextFieldProps) == null ? void 0 : _cell$column$muiTable.style)
1152
1175
  });
1153
1176
 
1154
- if (cell.column.editable && cell.column.Edit) {
1177
+ if (!cell.column.disableEditing && cell.column.Edit) {
1155
1178
  return React__default.createElement(React__default.Fragment, null, cell.column.Edit(_extends({}, textFieldProps, {
1156
1179
  cell: cell
1157
1180
  })));
@@ -1212,7 +1235,7 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
1212
1235
  animation: "wave",
1213
1236
  height: 20,
1214
1237
  width: Math.random() * (120 - 60) + 60
1215
- }, muiTableBodyCellSkeletonProps)) : (currentEditingRow == null ? void 0 : currentEditingRow.id) === cell.row.id ? React__default.createElement(MRT_EditCellTextField, {
1238
+ }, muiTableBodyCellSkeletonProps)) : !cell.column.disableEditing && (currentEditingRow == null ? void 0 : currentEditingRow.id) === cell.row.id ? React__default.createElement(MRT_EditCellTextField, {
1216
1239
  cell: cell
1217
1240
  }) : cell.isPlaceholder ? null : cell.isAggregated ? cell.render('Aggregated') : cell.isGrouped ? React__default.createElement("span", null, cell.render('Cell'), " (", cell.row.subRows.length, ")") : cell.render('Cell'));
1218
1241
  };
@@ -1408,9 +1431,18 @@ var MRT_ExpandButton = function MRT_ExpandButton(_ref) {
1408
1431
  var _useMRT = useMRT(),
1409
1432
  ExpandMoreIcon = _useMRT.icons.ExpandMoreIcon,
1410
1433
  localization = _useMRT.localization,
1434
+ onRowExpandChange = _useMRT.onRowExpandChange,
1411
1435
  renderDetailPanel = _useMRT.renderDetailPanel,
1412
1436
  densePadding = _useMRT.tableInstance.state.densePadding;
1413
1437
 
1438
+ var handleToggleExpand = function handleToggleExpand(event) {
1439
+ var _row$getToggleRowExpa;
1440
+
1441
+ // @ts-ignore
1442
+ (_row$getToggleRowExpa = row.getToggleRowExpandedProps()) == null ? void 0 : _row$getToggleRowExpa.onClick(event);
1443
+ onRowExpandChange == null ? void 0 : onRowExpandChange(event, row);
1444
+ };
1445
+
1414
1446
  return React__default.createElement(material.TableCell, {
1415
1447
  size: "small",
1416
1448
  sx: _extends({}, commonTableBodyButtonCellStyles(densePadding), {
@@ -1421,7 +1453,9 @@ var MRT_ExpandButton = function MRT_ExpandButton(_ref) {
1421
1453
  "aria-label": localization.expand,
1422
1454
  disabled: !row.canExpand && !renderDetailPanel,
1423
1455
  title: localization.expand
1424
- }, row.getToggleRowExpandedProps()), React__default.createElement(ExpandMoreIcon, {
1456
+ }, row.getToggleRowExpandedProps(), {
1457
+ onClick: handleToggleExpand
1458
+ }), React__default.createElement(ExpandMoreIcon, {
1425
1459
  style: {
1426
1460
  transform: "rotate(" + (!row.canExpand && !renderDetailPanel ? -90 : row.isExpanded ? -180 : 0) + "deg)",
1427
1461
  transition: 'transform 0.2s'
@@ -1456,7 +1490,9 @@ var MRT_RowActionMenu = function MRT_RowActionMenu(_ref) {
1456
1490
  }, enableRowEditing && React__default.createElement(material.MenuItem, {
1457
1491
  onClick: handleEdit,
1458
1492
  sx: commonMenuItemStyles$1
1459
- }, React__default.createElement(EditIcon, null), localization.edit), (_renderRowActionMenuI = renderRowActionMenuItems == null ? void 0 : renderRowActionMenuItems(row, tableInstance, function () {
1493
+ }, React__default.createElement(material.Box, {
1494
+ sx: commonListItemStyles
1495
+ }, React__default.createElement(material.ListItemIcon, null, React__default.createElement(EditIcon, null)), localization.edit)), (_renderRowActionMenuI = renderRowActionMenuItems == null ? void 0 : renderRowActionMenuItems(row, tableInstance, function () {
1460
1496
  return setAnchorEl(null);
1461
1497
  })) != null ? _renderRowActionMenuI : null);
1462
1498
  };
@@ -2379,14 +2415,9 @@ var MRT_TableBodyRow = function MRT_TableBodyRow(_ref) {
2379
2415
  hover: true,
2380
2416
  onClick: function onClick(event) {
2381
2417
  return onRowClick == null ? void 0 : onRowClick(event, row);
2382
- }
2383
- }, tableRowProps, {
2384
- sx: function sx(theme) {
2385
- return _extends({
2386
- backgroundColor: row.isSelected ? material.alpha(theme.palette.primary.light, 0.1) : 'transparent'
2387
- }, tableRowProps == null ? void 0 : tableRowProps.sx);
2388
- }
2389
- }), enableRowNumbers && React__default.createElement(material.TableCell, {
2418
+ },
2419
+ selected: row.isSelected
2420
+ }, tableRowProps), enableRowNumbers && React__default.createElement(material.TableCell, {
2390
2421
  sx: _extends({}, commonTableBodyCellStyles(densePadding))
2391
2422
  }, row.index + 1), (enableRowActions || enableRowEditing) && positionActionsColumn === 'first' && React__default.createElement(MRT_ToggleRowActionMenuButton, {
2392
2423
  row: row
@@ -2420,9 +2451,7 @@ var MRT_TableBody = function MRT_TableBody() {
2420
2451
  });
2421
2452
 
2422
2453
  return React__default.createElement(material.TableBody, Object.assign({}, tableBodyProps, {
2423
- sx: _extends({
2424
- overflowY: 'hidden'
2425
- }, tableBodyProps == null ? void 0 : tableBodyProps.sx)
2454
+ sx: _extends({}, tableBodyProps == null ? void 0 : tableBodyProps.sx)
2426
2455
  }), rows.map(function (row) {
2427
2456
  tableInstance.prepareRow(row);
2428
2457
  return React__default.createElement(MRT_TableBodyRow, {
@@ -2782,7 +2811,7 @@ var MRT_TablePagination = function MRT_TablePagination() {
2782
2811
  showLastButton: tableInstance.rows.length / tableInstance.state.pageSize > 2
2783
2812
  }, tablePaginationProps, {
2784
2813
  sx: _extends({
2785
- p: 0,
2814
+ m: '0 0.5rem',
2786
2815
  position: 'relative',
2787
2816
  zIndex: 2
2788
2817
  }, tablePaginationProps == null ? void 0 : tablePaginationProps.sx)
@@ -2844,6 +2873,34 @@ var MRT_ToolbarAlertBanner = function MRT_ToolbarAlertBanner() {
2844
2873
  }, selectMessage, groupedByMessage)));
2845
2874
  };
2846
2875
 
2876
+ var MRT_LinearProgressBar = function MRT_LinearProgressBar() {
2877
+ var _useMRT = useMRT(),
2878
+ muiLinearProgressProps = _useMRT.muiLinearProgressProps,
2879
+ isFetching = _useMRT.isFetching,
2880
+ isLoading = _useMRT.isLoading,
2881
+ tableInstance = _useMRT.tableInstance;
2882
+
2883
+ var linearProgressProps = muiLinearProgressProps instanceof Function ? muiLinearProgressProps(tableInstance) : muiLinearProgressProps;
2884
+ return React__default.createElement(material.Collapse, {
2885
+ "in": isFetching || isLoading,
2886
+ unmountOnExit: true
2887
+ }, React__default.createElement(material.LinearProgress, Object.assign({
2888
+ "aria-label": "Loading",
2889
+ "aria-busy": "true"
2890
+ }, linearProgressProps)));
2891
+ };
2892
+
2893
+ var commonToolbarStyles = function commonToolbarStyles(theme, tableInstance) {
2894
+ return {
2895
+ backgroundColor: theme.palette.background["default"],
2896
+ backgroundImage: "linear-gradient(" + material.alpha(theme.palette.common.white, 0.05) + "," + material.alpha(theme.palette.common.white, 0.05) + ")",
2897
+ display: 'grid',
2898
+ opacity: tableInstance.state.fullScreen ? 0.95 : 1,
2899
+ p: '0 !important',
2900
+ width: '100%',
2901
+ zIndex: 1
2902
+ };
2903
+ };
2847
2904
  var MRT_ToolbarTop = function MRT_ToolbarTop() {
2848
2905
  var _renderToolbarCustomA;
2849
2906
 
@@ -2864,15 +2921,9 @@ var MRT_ToolbarTop = function MRT_ToolbarTop() {
2864
2921
  }, toolbarProps, {
2865
2922
  sx: function sx(theme) {
2866
2923
  return _extends({
2867
- backgroundColor: theme.palette.background["default"],
2868
- backgroundImage: "linear-gradient(" + material.alpha(theme.palette.common.white, 0.05) + "," + material.alpha(theme.palette.common.white, 0.05) + ")",
2869
- display: 'grid',
2870
- p: '0 !important',
2871
2924
  position: tableInstance.state.fullScreen ? 'sticky' : undefined,
2872
- top: tableInstance.state.fullScreen ? '0' : undefined,
2873
- width: '100%',
2874
- zIndex: 1
2875
- }, toolbarProps == null ? void 0 : toolbarProps.sx);
2925
+ top: tableInstance.state.fullScreen ? '0' : undefined
2926
+ }, commonToolbarStyles(theme, tableInstance), toolbarProps == null ? void 0 : toolbarProps.sx);
2876
2927
  }
2877
2928
  }), positionToolbarAlertBanner === 'top' && React__default.createElement(MRT_ToolbarAlertBanner, null), React__default.createElement(material.Box, {
2878
2929
  sx: {
@@ -2887,7 +2938,7 @@ var MRT_ToolbarTop = function MRT_ToolbarTop() {
2887
2938
  position: 'relative',
2888
2939
  zIndex: 3
2889
2940
  }
2890
- }, !disableGlobalFilter && React__default.createElement(MRT_SearchTextField, null), !hideToolbarInternalActions && positionToolbarActions === 'top' && React__default.createElement(MRT_ToolbarInternalButtons, null))), React__default.createElement("div", null, !manualPagination && ['top', 'both'].includes(positionPagination != null ? positionPagination : '') && React__default.createElement(MRT_TablePagination, null)));
2941
+ }, !disableGlobalFilter && React__default.createElement(MRT_SearchTextField, null), !hideToolbarInternalActions && positionToolbarActions === 'top' && React__default.createElement(MRT_ToolbarInternalButtons, null))), React__default.createElement("div", null, !manualPagination && ['top', 'both'].includes(positionPagination != null ? positionPagination : '') && React__default.createElement(MRT_TablePagination, null)), React__default.createElement(MRT_LinearProgressBar, null));
2891
2942
  };
2892
2943
 
2893
2944
  var MRT_ToolbarBottom = function MRT_ToolbarBottom() {
@@ -2906,53 +2957,37 @@ var MRT_ToolbarBottom = function MRT_ToolbarBottom() {
2906
2957
  }, toolbarProps, {
2907
2958
  sx: function sx(theme) {
2908
2959
  return _extends({
2909
- backgroundColor: theme.palette.background["default"],
2910
- backgroundImage: "linear-gradient(" + material.alpha(theme.palette.common.white, 0.05) + "," + material.alpha(theme.palette.common.white, 0.05) + ")",
2911
2960
  bottom: tableInstance.state.fullScreen ? '0' : undefined,
2912
- display: 'flex',
2913
- justifyContent: 'space-between',
2914
- overflowY: 'hidden',
2915
- p: '0 0.5rem !important',
2916
- position: tableInstance.state.fullScreen ? 'fixed' : undefined,
2917
- width: 'calc(100% - 1rem)',
2918
- zIndex: 1
2919
- }, toolbarProps == null ? void 0 : toolbarProps.sx);
2961
+ position: tableInstance.state.fullScreen ? 'fixed' : undefined
2962
+ }, commonToolbarStyles(theme, tableInstance), toolbarProps == null ? void 0 : toolbarProps.sx);
2963
+ }
2964
+ }), React__default.createElement(MRT_LinearProgressBar, null), React__default.createElement(material.Box, {
2965
+ sx: {
2966
+ display: 'flex',
2967
+ justifyContent: 'space-between',
2968
+ width: '100%'
2920
2969
  }
2921
- }), !hideToolbarInternalActions && positionToolbarActions === 'bottom' ? React__default.createElement(MRT_ToolbarInternalButtons, null) : React__default.createElement("span", null), positionToolbarAlertBanner === 'bottom' && React__default.createElement(MRT_ToolbarAlertBanner, null), !manualPagination && ['bottom', 'both'].includes(positionPagination != null ? positionPagination : '') && React__default.createElement(MRT_TablePagination, null));
2970
+ }, !hideToolbarInternalActions && positionToolbarActions === 'bottom' ? React__default.createElement(MRT_ToolbarInternalButtons, null) : React__default.createElement("span", null), positionToolbarAlertBanner === 'bottom' && React__default.createElement(MRT_ToolbarAlertBanner, null), !manualPagination && ['bottom', 'both'].includes(positionPagination != null ? positionPagination : '') && React__default.createElement(MRT_TablePagination, null)));
2922
2971
  };
2923
2972
 
2924
2973
  var MRT_TableContainer = function MRT_TableContainer() {
2925
2974
  var _useMRT = useMRT(),
2926
2975
  hideToolbarBottom = _useMRT.hideToolbarBottom,
2927
2976
  hideToolbarTop = _useMRT.hideToolbarTop,
2928
- isFetching = _useMRT.isFetching,
2929
- isLoading = _useMRT.isLoading,
2930
- muiLinearProgressProps = _useMRT.muiLinearProgressProps,
2931
2977
  muiTableContainerProps = _useMRT.muiTableContainerProps,
2932
2978
  tableInstance = _useMRT.tableInstance;
2933
2979
 
2934
2980
  var fullScreen = tableInstance.state.fullScreen;
2935
- var originalBodyOverflowStyle = React.useRef();
2936
- React.useEffect(function () {
2937
- if (typeof window !== 'undefined') {
2938
- var _document, _document$body, _document$body$style;
2939
-
2940
- 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;
2941
- }
2942
- }, []);
2943
2981
  React.useEffect(function () {
2944
2982
  if (typeof window !== 'undefined') {
2945
2983
  if (fullScreen) {
2946
2984
  document.body.style.overflow = 'hidden';
2947
2985
  } else {
2948
- var _originalBodyOverflow;
2949
-
2950
- document.body.style.overflow = (_originalBodyOverflow = originalBodyOverflowStyle.current) != null ? _originalBodyOverflow : 'auto';
2986
+ document.body.style.overflow = 'auto';
2951
2987
  }
2952
2988
  }
2953
2989
  }, [fullScreen]);
2954
2990
  var tableContainerProps = muiTableContainerProps instanceof Function ? muiTableContainerProps(tableInstance) : muiTableContainerProps;
2955
- var linearProgressProps = muiLinearProgressProps instanceof Function ? muiLinearProgressProps(tableInstance) : muiLinearProgressProps;
2956
2991
  return React__default.createElement(material.TableContainer, Object.assign({
2957
2992
  component: material.Paper
2958
2993
  }, tableContainerProps, {
@@ -2961,6 +2996,7 @@ var MRT_TableContainer = function MRT_TableContainer() {
2961
2996
  height: fullScreen ? '100%' : undefined,
2962
2997
  left: fullScreen ? '0' : undefined,
2963
2998
  m: fullScreen ? '0' : undefined,
2999
+ overflowY: !fullScreen ? 'hidden' : undefined,
2964
3000
  position: fullScreen ? 'fixed' : undefined,
2965
3001
  right: fullScreen ? '0' : undefined,
2966
3002
  top: fullScreen ? '0' : undefined,
@@ -2968,10 +3004,7 @@ var MRT_TableContainer = function MRT_TableContainer() {
2968
3004
  width: fullScreen ? '100vw' : undefined,
2969
3005
  zIndex: fullScreen ? 1200 : 1
2970
3006
  }, tableContainerProps == null ? void 0 : tableContainerProps.sx)
2971
- }), !hideToolbarTop && React__default.createElement(MRT_ToolbarTop, null), React__default.createElement(material.Collapse, {
2972
- "in": isFetching || isLoading,
2973
- unmountOnExit: true
2974
- }, React__default.createElement(material.LinearProgress, Object.assign({}, linearProgressProps))), React__default.createElement(material.Box, {
3007
+ }), !hideToolbarTop && React__default.createElement(MRT_ToolbarTop, null), React__default.createElement(material.Box, {
2975
3008
  sx: {
2976
3009
  maxWidth: '100%',
2977
3010
  overflowX: 'auto'
@@ -3076,10 +3109,13 @@ var MaterialReactTable = (function (_ref) {
3076
3109
  positionToolbarAlertBanner = _ref$positionToolbarA2 === void 0 ? 'top' : _ref$positionToolbarA2,
3077
3110
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
3078
3111
 
3079
- return React__default.createElement(MaterialReactTableProvider, Object.assign({
3112
+ return React__default.createElement(MaterialReactTableProvider //@ts-ignore
3113
+ , Object.assign({
3114
+ //@ts-ignore
3080
3115
  defaultColumn: defaultColumn,
3081
- // @ts-ignore
3116
+ //@ts-ignore
3082
3117
  filterTypes: _extends({}, defaultFilterFNs, filterTypes),
3118
+ //@ts-ignore
3083
3119
  globalFilter: globalFilter,
3084
3120
  icons: _extends({}, MRT_Default_Icons, icons),
3085
3121
  localization: _extends({}, MRT_DefaultLocalization_EN, localization),