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.js
CHANGED
@@ -71,6 +71,8 @@ var Chip = require('@mui/material/Chip');
|
|
71
71
|
var InputAdornment = require('@mui/material/InputAdornment');
|
72
72
|
var utils = require('@mui/material/utils');
|
73
73
|
var DatePicker = require('@mui/x-date-pickers/DatePicker');
|
74
|
+
var DateTimePicker = require('@mui/x-date-pickers/DateTimePicker');
|
75
|
+
var TimePicker = require('@mui/x-date-pickers/TimePicker');
|
74
76
|
var FormHelperText = require('@mui/material/FormHelperText');
|
75
77
|
var Slider = require('@mui/material/Slider');
|
76
78
|
var Stack = require('@mui/material/Stack');
|
@@ -384,6 +386,8 @@ const createRow = (table, originalRow) => reactTable.createRow(table, 'mrt-row-c
|
|
384
386
|
}))), -1, 0);
|
385
387
|
const extraIndexRangeExtractor = (range, draggingIndex) => {
|
386
388
|
const newIndexes = reactVirtual.defaultRangeExtractor(range);
|
389
|
+
if (draggingIndex === undefined)
|
390
|
+
return newIndexes;
|
387
391
|
if (draggingIndex >= 0 &&
|
388
392
|
draggingIndex < Math.max(range.startIndex - range.overscan, 0)) {
|
389
393
|
newIndexes.unshift(draggingIndex);
|
@@ -428,7 +432,7 @@ const getMRTTheme = (table, theme) => (Object.assign({ baseBackgroundColor: them
|
|
428
432
|
? styles.darken(theme.palette.warning.dark, 0.25)
|
429
433
|
: 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)));
|
430
434
|
const getCommonMRTCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
|
431
|
-
var _a, _b, _c, _d, _e, _f
|
435
|
+
var _a, _b, _c, _d, _e, _f;
|
432
436
|
const { options: { layoutMode }, } = table;
|
433
437
|
const widthStyles = {
|
434
438
|
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)`,
|
@@ -448,19 +452,8 @@ const getCommonMRTCellStyles = ({ column, header, table, tableCellProps, theme,
|
|
448
452
|
? `4px 0 8px -6px ${styles.alpha(theme.palette.grey[700], 0.5)} inset`
|
449
453
|
: undefined, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, left: column.getIsPinned() === 'left'
|
450
454
|
? `${column.getStart('left')}px`
|
451
|
-
: undefined,
|
452
|
-
|
453
|
-
column.getPinnedIndex() === 0
|
454
|
-
? `-${column.getSize() *
|
455
|
-
((_f = (_e = table.getState().columnPinning.left) === null || _e === void 0 ? void 0 : _e.length) !== null && _f !== void 0 ? _f : 1)}px`
|
456
|
-
: undefined, mr: table.options.enableColumnVirtualization &&
|
457
|
-
column.getIsPinned() === 'right' &&
|
458
|
-
column.getPinnedIndex() === table.getVisibleLeafColumns().length - 1
|
459
|
-
? `-${column.getSize() *
|
460
|
-
((_h = (_g = table.getState().columnPinning.right) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 1) *
|
461
|
-
1.2}px`
|
462
|
-
: undefined, opacity: ((_j = table.getState().draggingColumn) === null || _j === void 0 ? void 0 : _j.id) === column.id ||
|
463
|
-
((_k = table.getState().hoveredColumn) === null || _k === void 0 ? void 0 : _k.id) === column.id
|
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
|
464
457
|
? 0.5
|
465
458
|
: 1, position: column.getIsPinned() && column.columnDef.columnDefType !== 'group'
|
466
459
|
? 'sticky'
|
@@ -891,11 +884,12 @@ const MRT_TableDetailPanel = (_a) => {
|
|
891
884
|
: 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 }) })) })) })));
|
892
885
|
};
|
893
886
|
|
894
|
-
const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRowIds, row, rowIndex, table,
|
887
|
+
const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRowIds, row, rowIndex, table, virtualRow, }) => {
|
895
888
|
var _a, _b, _c, _d;
|
896
889
|
const theme = styles.useTheme();
|
897
890
|
const { getState, options: { enableRowOrdering, enableRowPinning, enableStickyFooter, enableStickyHeader, layoutMode, memoMode, muiTableBodyRowProps, renderDetailPanel, rowPinningDisplayMode, }, refs: { tableFooterRef, tableHeadRef }, setHoveredRow, } = table;
|
898
891
|
const { density, draggingColumn, draggingRow, editingCell, editingRow, hoveredRow, isFullScreen, rowPinning, } = getState();
|
892
|
+
const { virtualColumns, virtualPaddingLeft, virtualPaddingRight } = columnVirtualizer !== null && columnVirtualizer !== void 0 ? columnVirtualizer : {};
|
899
893
|
const isPinned = enableRowPinning && row.getIsPinned();
|
900
894
|
const tableRowProps = parseFromValuesOrFunc(muiTableBodyRowProps, {
|
901
895
|
row,
|
@@ -995,7 +989,7 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRo
|
|
995
989
|
const Memo_MRT_TableBodyRow = react.memo(MRT_TableBodyRow, (prev, next) => prev.row === next.row && prev.rowIndex === next.rowIndex);
|
996
990
|
|
997
991
|
const useMRT_ColumnVirtualizer = (table) => {
|
998
|
-
var _a, _b, _c, _d;
|
992
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
999
993
|
const { getState, options: { columnVirtualizerInstanceRef, columnVirtualizerOptions, enableColumnPinning, enableColumnVirtualization, }, refs: { tableContainerRef }, } = table;
|
1000
994
|
const { columnPinning, columnVisibility, draggingColumn } = getState();
|
1001
995
|
const columnVirtualizerProps = parseFromValuesOrFunc(columnVirtualizerOptions, {
|
@@ -1006,22 +1000,26 @@ const useMRT_ColumnVirtualizer = (table) => {
|
|
1006
1000
|
table.getLeftLeafColumns().map((c) => c.getPinnedIndex()),
|
1007
1001
|
table
|
1008
1002
|
.getRightLeafColumns()
|
1009
|
-
.map((c) => table.getVisibleLeafColumns().length - c.getPinnedIndex() - 1)
|
1003
|
+
.map((c) => table.getVisibleLeafColumns().length - c.getPinnedIndex() - 1)
|
1004
|
+
.sort((a, b) => a - b),
|
1010
1005
|
]
|
1011
1006
|
: [[], []], [columnPinning, enableColumnVirtualization, enableColumnPinning]);
|
1012
1007
|
//get first 16 column widths and average them if calc is needed
|
1013
1008
|
const averageColumnWidth = react.useMemo(() => {
|
1014
1009
|
var _a, _b, _c, _d;
|
1015
|
-
if (!enableColumnVirtualization || (columnVirtualizerProps === null || columnVirtualizerProps === void 0 ? void 0 : columnVirtualizerProps.estimateSize))
|
1010
|
+
if (!enableColumnVirtualization || (columnVirtualizerProps === null || columnVirtualizerProps === void 0 ? void 0 : columnVirtualizerProps.estimateSize)) {
|
1016
1011
|
return 0;
|
1012
|
+
}
|
1017
1013
|
const columnsWidths = (_d = (_c = (_b = (_a = table
|
1018
1014
|
.getRowModel()
|
1019
1015
|
.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 : [];
|
1020
1016
|
return columnsWidths.reduce((a, b) => a + b, 0) / columnsWidths.length;
|
1021
1017
|
}, [table.getRowModel().rows, columnPinning, columnVisibility]);
|
1022
|
-
const draggingColumnIndex =
|
1023
|
-
|
1024
|
-
|
1018
|
+
const draggingColumnIndex = (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id)
|
1019
|
+
? table
|
1020
|
+
.getVisibleLeafColumns()
|
1021
|
+
.findIndex((c) => c.id === (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id))
|
1022
|
+
: undefined;
|
1025
1023
|
const columnVirtualizer = enableColumnVirtualization
|
1026
1024
|
? reactVirtual.useVirtualizer(Object.assign({ count: table.getVisibleLeafColumns().length, estimateSize: () => averageColumnWidth, getScrollElement: () => tableContainerRef.current, horizontal: true, overscan: 3, rangeExtractor: react.useCallback((range) => {
|
1027
1025
|
const newIndexes = extraIndexRangeExtractor(range, draggingColumnIndex);
|
@@ -1034,21 +1032,25 @@ const useMRT_ColumnVirtualizer = (table) => {
|
|
1034
1032
|
];
|
1035
1033
|
}, [leftPinnedIndexes, rightPinnedIndexes, draggingColumnIndex]) }, columnVirtualizerProps))
|
1036
1034
|
: undefined;
|
1037
|
-
if (
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1035
|
+
if (columnVirtualizer) {
|
1036
|
+
const virtualColumns = columnVirtualizer.getVirtualItems();
|
1037
|
+
columnVirtualizer.virtualColumns = virtualColumns;
|
1038
|
+
if (virtualColumns.length) {
|
1039
|
+
columnVirtualizer.virtualPaddingLeft =
|
1040
|
+
((_b = (_a = virtualColumns[leftPinnedIndexes.length]) === null || _a === void 0 ? void 0 : _a.start) !== null && _b !== void 0 ? _b : 0) -
|
1041
|
+
((_d = (_c = virtualColumns[leftPinnedIndexes.length - 1]) === null || _c === void 0 ? void 0 : _c.end) !== null && _d !== void 0 ? _d : 0);
|
1042
|
+
columnVirtualizer.virtualPaddingRight =
|
1043
|
+
columnVirtualizer.getTotalSize() -
|
1044
|
+
((_f = (_e = virtualColumns[virtualColumns.length - rightPinnedIndexes.length - 1]) === null || _e === void 0 ? void 0 : _e.end) !== null && _f !== void 0 ? _f : 0) -
|
1045
|
+
(rightPinnedIndexes.length
|
1046
|
+
? columnVirtualizer.getTotalSize() -
|
1047
|
+
((_h = (_g = virtualColumns[virtualColumns.length - rightPinnedIndexes.length]) === null || _g === void 0 ? void 0 : _g.start) !== null && _h !== void 0 ? _h : 0)
|
1048
|
+
: 0);
|
1049
|
+
}
|
1050
|
+
if (columnVirtualizerInstanceRef) {
|
1051
|
+
//@ts-ignore
|
1052
|
+
columnVirtualizerInstanceRef.current = columnVirtualizer;
|
1053
|
+
}
|
1052
1054
|
}
|
1053
1055
|
return columnVirtualizer;
|
1054
1056
|
};
|
@@ -1171,7 +1173,8 @@ const MRT_EditActionButtons = (_a) => {
|
|
1171
1173
|
});
|
1172
1174
|
}
|
1173
1175
|
};
|
1174
|
-
return (jsxRuntime.jsx(Box__default["default"], { 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' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], { title: localization.cancel, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.cancel, onClick: handleCancel, children: jsxRuntime.jsx(CancelIcon, {}) }) }),
|
1176
|
+
return (jsxRuntime.jsx(Box__default["default"], { 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' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], { title: localization.cancel, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.cancel, onClick: handleCancel, children: jsxRuntime.jsx(CancelIcon, {}) }) }), ((isCreating && onCreatingRowSave) ||
|
1177
|
+
(isEditing && onEditingRowSave)) && (jsxRuntime.jsx(Tooltip__default["default"], { title: localization.save, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.save, color: "info", onClick: handleSubmitRow, children: isSaving ? jsxRuntime.jsx(CircularProgress__default["default"], { size: 18 }) : jsxRuntime.jsx(SaveIcon, {}) }) }))] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Button__default["default"], { onClick: handleCancel, sx: { minWidth: '100px' }, children: localization.cancel }), jsxRuntime.jsxs(Button__default["default"], { onClick: handleSubmitRow, sx: { minWidth: '100px' }, variant: "contained", children: [isSaving && jsxRuntime.jsx(CircularProgress__default["default"], { color: "inherit", size: 18 }), localization.save] })] })) }));
|
1175
1178
|
};
|
1176
1179
|
|
1177
1180
|
const mrtFilterOptions = (localization) => [
|
@@ -1263,7 +1266,7 @@ const mrtFilterOptions = (localization) => [
|
|
1263
1266
|
const rangeModes = ['between', 'betweenInclusive', 'inNumberRange'];
|
1264
1267
|
const emptyModes = ['empty', 'notEmpty'];
|
1265
1268
|
const arrModes = ['arrIncludesSome', 'arrIncludesAll', 'arrIncludes'];
|
1266
|
-
const rangeVariants = ['range-slider', 'date-range', 'range'];
|
1269
|
+
const rangeVariants = ['range-slider', 'date-range', 'datetime-range', 'range'];
|
1267
1270
|
const MRT_FilterOptionMenu = (_a) => {
|
1268
1271
|
var _b, _c, _d, _e;
|
1269
1272
|
var { anchorEl, header, onSelect, setAnchorEl, setFilterValue, table } = _a, rest = __rest(_a, ["anchorEl", "header", "onSelect", "setAnchorEl", "setFilterValue", "table"]);
|
@@ -1386,7 +1389,7 @@ const commonListItemStyles = {
|
|
1386
1389
|
const MRT_ColumnActionMenu = (_a) => {
|
1387
1390
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
1388
1391
|
var { anchorEl, header, setAnchorEl, table } = _a, rest = __rest(_a, ["anchorEl", "header", "setAnchorEl", "table"]);
|
1389
|
-
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;
|
1392
|
+
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;
|
1390
1393
|
const { column } = header;
|
1391
1394
|
const { columnDef } = column;
|
1392
1395
|
const { columnSizing, columnVisibility, density, showColumnFilters } = getState();
|
@@ -1423,8 +1426,14 @@ const MRT_ColumnActionMenu = (_a) => {
|
|
1423
1426
|
setAnchorEl(null);
|
1424
1427
|
};
|
1425
1428
|
const handleClearFilter = () => {
|
1426
|
-
column.setFilterValue(
|
1429
|
+
column.setFilterValue(undefined);
|
1427
1430
|
setAnchorEl(null);
|
1431
|
+
if (['empty', 'notEmpty'].includes(columnDef._filterFn)) {
|
1432
|
+
setColumnFilterFns((prev) => {
|
1433
|
+
var _a;
|
1434
|
+
return (Object.assign(Object.assign({}, prev), { [header.id]: (_a = allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions[0]) !== null && _a !== void 0 ? _a : 'fuzzy' }));
|
1435
|
+
});
|
1436
|
+
}
|
1428
1437
|
};
|
1429
1438
|
const handleFilterByColumn = () => {
|
1430
1439
|
setShowColumnFilters(true);
|
@@ -1779,14 +1788,15 @@ const useMRT_Effects = (table) => {
|
|
1779
1788
|
}, [density]);
|
1780
1789
|
};
|
1781
1790
|
|
1782
|
-
const useMRT_RowVirtualizer = (table) => {
|
1791
|
+
const useMRT_RowVirtualizer = (table, rows) => {
|
1792
|
+
var _a;
|
1783
1793
|
const { getRowModel, getState, options: { enableRowVirtualization, rowVirtualizerInstanceRef, rowVirtualizerOptions, }, refs: { tableContainerRef }, } = table;
|
1784
1794
|
const { density, draggingRow } = getState();
|
1785
1795
|
const rowVirtualizerProps = parseFromValuesOrFunc(rowVirtualizerOptions, {
|
1786
1796
|
table,
|
1787
1797
|
});
|
1788
1798
|
const rowVirtualizer = enableRowVirtualization
|
1789
|
-
? reactVirtual.useVirtualizer(Object.assign({ count: getRowModel().rows.length, estimateSize: () => density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73, getScrollElement: () => tableContainerRef.current, measureElement: typeof window !== 'undefined' &&
|
1799
|
+
? 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' &&
|
1790
1800
|
navigator.userAgent.indexOf('Firefox') === -1
|
1791
1801
|
? (element) => element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height
|
1792
1802
|
: undefined, overscan: 4, rangeExtractor: react.useCallback((range) => {
|
@@ -1794,9 +1804,13 @@ const useMRT_RowVirtualizer = (table) => {
|
|
1794
1804
|
return extraIndexRangeExtractor(range, (_a = draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.index) !== null && _a !== void 0 ? _a : 0);
|
1795
1805
|
}, [draggingRow]) }, rowVirtualizerProps))
|
1796
1806
|
: undefined;
|
1797
|
-
if (
|
1798
|
-
|
1799
|
-
|
1807
|
+
if (rowVirtualizer) {
|
1808
|
+
const virtualRows = rowVirtualizer.getVirtualItems();
|
1809
|
+
rowVirtualizer.virtualRows = virtualRows;
|
1810
|
+
if (rowVirtualizerInstanceRef) {
|
1811
|
+
//@ts-ignore
|
1812
|
+
rowVirtualizerInstanceRef.current = rowVirtualizer;
|
1813
|
+
}
|
1800
1814
|
}
|
1801
1815
|
return rowVirtualizer;
|
1802
1816
|
};
|
@@ -1815,7 +1829,7 @@ const MRT_SortingFns = Object.assign(Object.assign({}, reactTable.sortingFns), {
|
|
1815
1829
|
const rankGlobalFuzzy = (rowA, rowB) => Math.max(...Object.values(rowB.columnFiltersMeta).map((v) => v.rank)) -
|
1816
1830
|
Math.max(...Object.values(rowA.columnFiltersMeta).map((v) => v.rank));
|
1817
1831
|
|
1818
|
-
const useMRT_Rows = (table) => {
|
1832
|
+
const useMRT_Rows = (table, pinnedRowIds = []) => {
|
1819
1833
|
const { getBottomRows, getCenterRows, getPrePaginationRowModel, getRowModel, getState, getTopRows, options: { enableGlobalFilterRankedResults, enablePagination, enableRowPinning, manualExpanding, manualFiltering, manualGrouping, manualPagination, manualSorting, rowPinningDisplayMode, }, } = table;
|
1820
1834
|
const { expanded, globalFilter, pagination, rowPinning, sorting } = getState();
|
1821
1835
|
const shouldRankRows = react.useMemo(() => getCanRankRows(table) &&
|
@@ -1830,9 +1844,6 @@ const useMRT_Rows = (table) => {
|
|
1830
1844
|
manualSorting,
|
1831
1845
|
sorting,
|
1832
1846
|
]);
|
1833
|
-
const pinnedRowIds = react.useMemo(() => getRowModel()
|
1834
|
-
.rows.filter((row) => row.getIsPinned())
|
1835
|
-
.map((r) => r.id), [rowPinning, table.getRowModel().rows]);
|
1836
1847
|
const rows = react.useMemo(() => {
|
1837
1848
|
let rows = [];
|
1838
1849
|
if (!shouldRankRows) {
|
@@ -2358,7 +2369,7 @@ const useMRT_TableOptions = (_a) => {
|
|
2358
2369
|
|
2359
2370
|
const MRT_TableBody = (_a) => {
|
2360
2371
|
var _b, _c, _d, _e, _f, _g;
|
2361
|
-
var { columnVirtualizer, table
|
2372
|
+
var { columnVirtualizer, table } = _a, rest = __rest(_a, ["columnVirtualizer", "table"]);
|
2362
2373
|
const { getBottomRows, getIsSomeRowsPinned, getRowModel, getState, getTopRows, options: { createDisplayMode, enableStickyFooter, enableStickyHeader, layoutMode, localization, memoMode, muiTableBodyProps, renderEmptyRowsFallback, rowPinningDisplayMode, }, refs: { tableFooterRef, tableHeadRef, tablePaperRef }, } = table;
|
2363
2374
|
const { columnFilters, creatingRow, globalFilter, isFullScreen, rowPinning } = getState();
|
2364
2375
|
const tableBodyProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableBodyProps, { table })), rest);
|
@@ -2366,21 +2377,21 @@ const MRT_TableBody = (_a) => {
|
|
2366
2377
|
((_b = tableHeadRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight)) ||
|
2367
2378
|
0;
|
2368
2379
|
const tableFooterHeight = (enableStickyFooter && ((_c = tableFooterRef.current) === null || _c === void 0 ? void 0 : _c.clientHeight)) || 0;
|
2369
|
-
const pinnedRowIds = react.useMemo(() =>
|
2370
|
-
|
2371
|
-
|
2372
|
-
|
2373
|
-
|
2374
|
-
|
2375
|
-
|
2376
|
-
|
2380
|
+
const pinnedRowIds = react.useMemo(() => {
|
2381
|
+
var _a, _b;
|
2382
|
+
if (!((_a = rowPinning.bottom) === null || _a === void 0 ? void 0 : _a.length) && !((_b = rowPinning.top) === null || _b === void 0 ? void 0 : _b.length))
|
2383
|
+
return [];
|
2384
|
+
return getRowModel()
|
2385
|
+
.rows.filter((row) => row.getIsPinned())
|
2386
|
+
.map((r) => r.id);
|
2387
|
+
}, [rowPinning, getRowModel().rows]);
|
2388
|
+
const rows = useMRT_Rows(table, pinnedRowIds);
|
2389
|
+
const rowVirtualizer = useMRT_RowVirtualizer(table, rows);
|
2390
|
+
const { virtualRows } = rowVirtualizer !== null && rowVirtualizer !== void 0 ? rowVirtualizer : {};
|
2377
2391
|
const commonRowProps = {
|
2378
2392
|
columnVirtualizer,
|
2379
2393
|
numRows: rows.length,
|
2380
2394
|
table,
|
2381
|
-
virtualColumns,
|
2382
|
-
virtualPaddingLeft,
|
2383
|
-
virtualPaddingRight,
|
2384
2395
|
};
|
2385
2396
|
const CreatingRow = creatingRow && createDisplayMode === 'row' && (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, commonRowProps, { row: creatingRow, rowIndex: -1 })));
|
2386
2397
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
|
@@ -2411,12 +2422,13 @@ const MRT_TableBody = (_a) => {
|
|
2411
2422
|
row, rowIndex: rowVirtualizer ? rowOrVirtualRow.index : rowIndex, virtualRow: rowVirtualizer
|
2412
2423
|
? rowOrVirtualRow
|
2413
2424
|
: undefined });
|
2414
|
-
|
2425
|
+
const key = `${row.id}-${row.index}`;
|
2426
|
+
return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), key)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), key));
|
2415
2427
|
}) })))] })), !(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
|
2416
2428
|
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) => {
|
2417
2429
|
const props = Object.assign(Object.assign({}, commonRowProps), { row,
|
2418
2430
|
rowIndex });
|
2419
|
-
return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props),
|
2431
|
+
return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
|
2420
2432
|
}) })))] }));
|
2421
2433
|
};
|
2422
2434
|
const Memo_MRT_TableBody = react.memo(MRT_TableBody, (prev, next) => prev.table.options.data === next.table.options.data);
|
@@ -2451,8 +2463,9 @@ const MRT_TableFooterCell = (_a) => {
|
|
2451
2463
|
|
2452
2464
|
const MRT_TableFooterRow = (_a) => {
|
2453
2465
|
var _b;
|
2454
|
-
var { footerGroup, table
|
2466
|
+
var { columnVirtualizer, footerGroup, table } = _a, rest = __rest(_a, ["columnVirtualizer", "footerGroup", "table"]);
|
2455
2467
|
const { options: { layoutMode, muiTableFooterRowProps }, } = table;
|
2468
|
+
const { virtualColumns, virtualPaddingLeft, virtualPaddingRight } = columnVirtualizer !== null && columnVirtualizer !== void 0 ? columnVirtualizer : {};
|
2456
2469
|
// if no content in row, skip row
|
2457
2470
|
if (!((_b = footerGroup.headers) === null || _b === void 0 ? void 0 : _b.some((header) => (typeof header.column.columnDef.footer === 'string' &&
|
2458
2471
|
!!header.column.columnDef.footer) ||
|
@@ -2471,7 +2484,7 @@ const MRT_TableFooterRow = (_a) => {
|
|
2471
2484
|
};
|
2472
2485
|
|
2473
2486
|
const MRT_TableFooter = (_a) => {
|
2474
|
-
var {
|
2487
|
+
var { columnVirtualizer, table } = _a, rest = __rest(_a, ["columnVirtualizer", "table"]);
|
2475
2488
|
const { getFooterGroups, getState, options: { enableStickyFooter, layoutMode, muiTableFooterProps }, refs: { tableFooterRef }, } = table;
|
2476
2489
|
const { isFullScreen } = getState();
|
2477
2490
|
const tableFooterProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterProps, {
|
@@ -2488,11 +2501,11 @@ const MRT_TableFooter = (_a) => {
|
|
2488
2501
|
? theme.palette.mode === 'light'
|
2489
2502
|
? `1px solid ${theme.palette.grey[300]}`
|
2490
2503
|
: `1px solid ${theme.palette.grey[700]}`
|
2491
|
-
: undefined, position: stickFooter ? 'sticky' : undefined, zIndex: stickFooter ? 1 : undefined }, parseFromValuesOrFunc(tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx, theme))), children: getFooterGroups().map((footerGroup) => (jsxRuntime.jsx(MRT_TableFooterRow, { footerGroup: footerGroup, table: table
|
2504
|
+
: undefined, position: stickFooter ? 'sticky' : undefined, zIndex: stickFooter ? 1 : undefined }, parseFromValuesOrFunc(tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx, theme))), children: getFooterGroups().map((footerGroup) => (jsxRuntime.jsx(MRT_TableFooterRow, { columnVirtualizer: columnVirtualizer, footerGroup: footerGroup, table: table }, footerGroup.id))) })));
|
2492
2505
|
};
|
2493
2506
|
|
2494
2507
|
const MRT_TableHeadCellColumnActionsButton = (_a) => {
|
2495
|
-
var _b;
|
2508
|
+
var _b, _c;
|
2496
2509
|
var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
|
2497
2510
|
const { options: { icons: { MoreVertIcon }, localization, muiColumnActionsButtonProps, }, } = table;
|
2498
2511
|
const { column } = header;
|
@@ -2512,7 +2525,7 @@ const MRT_TableHeadCellColumnActionsButton = (_a) => {
|
|
2512
2525
|
})), rest);
|
2513
2526
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], { 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: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.columnActions, onClick: handleClick, size: "small" }, iconButtonProps, { sx: (theme) => (Object.assign({ '&:hover': {
|
2514
2527
|
opacity: 1,
|
2515
|
-
}, 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: jsxRuntime.jsx(MoreVertIcon, { style: { transform: 'scale(0.9)' } }) })) }), anchorEl && (jsxRuntime.jsx(MRT_ColumnActionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table }))] }));
|
2528
|
+
}, 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 : (jsxRuntime.jsx(MoreVertIcon, { style: { transform: 'scale(0.9)' } })) })) }), anchorEl && (jsxRuntime.jsx(MRT_ColumnActionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table }))] }));
|
2516
2529
|
};
|
2517
2530
|
|
2518
2531
|
const MRT_FilterCheckbox = (_a) => {
|
@@ -2545,9 +2558,9 @@ const MRT_FilterCheckbox = (_a) => {
|
|
2545
2558
|
};
|
2546
2559
|
|
2547
2560
|
const MRT_FilterTextField = (_a) => {
|
2548
|
-
var _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
2561
|
+
var _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
2549
2562
|
var { header, rangeFilterIndex, table } = _a, rest = __rest(_a, ["header", "rangeFilterIndex", "table"]);
|
2550
|
-
const { options: { columnFilterModeOptions, enableColumnFilterModes, icons: { CloseIcon, FilterListIcon }, localization, manualFiltering, muiFilterAutocompleteProps, muiFilterDatePickerProps, muiFilterTextFieldProps, }, refs: { filterInputRefs }, setColumnFilterFns, } = table;
|
2563
|
+
const { options: { columnFilterModeOptions, enableColumnFilterModes, icons: { CloseIcon, FilterListIcon }, localization, manualFiltering, muiFilterAutocompleteProps, muiFilterDatePickerProps, muiFilterDateTimePickerProps, muiFilterTextFieldProps, muiFilterTimePickerProps, }, refs: { filterInputRefs }, setColumnFilterFns, } = table;
|
2551
2564
|
const { column } = header;
|
2552
2565
|
const { columnDef } = column;
|
2553
2566
|
const { filterVariant } = columnDef;
|
@@ -2563,7 +2576,15 @@ const MRT_FilterTextField = (_a) => {
|
|
2563
2576
|
column,
|
2564
2577
|
table,
|
2565
2578
|
}));
|
2566
|
-
const
|
2579
|
+
const dateTimePickerProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterDateTimePickerProps, { column, table })), parseFromValuesOrFunc(columnDef.muiFilterDateTimePickerProps, {
|
2580
|
+
column,
|
2581
|
+
table,
|
2582
|
+
}));
|
2583
|
+
const timePickerProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterTimePickerProps, { column, table })), parseFromValuesOrFunc(columnDef.muiFilterTimePickerProps, {
|
2584
|
+
column,
|
2585
|
+
table,
|
2586
|
+
}));
|
2587
|
+
const isDateFilter = (filterVariant === null || filterVariant === void 0 ? void 0 : filterVariant.startsWith('date')) || (filterVariant === null || filterVariant === void 0 ? void 0 : filterVariant.startsWith('time'));
|
2567
2588
|
const isAutocompleteFilter = filterVariant === 'autocomplete';
|
2568
2589
|
const isRangeFilter = (filterVariant === null || filterVariant === void 0 ? void 0 : filterVariant.includes('range')) || rangeFilterIndex !== undefined;
|
2569
2590
|
const isSelectFilter = filterVariant === 'select';
|
@@ -2730,12 +2751,22 @@ const MRT_FilterTextField = (_a) => {
|
|
2730
2751
|
: !filterChipLabel
|
2731
2752
|
? '120px'
|
2732
2753
|
: 'auto', mx: '-2px', p: 0, width: 'calc(100% + 4px)' }, parseFromValuesOrFunc(textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx, theme))) });
|
2733
|
-
|
2734
|
-
|
2735
|
-
|
2736
|
-
|
2737
|
-
|
2738
|
-
|
2754
|
+
const commonDatePickerProps = {
|
2755
|
+
onChange: (newDate) => {
|
2756
|
+
handleChange(newDate);
|
2757
|
+
},
|
2758
|
+
value: filterValue || null,
|
2759
|
+
};
|
2760
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [(filterVariant === null || filterVariant === void 0 ? void 0 : filterVariant.startsWith('time')) ? (jsxRuntime.jsx(TimePicker.TimePicker, Object.assign({}, commonDatePickerProps, timePickerProps, { slotProps: {
|
2761
|
+
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),
|
2762
|
+
textField: Object.assign(Object.assign({}, commonTextFieldProps), (_o = timePickerProps === null || timePickerProps === void 0 ? void 0 : timePickerProps.slotProps) === null || _o === void 0 ? void 0 : _o.textField),
|
2763
|
+
} }))) : (filterVariant === null || filterVariant === void 0 ? void 0 : filterVariant.startsWith('datetime')) ? (jsxRuntime.jsx(DateTimePicker.DateTimePicker, Object.assign({}, commonDatePickerProps, dateTimePickerProps, { slotProps: {
|
2764
|
+
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),
|
2765
|
+
textField: Object.assign(Object.assign({}, commonTextFieldProps), (_q = dateTimePickerProps === null || dateTimePickerProps === void 0 ? void 0 : dateTimePickerProps.slotProps) === null || _q === void 0 ? void 0 : _q.textField),
|
2766
|
+
} }))) : (filterVariant === null || filterVariant === void 0 ? void 0 : filterVariant.startsWith('date')) ? (jsxRuntime.jsx(DatePicker.DatePicker, Object.assign({}, commonDatePickerProps, datePickerProps, { slotProps: {
|
2767
|
+
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),
|
2768
|
+
textField: Object.assign(Object.assign({}, commonTextFieldProps), (_s = datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.slotProps) === null || _s === void 0 ? void 0 : _s.textField),
|
2769
|
+
} }))) : isAutocompleteFilter ? (jsxRuntime.jsx(Autocomplete__default["default"], 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) => {
|
2739
2770
|
var _a;
|
2740
2771
|
return (jsxRuntime.jsx(TextField__default["default"], Object.assign({}, builtinTextFieldProps, commonTextFieldProps, { InputProps: Object.assign(Object.assign({}, builtinTextFieldProps.InputProps), { startAdornment: (_a = commonTextFieldProps === null || commonTextFieldProps === void 0 ? void 0 : commonTextFieldProps.InputProps) === null || _a === void 0 ? void 0 : _a.startAdornment }), inputProps: Object.assign(Object.assign({}, builtinTextFieldProps.inputProps), commonTextFieldProps === null || commonTextFieldProps === void 0 ? void 0 : commonTextFieldProps.inputProps), onChange: handleTextFieldChange })));
|
2741
2772
|
}, value: filterValue }))) : (jsxRuntime.jsx(TextField__default["default"], Object.assign({ SelectProps: {
|
@@ -2750,7 +2781,7 @@ const MRT_FilterTextField = (_a) => {
|
|
2750
2781
|
}, onChange: handleTextFieldChange, select: isSelectFilter || isMultiSelectFilter }, commonTextFieldProps, { value: filterValue !== null && filterValue !== void 0 ? filterValue : '', children: (isSelectFilter || isMultiSelectFilter) && [
|
2751
2782
|
jsxRuntime.jsx(MenuItem__default["default"], { disabled: true, divider: true, hidden: true, value: "", children: jsxRuntime.jsx(Box__default["default"], { sx: { opacity: 0.5 }, children: filterPlaceholder }) }, "p"),
|
2752
2783
|
...[
|
2753
|
-
(
|
2784
|
+
(_u = textFieldProps.children) !== null && _u !== void 0 ? _u : dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map((option, index) => {
|
2754
2785
|
var _a;
|
2755
2786
|
const { label, value } = getValueAndLabel(option);
|
2756
2787
|
return (jsxRuntime.jsxs(MenuItem__default["default"], { sx: {
|
@@ -3159,8 +3190,9 @@ const MRT_TableHeadCell = (_a) => {
|
|
3159
3190
|
};
|
3160
3191
|
|
3161
3192
|
const MRT_TableHeadRow = (_a) => {
|
3162
|
-
var { headerGroup, table
|
3193
|
+
var { columnVirtualizer, headerGroup, table } = _a, rest = __rest(_a, ["columnVirtualizer", "headerGroup", "table"]);
|
3163
3194
|
const { options: { layoutMode, muiTableHeadRowProps }, } = table;
|
3195
|
+
const { virtualColumns, virtualPaddingLeft, virtualPaddingRight } = columnVirtualizer !== null && columnVirtualizer !== void 0 ? columnVirtualizer : {};
|
3164
3196
|
const tableRowProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableHeadRowProps, {
|
3165
3197
|
headerGroup,
|
3166
3198
|
table,
|
@@ -3203,6 +3235,8 @@ const MRT_TablePagination = (_a) => {
|
|
3203
3235
|
const firstRowIndex = pageIndex * pageSize;
|
3204
3236
|
const lastRowIndex = Math.min(pageIndex * pageSize + pageSize, totalRowCount);
|
3205
3237
|
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"]);
|
3238
|
+
const disableBack = pageIndex <= 0 || disabled;
|
3239
|
+
const disableNext = lastRowIndex >= totalRowCount || disabled;
|
3206
3240
|
return (jsxRuntime.jsxs(Box__default["default"], { className: "MuiTablePagination-root", sx: {
|
3207
3241
|
alignItems: 'center',
|
3208
3242
|
display: 'flex',
|
@@ -3229,7 +3263,7 @@ const MRT_TablePagination = (_a) => {
|
|
3229
3263
|
last: LastPageIcon,
|
3230
3264
|
next: ChevronRightIcon,
|
3231
3265
|
previous: ChevronLeftIcon,
|
3232
|
-
} }, 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(IconButton__default["default"], { "aria-label": localization.goToFirstPage, disabled:
|
3266
|
+
} }, 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] }));
|
3233
3267
|
};
|
3234
3268
|
|
3235
3269
|
const MRT_GlobalFilterTextField = (_a) => {
|
@@ -3601,7 +3635,7 @@ const MRT_TopToolbar = ({ table, }) => {
|
|
3601
3635
|
};
|
3602
3636
|
|
3603
3637
|
const MRT_TableHead = (_a) => {
|
3604
|
-
var {
|
3638
|
+
var { columnVirtualizer, table } = _a, rest = __rest(_a, ["columnVirtualizer", "table"]);
|
3605
3639
|
const { getHeaderGroups, getSelectedRowModel, getState, options: { enableStickyHeader, layoutMode, muiTableHeadProps, positionToolbarAlertBanner, }, refs: { tableHeadRef }, } = table;
|
3606
3640
|
const { isFullScreen, showAlertBanner } = getState();
|
3607
3641
|
const tableHeadProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableHeadProps, { table })), rest);
|
@@ -3618,7 +3652,7 @@ const MRT_TableHead = (_a) => {
|
|
3618
3652
|
}, children: jsxRuntime.jsx("th", { colSpan: table.getVisibleLeafColumns().length, style: {
|
3619
3653
|
display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined,
|
3620
3654
|
padding: 0,
|
3621
|
-
}, children: jsxRuntime.jsx(MRT_ToolbarAlertBanner, { table: table }) }) })) : (getHeaderGroups().map((headerGroup) => (jsxRuntime.jsx(MRT_TableHeadRow, { headerGroup: headerGroup, table: table
|
3655
|
+
}, children: jsxRuntime.jsx(MRT_ToolbarAlertBanner, { table: table }) }) })) : (getHeaderGroups().map((headerGroup) => (jsxRuntime.jsx(MRT_TableHeadRow, { columnVirtualizer: columnVirtualizer, headerGroup: headerGroup, table: table }, headerGroup.id)))) })));
|
3622
3656
|
};
|
3623
3657
|
|
3624
3658
|
const MRT_Table = (_a) => {
|
@@ -3641,18 +3675,11 @@ const MRT_Table = (_a) => {
|
|
3641
3675
|
return colSizes;
|
3642
3676
|
}, [columns, columnSizing, columnSizingInfo, columnVisibility]);
|
3643
3677
|
const columnVirtualizer = useMRT_ColumnVirtualizer(table);
|
3644
|
-
const { virtualPaddingLeft, virtualPaddingRight } = columnVirtualizer !== null && columnVirtualizer !== void 0 ? columnVirtualizer : {};
|
3645
|
-
const virtualColumns = columnVirtualizer
|
3646
|
-
? columnVirtualizer.getVirtualItems()
|
3647
|
-
: undefined;
|
3648
3678
|
const commonTableGroupProps = {
|
3679
|
+
columnVirtualizer,
|
3649
3680
|
table,
|
3650
|
-
virtualColumns,
|
3651
|
-
virtualPaddingLeft,
|
3652
|
-
virtualPaddingRight,
|
3653
3681
|
};
|
3654
|
-
|
3655
|
-
return (jsxRuntime.jsxs(Table__default["default"], Object.assign({ stickyHeader: enableStickyHeader || isFullScreen }, tableProps, { style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style), sx: (theme) => (Object.assign({ borderCollapse: 'separate', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined }, parseFromValuesOrFunc(tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx, theme))), children: [enableTableHead && jsxRuntime.jsx(MRT_TableHead, Object.assign({}, commonTableGroupProps)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsxRuntime.jsx(Memo_MRT_TableBody, Object.assign({}, commonTableBodyProps))) : (jsxRuntime.jsx(MRT_TableBody, Object.assign({}, commonTableBodyProps))), enableTableFooter && jsxRuntime.jsx(MRT_TableFooter, Object.assign({}, commonTableGroupProps))] })));
|
3682
|
+
return (jsxRuntime.jsxs(Table__default["default"], Object.assign({ stickyHeader: enableStickyHeader || isFullScreen }, tableProps, { style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style), sx: (theme) => (Object.assign({ borderCollapse: 'separate', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined }, parseFromValuesOrFunc(tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx, theme))), children: [enableTableHead && jsxRuntime.jsx(MRT_TableHead, Object.assign({}, commonTableGroupProps)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsxRuntime.jsx(Memo_MRT_TableBody, Object.assign({}, commonTableGroupProps))) : (jsxRuntime.jsx(MRT_TableBody, Object.assign({}, commonTableGroupProps))), enableTableFooter && jsxRuntime.jsx(MRT_TableFooter, Object.assign({}, commonTableGroupProps))] })));
|
3656
3683
|
};
|
3657
3684
|
|
3658
3685
|
const MRT_TableLoadingOverlay = (_a) => {
|