material-react-table 1.0.0-beta.0 → 1.0.0-beta.11

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 +247 -194
  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 +248 -197
  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 +13 -5
  93. package/src/inputs/MRT_GlobalFilterTextField.tsx +18 -5
  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, useEffect, Fragment, memo, 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;
@@ -1002,6 +1043,9 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
1002
1043
  var _a;
1003
1044
  const { getState, setGlobalFilter, options: { enableGlobalFilterModes, icons: { SearchIcon, CloseIcon }, localization, muiSearchTextFieldProps, }, refs: { searchInputRef }, } = table;
1004
1045
  const { globalFilter, showGlobalFilter } = getState();
1046
+ const textFieldProps = muiSearchTextFieldProps instanceof Function
1047
+ ? muiSearchTextFieldProps({ table })
1048
+ : muiSearchTextFieldProps;
1005
1049
  const [anchorEl, setAnchorEl] = useState(null);
1006
1050
  const [searchValue, setSearchValue] = useState(globalFilter !== null && globalFilter !== void 0 ? globalFilter : '');
1007
1051
  const handleChangeDebounced = useCallback(debounce((event) => {
@@ -1019,9 +1063,11 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
1019
1063
  setSearchValue('');
1020
1064
  setGlobalFilter(undefined);
1021
1065
  };
1022
- const textFieldProps = muiSearchTextFieldProps instanceof Function
1023
- ? muiSearchTextFieldProps({ table })
1024
- : muiSearchTextFieldProps;
1066
+ useEffect(() => {
1067
+ if (globalFilter === undefined) {
1068
+ handleClear();
1069
+ }
1070
+ }, [globalFilter]);
1025
1071
  return (React.createElement(Collapse, { in: showGlobalFilter, orientation: "horizontal", unmountOnExit: true, mountOnEnter: true },
1026
1072
  React.createElement(TextField, Object.assign({ placeholder: localization.search, onChange: handleChange, value: searchValue !== null && searchValue !== void 0 ? searchValue : '', variant: "standard", InputProps: {
1027
1073
  startAdornment: enableGlobalFilterModes ? (React.createElement(InputAdornment, { position: "start" },
@@ -1039,7 +1085,7 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
1039
1085
  textFieldProps.inputRef = inputRef;
1040
1086
  }
1041
1087
  } })),
1042
- React.createElement(MRT_FilterOptionMenu, { anchorEl: anchorEl, setAnchorEl: setAnchorEl, table: table })));
1088
+ React.createElement(MRT_FilterOptionMenu, { anchorEl: anchorEl, setAnchorEl: setAnchorEl, table: table, onSelect: handleClear })));
1043
1089
  };
1044
1090
 
1045
1091
  const MRT_LinearProgressBar = ({ isTopToolbar, table }) => {
@@ -1057,7 +1103,7 @@ const MRT_LinearProgressBar = ({ isTopToolbar, table }) => {
1057
1103
  React.createElement(LinearProgress, Object.assign({ "aria-label": "Loading", "aria-busy": "true", sx: { position: 'relative' } }, linearProgressProps))));
1058
1104
  };
1059
1105
 
1060
- const MRT_TablePagination = ({ table, position }) => {
1106
+ const MRT_TablePagination = ({ table, position, }) => {
1061
1107
  const { getPrePaginationRowModel, getState, setPageIndex, setPageSize, options: { muiTablePaginationProps, enableToolbarInternalActions, rowCount, }, } = table;
1062
1108
  const { pagination: { pageSize = 10, pageIndex = 0 }, showGlobalFilter, } = getState();
1063
1109
  const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
@@ -1075,14 +1121,14 @@ const MRT_TablePagination = ({ table, position }) => {
1075
1121
  enableToolbarInternalActions &&
1076
1122
  !showGlobalFilter
1077
1123
  ? '3.5rem'
1078
- : '-0.25rem', position: 'relative', zIndex: 2 }, ((tablePaginationProps === null || tablePaginationProps === void 0 ? void 0 : tablePaginationProps.sx) instanceof Function
1124
+ : undefined, position: 'relative', zIndex: 2 }, ((tablePaginationProps === null || tablePaginationProps === void 0 ? void 0 : tablePaginationProps.sx) instanceof Function
1079
1125
  ? tablePaginationProps.sx(theme)
1080
1126
  : tablePaginationProps === null || tablePaginationProps === void 0 ? void 0 : tablePaginationProps.sx))) })));
1081
1127
  };
1082
1128
 
1083
1129
  const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
1084
1130
  var _a, _b;
