material-react-table 1.0.0-beta.1 → 1.0.0-beta.10

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 (105) hide show
  1. package/README.md +20 -20
  2. package/dist/cjs/MaterialReactTable.d.ts +96 -19
  3. package/dist/cjs/_locales/en.d.ts +2 -0
  4. package/dist/cjs/_locales/es.d.ts +2 -0
  5. package/dist/cjs/body/MRT_EditRowModal.d.ts +0 -1
  6. package/dist/cjs/body/MRT_TableBody.d.ts +1 -2
  7. package/dist/cjs/body/MRT_TableBodyCellValue.d.ts +2 -2
  8. package/dist/cjs/buttons/MRT_ColumnPinningButtons.d.ts +0 -1
  9. package/dist/cjs/buttons/MRT_EditActionButtons.d.ts +0 -1
  10. package/dist/cjs/buttons/MRT_FullScreenToggleButton.d.ts +0 -1
  11. package/dist/cjs/buttons/MRT_ShowHideColumnsButton.d.ts +0 -1
  12. package/dist/cjs/buttons/MRT_ToggleDensePaddingButton.d.ts +0 -1
  13. package/dist/cjs/buttons/MRT_ToggleFiltersButton.d.ts +0 -1
  14. package/dist/cjs/buttons/MRT_ToggleGlobalFilterButton.d.ts +0 -1
  15. package/dist/cjs/column.utils.d.ts +12 -1
  16. package/dist/cjs/index.d.ts +4 -3
  17. package/dist/cjs/index.js +235 -192
  18. package/dist/cjs/index.js.map +1 -1
  19. package/dist/cjs/inputs/MRT_EditCellTextField.d.ts +0 -1
  20. package/dist/cjs/inputs/MRT_GlobalFilterTextField.d.ts +0 -1
  21. package/dist/cjs/menus/MRT_FilterOptionMenu.d.ts +3 -4
  22. package/dist/cjs/menus/MRT_ShowHideColumnsMenu.d.ts +0 -1
  23. package/dist/cjs/table/MRT_Table.d.ts +1 -2
  24. package/dist/cjs/table/MRT_TableRoot.d.ts +250 -3
  25. package/dist/cjs/toolbar/MRT_TablePagination.d.ts +3 -4
  26. package/dist/cjs/toolbar/MRT_ToolbarAlertBanner.d.ts +1 -1
  27. package/dist/cjs/toolbar/MRT_ToolbarInternalButtons.d.ts +3 -4
  28. package/dist/cjs/toolbar/MRT_TopToolbar.d.ts +1 -0
  29. package/dist/en.cjs +90 -0
  30. package/dist/en.cjs.d.ts +2 -0
  31. package/dist/en.cjs.map +1 -0
  32. package/dist/en.esm.d.ts +2 -0
  33. package/dist/en.esm.js +86 -0
  34. package/dist/en.esm.js.map +1 -0
  35. package/dist/esm/MaterialReactTable.d.ts +96 -19
  36. package/dist/esm/_locales/en.d.ts +2 -0
  37. package/dist/esm/_locales/es.d.ts +2 -0
  38. package/dist/esm/body/MRT_EditRowModal.d.ts +0 -1
  39. package/dist/esm/body/MRT_TableBody.d.ts +1 -2
  40. package/dist/esm/body/MRT_TableBodyCellValue.d.ts +2 -2
  41. package/dist/esm/buttons/MRT_ColumnPinningButtons.d.ts +0 -1
  42. package/dist/esm/buttons/MRT_EditActionButtons.d.ts +0 -1
  43. package/dist/esm/buttons/MRT_FullScreenToggleButton.d.ts +0 -1
  44. package/dist/esm/buttons/MRT_ShowHideColumnsButton.d.ts +0 -1
  45. package/dist/esm/buttons/MRT_ToggleDensePaddingButton.d.ts +0 -1
  46. package/dist/esm/buttons/MRT_ToggleFiltersButton.d.ts +0 -1
  47. package/dist/esm/buttons/MRT_ToggleGlobalFilterButton.d.ts +0 -1
  48. package/dist/esm/column.utils.d.ts +12 -1
  49. package/dist/esm/index.d.ts +4 -3
  50. package/dist/esm/inputs/MRT_EditCellTextField.d.ts +0 -1
  51. package/dist/esm/inputs/MRT_GlobalFilterTextField.d.ts +0 -1
  52. package/dist/esm/material-react-table.esm.js +236 -195
  53. package/dist/esm/material-react-table.esm.js.map +1 -1
  54. package/dist/esm/menus/MRT_FilterOptionMenu.d.ts +3 -4
  55. package/dist/esm/menus/MRT_ShowHideColumnsMenu.d.ts +0 -1
  56. package/dist/esm/table/MRT_Table.d.ts +1 -2
  57. package/dist/esm/table/MRT_TableRoot.d.ts +250 -3
  58. package/dist/esm/toolbar/MRT_TablePagination.d.ts +3 -4
  59. package/dist/esm/toolbar/MRT_ToolbarAlertBanner.d.ts +1 -1
  60. package/dist/esm/toolbar/MRT_ToolbarInternalButtons.d.ts +3 -4
  61. package/dist/esm/toolbar/MRT_TopToolbar.d.ts +1 -0
  62. package/dist/index.d.ts +47 -41
  63. package/package.json +7 -6
  64. package/src/MaterialReactTable.tsx +100 -23
  65. package/src/_locales/de.ts +0 -0
  66. package/src/{localization.ts → _locales/en.ts} +4 -82
  67. package/src/_locales/es.ts +86 -0
  68. package/src/_locales/fr.ts +0 -0
  69. package/src/_locales/hi.ts +0 -0
  70. package/src/_locales/id.ts +0 -0
  71. package/src/_locales/ja.ts +0 -0
  72. package/src/_locales/nl.ts +0 -0
  73. package/src/_locales/pt.ts +0 -0
  74. package/src/_locales/ru.ts +0 -0
  75. package/src/_locales/uk.ts +0 -0
  76. package/src/_locales/vi.ts +0 -0
  77. package/src/_locales/zh.ts +0 -0
  78. package/src/body/MRT_TableBody.tsx +54 -30
  79. package/src/body/MRT_TableBodyCell.tsx +11 -58
  80. package/src/body/MRT_TableBodyCellValue.tsx +7 -2
  81. package/src/body/MRT_TableBodyRowGrabHandle.tsx +5 -8
  82. package/src/buttons/MRT_GrabHandleButton.tsx +2 -2
  83. package/src/buttons/MRT_ToggleGlobalFilterButton.tsx +7 -2
  84. package/src/column.utils.ts +72 -0
  85. package/src/footer/MRT_TableFooter.tsx +3 -2
  86. package/src/footer/MRT_TableFooterCell.tsx +5 -15
  87. package/src/head/MRT_TableHead.tsx +10 -2
  88. package/src/head/MRT_TableHeadCell.tsx +9 -50
  89. package/src/head/MRT_TableHeadCellFilterLabel.tsx +7 -7
  90. package/src/head/MRT_TableHeadCellGrabHandle.tsx +5 -12
  91. package/src/index.tsx +6 -3
  92. package/src/inputs/MRT_FilterTextField.tsx +7 -6
  93. package/src/inputs/MRT_GlobalFilterTextField.tsx +1 -0
  94. package/src/menus/MRT_FilterOptionMenu.tsx +19 -2
  95. package/src/table/MRT_Table.tsx +3 -4
  96. package/src/table/MRT_TableContainer.tsx +2 -11
  97. package/src/table/MRT_TablePaper.tsx +34 -20
  98. package/src/table/MRT_TableRoot.tsx +34 -11
  99. package/src/toolbar/MRT_BottomToolbar.tsx +9 -3
  100. package/src/toolbar/MRT_TablePagination.tsx +8 -5
  101. package/src/toolbar/MRT_ToolbarAlertBanner.tsx +7 -1
  102. package/src/toolbar/MRT_ToolbarInternalButtons.tsx +8 -4
  103. package/src/toolbar/MRT_TopToolbar.tsx +8 -1
  104. package/dist/cjs/localization.d.ts +0 -82
  105. package/dist/esm/localization.d.ts +0 -82
@@ -1,8 +1,8 @@
1
- import React, { useMemo, useRef, useState, useCallback, Fragment, useEffect, useLayoutEffect } from 'react';
1
+ import React, { useMemo, useRef, useState, useCallback, Fragment, memo, useEffect, useLayoutEffect } from 'react';
2
2
  import { aggregationFns, filterFns, sortingFns, useReactTable, getCoreRowModel, getExpandedRowModel, getFacetedRowModel, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel } from '@tanstack/react-table';
3
3
  import { ArrowRight, Cancel, CheckBox, ClearAll, Close, DensityLarge, DensityMedium, DensitySmall, DragHandle, DynamicFeed, Edit, ExpandLess, ExpandMore, FilterAlt, FilterAltOff, FilterList, FilterListOff, FullscreenExit, Fullscreen, KeyboardDoubleArrowDown, MoreHoriz, MoreVert, PushPin, RestartAlt, Save, Search, SearchOff, Sort, ViewColumn, VisibilityOff } from '@mui/icons-material';
4
4
  import { rankItem, rankings, compareItems } from '@tanstack/match-sorter-utils';
