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

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 (50) hide show
  1. package/dist/cjs/index.js +458 -405
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/column.utils.d.ts +2 -0
  4. package/dist/cjs/types/icons.d.ts +1 -1
  5. package/dist/cjs/types/locales/hy.d.ts +2 -0
  6. package/dist/cjs/types/toolbar/MRT_ToolbarAlertBanner.d.ts +1 -1
  7. package/dist/cjs/types/types.d.ts +22 -29
  8. package/dist/esm/material-react-table.esm.js +459 -407
  9. package/dist/esm/material-react-table.esm.js.map +1 -1
  10. package/dist/esm/types/column.utils.d.ts +2 -0
  11. package/dist/esm/types/icons.d.ts +1 -1
  12. package/dist/esm/types/locales/hy.d.ts +2 -0
  13. package/dist/esm/types/toolbar/MRT_ToolbarAlertBanner.d.ts +1 -1
  14. package/dist/esm/types/types.d.ts +22 -29
  15. package/dist/index.d.ts +27 -33
  16. package/locales/hy.d.ts +2 -0
  17. package/locales/hy.esm.d.ts +2 -0
  18. package/locales/hy.esm.js +93 -0
  19. package/locales/hy.esm.js.map +1 -0
  20. package/locales/hy.js +97 -0
  21. package/locales/hy.js.map +1 -0
  22. package/package.json +7 -7
  23. package/src/body/MRT_TableBody.tsx +30 -22
  24. package/src/body/MRT_TableBodyCell.tsx +2 -2
  25. package/src/body/MRT_TableBodyRow.tsx +3 -3
  26. package/src/body/MRT_TableDetailPanel.tsx +3 -3
  27. package/src/buttons/MRT_GrabHandleButton.tsx +1 -2
  28. package/src/buttons/MRT_ShowHideColumnsButton.tsx +1 -2
  29. package/src/buttons/MRT_ToggleDensePaddingButton.tsx +1 -2
  30. package/src/buttons/MRT_ToggleFiltersButton.tsx +1 -2
  31. package/src/buttons/MRT_ToggleFullScreenButton.tsx +2 -3
  32. package/src/column.utils.ts +34 -9
  33. package/src/filterFns.ts +3 -3
  34. package/src/footer/MRT_TableFooter.tsx +1 -1
  35. package/src/footer/MRT_TableFooterCell.tsx +1 -1
  36. package/src/footer/MRT_TableFooterRow.tsx +2 -2
  37. package/src/head/MRT_TableHead.tsx +36 -14
  38. package/src/head/MRT_TableHeadCell.tsx +1 -1
  39. package/src/head/MRT_TableHeadCellFilterLabel.tsx +2 -0
  40. package/src/head/MRT_TableHeadRow.tsx +2 -2
  41. package/src/hooks/useMRT_TableInstance.ts +6 -6
  42. package/src/hooks/useMRT_TableOptions.ts +7 -2
  43. package/src/icons.ts +3 -3
  44. package/src/inputs/MRT_FilterTextField.tsx +4 -3
  45. package/src/locales/hy.ts +93 -0
  46. package/src/table/MRT_Table.tsx +24 -12
  47. package/src/toolbar/MRT_TablePagination.tsx +23 -14
  48. package/src/toolbar/MRT_ToolbarAlertBanner.tsx +53 -15
  49. package/src/toolbar/MRT_TopToolbar.tsx +1 -1
  50. package/src/types.ts +26 -25
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' &&
@@ -476,6 +481,17 @@ const flexRender = reactTable.flexRender;
476
481
  const createRow = (table, originalRow) => reactTable.createRow(table, 'mrt-row-create', originalRow !== null && originalRow !== void 0 ? originalRow : Object.assign({}, ...getAllLeafColumnDefs(table.options.columns).map((col) => ({
477
482
  [getColumnId(col)]: '',
478
483
  }))), -1, 0);
484
+ const extraIndexRangeExtractor = (range, draggingIndex) => {
485
+ const newIndexs = reactVirtual.defaultRangeExtractor(range);
486
+ if (draggingIndex >= 0 &&
487
+ draggingIndex < Math.max(range.startIndex - range.overscan, 0)) {
488
+ newIndexs.unshift(draggingIndex);
489
+ }
490
+ if (draggingIndex >= 0 && draggingIndex > range.endIndex + range.overscan) {
491
+ newIndexs.push(draggingIndex);
492
+ }
493
+ return newIndexs;
494
+ };
479
495
 
480
496
  const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table, }) => {
481
497
  var _a;
@@ -739,7 +755,7 @@ const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, ta
739
755
  : undefined,
740
756
  outlineOffset: '-1px',
741
757
  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'
758
+ }, 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
759
  ? columnDefType === 'display'
744
760
  ? '0 0.5rem'
745
761
  : '0.5rem'
@@ -792,14 +808,14 @@ const MRT_TableDetailPanel = ({ parentRowRef, row, rowIndex, table, virtualRow,
792
808
  });
793
809
  return (jsxRuntime.jsx(TableRow__default["default"], Object.assign({ className: "Mui-TableBodyCell-DetailPanel" }, tableRowProps, { sx: (theme) => {
794
810
  var _a, _b;
795
- return (Object.assign({ display: layoutMode === 'grid' ? 'flex' : 'table-row', position: virtualRow ? 'absolute' : undefined, top: virtualRow
811
+ return (Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, position: virtualRow ? 'absolute' : undefined, top: virtualRow
796
812
  ? `${(_b = (_a = parentRowRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.height}px`
797
813
  : undefined, transform: virtualRow
798
814
  ? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
799
815
  : undefined, width: '100%', zIndex: virtualRow ? 2 : undefined }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme)));
800
816
  }, 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 }) })) })) })));
817
+ ? styles.lighten(theme.palette.background.default, 0.05)
818
+ : 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
819
  };
804
820
 
805
821
  const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRowIds, row, rowIndex, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, virtualRow, }) => {
@@ -854,10 +870,10 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRo
854
870
  ? `${styles.lighten(theme.palette.background.default, 0.12)}`
855
871
  : `${styles.darken(theme.palette.background.default, 0.05)}`
856
872
  : undefined,
857
- }, backgroundColor: `${styles.lighten(theme.palette.background.default, 0.06)} !important`, bottom: !virtualRow && bottomPinnedIndex !== undefined && isPinned
873
+ }, backgroundColor: `${styles.lighten(theme.palette.background.default, 0.05)} !important`, bottom: !virtualRow && bottomPinnedIndex !== undefined && isPinned
858
874
  ? `${bottomPinnedIndex * rowHeight +
859
875
  (enableStickyFooter ? tableFooterHeight - 1 : 0)}px`