1085
- const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { localization, muiToolbarAlertBannerProps, muiToolbarAlertBannerChipProps, }, } = table;
1131
+ const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { localization, muiToolbarAlertBannerProps, muiToolbarAlertBannerChipProps, positionToolbarAlertBanner, }, } = table;
1086
1132
  const { grouping, showAlertBanner } = getState();
1087
1133
  const alertProps = muiToolbarAlertBannerProps instanceof Function
1088
1134
  ? muiToolbarAlertBannerProps({ table })
@@ -1100,7 +1146,11 @@ const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
1100
1146
  index > 0 ? localization.thenBy : '',
1101
1147
  React.createElement(Chip, Object.assign({ label: table.getColumn(columnId).columnDef.header, onDelete: () => table.getColumn(columnId).toggleGrouping() }, chipProps))))))) : null;
1102
1148
  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
1149
+ 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
1150
+ ? 0
1151
+ : positionToolbarAlertBanner === 'bottom'
1152
+ ? '-1rem'
1153
+ : undefined, right: 0, top: 0, width: '100%', zIndex: 2 }, ((alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx) instanceof Function
1104
1154
  ? alertProps.sx(theme)
1105
1155
  : alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx))) }),
1106
1156
  (alertProps === null || alertProps === void 0 ? void 0 : alertProps.title) && React.createElement(AlertTitle, null, alertProps.title),
@@ -1172,16 +1222,16 @@ const MRT_ToggleGlobalFilterButton = (_a) => {
1172
1222
  var _b;
1173
1223
  var { table } = _a, rest = __rest(_a, ["table"]);
1174
1224
  const { getState, options: { icons: { SearchIcon, SearchOffIcon }, localization, }, refs: { searchInputRef }, setShowGlobalFilter, } = table;
1175
- const { showGlobalFilter } = getState();
1225
+ const { globalFilter, showGlobalFilter } = getState();
1176
1226
  const handleToggleSearch = () => {
1177
1227
  setShowGlobalFilter(!showGlobalFilter);
1178
1228
  queueMicrotask(() => { var _a; return (_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); });
1179
1229
  };
1180
1230
  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))));
1231
+ React.createElement(IconButton, Object.assign({ disabled: !!globalFilter, onClick: handleToggleSearch }, rest, { title: undefined }), showGlobalFilter ? React.createElement(SearchOffIcon, null) : React.createElement(SearchIcon, null))));
1182
1232
  };
1183
1233
 
1184
- const MRT_ToolbarInternalButtons = ({ table }) => {
1234
+ const MRT_ToolbarInternalButtons = ({ table, }) => {
1185
1235
  var _a;
1186
1236
  const { options: { enableColumnFilters, enableColumnOrdering, enableDensityToggle, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, enablePinning, initialState, renderToolbarInternalActions, }, } = table;
1187
1237
  return (React.createElement(Box, { sx: {
@@ -1229,6 +1279,7 @@ const commonToolbarStyles = ({ theme }) => ({
1229
1279
  backgroundColor: lighten(theme.palette.background.default, 0.04),
1230
1280
  backgroundImage: 'none',
1231
1281
  display: 'grid',
1282
+ flexWrap: 'wrap-reverse',
1232
1283
  minHeight: '3.5rem',
1233
1284
  overflow: 'hidden',
1234
1285
  p: '0 !important',
@@ -1267,7 +1318,11 @@ const MRT_TopToolbar = ({ table }) => {
1267
1318
  width: '100%',
1268
1319
  } },
1269
1320
  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' } },
1321
+ enableToolbarInternalActions ? (React.createElement(Box, { sx: {
1322
+ display: 'flex',
1323
+ flexWrap: 'wrap-reverse',
1324
+ justifyContent: 'flex-end',
1325
+ } },
1271
1326
  enableGlobalFilter && positionGlobalFilter === 'right' && (React.createElement(MRT_GlobalFilterTextField, { table: table })),
1272
1327
  React.createElement(MRT_ToolbarInternalButtons, { table: table }))) : (enableGlobalFilter &&
1273
1328
  positionGlobalFilter === 'right' && (React.createElement(MRT_GlobalFilterTextField, { table: table })))),
@@ -1290,14 +1345,14 @@ const MRT_BottomToolbar = ({ table }) => {
1290
1345
  // @ts-ignore
1291
1346
  toolbarProps.ref.current = ref;
1292
1347
  }
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
1348
+ }, 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
1349
  ? toolbarProps.sx(theme)
1295
1350
  : toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx))) }),
1296
1351
  React.createElement(MRT_LinearProgressBar, { isTopToolbar: false, table: table }),
