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
package/dist/cjs/index.js CHANGED
@@ -43,11 +43,6 @@ var Popover = require('@mui/material/Popover');
43
43
  var Divider = require('@mui/material/Divider');
44
44
  var Badge = require('@mui/material/Badge');
45
45
  var TableSortLabel = require('@mui/material/TableSortLabel');
46
- var Dialog = require('@mui/material/Dialog');
47
- var DialogActions = require('@mui/material/DialogActions');
48
- var DialogContent = require('@mui/material/DialogContent');
49
- var DialogTitle = require('@mui/material/DialogTitle');
50
- var CircularProgress = require('@mui/material/CircularProgress');
51
46
  var Toolbar = require('@mui/material/Toolbar');
52
47
  var useMediaQuery = require('@mui/material/useMediaQuery');
53
48
  var LinearProgress = require('@mui/material/LinearProgress');
@@ -57,13 +52,18 @@ var PaginationItem = require('@mui/material/PaginationItem');
57
52
  var Select = require('@mui/material/Select');
58
53
  var Alert = require('@mui/material/Alert');
59
54
  var AlertTitle = require('@mui/material/AlertTitle');
55
+ var Radio = require('@mui/material/Radio');
60
56
  var Fade = require('@mui/material/Fade');
61
57
  var Switch = require('@mui/material/Switch');
62
- var Radio = require('@mui/material/Radio');
58
+ var Dialog = require('@mui/material/Dialog');
59
+ var DialogActions = require('@mui/material/DialogActions');
60
+ var DialogContent = require('@mui/material/DialogContent');
61
+ var DialogTitle = require('@mui/material/DialogTitle');
62
+ var CircularProgress = require('@mui/material/CircularProgress');
63
63
  var ArrowDownwardIcon = require('@mui/icons-material/ArrowDownward');
64
64
  var ArrowRightIcon = require('@mui/icons-material/ArrowRight');
65
65
  var CancelIcon = require('@mui/icons-material/Cancel');
66
- var ChevronLefIcon = require('@mui/icons-material/ChevronLeft');
66
+ var ChevronLeftIcon = require('@mui/icons-material/ChevronLeft');
67
67
  var ChevronRightIcon = require('@mui/icons-material/ChevronRight');
68
68
  var ClearAllIcon = require('@mui/icons-material/ClearAll');
69
69
  var CloseIcon = require('@mui/icons-material/Close');
@@ -128,11 +128,6 @@ var Popover__default = /*#__PURE__*/_interopDefaultLegacy(Popover);
128
128
  var Divider__default = /*#__PURE__*/_interopDefaultLegacy(Divider);
129
129
  var Badge__default = /*#__PURE__*/_interopDefaultLegacy(Badge);
130
130
  var TableSortLabel__default = /*#__PURE__*/_interopDefaultLegacy(TableSortLabel);
131
- var Dialog__default = /*#__PURE__*/_interopDefaultLegacy(Dialog);
132
- var DialogActions__default = /*#__PURE__*/_interopDefaultLegacy(DialogActions);
133
- var DialogContent__default = /*#__PURE__*/_interopDefaultLegacy(DialogContent);
134
- var DialogTitle__default = /*#__PURE__*/_interopDefaultLegacy(DialogTitle);
135
- var CircularProgress__default = /*#__PURE__*/_interopDefaultLegacy(CircularProgress);
136
131
  var Toolbar__default = /*#__PURE__*/_interopDefaultLegacy(Toolbar);
137
132
  var useMediaQuery__default = /*#__PURE__*/_interopDefaultLegacy(useMediaQuery);
138
133
  var LinearProgress__default = /*#__PURE__*/_interopDefaultLegacy(LinearProgress);
@@ -142,13 +137,18 @@ var PaginationItem__default = /*#__PURE__*/_interopDefaultLegacy(PaginationItem)
142
137
  var Select__default = /*#__PURE__*/_interopDefaultLegacy(Select);
143
138
  var Alert__default = /*#__PURE__*/_interopDefaultLegacy(Alert);
144
139
  var AlertTitle__default = /*#__PURE__*/_interopDefaultLegacy(AlertTitle);
140
+ var Radio__default = /*#__PURE__*/_interopDefaultLegacy(Radio);
145
141
  var Fade__default = /*#__PURE__*/_interopDefaultLegacy(Fade);
146
142
  var Switch__default = /*#__PURE__*/_interopDefaultLegacy(Switch);
147
- var Radio__default = /*#__PURE__*/_interopDefaultLegacy(Radio);
143
+ var Dialog__default = /*#__PURE__*/_interopDefaultLegacy(Dialog);
144
+ var DialogActions__default = /*#__PURE__*/_interopDefaultLegacy(DialogActions);
145
+ var DialogContent__default = /*#__PURE__*/_interopDefaultLegacy(DialogContent);
146
+ var DialogTitle__default = /*#__PURE__*/_interopDefaultLegacy(DialogTitle);
147
+ var CircularProgress__default = /*#__PURE__*/_interopDefaultLegacy(CircularProgress);
148
148
  var ArrowDownwardIcon__default = /*#__PURE__*/_interopDefaultLegacy(ArrowDownwardIcon);
149
149
  var ArrowRightIcon__default = /*#__PURE__*/_interopDefaultLegacy(ArrowRightIcon);
150
150
  var CancelIcon__default = /*#__PURE__*/_interopDefaultLegacy(CancelIcon);
151
- var ChevronLefIcon__default = /*#__PURE__*/_interopDefaultLegacy(ChevronLefIcon);
151
+ var ChevronLeftIcon__default = /*#__PURE__*/_interopDefaultLegacy(ChevronLeftIcon);
152
152
  var ChevronRightIcon__default = /*#__PURE__*/_interopDefaultLegacy(ChevronRightIcon);
153
153
  var ClearAllIcon__default = /*#__PURE__*/_interopDefaultLegacy(ClearAllIcon);
154
154
  var CloseIcon__default = /*#__PURE__*/_interopDefaultLegacy(CloseIcon);
@@ -414,19 +414,24 @@ const getCanRankRows = (table) => {
414
414
  };
415
415
  const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
416
416
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
417
+ const { options: { layoutMode }, } = table;
417
418
  const widthStyles = {
418
419
  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)`,
419
420
  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)`,
420
421
  };
