material-react-table 2.5.2 → 2.6.1

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.
package/dist/index.js CHANGED
@@ -30,7 +30,6 @@ var Menu = require('@mui/material/Menu');
30
30
  var Checkbox = require('@mui/material/Checkbox');
31
31
  var Radio = require('@mui/material/Radio');
32
32
  var matchSorterUtils = require('@tanstack/match-sorter-utils');
33
- var material = require('@mui/material');
34
33
  var ArrowDownwardIcon = require('@mui/icons-material/ArrowDownward');
35
34
  var ArrowRightIcon = require('@mui/icons-material/ArrowRight');
36
35
  var CancelIcon = require('@mui/icons-material/Cancel');
@@ -432,14 +431,14 @@ const getMRTTheme = (table, theme) => (Object.assign({ baseBackgroundColor: them
432
431
  ? styles.darken(theme.palette.warning.dark, 0.25)
433
432
  : styles.lighten(theme.palette.warning.light, 0.5), pinnedRowBackgroundColor: styles.alpha(theme.palette.primary.main, 0.1), selectedRowBackgroundColor: styles.alpha(theme.palette.primary.main, 0.2) }, parseFromValuesOrFunc(table.options.mrtTheme, theme)));
434
433
  const getCommonMRTCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
435
- var _a, _b, _c, _d, _e, _f;
434
+ var _a, _b, _c, _d, _e, _f, _g, _h;
436
435
  const { options: { layoutMode }, } = table;
437
436
  const widthStyles = {
438
437
  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)`,
439
- 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)`,
438
+ 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${header ? ` + ${(_e = (_d = header === null || header === void 0 ? void 0 : header.subHeaders) === null || _d === void 0 ? void 0 : _d.length) !== null && _e !== void 0 ? _e : 0}rem` : ''})`,
440
439
  };
441
440
  if (layoutMode === 'grid') {
442
- 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`;
441
+ widthStyles.flex = `var(--${header ? 'header' : 'col'}-${parseCSSVarId((_f = header === null || header === void 0 ? void 0 : header.id) !== null && _f !== void 0 ? _f : column.id)}-size) 0 auto`;
443
442
  }