1297
- positionToolbarAlertBanner === 'bottom' && (React.createElement(MRT_ToolbarAlertBanner, { table: table })),
1352
+ positionToolbarAlertBanner === 'bottom' && (React.createElement(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })),
1298
1353
  ['both', 'bottom'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (React.createElement(MRT_ToolbarDropZone, { table: table })),
1299
1354
  React.createElement(Box, { sx: {
1300
- alignItems: 'flex-start',
1355
+ alignItems: 'center',
1301
1356
  boxSizing: 'border-box',
1302
1357
  display: 'flex',
1303
1358
  justifyContent: 'space-between',
@@ -1446,8 +1501,10 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
1446
1501
  setAnchorEl(event.currentTarget);
1447
1502
  };
1448
1503
  useEffect(() => {
1449
- setFilterValue('');
1450
- }, [columnDef._filterFn]);
1504
+ if (column.getFilterValue() === undefined) {
1505
+ handleClear();
1506
+ }
1507
+ }, [column.getFilterValue()]);
1451
1508
  if (columnDef.Filter) {
1452
1509
  return React.createElement(React.Fragment, null, (_e = columnDef.Filter) === null || _e === void 0 ? void 0 : _e.call(columnDef, { column, header, table }));
1453
1510
  }
@@ -1505,7 +1562,11 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
1505
1562
  if (textFieldProps.inputRef) {
1506
1563
  textFieldProps.inputRef = inputRef;
1507
1564
  }
1508
- }, sx: (theme) => (Object.assign({ p: 0, minWidth: !filterChipLabel ? '120px' : 'auto', width: '100%', '& .MuiSelect-icon': {
1565
+ }, sx: (theme) => (Object.assign({ p: 0, minWidth: columnDef.filterVariant === 'range'
1566
+ ? '90px'
1567
+ : !filterChipLabel
1568
+ ? '120px'
1569
+ : 'auto', width: '100%', '& .MuiSelect-icon': {
1509
1570
  mr: '1.5rem',
1510
1571
  } }, ((textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx) instanceof Function
1511
1572
  ? textFieldProps.sx(theme)
@@ -1533,7 +1594,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
1533
1594
  isMultiSelectFilter && (React.createElement(Checkbox, { checked: ((_a = column.getFilterValue()) !== null && _a !== void 0 ? _a : []).includes(value), sx: { mr: '0.5rem' } })),
1534
1595
  text));
1535
1596
  })),
1536
- React.createElement(MRT_FilterOptionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table })));
1597
+ React.createElement(MRT_FilterOptionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table, setFilterValue: setFilterValue })));
1537
1598
  };
1538
1599
 