860
- : undefined, boxSizing: 'border-box', display: layoutMode === 'grid' ? 'flex' : 'table-row', opacity: isPinned
876
+ : undefined, boxSizing: 'border-box', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, opacity: isPinned
861
877
  ? 0.98
862
878
  : (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id || (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id
863
879
  ? 0.5
@@ -877,7 +893,7 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRo
877
893
  ? `${topPinnedIndex * rowHeight +
878
894
  (enableStickyHeader || isFullScreen ? tableHeadHeight - 1 : 0)}px`
879
895
  : 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
896
+ ? 2
881
897
  : undefined }, sx)), children: [virtualPaddingLeft ? (jsxRuntime.jsx("td", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : row.getVisibleCells()).map((cellOrVirtualCell) => {
882
898
  const cell = columnVirtualizer
883
899
  ? row.getVisibleCells()[cellOrVirtualCell.index]
@@ -920,7 +936,7 @@ const rankGlobalFuzzy = (rowA, rowB) => Math.max(...Object.values(rowB.columnFil
920
936
  const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
921
937
  var _a, _b, _c, _d, _e, _f;
922
938
  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();
939
+ const { columnFilters, density, draggingRow, expanded, globalFilter, isFullScreen, pagination, rowPinning, sorting, } = getState();
924
940
  const tableBodyProps = parseFromValuesOrFunc(muiTableBodyProps, { table });
925
941
  const rowVirtualizerProps = parseFromValuesOrFunc(rowVirtualizerOptions, {
926
942
  table,
@@ -929,16 +945,9 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
929
945
  ((_a = tableHeadRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight)) ||
930
946
  0;
931
947
  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 &&
948
+ const shouldRankRows = react.useMemo(() => getCanRankRows(table) &&
940
949
  !Object.values(sorting).some(Boolean) &&
941
- !Object.values(expanded).some(Boolean), [
950
+ globalFilter, [
942
951
  enableGlobalFilterRankedResults,
943
952
  expanded,
944
953
  globalFilter,
@@ -953,7 +962,7 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
953
962
  .map((r) => r.id), [rowPinning, table.getRowModel().rows]);
954
963
  const rows = react.useMemo(() => {
955
964
  let rows = [];
956
- if (!shouldRankResults) {
965
+ if (!shouldRankRows) {
957
966
  rows =
958
967
  !enableRowPinning || (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky'))
959
968
  ? getRowModel().rows
@@ -975,8 +984,8 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
975
984
  }
976
985
  return rows;
977
986
  }, [
978
- shouldRankResults,
979
- shouldRankResults ? getPrePaginationRowModel().rows : getRowModel().rows,
987
+ shouldRankRows,
988
+ shouldRankRows ? getPrePaginationRowModel().rows : getRowModel().rows,
980
989
  pagination.pageIndex,
981
990
  pagination.pageSize,
982
991
  rowPinning,
@@ -985,7 +994,10 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
985
994
  ? reactVirtual.useVirtualizer(Object.assign({ count: rows.length, estimateSize: () => density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73, getScrollElement: () => tableContainerRef.current, measureElement: typeof window !== 'undefined' &&
986
995
  navigator.userAgent.indexOf('Firefox') === -1
987
996
  ? (element) => element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height
988
- : undefined, overscan: 4 }, rowVirtualizerProps))
997
+ : undefined, overscan: 4, rangeExtractor: react.useCallback((range) => {
998
+ var _a;
999
+ return extraIndexRangeExtractor(range, (_a = draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.index) !== null && _a !== void 0 ? _a : 0);
1000
+ }, [draggingRow]) }, rowVirtualizerProps))
989
1001
  : undefined;
990
1002
  if (rowVirtualizerInstanceRef && rowVirtualizer) {
991
1003
  rowVirtualizerInstanceRef.current = rowVirtualizer;
@@ -994,7 +1006,7 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
994
1006
  ? rowVirtualizer.getVirtualItems()
995
1007
  : undefined;
996
1008
  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) => {
1009
+ 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
1010
  const props = {
999
1011
  columnVirtualizer,
1000
1012
  measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
@@ -1007,10 +1019,14 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
1007
1019
  virtualPaddingRight,
1008
1020
  };
1009
1021
  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
1022
+ }) }))), 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
1023
  ? `${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',
1024
+ : '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: {
1025
+ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined,
1026
+ }, children: jsxRuntime.jsx("td", { colSpan: table.getVisibleLeafColumns().length, style: {
1027
+ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid'))
1028
+ ? 'grid'
1029
+ : 'table-cell',
1014
1030
  }, children: (_d = renderEmptyRowsFallback === null || renderEmptyRowsFallback === void 0 ? void 0 : renderEmptyRowsFallback({ table })) !== null && _d !== void 0 ? _d : (jsxRuntime.jsx(Typography__default["default"], { sx: {
1015
1031
  color: 'text.secondary',
1016
1032
  fontStyle: 'italic',
@@ -1041,7 +1057,7 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
1041
1057
  };
1042
1058
  return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
1043
1059
  }) }))) })), !(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) => {
1060
+ 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
1061
  const props = {
1046
1062
  columnVirtualizer,
1047
1063
  measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
@@ -1069,7 +1085,7 @@ const MRT_TableFooterCell = ({ footer, table, }) => {
1069
1085
  column,
1070
1086
  table,
1071
1087
  }));
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'
1088
+ 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
1089
  ? '0.5rem'
1074
1090
  : density === 'comfortable'
1075
1091
  ? '1rem'
@@ -1095,7 +1111,7 @@ const MRT_TableFooterRow = ({ footerGroup, table, virtualColumns, virtualPadding
1095
1111
  footerGroup,
1096
1112
  table,
1097
1113
  });
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) => {
1114
+ 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
1115
  const footer = virtualColumns
1100
1116
  ? footerGroup.headers[footerOrVirtualFooter.index]
1101
1117
  : footerOrVirtualFooter;
@@ -1116,7 +1132,7 @@ const MRT_TableFooter = ({ table, virtualColumns, virtualPaddingLeft, virtualPad
1116
1132
  // @ts-ignore
1117
1133
  tableFooterProps.ref.current = ref;
1118
1134
  }
1119
- }, sx: (theme) => (Object.assign({ bottom: stickFooter ? 0 : undefined, display: layoutMode === 'grid' ? 'grid' : 'table-row-group', opacity: stickFooter ? 0.97 : undefined, outline: stickFooter
1135
+ }, 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
1136
  ? theme.palette.mode === 'light'
1121
1137
  ? `1px solid ${theme.palette.grey[300]}`
1122
1138
  : `1px solid ${theme.palette.grey[700]}`
@@ -1561,7 +1577,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
1561
1577
  if (isRangeFilter) {
1562
1578
  column.setFilterValue((old) => {
1563
1579
  const newFilterValues = old !== null && old !== void 0 ? old : ['', ''];
1564
- newFilterValues[rangeFilterIndex] = newValue;
1580
+ newFilterValues[rangeFilterIndex] = newValue !== null && newValue !== void 0 ? newValue : undefined;
1565
1581
  return newFilterValues;
1566
1582
  });
1567
1583
  }
@@ -1570,8 +1586,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
1570
1586
  }
1571
1587
  }, isTextboxFilter ? (manualFiltering ? 400 : 200) : 1), []);
1572
1588
  const handleChange = (newValue) => {
1573
- var _a;
1574
- setFilterValue((_a = newValue === null || newValue === void 0 ? void 0 : newValue.toString()) !== null && _a !== void 0 ? _a : '');
1589
+ setFilterValue(newValue !== null && newValue !== void 0 ? newValue : '');
1575
1590
  handleChangeDebounced(newValue);
1576
1591
  };
1577
1592
  const handleTextFieldChange = (event) => {
@@ -1649,7 +1664,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
1649
1664
  const endAdornment = !isAutocompleteFilter && !isDateFilter && !filterChipLabel ? (jsxRuntime.jsx(InputAdornment__default["default"], { position: "end", sx: { mr: isSelectFilter || isMultiSelectFilter ? '20px' : undefined }, children: jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, placement: "right", title: (_h = localization.clearFilter) !== null && _h !== void 0 ? _h : '', children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.clearFilter, disabled: !((_j = filterValue === null || filterValue === void 0 ? void 0 : filterValue.toString()) === null || _j === void 0 ? void 0 : _j.length), onClick: handleClear, size: "small", sx: {
1650
1665
  height: '2rem',
1651
1666
  transform: 'scale(0.9)',
1652
- width: '2rem'
1667
+ width: '2rem',
1653
1668
  }, children: jsxRuntime.jsx(CloseIcon, {}) }) }) }) })) : null;
1654
1669
  const startAdornment = showChangeModeButton ? (jsxRuntime.jsxs(InputAdornment__default["default"], { position: "start", children: [jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, title: localization.changeFilterMode, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.changeFilterMode, onClick: handleFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' }, children: jsxRuntime.jsx(FilterListIcon, {}) }) }) }), filterChipLabel && (jsxRuntime.jsx(Chip__default["default"], { label: filterChipLabel, onDelete: handleClearEmptyFilterChip }))] })) : null;
1655
1670
  const commonTextFieldProps = Object.assign(Object.assign({ FormHelperTextProps: {
@@ -1691,7 +1706,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
1691
1706
  }, value: filterValue || null }, datePickerProps, { slotProps: {
1692
1707
  field: Object.assign({ clearable: true, onClear: () => handleClear() }, (_l = datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.slotProps) === null || _l === void 0 ? void 0 : _l.field),
1693
1708
  textField: Object.assign(Object.assign({}, commonTextFieldProps), (_m = datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.slotProps) === null || _m === void 0 ? void 0 : _m.textField),
1694
- } }))) : isAutocompleteFilter ? (jsxRuntime.jsx(Autocomplete__default["default"], Object.assign({ getOptionLabel: (option) => option, onChange: (_e, newValue) => handleChange(newValue), options: dropdownOptions !== null && dropdownOptions !== void 0 ? dropdownOptions : [] }, autocompleteProps, { renderInput: (builtinTextFieldProps) => {
1709
+ } }))) : isAutocompleteFilter ? (jsxRuntime.jsx(Autocomplete__default["default"], Object.assign({ freeSolo: true, getOptionLabel: (option) => option, onChange: (_e, newValue) => handleChange(newValue), options: dropdownOptions !== null && dropdownOptions !== void 0 ? dropdownOptions : [] }, autocompleteProps, { renderInput: (builtinTextFieldProps) => {
1695
1710
  var _a;
1696
1711
  return (jsxRuntime.jsx(TextField__default["default"], Object.assign({}, builtinTextFieldProps, commonTextFieldProps, { InputProps: Object.assign(Object.assign({}, builtinTextFieldProps.InputProps), { startAdornment: (_a = commonTextFieldProps === null || commonTextFieldProps === void 0 ? void 0 : commonTextFieldProps.InputProps) === null || _a === void 0 ? void 0 : _a.startAdornment }), inputProps: Object.assign(Object.assign({}, builtinTextFieldProps.inputProps), commonTextFieldProps === null || commonTextFieldProps === void 0 ? void 0 : commonTextFieldProps.inputProps), onChange: handleTextFieldChange })));
1697
1712
  }, value: filterValue }))) : (jsxRuntime.jsx(TextField__default["default"], Object.assign({ SelectProps: {
@@ -1871,11 +1886,11 @@ const MRT_TableHeadCellFilterLabel = ({ header, table, }) => {
1871
1886
  }, children: jsxRuntime.jsx(FilterAltIcon, {}) }) }) }) }), jsxRuntime.jsx(Popover__default["default"], { anchorEl: anchorEl, anchorOrigin: {
1872
1887
  horizontal: 'center',
1873
1888
  vertical: 'top',
1874
- }, onClose: (event) => {
1889
+ }, onClick: (event) => event.stopPropagation(), onClose: (event) => {
1875
1890
  //@ts-ignore
1876
1891
  event.stopPropagation();
1877
1892
  setAnchorEl(null);
1878
- }, open: !!anchorEl, transformOrigin: {
1893
+ }, onKeyDown: (event) => event.key === 'Enter' && setAnchorEl(null), open: !!anchorEl, transformOrigin: {
1879
1894
  horizontal: 'center',
1880
1895
  vertical: 'bottom',
1881
1896
  }, children: jsxRuntime.jsx(Box__default["default"], { sx: { p: '1rem' }, children: jsxRuntime.jsx(MRT_TableHeadCellFilterContainer, { header: header, table: table }) }) })] }));
@@ -2034,7 +2049,7 @@ const MRT_TableHeadCell = ({ header, table, }) => {
2034
2049
  if (node) {
2035
2050
  tableHeadCellRefs.current[column.id] = node;
2036
2051
  }
2037
- } }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ flexDirection: layoutMode === 'grid' ? 'column' : undefined, fontWeight: 'bold', overflow: 'visible', p: density === 'compact'
2052
+ } }, 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
2053
  ? '0.5rem'
2039
2054
  : density === 'comfortable'
2040
2055
  ? columnDefType === 'display'
@@ -2101,7 +2116,7 @@ const MRT_TableHeadRow = ({ headerGroup, table, virtualColumns, virtualPaddingLe
2101
2116
  headerGroup,
2102
2117
  table,
2103
2118
  });
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) => {
2119
+ 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
2120
  const header = virtualColumns
2106
2121
  ? headerGroup.headers[headerOrVirtualHeader.index]
2107
2122
  : headerOrVirtualHeader;
@@ -2109,208 +2124,6 @@ const MRT_TableHeadRow = ({ headerGroup, table, virtualColumns, virtualPaddingLe
2109
2124
  }), virtualPaddingRight ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
2110
2125
  };
2111
2126
 
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
2127
  const MRT_LinearProgressBar = ({ isTopToolbar, table, }) => {
2315
2128
  const { getState, options: { muiLinearProgressProps }, } = table;
2316
2129
  const { isLoading, showProgressBars } = getState();
@@ -2326,25 +2139,52 @@ const MRT_LinearProgressBar = ({ isTopToolbar, table, }) => {
2326
2139
  }, unmountOnExit: true, children: jsxRuntime.jsx(LinearProgress__default["default"], Object.assign({ "aria-busy": "true", "aria-label": "Loading", sx: { position: 'relative' } }, linearProgressProps)) }));
2327
2140
  };
2328
2141
 
2329
- const defaultPageSizeOptions = [5, 10, 15, 20, 25, 30, 50, 100];
2142
+ /******************************************************************************
2143
+ Copyright (c) Microsoft Corporation.
2144
+
2145
+ Permission to use, copy, modify, and/or distribute this software for any
2146
+ purpose with or without fee is hereby granted.
2147
+
2148
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2149
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2150
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2151
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2152
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2153
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2154
+ PERFORMANCE OF THIS SOFTWARE.
2155
+ ***************************************************************************** */
2156
+ function __rest(s, e) {
2157
+ var t = {};
2158
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2159
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2160
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2161
+ }
2162
+ return t;
2163
+ }
2164
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
2165
+ var e = new Error(message);
2166
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
2167
+ };
2168
+
2169
+ const defaultRowsPerPage = [5, 10, 15, 20, 25, 30, 50, 100];
2330
2170
  const MRT_TablePagination = ({ position = 'bottom', table, }) => {
2331
- const { getPrePaginationRowModel, getState, options: { enableToolbarInternalActions, icons: { ChevronLefIcon, ChevronRightIcon, FirstPageIcon, LastPageIcon }, localization, muiTablePaginationProps, paginationDisplayMode, rowCount, }, setPageIndex, setPageSize, } = table;
2171
+ const { getPrePaginationRowModel, getState, options: { enableToolbarInternalActions, icons: { ChevronLeftIcon, ChevronRightIcon, FirstPageIcon, LastPageIcon }, localization, muiPaginationProps, paginationDisplayMode, rowCount, }, setPageIndex, setPageSize, } = table;
2332
2172
  const { pagination: { pageIndex = 0, pageSize = 10 }, showGlobalFilter, } = getState();
2333
- const paginationProps = parseFromValuesOrFunc(muiTablePaginationProps, {
2173
+ const paginationProps = parseFromValuesOrFunc(muiPaginationProps, {
2334
2174
  table,
2335
2175
  });
2336
2176
  const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
2337
2177
  const numberOfPages = Math.ceil(totalRowCount / pageSize);
2338
2178
  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
2179
  const firstRowIndex = pageIndex * pageSize;
2342
2180
  const lastRowIndex = Math.min(pageIndex * pageSize + pageSize, totalRowCount);
2181
+ const _a = paginationProps !== null && paginationProps !== void 0 ? paginationProps : {}, { rowsPerPageOptions = defaultRowsPerPage, showFirstButton = showFirstLastPageButtons, showLastButton = showFirstLastPageButtons, showRowsPerPage = true } = _a, rest = __rest(_a, ["rowsPerPageOptions", "showFirstButton", "showLastButton", "showRowsPerPage"]);
2343
2182
  return (jsxRuntime.jsxs(Box__default["default"], { sx: {
2344
2183
  alignItems: 'center',
2345
2184
  display: 'flex',
2346
2185
  gap: '8px',
2347
2186
  justifyContent: 'space-between',
2187
+ justifySelf: 'flex-end',
2348
2188
  mt: position === 'top' &&
2349
2189
  enableToolbarInternalActions &&
2350
2190
  !showGlobalFilter
@@ -2354,33 +2194,147 @@ const MRT_TablePagination = ({ position = 'bottom', table, }) => {
2354
2194
  px: '4px',
2355
2195
  py: '12px',
2356
2196
  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: {
2197
+ }, 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"], { id: "mrt-rows-per-page", inputProps: { 'aria-label': localization.rowsPerPage }, 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: {
2358
2198
  first: FirstPageIcon,
2359
2199
  last: LastPageIcon,
2360
2200
  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] }));
2201
+ previous: ChevronLeftIcon,
2202
+ } }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton }, rest))) : paginationDisplayMode === 'default' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography__default["default"], { sx: { mb: 0, minWidth: '10ch', mx: '4px' }, 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] }));
2363
2203
  };
2364
2204
 
2365
- 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();
2205
+ const MRT_GlobalFilterTextField = ({ table, }) => {
2206
+ var _a;
2207
+ const { getState, options: { enableGlobalFilterModes, icons: { CloseIcon, SearchIcon }, localization, manualFiltering, muiSearchTextFieldProps, }, refs: { searchInputRef }, setGlobalFilter, } = table;
2208
+ const { globalFilter, showGlobalFilter } = getState();
2209
+ const textFieldProps = parseFromValuesOrFunc(muiSearchTextFieldProps, {
2210
+ table,
2211
+ });
2212
+ const isMounted = react.useRef(false);
2213
+ const [anchorEl, setAnchorEl] = react.useState(null);
2214
+ const [searchValue, setSearchValue] = react.useState(globalFilter !== null && globalFilter !== void 0 ? globalFilter : '');
2215
+ const handleChangeDebounced = react.useCallback(utils.debounce((event) => {
2216
+ var _a;
2217
+ setGlobalFilter((_a = event.target.value) !== null && _a !== void 0 ? _a : undefined);
2218
+ }, manualFiltering ? 500 : 250), []);
2219
+ const handleChange = (event) => {
2220
+ setSearchValue(event.target.value);
2221
+ handleChangeDebounced(event);
2222
+ };
2223
+ const handleGlobalFilterMenuOpen = (event) => {
2224
+ setAnchorEl(event.currentTarget);
2225
+ };
2226
+ const handleClear = () => {
2227
+ setSearchValue('');
2228
+ setGlobalFilter(undefined);
2229
+ };
2230
+ react.useEffect(() => {
2231
+ if (isMounted.current) {
2232
+ if (globalFilter === undefined) {
2233
+ handleClear();
2234
+ }
2235
+ else {
2236
+ setSearchValue(globalFilter);
2237
+ }
2238
+ }
2239
+ isMounted.current = true;
2240
+ }, [globalFilter]);
2241
+ return (jsxRuntime.jsxs(Collapse__default["default"], { in: showGlobalFilter, mountOnEnter: true, orientation: "horizontal", unmountOnExit: true, children: [jsxRuntime.jsx(TextField__default["default"], Object.assign({ InputProps: {
2242
+ 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, {}) }) }) }) })),
2243
+ 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' } })),
2244
+ }, onChange: handleChange, placeholder: localization.search, value: searchValue !== null && searchValue !== void 0 ? searchValue : '', variant: "standard" }, textFieldProps, { inputRef: (inputRef) => {
2245
+ searchInputRef.current = inputRef;
2246
+ if (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.inputRef) {
2247
+ textFieldProps.inputRef = inputRef;
2248
+ }
2249
+ } })), jsxRuntime.jsx(MRT_FilterOptionMenu, { anchorEl: anchorEl, onSelect: handleClear, setAnchorEl: setAnchorEl, table: table })] }));
2250
+ };
2251
+
2252
+ const MRT_SelectCheckbox = ({ row, selectAll, table, }) => {
2253
+ var _a;
2254
+ const { getState, options: { enableMultiRowSelection, enableRowPinning, localization, muiSelectAllCheckboxProps, muiSelectCheckboxProps, rowPinningDisplayMode, selectAllMode, }, } = table;
2255
+ const { density, isLoading } = getState();
2256
+ const checkboxProps = !row
2257
+ ? parseFromValuesOrFunc(muiSelectAllCheckboxProps, { table })
2258
+ : parseFromValuesOrFunc(muiSelectCheckboxProps, { row, table });
2259
+ const allRowsSelected = selectAll
2260
+ ? selectAllMode === 'page'
2261
+ ? table.getIsAllPageRowsSelected()
2262
+ : table.getIsAllRowsSelected()
2263
+ : undefined;
2264
+ const commonProps = Object.assign(Object.assign({ checked: selectAll ? allRowsSelected : row === null || row === void 0 ? void 0 : row.getIsSelected(), disabled: isLoading || (row && !row.getCanSelect()), inputProps: {
2265
+ 'aria-label': selectAll
2266
+ ? localization.toggleSelectAll
2267
+ : localization.toggleSelectRow,
2268
+ }, onChange: (event) => {
2269
+ event.stopPropagation();
2270
+ row
2271
+ ? row.getToggleSelectedHandler()(event)
2272
+ : selectAllMode === 'all'
2273
+ ? table.getToggleAllRowsSelectedHandler()(event)
2274
+ : table.getToggleAllPageRowsSelectedHandler()(event);
2275
+ if (enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('select'))) {
2276
+ if (row) {
2277
+ row.pin(!row.getIsPinned() && event.target.checked
2278
+ ? (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('bottom'))
2279
+ ? 'bottom'
2280
+ : 'top'
2281
+ : false);
2282
+ }
2283
+ else {
2284
+ table.setRowPinning({ bottom: [], top: [] });
2285
+ }
2286
+ }
2287
+ }, size: (density === 'compact' ? 'small' : 'medium') }, checkboxProps), { onClick: (e) => {
2288
+ var _a;
2289
+ e.stopPropagation();
2290
+ (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
2291
+ }, 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 });
2292
+ 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
2293
+ ? localization.toggleSelectAll
2294
+ : localization.toggleSelectRow), children: enableMultiRowSelection === false ? (jsxRuntime.jsx(Radio__default["default"], Object.assign({}, commonProps))) : (jsxRuntime.jsx(Checkbox__default["default"], Object.assign({ indeterminate: selectAll
2295
+ ? table.getIsSomeRowsSelected() && !allRowsSelected
2296
+ : row === null || row === void 0 ? void 0 : row.getIsSomeSelected() }, commonProps))) }));
2297
+ };
2298
+
2299
+ const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
2300
+ var _a, _b, _c;
2301
+ const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { enableRowSelection, enableSelectAll, localization, muiToolbarAlertBannerChipProps, muiToolbarAlertBannerProps, positionToolbarAlertBanner, renderToolbarAlertBannerContent, rowCount, }, refs: { tablePaperRef }, } = table;
2302
+ const { density, grouping, showAlertBanner } = getState();
2369
2303
  const alertProps = parseFromValuesOrFunc(muiToolbarAlertBannerProps, {
2370
2304
  table,
2371
2305
  });
2372
2306
  const chipProps = parseFromValuesOrFunc(muiToolbarAlertBannerChipProps, {
2373
2307
  table,
2374
2308
  });
2375
- const selectMessage = getSelectedRowModel().rows.length > 0
2309
+ const selectedAlert = getSelectedRowModel().rows.length > 0
2376
2310
  ? (_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
2311
  : 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] })] })) }));
2312
+ 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;
2313
+ 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) => {
2314
+ var _a, _b;
2315
+ return (Object.assign({ '& .MuiAlert-message': {
2316
+ maxWidth: `calc(${(_b = (_a = tablePaperRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _b !== void 0 ? _b : 360}px - 1rem)`,
2317
+ width: '100%',
2318
+ }, borderRadius: 0, fontSize: '1rem', left: 0, mb: stackAlertBanner
2319
+ ? 0
2320
+ : positionToolbarAlertBanner === 'bottom'
2321
+ ? '-1rem'
2322
+ : undefined, p: 0, position: 'relative', right: 0, top: 0, width: '100%', zIndex: 2 }, parseFromValuesOrFunc(alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx, theme)));
2323
+ }, children: (_c = renderToolbarAlertBannerContent === null || renderToolbarAlertBannerContent === void 0 ? void 0 : renderToolbarAlertBannerContent({
2324
+ groupedAlert,
2325
+ selectedAlert,
2326
+ table,
2327
+ })) !== 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: {
2328
+ p: positionToolbarAlertBanner !== 'head-overlay'
2329
+ ? '0.5rem 1rem'
2330
+ : density === 'spacious'
2331
+ ? '0.75rem 1.25rem'
2332
+ : density === 'comfortable'
2333
+ ? '0.5rem 0.75rem'
2334
+ : '0.25rem 0.5rem',
2335
+ }, 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 &&
2336
+ enableSelectAll &&
2337
+ positionToolbarAlertBanner === 'head-overlay' && (jsxRuntime.jsx(MRT_SelectCheckbox, { selectAll: true, table: table })), ' ', selectedAlert] }), selectedAlert && groupedAlert && jsxRuntime.jsx("br", {}), groupedAlert] })] })) })) }));
2384
2338
  };
2385
2339
 
2386
2340
  const MRT_ToolbarDropZone = ({ table, }) => {
@@ -2414,33 +2368,6 @@ const MRT_ToolbarDropZone = ({ table, }) => {
2414
2368
  }), 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
2369
  };
2416
2370
 
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
2371
  const MRT_ColumnPinningButtons = ({ column, table, }) => {
2445
2372
  const { options: { icons: { PushPinIcon }, localization, }, } = table;
2446
2373
  const handlePinColumn = (pinDirection) => {
@@ -2608,7 +2535,7 @@ const MRT_ToggleFullScreenButton = (_a) => {
2608
2535
  setTooltipOpened(false);
2609
2536
  setIsFullScreen(!isFullScreen);
2610
2537
  };
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, {}) })) }));
2538
+ 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
2539
  };
2613
2540
 
2614
2541
  const MRT_ToggleGlobalFilterButton = (_a) => {
@@ -2639,56 +2566,9 @@ const MRT_ToolbarInternalButtons = ({ table, }) => {
2639
2566
  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
2567
  };
2641
2568
 
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
2569
  const commonToolbarStyles = ({ theme }) => ({
2690
2570
  alignItems: 'flex-start',
2691
- backgroundColor: styles.lighten(theme.palette.background.default, 0.04),
2571
+ backgroundColor: styles.lighten(theme.palette.background.default, 0.05),
2692
2572
  backgroundImage: 'none',
2693
2573
  display: 'grid',
2694
2574
  flexWrap: 'wrap-reverse',
@@ -2761,6 +2641,220 @@ const MRT_BottomToolbar = ({ table, }) => {
2761
2641
  ['both', 'bottom'].includes(positionPagination !== null && positionPagination !== void 0 ? positionPagination : '') && (jsxRuntime.jsx(MRT_TablePagination, { position: "bottom", table: table })) })] })] })));
2762
2642
  };
2763
2643
 
2644
+ const MRT_TableHead = ({ table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
2645
+ const { getHeaderGroups, getSelectedRowModel, getState, options: { enableStickyHeader, layoutMode, muiTableHeadProps, positionToolbarAlertBanner, }, refs: { tableHeadRef }, } = table;
2646
+ const { isFullScreen, showAlertBanner } = getState();
2647
+ const tableHeadProps = parseFromValuesOrFunc(muiTableHeadProps, { table });
2648
+ const stickyHeader = enableStickyHeader || isFullScreen;
2649
+ return (jsxRuntime.jsx(TableHead__default["default"], Object.assign({}, tableHeadProps, { ref: (ref) => {
2650
+ tableHeadRef.current = ref;
2651
+ if (tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.ref) {
2652
+ // @ts-ignore
2653
+ tableHeadProps.ref.current = ref;
2654
+ }
2655
+ }, 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' &&
2656
+ (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: {
2657
+ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : 'table-cell',
2658
+ padding: 0,
2659
+ }, 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)))) })));
2660
+ };
2661
+
2662
+ const MRT_Table = ({ table, }) => {
2663
+ var _a, _b, _c, _d;
2664
+ const { getFlatHeaders, getState, options: { columnVirtualizerInstanceRef, columnVirtualizerOptions, columns, enableColumnPinning, enableColumnResizing, enableColumnVirtualization, enableStickyHeader, enableTableFooter, enableTableHead, layoutMode, memoMode, muiTableProps, }, refs: { tableContainerRef }, } = table;
2665
+ const { columnPinning, columnSizing, columnSizingInfo, columnVisibility, draggingColumn, isFullScreen, } = getState();
2666
+ const tableProps = parseFromValuesOrFunc(muiTableProps, { table });
2667
+ const columnVirtualizerProps = parseFromValuesOrFunc(columnVirtualizerOptions, { table });
2668
+ const columnSizeVars = react.useMemo(() => {
2669
+ const headers = getFlatHeaders();
2670
+ const colSizes = {};
2671
+ for (let i = 0; i < headers.length; i++) {
2672
+ const header = headers[i];
2673
+ const colSize = header.getSize();
2674
+ colSizes[`--header-${parseCSSVarId(header.id)}-size`] = colSize;
2675
+ colSizes[`--col-${parseCSSVarId(header.column.id)}-size`] = colSize;
2676
+ }
2677
+ return colSizes;
2678
+ }, [columns, columnSizing, columnSizingInfo, columnVisibility]);
2679
+ //get first 16 column widths and average them
2680
+ const averageColumnWidth = react.useMemo(() => {
2681
+ var _a, _b, _c, _d;
2682
+ if (!enableColumnVirtualization)
2683
+ return 0;
2684
+ const columnsWidths = (_d = (_c = (_b = (_a = table
2685
+ .getRowModel()
2686
+ .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 : [];
2687
+ return columnsWidths.reduce((a, b) => a + b, 0) / columnsWidths.length;
2688
+ }, [table.getRowModel().rows, columnPinning, columnVisibility]);
2689
+ const [leftPinnedIndexes, rightPinnedIndexes] = react.useMemo(() => enableColumnVirtualization && enableColumnPinning
2690
+ ? [
2691
+ table.getLeftLeafColumns().map((c) => c.getPinnedIndex()),
2692
+ table
2693
+ .getRightLeafColumns()
2694
+ .map((c) => table.getVisibleLeafColumns().length - c.getPinnedIndex() - 1),
2695
+ ]
2696
+ : [[], []], [columnPinning, enableColumnVirtualization, enableColumnPinning]);
2697
+ const draggingColumnIndex = table
2698
+ .getVisibleLeafColumns()
2699
+ .findIndex((c) => c.id === (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id));
2700
+ const columnVirtualizer = enableColumnVirtualization
2701
+ ? reactVirtual.useVirtualizer(Object.assign({ count: table.getVisibleLeafColumns().length, estimateSize: () => averageColumnWidth, getScrollElement: () => tableContainerRef.current, horizontal: true, overscan: 3, rangeExtractor: react.useCallback((range) => {
2702
+ const newIndexs = extraIndexRangeExtractor(range, draggingColumnIndex);
2703
+ return [
2704
+ ...new Set([
2705
+ ...leftPinnedIndexes,
2706
+ ...newIndexs,
2707
+ ...rightPinnedIndexes,
2708
+ ]),
2709
+ ];
2710
+ }, [leftPinnedIndexes, rightPinnedIndexes, draggingColumnIndex]) }, columnVirtualizerProps))
2711
+ : undefined;
2712
+ if (columnVirtualizerInstanceRef && columnVirtualizer) {
2713
+ columnVirtualizerInstanceRef.current = columnVirtualizer;
2714
+ }
2715
+ const virtualColumns = columnVirtualizer
2716
+ ? columnVirtualizer.getVirtualItems()
2717
+ : undefined;
2718
+ let virtualPaddingLeft;
2719
+ let virtualPaddingRight;
2720
+ if (columnVirtualizer && (virtualColumns === null || virtualColumns === void 0 ? void 0 : virtualColumns.length)) {
2721
+ virtualPaddingLeft = (_b = (_a = virtualColumns[leftPinnedIndexes.length]) === null || _a === void 0 ? void 0 : _a.start) !== null && _b !== void 0 ? _b : 0;
2722
+ virtualPaddingRight =
2723
+ columnVirtualizer.getTotalSize() -
2724
+ ((_d = (_c = virtualColumns[virtualColumns.length - 1 - rightPinnedIndexes.length]) === null || _c === void 0 ? void 0 : _c.end) !== null && _d !== void 0 ? _d : 0);
2725
+ }
2726
+ const props = {
2727
+ table,
2728
+ virtualColumns,
2729
+ virtualPaddingLeft,
2730
+ virtualPaddingRight,
2731
+ };
2732
+ 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
2733
+ ? 'fixed'
2734
+ : 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))] })) }));
2735
+ };
2736
+
2737
+ const MRT_EditActionButtons = ({ row, table, variant = 'icon', }) => {
2738
+ const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onCreatingRowCancel, onCreatingRowSave, onEditingRowCancel, onEditingRowSave, }, refs: { editInputRefs }, setCreatingRow, setEditingRow, } = table;
2739
+ const { creatingRow, editingRow, isSaving } = getState();
2740
+ const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
2741
+ const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
2742
+ const handleCancel = () => {
2743
+ if (isCreating) {
2744
+ onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
2745
+ setCreatingRow(null);
2746
+ }
2747
+ else if (isEditing) {
2748
+ onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
2749
+ setEditingRow(null);
2750
+ }
2751
+ row._valuesCache = {}; //reset values cache
2752
+ };
2753
+ const handleSubmitRow = () => {
2754
+ var _a;
2755
+ //look for auto-filled input values
2756
+ (_a = Object.values(editInputRefs === null || editInputRefs === void 0 ? void 0 : editInputRefs.current)
2757
+ .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) => {
2758
+ if (input.value !== undefined &&
2759
+ Object.hasOwn(row === null || row === void 0 ? void 0 : row._valuesCache, input.name)) {
2760
+ // @ts-ignore
2761
+ row._valuesCache[input.name] = input.value;
2762
+ }
2763
+ });
2764
+ if (isCreating)
2765
+ onCreatingRowSave === null || onCreatingRowSave === void 0 ? void 0 : onCreatingRowSave({
2766
+ exitCreatingMode: () => setCreatingRow(null),
2767
+ row,
2768
+ table,
2769
+ values: row._valuesCache,
2770
+ });
2771
+ else if (isEditing) {
2772
+ onEditingRowSave === null || onEditingRowSave === void 0 ? void 0 : onEditingRowSave({
2773
+ exitEditingMode: () => setEditingRow(null),
2774
+ row,
2775
+ table,
2776
+ values: row === null || row === void 0 ? void 0 : row._valuesCache,
2777
+ });
2778
+ }
2779
+ };
2780
+ 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] })] })) }));
2781
+ };
2782
+
2783
+ const MRT_EditRowModal = ({ open, table, }) => {
2784
+ var _a;
2785
+ const { getState, options: { localization, muiCreateRowModalProps, muiEditRowModalProps, onCreatingRowCancel, onEditingRowCancel, renderCreateRowModalContent, renderEditRowModalContent, }, setCreatingRow, setEditingRow, } = table;
2786
+ const { creatingRow, editingRow } = getState();
2787
+ const row = (creatingRow !== null && creatingRow !== void 0 ? creatingRow : editingRow);
2788
+ const dialogProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditRowModalProps, { row, table })), (creatingRow &&
2789
+ parseFromValuesOrFunc(muiCreateRowModalProps, { row, table })));
2790
+ const internalEditComponents = row
2791
+ .getAllCells()
2792
+ .filter((cell) => cell.column.columnDef.columnDefType === 'data')
2793
+ .map((cell) => (jsxRuntime.jsx(MRT_EditCellTextField, { cell: cell, table: table }, cell.id)));
2794
+ return (jsxRuntime.jsx(Dialog__default["default"], Object.assign({ fullWidth: true, maxWidth: "xs", onClose: (event, reason) => {
2795
+ var _a;
2796
+ if (creatingRow) {
2797
+ onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
2798
+ setCreatingRow(null);
2799
+ }
2800
+ else {
2801
+ onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
2802
+ setEditingRow(null);
2803
+ }
2804
+ row._valuesCache = {}; //reset values cache
2805
+ (_a = dialogProps.onClose) === null || _a === void 0 ? void 0 : _a.call(dialogProps, event, reason);
2806
+ }, open: open }, dialogProps, { children: (_a = ((creatingRow &&
2807
+ (renderCreateRowModalContent === null || renderCreateRowModalContent === void 0 ? void 0 : renderCreateRowModalContent({
2808
+ internalEditComponents,
2809
+ row,
2810
+ table,
2811
+ }))) ||
2812
+ (renderEditRowModalContent === null || renderEditRowModalContent === void 0 ? void 0 : renderEditRowModalContent({
2813
+ internalEditComponents,
2814
+ row,
2815
+ table,
2816
+ })))) !== 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: {
2817
+ gap: '24px',
2818
+ paddingTop: '16px',
2819
+ width: '100%',
2820
+ }, children: internalEditComponents }) }) }), jsxRuntime.jsx(DialogActions__default["default"], { sx: { p: '1.25rem' }, children: jsxRuntime.jsx(MRT_EditActionButtons, { row: row, table: table, variant: "text" }) })] })) })));
2821
+ };
2822
+
2823
+ const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? react.useLayoutEffect : react.useEffect;
2824
+ const MRT_TableContainer = ({ table, }) => {
2825
+ const { getState, options: { createDisplayMode, editDisplayMode, enableStickyHeader, muiTableContainerProps, }, refs: { bottomToolbarRef, tableContainerRef, topToolbarRef }, } = table;
2826
+ const { creatingRow, editingRow, isFullScreen } = getState();
2827
+ const [totalToolbarHeight, setTotalToolbarHeight] = react.useState(0);
2828
+ const tableContainerProps = parseFromValuesOrFunc(muiTableContainerProps, {
2829
+ table,
2830
+ });
2831
+ useIsomorphicLayoutEffect(() => {
2832
+ var _a, _b, _c, _d;
2833
+ const topToolbarHeight = typeof document !== 'undefined'
2834
+ ? (_b = (_a = topToolbarRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0
2835
+ : 0;
2836
+ const bottomToolbarHeight = typeof document !== 'undefined'
2837
+ ? (_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
2838
+ : 0;
2839
+ setTotalToolbarHeight(topToolbarHeight + bottomToolbarHeight);
2840
+ });
2841
+ const createModalOpen = createDisplayMode === 'modal' && creatingRow;
2842
+ const editModalOpen = editDisplayMode === 'modal' && editingRow;
2843
+ return (jsxRuntime.jsxs(TableContainer__default["default"], Object.assign({}, tableContainerProps, { ref: (node) => {
2844
+ if (node) {
2845
+ tableContainerRef.current = node;
2846
+ if (tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.ref) {
2847
+ //@ts-ignore
2848
+ tableContainerProps.ref.current = node;
2849
+ }
2850
+ }
2851
+ }, style: Object.assign({ maxHeight: isFullScreen
2852
+ ? `calc(100vh - ${totalToolbarHeight}px)`
2853
+ : undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style), sx: (theme) => (Object.assign({ maxHeight: enableStickyHeader
2854
+ ? `clamp(350px, calc(100vh - ${totalToolbarHeight}px), 9999px)`
2855
+ : 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 }))] })));
2856
+ };
2857
+
2764
2858
  const MRT_TablePaper = ({ table, }) => {
2765
2859
  var _a, _b;
2766
2860
  const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps, renderBottomToolbar, renderTopToolbar, }, refs: { tablePaperRef }, } = table;
@@ -2912,53 +3006,6 @@ const MRT_ToggleRowActionMenuButton = ({ cell, row, table, }) => {
2912
3006
  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
3007
  };
2914
3008
 
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
3009
  const useMRT_DisplayColumns = ({ columnOrder, creatingRow, grouping, tableOptions, }) => {
2963
3010
  var _a, _b;
2964
3011
  return react.useMemo(() => {
@@ -3282,7 +3329,7 @@ const endsWith = (row, id, filterValue) => row
3282
3329
  .endsWith(filterValue.toString().toLowerCase().trim());
3283
3330
  endsWith.autoRemove = (val) => !val;
3284
3331
  const equals = (row, id, filterValue) => row.getValue(id).toString().toLowerCase().trim() ===
3285
- filterValue.toString().toLowerCase().trim();
3332
+ (filterValue === null || filterValue === void 0 ? void 0 : filterValue.toString().toLowerCase().trim());
3286
3333
  equals.autoRemove = (val) => !val;
3287
3334
  const notEquals = (row, id, filterValue) => row.getValue(id).toString().toLowerCase().trim() !==
3288
3335
  filterValue.toString().toLowerCase().trim();
@@ -3290,14 +3337,14 @@ notEquals.autoRemove = (val) => !val;
3290
3337
  const greaterThan = (row, id, filterValue) => !isNaN(+filterValue) && !isNaN(+row.getValue(id))
3291
3338
  ? +row.getValue(id) > +filterValue
3292
3339
  : row.getValue(id).toString().toLowerCase().trim() >
3293
- filterValue.toString().toLowerCase().trim();
3340
+ (filterValue === null || filterValue === void 0 ? void 0 : filterValue.toString().toLowerCase().trim());
3294
3341
  greaterThan.autoRemove = (val) => !val;
3295
3342
  const greaterThanOrEqualTo = (row, id, filterValue) => equals(row, id, filterValue) || greaterThan(row, id, filterValue);
3296
3343
  greaterThanOrEqualTo.autoRemove = (val) => !val;
3297
3344
  const lessThan = (row, id, filterValue) => !isNaN(+filterValue) && !isNaN(+row.getValue(id))
3298
3345
  ? +row.getValue(id) < +filterValue
3299
3346
  : row.getValue(id).toString().toLowerCase().trim() <
3300
- filterValue.toString().toLowerCase().trim();
3347
+ (filterValue === null || filterValue === void 0 ? void 0 : filterValue.toString().toLowerCase().trim());
3301
3348
  lessThan.autoRemove = (val) => !val;
3302
3349
  const lessThanOrEqualTo = (row, id, filterValue) => equals(row, id, filterValue) || lessThan(row, id, filterValue);
3303
3350
  lessThanOrEqualTo.autoRemove = (val) => !val;
@@ -3340,7 +3387,7 @@ const MRT_Default_Icons = {
3340
3387
  ArrowDownwardIcon: ArrowDownwardIcon__default["default"],
3341
3388
  ArrowRightIcon: ArrowRightIcon__default["default"],
3342
3389
  CancelIcon: CancelIcon__default["default"],
3343
- ChevronLefIcon: ChevronLefIcon__default["default"],
3390
+ ChevronLeftIcon: ChevronLeftIcon__default["default"],
3344
3391
  ChevronRightIcon: ChevronRightIcon__default["default"],
3345
3392
  ClearAllIcon: ClearAllIcon__default["default"],
3346
3393
  CloseIcon: CloseIcon__default["default"],
@@ -3473,8 +3520,13 @@ const useMRT_TableOptions = (_a) => {
3473
3520
  const _sortingFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_SortingFns), sortingFns)), []);
3474
3521
  const _defaultColumn = react.useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultColumn), defaultColumn)), [defaultColumn]);
3475
3522
  const _defaultDisplayColumn = react.useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultDisplayColumn), defaultDisplayColumn)), [defaultDisplayColumn]);
3476
- if (rest.enableRowVirtualization || rest.enableColumnVirtualization) {
3477
- layoutMode = 'grid';
3523
+ if (layoutMode === 'semantic') {
3524
+ if (rest.enableRowVirtualization || rest.enableColumnVirtualization) {
3525
+ layoutMode = 'grid';
3526
+ }
3527
+ if (enableColumnResizing) {
3528
+ layoutMode = 'grid-no-grow';
3529
+ }
3478
3530
  }
3479
3531
  if (rest.enableRowVirtualization) {
3480
3532
  enableStickyHeader = true;
@@ -3621,6 +3673,7 @@ exports.commonListItemStyles = commonListItemStyles;
3621
3673
  exports.commonMenuItemStyles = commonMenuItemStyles;
3622
3674
  exports.commonToolbarStyles = commonToolbarStyles;
3623
3675
  exports.createRow = createRow;
3676
+ exports.extraIndexRangeExtractor = extraIndexRangeExtractor;
3624
3677
  exports.flexRender = flexRender;
3625
3678
  exports.getAllLeafColumnDefs = getAllLeafColumnDefs;
3626
3679
  exports.getCanRankRows = getCanRankRows;