444
443
  else if (layoutMode === 'grid-no-grow') {
445
444
  widthStyles.flex = '0 0 auto';
@@ -452,8 +451,8 @@ const getCommonMRTCellStyles = ({ column, header, table, tableCellProps, theme,
452
451
  ? `4px 0 8px -6px ${styles.alpha(theme.palette.grey[700], 0.5)} inset`
453
452
  : undefined, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, left: column.getIsPinned() === 'left'
454
453
  ? `${column.getStart('left')}px`
455
- : undefined, opacity: ((_e = table.getState().draggingColumn) === null || _e === void 0 ? void 0 : _e.id) === column.id ||
456
- ((_f = table.getState().hoveredColumn) === null || _f === void 0 ? void 0 : _f.id) === column.id
454
+ : undefined, opacity: ((_g = table.getState().draggingColumn) === null || _g === void 0 ? void 0 : _g.id) === column.id ||
455
+ ((_h = table.getState().hoveredColumn) === null || _h === void 0 ? void 0 : _h.id) === column.id
457
456
  ? 0.5
458
457
  : 1, position: column.getIsPinned() && column.columnDef.columnDefType !== 'group'
459
458
  ? 'sticky'
@@ -474,6 +473,9 @@ const getCommonToolbarStyles = ({ table, theme, }) => ({
474
473
  transition: 'all 150ms ease-in-out',
475
474
  zIndex: 1,
476
475
  });
476
+ const flipIconStyles = (theme) => theme.direction === 'rtl'
477
+ ? { style: { transform: 'scaleX(-1)' } }
478
+ : undefined;
477
479
 
478
480
  const allowedTypes = ['string', 'number'];
479
481
  const MRT_TableBodyCellValue = ({ cell, rowRef, staticRowIndex, table, }) => {
@@ -662,9 +664,9 @@ const MRT_EditCellTextField = (_a) => {
662
664
 
663
665
  const MRT_TableBodyCell = (_a) => {
664
666
  var _b, _c, _d, _e, _f;
665
- var { cell, measureElement, numRows, rowIndex, rowRef, table, virtualColumnIndex } = _a, rest = __rest(_a, ["cell", "measureElement", "numRows", "rowIndex", "rowRef", "table", "virtualColumnIndex"]);
667
+ var { cell, measureElement, numRows, rowRef, staticRowIndex, table, virtualColumnIndex } = _a, rest = __rest(_a, ["cell", "measureElement", "numRows", "rowRef", "staticRowIndex", "table", "virtualColumnIndex"]);
666
668
  const theme = styles.useTheme();
667
- const { getState, options: { columnResizeDirection, columnResizeMode, createDisplayMode, editDisplayMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping, layoutMode, muiSkeletonProps, muiTableBodyCellProps, }, refs: { editInputRefs }, setEditingCell, setHoveredColumn, } = table;
669
+ const { getState, options: { columnResizeDirection, columnResizeMode, createDisplayMode, editDisplayMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping, layoutMode, muiSkeletonProps, muiTableBodyCellProps, positionExpandColumn, }, refs: { editInputRefs }, setEditingCell, setHoveredColumn, } = table;
668
670
  const { columnSizingInfo, creatingRow, density, draggingColumn, draggingRow, editingCell, editingRow, hoveredColumn, hoveredRow, isLoading, showSkeletons, } = getState();
669
671
  const { column, row } = cell;
670
672
  const { columnDef } = column;
@@ -694,7 +696,7 @@ const MRT_TableBodyCell = (_a) => {
694
696
  const isHoveredRow = (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id;
695
697
  const isFirstColumn = getIsFirstColumn(column, table);
696
698
  const isLastColumn = getIsLastColumn(column, table);
697
- const isLastRow = numRows && rowIndex === numRows - 1;
699
+ const isLastRow = numRows && staticRowIndex === numRows - 1;
698
700
  const isResizingColumn = columnSizingInfo.isResizingColumn === column.id;
699
701
  const showResizeBorder = isResizingColumn && columnResizeMode === 'onChange';
700
702
  const borderStyle = showResizeBorder
@@ -733,7 +735,7 @@ const MRT_TableBodyCell = (_a) => {
733
735
  draggingRow,
734
736
  hoveredColumn,
735
737
  hoveredRow,
736
- rowIndex,
738
+ staticRowIndex,
737
739
  ]);
738
740
  const isEditable = !cell.getIsPlaceholder() &&
739
741
  parseFromValuesOrFunc(enableEditing, row) &&
@@ -774,7 +776,7 @@ const MRT_TableBodyCell = (_a) => {
774
776
  cell,
775
777
  table,
776
778
  };
777
- return (jsxRuntime.jsx(TableCell__default["default"], Object.assign({ "data-index": virtualColumnIndex, ref: (node) => {
779
+ return (jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: theme.direction === 'rtl' ? 'right' : 'left', "data-index": virtualColumnIndex, ref: (node) => {
778
780
  if (node) {
779
781
  measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
780
782
  }
@@ -797,7 +799,9 @@ const MRT_TableBodyCell = (_a) => {
797
799
  : '1rem'
798
800
  : columnDefType === 'display'
799
801
  ? '1rem 1.25rem'
800
- : '1.5rem', textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined, [theme.direction === 'rtl' ? 'pr' : 'pl']: column.id === 'mrt-row-expand'
802
+ : '1.5rem', textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined, [theme.direction === 'rtl' || positionExpandColumn === 'last'
803
+ ? 'pr'
804
+ : 'pl']: column.id === 'mrt-row-expand'
801
805
  ? `${row.depth +
802
806
  (density === 'compact'
803
807
  ? 0.5
@@ -817,7 +821,7 @@ const MRT_TableBodyCell = (_a) => {
817
821
  renderedCellValue: cell.renderValue(),
818
822
  row,
819
823
  rowRef,
820
- staticRowIndex: rowIndex,
824
+ staticRowIndex,
821
825
  table,
822
826
  })) : isCreating || isEditing ? (jsxRuntime.jsx(MRT_EditCellTextField, { cell: cell, table: table })) : (enableClickToCopy || columnDef.enableClickToCopy) &&
823
827
  columnDef.enableClickToCopy !== false ? (jsxRuntime.jsx(MRT_CopyButton, { cell: cell, table: table, children: jsxRuntime.jsx(MRT_TableBodyCellValue, Object.assign({}, cellValueProps)) })) : (jsxRuntime.jsx(MRT_TableBodyCellValue, Object.assign({}, cellValueProps))), cell.getIsGrouped() && !columnDef.GroupedCell && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [" (", (_f = row.subRows) === null || _f === void 0 ? void 0 : _f.length, ")"] }))] })) })));
@@ -825,32 +829,40 @@ const MRT_TableBodyCell = (_a) => {
825
829
  const Memo_MRT_TableBodyCell = react.memo(MRT_TableBodyCell, (prev, next) => next.cell === prev.cell);
826
830
 
827
831
  const MRT_TableDetailPanel = (_a) => {
828
- var { parentRowRef, row, rowIndex, table, virtualRow } = _a, rest = __rest(_a, ["parentRowRef", "row", "rowIndex", "table", "virtualRow"]);
829
- const { getState, getVisibleLeafColumns, options: { layoutMode, muiDetailPanelProps, muiTableBodyRowProps, renderDetailPanel, }, } = table;
832
+ var { parentRowRef, row, rowVirtualizer, staticRowIndex, table, virtualRow } = _a, rest = __rest(_a, ["parentRowRef", "row", "rowVirtualizer", "staticRowIndex", "table", "virtualRow"]);
833
+ const { getState, getVisibleLeafColumns, options: { enableRowVirtualization, layoutMode, muiDetailPanelProps, muiTableBodyRowProps, renderDetailPanel, }, } = table;
830
834
  const { isLoading } = getState();
831
835
  const tableRowProps = parseFromValuesOrFunc(muiTableBodyRowProps, {
832
836
  isDetailPanel: true,
833
837
  row,
834
- staticRowIndex: rowIndex,
838
+ staticRowIndex,
835
839
  table,
836
840
  });
837
841
  const tableCellProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiDetailPanelProps, {
838
842
  row,
839
843
  table,
840
844
  })), rest);
841
- return (jsxRuntime.jsx(TableRow__default["default"], Object.assign({ className: "Mui-TableBodyCell-DetailPanel" }, tableRowProps, { sx: (theme) => {
845
+ const DetailPanel = !isLoading && (renderDetailPanel === null || renderDetailPanel === void 0 ? void 0 : renderDetailPanel({ row, table }));
846
+ return (jsxRuntime.jsx(TableRow__default["default"], Object.assign({ className: "Mui-TableBodyCell-DetailPanel", "data-index": renderDetailPanel ? staticRowIndex * 2 + 1 : staticRowIndex, ref: (node) => {
847
+ var _a;
848
+ if (node) {
849
+ (_a = rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement) === null || _a === void 0 ? void 0 : _a.call(rowVirtualizer, node);
850
+ }
851
+ } }, tableRowProps, { sx: (theme) => {
842
852
  var _a, _b;
843
853
  return (Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, position: virtualRow ? 'absolute' : undefined, top: virtualRow
844
854
  ? `${(_b = (_a = parentRowRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.height}px`
845
855
  : undefined, transform: virtualRow
846
856
  ? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
847
- : undefined, width: '100%', zIndex: virtualRow ? 2 : undefined }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme)));
857
+ : undefined, width: '100%' }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme)));
848
858
  }, children: jsxRuntime.jsx(TableCell__default["default"], Object.assign({ className: "Mui-TableBodyCell-DetailPanel", colSpan: getVisibleLeafColumns().length }, tableCellProps, { sx: (theme) => (Object.assign({ backgroundColor: virtualRow
849
859
  ? getMRTTheme(table, theme).baseBackgroundColor
850
- : undefined, borderBottom: !row.getIsExpanded() ? 'none' : undefined, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, py: 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 }) })) })) })));
860
+ : undefined, borderBottom: !row.getIsExpanded() ? 'none' : undefined, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, py: !!DetailPanel && row.getIsExpanded() ? '1rem' : 0, transition: !enableRowVirtualization
861
+ ? 'all 150ms ease-in-out'
862
+ : undefined, width: `100%` }, parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme))), children: enableRowVirtualization ? (row.getIsExpanded() && DetailPanel) : (jsxRuntime.jsx(Collapse__default["default"], { in: !!row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true, children: DetailPanel })) })) })));
851
863
  };
852
864
 
853
- const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRowIds, row, rowIndex, table, virtualRow, }) => {
865
+ const MRT_TableBodyRow = ({ columnVirtualizer, numRows, pinnedRowIds, row, rowVirtualizer, staticRowIndex, table, virtualRow, }) => {
854
866
  var _a, _b, _c, _d;
855
867
  const theme = styles.useTheme();
856
868
  const { getState, options: { enableRowOrdering, enableRowPinning, enableStickyFooter, enableStickyHeader, layoutMode, memoMode, muiTableBodyRowProps, renderDetailPanel, rowPinningDisplayMode, }, refs: { tableFooterRef, tableHeadRef }, setHoveredRow, } = table;
@@ -861,7 +873,7 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRo
861
873
  const isHoveredRow = (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id;
862
874
  const tableRowProps = parseFromValuesOrFunc(muiTableBodyRowProps, {
863
875
  row,
864
- staticRowIndex: rowIndex,
876
+ staticRowIndex,
865
877
  table,
866
878
  });
867
879
  const [bottomPinnedIndex, topPinnedIndex] = react.useMemo(() => {
@@ -892,10 +904,11 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRo
892
904
  };
893
905
  const rowRef = react.useRef(null);
894
906
  const { baseBackgroundColor, pinnedRowBackgroundColor, selectedRowBackgroundColor, } = getMRTTheme(table, theme);
895
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(TableRow__default["default"], Object.assign({ "data-index": rowIndex, "data-pinned": !!isPinned || undefined, "data-selected": row.getIsSelected() || row.getIsAllSubRowsSelected() || undefined, onDragEnter: handleDragEnter, ref: (node) => {
907
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(TableRow__default["default"], Object.assign({ "data-index": renderDetailPanel ? staticRowIndex * 2 : staticRowIndex, "data-pinned": !!isPinned || undefined, "data-selected": row.getIsSelected() || row.getIsAllSubRowsSelected() || undefined, onDragEnter: handleDragEnter, ref: (node) => {
908
+ var _a;
896
909
  if (node) {
897
910
  rowRef.current = node;
898
- measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
911
+ (_a = rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement) === null || _a === void 0 ? void 0 : _a.call(rowVirtualizer, node);
899
912
  }
900
913
  }, selected: row.getIsSelected() }, tableRowProps, { style: Object.assign({ transform: virtualRow
901
914
  ? `translateY(${virtualRow.start}px)`
@@ -937,8 +950,8 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRo
937
950
  ? columnVirtualizer === null || columnVirtualizer === void 0 ? void 0 : columnVirtualizer.measureElement
938
951
  : undefined,
939
952
  numRows,
940
- rowIndex,
941
953
  rowRef,
954
+ staticRowIndex,
942
955
  table,
943
956
  virtualColumnIndex: columnVirtualizer
944
957
  ? cellOrVirtualCell.index
@@ -950,9 +963,9 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRo
950
963
  !draggingRow &&
951
964
  (editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) !== cell.id &&
952
965
  (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) !== row.id ? (jsxRuntime.jsx(Memo_MRT_TableBodyCell, Object.assign({}, props), cell.id)) : (jsxRuntime.jsx(MRT_TableBodyCell, Object.assign({}, props), cell.id))) : null;
953
- }), virtualPaddingRight ? (jsxRuntime.jsx("td", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })), renderDetailPanel && !row.getIsGrouped() && (jsxRuntime.jsx(MRT_TableDetailPanel, { parentRowRef: rowRef, row: row, rowIndex: rowIndex, table: table, virtualRow: virtualRow }))] }));
966
+ }), virtualPaddingRight ? (jsxRuntime.jsx("td", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })), renderDetailPanel && !row.getIsGrouped() && (jsxRuntime.jsx(MRT_TableDetailPanel, { parentRowRef: rowRef, row: row, rowVirtualizer: rowVirtualizer, staticRowIndex: staticRowIndex, table: table, virtualRow: virtualRow }))] }));
954
967
  };
955
- const Memo_MRT_TableBodyRow = react.memo(MRT_TableBodyRow, (prev, next) => prev.row === next.row && prev.rowIndex === next.rowIndex);
968
+ const Memo_MRT_TableBodyRow = react.memo(MRT_TableBodyRow, (prev, next) => prev.row === next.row && prev.staticRowIndex === next.staticRowIndex);
956
969
 
957
970
  const useMRT_ColumnVirtualizer = (table) => {
958
971
  var _a, _b, _c, _d, _e, _f, _g, _h;
@@ -1119,7 +1132,8 @@ const MRT_ExpandAllButton = (_a) => {
1119
1132
 
1120
1133
  const MRT_ExpandButton = ({ row, table, }) => {
1121
1134
  var _a, _b;
1122
- const { getState, options: { icons: { ExpandMoreIcon }, localization, muiExpandButtonProps, renderDetailPanel, }, } = table;
1135
+ const theme = styles.useTheme();
1136
+ const { getState, options: { icons: { ExpandMoreIcon }, localization, muiExpandButtonProps, positionExpandColumn, renderDetailPanel, }, } = table;
1123
1137
  const { density } = getState();
1124
1138
  const iconButtonProps = parseFromValuesOrFunc(muiExpandButtonProps, {
1125
1139
  row,
@@ -1133,8 +1147,16 @@ const MRT_ExpandButton = ({ row, table, }) => {
1133
1147
  row.toggleExpanded();
1134
1148
  (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
1135
1149
  };
1136
- return (jsxRuntime.jsx(Tooltip__default["default"], { disableHoverListener: !canExpand && !renderDetailPanel, enterDelay: 1000, enterNextDelay: 1000, title: (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : (isExpanded ? localization.collapse : localization.expand), children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.expand, disabled: !canExpand && !renderDetailPanel }, iconButtonProps, { onClick: handleToggleExpand, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', opacity: !canExpand && !renderDetailPanel ? 0.3 : 1, width: density === 'compact' ? '1.75rem' : '2.25rem' }, parseFromValuesOrFunc(iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx, theme))), title: undefined, children: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _b !== void 0 ? _b : (jsxRuntime.jsx(ExpandMoreIcon, { style: {
1137
- transform: `rotate(${!canExpand && !renderDetailPanel ? -90 : isExpanded ? -180 : 0}deg)`,
1150
+ const detailPanel = !!(renderDetailPanel === null || renderDetailPanel === void 0 ? void 0 : renderDetailPanel({ row, table }));
1151
+ return (jsxRuntime.jsx(Tooltip__default["default"], { disableHoverListener: !canExpand && !detailPanel, enterDelay: 1000, enterNextDelay: 1000, title: (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : (isExpanded ? localization.collapse : localization.expand), children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.expand, disabled: !canExpand && !detailPanel }, iconButtonProps, { onClick: handleToggleExpand, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', opacity: !canExpand && !detailPanel ? 0.3 : 1, width: density === 'compact' ? '1.75rem' : '2.25rem' }, parseFromValuesOrFunc(iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx, theme))), title: undefined, children: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _b !== void 0 ? _b : (jsxRuntime.jsx(ExpandMoreIcon, { style: {
1152
+ transform: `rotate(${!canExpand && !renderDetailPanel
1153
+ ? positionExpandColumn === 'last' ||
1154
+ theme.direction === 'rtl'
1155
+ ? 90
1156
+ : -90
1157
+ : isExpanded
1158
+ ? -180
1159
+ : 0}deg)`,
1138
1160
  transition: 'transform 150ms',
1139
1161
  } })) })) }) }));
1140
1162
  };
@@ -1596,7 +1618,7 @@ const MRT_SelectCheckbox = (_a) => {
1596
1618
  : undefined;
1597
1619
  const onSelectionChange = (event, row) => {
1598
1620
  var _a;
1599
- if (row.getIsAllSubRowsSelected()) {
1621
+ if (row.getIsAllSubRowsSelected() && row.getCanSelectSubRows()) {
1600
1622
  (_a = row.subRows) === null || _a === void 0 ? void 0 : _a.forEach((r) => r.toggleSelected(false));
1601
1623
  }
1602
1624
  row.getToggleSelectedHandler()(event);
@@ -1620,7 +1642,8 @@ const MRT_SelectCheckbox = (_a) => {
1620
1642
  ? localization.toggleSelectAll
1621
1643
  : localization.toggleSelectRow, checked: selectAll
1622
1644
  ? allRowsSelected
1623
- : (row === null || row === void 0 ? void 0 : row.getIsSelected()) || (row === null || row === void 0 ? void 0 : row.getIsAllSubRowsSelected()), disabled: isLoading || (row && !row.getCanSelect()) || (row === null || row === void 0 ? void 0 : row.id) === 'mrt-row-create', inputProps: {
1645
+ : (row === null || row === void 0 ? void 0 : row.getIsSelected()) ||
1646
+ ((row === null || row === void 0 ? void 0 : row.getIsAllSubRowsSelected()) && row.getCanSelectSubRows()), disabled: isLoading || (row && !row.getCanSelect()) || (row === null || row === void 0 ? void 0 : row.id) === 'mrt-row-create', inputProps: {
1624
1647
  'aria-label': selectAll
1625
1648
  ? localization.toggleSelectAll
1626
1649
  : localization.toggleSelectRow,
@@ -1636,7 +1659,7 @@ const MRT_SelectCheckbox = (_a) => {
1636
1659
  ? localization.toggleSelectAll
1637
1660
  : localization.toggleSelectRow), children: enableMultiRowSelection === false ? (jsxRuntime.jsx(Radio__default["default"], Object.assign({}, commonProps))) : (jsxRuntime.jsx(Checkbox__default["default"], Object.assign({ indeterminate: selectAll
1638
1661
  ? table.getIsSomeRowsSelected() && !allRowsSelected
1639
- : row === null || row === void 0 ? void 0 : row.getIsSomeSelected() }, commonProps))) }));
1662
+ : (row === null || row === void 0 ? void 0 : row.getIsSomeSelected()) && row.getCanSelectSubRows() }, commonProps))) }));
1640
1663
  };
1641
1664
 
1642
1665
  const useMRT_DisplayColumns = (params) => {
@@ -1675,6 +1698,7 @@ const useMRT_DisplayColumns = (params) => {
1675
1698
  tableOptions.groupedColumnMode,
1676
1699
  tableOptions.localization,
1677
1700
  tableOptions.positionActionsColumn,
1701
+ tableOptions.positionExpandColumn,
1678
1702
  tableOptions.renderDetailPanel,
1679
1703
  tableOptions.renderRowActionMenuItems,
1680
1704
  tableOptions.renderRowActions,
@@ -1712,6 +1736,11 @@ function makeRowExpandColumn({ grouping, tableOptions }, order) {
1712
1736
  const id = 'mrt-row-expand';
1713
1737
  if (order.includes(id) &&
1714
1738
  showExpandColumn(tableOptions, (_b = (_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.grouping) !== null && _b !== void 0 ? _b : grouping)) {
1739
+ const alignProps = tableOptions.positionExpandColumn === 'last'
1740
+ ? {
1741
+ align: 'right',
1742
+ }
1743
+ : undefined;
1715
1744
  return Object.assign({ Cell: ({ cell, column, row, table }) => {
1716
1745
  var _a, _b, _c;
1717
1746
  const expandButtonProps = { row, table };
@@ -1730,7 +1759,7 @@ function makeRowExpandColumn({ grouping, tableOptions }, order) {
1730
1759
  .map((groupedColumnId) => table.getColumn(groupedColumnId).columnDef.header)
1731
1760
  .join(', ')] }));
1732
1761
  }
1733
- : undefined }, defaultDisplayColumnProps(tableOptions, id, 'expand', tableOptions.groupedColumnMode === 'remove'
1762
+ : undefined, muiTableBodyCellProps: alignProps, muiTableHeadCellProps: alignProps }, defaultDisplayColumnProps(tableOptions, id, 'expand', tableOptions.groupedColumnMode === 'remove'
1734
1763
  ? (_c = tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.defaultColumn) === null || _c === void 0 ? void 0 : _c.size
1735
1764
  : 60));
1736
1765
  }
@@ -1843,13 +1872,19 @@ const useMRT_Effects = (table) => {
1843
1872
 
1844
1873
  const useMRT_RowVirtualizer = (table, rows) => {
1845
1874
  var _a;
1846
- const { getRowModel, getState, options: { enableRowVirtualization, rowVirtualizerInstanceRef, rowVirtualizerOptions, }, refs: { tableContainerRef }, } = table;
1847
- const { density, draggingRow } = getState();
1875
+ const { getRowModel, getState, options: { enableRowVirtualization, renderDetailPanel, rowVirtualizerInstanceRef, rowVirtualizerOptions, }, refs: { tableContainerRef }, } = table;
1876
+ const { density, draggingRow, expanded } = getState();
1848
1877
  const rowVirtualizerProps = parseFromValuesOrFunc(rowVirtualizerOptions, {
1849
1878
  table,
1850
1879
  });
1880
+ const rowCount = (_a = rows === null || rows === void 0 ? void 0 : rows.length) !== null && _a !== void 0 ? _a : getRowModel().rows.length;
1881
+ const normalRowHeight = density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73;
1851
1882
  const rowVirtualizer = enableRowVirtualization
1852
- ? reactVirtual.useVirtualizer(Object.assign({ count: (_a = rows === null || rows === void 0 ? void 0 : rows.length) !== null && _a !== void 0 ? _a : getRowModel().rows.length, estimateSize: () => density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73, getScrollElement: () => tableContainerRef.current, measureElement: typeof window !== 'undefined' &&
1883
+ ? reactVirtual.useVirtualizer(Object.assign({ count: renderDetailPanel ? rowCount * 2 : rowCount, estimateSize: (index) => renderDetailPanel && index % 2 === 1
1884
+ ? expanded === true
1885
+ ? 100
1886
+ : 0
1887
+ : normalRowHeight, getScrollElement: () => tableContainerRef.current, measureElement: typeof window !== 'undefined' &&
1853
1888
  navigator.userAgent.indexOf('Firefox') === -1
1854
1889
  ? (element) => element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height
1855
1890
  : undefined, overscan: 4, rangeExtractor: react.useCallback((range) => {
@@ -2343,7 +2378,7 @@ const MRT_DefaultDisplayColumn = {
2343
2378
  const useMRT_TableOptions = (_a) => {
2344
2379
  var _b;
2345
2380
  var { aggregationFns, autoResetExpanded = false, columnFilterDisplayMode = 'subheader', columnResizeDirection, columnResizeMode = 'onChange', createDisplayMode = 'modal', defaultColumn, defaultDisplayColumn, editDisplayMode = 'modal', enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnPinning = false, enableColumnResizing = false, enableDensityToggle = true, enableExpandAll = true, enableExpanding, enableFilterMatchHighlighting = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterRankedResults = true, enableGrouping = false, enableHiding = true, enableMultiRowSelection = true, enableMultiSort = true, enablePagination = true, enableRowPinning = false, enableRowSelection = false, enableSelectAll = true, enableSorting = true, enableStickyHeader = false, enableTableFooter = true, enableTableHead = true, enableToolbarInternalActions = true, enableTopToolbar = true, filterFns, icons, layoutMode, localization, manualFiltering, manualGrouping, manualPagination, manualSorting, paginationDisplayMode = 'default', positionActionsColumn = 'first', positionExpandColumn = 'first', positionGlobalFilter = 'right', positionPagination = 'bottom', positionToolbarAlertBanner = 'top', positionToolbarDropZone = 'top', rowNumberDisplayMode = 'static', rowPinningDisplayMode = 'sticky', selectAllMode = 'page', sortingFns } = _a, rest = __rest(_a, ["aggregationFns", "autoResetExpanded", "columnFilterDisplayMode", "columnResizeDirection", "columnResizeMode", "createDisplayMode", "defaultColumn", "defaultDisplayColumn", "editDisplayMode", "enableBottomToolbar", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnPinning", "enableColumnResizing", "enableDensityToggle", "enableExpandAll", "enableExpanding", "enableFilterMatchHighlighting", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enableRowPinning", "enableRowSelection", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "paginationDisplayMode", "positionActionsColumn", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberDisplayMode", "rowPinningDisplayMode", "selectAllMode", "sortingFns"]);
2346
- const theme = material.useTheme();
2381
+ const theme = styles.useTheme();
2347
2382
  const _icons = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), [icons]);
2348
2383
  const _localization = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), [localization]);
2349
2384
  const _aggregationFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns)), []);
@@ -2423,7 +2458,7 @@ const useMRT_TableOptions = (_a) => {
2423
2458
  const MRT_TableBody = (_a) => {
2424
2459
  var _b, _c, _d, _e, _f, _g;
2425
2460
  var { columnVirtualizer, table } = _a, rest = __rest(_a, ["columnVirtualizer", "table"]);
2426
- const { getBottomRows, getIsSomeRowsPinned, getRowModel, getState, getTopRows, options: { createDisplayMode, enableStickyFooter, enableStickyHeader, layoutMode, localization, memoMode, muiTableBodyProps, renderEmptyRowsFallback, rowPinningDisplayMode, }, refs: { tableFooterRef, tableHeadRef, tablePaperRef }, } = table;
2461
+ const { getBottomRows, getIsSomeRowsPinned, getRowModel, getState, getTopRows, options: { createDisplayMode, enableStickyFooter, enableStickyHeader, layoutMode, localization, memoMode, muiTableBodyProps, renderDetailPanel, renderEmptyRowsFallback, rowPinningDisplayMode, }, refs: { tableFooterRef, tableHeadRef, tablePaperRef }, } = table;
2427
2462
  const { columnFilters, creatingRow, globalFilter, isFullScreen, rowPinning } = getState();
2428
2463
  const tableBodyProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableBodyProps, { table })), rest);
2429
2464
  const tableHeadHeight = ((enableStickyHeader || isFullScreen) &&
@@ -2446,11 +2481,11 @@ const MRT_TableBody = (_a) => {
2446
2481
  numRows: rows.length,
2447
2482
  table,
2448
2483
  };
2449
- const CreatingRow = creatingRow && createDisplayMode === 'row' && (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, commonRowProps, { row: creatingRow, rowIndex: -1 })));
2484
+ const CreatingRow = creatingRow && createDisplayMode === 'row' && (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, commonRowProps, { row: creatingRow, staticRowIndex: -1 })));
2450
2485
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
2451
- 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) => {
2486
+ 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, staticRowIndex) => {
2452
2487
  const props = Object.assign(Object.assign({}, commonRowProps), { row,
2453
- rowIndex });
2488
+ staticRowIndex });
2454
2489
  return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
2455
2490
  }) }))), rowVirtualizer && CreatingRow && (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 }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: CreatingRow }))), jsxRuntime.jsxs(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
2456
2491
  ? `${rowVirtualizer.getTotalSize()}px`
@@ -2467,20 +2502,35 @@ const MRT_TableBody = (_a) => {
2467
2502
  width: '100%',
2468
2503
  }, children: globalFilter || columnFilters.length
2469
2504
  ? localization.noResultsFound
2470
- : localization.noRecordsToDisplay })) }) })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: (virtualRows !== null && virtualRows !== void 0 ? virtualRows : rows).map((rowOrVirtualRow, rowIndex) => {
2505
+ : localization.noRecordsToDisplay })) }) })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: (virtualRows !== null && virtualRows !== void 0 ? virtualRows : rows).map((rowOrVirtualRow, staticRowIndex) => {
2506
+ if (rowVirtualizer) {
2507
+ if (renderDetailPanel) {
2508
+ if (rowOrVirtualRow.index % 2 === 1) {
2509
+ return null;
2510
+ }
2511
+ else {
2512
+ staticRowIndex = rowOrVirtualRow.index / 2;
2513
+ }
2514
+ }
2515
+ else {
2516
+ staticRowIndex = rowOrVirtualRow.index;
2517
+ }
2518
+ }
2471
2519
  const row = rowVirtualizer
2472
- ? rows[rowOrVirtualRow.index]
2520
+ ? rows[staticRowIndex]
2473
2521
  : rowOrVirtualRow;
2474
- const props = Object.assign(Object.assign({}, commonRowProps), { measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement, pinnedRowIds,
2475
- row, rowIndex: rowVirtualizer ? rowOrVirtualRow.index : rowIndex, virtualRow: rowVirtualizer
2522
+ const props = Object.assign(Object.assign({}, commonRowProps), { pinnedRowIds,
2523
+ row,
2524
+ rowVirtualizer,
2525
+ staticRowIndex, virtualRow: rowVirtualizer
2476
2526
  ? rowOrVirtualRow
2477
2527
  : undefined });
2478
2528
  const key = `${row.id}-${row.index}`;
2479
2529
  return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), key)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), key));
2480
2530
  }) })))] })), !(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
2481
- 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) => {
2531
+ 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, staticRowIndex) => {
2482
2532
  const props = Object.assign(Object.assign({}, commonRowProps), { row,
2483
- rowIndex });
2533
+ staticRowIndex });
2484
2534
  return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
2485
2535
  }) })))] }));
2486
2536
  };
@@ -2489,6 +2539,7 @@ const Memo_MRT_TableBody = react.memo(MRT_TableBody, (prev, next) => prev.table.
2489
2539
  const MRT_TableFooterCell = (_a) => {
2490
2540
  var _b, _c, _d;
2491
2541
  var { footer, table } = _a, rest = __rest(_a, ["footer", "table"]);
2542
+ const theme = styles.useTheme();
2492
2543
  const { getState, options: { layoutMode, muiTableFooterCellProps }, } = table;
2493
2544
  const { density } = getState();
2494
2545
  const { column } = footer;
@@ -2496,7 +2547,11 @@ const MRT_TableFooterCell = (_a) => {
2496
2547
  const { columnDefType } = columnDef;
2497
2548
  const args = { column, table };
2498
2549
  const tableCellProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterCellProps, args)), parseFromValuesOrFunc(columnDef.muiTableFooterCellProps, args)), rest);
2499
- return (jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: footer.colSpan, variant: "head" }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, fontWeight: 'bold', justifyContent: columnDefType === 'group' ? 'center' : undefined, p: density === 'compact'
2550
+ return (jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: columnDefType === 'group'
2551
+ ? 'center'
2552
+ : theme.direction === 'rtl'
2553
+ ? 'right'
2554
+ : 'left', colSpan: footer.colSpan, variant: "footer" }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, fontWeight: 'bold', justifyContent: columnDefType === 'group' ? 'center' : undefined, p: density === 'compact'
2500
2555
  ? '0.5rem'
2501
2556
  : density === 'comfortable'
2502
2557
  ? '1rem'
@@ -3162,12 +3217,16 @@ const MRT_TableHeadCell = (_a) => {
3162
3217
  setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
3163
3218
  }
3164
3219
  };
3165
- const headerElement = (_b = parseFromValuesOrFunc(columnDef.Header, {
3220
+ const HeaderElement = (_b = parseFromValuesOrFunc(columnDef.Header, {
3166
3221
  column,
3167
3222
  header,
3168
3223
  table,
3169
3224
  })) !== null && _b !== void 0 ? _b : columnDef.header;
3170
- return (jsxRuntime.jsxs(TableCell__default["default"], Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: (node) => {
3225
+ return (jsxRuntime.jsxs(TableCell__default["default"], Object.assign({ align: columnDefType === 'group'
3226
+ ? 'center'
3227
+ : theme.direction === 'rtl'
3228
+ ? 'right'
3229
+ : 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: (node) => {
3171
3230
  if (node) {
3172
3231
  tableHeadCellRefs.current[column.id] = node;
3173
3232
  }
@@ -3236,7 +3295,7 @@ const MRT_TableHeadCell = (_a) => {
3236
3295
  whiteSpace: ((_h = (_g = columnDef.header) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 0) < 20
3237
3296
  ? 'nowrap'
3238
3297
  : 'normal',
3239
- }, title: columnDefType === 'data' ? columnDef.header : undefined, children: headerElement }), column.getCanFilter() && (jsxRuntime.jsx(MRT_TableHeadCellFilterLabel, { header: header, table: table })), column.getCanSort() && (jsxRuntime.jsx(MRT_TableHeadCellSortLabel, { header: header, table: table }))] }), columnDefType !== 'group' && (jsxRuntime.jsxs(Box__default["default"], { className: "Mui-TableHeadCell-Content-Actions", sx: {
3298
+ }, title: columnDefType === 'data' ? columnDef.header : undefined, children: HeaderElement }), column.getCanFilter() && (jsxRuntime.jsx(MRT_TableHeadCellFilterLabel, { header: header, table: table })), column.getCanSort() && (jsxRuntime.jsx(MRT_TableHeadCellSortLabel, { header: header, table: table }))] }), columnDefType !== 'group' && (jsxRuntime.jsxs(Box__default["default"], { className: "Mui-TableHeadCell-Content-Actions", sx: {
3240
3299
  whiteSpace: 'nowrap',
3241
3300
  }, children: [showDragHandle && (jsxRuntime.jsx(MRT_TableHeadCellGrabHandle, { column: column, table: table, tableHeadCellRef: {
3242
3301
  current: tableHeadCellRefs.current[column.id],
@@ -3251,7 +3310,7 @@ const MRT_TableHeadRow = (_a) => {
3251
3310
  headerGroup,
3252
3311
  table,
3253
3312
  })), rest);
3254
- return (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: getMRTTheme(table, theme).baseBackgroundColor, boxShadow: `4px 0 8px ${material.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) => {
3313
+ return (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: getMRTTheme(table, theme).baseBackgroundColor, 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) => {
3255
3314
  const header = virtualColumns
3256
3315
  ? headerGroup.headers[headerOrVirtualHeader.index]
3257
3316
  : headerOrVirtualHeader;
@@ -3278,6 +3337,7 @@ const MRT_LinearProgressBar = (_a) => {
3278
3337
  const defaultRowsPerPage = [5, 10, 15, 20, 25, 30, 50, 100];
3279
3338
  const MRT_TablePagination = (_a) => {
3280
3339
  var { position = 'bottom', table } = _a, rest = __rest(_a, ["position", "table"]);
3340
+ const theme = styles.useTheme();
3281
3341
  const { getPrePaginationRowModel, getState, options: { enableToolbarInternalActions, icons: { ChevronLeftIcon, ChevronRightIcon, FirstPageIcon, LastPageIcon }, localization, muiPaginationProps, paginationDisplayMode, rowCount, }, setPageIndex, setPageSize, } = table;
3282
3342
  const { pagination: { pageIndex = 0, pageSize = 10 }, showGlobalFilter, } = getState();
3283
3343
  const paginationProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiPaginationProps, {
@@ -3317,7 +3377,7 @@ const MRT_TablePagination = (_a) => {
3317
3377
  last: LastPageIcon,
3318
3378
  next: ChevronRightIcon,
3319
3379
  previous: ChevronLeftIcon,
3320
- } }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton }, _rest))) : paginationDisplayMode === 'default' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography__default["default"], { align: "center", component: "span", sx: { m: '0 4px', minWidth: '8ch' }, 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(Tooltip__default["default"], { enterDelay: 1000, title: localization.goToFirstPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToFirstPage, disabled: disableBack, onClick: () => setPageIndex(0), size: "small", children: jsxRuntime.jsx(FirstPageIcon, {}) }) }) })), jsxRuntime.jsx(Tooltip__default["default"], { enterDelay: 1000, title: localization.goToPreviousPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToPreviousPage, disabled: disableBack, onClick: () => setPageIndex(pageIndex - 1), size: "small", children: jsxRuntime.jsx(ChevronLeftIcon, {}) }) }) }), jsxRuntime.jsx(Tooltip__default["default"], { enterDelay: 1000, title: localization.goToNextPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToNextPage, disabled: disableNext, onClick: () => setPageIndex(pageIndex + 1), size: "small", children: jsxRuntime.jsx(ChevronRightIcon, {}) }) }) }), showLastButton && (jsxRuntime.jsx(Tooltip__default["default"], { enterDelay: 1000, title: localization.goToLastPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToLastPage, disabled: disableNext, onClick: () => setPageIndex(numberOfPages - 1), size: "small", children: jsxRuntime.jsx(LastPageIcon, {}) }) }) }))] })] })) : null] }));
3380
+ } }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton }, _rest))) : paginationDisplayMode === 'default' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography__default["default"], { align: "center", component: "span", sx: { m: '0 4px', minWidth: '8ch' }, 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(Tooltip__default["default"], { enterDelay: 1000, title: localization.goToFirstPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToFirstPage, disabled: disableBack, onClick: () => setPageIndex(0), size: "small", children: jsxRuntime.jsx(FirstPageIcon, Object.assign({}, flipIconStyles(theme))) }) }) })), jsxRuntime.jsx(Tooltip__default["default"], { enterDelay: 1000, title: localization.goToPreviousPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToPreviousPage, disabled: disableBack, onClick: () => setPageIndex(pageIndex - 1), size: "small", children: jsxRuntime.jsx(ChevronLeftIcon, Object.assign({}, flipIconStyles(theme))) }) }) }), jsxRuntime.jsx(Tooltip__default["default"], { enterDelay: 1000, title: localization.goToNextPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToNextPage, disabled: disableNext, onClick: () => setPageIndex(pageIndex + 1), size: "small", children: jsxRuntime.jsx(ChevronRightIcon, Object.assign({}, flipIconStyles(theme))) }) }) }), showLastButton && (jsxRuntime.jsx(Tooltip__default["default"], { enterDelay: 1000, title: localization.goToLastPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToLastPage, disabled: disableNext, onClick: () => setPageIndex(numberOfPages - 1), size: "small", children: jsxRuntime.jsx(LastPageIcon, Object.assign({}, flipIconStyles(theme))) }) }) }))] })] })) : null] }));
3321
3381
  };
