material-react-table 2.0.0-alpha.4 → 2.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/cjs/index.js +447 -418
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/icons.d.ts +1 -1
  4. package/dist/cjs/types/locales/hy.d.ts +2 -0
  5. package/dist/cjs/types/toolbar/MRT_ToolbarAlertBanner.d.ts +1 -1
  6. package/dist/cjs/types/types.d.ts +16 -11
  7. package/dist/esm/material-react-table.esm.js +420 -391
  8. package/dist/esm/material-react-table.esm.js.map +1 -1
  9. package/dist/esm/types/icons.d.ts +1 -1
  10. package/dist/esm/types/locales/hy.d.ts +2 -0
  11. package/dist/esm/types/toolbar/MRT_ToolbarAlertBanner.d.ts +1 -1
  12. package/dist/esm/types/types.d.ts +16 -11
  13. package/dist/index.d.ts +18 -13
  14. package/locales/hy.d.ts +2 -0
  15. package/locales/hy.esm.d.ts +2 -0
  16. package/locales/hy.esm.js +93 -0
  17. package/locales/hy.esm.js.map +1 -0
  18. package/locales/hy.js +97 -0
  19. package/locales/hy.js.map +1 -0
  20. package/package.json +7 -7
  21. package/src/body/MRT_TableBody.tsx +13 -21
  22. package/src/body/MRT_TableBodyCell.tsx +2 -2
  23. package/src/body/MRT_TableBodyRow.tsx +3 -3
  24. package/src/body/MRT_TableDetailPanel.tsx +3 -3
  25. package/src/buttons/MRT_GrabHandleButton.tsx +1 -2
  26. package/src/buttons/MRT_ShowHideColumnsButton.tsx +1 -2
  27. package/src/buttons/MRT_ToggleDensePaddingButton.tsx +1 -2
  28. package/src/buttons/MRT_ToggleFiltersButton.tsx +1 -2
  29. package/src/buttons/MRT_ToggleFullScreenButton.tsx +2 -3
  30. package/src/column.utils.ts +15 -9
  31. package/src/footer/MRT_TableFooter.tsx +1 -1
  32. package/src/footer/MRT_TableFooterCell.tsx +1 -1
  33. package/src/footer/MRT_TableFooterRow.tsx +2 -2
  34. package/src/head/MRT_TableHead.tsx +36 -14
  35. package/src/head/MRT_TableHeadCell.tsx +1 -1
  36. package/src/head/MRT_TableHeadRow.tsx +2 -2
  37. package/src/hooks/useMRT_TableOptions.ts +7 -2
  38. package/src/icons.ts +3 -3
  39. package/src/locales/hy.ts +93 -0
  40. package/src/table/MRT_Table.tsx +4 -2
  41. package/src/toolbar/MRT_TablePagination.tsx +24 -14
  42. package/src/toolbar/MRT_ToolbarAlertBanner.tsx +53 -15
  43. package/src/toolbar/MRT_TopToolbar.tsx +1 -1
  44. package/src/types.ts +20 -15
@@ -1,6 +1,6 @@
1
1
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
2
  import Paper from '@mui/material/Paper';
3
- import { useState, memo, useEffect, useMemo, useRef, useCallback, useLayoutEffect, Fragment as Fragment$1, useReducer } from 'react';
3
+ import { useState, memo, useEffect, useMemo, useRef, useCallback, Fragment as Fragment$1, useLayoutEffect, useReducer } from 'react';
4
4
  import TableContainer from '@mui/material/TableContainer';
5
5
  import { useVirtualizer, defaultRangeExtractor } from '@tanstack/react-virtual';
6
6
  import Table from '@mui/material/Table';
@@ -39,11 +39,6 @@ import Popover from '@mui/material/Popover';
39
39
  import Divider from '@mui/material/Divider';
40
40
  import Badge from '@mui/material/Badge';
41
41
  import TableSortLabel from '@mui/material/TableSortLabel';
42
- import Dialog from '@mui/material/Dialog';
43
- import DialogActions from '@mui/material/DialogActions';
44
- import DialogContent from '@mui/material/DialogContent';
45
- import DialogTitle from '@mui/material/DialogTitle';
46
- import CircularProgress from '@mui/material/CircularProgress';
47
42
  import Toolbar from '@mui/material/Toolbar';
48
43
  import useMediaQuery from '@mui/material/useMediaQuery';
49
44
  import LinearProgress from '@mui/material/LinearProgress';
@@ -53,13 +48,18 @@ import PaginationItem from '@mui/material/PaginationItem';
53
48
  import Select from '@mui/material/Select';
54
49
  import Alert from '@mui/material/Alert';
55
50
  import AlertTitle from '@mui/material/AlertTitle';
51
+ import Radio from '@mui/material/Radio';
56
52
  import Fade from '@mui/material/Fade';
57
53
  import Switch from '@mui/material/Switch';
58
- import Radio from '@mui/material/Radio';
54
+ import Dialog from '@mui/material/Dialog';
55
+ import DialogActions from '@mui/material/DialogActions';
56
+ import DialogContent from '@mui/material/DialogContent';
57
+ import DialogTitle from '@mui/material/DialogTitle';
58
+ import CircularProgress from '@mui/material/CircularProgress';
59
59
  import ArrowDownwardIcon from '@mui/icons-material/ArrowDownward';
60
60
  import ArrowRightIcon from '@mui/icons-material/ArrowRight';
61
61
  import CancelIcon from '@mui/icons-material/Cancel';
62
- import ChevronLefIcon from '@mui/icons-material/ChevronLeft';
62
+ import ChevronLeftIcon from '@mui/icons-material/ChevronLeft';
63
63
  import ChevronRightIcon from '@mui/icons-material/ChevronRight';
64
64
  import ClearAllIcon from '@mui/icons-material/ClearAll';
65
65
  import CloseIcon from '@mui/icons-material/Close';
@@ -325,19 +325,24 @@ const getCanRankRows = (table) => {
325
325
  };
326
326
  const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
327
327
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
328
+ const { options: { layoutMode }, } = table;
328
329
  const widthStyles = {
329
330
  minWidth: `max(calc(var(--${header ? 'header' : 'col'}-${parseCSSVarId((_a = header === null || header === void 0 ? void 0 : header.id) !== null && _a !== void 0 ? _a : column.id)}-size) * 1px), ${(_b = column.columnDef.minSize) !== null && _b !== void 0 ? _b : 30}px)`,
330
331
  width: `calc(var(--${header ? 'header' : 'col'}-${parseCSSVarId((_c = header === null || header === void 0 ? void 0 : header.id) !== null && _c !== void 0 ? _c : column.id)}-size) * 1px)`,
331
332
  };
333
+ if (layoutMode === 'grid') {
334
+ widthStyles.flex = `var(--${header ? 'header' : 'col'}-${parseCSSVarId((_d = header === null || header === void 0 ? void 0 : header.id) !== null && _d !== void 0 ? _d : column.id)}-size) 0 auto`;
335
+ }
336
+ else if (layoutMode === 'grid-no-grow') {
337
+ widthStyles.flex = '0 0 auto';
338
+ }
332
339
  return Object.assign(Object.assign(Object.assign({ backgroundColor: column.getIsPinned() && column.columnDef.columnDefType !== 'group'
333
340
  ? alpha(lighten(theme.palette.background.default, 0.04), 0.97)
334
341
  : 'inherit', backgroundImage: 'inherit', boxShadow: getIsLastLeftPinnedColumn(table, column)
335
342
  ? `-4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
336
343
  : getIsFirstRightPinnedColumn(column)
337
344
  ? `4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
338
- : undefined, display: table.options.layoutMode === 'grid' ? 'flex' : 'table-cell', flex: table.options.layoutMode === 'grid'
339
- ? `var(--${header ? 'header' : 'col'}-${parseCSSVarId((_d = header === null || header === void 0 ? void 0 : header.id) !== null && _d !== void 0 ? _d : column.id)}-size) 0 auto`
340
- : undefined, left: column.getIsPinned() === 'left'
345
+ : undefined, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, left: column.getIsPinned() === 'left'
341
346
  ? `${column.getStart('left')}px`
342
347
  : undefined, ml: table.options.enableColumnVirtualization &&
343
348
  column.getIsPinned() === 'left' &&
@@ -650,7 +655,7 @@ const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, ta
650
655
  : undefined,
651
656
  outlineOffset: '-1px',
652
657
  textOverflow: 'clip',
653
- }, alignItems: layoutMode === 'grid' ? 'center' : undefined, cursor: isEditable && editDisplayMode === 'cell' ? 'pointer' : 'inherit', justifyContent: layoutMode === 'grid' ? tableCellProps.align : undefined, overflow: 'hidden', p: density === 'compact'
658
+ }, alignItems: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'center' : undefined, cursor: isEditable && editDisplayMode === 'cell' ? 'pointer' : 'inherit', justifyContent: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? tableCellProps.align : undefined, overflow: 'hidden', p: density === 'compact'
654
659
  ? columnDefType === 'display'
655
660
  ? '0 0.5rem'
656
661
  : '0.5rem'
@@ -703,14 +708,14 @@ const MRT_TableDetailPanel = ({ parentRowRef, row, rowIndex, table, virtualRow,
703
708
  });
704
709
  return (jsx(TableRow, Object.assign({ className: "Mui-TableBodyCell-DetailPanel" }, tableRowProps, { sx: (theme) => {
705
710
  var _a, _b;
706
- return (Object.assign({ display: layoutMode === 'grid' ? 'flex' : 'table-row', position: virtualRow ? 'absolute' : undefined, top: virtualRow
711
+ return (Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, position: virtualRow ? 'absolute' : undefined, top: virtualRow
707
712
  ? `${(_b = (_a = parentRowRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.height}px`
708
713
  : undefined, transform: virtualRow
709
714
  ? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
710
715
  : undefined, width: '100%', zIndex: virtualRow ? 2 : undefined }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme)));
711
716
  }, children: jsx(TableCell, Object.assign({ className: "Mui-TableBodyCell-DetailPanel", colSpan: getVisibleLeafColumns().length }, tableCellProps, { sx: (theme) => (Object.assign({ backgroundColor: virtualRow
712
- ? lighten(theme.palette.background.default, 0.06)
713
- : undefined, borderBottom: !row.getIsExpanded() ? 'none' : undefined, display: layoutMode === 'grid' ? 'flex' : 'table-cell', pb: row.getIsExpanded() ? '1rem' : 0, pt: row.getIsExpanded() ? '1rem' : 0, transition: 'all 150ms ease-in-out', width: `${table.getTotalSize()}px` }, parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme))), children: renderDetailPanel && (jsx(Collapse, { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true, children: !isLoading && renderDetailPanel({ row, table }) })) })) })));
717
+ ? lighten(theme.palette.background.default, 0.05)
718
+ : undefined, borderBottom: !row.getIsExpanded() ? 'none' : undefined, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : 'table-cell', pb: row.getIsExpanded() ? '1rem' : 0, pt: row.getIsExpanded() ? '1rem' : 0, transition: 'all 150ms ease-in-out', width: `${table.getTotalSize()}px` }, parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme))), children: renderDetailPanel && (jsx(Collapse, { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true, children: !isLoading && renderDetailPanel({ row, table }) })) })) })));
714
719
  };