5
- import { Tooltip, IconButton, Menu, MenuItem, Box, FormControlLabel, Switch, Typography, Button, Divider, ListItemIcon, Checkbox, debounce, Collapse, TextField, InputAdornment, LinearProgress, TablePagination, Chip, Alert, AlertTitle, Fade, alpha, useMediaQuery, Toolbar, lighten, Grow, TableSortLabel, useTheme, TableCell, TableRow, TableHead, darken, Skeleton, TableBody, TableFooter, Table, TableContainer, Paper, Dialog, DialogTitle, DialogContent, Stack, DialogActions } from '@mui/material';
5
+ import { Tooltip, IconButton, Menu, MenuItem, Box, alpha, lighten, FormControlLabel, Switch, Typography, Button, Divider, ListItemIcon, Checkbox, debounce, Collapse, TextField, InputAdornment, LinearProgress, TablePagination, Chip, Alert, AlertTitle, Fade, useMediaQuery, Toolbar, Grow, TableSortLabel, useTheme, TableCell, TableRow, TableHead, darken, Skeleton, TableBody, TableFooter, Table, TableContainer, Paper, Dialog, DialogTitle, DialogContent, Stack, DialogActions } from '@mui/material';
6
6
  import { useVirtual } from 'react-virtual';
7
7
 
