material-react-table 2.3.1 → 2.4.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.d.ts +78 -49
- package/dist/index.esm.js +118 -91
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +118 -91
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/body/MRT_TableBody.tsx +16 -29
- package/src/body/MRT_TableBodyRow.tsx +6 -8
- package/src/buttons/MRT_EditActionButtons.tsx +12 -9
- package/src/column.utils.ts +2 -1
- package/src/footer/MRT_TableFooter.tsx +8 -11
- package/src/footer/MRT_TableFooterRow.tsx +6 -7
- package/src/head/MRT_TableHead.tsx +8 -11
- package/src/head/MRT_TableHeadCellColumnActionsButton.tsx +3 -1
- package/src/head/MRT_TableHeadRow.tsx +6 -7
- package/src/hooks/useMRT_ColumnVirtualizer.ts +38 -36
- package/src/hooks/useMRT_RowVirtualizer.ts +18 -12
- package/src/hooks/useMRT_Rows.ts +1 -8
- package/src/inputs/MRT_FilterTextField.tsx +69 -6
- package/src/menus/MRT_ColumnActionMenu.tsx +8 -1
- package/src/menus/MRT_FilterOptionMenu.tsx +1 -1
- package/src/style.utils.ts +0 -19
- package/src/table/MRT_Table.tsx +3 -16
- package/src/toolbar/MRT_TablePagination.tsx +54 -33
- package/src/types.ts +86 -26
package/dist/index.esm.js
CHANGED
@@ -67,6 +67,8 @@ import Chip from '@mui/material/Chip';
|
|
67
67
|
import InputAdornment from '@mui/material/InputAdornment';
|
68
68
|
import { debounce } from '@mui/material/utils';
|
69
69
|
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
|
70
|
+
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
|
71
|
+
import { TimePicker } from '@mui/x-date-pickers/TimePicker';
|
70
72
|
import FormHelperText from '@mui/material/FormHelperText';
|
71
73
|
import Slider from '@mui/material/Slider';
|
72
74
|
import Stack from '@mui/material/Stack';
|
@@ -295,6 +297,8 @@ const createRow = (table, originalRow) => createRow$1(table, 'mrt-row-create', o
|
|
295
297
|
}))), -1, 0);
|
296
298
|
const extraIndexRangeExtractor = (range, draggingIndex) => {
|
297
299
|
const newIndexes = defaultRangeExtractor(range);
|
300
|
+
if (draggingIndex === undefined)
|
301
|
+
return newIndexes;
|
298
302
|
if (draggingIndex >= 0 &&
|
299
303
|
draggingIndex < Math.max(range.startIndex - range.overscan, 0)) {
|
300
304
|
newIndexes.unshift(draggingIndex);
|
@@ -339,7 +343,7 @@ const getMRTTheme = (table, theme) => (Object.assign({ baseBackgroundColor: them
|
|
339
343
|
? darken(theme.palette.warning.dark, 0.25)
|
340
344
|
: lighten(theme.palette.warning.light, 0.5), pinnedRowBackgroundColor: alpha(theme.palette.primary.main, 0.1), selectedRowBackgroundColor: alpha(theme.palette.primary.main, 0.2) }, parseFromValuesOrFunc(table.options.mrtTheme, theme)));
|
341
345
|
const getCommonMRTCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
|
342
|
-
var _a, _b, _c, _d, _e, _f
|
346
|
+
var _a, _b, _c, _d, _e, _f;
|
343
347
|
const { options: { layoutMode }, } = table;
|
344
348
|
const widthStyles = {
|
345
349
|
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)`,
|
@@ -359,19 +363,8 @@ const getCommonMRTCellStyles = ({ column, header, table, tableCellProps, theme,
|
|
359
363
|
? `4px 0 8px -6px ${alpha(theme.palette.grey[700], 0.5)} inset`
|
360
364
|
: undefined, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, left: column.getIsPinned() === 'left'
|
361
365
|
? `${column.getStart('left')}px`
|
362
|
-
: undefined,
|
363
|
-
|
364
|
-
column.getPinnedIndex() === 0
|
365
|
-
? `-${column.getSize() *
|
366
|
-
((_f = (_e = table.getState().columnPinning.left) === null || _e === void 0 ? void 0 : _e.length) !== null && _f !== void 0 ? _f : 1)}px`
|
367
|
-
: undefined, mr: table.options.enableColumnVirtualization &&
|
368
|
-
column.getIsPinned() === 'right' &&
|
369
|
-
column.getPinnedIndex() === table.getVisibleLeafColumns().length - 1
|
370
|
-
? `-${column.getSize() *
|
371
|
-
((_h = (_g = table.getState().columnPinning.right) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 1) *
|
372
|
-
1.2}px`
|
373
|
-
: undefined, opacity: ((_j = table.getState().draggingColumn) === null || _j === void 0 ? void 0 : _j.id) === column.id ||
|
374
|
-
((_k = table.getState().hoveredColumn) === null || _k === void 0 ? void 0 : _k.id) === column.id
|
366
|
+
: undefined, opacity: ((_e = table.getState().draggingColumn) === null || _e === void 0 ? void 0 : _e.id) === column.id ||
|
367
|
+
((_f = table.getState().hoveredColumn) === null || _f === void 0 ? void 0 : _f.id) === column.id
|
375
368
|
? 0.5
|
376
369
|
: 1, position: column.getIsPinned() && column.columnDef.columnDefType !== 'group'
|
377
370
|
? 'sticky'
|
@@ -802,11 +795,12 @@ const MRT_TableDetailPanel = (_a) => {
|
|
802
795
|
: 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 && (jsx(Collapse, { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true, children: !isLoading && renderDetailPanel({ row, table }) })) })) })));
|
803
796
|
};
|
804
797
|
|
805
|
-
const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRowIds, row, rowIndex, table,
|
798
|
+
const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRowIds, row, rowIndex, table, virtualRow, }) => {
|
806
799
|
var _a, _b, _c, _d;
|
807
800
|
const theme = useTheme();
|
808
801
|
const { getState, options: { enableRowOrdering, enableRowPinning, enableStickyFooter, enableStickyHeader, layoutMode, memoMode, muiTableBodyRowProps, renderDetailPanel, rowPinningDisplayMode, }, refs: { tableFooterRef, tableHeadRef }, setHoveredRow, } = table;
|
809
802
|
const { density, draggingColumn, draggingRow, editingCell, editingRow, hoveredRow, isFullScreen, rowPinning, } = getState();
|
803
|
+
const { virtualColumns, virtualPaddingLeft, virtualPaddingRight } = columnVirtualizer !== null && columnVirtualizer !== void 0 ? columnVirtualizer : {};
|
810
804
|
const isPinned = enableRowPinning && row.getIsPinned();
|
811
805
|
const tableRowProps = parseFromValuesOrFunc(muiTableBodyRowProps, {
|
812
806
|
row,
|
@@ -906,7 +900,7 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRo
|
|
906
900
|
const Memo_MRT_TableBodyRow = memo(MRT_TableBodyRow, (prev, next) => prev.row === next.row && prev.rowIndex === next.rowIndex);
|
907
901
|
|
908
902
|
const useMRT_ColumnVirtualizer = (table) => {
|
909
|
-
var _a, _b, _c, _d;
|
903
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
910
904
|
const { getState, options: { columnVirtualizerInstanceRef, columnVirtualizerOptions, enableColumnPinning, enableColumnVirtualization, }, refs: { tableContainerRef }, } = table;
|
911
905
|
const { columnPinning, columnVisibility, draggingColumn } = getState();
|
912
906
|
const columnVirtualizerProps = parseFromValuesOrFunc(columnVirtualizerOptions, {
|
@@ -917,22 +911,26 @@ const useMRT_ColumnVirtualizer = (table) => {
|
|
917
911
|
table.getLeftLeafColumns().map((c) => c.getPinnedIndex()),
|
918
912
|
table
|
919
913
|
.getRightLeafColumns()
|
920
|
-
.map((c) => table.getVisibleLeafColumns().length - c.getPinnedIndex() - 1)
|
914
|
+
.map((c) => table.getVisibleLeafColumns().length - c.getPinnedIndex() - 1)
|
915
|
+
.sort((a, b) => a - b),
|
921
916
|
]
|
922
917
|
: [[], []], [columnPinning, enableColumnVirtualization, enableColumnPinning]);
|
923
918
|
//get first 16 column widths and average them if calc is needed
|
924
919
|
const averageColumnWidth = useMemo(() => {
|
925
920
|
var _a, _b, _c, _d;
|
926
|
-
if (!enableColumnVirtualization || (columnVirtualizerProps === null || columnVirtualizerProps === void 0 ? void 0 : columnVirtualizerProps.estimateSize))
|
921
|
+
if (!enableColumnVirtualization || (columnVirtualizerProps === null || columnVirtualizerProps === void 0 ? void 0 : columnVirtualizerProps.estimateSize)) {
|
927
922
|
return 0;
|
923
|
+
}
|
928
924
|
const columnsWidths = (_d = (_c = (_b = (_a = table
|
929
925
|
.getRowModel()
|
930
926
|
.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 : [];
|
931
927
|
return columnsWidths.reduce((a, b) => a + b, 0) / columnsWidths.length;
|
932
928
|
}, [table.getRowModel().rows, columnPinning, columnVisibility]);
|
933
|
-
const draggingColumnIndex =
|
934
|
-
|
935
|
-
|
929
|
+
const draggingColumnIndex = (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id)
|
930
|
+
? table
|
931
|
+
.getVisibleLeafColumns()
|
932
|
+
.findIndex((c) => c.id === (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id))
|
933
|
+
: undefined;
|
936
934
|
const columnVirtualizer = enableColumnVirtualization
|
937
935
|
? useVirtualizer(Object.assign({ count: table.getVisibleLeafColumns().length, estimateSize: () => averageColumnWidth, getScrollElement: () => tableContainerRef.current, horizontal: true, overscan: 3, rangeExtractor: useCallback((range) => {
|
938
936
|
const newIndexes = extraIndexRangeExtractor(range, draggingColumnIndex);
|
@@ -945,21 +943,25 @@ const useMRT_ColumnVirtualizer = (table) => {
|
|
945
943
|
];
|
946
944
|
}, [leftPinnedIndexes, rightPinnedIndexes, draggingColumnIndex]) }, columnVirtualizerProps))
|
947
945
|
: undefined;
|
948
|
-
if (
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
946
|
+
if (columnVirtualizer) {
|
947
|
+
const virtualColumns = columnVirtualizer.getVirtualItems();
|
948
|
+
columnVirtualizer.virtualColumns = virtualColumns;
|
949
|
+
if (virtualColumns.length) {
|
950
|
+
columnVirtualizer.virtualPaddingLeft =
|
951
|
+
((_b = (_a = virtualColumns[leftPinnedIndexes.length]) === null || _a === void 0 ? void 0 : _a.start) !== null && _b !== void 0 ? _b : 0) -
|
952
|
+
((_d = (_c = virtualColumns[leftPinnedIndexes.length - 1]) === null || _c === void 0 ? void 0 : _c.end) !== null && _d !== void 0 ? _d : 0);
|
953
|
+
columnVirtualizer.virtualPaddingRight =
|
954
|
+
columnVirtualizer.getTotalSize() -
|
955
|
+
((_f = (_e = virtualColumns[virtualColumns.length - rightPinnedIndexes.length - 1]) === null || _e === void 0 ? void 0 : _e.end) !== null && _f !== void 0 ? _f : 0) -
|
956
|
+
(rightPinnedIndexes.length
|
957
|
+
? columnVirtualizer.getTotalSize() -
|
958
|
+
((_h = (_g = virtualColumns[virtualColumns.length - rightPinnedIndexes.length]) === null || _g === void 0 ? void 0 : _g.start) !== null && _h !== void 0 ? _h : 0)
|
959
|
+
: 0);
|
960
|
+
}
|
961
|
+
if (columnVirtualizerInstanceRef) {
|
962
|
+
//@ts-ignore
|
963
|
+
columnVirtualizerInstanceRef.current = columnVirtualizer;
|
964
|
+
}
|
963
965
|
}
|
964
966
|
return columnVirtualizer;
|
965
967
|
};
|
@@ -1082,7 +1084,8 @@ const MRT_EditActionButtons = (_a) => {
|
|
1082
1084
|
});
|
1083
1085
|
}
|
1084
1086
|
};
|
1085
|
-
return (jsx(Box, { onClick: (e) => e.stopPropagation(), sx: (theme) => (Object.assign({ display: 'flex', gap: '0.75rem' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: variant === 'icon' ? (jsxs(Fragment, { children: [jsx(Tooltip, { title: localization.cancel, children: jsx(IconButton, { "aria-label": localization.cancel, onClick: handleCancel, children: jsx(CancelIcon, {}) }) }),
|
1087
|
+
return (jsx(Box, { onClick: (e) => e.stopPropagation(), sx: (theme) => (Object.assign({ display: 'flex', gap: '0.75rem' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: variant === 'icon' ? (jsxs(Fragment, { children: [jsx(Tooltip, { title: localization.cancel, children: jsx(IconButton, { "aria-label": localization.cancel, onClick: handleCancel, children: jsx(CancelIcon, {}) }) }), ((isCreating && onCreatingRowSave) ||
|
1088
|
+
(isEditing && onEditingRowSave)) && (jsx(Tooltip, { title: localization.save, children: jsx(IconButton, { "aria-label": localization.save, color: "info", onClick: handleSubmitRow, children: isSaving ? jsx(CircularProgress, { size: 18 }) : jsx(SaveIcon, {}) }) }))] })) : (jsxs(Fragment, { children: [jsx(Button, { onClick: handleCancel, sx: { minWidth: '100px' }, children: localization.cancel }), jsxs(Button, { onClick: handleSubmitRow, sx: { minWidth: '100px' }, variant: "contained", children: [isSaving && jsx(CircularProgress, { color: "inherit", size: 18 }), localization.save] })] })) }));
|
1086
1089
|
};
|
1087
1090
|
|
1088
1091
|
const mrtFilterOptions = (localization) => [
|
@@ -1174,7 +1177,7 @@ const mrtFilterOptions = (localization) => [
|
|
1174
1177
|
const rangeModes = ['between', 'betweenInclusive', 'inNumberRange'];
|
1175
1178
|
const emptyModes = ['empty', 'notEmpty'];
|
1176
1179
|
const arrModes = ['arrIncludesSome', 'arrIncludesAll', 'arrIncludes'];
|
1177
|
-
const rangeVariants = ['range-slider', 'date-range', 'range'];
|
1180
|
+
const rangeVariants = ['range-slider', 'date-range', 'datetime-range', 'range'];
|
1178
1181
|
const MRT_FilterOptionMenu = (_a) => {
|
1179
1182
|
var _b, _c, _d, _e;
|
1180
1183
|
var { anchorEl, header, onSelect, setAnchorEl, setFilterValue, table } = _a, rest = __rest(_a, ["anchorEl", "header", "onSelect", "setAnchorEl", "setFilterValue", "table"]);
|
@@ -1297,7 +1300,7 @@ const commonListItemStyles = {
|
|
1297
1300
|
const MRT_ColumnActionMenu = (_a) => {
|
1298
1301
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
1299
1302
|
var { anchorEl, header, setAnchorEl, table } = _a, rest = __rest(_a, ["anchorEl", "header", "setAnchorEl", "table"]);
|
1300
|
-
const { getState, options: { columnFilterDisplayMode, columnFilterModeOptions, enableColumnFilterModes, enableColumnFilters, enableColumnPinning, enableColumnResizing, enableGrouping, enableHiding, enableSorting, enableSortingRemoval, icons: { ArrowRightIcon, ClearAllIcon, DynamicFeedIcon, FilterListIcon, FilterListOffIcon, PushPinIcon, RestartAltIcon, SortIcon, ViewColumnIcon, VisibilityOffIcon, }, localization, renderColumnActionsMenuItems, }, refs: { filterInputRefs }, setColumnOrder, setColumnSizingInfo, setShowColumnFilters, toggleAllColumnsVisible, } = table;
|
1303
|
+
const { getState, options: { columnFilterDisplayMode, columnFilterModeOptions, enableColumnFilterModes, enableColumnFilters, enableColumnPinning, enableColumnResizing, enableGrouping, enableHiding, enableSorting, enableSortingRemoval, icons: { ArrowRightIcon, ClearAllIcon, DynamicFeedIcon, FilterListIcon, FilterListOffIcon, PushPinIcon, RestartAltIcon, SortIcon, ViewColumnIcon, VisibilityOffIcon, }, localization, renderColumnActionsMenuItems, }, refs: { filterInputRefs }, setColumnFilterFns, setColumnOrder, setColumnSizingInfo, setShowColumnFilters, toggleAllColumnsVisible, } = table;
|
1301
1304
|
const { column } = header;
|
1302
1305
|
const { columnDef } = column;
|
1303
1306
|
const { columnSizing, columnVisibility, density, showColumnFilters } = getState();
|
@@ -1334,8 +1337,14 @@ const MRT_ColumnActionMenu = (_a) => {
|
|
1334
1337
|
setAnchorEl(null);
|
1335
1338
|
};
|
1336
1339
|
const handleClearFilter = () => {
|
1337
|
-
column.setFilterValue(
|
1340
|
+
column.setFilterValue(undefined);
|
1338
1341
|
setAnchorEl(null);
|
1342
|
+
if (['empty', 'notEmpty'].includes(columnDef._filterFn)) {
|
1343
|
+
setColumnFilterFns((prev) => {
|
1344
|
+
var _a;
|
1345
|
+
return (Object.assign(Object.assign({}, prev), { [header.id]: (_a = allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions[0]) !== null && _a !== void 0 ? _a : 'fuzzy' }));
|
1346
|
+
});
|
1347
|
+
}
|
1339
1348
|
};
|
1340
1349
|
const handleFilterByColumn = () => {
|
1341
1350
|
setShowColumnFilters(true);
|
@@ -1690,14 +1699,15 @@ const useMRT_Effects = (table) => {
|
|
1690
1699
|
}, [density]);
|
1691
1700
|
};
|
1692
1701
|
|
1693
|
-
const useMRT_RowVirtualizer = (table) => {
|
1702
|
+
const useMRT_RowVirtualizer = (table, rows) => {
|
1703
|
+
var _a;
|
1694
1704
|
const { getRowModel, getState, options: { enableRowVirtualization, rowVirtualizerInstanceRef, rowVirtualizerOptions, }, refs: { tableContainerRef }, } = table;
|
1695
1705
|
const { density, draggingRow } = getState();
|
1696
1706
|
const rowVirtualizerProps = parseFromValuesOrFunc(rowVirtualizerOptions, {
|
1697
1707
|
table,
|
1698
1708
|
});
|
1699
1709
|
const rowVirtualizer = enableRowVirtualization
|
1700
|
-
? useVirtualizer(Object.assign({ count: getRowModel().rows.length, estimateSize: () => density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73, getScrollElement: () => tableContainerRef.current, measureElement: typeof window !== 'undefined' &&
|
1710
|
+
? 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' &&
|
1701
1711
|
navigator.userAgent.indexOf('Firefox') === -1
|
1702
1712
|
? (element) => element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height
|
1703
1713
|
: undefined, overscan: 4, rangeExtractor: useCallback((range) => {
|
@@ -1705,9 +1715,13 @@ const useMRT_RowVirtualizer = (table) => {
|
|
1705
1715
|
return extraIndexRangeExtractor(range, (_a = draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.index) !== null && _a !== void 0 ? _a : 0);
|
1706
1716
|
}, [draggingRow]) }, rowVirtualizerProps))
|
1707
1717
|
: undefined;
|
1708
|
-
if (
|
1709
|
-
|
1710
|
-
|
1718
|
+
if (rowVirtualizer) {
|
1719
|
+
const virtualRows = rowVirtualizer.getVirtualItems();
|
1720
|
+
rowVirtualizer.virtualRows = virtualRows;
|
1721
|
+
if (rowVirtualizerInstanceRef) {
|
1722
|
+
//@ts-ignore
|
1723
|
+
rowVirtualizerInstanceRef.current = rowVirtualizer;
|
1724
|
+
}
|
1711
1725
|
}
|
1712
1726
|
return rowVirtualizer;
|
1713
1727
|
};
|
@@ -1726,7 +1740,7 @@ const MRT_SortingFns = Object.assign(Object.assign({}, sortingFns), { fuzzy: fuz
|
|
1726
1740
|
const rankGlobalFuzzy = (rowA, rowB) => Math.max(...Object.values(rowB.columnFiltersMeta).map((v) => v.rank)) -
|
1727
1741
|
Math.max(...Object.values(rowA.columnFiltersMeta).map((v) => v.rank));
|
1728
1742
|
|
1729
|
-
const useMRT_Rows = (table) => {
|
1743
|
+
const useMRT_Rows = (table, pinnedRowIds = []) => {
|
1730
1744
|
const { getBottomRows, getCenterRows, getPrePaginationRowModel, getRowModel, getState, getTopRows, options: { enableGlobalFilterRankedResults, enablePagination, enableRowPinning, manualExpanding, manualFiltering, manualGrouping, manualPagination, manualSorting, rowPinningDisplayMode, }, } = table;
|
1731
1745
|
const { expanded, globalFilter, pagination, rowPinning, sorting } = getState();
|
1732
1746
|
const shouldRankRows = useMemo(() => getCanRankRows(table) &&
|
@@ -1741,9 +1755,6 @@ const useMRT_Rows = (table) => {
|
|
1741
1755
|
manualSorting,
|
1742
1756
|
sorting,
|
1743
1757
|
]);
|
1744
|
-
const pinnedRowIds = useMemo(() => getRowModel()
|
1745
|
-
.rows.filter((row) => row.getIsPinned())
|
1746
|
-
.map((r) => r.id), [rowPinning, table.getRowModel().rows]);
|
1747
1758
|
const rows = useMemo(() => {
|
1748
1759
|
let rows = [];
|
1749
1760
|
if (!shouldRankRows) {
|
@@ -2269,7 +2280,7 @@ const useMRT_TableOptions = (_a) => {
|
|
2269
2280
|
|
2270
2281
|
const MRT_TableBody = (_a) => {
|
2271
2282
|
var _b, _c, _d, _e, _f, _g;
|
2272
|
-
var { columnVirtualizer, table
|
2283
|
+
var { columnVirtualizer, table } = _a, rest = __rest(_a, ["columnVirtualizer", "table"]);
|
2273
2284
|
const { getBottomRows, getIsSomeRowsPinned, getRowModel, getState, getTopRows, options: { createDisplayMode, enableStickyFooter, enableStickyHeader, layoutMode, localization, memoMode, muiTableBodyProps, renderEmptyRowsFallback, rowPinningDisplayMode, }, refs: { tableFooterRef, tableHeadRef, tablePaperRef }, } = table;
|
2274
2285
|
const { columnFilters, creatingRow, globalFilter, isFullScreen, rowPinning } = getState();
|
2275
2286
|
const tableBodyProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableBodyProps, { table })), rest);
|
@@ -2277,21 +2288,21 @@ const MRT_TableBody = (_a) => {
|
|
2277
2288
|
((_b = tableHeadRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight)) ||
|
2278
2289
|
0;
|
2279
2290
|
const tableFooterHeight = (enableStickyFooter && ((_c = tableFooterRef.current) === null || _c === void 0 ? void 0 : _c.clientHeight)) || 0;
|
2280
|
-
const pinnedRowIds = useMemo(() =>
|
2281
|
-
|
2282
|
-
|
2283
|
-
|
2284
|
-
|
2285
|
-
|
2286
|
-
|
2287
|
-
|
2291
|
+
const pinnedRowIds = useMemo(() => {
|
2292
|
+
var _a, _b;
|
2293
|
+
if (!((_a = rowPinning.bottom) === null || _a === void 0 ? void 0 : _a.length) && !((_b = rowPinning.top) === null || _b === void 0 ? void 0 : _b.length))
|
2294
|
+
return [];
|
2295
|
+
return getRowModel()
|
2296
|
+
.rows.filter((row) => row.getIsPinned())
|
2297
|
+
.map((r) => r.id);
|
2298
|
+
}, [rowPinning, getRowModel().rows]);
|
2299
|
+
const rows = useMRT_Rows(table, pinnedRowIds);
|
2300
|
+
const rowVirtualizer = useMRT_RowVirtualizer(table, rows);
|
2301
|
+
const { virtualRows } = rowVirtualizer !== null && rowVirtualizer !== void 0 ? rowVirtualizer : {};
|
2288
2302
|
const commonRowProps = {
|
2289
2303
|
columnVirtualizer,
|
2290
2304
|
numRows: rows.length,
|
2291
2305
|
table,
|
2292
|
-
virtualColumns,
|
2293
|
-
virtualPaddingLeft,
|
2294
|
-
virtualPaddingRight,
|
2295
2306
|
};
|
2296
2307
|
const CreatingRow = creatingRow && createDisplayMode === 'row' && (jsx(MRT_TableBodyRow, Object.assign({}, commonRowProps, { row: creatingRow, rowIndex: -1 })));
|
2297
2308
|
return (jsxs(Fragment, { children: [!(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
|
@@ -2322,12 +2333,13 @@ const MRT_TableBody = (_a) => {
|
|
2322
2333
|
row, rowIndex: rowVirtualizer ? rowOrVirtualRow.index : rowIndex, virtualRow: rowVirtualizer
|
2323
2334
|
? rowOrVirtualRow
|
2324
2335
|
: undefined });
|
2325
|
-
|
2336
|
+
const key = `${row.id}-${row.index}`;
|
2337
|
+
return memoMode === 'rows' ? (jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), key)) : (jsx(MRT_TableBodyRow, Object.assign({}, props), key));
|
2326
2338
|
}) })))] })), !(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
|
2327
2339
|
getIsSomeRowsPinned('bottom') && (jsx(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ bottom: tableFooterHeight - 1, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, position: 'sticky', zIndex: 1 }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: getBottomRows().map((row, rowIndex) => {
|
2328
2340
|
const props = Object.assign(Object.assign({}, commonRowProps), { row,
|
2329
2341
|
rowIndex });
|
2330
|
-
return memoMode === 'rows' ? (jsx(Memo_MRT_TableBodyRow, Object.assign({}, props),
|
2342
|
+
return memoMode === 'rows' ? (jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
|
2331
2343
|
}) })))] }));
|
2332
2344
|
};
|
2333
2345
|
const Memo_MRT_TableBody = memo(MRT_TableBody, (prev, next) => prev.table.options.data === next.table.options.data);
|
@@ -2362,8 +2374,9 @@ const MRT_TableFooterCell = (_a) => {
|
|
2362
2374
|
|
2363
2375
|
const MRT_TableFooterRow = (_a) => {
|
2364
2376
|
var _b;
|
2365
|
-
var { footerGroup, table
|
2377
|
+
var { columnVirtualizer, footerGroup, table } = _a, rest = __rest(_a, ["columnVirtualizer", "footerGroup", "table"]);
|
2366
2378
|
const { options: { layoutMode, muiTableFooterRowProps }, } = table;
|
2379
|
+
const { virtualColumns, virtualPaddingLeft, virtualPaddingRight } = columnVirtualizer !== null && columnVirtualizer !== void 0 ? columnVirtualizer : {};
|
2367
2380
|
// if no content in row, skip row
|
2368
2381
|
if (!((_b = footerGroup.headers) === null || _b === void 0 ? void 0 : _b.some((header) => (typeof header.column.columnDef.footer === 'string' &&
|
2369
2382
|
!!header.column.columnDef.footer) ||
|
@@ -2382,7 +2395,7 @@ const MRT_TableFooterRow = (_a) => {
|
|
2382
2395
|
};
|
2383
2396
|
|
2384
2397
|
const MRT_TableFooter = (_a) => {
|
2385
|
-
var {
|
2398
|
+
var { columnVirtualizer, table } = _a, rest = __rest(_a, ["columnVirtualizer", "table"]);
|
2386
2399
|
const { getFooterGroups, getState, options: { enableStickyFooter, layoutMode, muiTableFooterProps }, refs: { tableFooterRef }, } = table;
|
2387
2400
|
const { isFullScreen } = getState();
|
2388
2401
|
const tableFooterProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterProps, {
|
@@ -2399,11 +2412,11 @@ const MRT_TableFooter = (_a) => {
|
|
2399
2412
|
? theme.palette.mode === 'light'
|
2400
2413
|
? `1px solid ${theme.palette.grey[300]}`
|
2401
2414
|
: `1px solid ${theme.palette.grey[700]}`
|
2402
|
-
: undefined, position: stickFooter ? 'sticky' : undefined, zIndex: stickFooter ? 1 : undefined }, parseFromValuesOrFunc(tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx, theme))), children: getFooterGroups().map((footerGroup) => (jsx(MRT_TableFooterRow, { footerGroup: footerGroup, table: table
|
2415
|
+
: undefined, position: stickFooter ? 'sticky' : undefined, zIndex: stickFooter ? 1 : undefined }, parseFromValuesOrFunc(tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx, theme))), children: getFooterGroups().map((footerGroup) => (jsx(MRT_TableFooterRow, { columnVirtualizer: columnVirtualizer, footerGroup: footerGroup, table: table }, footerGroup.id))) })));
|
2403
2416
|
};
|
2404
2417
|
|
2405
2418
|
const MRT_TableHeadCellColumnActionsButton = (_a) => {
|
2406
|
-
var _b;
|
2419
|
+
var _b, _c;
|
2407
2420
|
var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
|
2408
2421
|
const { options: { icons: { MoreVertIcon }, localization, muiColumnActionsButtonProps, }, } = table;
|
2409
2422
|
const { column } = header;
|
@@ -2423,7 +2436,7 @@ const MRT_TableHeadCellColumnActionsButton = (_a) => {
|
|
2423
2436
|
})), rest);
|
2424
2437
|
return (jsxs(Fragment, { children: [jsx(Tooltip, { enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _b !== void 0 ? _b : localization.columnActions, children: jsx(IconButton, Object.assign({ "aria-label": localization.columnActions, onClick: handleClick, size: "small" }, iconButtonProps, { sx: (theme) => (Object.assign({ '&:hover': {
|
2425
2438
|
opacity: 1,
|
2426
|
-
}, height: '2rem', m: '-8px -4px', opacity: 0.3, transition: 'all 150ms', width: '2rem' }, parseFromValuesOrFunc(iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx, theme))), title: undefined, children: jsx(MoreVertIcon, { style: { transform: 'scale(0.9)' } }) })) }), anchorEl && (jsx(MRT_ColumnActionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table }))] }));
|
2439
|
+
}, height: '2rem', m: '-8px -4px', opacity: 0.3, transition: 'all 150ms', width: '2rem' }, parseFromValuesOrFunc(iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx, theme))), title: undefined, children: (_c = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _c !== void 0 ? _c : (jsx(MoreVertIcon, { style: { transform: 'scale(0.9)' } })) })) }), anchorEl && (jsx(MRT_ColumnActionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table }))] }));
|
2427
2440
|
};
|
2428
2441
|
|
2429
2442
|
const MRT_FilterCheckbox = (_a) => {
|
@@ -2456,9 +2469,9 @@ const MRT_FilterCheckbox = (_a) => {
|
|
2456
2469
|
};
|
2457
2470
|
|
2458
2471
|
const MRT_FilterTextField = (_a) => {
|
2459
|
-
var _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
2472
|
+
var _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
2460
2473
|
var { header, rangeFilterIndex, table } = _a, rest = __rest(_a, ["header", "rangeFilterIndex", "table"]);
|
2461
|
-
const { options: { columnFilterModeOptions, enableColumnFilterModes, icons: { CloseIcon, FilterListIcon }, localization, manualFiltering, muiFilterAutocompleteProps, muiFilterDatePickerProps, muiFilterTextFieldProps, }, refs: { filterInputRefs }, setColumnFilterFns, } = table;
|
2474
|
+
const { options: { columnFilterModeOptions, enableColumnFilterModes, icons: { CloseIcon, FilterListIcon }, localization, manualFiltering, muiFilterAutocompleteProps, muiFilterDatePickerProps, muiFilterDateTimePickerProps, muiFilterTextFieldProps, muiFilterTimePickerProps, }, refs: { filterInputRefs }, setColumnFilterFns, } = table;
|
2462
2475
|
const { column } = header;
|
2463
2476
|
const { columnDef } = column;
|
2464
2477
|
const { filterVariant } = columnDef;
|
@@ -2474,7 +2487,15 @@ const MRT_FilterTextField = (_a) => {
|
|
2474
2487
|
column,
|
2475
2488
|
table,
|
2476
2489
|
}));
|
2477
|
-
const
|
2490
|
+
const dateTimePickerProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterDateTimePickerProps, { column, table })), parseFromValuesOrFunc(columnDef.muiFilterDateTimePickerProps, {
|
2491
|
+
column,
|
2492
|
+
table,
|
2493
|
+
}));
|
2494
|
+
const timePickerProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterTimePickerProps, { column, table })), parseFromValuesOrFunc(columnDef.muiFilterTimePickerProps, {
|
2495
|
+
column,
|
2496
|
+
table,
|
2497
|
+
}));
|
2498
|
+
const isDateFilter = (filterVariant === null || filterVariant === void 0 ? void 0 : filterVariant.startsWith('date')) || (filterVariant === null || filterVariant === void 0 ? void 0 : filterVariant.startsWith('time'));
|
2478
2499
|
const isAutocompleteFilter = filterVariant === 'autocomplete';
|
2479
2500
|
const isRangeFilter = (filterVariant === null || filterVariant === void 0 ? void 0 : filterVariant.includes('range')) || rangeFilterIndex !== undefined;
|
2480
2501
|
const isSelectFilter = filterVariant === 'select';
|
@@ -2641,12 +2662,22 @@ const MRT_FilterTextField = (_a) => {
|
|
2641
2662
|
: !filterChipLabel
|
2642
2663
|
? '120px'
|
2643
2664
|
: 'auto', mx: '-2px', p: 0, width: 'calc(100% + 4px)' }, parseFromValuesOrFunc(textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx, theme))) });
|
2644
|
-
|
2645
|
-
|
2646
|
-
|
2647
|
-
|
2648
|
-
|
2649
|
-
|
2665
|
+
const commonDatePickerProps = {
|
2666
|
+
onChange: (newDate) => {
|
2667
|
+
handleChange(newDate);
|
2668
|
+
},
|
2669
|
+
value: filterValue || null,
|
2670
|
+
};
|
2671
|
+
return (jsxs(Fragment, { children: [(filterVariant === null || filterVariant === void 0 ? void 0 : filterVariant.startsWith('time')) ? (jsx(TimePicker, Object.assign({}, commonDatePickerProps, timePickerProps, { slotProps: {
|
2672
|
+
field: Object.assign({ clearable: true, onClear: () => handleClear() }, (_m = timePickerProps === null || timePickerProps === void 0 ? void 0 : timePickerProps.slotProps) === null || _m === void 0 ? void 0 : _m.field),
|
2673
|
+
textField: Object.assign(Object.assign({}, commonTextFieldProps), (_o = timePickerProps === null || timePickerProps === void 0 ? void 0 : timePickerProps.slotProps) === null || _o === void 0 ? void 0 : _o.textField),
|
2674
|
+
} }))) : (filterVariant === null || filterVariant === void 0 ? void 0 : filterVariant.startsWith('datetime')) ? (jsx(DateTimePicker, Object.assign({}, commonDatePickerProps, dateTimePickerProps, { slotProps: {
|
2675
|
+
field: Object.assign({ clearable: true, onClear: () => handleClear() }, (_p = dateTimePickerProps === null || dateTimePickerProps === void 0 ? void 0 : dateTimePickerProps.slotProps) === null || _p === void 0 ? void 0 : _p.field),
|
2676
|
+
textField: Object.assign(Object.assign({}, commonTextFieldProps), (_q = dateTimePickerProps === null || dateTimePickerProps === void 0 ? void 0 : dateTimePickerProps.slotProps) === null || _q === void 0 ? void 0 : _q.textField),
|
2677
|
+
} }))) : (filterVariant === null || filterVariant === void 0 ? void 0 : filterVariant.startsWith('date')) ? (jsx(DatePicker, Object.assign({}, commonDatePickerProps, datePickerProps, { slotProps: {
|
2678
|
+
field: Object.assign({ clearable: true, onClear: () => handleClear() }, (_r = datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.slotProps) === null || _r === void 0 ? void 0 : _r.field),
|
2679
|
+
textField: Object.assign(Object.assign({}, commonTextFieldProps), (_s = datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.slotProps) === null || _s === void 0 ? void 0 : _s.textField),
|
2680
|
+
} }))) : isAutocompleteFilter ? (jsx(Autocomplete, Object.assign({ freeSolo: true, getOptionLabel: (option) => getValueAndLabel(option).label, onChange: (_e, newValue) => handleChange(getValueAndLabel(newValue).value), options: (_t = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map((option) => getValueAndLabel(option))) !== null && _t !== void 0 ? _t : [] }, autocompleteProps, { renderInput: (builtinTextFieldProps) => {
|
2650
2681
|
var _a;
|
2651
2682
|
return (jsx(TextField, 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 })));
|
2652
2683
|
}, value: filterValue }))) : (jsx(TextField, Object.assign({ SelectProps: {
|
@@ -2661,7 +2692,7 @@ const MRT_FilterTextField = (_a) => {
|
|
2661
2692
|
}, onChange: handleTextFieldChange, select: isSelectFilter || isMultiSelectFilter }, commonTextFieldProps, { value: filterValue !== null && filterValue !== void 0 ? filterValue : '', children: (isSelectFilter || isMultiSelectFilter) && [
|
2662
2693
|
jsx(MenuItem, { disabled: true, divider: true, hidden: true, value: "", children: jsx(Box, { sx: { opacity: 0.5 }, children: filterPlaceholder }) }, "p"),
|
2663
2694
|
...[
|
2664
|
-
(
|
2695
|
+
(_u = textFieldProps.children) !== null && _u !== void 0 ? _u : dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map((option, index) => {
|
2665
2696
|
var _a;
|
2666
2697
|
const { label, value } = getValueAndLabel(option);
|
2667
2698
|
return (jsxs(MenuItem, { sx: {
|
@@ -3070,8 +3101,9 @@ const MRT_TableHeadCell = (_a) => {
|
|
3070
3101
|
};
|
3071
3102
|
|
3072
3103
|
const MRT_TableHeadRow = (_a) => {
|
3073
|
-
var { headerGroup, table
|
3104
|
+
var { columnVirtualizer, headerGroup, table } = _a, rest = __rest(_a, ["columnVirtualizer", "headerGroup", "table"]);
|
3074
3105
|
const { options: { layoutMode, muiTableHeadRowProps }, } = table;
|
3106
|
+
const { virtualColumns, virtualPaddingLeft, virtualPaddingRight } = columnVirtualizer !== null && columnVirtualizer !== void 0 ? columnVirtualizer : {};
|
3075
3107
|
const tableRowProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableHeadRowProps, {
|
3076
3108
|
headerGroup,
|
3077
3109
|
table,
|
@@ -3114,6 +3146,8 @@ const MRT_TablePagination = (_a) => {
|
|
3114
3146
|
const firstRowIndex = pageIndex * pageSize;
|
3115
3147
|
const lastRowIndex = Math.min(pageIndex * pageSize + pageSize, totalRowCount);
|
3116
3148
|
const _b = paginationProps !== null && paginationProps !== void 0 ? paginationProps : {}, { SelectProps, disabled = false, rowsPerPageOptions = defaultRowsPerPage, showFirstButton = showFirstLastPageButtons, showLastButton = showFirstLastPageButtons, showRowsPerPage = true } = _b, _rest = __rest(_b, ["SelectProps", "disabled", "rowsPerPageOptions", "showFirstButton", "showLastButton", "showRowsPerPage"]);
|
3149
|
+
const disableBack = pageIndex <= 0 || disabled;
|
3150
|
+
const disableNext = lastRowIndex >= totalRowCount || disabled;
|
3117
3151
|
return (jsxs(Box, { className: "MuiTablePagination-root", sx: {
|
3118
3152
|
alignItems: 'center',
|
3119
3153
|
display: 'flex',
|
@@ -3140,7 +3174,7 @@ const MRT_TablePagination = (_a) => {
|
|
3140
3174
|
last: LastPageIcon,
|
3141
3175
|
next: ChevronRightIcon,
|
3142
3176
|
previous: ChevronLeftIcon,
|
3143
|
-
} }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton }, _rest))) : paginationDisplayMode === 'default' ? (jsxs(Fragment, { children: [jsx(Typography, { 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()}` }), jsxs(Box, { gap: "xs", children: [showFirstButton && (jsx(IconButton, { "aria-label": localization.goToFirstPage, disabled:
|
3177
|
+
} }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton }, _rest))) : paginationDisplayMode === 'default' ? (jsxs(Fragment, { children: [jsx(Typography, { 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()}` }), jsxs(Box, { gap: "xs", children: [showFirstButton && (jsx(Tooltip, { enterDelay: 1000, title: localization.goToFirstPage, children: jsx("span", { children: jsx(IconButton, { "aria-label": localization.goToFirstPage, disabled: disableBack, onClick: () => setPageIndex(0), size: "small", children: jsx(FirstPageIcon, {}) }) }) })), jsx(Tooltip, { enterDelay: 1000, title: localization.goToPreviousPage, children: jsx("span", { children: jsx(IconButton, { "aria-label": localization.goToPreviousPage, disabled: disableBack, onClick: () => setPageIndex(pageIndex - 1), size: "small", children: jsx(ChevronLeftIcon, {}) }) }) }), jsx(Tooltip, { enterDelay: 1000, title: localization.goToNextPage, children: jsx("span", { children: jsx(IconButton, { "aria-label": localization.goToNextPage, disabled: disableNext, onClick: () => setPageIndex(pageIndex + 1), size: "small", children: jsx(ChevronRightIcon, {}) }) }) }), showLastButton && (jsx(Tooltip, { enterDelay: 1000, title: localization.goToLastPage, children: jsx("span", { children: jsx(IconButton, { "aria-label": localization.goToLastPage, disabled: disableNext, onClick: () => setPageIndex(numberOfPages - 1), size: "small", children: jsx(LastPageIcon, {}) }) }) }))] })] })) : null] }));
|
3144
3178
|
};
|
3145
3179
|
|
3146
3180
|
const MRT_GlobalFilterTextField = (_a) => {
|
@@ -3512,7 +3546,7 @@ const MRT_TopToolbar = ({ table, }) => {
|
|
3512
3546
|
};
|
3513
3547
|
|
3514
3548
|
const MRT_TableHead = (_a) => {
|
3515
|
-
var {
|
3549
|
+
var { columnVirtualizer, table } = _a, rest = __rest(_a, ["columnVirtualizer", "table"]);
|
3516
3550
|
const { getHeaderGroups, getSelectedRowModel, getState, options: { enableStickyHeader, layoutMode, muiTableHeadProps, positionToolbarAlertBanner, }, refs: { tableHeadRef }, } = table;
|
3517
3551
|
const { isFullScreen, showAlertBanner } = getState();
|
3518
3552
|
const tableHeadProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableHeadProps, { table })), rest);
|
@@ -3529,7 +3563,7 @@ const MRT_TableHead = (_a) => {
|
|
3529
3563
|
}, children: jsx("th", { colSpan: table.getVisibleLeafColumns().length, style: {
|
3530
3564
|
display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined,
|
3531
3565
|
padding: 0,
|
3532
|
-
}, children: jsx(MRT_ToolbarAlertBanner, { table: table }) }) })) : (getHeaderGroups().map((headerGroup) => (jsx(MRT_TableHeadRow, { headerGroup: headerGroup, table: table
|
3566
|
+
}, children: jsx(MRT_ToolbarAlertBanner, { table: table }) }) })) : (getHeaderGroups().map((headerGroup) => (jsx(MRT_TableHeadRow, { columnVirtualizer: columnVirtualizer, headerGroup: headerGroup, table: table }, headerGroup.id)))) })));
|
3533
3567
|
};
|
3534
3568
|
|
3535
3569
|
const MRT_Table = (_a) => {
|
@@ -3552,18 +3586,11 @@ const MRT_Table = (_a) => {
|
|
3552
3586
|
return colSizes;
|
3553
3587
|
}, [columns, columnSizing, columnSizingInfo, columnVisibility]);
|
3554
3588
|
const columnVirtualizer = useMRT_ColumnVirtualizer(table);
|
3555
|
-
const { virtualPaddingLeft, virtualPaddingRight } = columnVirtualizer !== null && columnVirtualizer !== void 0 ? columnVirtualizer : {};
|
3556
|
-
const virtualColumns = columnVirtualizer
|
3557
|
-
? columnVirtualizer.getVirtualItems()
|
3558
|
-
: undefined;
|
3559
3589
|
const commonTableGroupProps = {
|
3590
|
+
columnVirtualizer,
|
3560
3591
|
table,
|
3561
|
-
virtualColumns,
|
3562
|
-
virtualPaddingLeft,
|
3563
|
-
virtualPaddingRight,
|
3564
3592
|
};
|
3565
|
-
|
3566
|
-
return (jsxs(Table, Object.assign({ stickyHeader: enableStickyHeader || isFullScreen }, tableProps, { style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style), sx: (theme) => (Object.assign({ borderCollapse: 'separate', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined }, parseFromValuesOrFunc(tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx, theme))), children: [enableTableHead && jsx(MRT_TableHead, Object.assign({}, commonTableGroupProps)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsx(Memo_MRT_TableBody, Object.assign({}, commonTableBodyProps))) : (jsx(MRT_TableBody, Object.assign({}, commonTableBodyProps))), enableTableFooter && jsx(MRT_TableFooter, Object.assign({}, commonTableGroupProps))] })));
|
3593
|
+
return (jsxs(Table, Object.assign({ stickyHeader: enableStickyHeader || isFullScreen }, tableProps, { style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style), sx: (theme) => (Object.assign({ borderCollapse: 'separate', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined }, parseFromValuesOrFunc(tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx, theme))), children: [enableTableHead && jsx(MRT_TableHead, Object.assign({}, commonTableGroupProps)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsx(Memo_MRT_TableBody, Object.assign({}, commonTableGroupProps))) : (jsx(MRT_TableBody, Object.assign({}, commonTableGroupProps))), enableTableFooter && jsx(MRT_TableFooter, Object.assign({}, commonTableGroupProps))] })));
|
3567
3594
|
};
|
3568
3595
|
|
3569
3596
|
const MRT_TableLoadingOverlay = (_a) => {
|