715
720
 
716
721
  const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRowIds, row, rowIndex, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, virtualRow, }) => {
@@ -765,10 +770,10 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRo
765
770
  ? `${lighten(theme.palette.background.default, 0.12)}`
766
771
  : `${darken(theme.palette.background.default, 0.05)}`
767
772
  : undefined,
768
- }, backgroundColor: `${lighten(theme.palette.background.default, 0.06)} !important`, bottom: !virtualRow && bottomPinnedIndex !== undefined && isPinned
773
+ }, backgroundColor: `${lighten(theme.palette.background.default, 0.05)} !important`, bottom: !virtualRow && bottomPinnedIndex !== undefined && isPinned
769
774
  ? `${bottomPinnedIndex * rowHeight +
770
775
  (enableStickyFooter ? tableFooterHeight - 1 : 0)}px`
771
- : undefined, boxSizing: 'border-box', display: layoutMode === 'grid' ? 'flex' : 'table-row', opacity: isPinned
776
+ : undefined, boxSizing: 'border-box', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, opacity: isPinned
772
777
  ? 0.98
773
778
  : (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id || (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id
774
779
  ? 0.5
@@ -788,7 +793,7 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRo
788
793
  ? `${topPinnedIndex * rowHeight +
789
794
  (enableStickyHeader || isFullScreen ? tableHeadHeight - 1 : 0)}px`
790
795
  : undefined, transition: virtualRow ? 'none' : 'all 150ms ease-in-out', width: '100%', zIndex: (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) && isPinned
791
- ? 1
796
+ ? 2
792
797
  : undefined }, sx)), children: [virtualPaddingLeft ? (jsx("td", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : row.getVisibleCells()).map((cellOrVirtualCell) => {
793
798
  const cell = columnVirtualizer
794
799
  ? row.getVisibleCells()[cellOrVirtualCell.index]
@@ -831,7 +836,7 @@ const rankGlobalFuzzy = (rowA, rowB) => Math.max(...Object.values(rowB.columnFil
831
836
  const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
832
837
  var _a, _b, _c, _d, _e, _f;
833
838
  const { getBottomRows, getCenterRows, getIsSomeRowsPinned, getPrePaginationRowModel, getRowModel, getState, getTopRows, options: { enableGlobalFilterRankedResults, enablePagination, enableRowPinning, enableRowVirtualization, enableStickyFooter, enableStickyHeader, layoutMode, localization, manualExpanding, manualFiltering, manualGrouping, manualPagination, manualSorting, memoMode, muiTableBodyProps, renderEmptyRowsFallback, rowPinningDisplayMode, rowVirtualizerInstanceRef, rowVirtualizerOptions, }, refs: { tableContainerRef, tableFooterRef, tableHeadRef, tablePaperRef }, } = table;
834
- const { columnFilters, density, expanded, globalFilter, globalFilterFn, isFullScreen, pagination, rowPinning, sorting, } = getState();
839
+ const { columnFilters, density, expanded, globalFilter, isFullScreen, pagination, rowPinning, sorting, } = getState();
835
840
  const tableBodyProps = parseFromValuesOrFunc(muiTableBodyProps, { table });
836
841
  const rowVirtualizerProps = parseFromValuesOrFunc(rowVirtualizerOptions, {
837
842
  table,
@@ -840,16 +845,9 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
840
845
  ((_a = tableHeadRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight)) ||
841
846
  0;
842
847
  const tableFooterHeight = (enableStickyFooter && ((_b = tableFooterRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight)) || 0;
843
- const shouldRankResults = useMemo(() => !manualExpanding &&
844
- !manualFiltering &&
845
- !manualGrouping &&
846
- !manualSorting &&
847
- enableGlobalFilterRankedResults &&
848
- globalFilter &&
849
- globalFilterFn === 'fuzzy' &&
850
- expanded !== true &&
848
+ const shouldRankRows = useMemo(() => getCanRankRows(table) &&
851
849
  !Object.values(sorting).some(Boolean) &&
852
- !Object.values(expanded).some(Boolean), [
850
+ globalFilter, [
853
851
  enableGlobalFilterRankedResults,
854
852
  expanded,
855
853
  globalFilter,
@@ -864,7 +862,7 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
864
862
  .map((r) => r.id), [rowPinning, table.getRowModel().rows]);
865
863
  const rows = useMemo(() => {
866
864
  let rows = [];
867
- if (!shouldRankResults) {
865
+ if (!shouldRankRows) {
868
866
  rows =
869
867
  !enableRowPinning || (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky'))
870
868
  ? getRowModel().rows
@@ -886,8 +884,8 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
886
884
  }
887
885
  return rows;
888
886
  }, [
889
- shouldRankResults,
890
- shouldRankResults ? getPrePaginationRowModel().rows : getRowModel().rows,
887
+ shouldRankRows,
888
+ shouldRankRows ? getPrePaginationRowModel().rows : getRowModel().rows,
891
889
  pagination.pageIndex,
892
890
  pagination.pageSize,
893
891
  rowPinning,
@@ -905,7 +903,7 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
905
903
  ? rowVirtualizer.getVirtualItems()
906
904
  : undefined;
907
905
  return (jsxs(Fragment, { children: [!(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
908
- getIsSomeRowsPinned('top') && (jsx(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', position: 'sticky', top: tableHeadHeight - 1, zIndex: 1 }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: getTopRows().map((row, rowIndex) => {
906
+ getIsSomeRowsPinned('top') && (jsx(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, position: 'sticky', top: tableHeadHeight - 1, zIndex: 1 }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: getTopRows().map((row, rowIndex) => {
909
907
  const props = {
910
908
  columnVirtualizer,
911
909
  measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
@@ -918,10 +916,10 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
918
916
  virtualPaddingRight,
919
917
  };
920
918
  return memoMode === 'rows' ? (jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
921
- }) }))), jsx(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', height: rowVirtualizer
919
+ }) }))), jsx(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, height: rowVirtualizer
922
920
  ? `${rowVirtualizer.getTotalSize()}px`
923
- : 'inherit', minHeight: !rows.length ? '100px' : undefined, position: 'relative' }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: (_c = tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.children) !== null && _c !== void 0 ? _c : (!rows.length ? (jsx("tr", { style: { display: layoutMode === 'grid' ? 'grid' : 'table-row' }, children: jsx("td", { colSpan: table.getVisibleLeafColumns().length, style: {
924
- display: layoutMode === 'grid' ? 'grid' : 'table-cell',
921
+ : 'inherit', minHeight: !rows.length ? '100px' : undefined, position: 'relative' }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: (_c = tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.children) !== null && _c !== void 0 ? _c : (!rows.length ? (jsx("tr", { style: { display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined }, children: jsx("td", { colSpan: table.getVisibleLeafColumns().length, style: {
922
+ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : 'table-cell',
925
923
  }, children: (_d = renderEmptyRowsFallback === null || renderEmptyRowsFallback === void 0 ? void 0 : renderEmptyRowsFallback({ table })) !== null && _d !== void 0 ? _d : (jsx(Typography, { sx: {
926
924
  color: 'text.secondary',
927
925
  fontStyle: 'italic',
@@ -952,7 +950,7 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
952
950
  };
953
951
  return memoMode === 'rows' ? (jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
954
952
  }) }))) })), !(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
955
- getIsSomeRowsPinned('bottom') && (jsx(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ bottom: tableFooterHeight - 1, display: layoutMode === 'grid' ? 'grid' : 'table-row-group', position: 'sticky', zIndex: 1 }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: getBottomRows().map((row, rowIndex) => {
953
+ getIsSomeRowsPinned('bottom') && (jsx(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ bottom: tableFooterHeight - 1, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, position: 'sticky', zIndex: 1 }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: getBottomRows().map((row, rowIndex) => {
956
954
  const props = {
957
955
  columnVirtualizer,
958
956
  measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
@@ -980,7 +978,7 @@ const MRT_TableFooterCell = ({ footer, table, }) => {
980
978
  column,
981
979
  table,
982
980
  }));
983
- return (jsx(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: footer.colSpan, variant: "head" }, tableCellProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-cell', fontWeight: 'bold', justifyContent: columnDefType === 'group' ? 'center' : undefined, p: density === 'compact'
981
+ return (jsx(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: footer.colSpan, variant: "head" }, tableCellProps, { sx: (theme) => (Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : 'table-cell', fontWeight: 'bold', justifyContent: columnDefType === 'group' ? 'center' : undefined, p: density === 'compact'
984
982
  ? '0.5rem'
985
983
  : density === 'comfortable'
986
984
  ? '1rem'
@@ -1006,7 +1004,7 @@ const MRT_TableFooterRow = ({ footerGroup, table, virtualColumns, virtualPadding
1006
1004
  footerGroup,
1007
1005
  table,
1008
1006
  });
1009
- return (jsxs(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.04), display: layoutMode === 'grid' ? 'flex' : 'table-row', width: '100%' }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme))), children: [virtualPaddingLeft ? (jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : footerGroup.headers).map((footerOrVirtualFooter) => {
1007
+ return (jsxs(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.05), display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, width: '100%' }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme))), children: [virtualPaddingLeft ? (jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : footerGroup.headers).map((footerOrVirtualFooter) => {
1010
1008
  const footer = virtualColumns
1011
1009
  ? footerGroup.headers[footerOrVirtualFooter.index]
1012
1010
  : footerOrVirtualFooter;
@@ -1027,7 +1025,7 @@ const MRT_TableFooter = ({ table, virtualColumns, virtualPaddingLeft, virtualPad
1027
1025
  // @ts-ignore
1028
1026
  tableFooterProps.ref.current = ref;
1029
1027
  }
1030
- }, sx: (theme) => (Object.assign({ bottom: stickFooter ? 0 : undefined, display: layoutMode === 'grid' ? 'grid' : 'table-row-group', opacity: stickFooter ? 0.97 : undefined, outline: stickFooter
1028
+ }, sx: (theme) => (Object.assign({ bottom: stickFooter ? 0 : undefined, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, opacity: stickFooter ? 0.97 : undefined, outline: stickFooter
1031
1029
  ? theme.palette.mode === 'light'
1032
1030
  ? `1px solid ${theme.palette.grey[300]}`
1033
1031
  : `1px solid ${theme.palette.grey[700]}`
@@ -1945,7 +1943,7 @@ const MRT_TableHeadCell = ({ header, table, }) => {
1945
1943
  if (node) {
1946
1944
  tableHeadCellRefs.current[column.id] = node;
1947
1945
  }
1948
- } }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ flexDirection: layoutMode === 'grid' ? 'column' : undefined, fontWeight: 'bold', overflow: 'visible', p: density === 'compact'
1946
+ } }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ flexDirection: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'column' : undefined, fontWeight: 'bold', overflow: 'visible', p: density === 'compact'
1949
1947
  ? '0.5rem'
1950
1948
  : density === 'comfortable'
1951
1949
  ? columnDefType === 'display'
@@ -2012,7 +2010,7 @@ const MRT_TableHeadRow = ({ headerGroup, table, virtualColumns, virtualPaddingLe
2012
2010
  headerGroup,
2013
2011
  table,
2014
2012
  });
2015
- return (jsxs(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.04), boxShadow: `4px 0 8px ${alpha(theme.palette.common.black, 0.1)}`, display: layoutMode === 'grid' ? 'flex' : 'table-row', top: 0 }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme))), children: [virtualPaddingLeft ? (jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : headerGroup.headers).map((headerOrVirtualHeader) => {
2013
+ return (jsxs(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.05), boxShadow: `4px 0 8px ${alpha(theme.palette.common.black, 0.1)}`, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, top: 0 }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme))), children: [virtualPaddingLeft ? (jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : headerGroup.headers).map((headerOrVirtualHeader) => {
2016
2014
  const header = virtualColumns
2017
2015
  ? headerGroup.headers[headerOrVirtualHeader.index]
2018
2016
  : headerOrVirtualHeader;
@@ -2020,208 +2018,6 @@ const MRT_TableHeadRow = ({ headerGroup, table, virtualColumns, virtualPaddingLe
2020
2018
  }), virtualPaddingRight ? (jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
2021
2019
  };
2022
2020
 
2023
- const MRT_TableHead = ({ table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
2024
- const { getHeaderGroups, getState, options: { enableStickyHeader, layoutMode, muiTableHeadProps }, refs: { tableHeadRef }, } = table;
2025
- const { isFullScreen } = getState();
2026
- const tableHeadProps = parseFromValuesOrFunc(muiTableHeadProps, { table });
2027
- const stickyHeader = enableStickyHeader || isFullScreen;
2028
- return (jsx(TableHead, Object.assign({}, tableHeadProps, { ref: (ref) => {
2029
- tableHeadRef.current = ref;
2030
- if (tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.ref) {
2031
- // @ts-ignore
2032
- tableHeadProps.ref.current = ref;
2033
- }
2034
- }, sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', opacity: 0.97, position: stickyHeader ? 'sticky' : 'relative', top: stickyHeader && layoutMode === 'grid' ? 0 : undefined, zIndex: stickyHeader ? 2 : undefined }, parseFromValuesOrFunc(tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx, theme))), children: getHeaderGroups().map((headerGroup) => (jsx(MRT_TableHeadRow, { headerGroup: headerGroup, table: table, virtualColumns: virtualColumns, virtualPaddingLeft: virtualPaddingLeft, virtualPaddingRight: virtualPaddingRight }, headerGroup.id))) })));
2035
- };
2036
-
2037
- const MRT_Table = ({ table, }) => {
2038
- var _a, _b, _c, _d;
2039
- const { getFlatHeaders, getState, options: { columnVirtualizerInstanceRef, columnVirtualizerOptions, columns, enableColumnPinning, enableColumnResizing, enableColumnVirtualization, enableStickyHeader, enableTableFooter, enableTableHead, layoutMode, memoMode, muiTableProps, }, refs: { tableContainerRef }, } = table;
2040
- const { columnPinning, columnSizing, columnSizingInfo, columnVisibility, isFullScreen, } = getState();
2041
- const tableProps = parseFromValuesOrFunc(muiTableProps, { table });
2042
- const columnVirtualizerProps = parseFromValuesOrFunc(columnVirtualizerOptions, { table });
2043
- const columnSizeVars = useMemo(() => {
2044
- const headers = getFlatHeaders();
2045
- const colSizes = {};
2046
- for (let i = 0; i < headers.length; i++) {
2047
- const header = headers[i];
2048
- const colSize = header.getSize();
2049
- colSizes[`--header-${parseCSSVarId(header.id)}-size`] = colSize;
2050
- colSizes[`--col-${parseCSSVarId(header.column.id)}-size`] = colSize;
2051
- }
2052
- return colSizes;
2053
- }, [columns, columnSizing, columnSizingInfo, columnVisibility]);
2054
- //get first 16 column widths and average them
2055
- const averageColumnWidth = useMemo(() => {
2056
- var _a, _b, _c, _d;
2057
- if (!enableColumnVirtualization)
2058
- return 0;
2059
- const columnsWidths = (_d = (_c = (_b = (_a = table
2060
- .getRowModel()
2061
- .rows[0]) === null || _a === void 0 ? void 0 : _a.getCenterVisibleCells()) === null || _b === void 0 ? void 0 : _b.slice(0, 16)) === null || _c === void 0 ? void 0 : _c.map((cell) => cell.column.getSize() * 1.2)) !== null && _d !== void 0 ? _d : [];
2062
- return columnsWidths.reduce((a, b) => a + b, 0) / columnsWidths.length;
2063
- }, [table.getRowModel().rows, columnPinning, columnVisibility]);
2064
- const [leftPinnedIndexes, rightPinnedIndexes] = useMemo(() => enableColumnVirtualization && enableColumnPinning
2065
- ? [
2066
- table.getLeftLeafColumns().map((c) => c.getPinnedIndex()),
2067
- table
2068
- .getRightLeafColumns()
2069
- .map((c) => table.getVisibleLeafColumns().length - c.getPinnedIndex() - 1),
2070
- ]
2071
- : [[], []], [columnPinning, enableColumnVirtualization, enableColumnPinning]);
2072
- const columnVirtualizer = enableColumnVirtualization
2073
- ? useVirtualizer(Object.assign({ count: table.getVisibleLeafColumns().length, estimateSize: () => averageColumnWidth, getScrollElement: () => tableContainerRef.current, horizontal: true, overscan: 3, rangeExtractor: useCallback((range) => [
2074
- ...new Set([
2075
- ...leftPinnedIndexes,
2076
- ...defaultRangeExtractor(range),
2077
- ...rightPinnedIndexes,
2078
- ]),
2079
- ], [leftPinnedIndexes, rightPinnedIndexes]) }, columnVirtualizerProps))
2080
- : undefined;
2081
- if (columnVirtualizerInstanceRef && columnVirtualizer) {
2082
- columnVirtualizerInstanceRef.current = columnVirtualizer;
2083
- }
2084
- const virtualColumns = columnVirtualizer
2085
- ? columnVirtualizer.getVirtualItems()
2086
- : undefined;
2087
- let virtualPaddingLeft;
2088
- let virtualPaddingRight;
2089
- if (columnVirtualizer && (virtualColumns === null || virtualColumns === void 0 ? void 0 : virtualColumns.length)) {
2090
- virtualPaddingLeft = (_b = (_a = virtualColumns[leftPinnedIndexes.length]) === null || _a === void 0 ? void 0 : _a.start) !== null && _b !== void 0 ? _b : 0;
2091
- virtualPaddingRight =
2092
- columnVirtualizer.getTotalSize() -
2093
- ((_d = (_c = virtualColumns[virtualColumns.length - 1 - rightPinnedIndexes.length]) === null || _c === void 0 ? void 0 : _c.end) !== null && _d !== void 0 ? _d : 0);
2094
- }
2095
- const props = {
2096
- table,
2097
- virtualColumns,
2098
- virtualPaddingLeft,
2099
- virtualPaddingRight,
2100
- };
2101
- return (jsx(Fragment, { children: jsxs(Table, Object.assign({ stickyHeader: enableStickyHeader || isFullScreen }, tableProps, { style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style), sx: (theme) => (Object.assign({ borderCollapse: 'separate', display: layoutMode === 'grid' ? 'grid' : 'table', tableLayout: layoutMode !== 'grid' && enableColumnResizing ? 'fixed' : undefined }, parseFromValuesOrFunc(tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx, theme))), children: [enableTableHead && jsx(MRT_TableHead, Object.assign({}, props)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsx(Memo_MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))) : (jsx(MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))), enableTableFooter && jsx(MRT_TableFooter, Object.assign({}, props))] })) }));
2102
- };
2103
-
2104
- const MRT_EditActionButtons = ({ row, table, variant = 'icon', }) => {
2105
- const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onCreatingRowCancel, onCreatingRowSave, onEditingRowCancel, onEditingRowSave, }, refs: { editInputRefs }, setCreatingRow, setEditingRow, } = table;
2106
- const { creatingRow, editingRow, isSaving } = getState();
2107
- const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
2108
- const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
2109
- const handleCancel = () => {
2110
- if (isCreating) {
2111
- onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
2112
- setCreatingRow(null);
2113
- }
2114
- else if (isEditing) {
2115
- onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
2116
- setEditingRow(null);
2117
- }
2118
- row._valuesCache = {}; //reset values cache
2119
- };
2120
- const handleSubmitRow = () => {
2121
- var _a;
2122
- //look for auto-filled input values
2123
- (_a = Object.values(editInputRefs === null || editInputRefs === void 0 ? void 0 : editInputRefs.current)
2124
- .filter((inputRef) => { var _a, _b; return row.id === ((_b = (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.name) === null || _a === void 0 ? void 0 : _a.split('_')) === null || _b === void 0 ? void 0 : _b[0]); })) === null || _a === void 0 ? void 0 : _a.forEach((input) => {
2125
- if (input.value !== undefined &&
2126
- Object.hasOwn(row === null || row === void 0 ? void 0 : row._valuesCache, input.name)) {
2127
- // @ts-ignore
2128
- row._valuesCache[input.name] = input.value;
2129
- }
2130
- });
2131
- if (isCreating)
2132
- onCreatingRowSave === null || onCreatingRowSave === void 0 ? void 0 : onCreatingRowSave({
2133
- exitCreatingMode: () => setCreatingRow(null),
2134
- row,
2135
- table,
2136
- values: row._valuesCache,
2137
- });
2138
- else if (isEditing) {
2139
- onEditingRowSave === null || onEditingRowSave === void 0 ? void 0 : onEditingRowSave({
2140
- exitEditingMode: () => setEditingRow(null),
2141
- row,
2142
- table,
2143
- values: row === null || row === void 0 ? void 0 : row._valuesCache,
2144
- });
2145
- }
2146
- };
2147
- return (jsx(Box, { onClick: (e) => e.stopPropagation(), sx: { display: 'flex', gap: '0.75rem' }, children: variant === 'icon' ? (jsxs(Fragment, { children: [jsx(Tooltip, { arrow: true, title: localization.cancel, children: jsx(IconButton, { "aria-label": localization.cancel, onClick: handleCancel, children: jsx(CancelIcon, {}) }) }), jsx(Tooltip, { arrow: true, title: localization.save, children: jsx(IconButton, { "aria-label": localization.save, color: "info", onClick: handleSubmitRow, children: isSaving ? jsx(CircularProgress, { size: 18 }) : jsx(SaveIcon, {}) }) })] })) : (jsxs(Fragment, { children: [jsx(Button, { onClick: handleCancel, sx: { minWidth: '100px' }, children: localization.cancel }), jsxs(Button, { onClick: handleSubmitRow, sx: { minWidth: '100px' }, variant: "contained", children: [isSaving && jsx(CircularProgress, { color: "inherit", size: 18 }), localization.save] })] })) }));
2148
- };
2149
-
2150
- const MRT_EditRowModal = ({ open, table, }) => {
2151
- var _a;
2152
- const { getState, options: { localization, muiCreateRowModalProps, muiEditRowModalProps, onCreatingRowCancel, onEditingRowCancel, renderCreateRowModalContent, renderEditRowModalContent, }, setCreatingRow, setEditingRow, } = table;
2153
- const { creatingRow, editingRow } = getState();
2154
- const row = (creatingRow !== null && creatingRow !== void 0 ? creatingRow : editingRow);
2155
- const dialogProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditRowModalProps, { row, table })), (creatingRow &&
2156
- parseFromValuesOrFunc(muiCreateRowModalProps, { row, table })));
2157
- const internalEditComponents = row
2158
- .getAllCells()
2159
- .filter((cell) => cell.column.columnDef.columnDefType === 'data')
2160
- .map((cell) => (jsx(MRT_EditCellTextField, { cell: cell, table: table }, cell.id)));
2161
- return (jsx(Dialog, Object.assign({ fullWidth: true, maxWidth: "xs", onClose: (event, reason) => {
2162
- var _a;
2163
- if (creatingRow) {
2164
- onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
2165
- setCreatingRow(null);
2166
- }
2167
- else {
2168
- onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
2169
- setEditingRow(null);
2170
- }
2171
- row._valuesCache = {}; //reset values cache
2172
- (_a = dialogProps.onClose) === null || _a === void 0 ? void 0 : _a.call(dialogProps, event, reason);
2173
- }, open: open }, dialogProps, { children: (_a = ((creatingRow &&
2174
- (renderCreateRowModalContent === null || renderCreateRowModalContent === void 0 ? void 0 : renderCreateRowModalContent({
2175
- internalEditComponents,
2176
- row,
2177
- table,
2178
- }))) ||
2179
- (renderEditRowModalContent === null || renderEditRowModalContent === void 0 ? void 0 : renderEditRowModalContent({
2180
- internalEditComponents,
2181
- row,
2182
- table,
2183
- })))) !== null && _a !== void 0 ? _a : (jsxs(Fragment, { children: [jsx(DialogTitle, { sx: { textAlign: 'center' }, children: localization.edit }), jsx(DialogContent, { children: jsx("form", { onSubmit: (e) => e.preventDefault(), children: jsx(Stack, { sx: {
2184
- gap: '24px',
2185
- paddingTop: '16px',
2186
- width: '100%',
2187
- }, children: internalEditComponents }) }) }), jsx(DialogActions, { sx: { p: '1.25rem' }, children: jsx(MRT_EditActionButtons, { row: row, table: table, variant: "text" }) })] })) })));
2188
- };
2189
-
2190
- const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
2191
- const MRT_TableContainer = ({ table, }) => {
2192
- const { getState, options: { createDisplayMode, editDisplayMode, enableStickyHeader, muiTableContainerProps, }, refs: { bottomToolbarRef, tableContainerRef, topToolbarRef }, } = table;
2193
- const { creatingRow, editingRow, isFullScreen } = getState();
2194
- const [totalToolbarHeight, setTotalToolbarHeight] = useState(0);
2195
- const tableContainerProps = parseFromValuesOrFunc(muiTableContainerProps, {
2196
- table,
2197
- });
2198
- useIsomorphicLayoutEffect(() => {
2199
- var _a, _b, _c, _d;
2200
- const topToolbarHeight = typeof document !== 'undefined'
2201
- ? (_b = (_a = topToolbarRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0
2202
- : 0;
2203
- const bottomToolbarHeight = typeof document !== 'undefined'
2204
- ? (_d = (_c = bottomToolbarRef === null || bottomToolbarRef === void 0 ? void 0 : bottomToolbarRef.current) === null || _c === void 0 ? void 0 : _c.offsetHeight) !== null && _d !== void 0 ? _d : 0
2205
- : 0;
2206
- setTotalToolbarHeight(topToolbarHeight + bottomToolbarHeight);
2207
- });
2208
- const createModalOpen = createDisplayMode === 'modal' && creatingRow;
2209
- const editModalOpen = editDisplayMode === 'modal' && editingRow;
2210
- return (jsxs(TableContainer, Object.assign({}, tableContainerProps, { ref: (node) => {
2211
- if (node) {
2212
- tableContainerRef.current = node;
2213
- if (tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.ref) {
2214
- //@ts-ignore
2215
- tableContainerProps.ref.current = node;
2216
- }
2217
- }
2218
- }, style: Object.assign({ maxHeight: isFullScreen
2219
- ? `calc(100vh - ${totalToolbarHeight}px)`
2220
- : undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style), sx: (theme) => (Object.assign({ maxHeight: enableStickyHeader
2221
- ? `clamp(350px, calc(100vh - ${totalToolbarHeight}px), 9999px)`
2222
- : undefined, maxWidth: '100%', overflow: 'auto' }, parseFromValuesOrFunc(tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx, theme))), children: [jsx(MRT_Table, { table: table }), (createModalOpen || editModalOpen) && (jsx(MRT_EditRowModal, { open: true, table: table }))] })));
2223
- };
2224
-
2225
2021
  const MRT_LinearProgressBar = ({ isTopToolbar, table, }) => {
2226
2022
  const { getState, options: { muiLinearProgressProps }, } = table;
2227
2023
  const { isLoading, showProgressBars } = getState();
@@ -2237,25 +2033,52 @@ const MRT_LinearProgressBar = ({ isTopToolbar, table, }) => {
2237
2033
  }, unmountOnExit: true, children: jsx(LinearProgress, Object.assign({ "aria-busy": "true", "aria-label": "Loading", sx: { position: 'relative' } }, linearProgressProps)) }));
2238
2034
  };
2239
2035
 
2240
- const defaultPageSizeOptions = [5, 10, 15, 20, 25, 30, 50, 100];
2036
+ /******************************************************************************
2037
+ Copyright (c) Microsoft Corporation.
2038
+
2039
+ Permission to use, copy, modify, and/or distribute this software for any
2040
+ purpose with or without fee is hereby granted.
2041
+
2042
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2043
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2044
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2045
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2046
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2047
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2048
+ PERFORMANCE OF THIS SOFTWARE.
2049
+ ***************************************************************************** */
2050
+ function __rest(s, e) {
2051
+ var t = {};
2052
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2053
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2054
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2055
+ }
2056
+ return t;
2057
+ }
2058
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
2059
+ var e = new Error(message);
2060
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
2061
+ };
2062
+
2063
+ const defaultRowsPerPage = [5, 10, 15, 20, 25, 30, 50, 100];
2241
2064
  const MRT_TablePagination = ({ position = 'bottom', table, }) => {
2242
- const { getPrePaginationRowModel, getState, options: { enableToolbarInternalActions, icons: { ChevronLefIcon, ChevronRightIcon, FirstPageIcon, LastPageIcon }, localization, muiTablePaginationProps, paginationDisplayMode, rowCount, }, setPageIndex, setPageSize, } = table;
2065
+ const { getPrePaginationRowModel, getState, options: { enableToolbarInternalActions, icons: { ChevronLeftIcon, ChevronRightIcon, FirstPageIcon, LastPageIcon }, localization, muiPaginationProps, paginationDisplayMode, rowCount, }, setPageIndex, setPageSize, } = table;
2243
2066
  const { pagination: { pageIndex = 0, pageSize = 10 }, showGlobalFilter, } = getState();
2244
- const paginationProps = parseFromValuesOrFunc(muiTablePaginationProps, {
2067
+ const paginationProps = parseFromValuesOrFunc(muiPaginationProps, {
2245
2068
  table,
2246
2069
  });
2247
2070
  const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
2248
2071
  const numberOfPages = Math.ceil(totalRowCount / pageSize);
2249
2072
  const showFirstLastPageButtons = numberOfPages > 2;
2250
- const showFirstButton = showFirstLastPageButtons && (paginationProps === null || paginationProps === void 0 ? void 0 : paginationProps.showFirstButton) !== false;
2251
- const showLastButton = showFirstLastPageButtons && (paginationProps === null || paginationProps === void 0 ? void 0 : paginationProps.showLastButton) !== false;
2252
2073
  const firstRowIndex = pageIndex * pageSize;
2253
2074
  const lastRowIndex = Math.min(pageIndex * pageSize + pageSize, totalRowCount);
2075
+ const _a = paginationProps !== null && paginationProps !== void 0 ? paginationProps : {}, { showRowsPerPage = true, rowsPerPageOptions = defaultRowsPerPage, showFirstButton = showFirstLastPageButtons, showLastButton = showFirstLastPageButtons } = _a, rest = __rest(_a, ["showRowsPerPage", "rowsPerPageOptions", "showFirstButton", "showLastButton"]);
2254
2076
  return (jsxs(Box, { sx: {
2255
2077
  alignItems: 'center',
2256
2078
  display: 'flex',
2257
2079
  gap: '8px',
2258
2080
  justifyContent: 'space-between',
2081
+ justifySelf: 'flex-end',
2259
2082
  mt: position === 'top' &&
2260
2083
  enableToolbarInternalActions &&
2261
2084
  !showGlobalFilter
@@ -2265,33 +2088,147 @@ const MRT_TablePagination = ({ position = 'bottom', table, }) => {
2265
2088
  px: '4px',
2266
2089
  py: '12px',
2267
2090
  zIndex: 2,
2268
- }, children: [(paginationProps === null || paginationProps === void 0 ? void 0 : paginationProps.showRowsPerPage) !== false && (jsxs(Box, { sx: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [jsx(InputLabel, { htmlFor: "mrt-rows-per-page", sx: { mb: 0 }, children: localization.rowsPerPage }), jsx(Select, { id: "mrt-rows-per-page", label: localization.rowsPerPage, onChange: (event) => setPageSize(+event.target.value), sx: { '&::before': { border: 'none' }, mb: 0 }, value: pageSize, variant: "standard", children: defaultPageSizeOptions.map((value) => (jsx(MenuItem, { sx: { m: 0 }, value: value, children: value }, value))) })] })), paginationDisplayMode === 'pages' ? (jsx(Pagination, Object.assign({ count: numberOfPages, onChange: (_e, newPageIndex) => setPageIndex(newPageIndex - 1), page: pageIndex + 1, renderItem: (item) => (jsx(PaginationItem, Object.assign({ slots: {
2091
+ }, children: [showRowsPerPage && (jsxs(Box, { sx: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [jsx(InputLabel, { htmlFor: "mrt-rows-per-page", sx: { mb: 0 }, children: localization.rowsPerPage }), jsx(Select, { inputProps: { 'aria-label': localization.rowsPerPage }, id: "mrt-rows-per-page", label: localization.rowsPerPage, onChange: (event) => setPageSize(+event.target.value), sx: { '&::before': { border: 'none' }, mb: 0 }, value: pageSize, variant: "standard", children: rowsPerPageOptions.map((value) => (jsx(MenuItem, { sx: { m: 0 }, value: value, children: value }, value))) })] })), paginationDisplayMode === 'pages' ? (jsx(Pagination, Object.assign({ count: numberOfPages, onChange: (_e, newPageIndex) => setPageIndex(newPageIndex - 1), page: pageIndex + 1, renderItem: (item) => (jsx(PaginationItem, Object.assign({ slots: {
2269
2092
  first: FirstPageIcon,
2270
2093
  last: LastPageIcon,
2271
2094
  next: ChevronRightIcon,
2272
- previous: ChevronLefIcon,
2273
- } }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton }, paginationProps))) : paginationDisplayMode === 'default' ? (jsxs(Fragment, { children: [jsx(Typography, { mb: "0", mx: "8px", variant: "body2", children: `${lastRowIndex === 0 ? 0 : (firstRowIndex + 1).toLocaleString()}-${lastRowIndex.toLocaleString()} ${localization.of} ${totalRowCount.toLocaleString()}` }), jsxs(Box, { gap: "xs", children: [showFirstButton && (jsx(IconButton, { "aria-label": localization.goToFirstPage, disabled: pageIndex <= 0, onClick: () => setPageIndex(0), size: "small", children: jsx(FirstPageIcon, {}) })), jsx(IconButton, { "aria-label": localization.goToPreviousPage, disabled: pageIndex <= 0, onClick: () => setPageIndex(pageIndex - 1), size: "small", children: jsx(ChevronLefIcon, {}) }), jsx(IconButton, { "aria-label": localization.goToNextPage, disabled: lastRowIndex >= totalRowCount, onClick: () => setPageIndex(pageIndex + 1), size: "small", children: jsx(ChevronRightIcon, {}) }), showLastButton && (jsx(IconButton, { "aria-label": localization.goToLastPage, disabled: lastRowIndex >= totalRowCount, onClick: () => setPageIndex(numberOfPages - 1), size: "small", children: jsx(LastPageIcon, {}) }))] })] })) : null] }));
2095
+ previous: ChevronLeftIcon,
2096
+ } }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton }, rest))) : paginationDisplayMode === 'default' ? (jsxs(Fragment, { children: [jsx(Typography, { sx: { mb: 0, mx: '4px', minWidth: '10ch' }, variant: "body2", children: `${lastRowIndex === 0 ? 0 : (firstRowIndex + 1).toLocaleString()}-${lastRowIndex.toLocaleString()} ${localization.of} ${totalRowCount.toLocaleString()}` }), jsxs(Box, { gap: "xs", children: [showFirstButton && (jsx(IconButton, { "aria-label": localization.goToFirstPage, disabled: pageIndex <= 0, onClick: () => setPageIndex(0), size: "small", children: jsx(FirstPageIcon, {}) })), jsx(IconButton, { "aria-label": localization.goToPreviousPage, disabled: pageIndex <= 0, onClick: () => setPageIndex(pageIndex - 1), size: "small", children: jsx(ChevronLeftIcon, {}) }), jsx(IconButton, { "aria-label": localization.goToNextPage, disabled: lastRowIndex >= totalRowCount, onClick: () => setPageIndex(pageIndex + 1), size: "small", children: jsx(ChevronRightIcon, {}) }), showLastButton && (jsx(IconButton, { "aria-label": localization.goToLastPage, disabled: lastRowIndex >= totalRowCount, onClick: () => setPageIndex(numberOfPages - 1), size: "small", children: jsx(LastPageIcon, {}) }))] })] })) : null] }));
2274
2097
  };
2275
2098
 
2276
- const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
2277
- var _a, _b;
2278
- const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { localization, muiToolbarAlertBannerChipProps, muiToolbarAlertBannerProps, positionToolbarAlertBanner, rowCount, }, } = table;
2279
- const { grouping, showAlertBanner } = getState();
2280
- const alertProps = parseFromValuesOrFunc(muiToolbarAlertBannerProps, {
2099
+ const MRT_GlobalFilterTextField = ({ table, }) => {
2100
+ var _a;
2101
+ const { getState, options: { enableGlobalFilterModes, icons: { CloseIcon, SearchIcon }, localization, manualFiltering, muiSearchTextFieldProps, }, refs: { searchInputRef }, setGlobalFilter, } = table;
2102
+ const { globalFilter, showGlobalFilter } = getState();
2103
+ const textFieldProps = parseFromValuesOrFunc(muiSearchTextFieldProps, {
2281
2104
  table,
2282
2105
  });
2283
- const chipProps = parseFromValuesOrFunc(muiToolbarAlertBannerChipProps, {
2284
- table,
2106
+ const isMounted = useRef(false);
2107
+ const [anchorEl, setAnchorEl] = useState(null);
2108
+ const [searchValue, setSearchValue] = useState(globalFilter !== null && globalFilter !== void 0 ? globalFilter : '');
2109
+ const handleChangeDebounced = useCallback(debounce((event) => {
2110
+ var _a;
2111
+ setGlobalFilter((_a = event.target.value) !== null && _a !== void 0 ? _a : undefined);
2112
+ }, manualFiltering ? 500 : 250), []);
2113
+ const handleChange = (event) => {
2114
+ setSearchValue(event.target.value);
2115
+ handleChangeDebounced(event);
2116
+ };
2117
+ const handleGlobalFilterMenuOpen = (event) => {
2118
+ setAnchorEl(event.currentTarget);
2119
+ };
2120
+ const handleClear = () => {
2121
+ setSearchValue('');
2122
+ setGlobalFilter(undefined);
2123
+ };
2124
+ useEffect(() => {
2125
+ if (isMounted.current) {
2126
+ if (globalFilter === undefined) {
2127
+ handleClear();
2128
+ }
2129
+ else {
2130
+ setSearchValue(globalFilter);
2131
+ }
2132
+ }
2133
+ isMounted.current = true;
2134
+ }, [globalFilter]);
2135
+ return (jsxs(Collapse, { in: showGlobalFilter, mountOnEnter: true, orientation: "horizontal", unmountOnExit: true, children: [jsx(TextField, Object.assign({ InputProps: {
2136
+ endAdornment: (jsx(InputAdornment, { position: "end", children: jsx(Tooltip, { arrow: true, title: (_a = localization.clearSearch) !== null && _a !== void 0 ? _a : '', children: jsx("span", { children: jsx(IconButton, { "aria-label": localization.clearSearch, disabled: !(searchValue === null || searchValue === void 0 ? void 0 : searchValue.length), onClick: handleClear, size: "small", children: jsx(CloseIcon, {}) }) }) }) })),
2137
+ startAdornment: enableGlobalFilterModes ? (jsx(InputAdornment, { position: "start", children: jsx(Tooltip, { arrow: true, title: localization.changeSearchMode, children: jsx(IconButton, { "aria-label": localization.changeSearchMode, onClick: handleGlobalFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' }, children: jsx(SearchIcon, {}) }) }) })) : (jsx(SearchIcon, { style: { marginRight: '4px' } })),
2138
+ }, onChange: handleChange, placeholder: localization.search, value: searchValue !== null && searchValue !== void 0 ? searchValue : '', variant: "standard" }, textFieldProps, { inputRef: (inputRef) => {
2139
+ searchInputRef.current = inputRef;
2140
+ if (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.inputRef) {
2141
+ textFieldProps.inputRef = inputRef;
2142
+ }
2143
+ } })), jsx(MRT_FilterOptionMenu, { anchorEl: anchorEl, onSelect: handleClear, setAnchorEl: setAnchorEl, table: table })] }));
2144
+ };
2145
+
2146
+ const MRT_SelectCheckbox = ({ row, selectAll, table, }) => {
2147
+ var _a;
2148
+ const { getState, options: { enableMultiRowSelection, enableRowPinning, localization, muiSelectAllCheckboxProps, muiSelectCheckboxProps, rowPinningDisplayMode, selectAllMode, }, } = table;
2149
+ const { density, isLoading } = getState();
2150
+ const checkboxProps = !row
2151
+ ? parseFromValuesOrFunc(muiSelectAllCheckboxProps, { table })
2152
+ : parseFromValuesOrFunc(muiSelectCheckboxProps, { row, table });
2153
+ const allRowsSelected = selectAll
2154
+ ? selectAllMode === 'page'
2155
+ ? table.getIsAllPageRowsSelected()
2156
+ : table.getIsAllRowsSelected()
2157
+ : undefined;
2158
+ const commonProps = Object.assign(Object.assign({ checked: selectAll ? allRowsSelected : row === null || row === void 0 ? void 0 : row.getIsSelected(), disabled: isLoading || (row && !row.getCanSelect()), inputProps: {
2159
+ 'aria-label': selectAll
2160
+ ? localization.toggleSelectAll
2161
+ : localization.toggleSelectRow,
2162
+ }, onChange: (event) => {
2163
+ event.stopPropagation();
2164
+ row
2165
+ ? row.getToggleSelectedHandler()(event)
2166
+ : selectAllMode === 'all'
2167
+ ? table.getToggleAllRowsSelectedHandler()(event)
2168
+ : table.getToggleAllPageRowsSelectedHandler()(event);
2169
+ if (enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('select'))) {
2170
+ if (row) {
2171
+ row.pin(!row.getIsPinned() && event.target.checked
2172
+ ? (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('bottom'))
2173
+ ? 'bottom'
2174
+ : 'top'
2175
+ : false);
2176
+ }
2177
+ else {
2178
+ table.setRowPinning({ bottom: [], top: [] });
2179
+ }
2180
+ }
2181
+ }, size: (density === 'compact' ? 'small' : 'medium') }, checkboxProps), { onClick: (e) => {
2182
+ var _a;
2183
+ e.stopPropagation();
2184
+ (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
2185
+ }, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.5rem', m: density !== 'compact' ? '-0.4rem' : undefined, width: density === 'compact' ? '1.75rem' : '2.5rem', zIndex: 0 }, parseFromValuesOrFunc(checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx, theme))), title: undefined });
2186
+ return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _a !== void 0 ? _a : (selectAll
2187
+ ? localization.toggleSelectAll
2188
+ : localization.toggleSelectRow), children: enableMultiRowSelection === false ? (jsx(Radio, Object.assign({}, commonProps))) : (jsx(Checkbox, Object.assign({ indeterminate: selectAll
2189
+ ? table.getIsSomeRowsSelected() && !allRowsSelected
2190
+ : row === null || row === void 0 ? void 0 : row.getIsSomeSelected() }, commonProps))) }));
2191
+ };
2192
+
2193
+ const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
2194
+ var _a, _b, _c;
2195
+ const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { enableRowSelection, enableSelectAll, localization, muiToolbarAlertBannerChipProps, muiToolbarAlertBannerProps, positionToolbarAlertBanner, renderToolbarAlertBannerContent, rowCount, }, refs: { tablePaperRef }, } = table;
2196
+ const { density, grouping, showAlertBanner } = getState();
2197
+ const alertProps = parseFromValuesOrFunc(muiToolbarAlertBannerProps, {
2198
+ table,
2199
+ });
2200
+ const chipProps = parseFromValuesOrFunc(muiToolbarAlertBannerChipProps, {
2201
+ table,
2285
2202
  });
2286
- const selectMessage = getSelectedRowModel().rows.length > 0
2203
+ const selectedAlert = getSelectedRowModel().rows.length > 0
2287
2204
  ? (_b = (_a = localization.selectedCountOfRowCountRowsSelected) === null || _a === void 0 ? void 0 : _a.replace('{selectedCount}', getSelectedRowModel().rows.length.toString())) === null || _b === void 0 ? void 0 : _b.replace('{rowCount}', (rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length).toString())
2288
2205
  : null;
2289
- const groupedByMessage = grouping.length > 0 ? (jsxs("span", { children: [localization.groupedBy, ' ', grouping.map((columnId, index) => (jsxs(Fragment$1, { children: [index > 0 ? localization.thenBy : '', jsx(Chip, Object.assign({ label: table.getColumn(columnId).columnDef.header, onDelete: () => table.getColumn(columnId).toggleGrouping() }, chipProps))] }, `${index}-${columnId}`)))] })) : null;
2290
- return (jsx(Collapse, { in: showAlertBanner || !!selectMessage || !!groupedByMessage, timeout: stackAlertBanner ? 200 : 0, children: jsxs(Alert, Object.assign({ color: "info", icon: false }, alertProps, { sx: (theme) => (Object.assign({ borderRadius: 0, fontSize: '1rem', left: 0, mb: stackAlertBanner
2291
- ? 0
2292
- : positionToolbarAlertBanner === 'bottom'
2293
- ? '-1rem'
2294
- : undefined, p: 0, position: 'relative', right: 0, top: 0, width: '100%', zIndex: 2 }, parseFromValuesOrFunc(alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx, theme))), children: [(alertProps === null || alertProps === void 0 ? void 0 : alertProps.title) && jsx(AlertTitle, { children: alertProps.title }), jsxs(Box, { sx: { p: '0.5rem 1rem' }, children: [alertProps === null || alertProps === void 0 ? void 0 : alertProps.children, (alertProps === null || alertProps === void 0 ? void 0 : alertProps.children) && (selectMessage || groupedByMessage) && (jsx("br", {})), selectMessage, selectMessage && groupedByMessage && jsx("br", {}), groupedByMessage] })] })) }));
2206
+ const groupedAlert = grouping.length > 0 ? (jsxs("span", { children: [localization.groupedBy, ' ', grouping.map((columnId, index) => (jsxs(Fragment$1, { children: [index > 0 ? localization.thenBy : '', jsx(Chip, Object.assign({ label: table.getColumn(columnId).columnDef.header, onDelete: () => table.getColumn(columnId).toggleGrouping() }, chipProps))] }, `${index}-${columnId}`)))] })) : null;
2207
+ return (jsx(Collapse, { in: showAlertBanner || !!selectedAlert || !!groupedAlert, timeout: stackAlertBanner ? 200 : 0, children: jsx(Alert, Object.assign({ color: "info", icon: false }, alertProps, { sx: (theme) => {
2208
+ var _a, _b;
2209
+ return (Object.assign({ '& .MuiAlert-message': {
2210
+ maxWidth: `calc(${(_b = (_a = tablePaperRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _b !== void 0 ? _b : 360}px - 1rem)`,
2211
+ width: '100%',
2212
+ }, borderRadius: 0, fontSize: '1rem', left: 0, mb: stackAlertBanner
2213
+ ? 0
2214
+ : positionToolbarAlertBanner === 'bottom'
2215
+ ? '-1rem'
2216
+ : undefined, p: 0, position: 'relative', right: 0, top: 0, width: '100%', zIndex: 2 }, parseFromValuesOrFunc(alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx, theme)));
2217
+ }, children: (_c = renderToolbarAlertBannerContent === null || renderToolbarAlertBannerContent === void 0 ? void 0 : renderToolbarAlertBannerContent({
2218
+ groupedAlert,
2219
+ selectedAlert,
2220
+ table,
2221
+ })) !== null && _c !== void 0 ? _c : (jsxs(Fragment, { children: [(alertProps === null || alertProps === void 0 ? void 0 : alertProps.title) && jsx(AlertTitle, { children: alertProps.title }), jsxs(Stack, { sx: {
2222
+ p: positionToolbarAlertBanner !== 'head-overlay'
2223
+ ? '0.5rem 1rem'
2224
+ : density === 'spacious'
2225
+ ? '0.75rem 1.25rem'
2226
+ : density === 'comfortable'
2227
+ ? '0.5rem 0.75rem'
2228
+ : '0.25rem 0.5rem',
2229
+ }, children: [alertProps === null || alertProps === void 0 ? void 0 : alertProps.children, (alertProps === null || alertProps === void 0 ? void 0 : alertProps.children) && (selectedAlert || groupedAlert) && (jsx("br", {})), jsxs(Box, { sx: { display: 'flex' }, children: [enableRowSelection &&
2230
+ enableSelectAll &&
2231
+ positionToolbarAlertBanner === 'head-overlay' && (jsx(MRT_SelectCheckbox, { selectAll: true, table: table })), ' ', selectedAlert] }), selectedAlert && groupedAlert && jsx("br", {}), groupedAlert] })] })) })) }));
2295
2232
  };
2296
2233
 
2297
2234
  const MRT_ToolbarDropZone = ({ table, }) => {
@@ -2325,33 +2262,6 @@ const MRT_ToolbarDropZone = ({ table, }) => {
2325
2262
  }), children: jsx(Typography, { fontStyle: "italic", children: localization.dropToGroupBy.replace('{column}', (_b = (_a = draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.columnDef) === null || _a === void 0 ? void 0 : _a.header) !== null && _b !== void 0 ? _b : '') }) }) }));
2326
2263
  };
2327
2264
 
2328
- /******************************************************************************
2329
- Copyright (c) Microsoft Corporation.
2330
-
2331
- Permission to use, copy, modify, and/or distribute this software for any
2332
- purpose with or without fee is hereby granted.
2333
-
2334
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2335
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2336
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2337
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2338
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2339
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2340
- PERFORMANCE OF THIS SOFTWARE.
2341
- ***************************************************************************** */
2342
- function __rest(s, e) {
2343
- var t = {};
2344
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2345
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2346
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2347
- }
2348
- return t;
2349
- }
2350
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
2351
- var e = new Error(message);
2352
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
2353
- };
2354
-
2355
2265
  const MRT_ColumnPinningButtons = ({ column, table, }) => {
2356
2266
  const { options: { icons: { PushPinIcon }, localization, }, } = table;
2357
2267
  const handlePinColumn = (pinDirection) => {
@@ -2519,7 +2429,7 @@ const MRT_ToggleFullScreenButton = (_a) => {
2519
2429
  setTooltipOpened(false);
2520
2430
  setIsFullScreen(!isFullScreen);
2521
2431
  };
2522
- return (jsx(Tooltip, { arrow: true, open: tooltipOpened, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleFullScreen, children: jsx(IconButton, Object.assign({ "aria-label": localization.showHideFilters, onClick: handleToggleFullScreen, onMouseEnter: () => setTooltipOpened(true), onMouseLeave: () => setTooltipOpened(false) }, rest, { title: undefined, children: isFullScreen ? jsx(FullscreenExitIcon, {}) : jsx(FullscreenIcon, {}) })) }));
2432
+ return (jsx(Tooltip, { arrow: true, open: tooltipOpened, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleFullScreen, children: jsx(IconButton, Object.assign({ "aria-label": localization.toggleFullScreen, onClick: handleToggleFullScreen, onMouseEnter: () => setTooltipOpened(true), onMouseLeave: () => setTooltipOpened(false) }, rest, { title: undefined, children: isFullScreen ? jsx(FullscreenExitIcon, {}) : jsx(FullscreenIcon, {}) })) }));
2523
2433
  };
2524
2434
 
2525
2435
  const MRT_ToggleGlobalFilterButton = (_a) => {
@@ -2550,56 +2460,9 @@ const MRT_ToolbarInternalButtons = ({ table, }) => {
2550
2460
  columnFilterDisplayMode !== 'popover' && (jsx(MRT_ToggleFiltersButton, { table: table })), (enableHiding || enableColumnOrdering || enableColumnPinning) && (jsx(MRT_ShowHideColumnsButton, { table: table })), enableDensityToggle && (jsx(MRT_ToggleDensePaddingButton, { table: table })), enableFullScreenToggle && (jsx(MRT_ToggleFullScreenButton, { table: table }))] })) }));
2551
2461
  };
2552
2462
 
2553
- const MRT_GlobalFilterTextField = ({ table, }) => {
2554
- var _a;
2555
- const { getState, options: { enableGlobalFilterModes, icons: { CloseIcon, SearchIcon }, localization, manualFiltering, muiSearchTextFieldProps, }, refs: { searchInputRef }, setGlobalFilter, } = table;
2556
- const { globalFilter, showGlobalFilter } = getState();
2557
- const textFieldProps = parseFromValuesOrFunc(muiSearchTextFieldProps, {
2558
- table,
2559
- });
2560
- const isMounted = useRef(false);
2561
- const [anchorEl, setAnchorEl] = useState(null);
2562
- const [searchValue, setSearchValue] = useState(globalFilter !== null && globalFilter !== void 0 ? globalFilter : '');
2563
- const handleChangeDebounced = useCallback(debounce((event) => {
2564
- var _a;
2565
- setGlobalFilter((_a = event.target.value) !== null && _a !== void 0 ? _a : undefined);
2566
- }, manualFiltering ? 500 : 250), []);
2567
- const handleChange = (event) => {
2568
- setSearchValue(event.target.value);
2569
- handleChangeDebounced(event);
2570
- };
2571
- const handleGlobalFilterMenuOpen = (event) => {
2572
- setAnchorEl(event.currentTarget);
2573
- };
2574
- const handleClear = () => {
2575
- setSearchValue('');
2576
- setGlobalFilter(undefined);
2577
- };
2578
- useEffect(() => {
2579
- if (isMounted.current) {
2580
- if (globalFilter === undefined) {
2581
- handleClear();
2582
- }
2583
- else {
2584
- setSearchValue(globalFilter);
2585
- }
2586
- }
2587
- isMounted.current = true;
2588
- }, [globalFilter]);
2589
- return (jsxs(Collapse, { in: showGlobalFilter, mountOnEnter: true, orientation: "horizontal", unmountOnExit: true, children: [jsx(TextField, Object.assign({ InputProps: {
2590
- endAdornment: (jsx(InputAdornment, { position: "end", children: jsx(Tooltip, { arrow: true, title: (_a = localization.clearSearch) !== null && _a !== void 0 ? _a : '', children: jsx("span", { children: jsx(IconButton, { "aria-label": localization.clearSearch, disabled: !(searchValue === null || searchValue === void 0 ? void 0 : searchValue.length), onClick: handleClear, size: "small", children: jsx(CloseIcon, {}) }) }) }) })),
2591
- startAdornment: enableGlobalFilterModes ? (jsx(InputAdornment, { position: "start", children: jsx(Tooltip, { arrow: true, title: localization.changeSearchMode, children: jsx(IconButton, { "aria-label": localization.changeSearchMode, onClick: handleGlobalFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' }, children: jsx(SearchIcon, {}) }) }) })) : (jsx(SearchIcon, { style: { marginRight: '4px' } })),
2592
- }, onChange: handleChange, placeholder: localization.search, value: searchValue !== null && searchValue !== void 0 ? searchValue : '', variant: "standard" }, textFieldProps, { inputRef: (inputRef) => {
2593
- searchInputRef.current = inputRef;
2594
- if (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.inputRef) {
2595
- textFieldProps.inputRef = inputRef;
2596
- }
2597
- } })), jsx(MRT_FilterOptionMenu, { anchorEl: anchorEl, onSelect: handleClear, setAnchorEl: setAnchorEl, table: table })] }));
2598
- };
2599
-
2600
2463
  const commonToolbarStyles = ({ theme }) => ({
2601
2464
  alignItems: 'flex-start',
2602
- backgroundColor: lighten(theme.palette.background.default, 0.04),
2465
+ backgroundColor: lighten(theme.palette.background.default, 0.05),
2603
2466
  backgroundImage: 'none',
2604
2467
  display: 'grid',
2605
2468
  flexWrap: 'wrap-reverse',
@@ -2672,6 +2535,214 @@ const MRT_BottomToolbar = ({ table, }) => {
2672
2535
  ['both', 'bottom'].includes(positionPagination !== null && positionPagination !== void 0 ? positionPagination : '') && (jsx(MRT_TablePagination, { position: "bottom", table: table })) })] })] })));
2673
2536
  };
2674
2537
 
2538
+ const MRT_TableHead = ({ table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
2539
+ const { getHeaderGroups, getSelectedRowModel, getState, options: { enableStickyHeader, layoutMode, muiTableHeadProps, positionToolbarAlertBanner, }, refs: { tableHeadRef }, } = table;
2540
+ const { isFullScreen, showAlertBanner } = getState();
2541
+ const tableHeadProps = parseFromValuesOrFunc(muiTableHeadProps, { table });
2542
+ const stickyHeader = enableStickyHeader || isFullScreen;
2543
+ return (jsx(TableHead, Object.assign({}, tableHeadProps, { ref: (ref) => {
2544
+ tableHeadRef.current = ref;
2545
+ if (tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.ref) {
2546
+ // @ts-ignore
2547
+ tableHeadProps.ref.current = ref;
2548
+ }
2549
+ }, sx: (theme) => (Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, opacity: 0.97, position: stickyHeader ? 'sticky' : 'relative', top: stickyHeader && (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 0 : undefined, zIndex: stickyHeader ? 2 : undefined }, parseFromValuesOrFunc(tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx, theme))), children: positionToolbarAlertBanner === 'head-overlay' &&
2550
+ (showAlertBanner || getSelectedRowModel().rows.length > 0) ? (jsx("tr", { style: { display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined }, children: jsx("th", { colSpan: table.getVisibleLeafColumns().length, style: {
2551
+ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : 'table-cell',
2552
+ padding: 0,
2553
+ }, children: jsx(MRT_ToolbarAlertBanner, { table: table }) }) })) : (getHeaderGroups().map((headerGroup) => (jsx(MRT_TableHeadRow, { headerGroup: headerGroup, table: table, virtualColumns: virtualColumns, virtualPaddingLeft: virtualPaddingLeft, virtualPaddingRight: virtualPaddingRight }, headerGroup.id)))) })));
2554
+ };
2555
+
2556
+ const MRT_Table = ({ table, }) => {
2557
+ var _a, _b, _c, _d;
2558
+ const { getFlatHeaders, getState, options: { columnVirtualizerInstanceRef, columnVirtualizerOptions, columns, enableColumnPinning, enableColumnResizing, enableColumnVirtualization, enableStickyHeader, enableTableFooter, enableTableHead, layoutMode, memoMode, muiTableProps, }, refs: { tableContainerRef }, } = table;
2559
+ const { columnPinning, columnSizing, columnSizingInfo, columnVisibility, isFullScreen, } = getState();
2560
+ const tableProps = parseFromValuesOrFunc(muiTableProps, { table });
2561
+ const columnVirtualizerProps = parseFromValuesOrFunc(columnVirtualizerOptions, { table });
2562
+ const columnSizeVars = useMemo(() => {
2563
+ const headers = getFlatHeaders();
2564
+ const colSizes = {};
2565
+ for (let i = 0; i < headers.length; i++) {
2566
+ const header = headers[i];
2567
+ const colSize = header.getSize();
2568
+ colSizes[`--header-${parseCSSVarId(header.id)}-size`] = colSize;
2569
+ colSizes[`--col-${parseCSSVarId(header.column.id)}-size`] = colSize;
2570
+ }
2571
+ return colSizes;
2572
+ }, [columns, columnSizing, columnSizingInfo, columnVisibility]);
2573
+ //get first 16 column widths and average them
2574
+ const averageColumnWidth = useMemo(() => {
2575
+ var _a, _b, _c, _d;
2576
+ if (!enableColumnVirtualization)
2577
+ return 0;
2578
+ const columnsWidths = (_d = (_c = (_b = (_a = table
2579
+ .getRowModel()
2580
+ .rows[0]) === null || _a === void 0 ? void 0 : _a.getCenterVisibleCells()) === null || _b === void 0 ? void 0 : _b.slice(0, 16)) === null || _c === void 0 ? void 0 : _c.map((cell) => cell.column.getSize() * 1.2)) !== null && _d !== void 0 ? _d : [];
2581
+ return columnsWidths.reduce((a, b) => a + b, 0) / columnsWidths.length;
2582
+ }, [table.getRowModel().rows, columnPinning, columnVisibility]);
2583
+ const [leftPinnedIndexes, rightPinnedIndexes] = useMemo(() => enableColumnVirtualization && enableColumnPinning
2584
+ ? [
2585
+ table.getLeftLeafColumns().map((c) => c.getPinnedIndex()),
2586
+ table
2587
+ .getRightLeafColumns()
2588
+ .map((c) => table.getVisibleLeafColumns().length - c.getPinnedIndex() - 1),
2589
+ ]
2590
+ : [[], []], [columnPinning, enableColumnVirtualization, enableColumnPinning]);
2591
+ const columnVirtualizer = enableColumnVirtualization
2592
+ ? useVirtualizer(Object.assign({ count: table.getVisibleLeafColumns().length, estimateSize: () => averageColumnWidth, getScrollElement: () => tableContainerRef.current, horizontal: true, overscan: 3, rangeExtractor: useCallback((range) => [
2593
+ ...new Set([
2594
+ ...leftPinnedIndexes,
2595
+ ...defaultRangeExtractor(range),
2596
+ ...rightPinnedIndexes,
2597
+ ]),
2598
+ ], [leftPinnedIndexes, rightPinnedIndexes]) }, columnVirtualizerProps))
2599
+ : undefined;
2600
+ if (columnVirtualizerInstanceRef && columnVirtualizer) {
2601
+ columnVirtualizerInstanceRef.current = columnVirtualizer;
2602
+ }
2603
+ const virtualColumns = columnVirtualizer
2604
+ ? columnVirtualizer.getVirtualItems()
2605
+ : undefined;
2606
+ let virtualPaddingLeft;
2607
+ let virtualPaddingRight;
2608
+ if (columnVirtualizer && (virtualColumns === null || virtualColumns === void 0 ? void 0 : virtualColumns.length)) {
2609
+ virtualPaddingLeft = (_b = (_a = virtualColumns[leftPinnedIndexes.length]) === null || _a === void 0 ? void 0 : _a.start) !== null && _b !== void 0 ? _b : 0;
2610
+ virtualPaddingRight =
2611
+ columnVirtualizer.getTotalSize() -
2612
+ ((_d = (_c = virtualColumns[virtualColumns.length - 1 - rightPinnedIndexes.length]) === null || _c === void 0 ? void 0 : _c.end) !== null && _d !== void 0 ? _d : 0);
2613
+ }
2614
+ const props = {
2615
+ table,
2616
+ virtualColumns,
2617
+ virtualPaddingLeft,
2618
+ virtualPaddingRight,
2619
+ };
2620
+ return (jsx(Fragment, { children: jsxs(Table, Object.assign({ stickyHeader: enableStickyHeader || isFullScreen }, tableProps, { style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style), sx: (theme) => (Object.assign({ borderCollapse: 'separate', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, tableLayout: layoutMode === 'semantic' && enableColumnResizing
2621
+ ? 'fixed'
2622
+ : undefined }, parseFromValuesOrFunc(tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx, theme))), children: [enableTableHead && jsx(MRT_TableHead, Object.assign({}, props)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsx(Memo_MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))) : (jsx(MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))), enableTableFooter && jsx(MRT_TableFooter, Object.assign({}, props))] })) }));
2623
+ };
2624
+
2625
+ const MRT_EditActionButtons = ({ row, table, variant = 'icon', }) => {
2626
+ const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onCreatingRowCancel, onCreatingRowSave, onEditingRowCancel, onEditingRowSave, }, refs: { editInputRefs }, setCreatingRow, setEditingRow, } = table;
2627
+ const { creatingRow, editingRow, isSaving } = getState();
2628
+ const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
2629
+ const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
2630
+ const handleCancel = () => {
2631
+ if (isCreating) {
2632
+ onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
2633
+ setCreatingRow(null);
2634
+ }
2635
+ else if (isEditing) {
2636
+ onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
2637
+ setEditingRow(null);
2638
+ }
2639
+ row._valuesCache = {}; //reset values cache
2640
+ };
2641
+ const handleSubmitRow = () => {
2642
+ var _a;
2643
+ //look for auto-filled input values
2644
+ (_a = Object.values(editInputRefs === null || editInputRefs === void 0 ? void 0 : editInputRefs.current)
2645
+ .filter((inputRef) => { var _a, _b; return row.id === ((_b = (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.name) === null || _a === void 0 ? void 0 : _a.split('_')) === null || _b === void 0 ? void 0 : _b[0]); })) === null || _a === void 0 ? void 0 : _a.forEach((input) => {
2646
+ if (input.value !== undefined &&
2647
+ Object.hasOwn(row === null || row === void 0 ? void 0 : row._valuesCache, input.name)) {
2648
+ // @ts-ignore
2649
+ row._valuesCache[input.name] = input.value;
2650
+ }
2651
+ });
2652
+ if (isCreating)
2653
+ onCreatingRowSave === null || onCreatingRowSave === void 0 ? void 0 : onCreatingRowSave({
2654
+ exitCreatingMode: () => setCreatingRow(null),
2655
+ row,
2656
+ table,
2657
+ values: row._valuesCache,
2658
+ });
2659
+ else if (isEditing) {
2660
+ onEditingRowSave === null || onEditingRowSave === void 0 ? void 0 : onEditingRowSave({
2661
+ exitEditingMode: () => setEditingRow(null),
2662
+ row,
2663
+ table,
2664
+ values: row === null || row === void 0 ? void 0 : row._valuesCache,
2665
+ });
2666
+ }
2667
+ };
2668
+ return (jsx(Box, { onClick: (e) => e.stopPropagation(), sx: { display: 'flex', gap: '0.75rem' }, children: variant === 'icon' ? (jsxs(Fragment, { children: [jsx(Tooltip, { arrow: true, title: localization.cancel, children: jsx(IconButton, { "aria-label": localization.cancel, onClick: handleCancel, children: jsx(CancelIcon, {}) }) }), jsx(Tooltip, { arrow: true, title: localization.save, children: jsx(IconButton, { "aria-label": localization.save, color: "info", onClick: handleSubmitRow, children: isSaving ? jsx(CircularProgress, { size: 18 }) : jsx(SaveIcon, {}) }) })] })) : (jsxs(Fragment, { children: [jsx(Button, { onClick: handleCancel, sx: { minWidth: '100px' }, children: localization.cancel }), jsxs(Button, { onClick: handleSubmitRow, sx: { minWidth: '100px' }, variant: "contained", children: [isSaving && jsx(CircularProgress, { color: "inherit", size: 18 }), localization.save] })] })) }));
2669
+ };
2670
+
2671
+ const MRT_EditRowModal = ({ open, table, }) => {
2672
+ var _a;
2673
+ const { getState, options: { localization, muiCreateRowModalProps, muiEditRowModalProps, onCreatingRowCancel, onEditingRowCancel, renderCreateRowModalContent, renderEditRowModalContent, }, setCreatingRow, setEditingRow, } = table;
2674
+ const { creatingRow, editingRow } = getState();
2675
+ const row = (creatingRow !== null && creatingRow !== void 0 ? creatingRow : editingRow);
2676
+ const dialogProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditRowModalProps, { row, table })), (creatingRow &&
2677
+ parseFromValuesOrFunc(muiCreateRowModalProps, { row, table })));
2678
+ const internalEditComponents = row
2679
+ .getAllCells()
2680
+ .filter((cell) => cell.column.columnDef.columnDefType === 'data')
2681
+ .map((cell) => (jsx(MRT_EditCellTextField, { cell: cell, table: table }, cell.id)));
2682
+ return (jsx(Dialog, Object.assign({ fullWidth: true, maxWidth: "xs", onClose: (event, reason) => {
2683
+ var _a;
2684
+ if (creatingRow) {
2685
+ onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
2686
+ setCreatingRow(null);
2687
+ }
2688
+ else {
2689
+ onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
2690
+ setEditingRow(null);
2691
+ }
2692
+ row._valuesCache = {}; //reset values cache
2693
+ (_a = dialogProps.onClose) === null || _a === void 0 ? void 0 : _a.call(dialogProps, event, reason);
2694
+ }, open: open }, dialogProps, { children: (_a = ((creatingRow &&
2695
+ (renderCreateRowModalContent === null || renderCreateRowModalContent === void 0 ? void 0 : renderCreateRowModalContent({
2696
+ internalEditComponents,
2697
+ row,
2698
+ table,
2699
+ }))) ||
2700
+ (renderEditRowModalContent === null || renderEditRowModalContent === void 0 ? void 0 : renderEditRowModalContent({
2701
+ internalEditComponents,
2702
+ row,
2703
+ table,
2704
+ })))) !== null && _a !== void 0 ? _a : (jsxs(Fragment, { children: [jsx(DialogTitle, { sx: { textAlign: 'center' }, children: localization.edit }), jsx(DialogContent, { children: jsx("form", { onSubmit: (e) => e.preventDefault(), children: jsx(Stack, { sx: {
2705
+ gap: '24px',
2706
+ paddingTop: '16px',
2707
+ width: '100%',
2708
+ }, children: internalEditComponents }) }) }), jsx(DialogActions, { sx: { p: '1.25rem' }, children: jsx(MRT_EditActionButtons, { row: row, table: table, variant: "text" }) })] })) })));
2709
+ };
2710
+
2711
+ const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
2712
+ const MRT_TableContainer = ({ table, }) => {
2713
+ const { getState, options: { createDisplayMode, editDisplayMode, enableStickyHeader, muiTableContainerProps, }, refs: { bottomToolbarRef, tableContainerRef, topToolbarRef }, } = table;
2714
+ const { creatingRow, editingRow, isFullScreen } = getState();
2715
+ const [totalToolbarHeight, setTotalToolbarHeight] = useState(0);
2716
+ const tableContainerProps = parseFromValuesOrFunc(muiTableContainerProps, {
2717
+ table,
2718
+ });
2719
+ useIsomorphicLayoutEffect(() => {
2720
+ var _a, _b, _c, _d;
2721
+ const topToolbarHeight = typeof document !== 'undefined'
2722
+ ? (_b = (_a = topToolbarRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0
2723
+ : 0;
2724
+ const bottomToolbarHeight = typeof document !== 'undefined'
2725
+ ? (_d = (_c = bottomToolbarRef === null || bottomToolbarRef === void 0 ? void 0 : bottomToolbarRef.current) === null || _c === void 0 ? void 0 : _c.offsetHeight) !== null && _d !== void 0 ? _d : 0
2726
+ : 0;
2727
+ setTotalToolbarHeight(topToolbarHeight + bottomToolbarHeight);
2728
+ });
2729
+ const createModalOpen = createDisplayMode === 'modal' && creatingRow;
2730
+ const editModalOpen = editDisplayMode === 'modal' && editingRow;
2731
+ return (jsxs(TableContainer, Object.assign({}, tableContainerProps, { ref: (node) => {
2732
+ if (node) {
2733
+ tableContainerRef.current = node;
2734
+ if (tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.ref) {
2735
+ //@ts-ignore
2736
+ tableContainerProps.ref.current = node;
2737
+ }
2738
+ }
2739
+ }, style: Object.assign({ maxHeight: isFullScreen
2740
+ ? `calc(100vh - ${totalToolbarHeight}px)`
2741
+ : undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style), sx: (theme) => (Object.assign({ maxHeight: enableStickyHeader
2742
+ ? `clamp(350px, calc(100vh - ${totalToolbarHeight}px), 9999px)`
2743
+ : undefined, maxWidth: '100%', overflow: 'auto' }, parseFromValuesOrFunc(tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx, theme))), children: [jsx(MRT_Table, { table: table }), (createModalOpen || editModalOpen) && (jsx(MRT_EditRowModal, { open: true, table: table }))] })));
2744
+ };
2745
+
2675
2746
  const MRT_TablePaper = ({ table, }) => {
2676
2747
  var _a, _b;
2677
2748
  const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps, renderBottomToolbar, renderTopToolbar, }, refs: { tablePaperRef }, } = table;
@@ -2823,53 +2894,6 @@ const MRT_ToggleRowActionMenuButton = ({ cell, row, table, }) => {
2823
2894
  parseFromValuesOrFunc(enableEditing, row) ? (jsx(Tooltip, { arrow: true, placement: "right", title: localization.edit, children: jsx(IconButton, { "aria-label": localization.edit, onClick: handleStartEditMode, sx: commonIconButtonStyles, children: jsx(EditIcon, {}) }) })) : renderRowActionMenuItems ? (jsxs(Fragment, { children: [jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.rowActions, children: jsx(IconButton, { "aria-label": localization.rowActions, onClick: handleOpenRowActionMenu, size: "small", sx: commonIconButtonStyles, children: jsx(MoreHorizIcon, {}) }) }), jsx(MRT_RowActionMenu, { anchorEl: anchorEl, handleEdit: handleStartEditMode, row: row, setAnchorEl: setAnchorEl, table: table })] })) : null }));
2824
2895
  };
2825
2896
 
2826
- const MRT_SelectCheckbox = ({ row, selectAll, table, }) => {
2827
- var _a;
2828
- const { getState, options: { enableMultiRowSelection, enableRowPinning, localization, muiSelectAllCheckboxProps, muiSelectCheckboxProps, rowPinningDisplayMode, selectAllMode, }, } = table;
2829
- const { density, isLoading } = getState();
2830
- const checkboxProps = !row
2831
- ? parseFromValuesOrFunc(muiSelectAllCheckboxProps, { table })
2832
- : parseFromValuesOrFunc(muiSelectCheckboxProps, { row, table });
2833
- const allRowsSelected = selectAll
2834
- ? selectAllMode === 'page'
2835
- ? table.getIsAllPageRowsSelected()
2836
- : table.getIsAllRowsSelected()
2837
- : undefined;
2838
- const commonProps = Object.assign(Object.assign({ checked: selectAll ? allRowsSelected : row === null || row === void 0 ? void 0 : row.getIsSelected(), disabled: isLoading || (row && !row.getCanSelect()), inputProps: {
2839
- 'aria-label': selectAll
2840
- ? localization.toggleSelectAll
2841
- : localization.toggleSelectRow,
2842
- }, onChange: (event) => {
2843
- event.stopPropagation();
2844
- row
2845
- ? row.getToggleSelectedHandler()(event)
2846
- : selectAllMode === 'all'
2847
- ? table.getToggleAllRowsSelectedHandler()(event)
2848
- : table.getToggleAllPageRowsSelectedHandler()(event);
2849
- if (enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('select'))) {
2850
- if (row) {
2851
- row.pin(!row.getIsPinned() && event.target.checked
2852
- ? (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('bottom'))
2853
- ? 'bottom'
2854
- : 'top'
2855
- : false);
2856
- }
2857
- else {
2858
- table.setRowPinning({ bottom: [], top: [] });
2859
- }
2860
- }
2861
- }, size: (density === 'compact' ? 'small' : 'medium') }, checkboxProps), { onClick: (e) => {
2862
- var _a;
2863
- e.stopPropagation();
2864
- (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
2865
- }, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.5rem', m: density !== 'compact' ? '-0.4rem' : undefined, width: density === 'compact' ? '1.75rem' : '2.5rem', zIndex: 0 }, parseFromValuesOrFunc(checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx, theme))), title: undefined });
2866
- return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _a !== void 0 ? _a : (selectAll
2867
- ? localization.toggleSelectAll
2868
- : localization.toggleSelectRow), children: enableMultiRowSelection === false ? (jsx(Radio, Object.assign({}, commonProps))) : (jsx(Checkbox, Object.assign({ indeterminate: selectAll
2869
- ? table.getIsSomeRowsSelected() && !allRowsSelected
2870
- : row === null || row === void 0 ? void 0 : row.getIsSomeSelected() }, commonProps))) }));
2871
- };
2872
-
2873
2897
  const useMRT_DisplayColumns = ({ columnOrder, creatingRow, grouping, tableOptions, }) => {
2874
2898
  var _a, _b;
2875
2899
  return useMemo(() => {
@@ -3251,7 +3275,7 @@ const MRT_Default_Icons = {
3251
3275
  ArrowDownwardIcon,
3252
3276
  ArrowRightIcon,
3253
3277
  CancelIcon,
3254
- ChevronLefIcon,
3278
+ ChevronLeftIcon,
3255
3279
  ChevronRightIcon,
3256
3280
  ClearAllIcon,
3257
3281
  CloseIcon,
@@ -3384,8 +3408,13 @@ const useMRT_TableOptions = (_a) => {
3384
3408
  const _sortingFns = useMemo(() => (Object.assign(Object.assign({}, MRT_SortingFns), sortingFns)), []);
3385
3409
  const _defaultColumn = useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultColumn), defaultColumn)), [defaultColumn]);
3386
3410
  const _defaultDisplayColumn = useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultDisplayColumn), defaultDisplayColumn)), [defaultDisplayColumn]);
3387
- if (rest.enableRowVirtualization || rest.enableColumnVirtualization) {
3388
- layoutMode = 'grid';
3411
+ if (layoutMode === 'semantic') {
3412
+ if (rest.enableRowVirtualization || rest.enableColumnVirtualization) {
3413
+ layoutMode = 'grid';
3414
+ }
3415
+ if (enableColumnResizing) {
3416
+ layoutMode = 'grid-no-grow';
3417
+ }
3389
3418
  }
3390
3419
  if (rest.enableRowVirtualization) {
3391
3420
  enableStickyHeader = true;