1539
1600
  const MRT_FilterRangeFields = ({ header, table }) => {
@@ -1555,11 +1616,8 @@ const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
1555
1616
  const { options: { icons: { FilterAltIcon }, localization, }, } = table;
1556
1617
  const { column } = header;
1557
1618
  const { columnDef } = column;
1558
- const isRangeFilter = [
1559
- 'between',
1560
- 'betweenInclusive',
1561
- 'inNumberRange',
1562
- ].includes(columnDef._filterFn);
1619
+ const isRangeFilter = columnDef.filterVariant === 'range' ||
1620
+ ['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn);
1563
1621
  const currentFilterOption = columnDef._filterFn;
1564
1622
  const filterTooltip = localization.filteringByColumn
1565
1623
  .replace('{column}', String(columnDef.header))
@@ -1571,8 +1629,8 @@ const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
1571
1629
  ? column.getFilterValue().join(`" ${isRangeFilter ? localization.and : localization.or} "`)
1572
1630
  : column.getFilterValue()}"`)
1573
1631
  .replace('" "', '');
1574
- return (React.createElement(Grow, { unmountOnExit: true, in: (!!column.getFilterValue() && isRangeFilter) ||
1575
- (!isRangeFilter && // @ts-ignore
1632
+ return (React.createElement(Grow, { unmountOnExit: true, in: (!!column.getFilterValue() && !isRangeFilter) ||
1633
+ (isRangeFilter && // @ts-ignore
1576
1634
  (!!((_b = column.getFilterValue()) === null || _b === void 0 ? void 0 : _b[0]) || !!((_c = column.getFilterValue()) === null || _c === void 0 ? void 0 : _c[1]))) },
1577
1635
  React.createElement("span", null,
1578
1636
  React.createElement(Tooltip, { arrow: true, placement: "top", title: filterTooltip },
@@ -1589,7 +1647,7 @@ const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
1589
1647
  };
1590
1648
 
1591
1649
  const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
1592
- const { getState, options: { enableColumnOrdering, muiTableHeadCellDragHandleProps, onColumnDrop, }, setColumnOrder, setDraggingColumn, setHoveredColumn, } = table;
1650
+ const { getState, options: { enableColumnOrdering, muiTableHeadCellDragHandleProps }, setColumnOrder, setDraggingColumn, setHoveredColumn, } = table;
1593
1651
  const { columnDef } = column;
1594
1652
  const { hoveredColumn, draggingColumn, columnOrder } = getState();
1595
1653
  const mIconButtonProps = muiTableHeadCellDragHandleProps instanceof Function
@@ -1599,16 +1657,15 @@ const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
1599
1657
  ? columnDef.muiTableHeadCellDragHandleProps({ column, table })
1600
1658
  : columnDef.muiTableHeadCellDragHandleProps;
1601
1659
  const iconButtonProps = Object.assign(Object.assign({}, mIconButtonProps), mcIconButtonProps);
1602
- const handleDragStart = (e) => {
1660
+ const handleDragStart = (event) => {
1661
+ var _a;
1662
+ (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
1603
1663
  setDraggingColumn(column);
1604
- e.dataTransfer.setDragImage(tableHeadCellRef.current, 0, 0);
1664
+ event.dataTransfer.setDragImage(tableHeadCellRef.current, 0, 0);
1605
1665
  };
1606
1666
  const handleDragEnd = (event) => {
1607
- onColumnDrop === null || onColumnDrop === void 0 ? void 0 : onColumnDrop({
1608
- event,
1609
- draggedColumn: column,
1610
- targetColumn: hoveredColumn,
1611
- });
1667
+ var _a;
1668
+ (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
1612
1669
  if ((hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
1613
1670
  column.toggleGrouping();
1614
1671
  }
@@ -1676,7 +1733,7 @@ const MRT_TableHeadCellSortLabel = ({ header, table }) => {
1676
1733
  const MRT_TableHeadCell = ({ header, table }) => {
1677
1734
  var _a, _b, _c, _d;
1678
1735
  const theme = useTheme();
1679
- const { getState, options: { enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnResizing, enableGrouping, enableMultiSort, muiTableHeadCellProps, }, setHoveredColumn, } = table;
1736
+ const { getState, options: { enableColumnActions, enableColumnDragging, enableColumnOrdering, enableGrouping, enableMultiSort, muiTableHeadCellProps, }, setHoveredColumn, } = table;
1680
1737
  const { density, draggingColumn, grouping, hoveredColumn, showColumnFilters, } = getState();
1681
1738
  const { column } = header;
1682
1739
  const { columnDef } = column;
@@ -1688,16 +1745,6 @@ const MRT_TableHeadCell = ({ header, table }) => {
1688
1745
  ? columnDef.muiTableHeadCellProps({ column, table })
1689
1746
  : columnDef.muiTableHeadCellProps;
1690
1747
  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
1748
  const handleDragEnter = (_e) => {
1702
1749
  if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
1703
1750
  setHoveredColumn(null);
@@ -1726,44 +1773,33 @@ const MRT_TableHeadCell = ({ header, table }) => {
1726
1773
  })
1727
1774
  : columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header)) !== null && _b !== void 0 ? _b : columnDef.header);
1728
1775
  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
- } }),
1776
+ 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'
1777
+ ? '0.5rem'
1778
+ : density === 'comfortable'
1779
+ ? columnDefType === 'display'
1780
+ ? '0.75rem'
1781
+ : '1rem'
1782
+ : columnDefType === 'display'
1783
+ ? '1rem 1.25rem'
1784
+ : '1.5rem', pb: columnDefType === 'display'
1785
+ ? 0
1786
+ : showColumnFilters || density === 'compact'
1787
+ ? '0.4rem'
1788
+ : '0.6rem', pt: columnDefType === 'group' || density === 'compact'
1789
+ ? '0.25rem'
1790
+ : density === 'comfortable'
1791
+ ? '.75rem'
1792
+ : '1.25rem', userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top', zIndex: column.getIsResizing() || (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
1793
+ ? 3
1794
+ : column.getIsPinned() && columnDefType !== 'group'
1795
+ ? 2
1796
+ : 1 }, getCommonCellStyles({
1797
+ column,
1798
+ header,
1799
+ table,
1800
+ tableCellProps,
1801
+ theme,
1802
+ })), draggingBorders)) }),
1767
1803
  header.isPlaceholder ? null : (React.createElement(Box, { sx: {
1768
1804
  alignItems: 'flex-start',
1769
1805
  display: 'flex',
@@ -1818,11 +1854,13 @@ const MRT_TableHeadRow = ({ headerGroup, table }) => {
1818
1854
  };
1819
1855
 
1820
1856
  const MRT_TableHead = ({ table }) => {
1821
- const { getHeaderGroups, options: { muiTableHeadProps }, } = table;
1857
+ const { getHeaderGroups, options: { enableStickyHeader, muiTableHeadProps }, } = table;
1822
1858
  const tableHeadProps = muiTableHeadProps instanceof Function
1823
1859
  ? muiTableHeadProps({ table })
1824
1860
  : muiTableHeadProps;
1825
- return (React.createElement(TableHead, Object.assign({}, tableHeadProps), getHeaderGroups().map((headerGroup) => (React.createElement(MRT_TableHeadRow, { headerGroup: headerGroup, key: headerGroup.id, table: table })))));
1861
+ 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
1862
+ ? tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx(theme)
1863
+ : tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx))) }), getHeaderGroups().map((headerGroup) => (React.createElement(MRT_TableHeadRow, { headerGroup: headerGroup, key: headerGroup.id, table: table })))));
1826
1864
  };
1827
1865
 
1828
1866
  const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
@@ -1918,28 +1956,27 @@ const MRT_CopyButton = ({ cell, children, table, }) => {
1918
1956
  };
1919
1957
 
1920
1958
  const MRT_TableBodyRowGrabHandle = ({ cell, rowRef, table, }) => {
1921
- const { options: { muiTableBodyRowDragHandleProps, onRowDrop }, } = table;
1959
+ const { options: { muiTableBodyRowDragHandleProps }, } = table;
1922
1960
  const { row } = cell;
1923
1961
  const iconButtonProps = muiTableBodyRowDragHandleProps instanceof Function
1924
1962
  ? muiTableBodyRowDragHandleProps({ row, table })
1925
1963
  : muiTableBodyRowDragHandleProps;
1926
- const handleDragStart = (e) => {
1927
- e.dataTransfer.setDragImage(rowRef.current, 0, 0);
1964
+ const handleDragStart = (event) => {
1965
+ var _a;
1966
+ (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
1967
+ event.dataTransfer.setDragImage(rowRef.current, 0, 0);
1928
1968
  table.setDraggingRow(row);
1929
1969
  };
1930
1970
  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
- });
1971
+ var _a;
1972
+ (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
1936
1973
  table.setDraggingRow(null);
1937
1974
  table.setHoveredRow(null);
1938
1975
  };
1939
1976
  return (React.createElement(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
1940
1977
  };
1941
1978
 
1942
- const MRT_TableBodyCellValue = ({ cell, table }) => {
1979
+ const _MRT_TableBodyCellValue = ({ cell, table }) => {
1943
1980
  var _a, _b;
1944
1981
  const { column, row } = cell;
1945
1982
  const { columnDef } = column;
@@ -1961,6 +1998,7 @@ const MRT_TableBodyCellValue = ({ cell, table }) => {
1961
1998
  })
1962
1999
  : (_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
2000
  };
2001
+ const MRT_TableBodyCellValue = memo(_MRT_TableBodyCellValue, (prev, next) => prev.cell.getValue() === next.cell.getValue());
1964
2002
 
1965
2003
  const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
1966
2004
  var _a, _b;
@@ -1977,6 +2015,9 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
1977
2015
  ? columnDef.muiTableBodyCellProps({ cell, table })
1978
2016
  : columnDef.muiTableBodyCellProps;
1979
2017
  const tableCellProps = Object.assign(Object.assign({}, mTableCellBodyProps), mcTableCellBodyProps);
2018
+ const skeletonProps = muiTableBodyCellSkeletonProps instanceof Function
2019
+ ? muiTableBodyCellSkeletonProps({ cell, column, row, table })
2020
+ : muiTableBodyCellSkeletonProps;
1980
2021
  const isEditable = (enableEditing || columnDef.enableEditing) &&
1981
2022
  columnDef.enableEditing !== false;
1982
2023
  const isEditing = isEditable &&
@@ -2007,16 +2048,6 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
2007
2048
  });
2008
2049
  }
2009
2050
  };
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
2051
  const handleDragEnter = (e) => {
2021
2052
  var _a;
2022
2053
  (_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onDragEnter) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, e);
