material-react-table 2.0.0-alpha.4 → 2.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +458 -405
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/column.utils.d.ts +2 -0
- package/dist/cjs/types/icons.d.ts +1 -1
- package/dist/cjs/types/locales/hy.d.ts +2 -0
- package/dist/cjs/types/toolbar/MRT_ToolbarAlertBanner.d.ts +1 -1
- package/dist/cjs/types/types.d.ts +22 -29
- package/dist/esm/material-react-table.esm.js +459 -407
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/types/column.utils.d.ts +2 -0
- package/dist/esm/types/icons.d.ts +1 -1
- package/dist/esm/types/locales/hy.d.ts +2 -0
- package/dist/esm/types/toolbar/MRT_ToolbarAlertBanner.d.ts +1 -1
- package/dist/esm/types/types.d.ts +22 -29
- package/dist/index.d.ts +27 -33
- package/locales/hy.d.ts +2 -0
- package/locales/hy.esm.d.ts +2 -0
- package/locales/hy.esm.js +93 -0
- package/locales/hy.esm.js.map +1 -0
- package/locales/hy.js +97 -0
- package/locales/hy.js.map +1 -0
- package/package.json +7 -7
- package/src/body/MRT_TableBody.tsx +30 -22
- package/src/body/MRT_TableBodyCell.tsx +2 -2
- package/src/body/MRT_TableBodyRow.tsx +3 -3
- package/src/body/MRT_TableDetailPanel.tsx +3 -3
- package/src/buttons/MRT_GrabHandleButton.tsx +1 -2
- package/src/buttons/MRT_ShowHideColumnsButton.tsx +1 -2
- package/src/buttons/MRT_ToggleDensePaddingButton.tsx +1 -2
- package/src/buttons/MRT_ToggleFiltersButton.tsx +1 -2
- package/src/buttons/MRT_ToggleFullScreenButton.tsx +2 -3
- package/src/column.utils.ts +34 -9
- package/src/filterFns.ts +3 -3
- package/src/footer/MRT_TableFooter.tsx +1 -1
- package/src/footer/MRT_TableFooterCell.tsx +1 -1
- package/src/footer/MRT_TableFooterRow.tsx +2 -2
- package/src/head/MRT_TableHead.tsx +36 -14
- package/src/head/MRT_TableHeadCell.tsx +1 -1
- package/src/head/MRT_TableHeadCellFilterLabel.tsx +2 -0
- package/src/head/MRT_TableHeadRow.tsx +2 -2
- package/src/hooks/useMRT_TableInstance.ts +6 -6
- package/src/hooks/useMRT_TableOptions.ts +7 -2
- package/src/icons.ts +3 -3
- package/src/inputs/MRT_FilterTextField.tsx +4 -3
- package/src/locales/hy.ts +93 -0
- package/src/table/MRT_Table.tsx +24 -12
- package/src/toolbar/MRT_TablePagination.tsx +23 -14
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +53 -15
- package/src/toolbar/MRT_TopToolbar.tsx +1 -1
- package/src/types.ts +26 -25
@@ -1,8 +1,8 @@
|
|
1
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
2
2
|
import Paper from '@mui/material/Paper';
|
3
|
-
import { useState, memo, useEffect, useMemo, useRef, useCallback,
|
3
|
+
import { useState, memo, useEffect, useMemo, useRef, useCallback, Fragment as Fragment$1, useLayoutEffect, useReducer } from 'react';
|
4
4
|
import TableContainer from '@mui/material/TableContainer';
|
5
|
-
import {
|
5
|
+
import { defaultRangeExtractor, useVirtualizer } from '@tanstack/react-virtual';
|
6
6
|
import Table from '@mui/material/Table';
|
7
7
|
import TableBody from '@mui/material/TableBody';
|
8
8
|
import Typography from '@mui/material/Typography';
|
@@ -39,11 +39,6 @@ import Popover from '@mui/material/Popover';
|
|
39
39
|
import Divider from '@mui/material/Divider';
|
40
40
|
import Badge from '@mui/material/Badge';
|
41
41
|
import TableSortLabel from '@mui/material/TableSortLabel';
|
42
|
-
import Dialog from '@mui/material/Dialog';
|
43
|
-
import DialogActions from '@mui/material/DialogActions';
|
44
|
-
import DialogContent from '@mui/material/DialogContent';
|
45
|
-
import DialogTitle from '@mui/material/DialogTitle';
|
46
|
-
import CircularProgress from '@mui/material/CircularProgress';
|
47
42
|
import Toolbar from '@mui/material/Toolbar';
|
48
43
|
import useMediaQuery from '@mui/material/useMediaQuery';
|
49
44
|
import LinearProgress from '@mui/material/LinearProgress';
|
@@ -53,13 +48,18 @@ import PaginationItem from '@mui/material/PaginationItem';
|
|
53
48
|
import Select from '@mui/material/Select';
|
54
49
|
import Alert from '@mui/material/Alert';
|
55
50
|
import AlertTitle from '@mui/material/AlertTitle';
|
51
|
+
import Radio from '@mui/material/Radio';
|
56
52
|
import Fade from '@mui/material/Fade';
|
57
53
|
import Switch from '@mui/material/Switch';
|
58
|
-
import
|
54
|
+
import Dialog from '@mui/material/Dialog';
|
55
|
+
import DialogActions from '@mui/material/DialogActions';
|
56
|
+
import DialogContent from '@mui/material/DialogContent';
|
57
|
+
import DialogTitle from '@mui/material/DialogTitle';
|
58
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
59
59
|
import ArrowDownwardIcon from '@mui/icons-material/ArrowDownward';
|
60
60
|
import ArrowRightIcon from '@mui/icons-material/ArrowRight';
|
61
61
|
import CancelIcon from '@mui/icons-material/Cancel';
|
62
|
-
import
|
62
|
+
import ChevronLeftIcon from '@mui/icons-material/ChevronLeft';
|
63
63
|
import ChevronRightIcon from '@mui/icons-material/ChevronRight';
|
64
64
|
import ClearAllIcon from '@mui/icons-material/ClearAll';
|
65
65
|
import CloseIcon from '@mui/icons-material/Close';
|
@@ -325,19 +325,24 @@ const getCanRankRows = (table) => {
|
|
325
325
|
};
|
326
326
|
const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
|
327
327
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
328
|
+
const { options: { layoutMode }, } = table;
|
328
329
|
const widthStyles = {
|
329
330
|
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)`,
|
330
331
|
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)`,
|
331
332
|
};
|
333
|
+
if (layoutMode === 'grid') {
|
334
|
+
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`;
|
335
|
+
}
|
336
|
+
else if (layoutMode === 'grid-no-grow') {
|
337
|
+
widthStyles.flex = '0 0 auto';
|
338
|
+
}
|
332
339
|
return Object.assign(Object.assign(Object.assign({ backgroundColor: column.getIsPinned() && column.columnDef.columnDefType !== 'group'
|
333
340
|
? alpha(lighten(theme.palette.background.default, 0.04), 0.97)
|
334
341
|
: 'inherit', backgroundImage: 'inherit', boxShadow: getIsLastLeftPinnedColumn(table, column)
|
335
342
|
? `-4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
|
336
343
|
: getIsFirstRightPinnedColumn(column)
|
337
344
|
? `4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
|
338
|
-
: undefined, display:
|
339
|
-
? `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`
|
340
|
-
: undefined, left: column.getIsPinned() === 'left'
|
345
|
+
: undefined, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, left: column.getIsPinned() === 'left'
|
341
346
|
? `${column.getStart('left')}px`
|
342
347
|
: undefined, ml: table.options.enableColumnVirtualization &&
|
343
348
|
column.getIsPinned() === 'left' &&
|
@@ -387,6 +392,17 @@ const flexRender = flexRender$1;
|
|
387
392
|
const createRow = (table, originalRow) => createRow$1(table, 'mrt-row-create', originalRow !== null && originalRow !== void 0 ? originalRow : Object.assign({}, ...getAllLeafColumnDefs(table.options.columns).map((col) => ({
|
388
393
|
[getColumnId(col)]: '',
|
389
394
|
}))), -1, 0);
|
395
|
+
const extraIndexRangeExtractor = (range, draggingIndex) => {
|
396
|
+
const newIndexs = defaultRangeExtractor(range);
|
397
|
+
if (draggingIndex >= 0 &&
|
398
|
+
draggingIndex < Math.max(range.startIndex - range.overscan, 0)) {
|
399
|
+
newIndexs.unshift(draggingIndex);
|
400
|
+
}
|
401
|
+
if (draggingIndex >= 0 && draggingIndex > range.endIndex + range.overscan) {
|
402
|
+
newIndexs.push(draggingIndex);
|
403
|
+
}
|
404
|
+
return newIndexs;
|
405
|
+
};
|
390
406
|
|
391
407
|
const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table, }) => {
|
392
408
|
var _a;
|
@@ -650,7 +666,7 @@ const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, ta
|
|
650
666
|
: undefined,
|
651
667
|
outlineOffset: '-1px',
|
652
668
|
textOverflow: 'clip',
|
653
|
-
}, alignItems: layoutMode === 'grid' ? 'center' : undefined, cursor: isEditable && editDisplayMode === 'cell' ? 'pointer' : 'inherit', justifyContent: layoutMode === 'grid' ? tableCellProps.align : undefined, overflow: 'hidden', p: density === 'compact'
|
669
|
+
}, alignItems: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'center' : undefined, cursor: isEditable && editDisplayMode === 'cell' ? 'pointer' : 'inherit', justifyContent: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? tableCellProps.align : undefined, overflow: 'hidden', p: density === 'compact'
|
654
670
|
? columnDefType === 'display'
|
655
671
|
? '0 0.5rem'
|
656
672
|
: '0.5rem'
|
@@ -703,14 +719,14 @@ const MRT_TableDetailPanel = ({ parentRowRef, row, rowIndex, table, virtualRow,
|
|
703
719
|
});
|
704
720
|
return (jsx(TableRow, Object.assign({ className: "Mui-TableBodyCell-DetailPanel" }, tableRowProps, { sx: (theme) => {
|
705
721
|
var _a, _b;
|
706
|
-
return (Object.assign({ display: layoutMode === 'grid' ? 'flex' :
|
722
|
+
return (Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, position: virtualRow ? 'absolute' : undefined, top: virtualRow
|
707
723
|
? `${(_b = (_a = parentRowRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.height}px`
|
708
724
|
: undefined, transform: virtualRow
|
709
725
|
? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
|
710
726
|
: undefined, width: '100%', zIndex: virtualRow ? 2 : undefined }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme)));
|
711
727
|
}, children: jsx(TableCell, Object.assign({ className: "Mui-TableBodyCell-DetailPanel", colSpan: getVisibleLeafColumns().length }, tableCellProps, { sx: (theme) => (Object.assign({ backgroundColor: virtualRow
|
712
|
-
? lighten(theme.palette.background.default, 0.
|
713
|
-
: undefined, borderBottom: !row.getIsExpanded() ? 'none' : undefined, display: layoutMode === 'grid' ? 'flex' : 'table-cell', pb: row.getIsExpanded() ? '1rem' : 0, pt: row.getIsExpanded() ? '1rem' : 0, transition: 'all 150ms ease-in-out', width: `${table.getTotalSize()}px` }, parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme))), children: renderDetailPanel && (jsx(Collapse, { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true, children: !isLoading && renderDetailPanel({ row, table }) })) })) })));
|
728
|
+
? lighten(theme.palette.background.default, 0.05)
|
729
|
+
: undefined, borderBottom: !row.getIsExpanded() ? 'none' : undefined, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : 'table-cell', pb: row.getIsExpanded() ? '1rem' : 0, pt: row.getIsExpanded() ? '1rem' : 0, transition: 'all 150ms ease-in-out', width: `${table.getTotalSize()}px` }, parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme))), children: renderDetailPanel && (jsx(Collapse, { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true, children: !isLoading && renderDetailPanel({ row, table }) })) })) })));
|
714
730
|
};
|
715
731
|
|
716
732
|
const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRowIds, row, rowIndex, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, virtualRow, }) => {
|
@@ -765,10 +781,10 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRo
|
|
765
781
|
? `${lighten(theme.palette.background.default, 0.12)}`
|
766
782
|
: `${darken(theme.palette.background.default, 0.05)}`
|
767
783
|
: undefined,
|
768
|
-
}, backgroundColor: `${lighten(theme.palette.background.default, 0.
|
784
|
+
}, backgroundColor: `${lighten(theme.palette.background.default, 0.05)} !important`, bottom: !virtualRow && bottomPinnedIndex !== undefined && isPinned
|
769
785
|
? `${bottomPinnedIndex * rowHeight +
|
770
786
|
(enableStickyFooter ? tableFooterHeight - 1 : 0)}px`
|
771
|
-
: undefined, boxSizing: 'border-box', display: layoutMode === 'grid' ? 'flex' :
|
787
|
+
: undefined, boxSizing: 'border-box', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, opacity: isPinned
|
772
788
|
? 0.98
|
773
789
|
: (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id || (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id
|
774
790
|
? 0.5
|
@@ -788,7 +804,7 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRo
|
|
788
804
|
? `${topPinnedIndex * rowHeight +
|
789
805
|
(enableStickyHeader || isFullScreen ? tableHeadHeight - 1 : 0)}px`
|
790
806
|
: undefined, transition: virtualRow ? 'none' : 'all 150ms ease-in-out', width: '100%', zIndex: (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) && isPinned
|
791
|
-
?
|
807
|
+
? 2
|
792
808
|
: undefined }, sx)), children: [virtualPaddingLeft ? (jsx("td", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : row.getVisibleCells()).map((cellOrVirtualCell) => {
|
793
809
|
const cell = columnVirtualizer
|
794
810
|
? row.getVisibleCells()[cellOrVirtualCell.index]
|
@@ -831,7 +847,7 @@ const rankGlobalFuzzy = (rowA, rowB) => Math.max(...Object.values(rowB.columnFil
|
|
831
847
|
const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
|
832
848
|
var _a, _b, _c, _d, _e, _f;
|
833
849
|
const { getBottomRows, getCenterRows, getIsSomeRowsPinned, getPrePaginationRowModel, getRowModel, getState, getTopRows, options: { enableGlobalFilterRankedResults, enablePagination, enableRowPinning, enableRowVirtualization, enableStickyFooter, enableStickyHeader, layoutMode, localization, manualExpanding, manualFiltering, manualGrouping, manualPagination, manualSorting, memoMode, muiTableBodyProps, renderEmptyRowsFallback, rowPinningDisplayMode, rowVirtualizerInstanceRef, rowVirtualizerOptions, }, refs: { tableContainerRef, tableFooterRef, tableHeadRef, tablePaperRef }, } = table;
|
834
|
-
const { columnFilters, density, expanded, globalFilter,
|
850
|
+
const { columnFilters, density, draggingRow, expanded, globalFilter, isFullScreen, pagination, rowPinning, sorting, } = getState();
|
835
851
|
const tableBodyProps = parseFromValuesOrFunc(muiTableBodyProps, { table });
|
836
852
|
const rowVirtualizerProps = parseFromValuesOrFunc(rowVirtualizerOptions, {
|
837
853
|
table,
|
@@ -840,16 +856,9 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
|
|
840
856
|
((_a = tableHeadRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight)) ||
|
841
857
|
0;
|
842
858
|
const tableFooterHeight = (enableStickyFooter && ((_b = tableFooterRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight)) || 0;
|
843
|
-
const
|
844
|
-
!manualFiltering &&
|
845
|
-
!manualGrouping &&
|
846
|
-
!manualSorting &&
|
847
|
-
enableGlobalFilterRankedResults &&
|
848
|
-
globalFilter &&
|
849
|
-
globalFilterFn === 'fuzzy' &&
|
850
|
-
expanded !== true &&
|
859
|
+
const shouldRankRows = useMemo(() => getCanRankRows(table) &&
|
851
860
|
!Object.values(sorting).some(Boolean) &&
|
852
|
-
|
861
|
+
globalFilter, [
|
853
862
|
enableGlobalFilterRankedResults,
|
854
863
|
expanded,
|
855
864
|
globalFilter,
|
@@ -864,7 +873,7 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
|
|
864
873
|
.map((r) => r.id), [rowPinning, table.getRowModel().rows]);
|
865
874
|
const rows = useMemo(() => {
|
866
875
|
let rows = [];
|
867
|
-
if (!
|
876
|
+
if (!shouldRankRows) {
|
868
877
|
rows =
|
869
878
|
!enableRowPinning || (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky'))
|
870
879
|
? getRowModel().rows
|
@@ -886,8 +895,8 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
|
|
886
895
|
}
|
887
896
|
return rows;
|
888
897
|
}, [
|
889
|
-
|
890
|
-
|
898
|
+
shouldRankRows,
|
899
|
+
shouldRankRows ? getPrePaginationRowModel().rows : getRowModel().rows,
|
891
900
|
pagination.pageIndex,
|
892
901
|
pagination.pageSize,
|
893
902
|
rowPinning,
|
@@ -896,7 +905,10 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
|
|
896
905
|
? useVirtualizer(Object.assign({ count: rows.length, estimateSize: () => density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73, getScrollElement: () => tableContainerRef.current, measureElement: typeof window !== 'undefined' &&
|
897
906
|
navigator.userAgent.indexOf('Firefox') === -1
|
898
907
|
? (element) => element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height
|
899
|
-
: undefined, overscan: 4
|
908
|
+
: undefined, overscan: 4, rangeExtractor: useCallback((range) => {
|
909
|
+
var _a;
|
910
|
+
return extraIndexRangeExtractor(range, (_a = draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.index) !== null && _a !== void 0 ? _a : 0);
|
911
|
+
}, [draggingRow]) }, rowVirtualizerProps))
|
900
912
|
: undefined;
|
901
913
|
if (rowVirtualizerInstanceRef && rowVirtualizer) {
|
902
914
|
rowVirtualizerInstanceRef.current = rowVirtualizer;
|
@@ -905,7 +917,7 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
|
|
905
917
|
? rowVirtualizer.getVirtualItems()
|
906
918
|
: undefined;
|
907
919
|
return (jsxs(Fragment, { children: [!(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
|
908
|
-
getIsSomeRowsPinned('top') && (jsx(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' :
|
920
|
+
getIsSomeRowsPinned('top') && (jsx(TableBody, 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) => {
|
909
921
|
const props = {
|
910
922
|
columnVirtualizer,
|
911
923
|
measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
|
@@ -918,10 +930,14 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
|
|
918
930
|
virtualPaddingRight,
|
919
931
|
};
|
920
932
|
return memoMode === 'rows' ? (jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
|
921
|
-
}) }))), jsx(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' :
|
933
|
+
}) }))), jsx(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, height: rowVirtualizer
|
922
934
|
? `${rowVirtualizer.getTotalSize()}px`
|
923
|
-
: 'inherit', minHeight: !rows.length ? '100px' : undefined, position: 'relative' }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: (_c = tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.children) !== null && _c !== void 0 ? _c : (!rows.length ? (jsx("tr", { style: {
|
924
|
-
|
935
|
+
: 'inherit', minHeight: !rows.length ? '100px' : undefined, position: 'relative' }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: (_c = tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.children) !== null && _c !== void 0 ? _c : (!rows.length ? (jsx("tr", { style: {
|
936
|
+
display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined,
|
937
|
+
}, children: jsx("td", { colSpan: table.getVisibleLeafColumns().length, style: {
|
938
|
+
display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid'))
|
939
|
+
? 'grid'
|
940
|
+
: 'table-cell',
|
925
941
|
}, children: (_d = renderEmptyRowsFallback === null || renderEmptyRowsFallback === void 0 ? void 0 : renderEmptyRowsFallback({ table })) !== null && _d !== void 0 ? _d : (jsx(Typography, { sx: {
|
926
942
|
color: 'text.secondary',
|
927
943
|
fontStyle: 'italic',
|
@@ -952,7 +968,7 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
|
|
952
968
|
};
|
953
969
|
return memoMode === 'rows' ? (jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
|
954
970
|
}) }))) })), !(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
|
955
|
-
getIsSomeRowsPinned('bottom') && (jsx(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ bottom: tableFooterHeight - 1, display: layoutMode === 'grid' ? 'grid' :
|
971
|
+
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) => {
|
956
972
|
const props = {
|
957
973
|
columnVirtualizer,
|
958
974
|
measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
|
@@ -980,7 +996,7 @@ const MRT_TableFooterCell = ({ footer, table, }) => {
|
|
980
996
|
column,
|
981
997
|
table,
|
982
998
|
}));
|
983
|
-
return (jsx(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: footer.colSpan, variant: "head" }, tableCellProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-cell', fontWeight: 'bold', justifyContent: columnDefType === 'group' ? 'center' : undefined, p: density === 'compact'
|
999
|
+
return (jsx(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: footer.colSpan, variant: "head" }, tableCellProps, { sx: (theme) => (Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : 'table-cell', fontWeight: 'bold', justifyContent: columnDefType === 'group' ? 'center' : undefined, p: density === 'compact'
|
984
1000
|
? '0.5rem'
|
985
1001
|
: density === 'comfortable'
|
986
1002
|
? '1rem'
|
@@ -1006,7 +1022,7 @@ const MRT_TableFooterRow = ({ footerGroup, table, virtualColumns, virtualPadding
|
|
1006
1022
|
footerGroup,
|
1007
1023
|
table,
|
1008
1024
|
});
|
1009
|
-
return (jsxs(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.
|
1025
|
+
return (jsxs(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.05), display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, width: '100%' }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme))), children: [virtualPaddingLeft ? (jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : footerGroup.headers).map((footerOrVirtualFooter) => {
|
1010
1026
|
const footer = virtualColumns
|
1011
1027
|
? footerGroup.headers[footerOrVirtualFooter.index]
|
1012
1028
|
: footerOrVirtualFooter;
|
@@ -1027,7 +1043,7 @@ const MRT_TableFooter = ({ table, virtualColumns, virtualPaddingLeft, virtualPad
|
|
1027
1043
|
// @ts-ignore
|
1028
1044
|
tableFooterProps.ref.current = ref;
|
1029
1045
|
}
|
1030
|
-
}, sx: (theme) => (Object.assign({ bottom: stickFooter ? 0 : undefined, display: layoutMode === 'grid' ? 'grid' :
|
1046
|
+
}, sx: (theme) => (Object.assign({ bottom: stickFooter ? 0 : undefined, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, opacity: stickFooter ? 0.97 : undefined, outline: stickFooter
|
1031
1047
|
? theme.palette.mode === 'light'
|
1032
1048
|
? `1px solid ${theme.palette.grey[300]}`
|
1033
1049
|
: `1px solid ${theme.palette.grey[700]}`
|
@@ -1472,7 +1488,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1472
1488
|
if (isRangeFilter) {
|
1473
1489
|
column.setFilterValue((old) => {
|
1474
1490
|
const newFilterValues = old !== null && old !== void 0 ? old : ['', ''];
|
1475
|
-
newFilterValues[rangeFilterIndex] = newValue;
|
1491
|
+
newFilterValues[rangeFilterIndex] = newValue !== null && newValue !== void 0 ? newValue : undefined;
|
1476
1492
|
return newFilterValues;
|
1477
1493
|
});
|
1478
1494
|
}
|
@@ -1481,8 +1497,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1481
1497
|
}
|
1482
1498
|
}, isTextboxFilter ? (manualFiltering ? 400 : 200) : 1), []);
|
1483
1499
|
const handleChange = (newValue) => {
|
1484
|
-
|
1485
|
-
setFilterValue((_a = newValue === null || newValue === void 0 ? void 0 : newValue.toString()) !== null && _a !== void 0 ? _a : '');
|
1500
|
+
setFilterValue(newValue !== null && newValue !== void 0 ? newValue : '');
|
1486
1501
|
handleChangeDebounced(newValue);
|
1487
1502
|
};
|
1488
1503
|
const handleTextFieldChange = (event) => {
|
@@ -1560,7 +1575,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1560
1575
|
const endAdornment = !isAutocompleteFilter && !isDateFilter && !filterChipLabel ? (jsx(InputAdornment, { position: "end", sx: { mr: isSelectFilter || isMultiSelectFilter ? '20px' : undefined }, children: jsx(Tooltip, { arrow: true, placement: "right", title: (_h = localization.clearFilter) !== null && _h !== void 0 ? _h : '', children: jsx("span", { children: jsx(IconButton, { "aria-label": localization.clearFilter, disabled: !((_j = filterValue === null || filterValue === void 0 ? void 0 : filterValue.toString()) === null || _j === void 0 ? void 0 : _j.length), onClick: handleClear, size: "small", sx: {
|
1561
1576
|
height: '2rem',
|
1562
1577
|
transform: 'scale(0.9)',
|
1563
|
-
width: '2rem'
|
1578
|
+
width: '2rem',
|
1564
1579
|
}, children: jsx(CloseIcon, {}) }) }) }) })) : null;
|
1565
1580
|
const startAdornment = showChangeModeButton ? (jsxs(InputAdornment, { position: "start", children: [jsx(Tooltip, { arrow: true, title: localization.changeFilterMode, children: jsx("span", { children: jsx(IconButton, { "aria-label": localization.changeFilterMode, onClick: handleFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' }, children: jsx(FilterListIcon, {}) }) }) }), filterChipLabel && (jsx(Chip, { label: filterChipLabel, onDelete: handleClearEmptyFilterChip }))] })) : null;
|
1566
1581
|
const commonTextFieldProps = Object.assign(Object.assign({ FormHelperTextProps: {
|
@@ -1602,7 +1617,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1602
1617
|
}, value: filterValue || null }, datePickerProps, { slotProps: {
|
1603
1618
|
field: Object.assign({ clearable: true, onClear: () => handleClear() }, (_l = datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.slotProps) === null || _l === void 0 ? void 0 : _l.field),
|
1604
1619
|
textField: Object.assign(Object.assign({}, commonTextFieldProps), (_m = datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.slotProps) === null || _m === void 0 ? void 0 : _m.textField),
|
1605
|
-
} }))) : isAutocompleteFilter ? (jsx(Autocomplete, Object.assign({ getOptionLabel: (option) => option, onChange: (_e, newValue) => handleChange(newValue), options: dropdownOptions !== null && dropdownOptions !== void 0 ? dropdownOptions : [] }, autocompleteProps, { renderInput: (builtinTextFieldProps) => {
|
1620
|
+
} }))) : isAutocompleteFilter ? (jsx(Autocomplete, Object.assign({ freeSolo: true, getOptionLabel: (option) => option, onChange: (_e, newValue) => handleChange(newValue), options: dropdownOptions !== null && dropdownOptions !== void 0 ? dropdownOptions : [] }, autocompleteProps, { renderInput: (builtinTextFieldProps) => {
|
1606
1621
|
var _a;
|
1607
1622
|
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 })));
|
1608
1623
|
}, value: filterValue }))) : (jsx(TextField, Object.assign({ SelectProps: {
|
@@ -1782,11 +1797,11 @@ const MRT_TableHeadCellFilterLabel = ({ header, table, }) => {
|
|
1782
1797
|
}, children: jsx(FilterAltIcon, {}) }) }) }) }), jsx(Popover, { anchorEl: anchorEl, anchorOrigin: {
|
1783
1798
|
horizontal: 'center',
|
1784
1799
|
vertical: 'top',
|
1785
|
-
}, onClose: (event) => {
|
1800
|
+
}, onClick: (event) => event.stopPropagation(), onClose: (event) => {
|
1786
1801
|
//@ts-ignore
|
1787
1802
|
event.stopPropagation();
|
1788
1803
|
setAnchorEl(null);
|
1789
|
-
}, open: !!anchorEl, transformOrigin: {
|
1804
|
+
}, onKeyDown: (event) => event.key === 'Enter' && setAnchorEl(null), open: !!anchorEl, transformOrigin: {
|
1790
1805
|
horizontal: 'center',
|
1791
1806
|
vertical: 'bottom',
|
1792
1807
|
}, children: jsx(Box, { sx: { p: '1rem' }, children: jsx(MRT_TableHeadCellFilterContainer, { header: header, table: table }) }) })] }));
|
@@ -1945,7 +1960,7 @@ const MRT_TableHeadCell = ({ header, table, }) => {
|
|
1945
1960
|
if (node) {
|
1946
1961
|
tableHeadCellRefs.current[column.id] = node;
|
1947
1962
|
}
|
1948
|
-
} }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ flexDirection: layoutMode === 'grid' ? 'column' : undefined, fontWeight: 'bold', overflow: 'visible', p: density === 'compact'
|
1963
|
+
} }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ flexDirection: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'column' : undefined, fontWeight: 'bold', overflow: 'visible', p: density === 'compact'
|
1949
1964
|
? '0.5rem'
|
1950
1965
|
: density === 'comfortable'
|
1951
1966
|
? columnDefType === 'display'
|
@@ -2012,7 +2027,7 @@ const MRT_TableHeadRow = ({ headerGroup, table, virtualColumns, virtualPaddingLe
|
|
2012
2027
|
headerGroup,
|
2013
2028
|
table,
|
2014
2029
|
});
|
2015
|
-
return (jsxs(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.
|
2030
|
+
return (jsxs(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.05), boxShadow: `4px 0 8px ${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 ? (jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : headerGroup.headers).map((headerOrVirtualHeader) => {
|
2016
2031
|
const header = virtualColumns
|
2017
2032
|
? headerGroup.headers[headerOrVirtualHeader.index]
|
2018
2033
|
: headerOrVirtualHeader;
|
@@ -2020,208 +2035,6 @@ const MRT_TableHeadRow = ({ headerGroup, table, virtualColumns, virtualPaddingLe
|
|
2020
2035
|
}), virtualPaddingRight ? (jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
|
2021
2036
|
};
|
2022
2037
|
|
2023
|
-
const MRT_TableHead = ({ table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
|
2024
|
-
const { getHeaderGroups, getState, options: { enableStickyHeader, layoutMode, muiTableHeadProps }, refs: { tableHeadRef }, } = table;
|
2025
|
-
const { isFullScreen } = getState();
|
2026
|
-
const tableHeadProps = parseFromValuesOrFunc(muiTableHeadProps, { table });
|
2027
|
-
const stickyHeader = enableStickyHeader || isFullScreen;
|
2028
|
-
return (jsx(TableHead, Object.assign({}, tableHeadProps, { ref: (ref) => {
|
2029
|
-
tableHeadRef.current = ref;
|
2030
|
-
if (tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.ref) {
|
2031
|
-
// @ts-ignore
|
2032
|
-
tableHeadProps.ref.current = ref;
|
2033
|
-
}
|
2034
|
-
}, sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', opacity: 0.97, position: stickyHeader ? 'sticky' : 'relative', top: stickyHeader && layoutMode === 'grid' ? 0 : undefined, zIndex: stickyHeader ? 2 : undefined }, parseFromValuesOrFunc(tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx, theme))), children: getHeaderGroups().map((headerGroup) => (jsx(MRT_TableHeadRow, { headerGroup: headerGroup, table: table, virtualColumns: virtualColumns, virtualPaddingLeft: virtualPaddingLeft, virtualPaddingRight: virtualPaddingRight }, headerGroup.id))) })));
|
2035
|
-
};
|
2036
|
-
|
2037
|
-
const MRT_Table = ({ table, }) => {
|
2038
|
-
var _a, _b, _c, _d;
|
2039
|
-
const { getFlatHeaders, getState, options: { columnVirtualizerInstanceRef, columnVirtualizerOptions, columns, enableColumnPinning, enableColumnResizing, enableColumnVirtualization, enableStickyHeader, enableTableFooter, enableTableHead, layoutMode, memoMode, muiTableProps, }, refs: { tableContainerRef }, } = table;
|
2040
|
-
const { columnPinning, columnSizing, columnSizingInfo, columnVisibility, isFullScreen, } = getState();
|
2041
|
-
const tableProps = parseFromValuesOrFunc(muiTableProps, { table });
|
2042
|
-
const columnVirtualizerProps = parseFromValuesOrFunc(columnVirtualizerOptions, { table });
|
2043
|
-
const columnSizeVars = useMemo(() => {
|
2044
|
-
const headers = getFlatHeaders();
|
2045
|
-
const colSizes = {};
|
2046
|
-
for (let i = 0; i < headers.length; i++) {
|
2047
|
-
const header = headers[i];
|
2048
|
-
const colSize = header.getSize();
|
2049
|
-
colSizes[`--header-${parseCSSVarId(header.id)}-size`] = colSize;
|
2050
|
-
colSizes[`--col-${parseCSSVarId(header.column.id)}-size`] = colSize;
|
2051
|
-
}
|
2052
|
-
return colSizes;
|
2053
|
-
}, [columns, columnSizing, columnSizingInfo, columnVisibility]);
|
2054
|
-
//get first 16 column widths and average them
|
2055
|
-
const averageColumnWidth = useMemo(() => {
|
2056
|
-
var _a, _b, _c, _d;
|
2057
|
-
if (!enableColumnVirtualization)
|
2058
|
-
return 0;
|
2059
|
-
const columnsWidths = (_d = (_c = (_b = (_a = table
|
2060
|
-
.getRowModel()
|
2061
|
-
.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 : [];
|
2062
|
-
return columnsWidths.reduce((a, b) => a + b, 0) / columnsWidths.length;
|
2063
|
-
}, [table.getRowModel().rows, columnPinning, columnVisibility]);
|
2064
|
-
const [leftPinnedIndexes, rightPinnedIndexes] = useMemo(() => enableColumnVirtualization && enableColumnPinning
|
2065
|
-
? [
|
2066
|
-
table.getLeftLeafColumns().map((c) => c.getPinnedIndex()),
|
2067
|
-
table
|
2068
|
-
.getRightLeafColumns()
|
2069
|
-
.map((c) => table.getVisibleLeafColumns().length - c.getPinnedIndex() - 1),
|
2070
|
-
]
|
2071
|
-
: [[], []], [columnPinning, enableColumnVirtualization, enableColumnPinning]);
|
2072
|
-
const columnVirtualizer = enableColumnVirtualization
|
2073
|
-
? useVirtualizer(Object.assign({ count: table.getVisibleLeafColumns().length, estimateSize: () => averageColumnWidth, getScrollElement: () => tableContainerRef.current, horizontal: true, overscan: 3, rangeExtractor: useCallback((range) => [
|
2074
|
-
...new Set([
|
2075
|
-
...leftPinnedIndexes,
|
2076
|
-
...defaultRangeExtractor(range),
|
2077
|
-
...rightPinnedIndexes,
|
2078
|
-
]),
|
2079
|
-
], [leftPinnedIndexes, rightPinnedIndexes]) }, columnVirtualizerProps))
|
2080
|
-
: undefined;
|
2081
|
-
if (columnVirtualizerInstanceRef && columnVirtualizer) {
|
2082
|
-
columnVirtualizerInstanceRef.current = columnVirtualizer;
|
2083
|
-
}
|
2084
|
-
const virtualColumns = columnVirtualizer
|
2085
|
-
? columnVirtualizer.getVirtualItems()
|
2086
|
-
: undefined;
|
2087
|
-
let virtualPaddingLeft;
|
2088
|
-
let virtualPaddingRight;
|
2089
|
-
if (columnVirtualizer && (virtualColumns === null || virtualColumns === void 0 ? void 0 : virtualColumns.length)) {
|
2090
|
-
virtualPaddingLeft = (_b = (_a = virtualColumns[leftPinnedIndexes.length]) === null || _a === void 0 ? void 0 : _a.start) !== null && _b !== void 0 ? _b : 0;
|
2091
|
-
virtualPaddingRight =
|
2092
|
-
columnVirtualizer.getTotalSize() -
|
2093
|
-
((_d = (_c = virtualColumns[virtualColumns.length - 1 - rightPinnedIndexes.length]) === null || _c === void 0 ? void 0 : _c.end) !== null && _d !== void 0 ? _d : 0);
|
2094
|
-
}
|
2095
|
-
const props = {
|
2096
|
-
table,
|
2097
|
-
virtualColumns,
|
2098
|
-
virtualPaddingLeft,
|
2099
|
-
virtualPaddingRight,
|
2100
|
-
};
|
2101
|
-
return (jsx(Fragment, { children: 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 === 'grid' ? 'grid' : 'table', tableLayout: layoutMode !== 'grid' && enableColumnResizing ? 'fixed' : undefined }, parseFromValuesOrFunc(tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx, theme))), children: [enableTableHead && jsx(MRT_TableHead, Object.assign({}, props)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsx(Memo_MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))) : (jsx(MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))), enableTableFooter && jsx(MRT_TableFooter, Object.assign({}, props))] })) }));
|
2102
|
-
};
|
2103
|
-
|
2104
|
-
const MRT_EditActionButtons = ({ row, table, variant = 'icon', }) => {
|
2105
|
-
const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onCreatingRowCancel, onCreatingRowSave, onEditingRowCancel, onEditingRowSave, }, refs: { editInputRefs }, setCreatingRow, setEditingRow, } = table;
|
2106
|
-
const { creatingRow, editingRow, isSaving } = getState();
|
2107
|
-
const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
|
2108
|
-
const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
|
2109
|
-
const handleCancel = () => {
|
2110
|
-
if (isCreating) {
|
2111
|
-
onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
|
2112
|
-
setCreatingRow(null);
|
2113
|
-
}
|
2114
|
-
else if (isEditing) {
|
2115
|
-
onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
|
2116
|
-
setEditingRow(null);
|
2117
|
-
}
|
2118
|
-
row._valuesCache = {}; //reset values cache
|
2119
|
-
};
|
2120
|
-
const handleSubmitRow = () => {
|
2121
|
-
var _a;
|
2122
|
-
//look for auto-filled input values
|
2123
|
-
(_a = Object.values(editInputRefs === null || editInputRefs === void 0 ? void 0 : editInputRefs.current)
|
2124
|
-
.filter((inputRef) => { var _a, _b; return row.id === ((_b = (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.name) === null || _a === void 0 ? void 0 : _a.split('_')) === null || _b === void 0 ? void 0 : _b[0]); })) === null || _a === void 0 ? void 0 : _a.forEach((input) => {
|
2125
|
-
if (input.value !== undefined &&
|
2126
|
-
Object.hasOwn(row === null || row === void 0 ? void 0 : row._valuesCache, input.name)) {
|
2127
|
-
// @ts-ignore
|
2128
|
-
row._valuesCache[input.name] = input.value;
|
2129
|
-
}
|
2130
|
-
});
|
2131
|
-
if (isCreating)
|
2132
|
-
onCreatingRowSave === null || onCreatingRowSave === void 0 ? void 0 : onCreatingRowSave({
|
2133
|
-
exitCreatingMode: () => setCreatingRow(null),
|
2134
|
-
row,
|
2135
|
-
table,
|
2136
|
-
values: row._valuesCache,
|
2137
|
-
});
|
2138
|
-
else if (isEditing) {
|
2139
|
-
onEditingRowSave === null || onEditingRowSave === void 0 ? void 0 : onEditingRowSave({
|
2140
|
-
exitEditingMode: () => setEditingRow(null),
|
2141
|
-
row,
|
2142
|
-
table,
|
2143
|
-
values: row === null || row === void 0 ? void 0 : row._valuesCache,
|
2144
|
-
});
|
2145
|
-
}
|
2146
|
-
};
|
2147
|
-
return (jsx(Box, { onClick: (e) => e.stopPropagation(), sx: { display: 'flex', gap: '0.75rem' }, children: variant === 'icon' ? (jsxs(Fragment, { children: [jsx(Tooltip, { arrow: true, title: localization.cancel, children: jsx(IconButton, { "aria-label": localization.cancel, onClick: handleCancel, children: jsx(CancelIcon, {}) }) }), jsx(Tooltip, { arrow: true, 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] })] })) }));
|
2148
|
-
};
|
2149
|
-
|
2150
|
-
const MRT_EditRowModal = ({ open, table, }) => {
|
2151
|
-
var _a;
|
2152
|
-
const { getState, options: { localization, muiCreateRowModalProps, muiEditRowModalProps, onCreatingRowCancel, onEditingRowCancel, renderCreateRowModalContent, renderEditRowModalContent, }, setCreatingRow, setEditingRow, } = table;
|
2153
|
-
const { creatingRow, editingRow } = getState();
|
2154
|
-
const row = (creatingRow !== null && creatingRow !== void 0 ? creatingRow : editingRow);
|
2155
|
-
const dialogProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditRowModalProps, { row, table })), (creatingRow &&
|
2156
|
-
parseFromValuesOrFunc(muiCreateRowModalProps, { row, table })));
|
2157
|
-
const internalEditComponents = row
|
2158
|
-
.getAllCells()
|
2159
|
-
.filter((cell) => cell.column.columnDef.columnDefType === 'data')
|
2160
|
-
.map((cell) => (jsx(MRT_EditCellTextField, { cell: cell, table: table }, cell.id)));
|
2161
|
-
return (jsx(Dialog, Object.assign({ fullWidth: true, maxWidth: "xs", onClose: (event, reason) => {
|
2162
|
-
var _a;
|
2163
|
-
if (creatingRow) {
|
2164
|
-
onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
|
2165
|
-
setCreatingRow(null);
|
2166
|
-
}
|
2167
|
-
else {
|
2168
|
-
onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
|
2169
|
-
setEditingRow(null);
|
2170
|
-
}
|
2171
|
-
row._valuesCache = {}; //reset values cache
|
2172
|
-
(_a = dialogProps.onClose) === null || _a === void 0 ? void 0 : _a.call(dialogProps, event, reason);
|
2173
|
-
}, open: open }, dialogProps, { children: (_a = ((creatingRow &&
|
2174
|
-
(renderCreateRowModalContent === null || renderCreateRowModalContent === void 0 ? void 0 : renderCreateRowModalContent({
|
2175
|
-
internalEditComponents,
|
2176
|
-
row,
|
2177
|
-
table,
|
2178
|
-
}))) ||
|
2179
|
-
(renderEditRowModalContent === null || renderEditRowModalContent === void 0 ? void 0 : renderEditRowModalContent({
|
2180
|
-
internalEditComponents,
|
2181
|
-
row,
|
2182
|
-
table,
|
2183
|
-
})))) !== null && _a !== void 0 ? _a : (jsxs(Fragment, { children: [jsx(DialogTitle, { sx: { textAlign: 'center' }, children: localization.edit }), jsx(DialogContent, { children: jsx("form", { onSubmit: (e) => e.preventDefault(), children: jsx(Stack, { sx: {
|
2184
|
-
gap: '24px',
|
2185
|
-
paddingTop: '16px',
|
2186
|
-
width: '100%',
|
2187
|
-
}, children: internalEditComponents }) }) }), jsx(DialogActions, { sx: { p: '1.25rem' }, children: jsx(MRT_EditActionButtons, { row: row, table: table, variant: "text" }) })] })) })));
|
2188
|
-
};
|
2189
|
-
|
2190
|
-
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
2191
|
-
const MRT_TableContainer = ({ table, }) => {
|
2192
|
-
const { getState, options: { createDisplayMode, editDisplayMode, enableStickyHeader, muiTableContainerProps, }, refs: { bottomToolbarRef, tableContainerRef, topToolbarRef }, } = table;
|
2193
|
-
const { creatingRow, editingRow, isFullScreen } = getState();
|
2194
|
-
const [totalToolbarHeight, setTotalToolbarHeight] = useState(0);
|
2195
|
-
const tableContainerProps = parseFromValuesOrFunc(muiTableContainerProps, {
|
2196
|
-
table,
|
2197
|
-
});
|
2198
|
-
useIsomorphicLayoutEffect(() => {
|
2199
|
-
var _a, _b, _c, _d;
|
2200
|
-
const topToolbarHeight = typeof document !== 'undefined'
|
2201
|
-
? (_b = (_a = topToolbarRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0
|
2202
|
-
: 0;
|
2203
|
-
const bottomToolbarHeight = typeof document !== 'undefined'
|
2204
|
-
? (_d = (_c = bottomToolbarRef === null || bottomToolbarRef === void 0 ? void 0 : bottomToolbarRef.current) === null || _c === void 0 ? void 0 : _c.offsetHeight) !== null && _d !== void 0 ? _d : 0
|
2205
|
-
: 0;
|
2206
|
-
setTotalToolbarHeight(topToolbarHeight + bottomToolbarHeight);
|
2207
|
-
});
|
2208
|
-
const createModalOpen = createDisplayMode === 'modal' && creatingRow;
|
2209
|
-
const editModalOpen = editDisplayMode === 'modal' && editingRow;
|
2210
|
-
return (jsxs(TableContainer, Object.assign({}, tableContainerProps, { ref: (node) => {
|
2211
|
-
if (node) {
|
2212
|
-
tableContainerRef.current = node;
|
2213
|
-
if (tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.ref) {
|
2214
|
-
//@ts-ignore
|
2215
|
-
tableContainerProps.ref.current = node;
|
2216
|
-
}
|
2217
|
-
}
|
2218
|
-
}, style: Object.assign({ maxHeight: isFullScreen
|
2219
|
-
? `calc(100vh - ${totalToolbarHeight}px)`
|
2220
|
-
: undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style), sx: (theme) => (Object.assign({ maxHeight: enableStickyHeader
|
2221
|
-
? `clamp(350px, calc(100vh - ${totalToolbarHeight}px), 9999px)`
|
2222
|
-
: undefined, maxWidth: '100%', overflow: 'auto' }, parseFromValuesOrFunc(tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx, theme))), children: [jsx(MRT_Table, { table: table }), (createModalOpen || editModalOpen) && (jsx(MRT_EditRowModal, { open: true, table: table }))] })));
|
2223
|
-
};
|
2224
|
-
|
2225
2038
|
const MRT_LinearProgressBar = ({ isTopToolbar, table, }) => {
|
2226
2039
|
const { getState, options: { muiLinearProgressProps }, } = table;
|
2227
2040
|
const { isLoading, showProgressBars } = getState();
|
@@ -2237,25 +2050,52 @@ const MRT_LinearProgressBar = ({ isTopToolbar, table, }) => {
|
|
2237
2050
|
}, unmountOnExit: true, children: jsx(LinearProgress, Object.assign({ "aria-busy": "true", "aria-label": "Loading", sx: { position: 'relative' } }, linearProgressProps)) }));
|
2238
2051
|
};
|
2239
2052
|
|
2240
|
-
|
2053
|
+
/******************************************************************************
|
2054
|
+
Copyright (c) Microsoft Corporation.
|
2055
|
+
|
2056
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
2057
|
+
purpose with or without fee is hereby granted.
|
2058
|
+
|
2059
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
2060
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
2061
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
2062
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
2063
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
2064
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
2065
|
+
PERFORMANCE OF THIS SOFTWARE.
|
2066
|
+
***************************************************************************** */
|
2067
|
+
function __rest(s, e) {
|
2068
|
+
var t = {};
|
2069
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
2070
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
2071
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
2072
|
+
}
|
2073
|
+
return t;
|
2074
|
+
}
|
2075
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
2076
|
+
var e = new Error(message);
|
2077
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
2078
|
+
};
|
2079
|
+
|
2080
|
+
const defaultRowsPerPage = [5, 10, 15, 20, 25, 30, 50, 100];
|
2241
2081
|
const MRT_TablePagination = ({ position = 'bottom', table, }) => {
|
2242
|
-
const { getPrePaginationRowModel, getState, options: { enableToolbarInternalActions, icons: {
|
2082
|
+
const { getPrePaginationRowModel, getState, options: { enableToolbarInternalActions, icons: { ChevronLeftIcon, ChevronRightIcon, FirstPageIcon, LastPageIcon }, localization, muiPaginationProps, paginationDisplayMode, rowCount, }, setPageIndex, setPageSize, } = table;
|
2243
2083
|
const { pagination: { pageIndex = 0, pageSize = 10 }, showGlobalFilter, } = getState();
|
2244
|
-
const paginationProps = parseFromValuesOrFunc(
|
2084
|
+
const paginationProps = parseFromValuesOrFunc(muiPaginationProps, {
|
2245
2085
|
table,
|
2246
2086
|
});
|
2247
2087
|
const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
|
2248
2088
|
const numberOfPages = Math.ceil(totalRowCount / pageSize);
|
2249
2089
|
const showFirstLastPageButtons = numberOfPages > 2;
|
2250
|
-
const showFirstButton = showFirstLastPageButtons && (paginationProps === null || paginationProps === void 0 ? void 0 : paginationProps.showFirstButton) !== false;
|
2251
|
-
const showLastButton = showFirstLastPageButtons && (paginationProps === null || paginationProps === void 0 ? void 0 : paginationProps.showLastButton) !== false;
|
2252
2090
|
const firstRowIndex = pageIndex * pageSize;
|
2253
2091
|
const lastRowIndex = Math.min(pageIndex * pageSize + pageSize, totalRowCount);
|
2092
|
+
const _a = paginationProps !== null && paginationProps !== void 0 ? paginationProps : {}, { rowsPerPageOptions = defaultRowsPerPage, showFirstButton = showFirstLastPageButtons, showLastButton = showFirstLastPageButtons, showRowsPerPage = true } = _a, rest = __rest(_a, ["rowsPerPageOptions", "showFirstButton", "showLastButton", "showRowsPerPage"]);
|
2254
2093
|
return (jsxs(Box, { sx: {
|
2255
2094
|
alignItems: 'center',
|
2256
2095
|
display: 'flex',
|
2257
2096
|
gap: '8px',
|
2258
2097
|
justifyContent: 'space-between',
|
2098
|
+
justifySelf: 'flex-end',
|
2259
2099
|
mt: position === 'top' &&
|
2260
2100
|
enableToolbarInternalActions &&
|
2261
2101
|
!showGlobalFilter
|
@@ -2265,33 +2105,147 @@ const MRT_TablePagination = ({ position = 'bottom', table, }) => {
|
|
2265
2105
|
px: '4px',
|
2266
2106
|
py: '12px',
|
2267
2107
|
zIndex: 2,
|
2268
|
-
}, children: [
|
2108
|
+
}, children: [showRowsPerPage && (jsxs(Box, { sx: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [jsx(InputLabel, { htmlFor: "mrt-rows-per-page", sx: { mb: 0 }, children: localization.rowsPerPage }), jsx(Select, { id: "mrt-rows-per-page", inputProps: { 'aria-label': localization.rowsPerPage }, label: localization.rowsPerPage, onChange: (event) => setPageSize(+event.target.value), sx: { '&::before': { border: 'none' }, mb: 0 }, value: pageSize, variant: "standard", children: rowsPerPageOptions.map((value) => (jsx(MenuItem, { sx: { m: 0 }, value: value, children: value }, value))) })] })), paginationDisplayMode === 'pages' ? (jsx(Pagination, Object.assign({ count: numberOfPages, onChange: (_e, newPageIndex) => setPageIndex(newPageIndex - 1), page: pageIndex + 1, renderItem: (item) => (jsx(PaginationItem, Object.assign({ slots: {
|
2269
2109
|
first: FirstPageIcon,
|
2270
2110
|
last: LastPageIcon,
|
2271
2111
|
next: ChevronRightIcon,
|
2272
|
-
previous:
|
2273
|
-
} }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton },
|
2112
|
+
previous: ChevronLeftIcon,
|
2113
|
+
} }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton }, rest))) : paginationDisplayMode === 'default' ? (jsxs(Fragment, { children: [jsx(Typography, { sx: { mb: 0, minWidth: '10ch', mx: '4px' }, 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: pageIndex <= 0, onClick: () => setPageIndex(0), size: "small", children: jsx(FirstPageIcon, {}) })), jsx(IconButton, { "aria-label": localization.goToPreviousPage, disabled: pageIndex <= 0, onClick: () => setPageIndex(pageIndex - 1), size: "small", children: jsx(ChevronLeftIcon, {}) }), jsx(IconButton, { "aria-label": localization.goToNextPage, disabled: lastRowIndex >= totalRowCount, onClick: () => setPageIndex(pageIndex + 1), size: "small", children: jsx(ChevronRightIcon, {}) }), showLastButton && (jsx(IconButton, { "aria-label": localization.goToLastPage, disabled: lastRowIndex >= totalRowCount, onClick: () => setPageIndex(numberOfPages - 1), size: "small", children: jsx(LastPageIcon, {}) }))] })] })) : null] }));
|
2274
2114
|
};
|
2275
2115
|
|
2276
|
-
const
|
2277
|
-
var _a
|
2278
|
-
const {
|
2279
|
-
const {
|
2280
|
-
const
|
2281
|
-
table,
|
2282
|
-
});
|
2283
|
-
const chipProps = parseFromValuesOrFunc(muiToolbarAlertBannerChipProps, {
|
2116
|
+
const MRT_GlobalFilterTextField = ({ table, }) => {
|
2117
|
+
var _a;
|
2118
|
+
const { getState, options: { enableGlobalFilterModes, icons: { CloseIcon, SearchIcon }, localization, manualFiltering, muiSearchTextFieldProps, }, refs: { searchInputRef }, setGlobalFilter, } = table;
|
2119
|
+
const { globalFilter, showGlobalFilter } = getState();
|
2120
|
+
const textFieldProps = parseFromValuesOrFunc(muiSearchTextFieldProps, {
|
2284
2121
|
table,
|
2285
2122
|
});
|
2286
|
-
const
|
2287
|
-
|
2288
|
-
|
2289
|
-
const
|
2290
|
-
|
2291
|
-
|
2292
|
-
|
2293
|
-
|
2294
|
-
|
2123
|
+
const isMounted = useRef(false);
|
2124
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
2125
|
+
const [searchValue, setSearchValue] = useState(globalFilter !== null && globalFilter !== void 0 ? globalFilter : '');
|
2126
|
+
const handleChangeDebounced = useCallback(debounce((event) => {
|
2127
|
+
var _a;
|
2128
|
+
setGlobalFilter((_a = event.target.value) !== null && _a !== void 0 ? _a : undefined);
|
2129
|
+
}, manualFiltering ? 500 : 250), []);
|
2130
|
+
const handleChange = (event) => {
|
2131
|
+
setSearchValue(event.target.value);
|
2132
|
+
handleChangeDebounced(event);
|
2133
|
+
};
|
2134
|
+
const handleGlobalFilterMenuOpen = (event) => {
|
2135
|
+
setAnchorEl(event.currentTarget);
|
2136
|
+
};
|
2137
|
+
const handleClear = () => {
|
2138
|
+
setSearchValue('');
|
2139
|
+
setGlobalFilter(undefined);
|
2140
|
+
};
|
2141
|
+
useEffect(() => {
|
2142
|
+
if (isMounted.current) {
|
2143
|
+
if (globalFilter === undefined) {
|
2144
|
+
handleClear();
|
2145
|
+
}
|
2146
|
+
else {
|
2147
|
+
setSearchValue(globalFilter);
|
2148
|
+
}
|
2149
|
+
}
|
2150
|
+
isMounted.current = true;
|
2151
|
+
}, [globalFilter]);
|
2152
|
+
return (jsxs(Collapse, { in: showGlobalFilter, mountOnEnter: true, orientation: "horizontal", unmountOnExit: true, children: [jsx(TextField, Object.assign({ InputProps: {
|
2153
|
+
endAdornment: (jsx(InputAdornment, { position: "end", children: jsx(Tooltip, { arrow: true, title: (_a = localization.clearSearch) !== null && _a !== void 0 ? _a : '', children: jsx("span", { children: jsx(IconButton, { "aria-label": localization.clearSearch, disabled: !(searchValue === null || searchValue === void 0 ? void 0 : searchValue.length), onClick: handleClear, size: "small", children: jsx(CloseIcon, {}) }) }) }) })),
|
2154
|
+
startAdornment: enableGlobalFilterModes ? (jsx(InputAdornment, { position: "start", children: jsx(Tooltip, { arrow: true, title: localization.changeSearchMode, children: jsx(IconButton, { "aria-label": localization.changeSearchMode, onClick: handleGlobalFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' }, children: jsx(SearchIcon, {}) }) }) })) : (jsx(SearchIcon, { style: { marginRight: '4px' } })),
|
2155
|
+
}, onChange: handleChange, placeholder: localization.search, value: searchValue !== null && searchValue !== void 0 ? searchValue : '', variant: "standard" }, textFieldProps, { inputRef: (inputRef) => {
|
2156
|
+
searchInputRef.current = inputRef;
|
2157
|
+
if (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.inputRef) {
|
2158
|
+
textFieldProps.inputRef = inputRef;
|
2159
|
+
}
|
2160
|
+
} })), jsx(MRT_FilterOptionMenu, { anchorEl: anchorEl, onSelect: handleClear, setAnchorEl: setAnchorEl, table: table })] }));
|
2161
|
+
};
|
2162
|
+
|
2163
|
+
const MRT_SelectCheckbox = ({ row, selectAll, table, }) => {
|
2164
|
+
var _a;
|
2165
|
+
const { getState, options: { enableMultiRowSelection, enableRowPinning, localization, muiSelectAllCheckboxProps, muiSelectCheckboxProps, rowPinningDisplayMode, selectAllMode, }, } = table;
|
2166
|
+
const { density, isLoading } = getState();
|
2167
|
+
const checkboxProps = !row
|
2168
|
+
? parseFromValuesOrFunc(muiSelectAllCheckboxProps, { table })
|
2169
|
+
: parseFromValuesOrFunc(muiSelectCheckboxProps, { row, table });
|
2170
|
+
const allRowsSelected = selectAll
|
2171
|
+
? selectAllMode === 'page'
|
2172
|
+
? table.getIsAllPageRowsSelected()
|
2173
|
+
: table.getIsAllRowsSelected()
|
2174
|
+
: undefined;
|
2175
|
+
const commonProps = Object.assign(Object.assign({ checked: selectAll ? allRowsSelected : row === null || row === void 0 ? void 0 : row.getIsSelected(), disabled: isLoading || (row && !row.getCanSelect()), inputProps: {
|
2176
|
+
'aria-label': selectAll
|
2177
|
+
? localization.toggleSelectAll
|
2178
|
+
: localization.toggleSelectRow,
|
2179
|
+
}, onChange: (event) => {
|
2180
|
+
event.stopPropagation();
|
2181
|
+
row
|
2182
|
+
? row.getToggleSelectedHandler()(event)
|
2183
|
+
: selectAllMode === 'all'
|
2184
|
+
? table.getToggleAllRowsSelectedHandler()(event)
|
2185
|
+
: table.getToggleAllPageRowsSelectedHandler()(event);
|
2186
|
+
if (enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('select'))) {
|
2187
|
+
if (row) {
|
2188
|
+
row.pin(!row.getIsPinned() && event.target.checked
|
2189
|
+
? (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('bottom'))
|
2190
|
+
? 'bottom'
|
2191
|
+
: 'top'
|
2192
|
+
: false);
|
2193
|
+
}
|
2194
|
+
else {
|
2195
|
+
table.setRowPinning({ bottom: [], top: [] });
|
2196
|
+
}
|
2197
|
+
}
|
2198
|
+
}, size: (density === 'compact' ? 'small' : 'medium') }, checkboxProps), { onClick: (e) => {
|
2199
|
+
var _a;
|
2200
|
+
e.stopPropagation();
|
2201
|
+
(_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
|
2202
|
+
}, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.5rem', m: density !== 'compact' ? '-0.4rem' : undefined, width: density === 'compact' ? '1.75rem' : '2.5rem', zIndex: 0 }, parseFromValuesOrFunc(checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx, theme))), title: undefined });
|
2203
|
+
return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _a !== void 0 ? _a : (selectAll
|
2204
|
+
? localization.toggleSelectAll
|
2205
|
+
: localization.toggleSelectRow), children: enableMultiRowSelection === false ? (jsx(Radio, Object.assign({}, commonProps))) : (jsx(Checkbox, Object.assign({ indeterminate: selectAll
|
2206
|
+
? table.getIsSomeRowsSelected() && !allRowsSelected
|
2207
|
+
: row === null || row === void 0 ? void 0 : row.getIsSomeSelected() }, commonProps))) }));
|
2208
|
+
};
|
2209
|
+
|
2210
|
+
const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
|
2211
|
+
var _a, _b, _c;
|
2212
|
+
const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { enableRowSelection, enableSelectAll, localization, muiToolbarAlertBannerChipProps, muiToolbarAlertBannerProps, positionToolbarAlertBanner, renderToolbarAlertBannerContent, rowCount, }, refs: { tablePaperRef }, } = table;
|
2213
|
+
const { density, grouping, showAlertBanner } = getState();
|
2214
|
+
const alertProps = parseFromValuesOrFunc(muiToolbarAlertBannerProps, {
|
2215
|
+
table,
|
2216
|
+
});
|
2217
|
+
const chipProps = parseFromValuesOrFunc(muiToolbarAlertBannerChipProps, {
|
2218
|
+
table,
|
2219
|
+
});
|
2220
|
+
const selectedAlert = getSelectedRowModel().rows.length > 0
|
2221
|
+
? (_b = (_a = localization.selectedCountOfRowCountRowsSelected) === null || _a === void 0 ? void 0 : _a.replace('{selectedCount}', getSelectedRowModel().rows.length.toString())) === null || _b === void 0 ? void 0 : _b.replace('{rowCount}', (rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length).toString())
|
2222
|
+
: null;
|
2223
|
+
const groupedAlert = grouping.length > 0 ? (jsxs("span", { children: [localization.groupedBy, ' ', grouping.map((columnId, index) => (jsxs(Fragment$1, { children: [index > 0 ? localization.thenBy : '', jsx(Chip, Object.assign({ label: table.getColumn(columnId).columnDef.header, onDelete: () => table.getColumn(columnId).toggleGrouping() }, chipProps))] }, `${index}-${columnId}`)))] })) : null;
|
2224
|
+
return (jsx(Collapse, { in: showAlertBanner || !!selectedAlert || !!groupedAlert, timeout: stackAlertBanner ? 200 : 0, children: jsx(Alert, Object.assign({ color: "info", icon: false }, alertProps, { sx: (theme) => {
|
2225
|
+
var _a, _b;
|
2226
|
+
return (Object.assign({ '& .MuiAlert-message': {
|
2227
|
+
maxWidth: `calc(${(_b = (_a = tablePaperRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _b !== void 0 ? _b : 360}px - 1rem)`,
|
2228
|
+
width: '100%',
|
2229
|
+
}, borderRadius: 0, fontSize: '1rem', left: 0, mb: stackAlertBanner
|
2230
|
+
? 0
|
2231
|
+
: positionToolbarAlertBanner === 'bottom'
|
2232
|
+
? '-1rem'
|
2233
|
+
: undefined, p: 0, position: 'relative', right: 0, top: 0, width: '100%', zIndex: 2 }, parseFromValuesOrFunc(alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx, theme)));
|
2234
|
+
}, children: (_c = renderToolbarAlertBannerContent === null || renderToolbarAlertBannerContent === void 0 ? void 0 : renderToolbarAlertBannerContent({
|
2235
|
+
groupedAlert,
|
2236
|
+
selectedAlert,
|
2237
|
+
table,
|
2238
|
+
})) !== null && _c !== void 0 ? _c : (jsxs(Fragment, { children: [(alertProps === null || alertProps === void 0 ? void 0 : alertProps.title) && jsx(AlertTitle, { children: alertProps.title }), jsxs(Stack, { sx: {
|
2239
|
+
p: positionToolbarAlertBanner !== 'head-overlay'
|
2240
|
+
? '0.5rem 1rem'
|
2241
|
+
: density === 'spacious'
|
2242
|
+
? '0.75rem 1.25rem'
|
2243
|
+
: density === 'comfortable'
|
2244
|
+
? '0.5rem 0.75rem'
|
2245
|
+
: '0.25rem 0.5rem',
|
2246
|
+
}, children: [alertProps === null || alertProps === void 0 ? void 0 : alertProps.children, (alertProps === null || alertProps === void 0 ? void 0 : alertProps.children) && (selectedAlert || groupedAlert) && (jsx("br", {})), jsxs(Box, { sx: { display: 'flex' }, children: [enableRowSelection &&
|
2247
|
+
enableSelectAll &&
|
2248
|
+
positionToolbarAlertBanner === 'head-overlay' && (jsx(MRT_SelectCheckbox, { selectAll: true, table: table })), ' ', selectedAlert] }), selectedAlert && groupedAlert && jsx("br", {}), groupedAlert] })] })) })) }));
|
2295
2249
|
};
|
2296
2250
|
|
2297
2251
|
const MRT_ToolbarDropZone = ({ table, }) => {
|
@@ -2325,33 +2279,6 @@ const MRT_ToolbarDropZone = ({ table, }) => {
|
|
2325
2279
|
}), children: jsx(Typography, { fontStyle: "italic", children: localization.dropToGroupBy.replace('{column}', (_b = (_a = draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.columnDef) === null || _a === void 0 ? void 0 : _a.header) !== null && _b !== void 0 ? _b : '') }) }) }));
|
2326
2280
|
};
|
2327
2281
|
|
2328
|
-
/******************************************************************************
|
2329
|
-
Copyright (c) Microsoft Corporation.
|
2330
|
-
|
2331
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
2332
|
-
purpose with or without fee is hereby granted.
|
2333
|
-
|
2334
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
2335
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
2336
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
2337
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
2338
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
2339
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
2340
|
-
PERFORMANCE OF THIS SOFTWARE.
|
2341
|
-
***************************************************************************** */
|
2342
|
-
function __rest(s, e) {
|
2343
|
-
var t = {};
|
2344
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
2345
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
2346
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
2347
|
-
}
|
2348
|
-
return t;
|
2349
|
-
}
|
2350
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
2351
|
-
var e = new Error(message);
|
2352
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
2353
|
-
};
|
2354
|
-
|
2355
2282
|
const MRT_ColumnPinningButtons = ({ column, table, }) => {
|
2356
2283
|
const { options: { icons: { PushPinIcon }, localization, }, } = table;
|
2357
2284
|
const handlePinColumn = (pinDirection) => {
|
@@ -2519,7 +2446,7 @@ const MRT_ToggleFullScreenButton = (_a) => {
|
|
2519
2446
|
setTooltipOpened(false);
|
2520
2447
|
setIsFullScreen(!isFullScreen);
|
2521
2448
|
};
|
2522
|
-
return (jsx(Tooltip, { arrow: true, open: tooltipOpened, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleFullScreen, children: jsx(IconButton, Object.assign({ "aria-label": localization.
|
2449
|
+
return (jsx(Tooltip, { arrow: true, open: tooltipOpened, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleFullScreen, children: jsx(IconButton, Object.assign({ "aria-label": localization.toggleFullScreen, onClick: handleToggleFullScreen, onMouseEnter: () => setTooltipOpened(true), onMouseLeave: () => setTooltipOpened(false) }, rest, { title: undefined, children: isFullScreen ? jsx(FullscreenExitIcon, {}) : jsx(FullscreenIcon, {}) })) }));
|
2523
2450
|
};
|
2524
2451
|
|
2525
2452
|
const MRT_ToggleGlobalFilterButton = (_a) => {
|
@@ -2550,56 +2477,9 @@ const MRT_ToolbarInternalButtons = ({ table, }) => {
|
|
2550
2477
|
columnFilterDisplayMode !== 'popover' && (jsx(MRT_ToggleFiltersButton, { table: table })), (enableHiding || enableColumnOrdering || enableColumnPinning) && (jsx(MRT_ShowHideColumnsButton, { table: table })), enableDensityToggle && (jsx(MRT_ToggleDensePaddingButton, { table: table })), enableFullScreenToggle && (jsx(MRT_ToggleFullScreenButton, { table: table }))] })) }));
|
2551
2478
|
};
|
2552
2479
|
|
2553
|
-
const MRT_GlobalFilterTextField = ({ table, }) => {
|
2554
|
-
var _a;
|
2555
|
-
const { getState, options: { enableGlobalFilterModes, icons: { CloseIcon, SearchIcon }, localization, manualFiltering, muiSearchTextFieldProps, }, refs: { searchInputRef }, setGlobalFilter, } = table;
|
2556
|
-
const { globalFilter, showGlobalFilter } = getState();
|
2557
|
-
const textFieldProps = parseFromValuesOrFunc(muiSearchTextFieldProps, {
|
2558
|
-
table,
|
2559
|
-
});
|
2560
|
-
const isMounted = useRef(false);
|
2561
|
-
const [anchorEl, setAnchorEl] = useState(null);
|
2562
|
-
const [searchValue, setSearchValue] = useState(globalFilter !== null && globalFilter !== void 0 ? globalFilter : '');
|
2563
|
-
const handleChangeDebounced = useCallback(debounce((event) => {
|
2564
|
-
var _a;
|
2565
|
-
setGlobalFilter((_a = event.target.value) !== null && _a !== void 0 ? _a : undefined);
|
2566
|
-
}, manualFiltering ? 500 : 250), []);
|
2567
|
-
const handleChange = (event) => {
|
2568
|
-
setSearchValue(event.target.value);
|
2569
|
-
handleChangeDebounced(event);
|
2570
|
-
};
|
2571
|
-
const handleGlobalFilterMenuOpen = (event) => {
|
2572
|
-
setAnchorEl(event.currentTarget);
|
2573
|
-
};
|
2574
|
-
const handleClear = () => {
|
2575
|
-
setSearchValue('');
|
2576
|
-
setGlobalFilter(undefined);
|
2577
|
-
};
|
2578
|
-
useEffect(() => {
|
2579
|
-
if (isMounted.current) {
|
2580
|
-
if (globalFilter === undefined) {
|
2581
|
-
handleClear();
|
2582
|
-
}
|
2583
|
-
else {
|
2584
|
-
setSearchValue(globalFilter);
|
2585
|
-
}
|
2586
|
-
}
|
2587
|
-
isMounted.current = true;
|
2588
|
-
}, [globalFilter]);
|
2589
|
-
return (jsxs(Collapse, { in: showGlobalFilter, mountOnEnter: true, orientation: "horizontal", unmountOnExit: true, children: [jsx(TextField, Object.assign({ InputProps: {
|
2590
|
-
endAdornment: (jsx(InputAdornment, { position: "end", children: jsx(Tooltip, { arrow: true, title: (_a = localization.clearSearch) !== null && _a !== void 0 ? _a : '', children: jsx("span", { children: jsx(IconButton, { "aria-label": localization.clearSearch, disabled: !(searchValue === null || searchValue === void 0 ? void 0 : searchValue.length), onClick: handleClear, size: "small", children: jsx(CloseIcon, {}) }) }) }) })),
|
2591
|
-
startAdornment: enableGlobalFilterModes ? (jsx(InputAdornment, { position: "start", children: jsx(Tooltip, { arrow: true, title: localization.changeSearchMode, children: jsx(IconButton, { "aria-label": localization.changeSearchMode, onClick: handleGlobalFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' }, children: jsx(SearchIcon, {}) }) }) })) : (jsx(SearchIcon, { style: { marginRight: '4px' } })),
|
2592
|
-
}, onChange: handleChange, placeholder: localization.search, value: searchValue !== null && searchValue !== void 0 ? searchValue : '', variant: "standard" }, textFieldProps, { inputRef: (inputRef) => {
|
2593
|
-
searchInputRef.current = inputRef;
|
2594
|
-
if (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.inputRef) {
|
2595
|
-
textFieldProps.inputRef = inputRef;
|
2596
|
-
}
|
2597
|
-
} })), jsx(MRT_FilterOptionMenu, { anchorEl: anchorEl, onSelect: handleClear, setAnchorEl: setAnchorEl, table: table })] }));
|
2598
|
-
};
|
2599
|
-
|
2600
2480
|
const commonToolbarStyles = ({ theme }) => ({
|
2601
2481
|
alignItems: 'flex-start',
|
2602
|
-
backgroundColor: lighten(theme.palette.background.default, 0.
|
2482
|
+
backgroundColor: lighten(theme.palette.background.default, 0.05),
|
2603
2483
|
backgroundImage: 'none',
|
2604
2484
|
display: 'grid',
|
2605
2485
|
flexWrap: 'wrap-reverse',
|
@@ -2672,6 +2552,220 @@ const MRT_BottomToolbar = ({ table, }) => {
|
|
2672
2552
|
['both', 'bottom'].includes(positionPagination !== null && positionPagination !== void 0 ? positionPagination : '') && (jsx(MRT_TablePagination, { position: "bottom", table: table })) })] })] })));
|
2673
2553
|
};
|
2674
2554
|
|
2555
|
+
const MRT_TableHead = ({ table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
|
2556
|
+
const { getHeaderGroups, getSelectedRowModel, getState, options: { enableStickyHeader, layoutMode, muiTableHeadProps, positionToolbarAlertBanner, }, refs: { tableHeadRef }, } = table;
|
2557
|
+
const { isFullScreen, showAlertBanner } = getState();
|
2558
|
+
const tableHeadProps = parseFromValuesOrFunc(muiTableHeadProps, { table });
|
2559
|
+
const stickyHeader = enableStickyHeader || isFullScreen;
|
2560
|
+
return (jsx(TableHead, Object.assign({}, tableHeadProps, { ref: (ref) => {
|
2561
|
+
tableHeadRef.current = ref;
|
2562
|
+
if (tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.ref) {
|
2563
|
+
// @ts-ignore
|
2564
|
+
tableHeadProps.ref.current = ref;
|
2565
|
+
}
|
2566
|
+
}, sx: (theme) => (Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, opacity: 0.97, position: stickyHeader ? 'sticky' : 'relative', top: stickyHeader && (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 0 : undefined, zIndex: stickyHeader ? 2 : undefined }, parseFromValuesOrFunc(tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx, theme))), children: positionToolbarAlertBanner === 'head-overlay' &&
|
2567
|
+
(showAlertBanner || getSelectedRowModel().rows.length > 0) ? (jsx("tr", { style: { display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined }, children: jsx("th", { colSpan: table.getVisibleLeafColumns().length, style: {
|
2568
|
+
display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : 'table-cell',
|
2569
|
+
padding: 0,
|
2570
|
+
}, children: jsx(MRT_ToolbarAlertBanner, { table: table }) }) })) : (getHeaderGroups().map((headerGroup) => (jsx(MRT_TableHeadRow, { headerGroup: headerGroup, table: table, virtualColumns: virtualColumns, virtualPaddingLeft: virtualPaddingLeft, virtualPaddingRight: virtualPaddingRight }, headerGroup.id)))) })));
|
2571
|
+
};
|
2572
|
+
|
2573
|
+
const MRT_Table = ({ table, }) => {
|
2574
|
+
var _a, _b, _c, _d;
|
2575
|
+
const { getFlatHeaders, getState, options: { columnVirtualizerInstanceRef, columnVirtualizerOptions, columns, enableColumnPinning, enableColumnResizing, enableColumnVirtualization, enableStickyHeader, enableTableFooter, enableTableHead, layoutMode, memoMode, muiTableProps, }, refs: { tableContainerRef }, } = table;
|
2576
|
+
const { columnPinning, columnSizing, columnSizingInfo, columnVisibility, draggingColumn, isFullScreen, } = getState();
|
2577
|
+
const tableProps = parseFromValuesOrFunc(muiTableProps, { table });
|
2578
|
+
const columnVirtualizerProps = parseFromValuesOrFunc(columnVirtualizerOptions, { table });
|
2579
|
+
const columnSizeVars = useMemo(() => {
|
2580
|
+
const headers = getFlatHeaders();
|
2581
|
+
const colSizes = {};
|
2582
|
+
for (let i = 0; i < headers.length; i++) {
|
2583
|
+
const header = headers[i];
|
2584
|
+
const colSize = header.getSize();
|
2585
|
+
colSizes[`--header-${parseCSSVarId(header.id)}-size`] = colSize;
|
2586
|
+
colSizes[`--col-${parseCSSVarId(header.column.id)}-size`] = colSize;
|
2587
|
+
}
|
2588
|
+
return colSizes;
|
2589
|
+
}, [columns, columnSizing, columnSizingInfo, columnVisibility]);
|
2590
|
+
//get first 16 column widths and average them
|
2591
|
+
const averageColumnWidth = useMemo(() => {
|
2592
|
+
var _a, _b, _c, _d;
|
2593
|
+
if (!enableColumnVirtualization)
|
2594
|
+
return 0;
|
2595
|
+
const columnsWidths = (_d = (_c = (_b = (_a = table
|
2596
|
+
.getRowModel()
|
2597
|
+
.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 : [];
|
2598
|
+
return columnsWidths.reduce((a, b) => a + b, 0) / columnsWidths.length;
|
2599
|
+
}, [table.getRowModel().rows, columnPinning, columnVisibility]);
|
2600
|
+
const [leftPinnedIndexes, rightPinnedIndexes] = useMemo(() => enableColumnVirtualization && enableColumnPinning
|
2601
|
+
? [
|
2602
|
+
table.getLeftLeafColumns().map((c) => c.getPinnedIndex()),
|
2603
|
+
table
|
2604
|
+
.getRightLeafColumns()
|
2605
|
+
.map((c) => table.getVisibleLeafColumns().length - c.getPinnedIndex() - 1),
|
2606
|
+
]
|
2607
|
+
: [[], []], [columnPinning, enableColumnVirtualization, enableColumnPinning]);
|
2608
|
+
const draggingColumnIndex = table
|
2609
|
+
.getVisibleLeafColumns()
|
2610
|
+
.findIndex((c) => c.id === (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id));
|
2611
|
+
const columnVirtualizer = enableColumnVirtualization
|
2612
|
+
? useVirtualizer(Object.assign({ count: table.getVisibleLeafColumns().length, estimateSize: () => averageColumnWidth, getScrollElement: () => tableContainerRef.current, horizontal: true, overscan: 3, rangeExtractor: useCallback((range) => {
|
2613
|
+
const newIndexs = extraIndexRangeExtractor(range, draggingColumnIndex);
|
2614
|
+
return [
|
2615
|
+
...new Set([
|
2616
|
+
...leftPinnedIndexes,
|
2617
|
+
...newIndexs,
|
2618
|
+
...rightPinnedIndexes,
|
2619
|
+
]),
|
2620
|
+
];
|
2621
|
+
}, [leftPinnedIndexes, rightPinnedIndexes, draggingColumnIndex]) }, columnVirtualizerProps))
|
2622
|
+
: undefined;
|
2623
|
+
if (columnVirtualizerInstanceRef && columnVirtualizer) {
|
2624
|
+
columnVirtualizerInstanceRef.current = columnVirtualizer;
|
2625
|
+
}
|
2626
|
+
const virtualColumns = columnVirtualizer
|
2627
|
+
? columnVirtualizer.getVirtualItems()
|
2628
|
+
: undefined;
|
2629
|
+
let virtualPaddingLeft;
|
2630
|
+
let virtualPaddingRight;
|
2631
|
+
if (columnVirtualizer && (virtualColumns === null || virtualColumns === void 0 ? void 0 : virtualColumns.length)) {
|
2632
|
+
virtualPaddingLeft = (_b = (_a = virtualColumns[leftPinnedIndexes.length]) === null || _a === void 0 ? void 0 : _a.start) !== null && _b !== void 0 ? _b : 0;
|
2633
|
+
virtualPaddingRight =
|
2634
|
+
columnVirtualizer.getTotalSize() -
|
2635
|
+
((_d = (_c = virtualColumns[virtualColumns.length - 1 - rightPinnedIndexes.length]) === null || _c === void 0 ? void 0 : _c.end) !== null && _d !== void 0 ? _d : 0);
|
2636
|
+
}
|
2637
|
+
const props = {
|
2638
|
+
table,
|
2639
|
+
virtualColumns,
|
2640
|
+
virtualPaddingLeft,
|
2641
|
+
virtualPaddingRight,
|
2642
|
+
};
|
2643
|
+
return (jsx(Fragment, { children: 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, tableLayout: layoutMode === 'semantic' && enableColumnResizing
|
2644
|
+
? 'fixed'
|
2645
|
+
: undefined }, parseFromValuesOrFunc(tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx, theme))), children: [enableTableHead && jsx(MRT_TableHead, Object.assign({}, props)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsx(Memo_MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))) : (jsx(MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))), enableTableFooter && jsx(MRT_TableFooter, Object.assign({}, props))] })) }));
|
2646
|
+
};
|
2647
|
+
|
2648
|
+
const MRT_EditActionButtons = ({ row, table, variant = 'icon', }) => {
|
2649
|
+
const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onCreatingRowCancel, onCreatingRowSave, onEditingRowCancel, onEditingRowSave, }, refs: { editInputRefs }, setCreatingRow, setEditingRow, } = table;
|
2650
|
+
const { creatingRow, editingRow, isSaving } = getState();
|
2651
|
+
const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
|
2652
|
+
const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
|
2653
|
+
const handleCancel = () => {
|
2654
|
+
if (isCreating) {
|
2655
|
+
onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
|
2656
|
+
setCreatingRow(null);
|
2657
|
+
}
|
2658
|
+
else if (isEditing) {
|
2659
|
+
onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
|
2660
|
+
setEditingRow(null);
|
2661
|
+
}
|
2662
|
+
row._valuesCache = {}; //reset values cache
|
2663
|
+
};
|
2664
|
+
const handleSubmitRow = () => {
|
2665
|
+
var _a;
|
2666
|
+
//look for auto-filled input values
|
2667
|
+
(_a = Object.values(editInputRefs === null || editInputRefs === void 0 ? void 0 : editInputRefs.current)
|
2668
|
+
.filter((inputRef) => { var _a, _b; return row.id === ((_b = (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.name) === null || _a === void 0 ? void 0 : _a.split('_')) === null || _b === void 0 ? void 0 : _b[0]); })) === null || _a === void 0 ? void 0 : _a.forEach((input) => {
|
2669
|
+
if (input.value !== undefined &&
|
2670
|
+
Object.hasOwn(row === null || row === void 0 ? void 0 : row._valuesCache, input.name)) {
|
2671
|
+
// @ts-ignore
|
2672
|
+
row._valuesCache[input.name] = input.value;
|
2673
|
+
}
|
2674
|
+
});
|
2675
|
+
if (isCreating)
|
2676
|
+
onCreatingRowSave === null || onCreatingRowSave === void 0 ? void 0 : onCreatingRowSave({
|
2677
|
+
exitCreatingMode: () => setCreatingRow(null),
|
2678
|
+
row,
|
2679
|
+
table,
|
2680
|
+
values: row._valuesCache,
|
2681
|
+
});
|
2682
|
+
else if (isEditing) {
|
2683
|
+
onEditingRowSave === null || onEditingRowSave === void 0 ? void 0 : onEditingRowSave({
|
2684
|
+
exitEditingMode: () => setEditingRow(null),
|
2685
|
+
row,
|
2686
|
+
table,
|
2687
|
+
values: row === null || row === void 0 ? void 0 : row._valuesCache,
|
2688
|
+
});
|
2689
|
+
}
|
2690
|
+
};
|
2691
|
+
return (jsx(Box, { onClick: (e) => e.stopPropagation(), sx: { display: 'flex', gap: '0.75rem' }, children: variant === 'icon' ? (jsxs(Fragment, { children: [jsx(Tooltip, { arrow: true, title: localization.cancel, children: jsx(IconButton, { "aria-label": localization.cancel, onClick: handleCancel, children: jsx(CancelIcon, {}) }) }), jsx(Tooltip, { arrow: true, 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] })] })) }));
|
2692
|
+
};
|
2693
|
+
|
2694
|
+
const MRT_EditRowModal = ({ open, table, }) => {
|
2695
|
+
var _a;
|
2696
|
+
const { getState, options: { localization, muiCreateRowModalProps, muiEditRowModalProps, onCreatingRowCancel, onEditingRowCancel, renderCreateRowModalContent, renderEditRowModalContent, }, setCreatingRow, setEditingRow, } = table;
|
2697
|
+
const { creatingRow, editingRow } = getState();
|
2698
|
+
const row = (creatingRow !== null && creatingRow !== void 0 ? creatingRow : editingRow);
|
2699
|
+
const dialogProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditRowModalProps, { row, table })), (creatingRow &&
|
2700
|
+
parseFromValuesOrFunc(muiCreateRowModalProps, { row, table })));
|
2701
|
+
const internalEditComponents = row
|
2702
|
+
.getAllCells()
|
2703
|
+
.filter((cell) => cell.column.columnDef.columnDefType === 'data')
|
2704
|
+
.map((cell) => (jsx(MRT_EditCellTextField, { cell: cell, table: table }, cell.id)));
|
2705
|
+
return (jsx(Dialog, Object.assign({ fullWidth: true, maxWidth: "xs", onClose: (event, reason) => {
|
2706
|
+
var _a;
|
2707
|
+
if (creatingRow) {
|
2708
|
+
onCreatingRowCancel === null || onCreatingRowCancel === void 0 ? void 0 : onCreatingRowCancel({ row, table });
|
2709
|
+
setCreatingRow(null);
|
2710
|
+
}
|
2711
|
+
else {
|
2712
|
+
onEditingRowCancel === null || onEditingRowCancel === void 0 ? void 0 : onEditingRowCancel({ row, table });
|
2713
|
+
setEditingRow(null);
|
2714
|
+
}
|
2715
|
+
row._valuesCache = {}; //reset values cache
|
2716
|
+
(_a = dialogProps.onClose) === null || _a === void 0 ? void 0 : _a.call(dialogProps, event, reason);
|
2717
|
+
}, open: open }, dialogProps, { children: (_a = ((creatingRow &&
|
2718
|
+
(renderCreateRowModalContent === null || renderCreateRowModalContent === void 0 ? void 0 : renderCreateRowModalContent({
|
2719
|
+
internalEditComponents,
|
2720
|
+
row,
|
2721
|
+
table,
|
2722
|
+
}))) ||
|
2723
|
+
(renderEditRowModalContent === null || renderEditRowModalContent === void 0 ? void 0 : renderEditRowModalContent({
|
2724
|
+
internalEditComponents,
|
2725
|
+
row,
|
2726
|
+
table,
|
2727
|
+
})))) !== null && _a !== void 0 ? _a : (jsxs(Fragment, { children: [jsx(DialogTitle, { sx: { textAlign: 'center' }, children: localization.edit }), jsx(DialogContent, { children: jsx("form", { onSubmit: (e) => e.preventDefault(), children: jsx(Stack, { sx: {
|
2728
|
+
gap: '24px',
|
2729
|
+
paddingTop: '16px',
|
2730
|
+
width: '100%',
|
2731
|
+
}, children: internalEditComponents }) }) }), jsx(DialogActions, { sx: { p: '1.25rem' }, children: jsx(MRT_EditActionButtons, { row: row, table: table, variant: "text" }) })] })) })));
|
2732
|
+
};
|
2733
|
+
|
2734
|
+
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
2735
|
+
const MRT_TableContainer = ({ table, }) => {
|
2736
|
+
const { getState, options: { createDisplayMode, editDisplayMode, enableStickyHeader, muiTableContainerProps, }, refs: { bottomToolbarRef, tableContainerRef, topToolbarRef }, } = table;
|
2737
|
+
const { creatingRow, editingRow, isFullScreen } = getState();
|
2738
|
+
const [totalToolbarHeight, setTotalToolbarHeight] = useState(0);
|
2739
|
+
const tableContainerProps = parseFromValuesOrFunc(muiTableContainerProps, {
|
2740
|
+
table,
|
2741
|
+
});
|
2742
|
+
useIsomorphicLayoutEffect(() => {
|
2743
|
+
var _a, _b, _c, _d;
|
2744
|
+
const topToolbarHeight = typeof document !== 'undefined'
|
2745
|
+
? (_b = (_a = topToolbarRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0
|
2746
|
+
: 0;
|
2747
|
+
const bottomToolbarHeight = typeof document !== 'undefined'
|
2748
|
+
? (_d = (_c = bottomToolbarRef === null || bottomToolbarRef === void 0 ? void 0 : bottomToolbarRef.current) === null || _c === void 0 ? void 0 : _c.offsetHeight) !== null && _d !== void 0 ? _d : 0
|
2749
|
+
: 0;
|
2750
|
+
setTotalToolbarHeight(topToolbarHeight + bottomToolbarHeight);
|
2751
|
+
});
|
2752
|
+
const createModalOpen = createDisplayMode === 'modal' && creatingRow;
|
2753
|
+
const editModalOpen = editDisplayMode === 'modal' && editingRow;
|
2754
|
+
return (jsxs(TableContainer, Object.assign({}, tableContainerProps, { ref: (node) => {
|
2755
|
+
if (node) {
|
2756
|
+
tableContainerRef.current = node;
|
2757
|
+
if (tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.ref) {
|
2758
|
+
//@ts-ignore
|
2759
|
+
tableContainerProps.ref.current = node;
|
2760
|
+
}
|
2761
|
+
}
|
2762
|
+
}, style: Object.assign({ maxHeight: isFullScreen
|
2763
|
+
? `calc(100vh - ${totalToolbarHeight}px)`
|
2764
|
+
: undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style), sx: (theme) => (Object.assign({ maxHeight: enableStickyHeader
|
2765
|
+
? `clamp(350px, calc(100vh - ${totalToolbarHeight}px), 9999px)`
|
2766
|
+
: undefined, maxWidth: '100%', overflow: 'auto' }, parseFromValuesOrFunc(tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx, theme))), children: [jsx(MRT_Table, { table: table }), (createModalOpen || editModalOpen) && (jsx(MRT_EditRowModal, { open: true, table: table }))] })));
|
2767
|
+
};
|
2768
|
+
|
2675
2769
|
const MRT_TablePaper = ({ table, }) => {
|
2676
2770
|
var _a, _b;
|
2677
2771
|
const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps, renderBottomToolbar, renderTopToolbar, }, refs: { tablePaperRef }, } = table;
|
@@ -2823,53 +2917,6 @@ const MRT_ToggleRowActionMenuButton = ({ cell, row, table, }) => {
|
|
2823
2917
|
parseFromValuesOrFunc(enableEditing, row) ? (jsx(Tooltip, { arrow: true, placement: "right", title: localization.edit, children: jsx(IconButton, { "aria-label": localization.edit, onClick: handleStartEditMode, sx: commonIconButtonStyles, children: jsx(EditIcon, {}) }) })) : renderRowActionMenuItems ? (jsxs(Fragment, { children: [jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.rowActions, children: jsx(IconButton, { "aria-label": localization.rowActions, onClick: handleOpenRowActionMenu, size: "small", sx: commonIconButtonStyles, children: jsx(MoreHorizIcon, {}) }) }), jsx(MRT_RowActionMenu, { anchorEl: anchorEl, handleEdit: handleStartEditMode, row: row, setAnchorEl: setAnchorEl, table: table })] })) : null }));
|
2824
2918
|
};
|
2825
2919
|
|
2826
|
-
const MRT_SelectCheckbox = ({ row, selectAll, table, }) => {
|
2827
|
-
var _a;
|
2828
|
-
const { getState, options: { enableMultiRowSelection, enableRowPinning, localization, muiSelectAllCheckboxProps, muiSelectCheckboxProps, rowPinningDisplayMode, selectAllMode, }, } = table;
|
2829
|
-
const { density, isLoading } = getState();
|
2830
|
-
const checkboxProps = !row
|
2831
|
-
? parseFromValuesOrFunc(muiSelectAllCheckboxProps, { table })
|
2832
|
-
: parseFromValuesOrFunc(muiSelectCheckboxProps, { row, table });
|
2833
|
-
const allRowsSelected = selectAll
|
2834
|
-
? selectAllMode === 'page'
|
2835
|
-
? table.getIsAllPageRowsSelected()
|
2836
|
-
: table.getIsAllRowsSelected()
|
2837
|
-
: undefined;
|
2838
|
-
const commonProps = Object.assign(Object.assign({ checked: selectAll ? allRowsSelected : row === null || row === void 0 ? void 0 : row.getIsSelected(), disabled: isLoading || (row && !row.getCanSelect()), inputProps: {
|
2839
|
-
'aria-label': selectAll
|
2840
|
-
? localization.toggleSelectAll
|
2841
|
-
: localization.toggleSelectRow,
|
2842
|
-
}, onChange: (event) => {
|
2843
|
-
event.stopPropagation();
|
2844
|
-
row
|
2845
|
-
? row.getToggleSelectedHandler()(event)
|
2846
|
-
: selectAllMode === 'all'
|
2847
|
-
? table.getToggleAllRowsSelectedHandler()(event)
|
2848
|
-
: table.getToggleAllPageRowsSelectedHandler()(event);
|
2849
|
-
if (enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('select'))) {
|
2850
|
-
if (row) {
|
2851
|
-
row.pin(!row.getIsPinned() && event.target.checked
|
2852
|
-
? (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('bottom'))
|
2853
|
-
? 'bottom'
|
2854
|
-
: 'top'
|
2855
|
-
: false);
|
2856
|
-
}
|
2857
|
-
else {
|
2858
|
-
table.setRowPinning({ bottom: [], top: [] });
|
2859
|
-
}
|
2860
|
-
}
|
2861
|
-
}, size: (density === 'compact' ? 'small' : 'medium') }, checkboxProps), { onClick: (e) => {
|
2862
|
-
var _a;
|
2863
|
-
e.stopPropagation();
|
2864
|
-
(_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
|
2865
|
-
}, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.5rem', m: density !== 'compact' ? '-0.4rem' : undefined, width: density === 'compact' ? '1.75rem' : '2.5rem', zIndex: 0 }, parseFromValuesOrFunc(checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx, theme))), title: undefined });
|
2866
|
-
return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _a !== void 0 ? _a : (selectAll
|
2867
|
-
? localization.toggleSelectAll
|
2868
|
-
: localization.toggleSelectRow), children: enableMultiRowSelection === false ? (jsx(Radio, Object.assign({}, commonProps))) : (jsx(Checkbox, Object.assign({ indeterminate: selectAll
|
2869
|
-
? table.getIsSomeRowsSelected() && !allRowsSelected
|
2870
|
-
: row === null || row === void 0 ? void 0 : row.getIsSomeSelected() }, commonProps))) }));
|
2871
|
-
};
|
2872
|
-
|
2873
2920
|
const useMRT_DisplayColumns = ({ columnOrder, creatingRow, grouping, tableOptions, }) => {
|
2874
2921
|
var _a, _b;
|
2875
2922
|
return useMemo(() => {
|
@@ -3193,7 +3240,7 @@ const endsWith = (row, id, filterValue) => row
|
|
3193
3240
|
.endsWith(filterValue.toString().toLowerCase().trim());
|
3194
3241
|
endsWith.autoRemove = (val) => !val;
|
3195
3242
|
const equals = (row, id, filterValue) => row.getValue(id).toString().toLowerCase().trim() ===
|
3196
|
-
filterValue.toString().toLowerCase().trim();
|
3243
|
+
(filterValue === null || filterValue === void 0 ? void 0 : filterValue.toString().toLowerCase().trim());
|
3197
3244
|
equals.autoRemove = (val) => !val;
|
3198
3245
|
const notEquals = (row, id, filterValue) => row.getValue(id).toString().toLowerCase().trim() !==
|
3199
3246
|
filterValue.toString().toLowerCase().trim();
|
@@ -3201,14 +3248,14 @@ notEquals.autoRemove = (val) => !val;
|
|
3201
3248
|
const greaterThan = (row, id, filterValue) => !isNaN(+filterValue) && !isNaN(+row.getValue(id))
|
3202
3249
|
? +row.getValue(id) > +filterValue
|
3203
3250
|
: row.getValue(id).toString().toLowerCase().trim() >
|
3204
|
-
filterValue.toString().toLowerCase().trim();
|
3251
|
+
(filterValue === null || filterValue === void 0 ? void 0 : filterValue.toString().toLowerCase().trim());
|
3205
3252
|
greaterThan.autoRemove = (val) => !val;
|
3206
3253
|
const greaterThanOrEqualTo = (row, id, filterValue) => equals(row, id, filterValue) || greaterThan(row, id, filterValue);
|
3207
3254
|
greaterThanOrEqualTo.autoRemove = (val) => !val;
|
3208
3255
|
const lessThan = (row, id, filterValue) => !isNaN(+filterValue) && !isNaN(+row.getValue(id))
|
3209
3256
|
? +row.getValue(id) < +filterValue
|
3210
3257
|
: row.getValue(id).toString().toLowerCase().trim() <
|
3211
|
-
filterValue.toString().toLowerCase().trim();
|
3258
|
+
(filterValue === null || filterValue === void 0 ? void 0 : filterValue.toString().toLowerCase().trim());
|
3212
3259
|
lessThan.autoRemove = (val) => !val;
|
3213
3260
|
const lessThanOrEqualTo = (row, id, filterValue) => equals(row, id, filterValue) || lessThan(row, id, filterValue);
|
3214
3261
|
lessThanOrEqualTo.autoRemove = (val) => !val;
|
@@ -3251,7 +3298,7 @@ const MRT_Default_Icons = {
|
|
3251
3298
|
ArrowDownwardIcon,
|
3252
3299
|
ArrowRightIcon,
|
3253
3300
|
CancelIcon,
|
3254
|
-
|
3301
|
+
ChevronLeftIcon,
|
3255
3302
|
ChevronRightIcon,
|
3256
3303
|
ClearAllIcon,
|
3257
3304
|
CloseIcon,
|
@@ -3384,8 +3431,13 @@ const useMRT_TableOptions = (_a) => {
|
|
3384
3431
|
const _sortingFns = useMemo(() => (Object.assign(Object.assign({}, MRT_SortingFns), sortingFns)), []);
|
3385
3432
|
const _defaultColumn = useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultColumn), defaultColumn)), [defaultColumn]);
|
3386
3433
|
const _defaultDisplayColumn = useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultDisplayColumn), defaultDisplayColumn)), [defaultDisplayColumn]);
|
3387
|
-
if (
|
3388
|
-
|
3434
|
+
if (layoutMode === 'semantic') {
|
3435
|
+
if (rest.enableRowVirtualization || rest.enableColumnVirtualization) {
|
3436
|
+
layoutMode = 'grid';
|
3437
|
+
}
|
3438
|
+
if (enableColumnResizing) {
|
3439
|
+
layoutMode = 'grid-no-grow';
|
3440
|
+
}
|
3389
3441
|
}
|
3390
3442
|
if (rest.enableRowVirtualization) {
|
3391
3443
|
enableStickyHeader = true;
|
@@ -3464,5 +3516,5 @@ const MaterialReactTable = (props) => {
|
|
3464
3516
|
return jsx(MRT_TablePaper, { table: table });
|
3465
3517
|
};
|
3466
3518
|
|
3467
|
-
export { MRT_AggregationFns, MRT_BottomToolbar, MRT_ColumnActionMenu, MRT_ColumnPinningButtons, MRT_CopyButton, MRT_DefaultColumn, MRT_DefaultDisplayColumn, MRT_EditActionButtons, MRT_EditCellTextField, MRT_EditRowModal, MRT_ExpandAllButton, MRT_ExpandButton, MRT_FilterCheckbox, MRT_FilterFns, MRT_FilterOptionMenu, MRT_FilterRangeFields, MRT_FilterRangeSlider, MRT_FilterTextField, MRT_GlobalFilterTextField, MRT_GrabHandleButton, MRT_LinearProgressBar, MRT_RowActionMenu, MRT_RowPinButton, MRT_SelectCheckbox, MRT_ShowHideColumnsButton, MRT_ShowHideColumnsMenu, MRT_ShowHideColumnsMenuItems, MRT_SortingFns, MRT_Table, MRT_TableBody, MRT_TableBodyCell, MRT_TableBodyCellValue, MRT_TableBodyRow, MRT_TableBodyRowGrabHandle, MRT_TableBodyRowPinButton, MRT_TableContainer, MRT_TableDetailPanel, MRT_TableFooter, MRT_TableFooterCell, MRT_TableFooterRow, MRT_TableHead, MRT_TableHeadCell, MRT_TableHeadCellColumnActionsButton, MRT_TableHeadCellFilterContainer, MRT_TableHeadCellFilterLabel, MRT_TableHeadCellGrabHandle, MRT_TableHeadCellResizeHandle, MRT_TableHeadCellSortLabel, MRT_TableHeadRow, MRT_TablePagination, MRT_TablePaper, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleFullScreenButton, MRT_ToggleGlobalFilterButton, MRT_ToggleRowActionMenuButton, MRT_ToolbarAlertBanner, MRT_ToolbarDropZone, MRT_ToolbarInternalButtons, MRT_TopToolbar, MaterialReactTable, Memo_MRT_TableBody, Memo_MRT_TableBodyCell, Memo_MRT_TableBodyRow, commonListItemStyles, commonMenuItemStyles, commonToolbarStyles, createRow, flexRender, getAllLeafColumnDefs, getCanRankRows, getColumnId, getCommonCellStyles, getDefaultColumnFilterFn, getDefaultColumnOrderIds, getIsFirstColumn, getIsFirstRightPinnedColumn, getIsLastColumn, getIsLastLeftPinnedColumn, getLeadingDisplayColumnIds, getTotalRight, getTrailingDisplayColumnIds, mrtFilterOptions, parseCSSVarId, parseFromValuesOrFunc, prepareColumns, rankGlobalFuzzy, reorderColumn, showExpandColumn, useMaterialReactTable };
|
3519
|
+
export { MRT_AggregationFns, MRT_BottomToolbar, MRT_ColumnActionMenu, MRT_ColumnPinningButtons, MRT_CopyButton, MRT_DefaultColumn, MRT_DefaultDisplayColumn, MRT_EditActionButtons, MRT_EditCellTextField, MRT_EditRowModal, MRT_ExpandAllButton, MRT_ExpandButton, MRT_FilterCheckbox, MRT_FilterFns, MRT_FilterOptionMenu, MRT_FilterRangeFields, MRT_FilterRangeSlider, MRT_FilterTextField, MRT_GlobalFilterTextField, MRT_GrabHandleButton, MRT_LinearProgressBar, MRT_RowActionMenu, MRT_RowPinButton, MRT_SelectCheckbox, MRT_ShowHideColumnsButton, MRT_ShowHideColumnsMenu, MRT_ShowHideColumnsMenuItems, MRT_SortingFns, MRT_Table, MRT_TableBody, MRT_TableBodyCell, MRT_TableBodyCellValue, MRT_TableBodyRow, MRT_TableBodyRowGrabHandle, MRT_TableBodyRowPinButton, MRT_TableContainer, MRT_TableDetailPanel, MRT_TableFooter, MRT_TableFooterCell, MRT_TableFooterRow, MRT_TableHead, MRT_TableHeadCell, MRT_TableHeadCellColumnActionsButton, MRT_TableHeadCellFilterContainer, MRT_TableHeadCellFilterLabel, MRT_TableHeadCellGrabHandle, MRT_TableHeadCellResizeHandle, MRT_TableHeadCellSortLabel, MRT_TableHeadRow, MRT_TablePagination, MRT_TablePaper, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleFullScreenButton, MRT_ToggleGlobalFilterButton, MRT_ToggleRowActionMenuButton, MRT_ToolbarAlertBanner, MRT_ToolbarDropZone, MRT_ToolbarInternalButtons, MRT_TopToolbar, MaterialReactTable, Memo_MRT_TableBody, Memo_MRT_TableBodyCell, Memo_MRT_TableBodyRow, commonListItemStyles, commonMenuItemStyles, commonToolbarStyles, createRow, extraIndexRangeExtractor, flexRender, getAllLeafColumnDefs, getCanRankRows, getColumnId, getCommonCellStyles, getDefaultColumnFilterFn, getDefaultColumnOrderIds, getIsFirstColumn, getIsFirstRightPinnedColumn, getIsLastColumn, getIsLastLeftPinnedColumn, getLeadingDisplayColumnIds, getTotalRight, getTrailingDisplayColumnIds, mrtFilterOptions, parseCSSVarId, parseFromValuesOrFunc, prepareColumns, rankGlobalFuzzy, reorderColumn, showExpandColumn, useMaterialReactTable };
|
3468
3520
|
//# sourceMappingURL=material-react-table.esm.js.map
|