422
+ if (layoutMode === 'grid') {
423
+ 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`;
424
+ }
425
+ else if (layoutMode === 'grid-no-grow') {
426
+ widthStyles.flex = '0 0 auto';
427
+ }
421
428
  return Object.assign(Object.assign(Object.assign({ backgroundColor: column.getIsPinned() && column.columnDef.columnDefType !== 'group'
422
429
  ? styles.alpha(styles.lighten(theme.palette.background.default, 0.04), 0.97)
423
430
  : 'inherit', backgroundImage: 'inherit', boxShadow: getIsLastLeftPinnedColumn(table, column)
424
431
  ? `-4px 0 8px -6px ${styles.alpha(theme.palette.common.black, 0.2)} inset`
425
432
  : getIsFirstRightPinnedColumn(column)
426
433
  ? `4px 0 8px -6px ${styles.alpha(theme.palette.common.black, 0.2)} inset`
427
- : undefined, display: table.options.layoutMode === 'grid' ? 'flex' : 'table-cell', flex: table.options.layoutMode === 'grid'
428
- ? `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`
429
- : undefined, left: column.getIsPinned() === 'left'
434
+ : undefined, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, left: column.getIsPinned() === 'left'
430
435
  ? `${column.getStart('left')}px`
431
436
  : undefined, ml: table.options.enableColumnVirtualization &&
432
437
  column.getIsPinned() === 'left' &&
@@ -739,7 +744,7 @@ const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, ta
739
744
  : undefined,
740
745
  outlineOffset: '-1px',
741
746
  textOverflow: 'clip',
742
- }, alignItems: layoutMode === 'grid' ? 'center' : undefined, cursor: isEditable && editDisplayMode === 'cell' ? 'pointer' : 'inherit', justifyContent: layoutMode === 'grid' ? tableCellProps.align : undefined, overflow: 'hidden', p: density === 'compact'
747
+ }, 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'
743
748
  ? columnDefType === 'display'
744
749
  ? '0 0.5rem'
745
750
  : '0.5rem'
@@ -792,14 +797,14 @@ const MRT_TableDetailPanel = ({ parentRowRef, row, rowIndex, table, virtualRow,
792
797
  });
793
798
  return (jsxRuntime.jsx(TableRow__default["default"], Object.assign({ className: "Mui-TableBodyCell-DetailPanel" }, tableRowProps, { sx: (theme) => {
794
799
  var _a, _b;
795
- return (Object.assign({ display: layoutMode === 'grid' ? 'flex' : 'table-row', position: virtualRow ? 'absolute' : undefined, top: virtualRow
800
+ return (Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, position: virtualRow ? 'absolute' : undefined, top: virtualRow
796
801
  ? `${(_b = (_a = parentRowRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.height}px`
797
802
  : undefined, transform: virtualRow
798
803
  ? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
799
804
  : undefined, width: '100%', zIndex: virtualRow ? 2 : undefined }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme)));
800
805
  }, children: jsxRuntime.jsx(TableCell__default["default"], Object.assign({ className: "Mui-TableBodyCell-DetailPanel", colSpan: getVisibleLeafColumns().length }, tableCellProps, { sx: (theme) => (Object.assign({ backgroundColor: virtualRow
801
- ? styles.lighten(theme.palette.background.default, 0.06)
802
- : 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 && (jsxRuntime.jsx(Collapse__default["default"], { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true, children: !isLoading && renderDetailPanel({ row, table }) })) })) })));
806
+ ? styles.lighten(theme.palette.background.default, 0.05)
807
+ : 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 && (jsxRuntime.jsx(Collapse__default["default"], { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true, children: !isLoading && renderDetailPanel({ row, table }) })) })) })));
803
808
  };
804
809
 
805
810
  const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRowIds, row, rowIndex, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, virtualRow, }) => {
@@ -854,10 +859,10 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRo
854
859
  ? `${styles.lighten(theme.palette.background.default, 0.12)}`
855
860
  : `${styles.darken(theme.palette.background.default, 0.05)}`
856
861
  : undefined,
857
- }, backgroundColor: `${styles.lighten(theme.palette.background.default, 0.06)} !important`, bottom: !virtualRow && bottomPinnedIndex !== undefined && isPinned
862
+ }, backgroundColor: `${styles.lighten(theme.palette.background.default, 0.05)} !important`, bottom: !virtualRow && bottomPinnedIndex !== undefined && isPinned
858
863
  ? `${bottomPinnedIndex * rowHeight +
859
864
  (enableStickyFooter ? tableFooterHeight - 1 : 0)}px`
860
- : undefined, boxSizing: 'border-box', display: layoutMode === 'grid' ? 'flex' : 'table-row', opacity: isPinned
865
+ : undefined, boxSizing: 'border-box', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, opacity: isPinned
861
866
  ? 0.98
862
867
  : (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id || (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id
863
868
  ? 0.5
@@ -877,7 +882,7 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRo
877
882
  ? `${topPinnedIndex * rowHeight +
878
883
  (enableStickyHeader || isFullScreen ? tableHeadHeight - 1 : 0)}px`
879
884
  : undefined, transition: virtualRow ? 'none' : 'all 150ms ease-in-out', width: '100%', zIndex: (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) && isPinned
880
- ? 1
885
+ ? 2
881
886
  : undefined }, sx)), children: [virtualPaddingLeft ? (jsxRuntime.jsx("td", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : row.getVisibleCells()).map((cellOrVirtualCell) => {
882
887
  const cell = columnVirtualizer
883
888
  ? row.getVisibleCells()[cellOrVirtualCell.index]
@@ -920,7 +925,7 @@ const rankGlobalFuzzy = (rowA, rowB) => Math.max(...Object.values(rowB.columnFil
920
925
  const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
921
926
  var _a, _b, _c, _d, _e, _f;
922
927
  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;
923
- const { columnFilters, density, expanded, globalFilter, globalFilterFn, isFullScreen, pagination, rowPinning, sorting, } = getState();
928
+ const { columnFilters, density, expanded, globalFilter, isFullScreen, pagination, rowPinning, sorting, } = getState();
924
929
  const tableBodyProps = parseFromValuesOrFunc(muiTableBodyProps, { table });
925
930
  const rowVirtualizerProps = parseFromValuesOrFunc(rowVirtualizerOptions, {
926
931
  table,
@@ -929,16 +934,9 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
929
934
  ((_a = tableHeadRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight)) ||
930
935
  0;
931
936
  const tableFooterHeight = (enableStickyFooter && ((_b = tableFooterRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight)) || 0;
932
- const shouldRankResults = react.useMemo(() => !manualExpanding &&
933
- !manualFiltering &&
934
- !manualGrouping &&
935
- !manualSorting &&
936
- enableGlobalFilterRankedResults &&
937
- globalFilter &&
938
- globalFilterFn === 'fuzzy' &&
939
- expanded !== true &&
937
+ const shouldRankRows = react.useMemo(() => getCanRankRows(table) &&
940
938
  !Object.values(sorting).some(Boolean) &&
941
- !Object.values(expanded).some(Boolean), [
939
+ globalFilter, [
942
940
  enableGlobalFilterRankedResults,
943
941
  expanded,
944
942
  globalFilter,
@@ -953,7 +951,7 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
953
951
  .map((r) => r.id), [rowPinning, table.getRowModel().rows]);
954
952
  const rows = react.useMemo(() => {
955
953
  let rows = [];
956
- if (!shouldRankResults) {
954
+ if (!shouldRankRows) {
957
955
  rows =
958
956
  !enableRowPinning || (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky'))
959
957
  ? getRowModel().rows
@@ -975,8 +973,8 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
975
973
  }
976
974
  return rows;
977
975
  }, [
978
- shouldRankResults,
979
- shouldRankResults ? getPrePaginationRowModel().rows : getRowModel().rows,
976
+ shouldRankRows,
977
+ shouldRankRows ? getPrePaginationRowModel().rows : getRowModel().rows,
980
978
  pagination.pageIndex,
981
979
  pagination.pageSize,
982
980
  rowPinning,
@@ -994,7 +992,7 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
994
992
  ? rowVirtualizer.getVirtualItems()
995
993
  : undefined;
996
994
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
997
- getIsSomeRowsPinned('top') && (jsxRuntime.jsx(TableBody__default["default"], 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) => {
995
+ getIsSomeRowsPinned('top') && (jsxRuntime.jsx(TableBody__default["default"], 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) => {
998
996
  const props = {
999
997
  columnVirtualizer,
1000
998
  measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
@@ -1007,10 +1005,10 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
1007
1005
  virtualPaddingRight,
1008
1006
  };
1009
1007
  return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
1010
- }) }))), jsxRuntime.jsx(TableBody__default["default"], Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', height: rowVirtualizer
1008
+ }) }))), jsxRuntime.jsx(TableBody__default["default"], Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, height: rowVirtualizer
1011
1009
  ? `${rowVirtualizer.getTotalSize()}px`
1012
- : '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 ? (jsxRuntime.jsx("tr", { style: { display: layoutMode === 'grid' ? 'grid' : 'table-row' }, children: jsxRuntime.jsx("td", { colSpan: table.getVisibleLeafColumns().length, style: {
1013
- display: layoutMode === 'grid' ? 'grid' : 'table-cell',
1010
+ : '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 ? (jsxRuntime.jsx("tr", { style: { display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined }, children: jsxRuntime.jsx("td", { colSpan: table.getVisibleLeafColumns().length, style: {
1011
+ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : 'table-cell',
1014
1012
  }, children: (_d = renderEmptyRowsFallback === null || renderEmptyRowsFallback === void 0 ? void 0 : renderEmptyRowsFallback({ table })) !== null && _d !== void 0 ? _d : (jsxRuntime.jsx(Typography__default["default"], { sx: {
1015
1013
  color: 'text.secondary',
1016
1014
  fontStyle: 'italic',
@@ -1041,7 +1039,7 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
1041
1039
  };
1042
1040
  return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
1043
1041
  }) }))) })), !(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
1044
- getIsSomeRowsPinned('bottom') && (jsxRuntime.jsx(TableBody__default["default"], 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) => {
1042
+ getIsSomeRowsPinned('bottom') && (jsxRuntime.jsx(TableBody__default["default"], 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) => {
1045
1043
  const props = {
1046
1044
  columnVirtualizer,
1047
1045
  measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
@@ -1069,7 +1067,7 @@ const MRT_TableFooterCell = ({ footer, table, }) => {
1069
1067
  column,
1070
1068
  table,
1071
1069
  }));
1072
- return (jsxRuntime.jsx(TableCell__default["default"], 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'
1070
+ return (jsxRuntime.jsx(TableCell__default["default"], 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'
1073
1071
  ? '0.5rem'
1074
1072
  : density === 'comfortable'
1075
1073
  ? '1rem'
@@ -1095,7 +1093,7 @@ const MRT_TableFooterRow = ({ footerGroup, table, virtualColumns, virtualPadding
1095
1093
  footerGroup,
1096
1094
  table,
1097
1095
  });
1098
- return (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: styles.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 ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : footerGroup.headers).map((footerOrVirtualFooter) => {
1096
+ return (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: styles.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 ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : footerGroup.headers).map((footerOrVirtualFooter) => {
1099
1097
  const footer = virtualColumns
1100
1098
  ? footerGroup.headers[footerOrVirtualFooter.index]
1101
1099
  : footerOrVirtualFooter;
@@ -1116,7 +1114,7 @@ const MRT_TableFooter = ({ table, virtualColumns, virtualPaddingLeft, virtualPad
1116
1114
  // @ts-ignore
1117
1115
  tableFooterProps.ref.current = ref;
1118
1116
  }
1119
- }, sx: (theme) => (Object.assign({ bottom: stickFooter ? 0 : undefined, display: layoutMode === 'grid' ? 'grid' : 'table-row-group', opacity: stickFooter ? 0.97 : undefined, outline: stickFooter
1117
+ }, 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
1120
1118
  ? theme.palette.mode === 'light'
1121
1119
  ? `1px solid ${theme.palette.grey[300]}`
1122
1120
  : `1px solid ${theme.palette.grey[700]}`
@@ -2034,7 +2032,7 @@ const MRT_TableHeadCell = ({ header, table, }) => {
2034
2032
  if (node) {
2035
2033
  tableHeadCellRefs.current[column.id] = node;
2036
2034
  }
2037
- } }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ flexDirection: layoutMode === 'grid' ? 'column' : undefined, fontWeight: 'bold', overflow: 'visible', p: density === 'compact'
2035
+ } }, 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'
2038
2036
  ? '0.5rem'
2039
2037
  : density === 'comfortable'
2040
2038
  ? columnDefType === 'display'
@@ -2101,7 +2099,7 @@ const MRT_TableHeadRow = ({ headerGroup, table, virtualColumns, virtualPaddingLe
2101
2099
  headerGroup,
2102
2100
  table,
2103
2101
  });
2104
- return (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: styles.lighten(theme.palette.background.default, 0.04), boxShadow: `4px 0 8px ${styles.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 ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : headerGroup.headers).map((headerOrVirtualHeader) => {
2102
+ return (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: styles.lighten(theme.palette.background.default, 0.05), boxShadow: `4px 0 8px ${styles.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 ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : headerGroup.headers).map((headerOrVirtualHeader) => {
2105
2103
  const header = virtualColumns
2106
2104
  ? headerGroup.headers[headerOrVirtualHeader.index]
2107
2105
  : headerOrVirtualHeader;
@@ -2109,208 +2107,6 @@ const MRT_TableHeadRow = ({ headerGroup, table, virtualColumns, virtualPaddingLe
2109
2107
  }), virtualPaddingRight ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
2110
2108
  };
2111
2109
 
2112
- const MRT_TableHead = ({ table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
2113
- const { getHeaderGroups, getState, options: { enableStickyHeader, layoutMode, muiTableHeadProps }, refs: { tableHeadRef }, } = table;
2114
- const { isFullScreen } = getState();
2115
- const tableHeadProps = parseFromValuesOrFunc(muiTableHeadProps, { table });
2116
- const stickyHeader = enableStickyHeader || isFullScreen;
2117
- return (jsxRuntime.jsx(TableHead__default["default"], Object.assign({}, tableHeadProps, { ref: (ref) => {
2118
- tableHeadRef.current = ref;
2119
- if (tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.ref) {
2120
- // @ts-ignore
2121
- tableHeadProps.ref.current = ref;
2122
- }
2123
- }, 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) => (jsxRuntime.jsx(MRT_TableHeadRow, { headerGroup: headerGroup, table: table, virtualColumns: virtualColumns, virtualPaddingLeft: virtualPaddingLeft, virtualPaddingRight: virtualPaddingRight }, headerGroup.id))) })));
2124
- };
2125
-
2126
- const MRT_Table = ({ table, }) => {
2127
- var _a, _b, _c, _d;
2128
- const { getFlatHeaders, getState, options: { columnVirtualizerInstanceRef, columnVirtualizerOptions, columns, enableColumnPinning, enableColumnResizing, enableColumnVirtualization, enableStickyHeader, enableTableFooter, enableTableHead, layoutMode, memoMode, muiTableProps, }, refs: { tableContainerRef }, } = table;
2129
- const { columnPinning, columnSizing, columnSizingInfo, columnVisibility, isFullScreen, } = getState();
2130
- const tableProps = parseFromValuesOrFunc(muiTableProps, { table });
2131
- const columnVirtualizerProps = parseFromValuesOrFunc(columnVirtualizerOptions, { table });
2132
- const columnSizeVars = react.useMemo(() => {
2133
- const headers = getFlatHeaders();
2134
- const colSizes = {};
2135
- for (let i = 0; i < headers.length; i++) {
2136
- const header = headers[i];
2137
- const colSize = header.getSize();
2138
- colSizes[`--header-${parseCSSVarId(header.id)}-size`] = colSize;
2139
- colSizes[`--col-${parseCSSVarId(header.column.id)}-size`] = colSize;
2140
- }
2141
- return colSizes;
2142
- }, [columns, columnSizing, columnSizingInfo, columnVisibility]);
2143
- //get first 16 column widths and average them
2144
- const averageColumnWidth = react.useMemo(() => {
2145
- var _a, _b, _c, _d;
2146
- if (!enableColumnVirtualization)
2147
- return 0;
2148
- const columnsWidths = (_d = (_c = (_b = (_a = table
2149
- .getRowModel()
2150
- .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 : [];
2151
- return columnsWidths.reduce((a, b) => a + b, 0) / columnsWidths.length;
2152
- }, [table.getRowModel().rows, columnPinning, columnVisibility]);
2153
- const [leftPinnedIndexes, rightPinnedIndexes] = react.useMemo(() => enableColumnVirtualization && enableColumnPinning
2154
- ? [
2155
- table.getLeftLeafColumns().map((c) => c.getPinnedIndex()),
2156
- table
2157
- .getRightLeafColumns()
2158
- .map((c) => table.getVisibleLeafColumns().length - c.getPinnedIndex() - 1),
2159
- ]
2160
- : [[], []], [columnPinning, enableColumnVirtualization, enableColumnPinning]);
2161
- const columnVirtualizer = enableColumnVirtualization
2162
- ? reactVirtual.useVirtualizer(Object.assign({ count: table.getVisibleLeafColumns().length, estimateSize: () => averageColumnWidth, getScrollElement: () => tableContainerRef.current, horizontal: true, overscan: 3, rangeExtractor: react.useCallback((range) => [
2163
- ...new Set([
2164
- ...leftPinnedIndexes,
2165
- ...reactVirtual.defaultRangeExtractor(range),
2166
- ...rightPinnedIndexes,
2167
- ]),
2168
- ], [leftPinnedIndexes, rightPinnedIndexes]) }, columnVirtualizerProps))
2169
- : undefined;
2170
- if (columnVirtualizerInstanceRef && columnVirtualizer) {
2171
- columnVirtualizerInstanceRef.current = columnVirtualizer;
2172
- }
2173
- const virtualColumns = columnVirtualizer
2174
- ? columnVirtualizer.getVirtualItems()
2175
- : undefined;
2176
- let virtualPaddingLeft;
2177
- let virtualPaddingRight;
2178
- if (columnVirtualizer && (virtualColumns === null || virtualColumns === void 0 ? void 0 : virtualColumns.length)) {
2179
- virtualPaddingLeft = (_b = (_a = virtualColumns[leftPinnedIndexes.length]) === null || _a === void 0 ? void 0 : _a.start) !== null && _b !== void 0 ? _b : 0;
2180
- virtualPaddingRight =
2181
- columnVirtualizer.getTotalSize() -
2182
- ((_d = (_c = virtualColumns[virtualColumns.length - 1 - rightPinnedIndexes.length]) === null || _c === void 0 ? void 0 : _c.end) !== null && _d !== void 0 ? _d : 0);
2183
- }
2184
- const props = {
2185
- table,
2186
- virtualColumns,
2187
- virtualPaddingLeft,
2188
- virtualPaddingRight,
2189
- };
2190
- return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(Table__default["default"], 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 && jsxRuntime.jsx(MRT_TableHead, Object.assign({}, props)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsxRuntime.jsx(Memo_MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))) : (jsxRuntime.jsx(MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))), enableTableFooter && jsxRuntime.jsx(MRT_TableFooter, Object.assign({}, props))] })) }));
2191
- };
2192
-
2193
- const MRT_EditActionButtons = ({ row, table, variant = 'icon', }) => {
2194
- const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onCreatingRowCancel, onCreatingRowSave, onEditingRowCancel, onEditingRowSave, }, refs: { editInputRefs }, setCreatingRow, setEditingRow, } = table;
2195
- const { creatingRow, editingRow, isSaving } = getState();
2196
- const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
2197
- const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
2198
- const handleCancel = () => {
2199
- if (isCreating) {
2200
- onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
2201
- setCreatingRow(null);
2202
- }
2203
- else if (isEditing) {
2204
- onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
2205
- setEditingRow(null);
2206
- }
2207
- row._valuesCache = {}; //reset values cache
2208
- };
2209
- const handleSubmitRow = () => {
2210
- var _a;
2211
- //look for auto-filled input values
2212
- (_a = Object.values(editInputRefs === null || editInputRefs === void 0 ? void 0 : editInputRefs.current)
2213
- .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) => {
2214
- if (input.value !== undefined &&
2215
- Object.hasOwn(row === null || row === void 0 ? void 0 : row._valuesCache, input.name)) {
2216
- // @ts-ignore
2217
- row._valuesCache[input.name] = input.value;
2218
- }
2219
- });
2220
- if (isCreating)
2221
- onCreatingRowSave === null || onCreatingRowSave === void 0 ? void 0 : onCreatingRowSave({
2222
- exitCreatingMode: () => setCreatingRow(null),
2223
- row,
2224
- table,
2225
- values: row._valuesCache,
2226
- });
2227
- else if (isEditing) {
2228
- onEditingRowSave === null || onEditingRowSave === void 0 ? void 0 : onEditingRowSave({
2229
- exitEditingMode: () => setEditingRow(null),
2230
- row,
2231
- table,
2232
- values: row === null || row === void 0 ? void 0 : row._valuesCache,
2233
- });
2234
- }
2235
- };
2236
- return (jsxRuntime.jsx(Box__default["default"], { onClick: (e) => e.stopPropagation(), sx: { display: 'flex', gap: '0.75rem' }, children: variant === 'icon' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: localization.cancel, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.cancel, onClick: handleCancel, children: jsxRuntime.jsx(CancelIcon, {}) }) }), jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: localization.save, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.save, color: "info", onClick: handleSubmitRow, children: isSaving ? jsxRuntime.jsx(CircularProgress__default["default"], { size: 18 }) : jsxRuntime.jsx(SaveIcon, {}) }) })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Button__default["default"], { onClick: handleCancel, sx: { minWidth: '100px' }, children: localization.cancel }), jsxRuntime.jsxs(Button__default["default"], { onClick: handleSubmitRow, sx: { minWidth: '100px' }, variant: "contained", children: [isSaving && jsxRuntime.jsx(CircularProgress__default["default"], { color: "inherit", size: 18 }), localization.save] })] })) }));
2237
- };
2238
-
2239
- const MRT_EditRowModal = ({ open, table, }) => {
2240
- var _a;
2241
- const { getState, options: { localization, muiCreateRowModalProps, muiEditRowModalProps, onCreatingRowCancel, onEditingRowCancel, renderCreateRowModalContent, renderEditRowModalContent, }, setCreatingRow, setEditingRow, } = table;
2242
- const { creatingRow, editingRow } = getState();
2243
- const row = (creatingRow !== null && creatingRow !== void 0 ? creatingRow : editingRow);
2244
- const dialogProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditRowModalProps, { row, table })), (creatingRow &&
2245
- parseFromValuesOrFunc(muiCreateRowModalProps, { row, table })));
2246
- const internalEditComponents = row
2247
- .getAllCells()
2248
- .filter((cell) => cell.column.columnDef.columnDefType === 'data')
2249
- .map((cell) => (jsxRuntime.jsx(MRT_EditCellTextField, { cell: cell, table: table }, cell.id)));
2250
- return (jsxRuntime.jsx(Dialog__default["default"], Object.assign({ fullWidth: true, maxWidth: "xs", onClose: (event, reason) => {
2251
- var _a;
2252
- if (creatingRow) {
2253
- onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
2254
- setCreatingRow(null);
2255
- }
2256
- else {
2257
- onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
2258
- setEditingRow(null);
2259
- }
2260
- row._valuesCache = {}; //reset values cache
2261
- (_a = dialogProps.onClose) === null || _a === void 0 ? void 0 : _a.call(dialogProps, event, reason);
2262
- }, open: open }, dialogProps, { children: (_a = ((creatingRow &&
2263
- (renderCreateRowModalContent === null || renderCreateRowModalContent === void 0 ? void 0 : renderCreateRowModalContent({
2264
- internalEditComponents,
2265
- row,
2266
- table,
2267
- }))) ||
2268
- (renderEditRowModalContent === null || renderEditRowModalContent === void 0 ? void 0 : renderEditRowModalContent({
2269
- internalEditComponents,
2270
- row,
2271
- table,
2272
- })))) !== null && _a !== void 0 ? _a : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(DialogTitle__default["default"], { sx: { textAlign: 'center' }, children: localization.edit }), jsxRuntime.jsx(DialogContent__default["default"], { children: jsxRuntime.jsx("form", { onSubmit: (e) => e.preventDefault(), children: jsxRuntime.jsx(Stack__default["default"], { sx: {
2273
- gap: '24px',
2274
- paddingTop: '16px',
2275
- width: '100%',
2276
- }, children: internalEditComponents }) }) }), jsxRuntime.jsx(DialogActions__default["default"], { sx: { p: '1.25rem' }, children: jsxRuntime.jsx(MRT_EditActionButtons, { row: row, table: table, variant: "text" }) })] })) })));
2277
- };
2278
-
2279
- const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? react.useLayoutEffect : react.useEffect;
2280
- const MRT_TableContainer = ({ table, }) => {
2281
- const { getState, options: { createDisplayMode, editDisplayMode, enableStickyHeader, muiTableContainerProps, }, refs: { bottomToolbarRef, tableContainerRef, topToolbarRef }, } = table;
2282
- const { creatingRow, editingRow, isFullScreen } = getState();
2283
- const [totalToolbarHeight, setTotalToolbarHeight] = react.useState(0);
2284
- const tableContainerProps = parseFromValuesOrFunc(muiTableContainerProps, {
2285
- table,
2286
- });
2287
- useIsomorphicLayoutEffect(() => {
2288
- var _a, _b, _c, _d;
2289
- const topToolbarHeight = typeof document !== 'undefined'
2290
- ? (_b = (_a = topToolbarRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0
2291
- : 0;
2292
- const bottomToolbarHeight = typeof document !== 'undefined'
2293
- ? (_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
2294
- : 0;
2295
- setTotalToolbarHeight(topToolbarHeight + bottomToolbarHeight);
2296
- });
2297
- const createModalOpen = createDisplayMode === 'modal' && creatingRow;
2298
- const editModalOpen = editDisplayMode === 'modal' && editingRow;
2299
- return (jsxRuntime.jsxs(TableContainer__default["default"], Object.assign({}, tableContainerProps, { ref: (node) => {
2300
- if (node) {
2301
- tableContainerRef.current = node;
2302
- if (tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.ref) {
2303
- //@ts-ignore
2304
- tableContainerProps.ref.current = node;
2305
- }
2306
- }
2307
- }, style: Object.assign({ maxHeight: isFullScreen
2308
- ? `calc(100vh - ${totalToolbarHeight}px)`
2309
- : undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style), sx: (theme) => (Object.assign({ maxHeight: enableStickyHeader
2310
- ? `clamp(350px, calc(100vh - ${totalToolbarHeight}px), 9999px)`
2311
- : undefined, maxWidth: '100%', overflow: 'auto' }, parseFromValuesOrFunc(tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx, theme))), children: [jsxRuntime.jsx(MRT_Table, { table: table }), (createModalOpen || editModalOpen) && (jsxRuntime.jsx(MRT_EditRowModal, { open: true, table: table }))] })));
2312
- };
2313
-
2314
2110
  const MRT_LinearProgressBar = ({ isTopToolbar, table, }) => {
2315
2111
  const { getState, options: { muiLinearProgressProps }, } = table;
2316
2112
  const { isLoading, showProgressBars } = getState();
@@ -2326,61 +2122,202 @@ const MRT_LinearProgressBar = ({ isTopToolbar, table, }) => {
2326
2122
  }, unmountOnExit: true, children: jsxRuntime.jsx(LinearProgress__default["default"], Object.assign({ "aria-busy": "true", "aria-label": "Loading", sx: { position: 'relative' } }, linearProgressProps)) }));
2327
2123
  };
2328
2124
 
2329
- const defaultPageSizeOptions = [5, 10, 15, 20, 25, 30, 50, 100];
2330
- const MRT_TablePagination = ({ position = 'bottom', table, }) => {
2331
- const { getPrePaginationRowModel, getState, options: { enableToolbarInternalActions, icons: { ChevronLefIcon, ChevronRightIcon, FirstPageIcon, LastPageIcon }, localization, muiTablePaginationProps, paginationDisplayMode, rowCount, }, setPageIndex, setPageSize, } = table;
2332
- const { pagination: { pageIndex = 0, pageSize = 10 }, showGlobalFilter, } = getState();
2333
- const paginationProps = parseFromValuesOrFunc(muiTablePaginationProps, {
2334
- table,
2335
- });
2336
- const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
2337
- const numberOfPages = Math.ceil(totalRowCount / pageSize);
2338
- const showFirstLastPageButtons = numberOfPages > 2;
2339
- const showFirstButton = showFirstLastPageButtons && (paginationProps === null || paginationProps === void 0 ? void 0 : paginationProps.showFirstButton) !== false;
2340
- const showLastButton = showFirstLastPageButtons && (paginationProps === null || paginationProps === void 0 ? void 0 : paginationProps.showLastButton) !== false;
2341
- const firstRowIndex = pageIndex * pageSize;
2342
- const lastRowIndex = Math.min(pageIndex * pageSize + pageSize, totalRowCount);
2343
- return (jsxRuntime.jsxs(Box__default["default"], { sx: {
2344
- alignItems: 'center',
2345
- display: 'flex',
2346
- gap: '8px',
2347
- justifyContent: 'space-between',
2348
- mt: position === 'top' &&
2349
- enableToolbarInternalActions &&
2350
- !showGlobalFilter
2351
- ? '3rem'
2352
- : undefined,
2353
- position: 'relative',
2354
- px: '4px',
2355
- py: '12px',
2356
- zIndex: 2,
2357
- }, children: [(paginationProps === null || paginationProps === void 0 ? void 0 : paginationProps.showRowsPerPage) !== false && (jsxRuntime.jsxs(Box__default["default"], { sx: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [jsxRuntime.jsx(InputLabel__default["default"], { htmlFor: "mrt-rows-per-page", sx: { mb: 0 }, children: localization.rowsPerPage }), jsxRuntime.jsx(Select__default["default"], { 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) => (jsxRuntime.jsx(MenuItem__default["default"], { sx: { m: 0 }, value: value, children: value }, value))) })] })), paginationDisplayMode === 'pages' ? (jsxRuntime.jsx(Pagination__default["default"], Object.assign({ count: numberOfPages, onChange: (_e, newPageIndex) => setPageIndex(newPageIndex - 1), page: pageIndex + 1, renderItem: (item) => (jsxRuntime.jsx(PaginationItem__default["default"], Object.assign({ slots: {
2358
- first: FirstPageIcon,
2359
- last: LastPageIcon,
2125
+ /******************************************************************************
2126
+ Copyright (c) Microsoft Corporation.
2127
+
2128
+ Permission to use, copy, modify, and/or distribute this software for any
2129
+ purpose with or without fee is hereby granted.
2130
+
2131
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2132
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2133
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2134
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2135
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2136
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2137
+ PERFORMANCE OF THIS SOFTWARE.
2138
+ ***************************************************************************** */
2139
+ function __rest(s, e) {
2140
+ var t = {};
2141
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2142
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2143
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2144
+ }
2145
+ return t;
2146
+ }
2147
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
2148
+ var e = new Error(message);
2149
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
2150
+ };
2151
+
2152
+ const defaultRowsPerPage = [5, 10, 15, 20, 25, 30, 50, 100];
2153
+ const MRT_TablePagination = ({ position = 'bottom', table, }) => {
2154
+ const { getPrePaginationRowModel, getState, options: { enableToolbarInternalActions, icons: { ChevronLeftIcon, ChevronRightIcon, FirstPageIcon, LastPageIcon }, localization, muiPaginationProps, paginationDisplayMode, rowCount, }, setPageIndex, setPageSize, } = table;
2155
+ const { pagination: { pageIndex = 0, pageSize = 10 }, showGlobalFilter, } = getState();
2156
+ const paginationProps = parseFromValuesOrFunc(muiPaginationProps, {
2157
+ table,
2158
+ });
2159
+ const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
2160
+ const numberOfPages = Math.ceil(totalRowCount / pageSize);
2161
+ const showFirstLastPageButtons = numberOfPages > 2;
2162
+ const firstRowIndex = pageIndex * pageSize;
2163
+ const lastRowIndex = Math.min(pageIndex * pageSize + pageSize, totalRowCount);
2164
+ const _a = paginationProps !== null && paginationProps !== void 0 ? paginationProps : {}, { showRowsPerPage = true, rowsPerPageOptions = defaultRowsPerPage, showFirstButton = showFirstLastPageButtons, showLastButton = showFirstLastPageButtons } = _a, rest = __rest(_a, ["showRowsPerPage", "rowsPerPageOptions", "showFirstButton", "showLastButton"]);
2165
+ return (jsxRuntime.jsxs(Box__default["default"], { sx: {
2166
+ alignItems: 'center',
2167
+ display: 'flex',
2168
+ gap: '8px',
2169
+ justifyContent: 'space-between',
2170
+ justifySelf: 'flex-end',
2171
+ mt: position === 'top' &&
2172
+ enableToolbarInternalActions &&
2173
+ !showGlobalFilter
2174
+ ? '3rem'
2175
+ : undefined,
2176
+ position: 'relative',
2177
+ px: '4px',
2178
+ py: '12px',
2179
+ zIndex: 2,
2180
+ }, children: [showRowsPerPage && (jsxRuntime.jsxs(Box__default["default"], { sx: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [jsxRuntime.jsx(InputLabel__default["default"], { htmlFor: "mrt-rows-per-page", sx: { mb: 0 }, children: localization.rowsPerPage }), jsxRuntime.jsx(Select__default["default"], { 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) => (jsxRuntime.jsx(MenuItem__default["default"], { sx: { m: 0 }, value: value, children: value }, value))) })] })), paginationDisplayMode === 'pages' ? (jsxRuntime.jsx(Pagination__default["default"], Object.assign({ count: numberOfPages, onChange: (_e, newPageIndex) => setPageIndex(newPageIndex - 1), page: pageIndex + 1, renderItem: (item) => (jsxRuntime.jsx(PaginationItem__default["default"], Object.assign({ slots: {
2181
+ first: FirstPageIcon,
2182
+ last: LastPageIcon,
2360
2183
  next: ChevronRightIcon,
2361
- previous: ChevronLefIcon,
2362
- } }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton }, paginationProps))) : paginationDisplayMode === 'default' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography__default["default"], { mb: "0", mx: "8px", variant: "body2", children: `${lastRowIndex === 0 ? 0 : (firstRowIndex + 1).toLocaleString()}-${lastRowIndex.toLocaleString()} ${localization.of} ${totalRowCount.toLocaleString()}` }), jsxRuntime.jsxs(Box__default["default"], { gap: "xs", children: [showFirstButton && (jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToFirstPage, disabled: pageIndex <= 0, onClick: () => setPageIndex(0), size: "small", children: jsxRuntime.jsx(FirstPageIcon, {}) })), jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToPreviousPage, disabled: pageIndex <= 0, onClick: () => setPageIndex(pageIndex - 1), size: "small", children: jsxRuntime.jsx(ChevronLefIcon, {}) }), jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToNextPage, disabled: lastRowIndex >= totalRowCount, onClick: () => setPageIndex(pageIndex + 1), size: "small", children: jsxRuntime.jsx(ChevronRightIcon, {}) }), showLastButton && (jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToLastPage, disabled: lastRowIndex >= totalRowCount, onClick: () => setPageIndex(numberOfPages - 1), size: "small", children: jsxRuntime.jsx(LastPageIcon, {}) }))] })] })) : null] }));
2184
+ previous: ChevronLeftIcon,
2185
+ } }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton }, rest))) : paginationDisplayMode === 'default' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography__default["default"], { sx: { mb: 0, mx: '4px', minWidth: '10ch' }, variant: "body2", children: `${lastRowIndex === 0 ? 0 : (firstRowIndex + 1).toLocaleString()}-${lastRowIndex.toLocaleString()} ${localization.of} ${totalRowCount.toLocaleString()}` }), jsxRuntime.jsxs(Box__default["default"], { gap: "xs", children: [showFirstButton && (jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToFirstPage, disabled: pageIndex <= 0, onClick: () => setPageIndex(0), size: "small", children: jsxRuntime.jsx(FirstPageIcon, {}) })), jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToPreviousPage, disabled: pageIndex <= 0, onClick: () => setPageIndex(pageIndex - 1), size: "small", children: jsxRuntime.jsx(ChevronLeftIcon, {}) }), jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToNextPage, disabled: lastRowIndex >= totalRowCount, onClick: () => setPageIndex(pageIndex + 1), size: "small", children: jsxRuntime.jsx(ChevronRightIcon, {}) }), showLastButton && (jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToLastPage, disabled: lastRowIndex >= totalRowCount, onClick: () => setPageIndex(numberOfPages - 1), size: "small", children: jsxRuntime.jsx(LastPageIcon, {}) }))] })] })) : null] }));
2186
+ };
2187
+
2188
+ const MRT_GlobalFilterTextField = ({ table, }) => {
2189
+ var _a;
2190
+ const { getState, options: { enableGlobalFilterModes, icons: { CloseIcon, SearchIcon }, localization, manualFiltering, muiSearchTextFieldProps, }, refs: { searchInputRef }, setGlobalFilter, } = table;
2191
+ const { globalFilter, showGlobalFilter } = getState();
2192
+ const textFieldProps = parseFromValuesOrFunc(muiSearchTextFieldProps, {
2193
+ table,
2194
+ });
2195
+ const isMounted = react.useRef(false);
2196
+ const [anchorEl, setAnchorEl] = react.useState(null);
2197
+ const [searchValue, setSearchValue] = react.useState(globalFilter !== null && globalFilter !== void 0 ? globalFilter : '');
2198
+ const handleChangeDebounced = react.useCallback(utils.debounce((event) => {
2199
+ var _a;
2200
+ setGlobalFilter((_a = event.target.value) !== null && _a !== void 0 ? _a : undefined);
2201
+ }, manualFiltering ? 500 : 250), []);
2202
+ const handleChange = (event) => {
2203
+ setSearchValue(event.target.value);
2204
+ handleChangeDebounced(event);
2205
+ };
2206
+ const handleGlobalFilterMenuOpen = (event) => {
2207
+ setAnchorEl(event.currentTarget);
2208
+ };
2209
+ const handleClear = () => {
2210
+ setSearchValue('');
2211
+ setGlobalFilter(undefined);
2212
+ };
2213
+ react.useEffect(() => {
2214
+ if (isMounted.current) {
2215
+ if (globalFilter === undefined) {
2216
+ handleClear();
2217
+ }
2218
+ else {
2219
+ setSearchValue(globalFilter);
2220
+ }
2221
+ }
2222
+ isMounted.current = true;
2223
+ }, [globalFilter]);
2224
+ return (jsxRuntime.jsxs(Collapse__default["default"], { in: showGlobalFilter, mountOnEnter: true, orientation: "horizontal", unmountOnExit: true, children: [jsxRuntime.jsx(TextField__default["default"], Object.assign({ InputProps: {
2225
+ endAdornment: (jsxRuntime.jsx(InputAdornment__default["default"], { position: "end", children: jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: (_a = localization.clearSearch) !== null && _a !== void 0 ? _a : '', children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.clearSearch, disabled: !(searchValue === null || searchValue === void 0 ? void 0 : searchValue.length), onClick: handleClear, size: "small", children: jsxRuntime.jsx(CloseIcon, {}) }) }) }) })),
2226
+ startAdornment: enableGlobalFilterModes ? (jsxRuntime.jsx(InputAdornment__default["default"], { position: "start", children: jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: localization.changeSearchMode, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.changeSearchMode, onClick: handleGlobalFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' }, children: jsxRuntime.jsx(SearchIcon, {}) }) }) })) : (jsxRuntime.jsx(SearchIcon, { style: { marginRight: '4px' } })),
2227
+ }, onChange: handleChange, placeholder: localization.search, value: searchValue !== null && searchValue !== void 0 ? searchValue : '', variant: "standard" }, textFieldProps, { inputRef: (inputRef) => {
2228
+ searchInputRef.current = inputRef;
2229
+ if (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.inputRef) {
2230
+ textFieldProps.inputRef = inputRef;
2231
+ }
2232
+ } })), jsxRuntime.jsx(MRT_FilterOptionMenu, { anchorEl: anchorEl, onSelect: handleClear, setAnchorEl: setAnchorEl, table: table })] }));
2233
+ };
2234
+
2235
+ const MRT_SelectCheckbox = ({ row, selectAll, table, }) => {
2236
+ var _a;
2237
+ const { getState, options: { enableMultiRowSelection, enableRowPinning, localization, muiSelectAllCheckboxProps, muiSelectCheckboxProps, rowPinningDisplayMode, selectAllMode, }, } = table;
2238
+ const { density, isLoading } = getState();
2239
+ const checkboxProps = !row
2240
+ ? parseFromValuesOrFunc(muiSelectAllCheckboxProps, { table })
2241
+ : parseFromValuesOrFunc(muiSelectCheckboxProps, { row, table });
2242
+ const allRowsSelected = selectAll
2243
+ ? selectAllMode === 'page'
2244
+ ? table.getIsAllPageRowsSelected()
2245
+ : table.getIsAllRowsSelected()
2246
+ : undefined;
2247
+ const commonProps = Object.assign(Object.assign({ checked: selectAll ? allRowsSelected : row === null || row === void 0 ? void 0 : row.getIsSelected(), disabled: isLoading || (row && !row.getCanSelect()), inputProps: {
2248
+ 'aria-label': selectAll
2249
+ ? localization.toggleSelectAll
2250
+ : localization.toggleSelectRow,
2251
+ }, onChange: (event) => {
2252
+ event.stopPropagation();
2253
+ row
2254
+ ? row.getToggleSelectedHandler()(event)
2255
+ : selectAllMode === 'all'
2256
+ ? table.getToggleAllRowsSelectedHandler()(event)
2257
+ : table.getToggleAllPageRowsSelectedHandler()(event);
2258
+ if (enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('select'))) {
2259
+ if (row) {
2260
+ row.pin(!row.getIsPinned() && event.target.checked
2261
+ ? (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('bottom'))
2262
+ ? 'bottom'
2263
+ : 'top'
2264
+ : false);
2265
+ }
2266
+ else {
2267
+ table.setRowPinning({ bottom: [], top: [] });
2268
+ }
2269
+ }
2270
+ }, size: (density === 'compact' ? 'small' : 'medium') }, checkboxProps), { onClick: (e) => {
2271
+ var _a;
2272
+ e.stopPropagation();
2273
+ (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
2274
+ }, 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 });
2275
+ return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _a !== void 0 ? _a : (selectAll
2276
+ ? localization.toggleSelectAll
2277
+ : localization.toggleSelectRow), children: enableMultiRowSelection === false ? (jsxRuntime.jsx(Radio__default["default"], Object.assign({}, commonProps))) : (jsxRuntime.jsx(Checkbox__default["default"], Object.assign({ indeterminate: selectAll
2278
+ ? table.getIsSomeRowsSelected() && !allRowsSelected
2279
+ : row === null || row === void 0 ? void 0 : row.getIsSomeSelected() }, commonProps))) }));
2363
2280
  };
2364
2281
 
2365
2282
  const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
2366
- var _a, _b;
2367
- const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { localization, muiToolbarAlertBannerChipProps, muiToolbarAlertBannerProps, positionToolbarAlertBanner, rowCount, }, } = table;
2368
- const { grouping, showAlertBanner } = getState();
2283
+ var _a, _b, _c;
2284
+ const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { enableRowSelection, enableSelectAll, localization, muiToolbarAlertBannerChipProps, muiToolbarAlertBannerProps, positionToolbarAlertBanner, renderToolbarAlertBannerContent, rowCount, }, refs: { tablePaperRef }, } = table;
2285
+ const { density, grouping, showAlertBanner } = getState();
2369
2286
  const alertProps = parseFromValuesOrFunc(muiToolbarAlertBannerProps, {
2370
2287
  table,
2371
2288
  });
2372
2289
  const chipProps = parseFromValuesOrFunc(muiToolbarAlertBannerChipProps, {
2373
2290
  table,
2374
2291
  });
2375
- const selectMessage = getSelectedRowModel().rows.length > 0
2292
+ const selectedAlert = getSelectedRowModel().rows.length > 0
2376
2293
  ? (_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())
2377
2294
  : null;
2378
- const groupedByMessage = grouping.length > 0 ? (jsxRuntime.jsxs("span", { children: [localization.groupedBy, ' ', grouping.map((columnId, index) => (jsxRuntime.jsxs(react.Fragment, { children: [index > 0 ? localization.thenBy : '', jsxRuntime.jsx(Chip__default["default"], Object.assign({ label: table.getColumn(columnId).columnDef.header, onDelete: () => table.getColumn(columnId).toggleGrouping() }, chipProps))] }, `${index}-${columnId}`)))] })) : null;
2379
- return (jsxRuntime.jsx(Collapse__default["default"], { in: showAlertBanner || !!selectMessage || !!groupedByMessage, timeout: stackAlertBanner ? 200 : 0, children: jsxRuntime.jsxs(Alert__default["default"], Object.assign({ color: "info", icon: false }, alertProps, { sx: (theme) => (Object.assign({ borderRadius: 0, fontSize: '1rem', left: 0, mb: stackAlertBanner
2380
- ? 0
2381
- : positionToolbarAlertBanner === 'bottom'
2382
- ? '-1rem'
2383
- : 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) && jsxRuntime.jsx(AlertTitle__default["default"], { children: alertProps.title }), jsxRuntime.jsxs(Box__default["default"], { 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) && (jsxRuntime.jsx("br", {})), selectMessage, selectMessage && groupedByMessage && jsxRuntime.jsx("br", {}), groupedByMessage] })] })) }));
2295
+ const groupedAlert = grouping.length > 0 ? (jsxRuntime.jsxs("span", { children: [localization.groupedBy, ' ', grouping.map((columnId, index) => (jsxRuntime.jsxs(react.Fragment, { children: [index > 0 ? localization.thenBy : '', jsxRuntime.jsx(Chip__default["default"], Object.assign({ label: table.getColumn(columnId).columnDef.header, onDelete: () => table.getColumn(columnId).toggleGrouping() }, chipProps))] }, `${index}-${columnId}`)))] })) : null;
2296
+ return (jsxRuntime.jsx(Collapse__default["default"], { in: showAlertBanner || !!selectedAlert || !!groupedAlert, timeout: stackAlertBanner ? 200 : 0, children: jsxRuntime.jsx(Alert__default["default"], Object.assign({ color: "info", icon: false }, alertProps, { sx: (theme) => {
2297
+ var _a, _b;
2298
+ return (Object.assign({ '& .MuiAlert-message': {
2299
+ maxWidth: `calc(${(_b = (_a = tablePaperRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _b !== void 0 ? _b : 360}px - 1rem)`,
2300
+ width: '100%',
2301
+ }, borderRadius: 0, fontSize: '1rem', left: 0, mb: stackAlertBanner
2302
+ ? 0
2303
+ : positionToolbarAlertBanner === 'bottom'
2304
+ ? '-1rem'
2305
+ : undefined, p: 0, position: 'relative', right: 0, top: 0, width: '100%', zIndex: 2 }, parseFromValuesOrFunc(alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx, theme)));
2306
+ }, children: (_c = renderToolbarAlertBannerContent === null || renderToolbarAlertBannerContent === void 0 ? void 0 : renderToolbarAlertBannerContent({
2307
+ groupedAlert,
2308
+ selectedAlert,
2309
+ table,
2310
+ })) !== null && _c !== void 0 ? _c : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [(alertProps === null || alertProps === void 0 ? void 0 : alertProps.title) && jsxRuntime.jsx(AlertTitle__default["default"], { children: alertProps.title }), jsxRuntime.jsxs(Stack__default["default"], { sx: {
2311
+ p: positionToolbarAlertBanner !== 'head-overlay'
2312
+ ? '0.5rem 1rem'
2313
+ : density === 'spacious'
2314
+ ? '0.75rem 1.25rem'
2315
+ : density === 'comfortable'
2316
+ ? '0.5rem 0.75rem'
2317
+ : '0.25rem 0.5rem',
2318
+ }, children: [alertProps === null || alertProps === void 0 ? void 0 : alertProps.children, (alertProps === null || alertProps === void 0 ? void 0 : alertProps.children) && (selectedAlert || groupedAlert) && (jsxRuntime.jsx("br", {})), jsxRuntime.jsxs(Box__default["default"], { sx: { display: 'flex' }, children: [enableRowSelection &&
2319
+ enableSelectAll &&
2320
+ positionToolbarAlertBanner === 'head-overlay' && (jsxRuntime.jsx(MRT_SelectCheckbox, { selectAll: true, table: table })), ' ', selectedAlert] }), selectedAlert && groupedAlert && jsxRuntime.jsx("br", {}), groupedAlert] })] })) })) }));
2384
2321
  };
2385
2322
 
2386
2323
  const MRT_ToolbarDropZone = ({ table, }) => {
@@ -2414,33 +2351,6 @@ const MRT_ToolbarDropZone = ({ table, }) => {
2414
2351
  }), children: jsxRuntime.jsx(Typography__default["default"], { 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 : '') }) }) }));
2415
2352
  };
2416
2353
 
2417
- /******************************************************************************
2418
- Copyright (c) Microsoft Corporation.
2419
-
2420
- Permission to use, copy, modify, and/or distribute this software for any
2421
- purpose with or without fee is hereby granted.
2422
-
2423
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2424
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2425
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2426
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2427
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2428
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2429
- PERFORMANCE OF THIS SOFTWARE.
2430
- ***************************************************************************** */
2431
- function __rest(s, e) {
2432
- var t = {};
2433
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2434
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2435
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2436
- }
2437
- return t;
2438
- }
2439
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
2440
- var e = new Error(message);
2441
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
2442
- };
2443
-
2444
2354
  const MRT_ColumnPinningButtons = ({ column, table, }) => {
2445
2355
  const { options: { icons: { PushPinIcon }, localization, }, } = table;
2446
2356
  const handlePinColumn = (pinDirection) => {
@@ -2608,7 +2518,7 @@ const MRT_ToggleFullScreenButton = (_a) => {
2608
2518
  setTooltipOpened(false);
2609
2519
  setIsFullScreen(!isFullScreen);
2610
2520
  };
2611
- return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, open: tooltipOpened, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleFullScreen, children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.showHideFilters, onClick: handleToggleFullScreen, onMouseEnter: () => setTooltipOpened(true), onMouseLeave: () => setTooltipOpened(false) }, rest, { title: undefined, children: isFullScreen ? jsxRuntime.jsx(FullscreenExitIcon, {}) : jsxRuntime.jsx(FullscreenIcon, {}) })) }));
2521
+ return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, open: tooltipOpened, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleFullScreen, children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.toggleFullScreen, onClick: handleToggleFullScreen, onMouseEnter: () => setTooltipOpened(true), onMouseLeave: () => setTooltipOpened(false) }, rest, { title: undefined, children: isFullScreen ? jsxRuntime.jsx(FullscreenExitIcon, {}) : jsxRuntime.jsx(FullscreenIcon, {}) })) }));
2612
2522
  };
2613
2523
 
2614
2524
  const MRT_ToggleGlobalFilterButton = (_a) => {
@@ -2639,56 +2549,9 @@ const MRT_ToolbarInternalButtons = ({ table, }) => {
2639
2549
  columnFilterDisplayMode !== 'popover' && (jsxRuntime.jsx(MRT_ToggleFiltersButton, { table: table })), (enableHiding || enableColumnOrdering || enableColumnPinning) && (jsxRuntime.jsx(MRT_ShowHideColumnsButton, { table: table })), enableDensityToggle && (jsxRuntime.jsx(MRT_ToggleDensePaddingButton, { table: table })), enableFullScreenToggle && (jsxRuntime.jsx(MRT_ToggleFullScreenButton, { table: table }))] })) }));
2640
2550
  };
2641
2551
 
2642
- const MRT_GlobalFilterTextField = ({ table, }) => {
2643
- var _a;
2644
- const { getState, options: { enableGlobalFilterModes, icons: { CloseIcon, SearchIcon }, localization, manualFiltering, muiSearchTextFieldProps, }, refs: { searchInputRef }, setGlobalFilter, } = table;
2645
- const { globalFilter, showGlobalFilter } = getState();
2646
- const textFieldProps = parseFromValuesOrFunc(muiSearchTextFieldProps, {
2647
- table,
2648
- });
2649
- const isMounted = react.useRef(false);
2650
- const [anchorEl, setAnchorEl] = react.useState(null);
2651
- const [searchValue, setSearchValue] = react.useState(globalFilter !== null && globalFilter !== void 0 ? globalFilter : '');
2652
- const handleChangeDebounced = react.useCallback(utils.debounce((event) => {
2653
- var _a;
2654
- setGlobalFilter((_a = event.target.value) !== null && _a !== void 0 ? _a : undefined);
2655
- }, manualFiltering ? 500 : 250), []);
2656
- const handleChange = (event) => {
2657
- setSearchValue(event.target.value);
2658
- handleChangeDebounced(event);
2659
- };
2660
- const handleGlobalFilterMenuOpen = (event) => {
2661
- setAnchorEl(event.currentTarget);
2662
- };
2663
- const handleClear = () => {
2664
- setSearchValue('');
2665
- setGlobalFilter(undefined);
2666
- };
2667
- react.useEffect(() => {
2668
- if (isMounted.current) {
2669
- if (globalFilter === undefined) {
2670
- handleClear();
2671
- }
2672
- else {
2673
- setSearchValue(globalFilter);
2674
- }
2675
- }
2676
- isMounted.current = true;
2677
- }, [globalFilter]);
2678
- return (jsxRuntime.jsxs(Collapse__default["default"], { in: showGlobalFilter, mountOnEnter: true, orientation: "horizontal", unmountOnExit: true, children: [jsxRuntime.jsx(TextField__default["default"], Object.assign({ InputProps: {
2679
- endAdornment: (jsxRuntime.jsx(InputAdornment__default["default"], { position: "end", children: jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: (_a = localization.clearSearch) !== null && _a !== void 0 ? _a : '', children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.clearSearch, disabled: !(searchValue === null || searchValue === void 0 ? void 0 : searchValue.length), onClick: handleClear, size: "small", children: jsxRuntime.jsx(CloseIcon, {}) }) }) }) })),
2680
- startAdornment: enableGlobalFilterModes ? (jsxRuntime.jsx(InputAdornment__default["default"], { position: "start", children: jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: localization.changeSearchMode, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.changeSearchMode, onClick: handleGlobalFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' }, children: jsxRuntime.jsx(SearchIcon, {}) }) }) })) : (jsxRuntime.jsx(SearchIcon, { style: { marginRight: '4px' } })),
2681
- }, onChange: handleChange, placeholder: localization.search, value: searchValue !== null && searchValue !== void 0 ? searchValue : '', variant: "standard" }, textFieldProps, { inputRef: (inputRef) => {
2682
- searchInputRef.current = inputRef;
2683
- if (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.inputRef) {
2684
- textFieldProps.inputRef = inputRef;
2685
- }
2686
- } })), jsxRuntime.jsx(MRT_FilterOptionMenu, { anchorEl: anchorEl, onSelect: handleClear, setAnchorEl: setAnchorEl, table: table })] }));
2687
- };
2688
-
2689
2552
  const commonToolbarStyles = ({ theme }) => ({
2690
2553
  alignItems: 'flex-start',
2691
- backgroundColor: styles.lighten(theme.palette.background.default, 0.04),
2554
+ backgroundColor: styles.lighten(theme.palette.background.default, 0.05),
2692
2555
  backgroundImage: 'none',
2693
2556
  display: 'grid',
2694
2557
  flexWrap: 'wrap-reverse',
@@ -2761,6 +2624,214 @@ const MRT_BottomToolbar = ({ table, }) => {
2761
2624
  ['both', 'bottom'].includes(positionPagination !== null && positionPagination !== void 0 ? positionPagination : '') && (jsxRuntime.jsx(MRT_TablePagination, { position: "bottom", table: table })) })] })] })));
2762
2625
  };
2763
2626
 
2627
+ const MRT_TableHead = ({ table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
2628
+ const { getHeaderGroups, getSelectedRowModel, getState, options: { enableStickyHeader, layoutMode, muiTableHeadProps, positionToolbarAlertBanner, }, refs: { tableHeadRef }, } = table;
2629
+ const { isFullScreen, showAlertBanner } = getState();
2630
+ const tableHeadProps = parseFromValuesOrFunc(muiTableHeadProps, { table });
2631
+ const stickyHeader = enableStickyHeader || isFullScreen;
2632
+ return (jsxRuntime.jsx(TableHead__default["default"], Object.assign({}, tableHeadProps, { ref: (ref) => {
2633
+ tableHeadRef.current = ref;
2634
+ if (tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.ref) {
2635
+ // @ts-ignore
2636
+ tableHeadProps.ref.current = ref;
2637
+ }
2638
+ }, 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' &&
2639
+ (showAlertBanner || getSelectedRowModel().rows.length > 0) ? (jsxRuntime.jsx("tr", { style: { display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined }, children: jsxRuntime.jsx("th", { colSpan: table.getVisibleLeafColumns().length, style: {
2640
+ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : 'table-cell',
2641
+ padding: 0,
2642
+ }, children: jsxRuntime.jsx(MRT_ToolbarAlertBanner, { table: table }) }) })) : (getHeaderGroups().map((headerGroup) => (jsxRuntime.jsx(MRT_TableHeadRow, { headerGroup: headerGroup, table: table, virtualColumns: virtualColumns, virtualPaddingLeft: virtualPaddingLeft, virtualPaddingRight: virtualPaddingRight }, headerGroup.id)))) })));
2643
+ };
2644
+
2645
+ const MRT_Table = ({ table, }) => {
2646
+ var _a, _b, _c, _d;
2647
+ const { getFlatHeaders, getState, options: { columnVirtualizerInstanceRef, columnVirtualizerOptions, columns, enableColumnPinning, enableColumnResizing, enableColumnVirtualization, enableStickyHeader, enableTableFooter, enableTableHead, layoutMode, memoMode, muiTableProps, }, refs: { tableContainerRef }, } = table;
2648
+ const { columnPinning, columnSizing, columnSizingInfo, columnVisibility, isFullScreen, } = getState();
2649
+ const tableProps = parseFromValuesOrFunc(muiTableProps, { table });
2650
+ const columnVirtualizerProps = parseFromValuesOrFunc(columnVirtualizerOptions, { table });
2651
+ const columnSizeVars = react.useMemo(() => {
2652
+ const headers = getFlatHeaders();
2653
+ const colSizes = {};
2654
+ for (let i = 0; i < headers.length; i++) {
2655
+ const header = headers[i];
2656
+ const colSize = header.getSize();
2657
+ colSizes[`--header-${parseCSSVarId(header.id)}-size`] = colSize;
2658
+ colSizes[`--col-${parseCSSVarId(header.column.id)}-size`] = colSize;
2659
+ }
2660
+ return colSizes;
2661
+ }, [columns, columnSizing, columnSizingInfo, columnVisibility]);
2662
+ //get first 16 column widths and average them
2663
+ const averageColumnWidth = react.useMemo(() => {
2664
+ var _a, _b, _c, _d;
2665
+ if (!enableColumnVirtualization)
2666
+ return 0;
2667
+ const columnsWidths = (_d = (_c = (_b = (_a = table
2668
+ .getRowModel()
2669
+ .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 : [];
2670
+ return columnsWidths.reduce((a, b) => a + b, 0) / columnsWidths.length;
2671
+ }, [table.getRowModel().rows, columnPinning, columnVisibility]);
2672
+ const [leftPinnedIndexes, rightPinnedIndexes] = react.useMemo(() => enableColumnVirtualization && enableColumnPinning
2673
+ ? [
2674
+ table.getLeftLeafColumns().map((c) => c.getPinnedIndex()),
2675
+ table
2676
+ .getRightLeafColumns()
2677
+ .map((c) => table.getVisibleLeafColumns().length - c.getPinnedIndex() - 1),
2678
+ ]
2679
+ : [[], []], [columnPinning, enableColumnVirtualization, enableColumnPinning]);
2680
+ const columnVirtualizer = enableColumnVirtualization
2681
+ ? reactVirtual.useVirtualizer(Object.assign({ count: table.getVisibleLeafColumns().length, estimateSize: () => averageColumnWidth, getScrollElement: () => tableContainerRef.current, horizontal: true, overscan: 3, rangeExtractor: react.useCallback((range) => [
2682
+ ...new Set([
2683
+ ...leftPinnedIndexes,
2684
+ ...reactVirtual.defaultRangeExtractor(range),
2685
+ ...rightPinnedIndexes,
2686
+ ]),
2687
+ ], [leftPinnedIndexes, rightPinnedIndexes]) }, columnVirtualizerProps))
2688
+ : undefined;
2689
+ if (columnVirtualizerInstanceRef && columnVirtualizer) {
2690
+ columnVirtualizerInstanceRef.current = columnVirtualizer;
2691
+ }
2692
+ const virtualColumns = columnVirtualizer
2693
+ ? columnVirtualizer.getVirtualItems()
2694
+ : undefined;
2695
+ let virtualPaddingLeft;
2696
+ let virtualPaddingRight;
2697
+ if (columnVirtualizer && (virtualColumns === null || virtualColumns === void 0 ? void 0 : virtualColumns.length)) {
2698
+ virtualPaddingLeft = (_b = (_a = virtualColumns[leftPinnedIndexes.length]) === null || _a === void 0 ? void 0 : _a.start) !== null && _b !== void 0 ? _b : 0;
2699
+ virtualPaddingRight =
2700
+ columnVirtualizer.getTotalSize() -
2701
+ ((_d = (_c = virtualColumns[virtualColumns.length - 1 - rightPinnedIndexes.length]) === null || _c === void 0 ? void 0 : _c.end) !== null && _d !== void 0 ? _d : 0);
2702
+ }
2703
+ const props = {
2704
+ table,
2705
+ virtualColumns,
2706
+ virtualPaddingLeft,
2707
+ virtualPaddingRight,
2708
+ };
2709
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(Table__default["default"], 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
2710
+ ? 'fixed'
2711
+ : undefined }, parseFromValuesOrFunc(tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx, theme))), children: [enableTableHead && jsxRuntime.jsx(MRT_TableHead, Object.assign({}, props)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsxRuntime.jsx(Memo_MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))) : (jsxRuntime.jsx(MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))), enableTableFooter && jsxRuntime.jsx(MRT_TableFooter, Object.assign({}, props))] })) }));
2712
+ };
2713
+
2714
+ const MRT_EditActionButtons = ({ row, table, variant = 'icon', }) => {
2715
+ const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onCreatingRowCancel, onCreatingRowSave, onEditingRowCancel, onEditingRowSave, }, refs: { editInputRefs }, setCreatingRow, setEditingRow, } = table;
2716
+ const { creatingRow, editingRow, isSaving } = getState();
2717
+ const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
2718
+ const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
2719
+ const handleCancel = () => {
2720
+ if (isCreating) {
2721
+ onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
2722
+ setCreatingRow(null);
2723
+ }
2724
+ else if (isEditing) {
2725
+ onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
2726
+ setEditingRow(null);
2727
+ }
2728
+ row._valuesCache = {}; //reset values cache
2729
+ };
2730
+ const handleSubmitRow = () => {
2731
+ var _a;
2732
+ //look for auto-filled input values
2733
+ (_a = Object.values(editInputRefs === null || editInputRefs === void 0 ? void 0 : editInputRefs.current)
2734
+ .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) => {
2735
+ if (input.value !== undefined &&
2736
+ Object.hasOwn(row === null || row === void 0 ? void 0 : row._valuesCache, input.name)) {
2737
+ // @ts-ignore
2738
+ row._valuesCache[input.name] = input.value;
2739
+ }
2740
+ });
2741
+ if (isCreating)
2742
+ onCreatingRowSave === null || onCreatingRowSave === void 0 ? void 0 : onCreatingRowSave({
2743
+ exitCreatingMode: () => setCreatingRow(null),
2744
+ row,
2745
+ table,
2746
+ values: row._valuesCache,
2747
+ });
2748
+ else if (isEditing) {
2749
+ onEditingRowSave === null || onEditingRowSave === void 0 ? void 0 : onEditingRowSave({
2750
+ exitEditingMode: () => setEditingRow(null),
2751
+ row,
2752
+ table,
2753
+ values: row === null || row === void 0 ? void 0 : row._valuesCache,
2754
+ });
2755
+ }
2756
+ };
2757
+ return (jsxRuntime.jsx(Box__default["default"], { onClick: (e) => e.stopPropagation(), sx: { display: 'flex', gap: '0.75rem' }, children: variant === 'icon' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: localization.cancel, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.cancel, onClick: handleCancel, children: jsxRuntime.jsx(CancelIcon, {}) }) }), jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: localization.save, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.save, color: "info", onClick: handleSubmitRow, children: isSaving ? jsxRuntime.jsx(CircularProgress__default["default"], { size: 18 }) : jsxRuntime.jsx(SaveIcon, {}) }) })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Button__default["default"], { onClick: handleCancel, sx: { minWidth: '100px' }, children: localization.cancel }), jsxRuntime.jsxs(Button__default["default"], { onClick: handleSubmitRow, sx: { minWidth: '100px' }, variant: "contained", children: [isSaving && jsxRuntime.jsx(CircularProgress__default["default"], { color: "inherit", size: 18 }), localization.save] })] })) }));
2758
+ };
2759
+
2760
+ const MRT_EditRowModal = ({ open, table, }) => {
2761
+ var _a;
2762
+ const { getState, options: { localization, muiCreateRowModalProps, muiEditRowModalProps, onCreatingRowCancel, onEditingRowCancel, renderCreateRowModalContent, renderEditRowModalContent, }, setCreatingRow, setEditingRow, } = table;
2763
+ const { creatingRow, editingRow } = getState();
2764
+ const row = (creatingRow !== null && creatingRow !== void 0 ? creatingRow : editingRow);
2765
+ const dialogProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditRowModalProps, { row, table })), (creatingRow &&
2766
+ parseFromValuesOrFunc(muiCreateRowModalProps, { row, table })));
2767
+ const internalEditComponents = row
2768
+ .getAllCells()
2769
+ .filter((cell) => cell.column.columnDef.columnDefType === 'data')
2770
+ .map((cell) => (jsxRuntime.jsx(MRT_EditCellTextField, { cell: cell, table: table }, cell.id)));
2771
+ return (jsxRuntime.jsx(Dialog__default["default"], Object.assign({ fullWidth: true, maxWidth: "xs", onClose: (event, reason) => {
2772
+ var _a;
2773
+ if (creatingRow) {
2774
+ onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
2775
+ setCreatingRow(null);
2776
+ }
2777
+ else {
2778
+ onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
2779
+ setEditingRow(null);
2780
+ }
2781
+ row._valuesCache = {}; //reset values cache
2782
+ (_a = dialogProps.onClose) === null || _a === void 0 ? void 0 : _a.call(dialogProps, event, reason);
2783
+ }, open: open }, dialogProps, { children: (_a = ((creatingRow &&
2784
+ (renderCreateRowModalContent === null || renderCreateRowModalContent === void 0 ? void 0 : renderCreateRowModalContent({
2785
+ internalEditComponents,
2786
+ row,
2787
+ table,
2788
+ }))) ||
2789
+ (renderEditRowModalContent === null || renderEditRowModalContent === void 0 ? void 0 : renderEditRowModalContent({
2790
+ internalEditComponents,
2791
+ row,
2792
+ table,
2793
+ })))) !== null && _a !== void 0 ? _a : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(DialogTitle__default["default"], { sx: { textAlign: 'center' }, children: localization.edit }), jsxRuntime.jsx(DialogContent__default["default"], { children: jsxRuntime.jsx("form", { onSubmit: (e) => e.preventDefault(), children: jsxRuntime.jsx(Stack__default["default"], { sx: {
2794
+ gap: '24px',
2795
+ paddingTop: '16px',
2796
+ width: '100%',
2797
+ }, children: internalEditComponents }) }) }), jsxRuntime.jsx(DialogActions__default["default"], { sx: { p: '1.25rem' }, children: jsxRuntime.jsx(MRT_EditActionButtons, { row: row, table: table, variant: "text" }) })] })) })));
2798
+ };
2799
+
2800
+ const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? react.useLayoutEffect : react.useEffect;
2801
+ const MRT_TableContainer = ({ table, }) => {
2802
+ const { getState, options: { createDisplayMode, editDisplayMode, enableStickyHeader, muiTableContainerProps, }, refs: { bottomToolbarRef, tableContainerRef, topToolbarRef }, } = table;
2803
+ const { creatingRow, editingRow, isFullScreen } = getState();
2804
+ const [totalToolbarHeight, setTotalToolbarHeight] = react.useState(0);
2805
+ const tableContainerProps = parseFromValuesOrFunc(muiTableContainerProps, {
2806
+ table,
2807
+ });
2808
+ useIsomorphicLayoutEffect(() => {
2809
+ var _a, _b, _c, _d;
2810
+ const topToolbarHeight = typeof document !== 'undefined'
2811
+ ? (_b = (_a = topToolbarRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0
2812
+ : 0;
2813
+ const bottomToolbarHeight = typeof document !== 'undefined'
2814
+ ? (_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
2815
+ : 0;
2816
+ setTotalToolbarHeight(topToolbarHeight + bottomToolbarHeight);
2817
+ });
2818
+ const createModalOpen = createDisplayMode === 'modal' && creatingRow;
2819
+ const editModalOpen = editDisplayMode === 'modal' && editingRow;
2820
+ return (jsxRuntime.jsxs(TableContainer__default["default"], Object.assign({}, tableContainerProps, { ref: (node) => {
2821
+ if (node) {
2822
+ tableContainerRef.current = node;
2823
+ if (tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.ref) {
2824
+ //@ts-ignore
2825
+ tableContainerProps.ref.current = node;
2826
+ }
2827
+ }
2828
+ }, style: Object.assign({ maxHeight: isFullScreen
2829
+ ? `calc(100vh - ${totalToolbarHeight}px)`
2830
+ : undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style), sx: (theme) => (Object.assign({ maxHeight: enableStickyHeader
2831
+ ? `clamp(350px, calc(100vh - ${totalToolbarHeight}px), 9999px)`
2832
+ : undefined, maxWidth: '100%', overflow: 'auto' }, parseFromValuesOrFunc(tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx, theme))), children: [jsxRuntime.jsx(MRT_Table, { table: table }), (createModalOpen || editModalOpen) && (jsxRuntime.jsx(MRT_EditRowModal, { open: true, table: table }))] })));
2833
+ };
2834
+
2764
2835
  const MRT_TablePaper = ({ table, }) => {
2765
2836
  var _a, _b;
2766
2837
  const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps, renderBottomToolbar, renderTopToolbar, }, refs: { tablePaperRef }, } = table;
@@ -2912,53 +2983,6 @@ const MRT_ToggleRowActionMenuButton = ({ cell, row, table, }) => {
2912
2983
  parseFromValuesOrFunc(enableEditing, row) ? (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, placement: "right", title: localization.edit, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.edit, onClick: handleStartEditMode, sx: commonIconButtonStyles, children: jsxRuntime.jsx(EditIcon, {}) }) })) : renderRowActionMenuItems ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.rowActions, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.rowActions, onClick: handleOpenRowActionMenu, size: "small", sx: commonIconButtonStyles, children: jsxRuntime.jsx(MoreHorizIcon, {}) }) }), jsxRuntime.jsx(MRT_RowActionMenu, { anchorEl: anchorEl, handleEdit: handleStartEditMode, row: row, setAnchorEl: setAnchorEl, table: table })] })) : null }));
2913
2984
  };
2914
2985
 
2915
- const MRT_SelectCheckbox = ({ row, selectAll, table, }) => {
2916
- var _a;
2917
- const { getState, options: { enableMultiRowSelection, enableRowPinning, localization, muiSelectAllCheckboxProps, muiSelectCheckboxProps, rowPinningDisplayMode, selectAllMode, }, } = table;
2918
- const { density, isLoading } = getState();
2919
- const checkboxProps = !row
2920
- ? parseFromValuesOrFunc(muiSelectAllCheckboxProps, { table })
2921
- : parseFromValuesOrFunc(muiSelectCheckboxProps, { row, table });
2922
- const allRowsSelected = selectAll
2923
- ? selectAllMode === 'page'
2924
- ? table.getIsAllPageRowsSelected()
2925
- : table.getIsAllRowsSelected()
2926
- : undefined;
2927
- const commonProps = Object.assign(Object.assign({ checked: selectAll ? allRowsSelected : row === null || row === void 0 ? void 0 : row.getIsSelected(), disabled: isLoading || (row && !row.getCanSelect()), inputProps: {
2928
- 'aria-label': selectAll
2929
- ? localization.toggleSelectAll
2930
- : localization.toggleSelectRow,
2931
- }, onChange: (event) => {
2932
- event.stopPropagation();
2933
- row
2934
- ? row.getToggleSelectedHandler()(event)
2935
- : selectAllMode === 'all'
2936
- ? table.getToggleAllRowsSelectedHandler()(event)
2937
- : table.getToggleAllPageRowsSelectedHandler()(event);
2938
- if (enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('select'))) {
2939
- if (row) {
2940
- row.pin(!row.getIsPinned() && event.target.checked
2941
- ? (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('bottom'))
2942
- ? 'bottom'
2943
- : 'top'
2944
- : false);
2945
- }
2946
- else {
2947
- table.setRowPinning({ bottom: [], top: [] });
2948
- }
2949
- }
2950
- }, size: (density === 'compact' ? 'small' : 'medium') }, checkboxProps), { onClick: (e) => {
2951
- var _a;
2952
- e.stopPropagation();
2953
- (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
2954
- }, 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 });
2955
- return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _a !== void 0 ? _a : (selectAll
2956
- ? localization.toggleSelectAll
2957
- : localization.toggleSelectRow), children: enableMultiRowSelection === false ? (jsxRuntime.jsx(Radio__default["default"], Object.assign({}, commonProps))) : (jsxRuntime.jsx(Checkbox__default["default"], Object.assign({ indeterminate: selectAll
2958
- ? table.getIsSomeRowsSelected() && !allRowsSelected
2959
- : row === null || row === void 0 ? void 0 : row.getIsSomeSelected() }, commonProps))) }));
2960
- };
2961
-
2962
2986
  const useMRT_DisplayColumns = ({ columnOrder, creatingRow, grouping, tableOptions, }) => {
2963
2987
  var _a, _b;
2964
2988
  return react.useMemo(() => {
@@ -3340,7 +3364,7 @@ const MRT_Default_Icons = {
3340
3364
  ArrowDownwardIcon: ArrowDownwardIcon__default["default"],
3341
3365
  ArrowRightIcon: ArrowRightIcon__default["default"],
3342
3366
  CancelIcon: CancelIcon__default["default"],
3343
- ChevronLefIcon: ChevronLefIcon__default["default"],
3367
+ ChevronLeftIcon: ChevronLeftIcon__default["default"],
3344
3368
  ChevronRightIcon: ChevronRightIcon__default["default"],
3345
3369
  ClearAllIcon: ClearAllIcon__default["default"],
3346
3370
  CloseIcon: CloseIcon__default["default"],
@@ -3473,8 +3497,13 @@ const useMRT_TableOptions = (_a) => {
3473
3497
  const _sortingFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_SortingFns), sortingFns)), []);
3474
3498
  const _defaultColumn = react.useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultColumn), defaultColumn)), [defaultColumn]);
3475
3499
  const _defaultDisplayColumn = react.useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultDisplayColumn), defaultDisplayColumn)), [defaultDisplayColumn]);
3476
- if (rest.enableRowVirtualization || rest.enableColumnVirtualization) {
3477
- layoutMode = 'grid';
3500
+ if (layoutMode === 'semantic') {
3501
+ if (rest.enableRowVirtualization || rest.enableColumnVirtualization) {
3502
+ layoutMode = 'grid';
3503
+ }
3504
+ if (enableColumnResizing) {
3505
+ layoutMode = 'grid-no-grow';
3506
+ }
3478
3507
  }
3479
3508
  if (rest.enableRowVirtualization) {
3480
3509
  enableStickyHeader = true;