@@ -2045,53 +2076,34 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
2045
2076
  : undefined,
2046
2077
  }
2047
2078
  : 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'
2079
+ 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'
2080
+ ? columnDefType === 'display'
2081
+ ? '0 0.5rem'
2082
+ : '0.5rem'
2083
+ : density === 'comfortable'
2061
2084
  ? 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 &&
2085
+ ? '0.5rem 0.75rem'
2086
+ : '1rem'
2087
+ : columnDefType === 'display'
2088
+ ? '1rem 1.25rem'
2089
+ : '1.5rem', pl: column.id === 'mrt-row-expand'
2090
+ ? `${row.depth +
2091
+ (density === 'compact'
2092
+ ? 0.5
2093
+ : density === 'comfortable'
2094
+ ? 0.75
2095
+ : 1.25)}rem`
2096
+ : 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': {
2097
+ backgroundColor: enableHover &&
2098
+ enableEditing &&
2099
+ columnDef.enableEditing !== false &&
2100
+ ['table', 'cell'].includes(editingMode !== null && editingMode !== void 0 ? editingMode : '')
2101
+ ? theme.palette.mode === 'dark'
2102
+ ? `${lighten(theme.palette.background.default, 0.2)} !important`
2103
+ : `${darken(theme.palette.background.default, 0.1)} !important`
2104
+ : undefined,
2105
+ } }, getCommonCellStyles({ column, table, theme, tableCellProps })), draggingBorders)) }),
2106
+ React.createElement(React.Fragment, null, cell.getIsPlaceholder() ? null : isLoading || showSkeletons ? (React.createElement(Skeleton, Object.assign({ animation: "wave", height: 20, width: skeletonWidth }, skeletonProps))) : enableRowNumbers &&
2095
2107
  rowNumberMode === 'static' &&
2096
2108
  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
2109
  (column.id === 'mrt-row-select' ||
@@ -2161,9 +2173,10 @@ const MRT_TableBodyRow = ({ row, rowIndex, table, virtualRow, }) => {
2161
2173
  renderDetailPanel && !row.getIsGrouped() && (React.createElement(MRT_TableDetailPanel, { row: row, table: table }))));
2162
2174
  };