3322
3382
 
3323
3383
  const MRT_GlobalFilterTextField = (_a) => {
@@ -3446,7 +3506,7 @@ const MRT_BottomToolbar = (_a) => {
3446
3506
  toolbarProps.ref.current = node;
3447
3507
  }
3448
3508
  }
3449
- }, sx: (theme) => (Object.assign(Object.assign(Object.assign({}, getCommonToolbarStyles({ table, theme })), { bottom: isFullScreen ? '0' : undefined, boxShadow: `0 1px 2px -1px ${material.alpha(theme.palette.grey[700], 0.5)} inset`, left: 0, position: isFullScreen ? 'fixed' : 'relative', right: 0 }), parseFromValuesOrFunc(toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx, theme))), children: [jsxRuntime.jsx(MRT_LinearProgressBar, { isTopToolbar: false, table: table }), positionToolbarAlertBanner === 'bottom' && (jsxRuntime.jsx(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })), ['both', 'bottom'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (jsxRuntime.jsx(MRT_ToolbarDropZone, { table: table })), jsxRuntime.jsxs(Box__default["default"], { sx: {
3509
+ }, sx: (theme) => (Object.assign(Object.assign(Object.assign({}, getCommonToolbarStyles({ table, theme })), { bottom: isFullScreen ? '0' : undefined, boxShadow: `0 1px 2px -1px ${styles.alpha(theme.palette.grey[700], 0.5)} inset`, left: 0, position: isFullScreen ? 'fixed' : 'relative', right: 0 }), parseFromValuesOrFunc(toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx, theme))), children: [jsxRuntime.jsx(MRT_LinearProgressBar, { isTopToolbar: false, table: table }), positionToolbarAlertBanner === 'bottom' && (jsxRuntime.jsx(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })), ['both', 'bottom'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (jsxRuntime.jsx(MRT_ToolbarDropZone, { table: table })), jsxRuntime.jsxs(Box__default["default"], { sx: {
3450
3510
  alignItems: 'center',
3451
3511
  boxSizing: 'border-box',
3452
3512
  display: 'flex',
@@ -3733,14 +3793,11 @@ const MRT_Table = (_a) => {
3733
3793
  const { columnSizing, columnSizingInfo, columnVisibility, isFullScreen } = getState();
3734
3794
  const tableProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableProps, { table })), rest);
3735
3795
  const columnSizeVars = react.useMemo(() => {
3736
- var _a;
3737
3796
  const headers = getFlatHeaders();
3738
3797
  const colSizes = {};
3739
3798
  for (let i = 0; i < headers.length; i++) {
3740
3799
  const header = headers[i];
3741
- let colSize = header.getSize();
3742
- if ((_a = header.subHeaders) === null || _a === void 0 ? void 0 : _a.length)
3743
- colSize = colSize * 1.05 + header.subHeaders.length * 2;
3800
+ const colSize = header.getSize();
3744
3801
  colSizes[`--header-${parseCSSVarId(header.id)}-size`] = colSize;
3745
3802
  colSizes[`--col-${parseCSSVarId(header.column.id)}-size`] = colSize;
3746
3803
  }
@@ -3969,6 +4026,7 @@ exports.createMRTColumnHelper = createMRTColumnHelper;
3969
4026
  exports.createRow = createRow;
3970
4027
  exports.extraIndexRangeExtractor = extraIndexRangeExtractor;
3971
4028
  exports.flexRender = flexRender;
4029
+ exports.flipIconStyles = flipIconStyles;
3972
4030
  exports.getAllLeafColumnDefs = getAllLeafColumnDefs;
3973
4031
  exports.getCanRankRows = getCanRankRows;
3974
4032
  exports.getColumnId = getColumnId;