8
8
  /******************************************************************************
@@ -151,7 +151,7 @@ const MRT_FilterFns = Object.assign(Object.assign({}, filterFns), { between,
151
151
  notEquals,
152
152
  startsWith });
153
153
 
154
- const MRT_DefaultLocalization_EN = {
154
+ const MRT_Localization_EN = {
155
155
  actions: 'Actions',
156
156
  and: 'and',
157
157
  cancel: 'Cancel',
@@ -200,6 +200,8 @@ const MRT_DefaultLocalization_EN = {
200
200
  max: 'Max',
201
201
  min: 'Min',
202
202
  move: 'Move',
203
+ noRecordsToDisplay: 'No records to display',
204
+ noResultsFound: 'No results found',
203
205
  or: 'or',
204
206
  pinToLeft: 'Pin to left',
205
207
  pinToRight: 'Pin to right',
@@ -383,7 +385,7 @@ const mrtFilterOptions = (localization) => [
383
385
  divider: false,
384
386
  },
385
387
  ];
386
- const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, table, }) => {
388
+ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilterValue, table, }) => {
387
389
  var _a, _b, _c, _d;
388
390
  const { getState, options: { columnFilterModeOptions, globalFilterModeOptions, localization, renderColumnFilterModeMenuItems, renderGlobalFilterModeMenuItems, }, setColumnFilterFns, setGlobalFilterFn, } = table;
389
391
  const { globalFilterFn, density } = getState();
@@ -402,11 +404,19 @@ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, table,
402
404
  if (['empty', 'notEmpty'].includes(option)) {
403
405
  column.setFilterValue(' ');
404
406
  }
405
- else if (option === 'between') {
407
+ else if ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant) === 'multi-select' ||
408
+ ['arrIncludesSome', 'arrIncludesAll', 'arrIncludes'].includes(option)) {
409
+ column.setFilterValue([]);
410
+ setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue([]);
411
+ }
412
+ else if ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant) === 'range' ||
413
+ ['between', 'betweenInclusive', 'inNumberRange'].includes(option)) {
406
414
  column.setFilterValue(['', '']);
415
+ setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue('');
407
416
  }
408
417
  else {
409
418
  column.setFilterValue('');
419
+ setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue('');
410
420
  }
411
421
  }
412
422
  else {
@@ -469,11 +479,11 @@ const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table,
469
479
  var _a;
470
480
  const { options: { icons: { DragHandleIcon }, localization, }, } = table;
471
481
  return (React.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : localization.move },
472
- React.createElement(IconButton, Object.assign({ disableRipple: true, draggable: "true", onDragStart: onDragStart, onDragEnd: onDragEnd, size: "small" }, iconButtonProps, { onClick: (e) => {
482
+ React.createElement(IconButton, Object.assign({ disableRipple: true, draggable: "true", size: "small" }, iconButtonProps, { onClick: (e) => {
473
483
  var _a;
474
484
  e.stopPropagation();
475
485
  (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, e);
476
- }, sx: (theme) => (Object.assign({ cursor: 'grab', m: 0, opacity: 0.5, p: '2px', transition: 'all 0.2s ease-in-out', '&:hover': {
486
+ }, onDragStart: onDragStart, onDragEnd: onDragEnd, sx: (theme) => (Object.assign({ cursor: 'grab', m: 0, opacity: 0.5, p: '2px', transition: 'all 0.2s ease-in-out', '&:hover': {
477
487
  backgroundColor: 'transparent',
478
488
  opacity: 1,
479
489
  }, '&:active': {
@@ -587,6 +597,37 @@ const getDefaultColumnFilterFn = (columnDef) => {
587
597
  return 'betweenInclusive';
588
598
  return 'fuzzy';
589
599
  };
600
+ const getIsLastLeftPinnedColumn = (table, column) => {
601
+ return (column.getIsPinned() === 'left' &&
602
+ table.getLeftLeafHeaders().length - 1 === column.getPinnedIndex());
603
+ };
604
+ const getIsFirstRightPinnedColumn = (column) => {
605
+ return column.getIsPinned() === 'right' && column.getPinnedIndex() === 0;
606
+ };
607
+ const getTotalRight = (table, column) => {
608
+ return ((table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 160);
609
+ };
610
+ const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
611
+ var _a, _b, _c, _d;
612
+ return (Object.assign(Object.assign({ backgroundColor: column.getIsPinned() && column.columnDef.columnDefType !== 'group'
613
+ ? alpha(lighten(theme.palette.background.default, 0.04), 0.95)
614
+ : 'inherit', backgroundImage: 'inherit', boxShadow: getIsLastLeftPinnedColumn(table, column)
615
+ ? `-4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
616
+ : getIsFirstRightPinnedColumn(column)
617
+ ? `4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
618
+ : undefined, left: column.getIsPinned() === 'left'
619
+ ? `${column.getStart('left')}px`
620
+ : undefined, opacity: ((_a = table.getState().draggingColumn) === null || _a === void 0 ? void 0 : _a.id) === column.id ||
621
+ ((_b = table.getState().hoveredColumn) === null || _b === void 0 ? void 0 : _b.id) === column.id
622
+ ? 0.5
623
+ : 1, position: column.getIsPinned() && column.columnDef.columnDefType !== 'group'
624
+ ? 'sticky'
625
+ : undefined, right: column.getIsPinned() === 'right'
626
+ ? `${getTotalRight(table, column)}px`
627
+ : undefined, transition: `all ${column.getIsResizing() ? 0 : '0.2s'} ease-in-out` }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
628
+ ? tableCellProps.sx(theme)
629
+ : tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), { maxWidth: `min(${column.getSize()}px, fit-content)`, minWidth: `max(${column.getSize()}px, ${(_c = column.columnDef.minSize) !== null && _c !== void 0 ? _c : 30}px)`, width: (_d = header === null || header === void 0 ? void 0 : header.getSize()) !== null && _d !== void 0 ? _d : column.getSize() }));
630
+ };
590
631
 
591
632
  const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredColumn, column, isSubMenu, table, }) => {
592
633
  var _a;
@@ -1039,7 +1080,7 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
1039
1080
  textFieldProps.inputRef = inputRef;
1040
1081
  }
1041
1082
  } })),
1042
- React.createElement(MRT_FilterOptionMenu, { anchorEl: anchorEl, setAnchorEl: setAnchorEl, table: table })));
1083
+ React.createElement(MRT_FilterOptionMenu, { anchorEl: anchorEl, setAnchorEl: setAnchorEl, table: table, onSelect: handleClear })));
1043
1084
  };
1044
1085
 
1045
1086
  const MRT_LinearProgressBar = ({ isTopToolbar, table }) => {
@@ -1057,7 +1098,7 @@ const MRT_LinearProgressBar = ({ isTopToolbar, table }) => {
1057
1098
  React.createElement(LinearProgress, Object.assign({ "aria-label": "Loading", "aria-busy": "true", sx: { position: 'relative' } }, linearProgressProps))));
1058
1099
  };
1059
1100
 
1060
- const MRT_TablePagination = ({ table, position }) => {
1101
+ const MRT_TablePagination = ({ table, position, }) => {
1061
1102
  const { getPrePaginationRowModel, getState, setPageIndex, setPageSize, options: { muiTablePaginationProps, enableToolbarInternalActions, rowCount, }, } = table;
1062
1103
  const { pagination: { pageSize = 10, pageIndex = 0 }, showGlobalFilter, } = getState();
1063
1104
  const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
@@ -1075,14 +1116,14 @@ const MRT_TablePagination = ({ table, position }) => {
1075
1116
  enableToolbarInternalActions &&
1076
1117
  !showGlobalFilter
1077
1118
  ? '3.5rem'
1078
- : '-0.25rem', position: 'relative', zIndex: 2 }, ((tablePaginationProps === null || tablePaginationProps === void 0 ? void 0 : tablePaginationProps.sx) instanceof Function
1119
+ : undefined, position: 'relative', zIndex: 2 }, ((tablePaginationProps === null || tablePaginationProps === void 0 ? void 0 : tablePaginationProps.sx) instanceof Function
1079
1120
  ? tablePaginationProps.sx(theme)
1080
1121
  : tablePaginationProps === null || tablePaginationProps === void 0 ? void 0 : tablePaginationProps.sx))) })));
1081
1122
  };
1082
1123
 
1083
1124
  const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
1084
1125
  var _a, _b;
1085
- const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { localization, muiToolbarAlertBannerProps, muiToolbarAlertBannerChipProps, }, } = table;
1126
+ const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { localization, muiToolbarAlertBannerProps, muiToolbarAlertBannerChipProps, positionToolbarAlertBanner, }, } = table;
1086
1127
  const { grouping, showAlertBanner } = getState();
1087
1128
  const alertProps = muiToolbarAlertBannerProps instanceof Function
1088
1129
  ? muiToolbarAlertBannerProps({ table })
@@ -1100,7 +1141,11 @@ const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
1100
1141
  index > 0 ? localization.thenBy : '',
1101
1142
  React.createElement(Chip, Object.assign({ label: table.getColumn(columnId).columnDef.header, onDelete: () => table.getColumn(columnId).toggleGrouping() }, chipProps))))))) : null;
1102
1143
  return (React.createElement(Collapse, { in: showAlertBanner || !!selectMessage || !!groupedByMessage, timeout: stackAlertBanner ? 200 : 0 },
1103
- React.createElement(Alert, Object.assign({ color: "info", icon: false }, alertProps, { sx: (theme) => (Object.assign({ borderRadius: 0, fontSize: '1rem', left: 0, p: 0, position: 'relative', right: 0, top: 0, width: '100%', zIndex: 2 }, ((alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx) instanceof Function
1144
+ React.createElement(Alert, Object.assign({ color: "info", icon: false }, alertProps, { sx: (theme) => (Object.assign({ borderRadius: 0, fontSize: '1rem', left: 0, p: 0, position: 'relative', mb: stackAlertBanner
1145
+ ? 0
1146
+ : positionToolbarAlertBanner === 'bottom'
1147
+ ? '-1rem'
1148
+ : undefined, right: 0, top: 0, width: '100%', zIndex: 2 }, ((alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx) instanceof Function
1104
1149
  ? alertProps.sx(theme)
1105
1150
  : alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx))) }),
1106
1151
  (alertProps === null || alertProps === void 0 ? void 0 : alertProps.title) && React.createElement(AlertTitle, null, alertProps.title),
@@ -1172,16 +1217,16 @@ const MRT_ToggleGlobalFilterButton = (_a) => {
1172
1217
  var _b;
1173
1218
  var { table } = _a, rest = __rest(_a, ["table"]);
1174
1219
  const { getState, options: { icons: { SearchIcon, SearchOffIcon }, localization, }, refs: { searchInputRef }, setShowGlobalFilter, } = table;
1175
- const { showGlobalFilter } = getState();
1220
+ const { globalFilter, showGlobalFilter } = getState();
1176
1221
  const handleToggleSearch = () => {
1177
1222
  setShowGlobalFilter(!showGlobalFilter);
1178
1223
  queueMicrotask(() => { var _a; return (_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); });
1179
1224
  };
1180
1225
  return (React.createElement(Tooltip, { arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.showHideSearch },
1181
- React.createElement(IconButton, Object.assign({ onClick: handleToggleSearch }, rest, { title: undefined }), showGlobalFilter ? React.createElement(SearchOffIcon, null) : React.createElement(SearchIcon, null))));
1226
+ React.createElement(IconButton, Object.assign({ disabled: !!globalFilter, onClick: handleToggleSearch }, rest, { title: undefined }), showGlobalFilter ? React.createElement(SearchOffIcon, null) : React.createElement(SearchIcon, null))));
1182
1227
  };
1183
1228
 
1184
- const MRT_ToolbarInternalButtons = ({ table }) => {
1229
+ const MRT_ToolbarInternalButtons = ({ table, }) => {
1185
1230
  var _a;
1186
1231
  const { options: { enableColumnFilters, enableColumnOrdering, enableDensityToggle, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, enablePinning, initialState, renderToolbarInternalActions, }, } = table;
1187
1232
  return (React.createElement(Box, { sx: {
@@ -1229,6 +1274,7 @@ const commonToolbarStyles = ({ theme }) => ({
1229
1274
  backgroundColor: lighten(theme.palette.background.default, 0.04),
1230
1275
  backgroundImage: 'none',
1231
1276
  display: 'grid',
1277
+ flexWrap: 'wrap-reverse',
1232
1278
  minHeight: '3.5rem',
1233
1279
  overflow: 'hidden',
1234
1280
  p: '0 !important',
@@ -1267,7 +1313,11 @@ const MRT_TopToolbar = ({ table }) => {
1267
1313
  width: '100%',
1268
1314
  } },
1269
1315
  enableGlobalFilter && positionGlobalFilter === 'left' && (React.createElement(MRT_GlobalFilterTextField, { table: table })), (_a = renderTopToolbarCustomActions === null || renderTopToolbarCustomActions === void 0 ? void 0 : renderTopToolbarCustomActions({ table })) !== null && _a !== void 0 ? _a : React.createElement("span", null),
1270
- enableToolbarInternalActions ? (React.createElement(Box, { sx: { display: 'flex', flexWrap: 'wrap' } },
1316
+ enableToolbarInternalActions ? (React.createElement(Box, { sx: {
1317
+ display: 'flex',
1318
+ flexWrap: 'wrap-reverse',
1319
+ justifyContent: 'flex-end',
1320
+ } },
1271
1321
  enableGlobalFilter && positionGlobalFilter === 'right' && (React.createElement(MRT_GlobalFilterTextField, { table: table })),
1272
1322
  React.createElement(MRT_ToolbarInternalButtons, { table: table }))) : (enableGlobalFilter &&
1273
1323
  positionGlobalFilter === 'right' && (React.createElement(MRT_GlobalFilterTextField, { table: table })))),
@@ -1290,14 +1340,14 @@ const MRT_BottomToolbar = ({ table }) => {
1290
1340
  // @ts-ignore
1291
1341
  toolbarProps.ref.current = ref;
1292
1342
  }
1293
- }, sx: (theme) => (Object.assign(Object.assign(Object.assign({}, commonToolbarStyles({ theme })), { bottom: isFullScreen ? '0' : undefined, boxShadow: `-3px 0 6px ${alpha(theme.palette.common.black, 0.1)}`, left: 0, position: isFullScreen ? 'fixed' : 'relative', right: 0 }), ((toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx) instanceof Function
1343
+ }, sx: (theme) => (Object.assign(Object.assign(Object.assign({}, commonToolbarStyles({ theme })), { bottom: isFullScreen ? '0' : undefined, boxShadow: `0 1px 2px -1px ${alpha(theme.palette.common.black, 0.1)} inset`, left: 0, position: isFullScreen ? 'fixed' : 'relative', right: 0 }), ((toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx) instanceof Function
1294
1344
  ? toolbarProps.sx(theme)
1295
1345
  : toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx))) }),
1296
1346
  React.createElement(MRT_LinearProgressBar, { isTopToolbar: false, table: table }),
1297
- positionToolbarAlertBanner === 'bottom' && (React.createElement(MRT_ToolbarAlertBanner, { table: table })),
1347
+ positionToolbarAlertBanner === 'bottom' && (React.createElement(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })),
1298
1348
  ['both', 'bottom'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (React.createElement(MRT_ToolbarDropZone, { table: table })),
1299
1349
  React.createElement(Box, { sx: {
1300
- alignItems: 'flex-start',
1350
+ alignItems: 'center',
1301
1351
  boxSizing: 'border-box',
1302
1352
  display: 'flex',
1303
1353
  justifyContent: 'space-between',
@@ -1445,9 +1495,6 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
1445
1495
  const handleFilterMenuOpen = (event) => {
1446
1496
  setAnchorEl(event.currentTarget);
1447
1497
  };
1448
- useEffect(() => {
1449
- handleClear();
1450
- }, [columnDef._filterFn]);
1451
1498
  if (columnDef.Filter) {
1452
1499
  return React.createElement(React.Fragment, null, (_e = columnDef.Filter) === null || _e === void 0 ? void 0 : _e.call(columnDef, { column, header, table }));
1453
1500
  }
@@ -1505,7 +1552,11 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
1505
1552
  if (textFieldProps.inputRef) {
1506
1553
  textFieldProps.inputRef = inputRef;
1507
1554
  }
1508
- }, sx: (theme) => (Object.assign({ p: 0, minWidth: !filterChipLabel ? '120px' : 'auto', width: '100%', '& .MuiSelect-icon': {
1555
+ }, sx: (theme) => (Object.assign({ p: 0, minWidth: columnDef.filterVariant === 'range'
1556
+ ? '90px'
1557
+ : !filterChipLabel
1558
+ ? '120px'
1559
+ : 'auto', width: '100%', '& .MuiSelect-icon': {
1509
1560
  mr: '1.5rem',
1510
1561
  } }, ((textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx) instanceof Function
1511
1562
  ? textFieldProps.sx(theme)
@@ -1533,7 +1584,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
1533
1584
  isMultiSelectFilter && (React.createElement(Checkbox, { checked: ((_a = column.getFilterValue()) !== null && _a !== void 0 ? _a : []).includes(value), sx: { mr: '0.5rem' } })),
1534
1585
  text));
1535
1586
  })),
1536
- React.createElement(MRT_FilterOptionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table })));
1587
+ React.createElement(MRT_FilterOptionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table, setFilterValue: setFilterValue })));
1537
1588
  };
1538
1589
 
1539
1590
  const MRT_FilterRangeFields = ({ header, table }) => {
@@ -1555,11 +1606,8 @@ const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
1555
1606
  const { options: { icons: { FilterAltIcon }, localization, }, } = table;
1556
1607
  const { column } = header;
1557
1608
  const { columnDef } = column;
1558
- const isRangeFilter = [
1559
- 'between',
1560
- 'betweenInclusive',
1561
- 'inNumberRange',
1562
- ].includes(columnDef._filterFn);
1609
+ const isRangeFilter = columnDef.filterVariant === 'range' ||
1610
+ ['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn);
1563
1611
  const currentFilterOption = columnDef._filterFn;
1564
1612
  const filterTooltip = localization.filteringByColumn
1565
1613
  .replace('{column}', String(columnDef.header))
@@ -1571,8 +1619,8 @@ const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
1571
1619
  ? column.getFilterValue().join(`" ${isRangeFilter ? localization.and : localization.or} "`)
1572
1620
  : column.getFilterValue()}"`)
1573
1621
  .replace('" "', '');
1574
- return (React.createElement(Grow, { unmountOnExit: true, in: (!!column.getFilterValue() && isRangeFilter) ||
1575
- (!isRangeFilter && // @ts-ignore
1622
+ return (React.createElement(Grow, { unmountOnExit: true, in: (!!column.getFilterValue() && !isRangeFilter) ||
1623
+ (isRangeFilter && // @ts-ignore
1576
1624
  (!!((_b = column.getFilterValue()) === null || _b === void 0 ? void 0 : _b[0]) || !!((_c = column.getFilterValue()) === null || _c === void 0 ? void 0 : _c[1]))) },
1577
1625
  React.createElement("span", null,
1578
1626
  React.createElement(Tooltip, { arrow: true, placement: "top", title: filterTooltip },
@@ -1589,7 +1637,7 @@ const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
1589
1637
  };
1590
1638
 
1591
1639
  const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
1592
- const { getState, options: { enableColumnOrdering, muiTableHeadCellDragHandleProps, onColumnDrop, }, setColumnOrder, setDraggingColumn, setHoveredColumn, } = table;
1640
+ const { getState, options: { enableColumnOrdering, muiTableHeadCellDragHandleProps }, setColumnOrder, setDraggingColumn, setHoveredColumn, } = table;
1593
1641
  const { columnDef } = column;
1594
1642
  const { hoveredColumn, draggingColumn, columnOrder } = getState();
1595
1643
  const mIconButtonProps = muiTableHeadCellDragHandleProps instanceof Function
@@ -1599,16 +1647,15 @@ const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
1599
1647
  ? columnDef.muiTableHeadCellDragHandleProps({ column, table })
1600
1648
  : columnDef.muiTableHeadCellDragHandleProps;
1601
1649
  const iconButtonProps = Object.assign(Object.assign({}, mIconButtonProps), mcIconButtonProps);
1602
- const handleDragStart = (e) => {
1650
+ const handleDragStart = (event) => {
1651
+ var _a;
1652
+ (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
1603
1653
  setDraggingColumn(column);
1604
- e.dataTransfer.setDragImage(tableHeadCellRef.current, 0, 0);
1654
+ event.dataTransfer.setDragImage(tableHeadCellRef.current, 0, 0);
1605
1655
  };
1606
1656
  const handleDragEnd = (event) => {
1607
- onColumnDrop === null || onColumnDrop === void 0 ? void 0 : onColumnDrop({
1608
- event,
1609
- draggedColumn: column,
1610
- targetColumn: hoveredColumn,
1611
- });
1657
+ var _a;
1658
+ (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
1612
1659
  if ((hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
1613
1660
  column.toggleGrouping();
1614
1661
  }
@@ -1676,7 +1723,7 @@ const MRT_TableHeadCellSortLabel = ({ header, table }) => {
1676
1723
  const MRT_TableHeadCell = ({ header, table }) => {
1677
1724
  var _a, _b, _c, _d;
1678
1725
  const theme = useTheme();
1679
- const { getState, options: { enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnResizing, enableGrouping, enableMultiSort, muiTableHeadCellProps, }, setHoveredColumn, } = table;
1726
+ const { getState, options: { enableColumnActions, enableColumnDragging, enableColumnOrdering, enableGrouping, enableMultiSort, muiTableHeadCellProps, }, setHoveredColumn, } = table;
1680
1727
  const { density, draggingColumn, grouping, hoveredColumn, showColumnFilters, } = getState();
1681
1728
  const { column } = header;
1682
1729
  const { columnDef } = column;
@@ -1688,16 +1735,6 @@ const MRT_TableHeadCell = ({ header, table }) => {
1688
1735
  ? columnDef.muiTableHeadCellProps({ column, table })
1689
1736
  : columnDef.muiTableHeadCellProps;
1690
1737
  const tableCellProps = Object.assign(Object.assign({}, mTableHeadCellProps), mcTableHeadCellProps);
1691
- const getIsLastLeftPinnedColumn = () => {
1692
- return (column.getIsPinned() === 'left' &&
1693
- table.getLeftLeafHeaders().length - 1 === column.getPinnedIndex());
1694
- };
1695
- const getIsFirstRightPinnedColumn = () => {
1696
- return column.getIsPinned() === 'right' && column.getPinnedIndex() === 0;
1697
- };
1698
- const getTotalRight = () => {
1699
- return ((table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 150);
1700
- };
1701
1738
  const handleDragEnter = (_e) => {
1702
1739
  if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
1703
1740
  setHoveredColumn(null);
@@ -1726,44 +1763,33 @@ const MRT_TableHeadCell = ({ header, table }) => {
1726
1763
  })
1727
1764
  : columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header)) !== null && _b !== void 0 ? _b : columnDef.header);
1728
1765
  const tableHeadCellRef = React.useRef(null);
1729
- return (React.createElement(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: tableHeadCellRef }, tableCellProps, { sx: (theme) => {
1730
- var _a;
1731
- return (Object.assign(Object.assign(Object.assign({ backgroundColor: column.getIsPinned() && columnDefType !== 'group'
1732
- ? alpha(lighten(theme.palette.background.default, 0.04), 0.95)
1733
- : 'inherit', backgroundImage: 'inherit', boxShadow: getIsLastLeftPinnedColumn()
1734
- ? `4px 0 4px -2px ${alpha(theme.palette.common.black, 0.1)}`
1735
- : getIsFirstRightPinnedColumn()
1736
- ? `-4px 0 4px -2px ${alpha(theme.palette.common.black, 0.1)}`
1737
- : undefined, fontWeight: 'bold', left: column.getIsPinned() === 'left'
1738
- ? `${column.getStart('left')}px`
1739
- : undefined, overflow: 'visible', opacity: (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id || (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
1740
- ? 0.5
1741
- : 1, p: density === 'compact'
1742
- ? '0.5rem'
1743
- : density === 'comfortable'
1744
- ? columnDefType === 'display'
1745
- ? '0.75rem'
1746
- : '1rem'
1747
- : columnDefType === 'display'
1748
- ? '1rem 1.25rem'
1749
- : '1.5rem', pb: columnDefType === 'display'
1750
- ? 0
1751
- : showColumnFilters || density === 'compact'
1752
- ? '0.4rem'
1753
- : '0.6rem', position: column.getIsPinned() && columnDefType !== 'group'
1754
- ? 'sticky'
1755
- : undefined, pt: columnDefType === 'group' || density === 'compact'
1756
- ? '0.25rem'
1757
- : density === 'comfortable'
1758
- ? '.75rem'
1759
- : '1.25rem', right: column.getIsPinned() === 'right' ? `${getTotalRight()}px` : undefined, transition: `all ${enableColumnResizing ? 0 : '0.2s'} ease-in-out`, userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top', zIndex: column.getIsResizing() || (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
1760
- ? 3
1761
- : column.getIsPinned() && columnDefType !== 'group'
1762
- ? 2
1763
- : 1 }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
1764
- ? tableCellProps.sx(theme)
1765
- : tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), draggingBorders), { maxWidth: `min(${column.getSize()}px, fit-content)`, minWidth: `max(${column.getSize()}px, ${(_a = columnDef.minSize) !== null && _a !== void 0 ? _a : 30}px)`, width: header.getSize() }));
1766
- } }),
1766
+ return (React.createElement(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: tableHeadCellRef }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ fontWeight: 'bold', overflow: 'visible', p: density === 'compact'
1767
+ ? '0.5rem'
1768
+ : density === 'comfortable'
1769
+ ? columnDefType === 'display'
1770
+ ? '0.75rem'
1771
+ : '1rem'
1772
+ : columnDefType === 'display'
1773
+ ? '1rem 1.25rem'
1774
+ : '1.5rem', pb: columnDefType === 'display'
1775
+ ? 0
1776
+ : showColumnFilters || density === 'compact'
1777
+ ? '0.4rem'
1778
+ : '0.6rem', pt: columnDefType === 'group' || density === 'compact'
1779
+ ? '0.25rem'
1780
+ : density === 'comfortable'
1781
+ ? '.75rem'
1782
+ : '1.25rem', userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top', zIndex: column.getIsResizing() || (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
1783
+ ? 3
1784
+ : column.getIsPinned() && columnDefType !== 'group'
1785
+ ? 2
1786
+ : 1 }, getCommonCellStyles({
1787
+ column,
1788
+ header,
1789
+ table,
1790
+ tableCellProps,
1791
+ theme,
1792
+ })), draggingBorders)) }),
1767
1793
  header.isPlaceholder ? null : (React.createElement(Box, { sx: {
1768
1794
  alignItems: 'flex-start',
1769
1795
  display: 'flex',
@@ -1818,11 +1844,13 @@ const MRT_TableHeadRow = ({ headerGroup, table }) => {
1818
1844
  };
1819
1845
 
1820
1846
  const MRT_TableHead = ({ table }) => {
1821
- const { getHeaderGroups, options: { muiTableHeadProps }, } = table;
1847
+ const { getHeaderGroups, options: { enableStickyHeader, muiTableHeadProps }, } = table;
1822
1848
  const tableHeadProps = muiTableHeadProps instanceof Function
1823
1849
  ? muiTableHeadProps({ table })
1824
1850
  : muiTableHeadProps;
1825
- return (React.createElement(TableHead, Object.assign({}, tableHeadProps), getHeaderGroups().map((headerGroup) => (React.createElement(MRT_TableHeadRow, { headerGroup: headerGroup, key: headerGroup.id, table: table })))));
1851
+ return (React.createElement(TableHead, Object.assign({}, tableHeadProps, { sx: (theme) => (Object.assign({ opacity: enableStickyHeader ? 0.95 : undefined }, ((tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx) instanceof Function
1852
+ ? tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx(theme)
1853
+ : tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx))) }), getHeaderGroups().map((headerGroup) => (React.createElement(MRT_TableHeadRow, { headerGroup: headerGroup, key: headerGroup.id, table: table })))));
1826
1854
  };
1827
1855
 
1828
1856
  const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
@@ -1918,28 +1946,27 @@ const MRT_CopyButton = ({ cell, children, table, }) => {
1918
1946
  };
1919
1947
 
1920
1948
  const MRT_TableBodyRowGrabHandle = ({ cell, rowRef, table, }) => {
1921
- const { options: { muiTableBodyRowDragHandleProps, onRowDrop }, } = table;
1949
+ const { options: { muiTableBodyRowDragHandleProps }, } = table;
1922
1950
  const { row } = cell;
1923
1951
  const iconButtonProps = muiTableBodyRowDragHandleProps instanceof Function
1924
1952
  ? muiTableBodyRowDragHandleProps({ row, table })
1925
1953
  : muiTableBodyRowDragHandleProps;
1926
- const handleDragStart = (e) => {
1927
- e.dataTransfer.setDragImage(rowRef.current, 0, 0);
1954
+ const handleDragStart = (event) => {
1955
+ var _a;
1956
+ (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
1957
+ event.dataTransfer.setDragImage(rowRef.current, 0, 0);
1928
1958
  table.setDraggingRow(row);
1929
1959
  };
1930
1960
  const handleDragEnd = (event) => {
1931
- onRowDrop === null || onRowDrop === void 0 ? void 0 : onRowDrop({
1932
- event,
1933
- draggedRow: table.getState().draggingRow,
1934
- targetRow: table.getState().hoveredRow,
1935
- });
1961
+ var _a;
1962
+ (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
1936
1963
  table.setDraggingRow(null);
1937
1964
  table.setHoveredRow(null);
1938
1965
  };
1939
1966
  return (React.createElement(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
1940
1967
  };
1941
1968
 
1942
- const MRT_TableBodyCellValue = ({ cell, table }) => {
1969
+ const _MRT_TableBodyCellValue = ({ cell, table }) => {
1943
1970
  var _a, _b;
1944
1971
  const { column, row } = cell;
1945
1972
  const { columnDef } = column;
@@ -1961,6 +1988,7 @@ const MRT_TableBodyCellValue = ({ cell, table }) => {
1961
1988
  })
1962
1989
  : (_b = (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Cell) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table })) !== null && _b !== void 0 ? _b : cell.renderValue()));
1963
1990
  };
1991
+ const MRT_TableBodyCellValue = memo(_MRT_TableBodyCellValue, (prev, next) => prev.cell.getValue() === next.cell.getValue());
1964
1992
 
1965
1993
  const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
1966
1994
  var _a, _b;
@@ -1977,6 +2005,9 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
1977
2005
  ? columnDef.muiTableBodyCellProps({ cell, table })
1978
2006
  : columnDef.muiTableBodyCellProps;
1979
2007
  const tableCellProps = Object.assign(Object.assign({}, mTableCellBodyProps), mcTableCellBodyProps);
2008
+ const skeletonProps = muiTableBodyCellSkeletonProps instanceof Function
2009
+ ? muiTableBodyCellSkeletonProps({ cell, column, row, table })
2010
+ : muiTableBodyCellSkeletonProps;
1980
2011
  const isEditable = (enableEditing || columnDef.enableEditing) &&
1981
2012
  columnDef.enableEditing !== false;
1982
2013
  const isEditing = isEditable &&
@@ -2007,16 +2038,6 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
2007
2038
  });
2008
2039
  }
2009
2040
  };
2010
- const getIsLastLeftPinnedColumn = () => {
2011
- return (column.getIsPinned() === 'left' &&
2012
- table.getLeftLeafHeaders().length - 1 === column.getPinnedIndex());
2013
- };
2014
- const getIsFirstRightPinnedColumn = () => {
2015
- return column.getIsPinned() === 'right' && column.getPinnedIndex() === 0;
2016
- };
2017
- const getTotalRight = () => {
2018
- return ((table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 150);
2019
- };
2020
2041
  const handleDragEnter = (e) => {
2021
2042
  var _a;
2022
2043
  (_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onDragEnter) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, e);
@@ -2045,53 +2066,34 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
2045
2066
  : undefined,
2046
2067
  }
2047
2068
  : undefined;
2048
- return (React.createElement(TableCell, Object.assign({}, tableCellProps, { onDragEnter: handleDragEnter, onDoubleClick: handleDoubleClick, sx: (theme) => {
2049
- var _a;
2050
- return (Object.assign(Object.assign(Object.assign({ backgroundColor: column.getIsPinned()
2051
- ? alpha(lighten(theme.palette.background.default, 0.04), 0.95)
2052
- : undefined, boxShadow: getIsLastLeftPinnedColumn()
2053
- ? `4px 0 4px -2px ${alpha(theme.palette.common.black, 0.1)}`
2054
- : getIsFirstRightPinnedColumn()
2055
- ? `-4px 0 4px -2px ${alpha(theme.palette.common.black, 0.1)}`
2056
- : undefined, cursor: isEditable && editingMode === 'cell' ? 'pointer' : 'text', left: column.getIsPinned() === 'left'
2057
- ? `${column.getStart('left')}px`
2058
- : undefined, opacity: (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id || (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
2059
- ? 0.5
2060
- : 1, overflow: 'hidden', p: density === 'compact'
2069
+ return (React.createElement(TableCell, Object.assign({}, tableCellProps, { onDragEnter: handleDragEnter, onDoubleClick: handleDoubleClick, sx: (theme) => (Object.assign(Object.assign({ cursor: isEditable && editingMode === 'cell' ? 'pointer' : 'text', overflow: 'hidden', p: density === 'compact'
2070
+ ? columnDefType === 'display'
2071
+ ? '0 0.5rem'
2072
+ : '0.5rem'
2073
+ : density === 'comfortable'
2061
2074
  ? columnDefType === 'display'
2062
- ? '0 0.5rem'
2063
- : '0.5rem'
2064
- : density === 'comfortable'
2065
- ? columnDefType === 'display'
2066
- ? '0.5rem 0.75rem'
2067
- : '1rem'
2068
- : columnDefType === 'display'
2069
- ? '1rem 1.25rem'
2070
- : '1.5rem', pl: column.id === 'mrt-row-expand'
2071
- ? `${row.depth +
2072
- (density === 'compact'
2073
- ? 0.5
2074
- : density === 'comfortable'
2075
- ? 0.75
2076
- : 1.25)}rem`
2077
- : undefined, position: column.getIsPinned() ? 'sticky' : 'relative', right: column.getIsPinned() === 'right' ? `${getTotalRight()}px` : undefined, textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined, transition: 'all 0.2s ease-in-out', whiteSpace: density === 'compact' ? 'nowrap' : 'normal', zIndex: (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
2078
- ? 2
2079
- : column.getIsPinned()
2080
- ? 1
2081
- : undefined, '&:hover': {
2082
- backgroundColor: enableHover &&
2083
- enableEditing &&
2084
- columnDef.enableEditing !== false &&
2085
- ['table', 'cell'].includes(editingMode !== null && editingMode !== void 0 ? editingMode : '')
2086
- ? theme.palette.mode === 'dark'
2087
- ? `${lighten(theme.palette.background.default, 0.2)} !important`
2088
- : `${darken(theme.palette.background.default, 0.1)} !important`
2089
- : undefined,
2090
- } }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
2091
- ? tableCellProps.sx(theme)
2092
- : tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), draggingBorders), { maxWidth: `min(${column.getSize()}px, fit-content)`, minWidth: `max(${column.getSize()}px, ${(_a = columnDef.minSize) !== null && _a !== void 0 ? _a : 30}px)`, width: column.getSize() }));
2093
- } }),
2094
- React.createElement(React.Fragment, null, cell.getIsPlaceholder() ? null : isLoading || showSkeletons ? (React.createElement(Skeleton, Object.assign({ animation: "wave", height: 20, width: skeletonWidth }, muiTableBodyCellSkeletonProps))) : enableRowNumbers &&
2075
+ ? '0.5rem 0.75rem'
2076
+ : '1rem'
2077
+ : columnDefType === 'display'
2078
+ ? '1rem 1.25rem'
2079
+ : '1.5rem', pl: column.id === 'mrt-row-expand'
2080
+ ? `${row.depth +
2081
+ (density === 'compact'
2082
+ ? 0.5
2083
+ : density === 'comfortable'
2084
+ ? 0.75
2085
+ : 1.25)}rem`
2086
+ : undefined, textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined, whiteSpace: density === 'compact' ? 'nowrap' : 'normal', zIndex: (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id ? 2 : column.getIsPinned() ? 1 : 0, '&:hover': {
2087
+ backgroundColor: enableHover &&
2088
+ enableEditing &&
2089
+ columnDef.enableEditing !== false &&
2090
+ ['table', 'cell'].includes(editingMode !== null && editingMode !== void 0 ? editingMode : '')
2091
+ ? theme.palette.mode === 'dark'
2092
+ ? `${lighten(theme.palette.background.default, 0.2)} !important`
2093
+ : `${darken(theme.palette.background.default, 0.1)} !important`
2094
+ : undefined,
2095
+ } }, getCommonCellStyles({ column, table, theme, tableCellProps })), draggingBorders)) }),
2096
+ React.createElement(React.Fragment, null, cell.getIsPlaceholder() ? null : isLoading || showSkeletons ? (React.createElement(Skeleton, Object.assign({ animation: "wave", height: 20, width: skeletonWidth }, skeletonProps))) : enableRowNumbers &&
2095
2097
  rowNumberMode === 'static' &&
2096
2098
  column.id === 'mrt-row-numbers' ? (rowIndex + 1) : column.id === 'mrt-row-drag' ? (React.createElement(MRT_TableBodyRowGrabHandle, { cell: cell, rowRef: rowRef, table: table })) : columnDefType === 'display' &&
2097
2099
  (column.id === 'mrt-row-select' ||
@@ -2161,9 +2163,10 @@ const MRT_TableBodyRow = ({ row, rowIndex, table, virtualRow, }) => {
2161
2163
  renderDetailPanel && !row.getIsGrouped() && (React.createElement(MRT_TableDetailPanel, { row: row, table: table }))));
2162
2164
  };
2163
2165
 
2164
- const MRT_TableBody = ({ table, tableContainerRef }) => {
2165
- const { getRowModel, getPrePaginationRowModel, getState, options: { enableGlobalFilterRankedResults, enablePagination, enableRowVirtualization, manualFiltering, manualSorting, muiTableBodyProps, virtualizerInstanceRef, virtualizerProps, }, } = table;
2166
- const { globalFilter, pagination, sorting } = getState();
2166
+ const MRT_TableBody = ({ table }) => {
2167
+ var _a;
2168
+ const { getRowModel, getPrePaginationRowModel, getState, options: { enableGlobalFilterRankedResults, enablePagination, enableRowVirtualization, localization, manualFiltering, manualSorting, muiTableBodyProps, virtualizerInstanceRef, virtualizerProps, }, refs: { tableContainerRef, tablePaperRef }, } = table;
2169
+ const { columnFilters, globalFilter, pagination, sorting } = getState();
2167
2170
  const tableBodyProps = muiTableBodyProps instanceof Function
2168
2171
  ? muiTableBodyProps({ table })
2169
2172
  : muiTableBodyProps;
@@ -2228,7 +2231,18 @@ const MRT_TableBody = ({ table, tableContainerRef }) => {
2228
2231
  // ? virtualizer.getTotalSize() - virtualRows[virtualRows.length - 1].end
2229
2232
  // : 0;
2230
2233
  // }
2231
- return (React.createElement(TableBody, Object.assign({}, tableBodyProps),
2234
+ return (React.createElement(TableBody, Object.assign({}, tableBodyProps), !rows.length ? (React.createElement("tr", null,
2235
+ React.createElement("td", { colSpan: table.getVisibleLeafColumns().length },
2236
+ React.createElement(Typography, { sx: {
2237
+ color: 'text.secondary',
2238
+ fontStyle: 'italic',
2239
+ maxWidth: `min(100vw, ${(_a = tablePaperRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth}px)`,
2240
+ py: '2rem',
2241
+ textAlign: 'center',
2242
+ width: '100%',
2243
+ } }, globalFilter || columnFilters.length
2244
+ ? localization.noResultsFound
2245
+ : localization.noRecordsToDisplay)))) : (React.createElement(React.Fragment, null,
2232
2246
  enableRowVirtualization && paddingTop > 0 && (React.createElement("tr", null,
2233
2247
  React.createElement("td", { style: { height: `${paddingTop}px` } }))),
2234
2248
  (enableRowVirtualization ? virtualRows : rows).map((rowOrVirtualRow, rowIndex) => {
@@ -2238,12 +2252,12 @@ const MRT_TableBody = ({ table, tableContainerRef }) => {
2238
2252
  return (React.createElement(MRT_TableBodyRow, { key: row.id, row: row, rowIndex: enableRowVirtualization ? rowOrVirtualRow.index : rowIndex, table: table, virtualRow: enableRowVirtualization ? rowOrVirtualRow : null }));
2239
2253
  }),
2240
2254
  enableRowVirtualization && paddingBottom > 0 && (React.createElement("tr", null,
2241
- React.createElement("td", { style: { height: `${paddingBottom}px` } })))));
2255
+ React.createElement("td", { style: { height: `${paddingBottom}px` } })))))));
2242
2256
  };
2243
2257
 
2244
2258
  const MRT_TableFooterCell = ({ footer, table }) => {
2245
2259
  var _a, _b, _c;
2246
- const { getState, options: { muiTableFooterCellProps, enableColumnResizing }, } = table;
2260
+ const { getState, options: { muiTableFooterCellProps }, } = table;
2247
2261
  const { density } = getState();
2248
2262
  const { column } = footer;
2249
2263
  const { columnDef } = column;
@@ -2255,13 +2269,11 @@ const MRT_TableFooterCell = ({ footer, table }) => {
2255
2269
  ? columnDef.muiTableFooterCellProps({ column, table })
2256
2270
  : columnDef.muiTableFooterCellProps;
2257
2271
  const tableCellProps = Object.assign(Object.assign({}, mTableFooterCellProps), mcTableFooterCellProps);
2258
- return (React.createElement(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: footer.colSpan, variant: "head" }, tableCellProps, { sx: (theme) => (Object.assign({ backgroundColor: theme.palette.background.default, backgroundImage: `linear-gradient(${alpha(theme.palette.common.white, 0.05)},${alpha(theme.palette.common.white, 0.05)})`, fontWeight: 'bold', maxWidth: `${column.getSize()}px`, minWidth: `${column.getSize()}px`, p: density === 'compact'
2272
+ return (React.createElement(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: footer.colSpan, variant: "head" }, tableCellProps, { sx: (theme) => (Object.assign({ fontWeight: 'bold', p: density === 'compact'
2259
2273
  ? '0.5rem'
2260
2274
  : density === 'comfortable'
2261
2275
  ? '1rem'
2262
- : '1.5rem', transition: `all ${enableColumnResizing ? '10ms' : '0.2s'} ease-in-out`, width: column.getSize(), verticalAlign: 'text-top' }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
2263
- ? tableCellProps.sx(theme)
2264
- : tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))) }),
2276
+ : '1.5rem', verticalAlign: 'top' }, getCommonCellStyles({ column, table, theme, tableCellProps }))) }),
2265
2277
  React.createElement(React.Fragment, null, footer.isPlaceholder
2266
2278
  ? null
2267
2279
  : (_c = (_b = (columnDef.Footer instanceof Function
@@ -2294,16 +2306,16 @@ const MRT_TableFooter = ({ table }) => {
2294
2306
  ? muiTableFooterProps({ table })
2295
2307
  : muiTableFooterProps;
2296
2308
  const stickFooter = (isFullScreen || enableStickyFooter) && enableStickyFooter !== false;
2297
- return (React.createElement(TableFooter, Object.assign({}, tableFooterProps, { sx: (theme) => (Object.assign({ position: stickFooter ? 'sticky' : undefined, bottom: stickFooter ? 0 : undefined, opacity: stickFooter ? 0.95 : undefined, outline: stickFooter
2309
+ return (React.createElement(TableFooter, Object.assign({}, tableFooterProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.06), bottom: stickFooter ? 0 : undefined, opacity: stickFooter ? 0.95 : undefined, outline: stickFooter
2298
2310
  ? theme.palette.mode === 'light'
2299
2311
  ? `1px solid ${theme.palette.grey[300]}`
2300
2312
  : `1px solid ${theme.palette.grey[700]}`
2301
- : undefined }, ((tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx) instanceof Function
2313
+ : undefined, position: stickFooter ? 'sticky' : undefined }, ((tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx) instanceof Function
2302
2314
  ? tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx(theme)
2303
2315
  : tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx))) }), getFooterGroups().map((footerGroup) => (React.createElement(MRT_TableFooterRow, { footerGroup: footerGroup, key: footerGroup.id, table: table })))));
2304
2316
  };
2305
2317
 
2306
- const MRT_Table = ({ tableContainerRef, table }) => {
2318
+ const MRT_Table = ({ table }) => {
2307
2319
  const { getState, options: { enableColumnResizing, enableRowVirtualization, enableStickyHeader, enableTableFooter, enableTableHead, muiTableProps, }, } = table;
2308
2320
  const { isFullScreen } = getState();
2309
2321
  const tableProps = muiTableProps instanceof Function
@@ -2313,7 +2325,7 @@ const MRT_Table = ({ tableContainerRef, table }) => {
2313
2325
  ? tableProps.sx(theme)
2314
2326
  : tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx))) }),
2315
2327
  enableTableHead && React.createElement(MRT_TableHead, { table: table }),
2316
- React.createElement(MRT_TableBody, { tableContainerRef: tableContainerRef, table: table }),
2328
+ React.createElement(MRT_TableBody, { table: table }),
2317
2329
  enableTableFooter && React.createElement(MRT_TableFooter, { table: table })));
2318
2330
  };
2319
2331
 
@@ -2348,31 +2360,42 @@ const MRT_TableContainer = ({ table }) => {
2348
2360
  : tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx))), style: Object.assign({ maxHeight: isFullScreen
2349
2361
  ? `calc(100vh - ${totalToolbarHeight}px)`
2350
2362
  : undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style) }),
2351
- React.createElement(MRT_Table, { tableContainerRef: tableContainerRef, table: table })));
2363
+ React.createElement(MRT_Table, { table: table })));
2352
2364
  };
2353
2365
 
2354
2366
  const MRT_TablePaper = ({ table }) => {
2355
- const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps }, } = table;
2367
+ const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps, renderBottomToolbar, renderTopToolbar, }, refs: { tablePaperRef }, } = table;
2356
2368
  const { isFullScreen } = getState();
2357
- useEffect(() => {
2358
- if (typeof window !== 'undefined') {
2359
- if (isFullScreen) {
2360
- document.body.style.height = '100vh';
2361
- }
2362
- else {
2363
- document.body.style.height = 'auto';
2364
- }
2365
- }
2366
- }, [isFullScreen]);
2367
2369
  const tablePaperProps = muiTablePaperProps instanceof Function
2368
2370
  ? muiTablePaperProps({ table })
2369
2371
  : muiTablePaperProps;
2370
- return (React.createElement(Paper, Object.assign({ elevation: 2 }, tablePaperProps, { sx: (theme) => (Object.assign({ transition: 'all 0.2s ease-in-out' }, ((tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx) instanceof Function
2372
+ return (React.createElement(Paper, Object.assign({ elevation: 2 }, tablePaperProps, { ref: (ref) => {
2373
+ tablePaperRef.current = ref;
2374
+ if (tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.ref) {
2375
+ //@ts-ignore
2376
+ tablePaperProps.ref.current = ref;
2377
+ }
2378
+ }, sx: (theme) => (Object.assign({ transition: 'all 0.2s ease-in-out' }, ((tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx) instanceof Function
2371
2379
  ? tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx(theme)
2372
- : tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx))), style: Object.assign(Object.assign({}, tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style), { height: isFullScreen ? '100vh' : undefined, margin: isFullScreen ? '0' : undefined, maxHeight: isFullScreen ? '100vh' : undefined, maxWidth: isFullScreen ? '100vw' : undefined, padding: isFullScreen ? '0' : undefined, width: isFullScreen ? '100vw' : undefined }) }),
2373
- enableTopToolbar && React.createElement(MRT_TopToolbar, { table: table }),
2380
+ : tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx))), style: Object.assign(Object.assign({}, tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style), (isFullScreen
2381
+ ? {
2382
+ height: '100vh',
2383
+ margin: 0,
2384
+ maxHeight: '100vh',
2385
+ maxWidth: '100vw',
2386
+ padding: 0,
2387
+ width: '100vw',
2388
+ }
2389
+ : {})) }),
2390
+ enableTopToolbar &&
2391
+ (renderTopToolbar instanceof Function
2392
+ ? renderTopToolbar({ table })
2393
+ : renderTopToolbar !== null && renderTopToolbar !== void 0 ? renderTopToolbar : React.createElement(MRT_TopToolbar, { table: table })),
2374
2394
  React.createElement(MRT_TableContainer, { table: table }),
2375
- enableBottomToolbar && React.createElement(MRT_BottomToolbar, { table: table })));
2395
+ enableBottomToolbar &&
2396
+ (renderBottomToolbar instanceof Function
2397
+ ? renderBottomToolbar({ table })
2398
+ : renderBottomToolbar !== null && renderBottomToolbar !== void 0 ? renderBottomToolbar : React.createElement(MRT_BottomToolbar, { table: table }))));
2376
2399
  };
2377
2400
 
2378
2401
  const MRT_EditRowModal = ({ open, row, table, }) => {
@@ -2400,6 +2423,7 @@ const MRT_TableRoot = (props) => {
2400
2423
  const filterInputRefs = useRef({});
2401
2424
  const searchInputRef = useRef(null);
2402
2425
  const tableContainerRef = useRef(null);
2426
+ const tablePaperRef = useRef(null);
2403
2427
  const topToolbarRef = useRef(null);
2404
2428
  const initialState = useMemo(() => {
2405
2429
  var _a, _b;
@@ -2435,14 +2459,14 @@ const MRT_TableRoot = (props) => {
2435
2459
  const [showColumnFilters, setShowFilters] = useState((_p = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _p !== void 0 ? _p : false);
2436
2460
  const [showGlobalFilter, setShowGlobalFilter] = useState((_q = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _q !== void 0 ? _q : false);
2437
2461
  const displayColumns = useMemo(() => {
2438
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
2462
+ var _a, _b, _c, _d, _e;
2439
2463
  return [
2440
- columnOrder.includes('mrt-row-drag') && Object.assign(Object.assign(Object.assign({ header: (_a = props.localization) === null || _a === void 0 ? void 0 : _a.move, size: 60 }, props.defaultDisplayColumn), (_b = props.displayColumnDefOptions) === null || _b === void 0 ? void 0 : _b['mrt-row-drag']), { id: 'mrt-row-drag' }),
2441
- columnOrder.includes('mrt-row-actions') && Object.assign(Object.assign(Object.assign({ Cell: ({ cell, row }) => (React.createElement(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, table: table })), header: (_c = props.localization) === null || _c === void 0 ? void 0 : _c.actions, size: 70 }, props.defaultDisplayColumn), (_d = props.displayColumnDefOptions) === null || _d === void 0 ? void 0 : _d['mrt-row-actions']), { id: 'mrt-row-actions' }),
2464
+ columnOrder.includes('mrt-row-drag') && Object.assign(Object.assign(Object.assign({ header: props.localization.move, size: 60 }, props.defaultDisplayColumn), (_a = props.displayColumnDefOptions) === null || _a === void 0 ? void 0 : _a['mrt-row-drag']), { id: 'mrt-row-drag' }),
2465
+ columnOrder.includes('mrt-row-actions') && Object.assign(Object.assign(Object.assign({ Cell: ({ cell, row }) => (React.createElement(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, table: table })), header: props.localization.actions, size: 70 }, props.defaultDisplayColumn), (_b = props.displayColumnDefOptions) === null || _b === void 0 ? void 0 : _b['mrt-row-actions']), { id: 'mrt-row-actions' }),
2442
2466
  columnOrder.includes('mrt-row-expand') &&
2443
- showExpandColumn(props, grouping) && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React.createElement(MRT_ExpandButton, { row: row, table: table })), Header: () => props.enableExpandAll ? (React.createElement(MRT_ExpandAllButton, { table: table })) : null, header: (_e = props.localization) === null || _e === void 0 ? void 0 : _e.expand, size: 60 }, props.defaultDisplayColumn), (_f = props.displayColumnDefOptions) === null || _f === void 0 ? void 0 : _f['mrt-row-expand']), { id: 'mrt-row-expand' }),
2444
- columnOrder.includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React.createElement(MRT_SelectCheckbox, { row: row, table: table })), Header: () => props.enableSelectAll ? (React.createElement(MRT_SelectCheckbox, { selectAll: true, table: table })) : null, header: (_g = props.localization) === null || _g === void 0 ? void 0 : _g.select, size: 60 }, props.defaultDisplayColumn), (_h = props.displayColumnDefOptions) === null || _h === void 0 ? void 0 : _h['mrt-row-select']), { id: 'mrt-row-select' }),
2445
- columnOrder.includes('mrt-row-numbers') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => row.index + 1, Header: () => { var _a; return (_a = props.localization) === null || _a === void 0 ? void 0 : _a.rowNumber; }, header: (_j = props.localization) === null || _j === void 0 ? void 0 : _j.rowNumbers, size: 60 }, props.defaultDisplayColumn), (_k = props.displayColumnDefOptions) === null || _k === void 0 ? void 0 : _k['mrt-row-numbers']), { id: 'mrt-row-numbers' }),
2467
+ showExpandColumn(props, grouping) && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React.createElement(MRT_ExpandButton, { row: row, table: table })), Header: () => props.enableExpandAll ? (React.createElement(MRT_ExpandAllButton, { table: table })) : null, header: props.localization.expand, size: 60 }, props.defaultDisplayColumn), (_c = props.displayColumnDefOptions) === null || _c === void 0 ? void 0 : _c['mrt-row-expand']), { id: 'mrt-row-expand' }),
2468
+ columnOrder.includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React.createElement(MRT_SelectCheckbox, { row: row, table: table })), Header: () => props.enableSelectAll ? (React.createElement(MRT_SelectCheckbox, { selectAll: true, table: table })) : null, header: props.localization.select, size: 60 }, props.defaultDisplayColumn), (_d = props.displayColumnDefOptions) === null || _d === void 0 ? void 0 : _d['mrt-row-select']), { id: 'mrt-row-select' }),
2469
+ columnOrder.includes('mrt-row-numbers') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => row.index + 1, Header: () => props.localization.rowNumber, header: props.localization.rowNumbers, size: 60 }, props.defaultDisplayColumn), (_e = props.displayColumnDefOptions) === null || _e === void 0 ? void 0 : _e['mrt-row-numbers']), { id: 'mrt-row-numbers' }),
2446
2470
  ].filter(Boolean);
2447
2471
  }, [
2448
2472
  columnOrder,
@@ -2520,22 +2544,39 @@ const MRT_TableRoot = (props) => {
2520
2544
  filterInputRefs,
2521
2545
  searchInputRef,
2522
2546
  tableContainerRef,
2547
+ tablePaperRef,
2523
2548
  topToolbarRef,
2524
2549
  }, setColumnFilterFns: (_x = props.onFilterFnsChange) !== null && _x !== void 0 ? _x : setColumnFilterFns, setDensity: (_y = props.onDensityChange) !== null && _y !== void 0 ? _y : setDensity, setDraggingColumn: (_z = props.onDraggingColumnChange) !== null && _z !== void 0 ? _z : setDraggingColumn, setDraggingRow: (_0 = props.onDraggingRowChange) !== null && _0 !== void 0 ? _0 : setDraggingRow, setEditingCell: (_1 = props.onEditingCellChange) !== null && _1 !== void 0 ? _1 : setEditingCell, setEditingRow: (_2 = props.onEditingRowChange) !== null && _2 !== void 0 ? _2 : setEditingRow, setGlobalFilterFn: (_3 = props.onGlobalFilterFnChange) !== null && _3 !== void 0 ? _3 : setGlobalFilterFn, setHoveredColumn: (_4 = props.onHoveredColumnChange) !== null && _4 !== void 0 ? _4 : setHoveredColumn, setHoveredRow: (_5 = props.onHoveredRowChange) !== null && _5 !== void 0 ? _5 : setHoveredRow, setIsFullScreen: (_6 = props.onIsFullScreenChange) !== null && _6 !== void 0 ? _6 : setIsFullScreen, setShowAlertBanner: (_7 = props.onShowAlertBannerChange) !== null && _7 !== void 0 ? _7 : setShowAlertBanner, setShowFilters: (_8 = props.onShowFiltersChange) !== null && _8 !== void 0 ? _8 : setShowFilters, setShowGlobalFilter: (_9 = props.onShowGlobalFilterChange) !== null && _9 !== void 0 ? _9 : setShowGlobalFilter });
2525
2550
  if (props.tableInstanceRef) {
2526
2551
  props.tableInstanceRef.current = table;
2527
2552
  }
2553
+ const initialBodyHeight = useRef();
2554
+ useEffect(() => {
2555
+ if (typeof window !== 'undefined') {
2556
+ initialBodyHeight.current = document.body.style.height;
2557
+ }
2558
+ }, []);
2559
+ useEffect(() => {
2560
+ if (typeof window !== 'undefined') {
2561
+ if (table.getState().isFullScreen) {
2562
+ document.body.style.height = '100vh';
2563
+ }
2564
+ else {
2565
+ document.body.style.height = initialBodyHeight.current;
2566
+ }
2567
+ }
2568
+ }, [table.getState().isFullScreen]);
2528
2569
  return (React.createElement(React.Fragment, null,
2529
- React.createElement(Dialog, { PaperComponent: Box, TransitionComponent: Grow, disablePortal: true, fullScreen: true, keepMounted: false, onClose: () => setIsFullScreen(false), open: isFullScreen, transitionDuration: 400 },
2570
+ React.createElement(Dialog, { PaperComponent: Box, TransitionComponent: Grow, disablePortal: true, fullScreen: true, keepMounted: false, onClose: () => table.setIsFullScreen(false), open: table.getState().isFullScreen, transitionDuration: 400 },
2530
2571
  React.createElement(MRT_TablePaper, { table: table })),
2531
- !isFullScreen && React.createElement(MRT_TablePaper, { table: table }),
2572
+ !table.getState().isFullScreen && (React.createElement(MRT_TablePaper, { table: table })),
2532
2573
  editingRow && props.editingMode === 'modal' && (React.createElement(MRT_EditRowModal, { row: editingRow, table: table, open: true }))));
2533
2574
  };
2534
2575
 
2535
2576
  var MaterialReactTable = (_a) => {
2536
2577
  var { aggregationFns, autoResetExpanded = false, columnResizeMode = 'onEnd', defaultColumn = { minSize: 40, maxSize: 1000, size: 180 }, defaultDisplayColumn, editingMode = 'modal', enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnResizing = false, enableDensityToggle = true, enableExpandAll = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterRankedResults = true, enableGrouping = false, enableHiding = true, enableMultiRowSelection = true, enableMultiSort = true, enablePagination = true, enablePinning = false, enableRowSelection = false, enableSelectAll = true, enableSorting = true, enableStickyHeader = false, enableTableFooter = true, enableTableHead = true, enableToolbarInternalActions = true, enableTopToolbar = true, filterFns, icons, localization, positionActionsColumn = 'first', positionExpandColumn = 'first', positionGlobalFilter = 'right', positionPagination = 'bottom', positionToolbarAlertBanner = 'top', positionToolbarDropZone = 'top', rowNumberMode = 'original', selectAllMode = 'all', sortingFns } = _a, rest = __rest(_a, ["aggregationFns", "autoResetExpanded", "columnResizeMode", "defaultColumn", "defaultDisplayColumn", "editingMode", "enableBottomToolbar", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnResizing", "enableDensityToggle", "enableExpandAll", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enablePinning", "enableRowSelection", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "localization", "positionActionsColumn", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberMode", "selectAllMode", "sortingFns"]);
2537
- return (React.createElement(MRT_TableRoot, Object.assign({ aggregationFns: Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns), autoResetExpanded: autoResetExpanded, columnResizeMode: columnResizeMode, defaultColumn: defaultColumn, defaultDisplayColumn: Object.assign({ columnDefType: 'display', enableClickToCopy: false, enableColumnActions: false, enableColumnDragging: false, enableColumnFilter: false, enableColumnOrdering: false, enableEditing: false, enableGlobalFilter: false, enableGrouping: false, enableHiding: false, enableResizing: false, enableSorting: false }, defaultDisplayColumn), editingMode: editingMode, enableBottomToolbar: enableBottomToolbar, enableColumnActions: enableColumnActions, enableColumnFilters: enableColumnFilters, enableColumnOrdering: enableColumnOrdering, enableColumnResizing: enableColumnResizing, enableDensityToggle: enableDensityToggle, enableExpandAll: enableExpandAll, enableFilters: enableFilters, enableFullScreenToggle: enableFullScreenToggle, enableGlobalFilter: enableGlobalFilter, enableGlobalFilterRankedResults: enableGlobalFilterRankedResults, enableGrouping: enableGrouping, enableHiding: enableHiding, enableMultiRowSelection: enableMultiRowSelection, enableMultiSort: enableMultiSort, enablePagination: enablePagination, enablePinning: enablePinning, enableRowSelection: enableRowSelection, enableSelectAll: enableSelectAll, enableSorting: enableSorting, enableStickyHeader: enableStickyHeader, enableTableFooter: enableTableFooter, enableTableHead: enableTableHead, enableToolbarInternalActions: enableToolbarInternalActions, enableTopToolbar: enableTopToolbar, filterFns: Object.assign(Object.assign({}, MRT_FilterFns), filterFns), icons: Object.assign(Object.assign({}, MRT_Default_Icons), icons), localization: Object.assign(Object.assign({}, MRT_DefaultLocalization_EN), localization), positionActionsColumn: positionActionsColumn, positionExpandColumn: positionExpandColumn, positionGlobalFilter: positionGlobalFilter, positionPagination: positionPagination, positionToolbarAlertBanner: positionToolbarAlertBanner, positionToolbarDropZone: positionToolbarDropZone, rowNumberMode: rowNumberMode, selectAllMode: selectAllMode, sortingFns: Object.assign(Object.assign({}, MRT_SortingFns), sortingFns) }, rest)));
2578
+ return (React.createElement(MRT_TableRoot, Object.assign({ aggregationFns: Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns), autoResetExpanded: autoResetExpanded, columnResizeMode: columnResizeMode, defaultColumn: defaultColumn, defaultDisplayColumn: Object.assign({ columnDefType: 'display', enableClickToCopy: false, enableColumnActions: false, enableColumnDragging: false, enableColumnFilter: false, enableColumnOrdering: false, enableEditing: false, enableGlobalFilter: false, enableGrouping: false, enableHiding: false, enableResizing: false, enableSorting: false }, defaultDisplayColumn), editingMode: editingMode, enableBottomToolbar: enableBottomToolbar, enableColumnActions: enableColumnActions, enableColumnFilters: enableColumnFilters, enableColumnOrdering: enableColumnOrdering, enableColumnResizing: enableColumnResizing, enableDensityToggle: enableDensityToggle, enableExpandAll: enableExpandAll, enableFilters: enableFilters, enableFullScreenToggle: enableFullScreenToggle, enableGlobalFilter: enableGlobalFilter, enableGlobalFilterRankedResults: enableGlobalFilterRankedResults, enableGrouping: enableGrouping, enableHiding: enableHiding, enableMultiRowSelection: enableMultiRowSelection, enableMultiSort: enableMultiSort, enablePagination: enablePagination, enablePinning: enablePinning, enableRowSelection: enableRowSelection, enableSelectAll: enableSelectAll, enableSorting: enableSorting, enableStickyHeader: enableStickyHeader, enableTableFooter: enableTableFooter, enableTableHead: enableTableHead, enableToolbarInternalActions: enableToolbarInternalActions, enableTopToolbar: enableTopToolbar, filterFns: Object.assign(Object.assign({}, MRT_FilterFns), filterFns), icons: Object.assign(Object.assign({}, MRT_Default_Icons), icons), localization: Object.assign(Object.assign({}, MRT_Localization_EN), localization), positionActionsColumn: positionActionsColumn, positionExpandColumn: positionExpandColumn, positionGlobalFilter: positionGlobalFilter, positionPagination: positionPagination, positionToolbarAlertBanner: positionToolbarAlertBanner, positionToolbarDropZone: positionToolbarDropZone, rowNumberMode: rowNumberMode, selectAllMode: selectAllMode, sortingFns: Object.assign(Object.assign({}, MRT_SortingFns), sortingFns) }, rest)));
2538
2579
  };
2539
2580
 
2540
- export { MRT_CopyButton, MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_ShowHideColumnsButton, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MaterialReactTable as default };
2581
+ export { MRT_CopyButton, MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_ShowHideColumnsButton, MRT_TablePagination, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MRT_ToolbarInternalButtons, MaterialReactTable as default };
2541
2582
  //# sourceMappingURL=material-react-table.esm.js.map