2163
2175
 
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();
2176
+ const MRT_TableBody = ({ table }) => {
2177
+ var _a;
2178
+ const { getRowModel, getPrePaginationRowModel, getState, options: { enableGlobalFilterRankedResults, enablePagination, enableRowVirtualization, localization, manualFiltering, manualSorting, muiTableBodyProps, virtualizerInstanceRef, virtualizerProps, }, refs: { tableContainerRef, tablePaperRef }, } = table;
2179
+ const { columnFilters, globalFilter, pagination, sorting } = getState();
2167
2180
  const tableBodyProps = muiTableBodyProps instanceof Function
2168
2181
  ? muiTableBodyProps({ table })
2169
2182
  : muiTableBodyProps;
@@ -2228,7 +2241,18 @@ const MRT_TableBody = ({ table, tableContainerRef }) => {
2228
2241
  // ? virtualizer.getTotalSize() - virtualRows[virtualRows.length - 1].end
2229
2242
  // : 0;
2230
2243
  // }
2231
- return (React.createElement(TableBody, Object.assign({}, tableBodyProps),
2244
+ return (React.createElement(TableBody, Object.assign({}, tableBodyProps), !rows.length ? (React.createElement("tr", null,
2245
+ React.createElement("td", { colSpan: table.getVisibleLeafColumns().length },
2246
+ React.createElement(Typography, { sx: {
2247
+ color: 'text.secondary',
2248
+ fontStyle: 'italic',
2249
+ maxWidth: `min(100vw, ${(_a = tablePaperRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth}px)`,
2250
+ py: '2rem',
2251
+ textAlign: 'center',
2252
+ width: '100%',
2253
+ } }, globalFilter || columnFilters.length
2254
+ ? localization.noResultsFound
2255
+ : localization.noRecordsToDisplay)))) : (React.createElement(React.Fragment, null,
2232
2256
  enableRowVirtualization && paddingTop > 0 && (React.createElement("tr", null,
2233
2257
  React.createElement("td", { style: { height: `${paddingTop}px` } }))),
2234
2258
  (enableRowVirtualization ? virtualRows : rows).map((rowOrVirtualRow, rowIndex) => {
@@ -2238,12 +2262,12 @@ const MRT_TableBody = ({ table, tableContainerRef }) => {
2238
2262
  return (React.createElement(MRT_TableBodyRow, { key: row.id, row: row, rowIndex: enableRowVirtualization ? rowOrVirtualRow.index : rowIndex, table: table, virtualRow: enableRowVirtualization ? rowOrVirtualRow : null }));
2239
2263
  }),
2240
2264
  enableRowVirtualization && paddingBottom > 0 && (React.createElement("tr", null,
2241
- React.createElement("td", { style: { height: `${paddingBottom}px` } })))));
2265
+ React.createElement("td", { style: { height: `${paddingBottom}px` } })))))));
2242
2266
  };
2243
2267
 
2244
2268
  const MRT_TableFooterCell = ({ footer, table }) => {
2245
2269
  var _a, _b, _c;
2246
- const { getState, options: { muiTableFooterCellProps, enableColumnResizing }, } = table;
2270
+ const { getState, options: { muiTableFooterCellProps }, } = table;
2247
2271
  const { density } = getState();
2248
2272
  const { column } = footer;
2249
2273
  const { columnDef } = column;
@@ -2255,13 +2279,11 @@ const MRT_TableFooterCell = ({ footer, table }) => {
2255
2279
  ? columnDef.muiTableFooterCellProps({ column, table })
2256
2280
  : columnDef.muiTableFooterCellProps;
2257
2281
  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'
2282
+ 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
2283
  ? '0.5rem'
2260
2284
  : density === 'comfortable'
2261
2285
  ? '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))) }),
2286
+ : '1.5rem', verticalAlign: 'top' }, getCommonCellStyles({ column, table, theme, tableCellProps }))) }),
2265
2287
  React.createElement(React.Fragment, null, footer.isPlaceholder
2266
2288
  ? null
2267
2289
  : (_c = (_b = (columnDef.Footer instanceof Function
@@ -2294,16 +2316,16 @@ const MRT_TableFooter = ({ table }) => {
2294
2316
  ? muiTableFooterProps({ table })
2295
2317
  : muiTableFooterProps;
2296
2318
  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
2319
+ 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
2320
  ? theme.palette.mode === 'light'
2299
2321
  ? `1px solid ${theme.palette.grey[300]}`
2300
2322
  : `1px solid ${theme.palette.grey[700]}`
2301
- : undefined }, ((tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx) instanceof Function
2323
+ : undefined, position: stickFooter ? 'sticky' : undefined }, ((tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx) instanceof Function
2302
2324
  ? tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx(theme)
2303
2325
  : tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx))) }), getFooterGroups().map((footerGroup) => (React.createElement(MRT_TableFooterRow, { footerGroup: footerGroup, key: footerGroup.id, table: table })))));
2304
2326
  };
2305
2327
 
2306
- const MRT_Table = ({ tableContainerRef, table }) => {
2328
+ const MRT_Table = ({ table }) => {
2307
2329
  const { getState, options: { enableColumnResizing, enableRowVirtualization, enableStickyHeader, enableTableFooter, enableTableHead, muiTableProps, }, } = table;
2308
2330
  const { isFullScreen } = getState();
2309
2331
  const tableProps = muiTableProps instanceof Function
@@ -2313,7 +2335,7 @@ const MRT_Table = ({ tableContainerRef, table }) => {
2313
2335
  ? tableProps.sx(theme)
2314
2336
  : tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx))) }),
2315
2337
  enableTableHead && React.createElement(MRT_TableHead, { table: table }),
2316
- React.createElement(MRT_TableBody, { tableContainerRef: tableContainerRef, table: table }),
2338
+ React.createElement(MRT_TableBody, { table: table }),
2317
2339
  enableTableFooter && React.createElement(MRT_TableFooter, { table: table })));
2318
2340
  };
2319
2341
 
@@ -2348,31 +2370,42 @@ const MRT_TableContainer = ({ table }) => {
2348
2370
  : tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx))), style: Object.assign({ maxHeight: isFullScreen
2349
2371
  ? `calc(100vh - ${totalToolbarHeight}px)`
2350
2372
  : undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style) }),
2351
- React.createElement(MRT_Table, { tableContainerRef: tableContainerRef, table: table })));
2373
+ React.createElement(MRT_Table, { table: table })));
2352
2374
  };
2353
2375
 
2354
2376
  const MRT_TablePaper = ({ table }) => {
2355
- const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps }, } = table;
2377
+ const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps, renderBottomToolbar, renderTopToolbar, }, refs: { tablePaperRef }, } = table;
2356
2378
  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
2379
  const tablePaperProps = muiTablePaperProps instanceof Function
2368
2380
  ? muiTablePaperProps({ table })
2369
2381
  : 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
2382
+ return (React.createElement(Paper, Object.assign({ elevation: 2 }, tablePaperProps, { ref: (ref) => {
2383
+ tablePaperRef.current = ref;
2384
+ if (tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.ref) {
2385
+ //@ts-ignore
2386
+ tablePaperProps.ref.current = ref;
2387
+ }
2388
+ }, sx: (theme) => (Object.assign({ transition: 'all 0.2s ease-in-out' }, ((tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx) instanceof Function
2371
2389
  ? 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 }),
2390
+ : tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx))), style: Object.assign(Object.assign({}, tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style), (isFullScreen
2391
+ ? {
2392
+ height: '100vh',
2393
+ margin: 0,
2394
+ maxHeight: '100vh',
2395
+ maxWidth: '100vw',
2396
+ padding: 0,
2397
+ width: '100vw',
2398
+ }
2399
+ : {})) }),
2400
+ enableTopToolbar &&
2401
+ (renderTopToolbar instanceof Function
2402
+ ? renderTopToolbar({ table })
2403
+ : renderTopToolbar !== null && renderTopToolbar !== void 0 ? renderTopToolbar : React.createElement(MRT_TopToolbar, { table: table })),
2374
2404
  React.createElement(MRT_TableContainer, { table: table }),
2375
- enableBottomToolbar && React.createElement(MRT_BottomToolbar, { table: table })));
2405
+ enableBottomToolbar &&
2406
+ (renderBottomToolbar instanceof Function
2407
+ ? renderBottomToolbar({ table })
2408
+ : renderBottomToolbar !== null && renderBottomToolbar !== void 0 ? renderBottomToolbar : React.createElement(MRT_BottomToolbar, { table: table }))));
2376
2409
  };
2377
2410
 
2378
2411
  const MRT_EditRowModal = ({ open, row, table, }) => {
@@ -2400,6 +2433,7 @@ const MRT_TableRoot = (props) => {
2400
2433
  const filterInputRefs = useRef({});
2401
2434
  const searchInputRef = useRef(null);
2402
2435
  const tableContainerRef = useRef(null);
2436
+ const tablePaperRef = useRef(null);
2403
2437
  const topToolbarRef = useRef(null);
2404
2438
  const initialState = useMemo(() => {
2405
2439
  var _a, _b;
@@ -2435,14 +2469,14 @@ const MRT_TableRoot = (props) => {
2435
2469
  const [showColumnFilters, setShowFilters] = useState((_p = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _p !== void 0 ? _p : false);
2436
2470
  const [showGlobalFilter, setShowGlobalFilter] = useState((_q = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _q !== void 0 ? _q : false);
2437
2471
  const displayColumns = useMemo(() => {
2438
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
2472
+ var _a, _b, _c, _d, _e;
2439
2473
  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' }),
2474
+ 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' }),
2475
+ 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
2476
  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' }),
2477
+ 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' }),
2478
+ 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' }),
2479
+ 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
2480
  ].filter(Boolean);
2447
2481
  }, [
2448
2482
  columnOrder,
@@ -2520,22 +2554,39 @@ const MRT_TableRoot = (props) => {
2520
2554
  filterInputRefs,
2521
2555
  searchInputRef,
2522
2556
  tableContainerRef,
2557
+ tablePaperRef,
2523
2558
  topToolbarRef,
2524
2559
  }, 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
2560
  if (props.tableInstanceRef) {
2526
2561
  props.tableInstanceRef.current = table;
2527
2562
  }
2563
+ const initialBodyHeight = useRef();
2564
+ useEffect(() => {
2565
+ if (typeof window !== 'undefined') {
2566
+ initialBodyHeight.current = document.body.style.height;
2567
+ }
2568
+ }, []);
2569
+ useEffect(() => {
2570
+ if (typeof window !== 'undefined') {
2571
+ if (table.getState().isFullScreen) {
2572
+ document.body.style.height = '100vh';
2573
+ }
2574
+ else {
2575
+ document.body.style.height = initialBodyHeight.current;
2576
+ }
2577
+ }
2578
+ }, [table.getState().isFullScreen]);
2528
2579
  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 },
2580
+ React.createElement(Dialog, { PaperComponent: Box, TransitionComponent: Grow, disablePortal: true, fullScreen: true, keepMounted: false, onClose: () => table.setIsFullScreen(false), open: table.getState().isFullScreen, transitionDuration: 400 },
2530
2581
  React.createElement(MRT_TablePaper, { table: table })),
2531
- !isFullScreen && React.createElement(MRT_TablePaper, { table: table }),
2582
+ !table.getState().isFullScreen && (React.createElement(MRT_TablePaper, { table: table })),
2532
2583
  editingRow && props.editingMode === 'modal' && (React.createElement(MRT_EditRowModal, { row: editingRow, table: table, open: true }))));
2533
2584
  };
2534
2585
 
2535
2586
  var MaterialReactTable = (_a) => {
2536
2587
  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)));
2588
+ 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
2589
  };
2539
2590
 
2540
- export { MRT_CopyButton, MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_ShowHideColumnsButton, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MaterialReactTable as default };
2591
+ export { MRT_CopyButton, MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_ShowHideColumnsButton, MRT_TablePagination, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MRT_ToolbarInternalButtons, MaterialReactTable as default };
2541
2592
  //# sourceMappingURL=material-react-table.esm.js.map