material-react-table 1.4.0-beta.4 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +4 -2
- package/dist/cjs/index.js +30 -598
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/MaterialReactTable.d.ts +6 -2
- package/dist/cjs/types/body/MRT_TableDetailPanel.d.ts +4 -1
- package/dist/cjs/types/index.d.ts +3 -1
- package/dist/cjs/types/table/MRT_TableRoot.d.ts +3 -2
- package/dist/cjs/types/toolbar/MRT_ToolbarAlertBanner.d.ts +4 -4
- package/dist/cjs/types/toolbar/MRT_ToolbarDropZone.d.ts +4 -4
- package/dist/esm/material-react-table.esm.js +333 -885
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/types/MaterialReactTable.d.ts +6 -2
- package/dist/esm/types/body/MRT_TableDetailPanel.d.ts +4 -1
- package/dist/esm/types/index.d.ts +3 -1
- package/dist/esm/types/table/MRT_TableRoot.d.ts +3 -2
- package/dist/esm/types/toolbar/MRT_ToolbarAlertBanner.d.ts +4 -4
- package/dist/esm/types/toolbar/MRT_ToolbarDropZone.d.ts +4 -4
- package/dist/index.d.ts +33 -18
- package/locales/nl.esm.js +1 -1
- package/locales/nl.esm.js.map +1 -1
- package/locales/nl.js +1 -1
- package/locales/nl.js.map +1 -1
- package/locales/ru.esm.js +3 -3
- package/locales/ru.esm.js.map +1 -1
- package/locales/ru.js +3 -3
- package/locales/ru.js.map +1 -1
- package/package.json +10 -10
- package/src/MaterialReactTable.tsx +11 -3
- package/src/_locales/nl.ts +1 -1
- package/src/_locales/ru.ts +3 -3
- package/src/body/MRT_TableBody.tsx +1 -1
- package/src/body/MRT_TableBodyRow.tsx +6 -1
- package/src/body/MRT_TableDetailPanel.tsx +32 -5
- package/src/head/MRT_TableHead.tsx +2 -8
- package/src/index.tsx +4 -0
- package/src/table/MRT_Table.tsx +2 -6
- package/src/table/MRT_TableContainer.tsx +4 -9
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +5 -5
- package/src/toolbar/MRT_ToolbarDropZone.tsx +6 -4
@@ -1,5 +1,4 @@
|
|
1
|
-
import
|
2
|
-
import React__default, { useMemo, useRef, useState, useCallback, useEffect, Fragment, memo as memo$1, useLayoutEffect } from 'react';
|
1
|
+
import React, { useMemo, useRef, useState, useCallback, useEffect, Fragment, memo, useLayoutEffect } from 'react';
|
3
2
|
import { aggregationFns, filterFns, sortingFns, useReactTable, getCoreRowModel, getExpandedRowModel, getFacetedRowModel, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel } from '@tanstack/react-table';
|
4
3
|
import { alpha, lighten, useTheme, darken } from '@mui/material/styles';
|
5
4
|
import { rankItem, rankings, compareItems } from '@tanstack/match-sorter-utils';
|
@@ -68,6 +67,7 @@ import TableHead from '@mui/material/TableHead';
|
|
68
67
|
import TableRow from '@mui/material/TableRow';
|
69
68
|
import TableCell from '@mui/material/TableCell';
|
70
69
|
import TableSortLabel from '@mui/material/TableSortLabel';
|
70
|
+
import { useVirtualizer } from '@tanstack/react-virtual';
|
71
71
|
import TableBody from '@mui/material/TableBody';
|
72
72
|
import Skeleton from '@mui/material/Skeleton';
|
73
73
|
import TableFooter from '@mui/material/TableFooter';
|
@@ -411,14 +411,14 @@ const MRT_ExpandAllButton = ({ table }) => {
|
|
411
411
|
? muiExpandAllButtonProps({ table })
|
412
412
|
: muiExpandAllButtonProps;
|
413
413
|
const isAllRowsExpanded = getIsAllRowsExpanded();
|
414
|
-
return (
|
414
|
+
return (React.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: ((_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : isAllRowsExpanded)
|
415
415
|
? localization.collapseAll
|
416
416
|
: localization.expandAll },
|
417
|
-
|
418
|
-
|
417
|
+
React.createElement("span", null,
|
418
|
+
React.createElement(IconButton, Object.assign({ "aria-label": localization.expandAll, disabled: isLoading || (!renderDetailPanel && !getCanSomeRowsExpand()), onClick: () => toggleAllRowsExpanded(!isAllRowsExpanded) }, iconButtonProps, { sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', width: density === 'compact' ? '1.75rem' : '2.25rem', mt: density !== 'compact' ? '-0.25rem' : undefined }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
|
419
419
|
? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
|
420
420
|
: iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined }),
|
421
|
-
|
421
|
+
React.createElement(KeyboardDoubleArrowDownIcon, { style: {
|
422
422
|
transform: `rotate(${isAllRowsExpanded ? -180 : getIsSomeRowsExpanded() ? -90 : 0}deg)`,
|
423
423
|
transition: 'transform 150ms',
|
424
424
|
} })))));
|
@@ -439,14 +439,14 @@ const MRT_ExpandButton = ({ row, table }) => {
|
|
439
439
|
row.toggleExpanded();
|
440
440
|
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
441
441
|
};
|
442
|
-
return (
|
442
|
+
return (React.createElement(Tooltip, { arrow: true, disableHoverListener: !canExpand && !renderDetailPanel, enterDelay: 1000, enterNextDelay: 1000, title: ((_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : isExpanded)
|
443
443
|
? localization.collapse
|
444
444
|
: localization.expand },
|
445
|
-
|
446
|
-
|
445
|
+
React.createElement("span", null,
|
446
|
+
React.createElement(IconButton, Object.assign({ "aria-label": localization.expand, disabled: !canExpand && !renderDetailPanel }, iconButtonProps, { onClick: handleToggleExpand, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', width: density === 'compact' ? '1.75rem' : '2.25rem' }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
|
447
447
|
? iconButtonProps.sx(theme)
|
448
448
|
: iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined }),
|
449
|
-
|
449
|
+
React.createElement(ExpandMoreIcon, { style: {
|
450
450
|
transform: `rotate(${!canExpand && !renderDetailPanel ? -90 : isExpanded ? -180 : 0}deg)`,
|
451
451
|
transition: 'transform 150ms',
|
452
452
|
} })))));
|
@@ -579,7 +579,7 @@ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilt
|
|
579
579
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect();
|
580
580
|
};
|
581
581
|
const filterOption = !!header && columnDef ? columnDef._filterFn : globalFilterFn;
|
582
|
-
return (
|
582
|
+
return (React.createElement(Menu, { anchorEl: anchorEl, anchorOrigin: { vertical: 'center', horizontal: 'right' }, onClose: () => setAnchorEl(null), open: !!anchorEl, MenuListProps: {
|
583
583
|
dense: density === 'compact',
|
584
584
|
} }, (_d = (header && column && columnDef
|
585
585
|
? (_c = (_b = columnDef.renderColumnFilterModeMenuItems) === null || _b === void 0 ? void 0 : _b.call(columnDef, {
|
@@ -597,14 +597,14 @@ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilt
|
|
597
597
|
internalFilterOptions,
|
598
598
|
onSelectFilterMode: handleSelectFilterMode,
|
599
599
|
table,
|
600
|
-
}))) !== null && _d !== void 0 ? _d : internalFilterOptions.map(({ option, label, divider, symbol }, index) => (
|
600
|
+
}))) !== null && _d !== void 0 ? _d : internalFilterOptions.map(({ option, label, divider, symbol }, index) => (React.createElement(MenuItem, { divider: divider, key: index, onClick: () => handleSelectFilterMode(option), selected: option === filterOption, sx: {
|
601
601
|
alignItems: 'center',
|
602
602
|
display: 'flex',
|
603
603
|
gap: '2ch',
|
604
604
|
my: 0,
|
605
605
|
py: '6px',
|
606
606
|
}, value: option },
|
607
|
-
|
607
|
+
React.createElement(Box, { sx: { fontSize: '1.25rem', width: '2ch' } }, symbol),
|
608
608
|
label)))));
|
609
609
|
};
|
610
610
|
|
@@ -613,17 +613,17 @@ const MRT_ColumnPinningButtons = ({ column, table, }) => {
|
|
613
613
|
const handlePinColumn = (pinDirection) => {
|
614
614
|
column.pin(pinDirection);
|
615
615
|
};
|
616
|
-
return (
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
616
|
+
return (React.createElement(Box, { sx: { minWidth: '70px', textAlign: 'center' } }, column.getIsPinned() ? (React.createElement(Tooltip, { arrow: true, title: localization.unpin },
|
617
|
+
React.createElement(IconButton, { onClick: () => handlePinColumn(false), size: "small" },
|
618
|
+
React.createElement(PushPinIcon, null)))) : (React.createElement(React.Fragment, null,
|
619
|
+
React.createElement(Tooltip, { arrow: true, title: localization.pinToLeft },
|
620
|
+
React.createElement(IconButton, { onClick: () => handlePinColumn('left'), size: "small" },
|
621
|
+
React.createElement(PushPinIcon, { style: {
|
622
622
|
transform: 'rotate(90deg)',
|
623
623
|
} }))),
|
624
|
-
|
625
|
-
|
626
|
-
|
624
|
+
React.createElement(Tooltip, { arrow: true, title: localization.pinToRight },
|
625
|
+
React.createElement(IconButton, { onClick: () => handlePinColumn('right'), size: "small" },
|
626
|
+
React.createElement(PushPinIcon, { style: {
|
627
627
|
transform: 'rotate(-90deg)',
|
628
628
|
} })))))));
|
629
629
|
};
|
@@ -631,8 +631,8 @@ const MRT_ColumnPinningButtons = ({ column, table, }) => {
|
|
631
631
|
const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table, }) => {
|
632
632
|
var _a;
|
633
633
|
const { options: { icons: { DragHandleIcon }, localization, }, } = table;
|
634
|
-
return (
|
635
|
-
|
634
|
+
return (React.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : localization.move },
|
635
|
+
React.createElement(IconButton, Object.assign({ disableRipple: true, draggable: "true", size: "small" }, iconButtonProps, { onClick: (e) => {
|
636
636
|
var _a;
|
637
637
|
e.stopPropagation();
|
638
638
|
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, e);
|
@@ -644,7 +644,7 @@ const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table,
|
|
644
644
|
} }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
|
645
645
|
? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
|
646
646
|
: iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined }),
|
647
|
-
|
647
|
+
React.createElement(DragHandleIcon, null))));
|
648
648
|
};
|
649
649
|
|
650
650
|
const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredColumn, column, isSubMenu, table, }) => {
|
@@ -685,8 +685,8 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredCol
|
|
685
685
|
setHoveredColumn(column);
|
686
686
|
}
|
687
687
|
};
|
688
|
-
return (
|
689
|
-
|
688
|
+
return (React.createElement(React.Fragment, null,
|
689
|
+
React.createElement(MenuItem, { disableRipple: true, ref: menuItemRef, onDragEnter: handleDragEnter, sx: (theme) => ({
|
690
690
|
alignItems: 'center',
|
691
691
|
justifyContent: 'flex-start',
|
692
692
|
my: 0,
|
@@ -699,7 +699,7 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredCol
|
|
699
699
|
pl: `${(column.depth + 0.5) * 2}rem`,
|
700
700
|
py: '6px',
|
701
701
|
}) },
|
702
|
-
|
702
|
+
React.createElement(Box, { sx: {
|
703
703
|
display: 'flex',
|
704
704
|
flexWrap: 'nowrap',
|
705
705
|
gap: '8px',
|
@@ -708,20 +708,20 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredCol
|
|
708
708
|
columnDefType !== 'group' &&
|
709
709
|
enableColumnOrdering &&
|
710
710
|
!allColumns.some((col) => col.columnDef.columnDefType === 'group') &&
|
711
|
-
(columnDef.enableColumnOrdering !== false ? (
|
711
|
+
(columnDef.enableColumnOrdering !== false ? (React.createElement(MRT_GrabHandleButton, { onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table })) : (React.createElement(Box, { sx: { width: '28px' } }))),
|
712
712
|
!isSubMenu &&
|
713
713
|
enablePinning &&
|
714
|
-
(column.getCanPin() ? (
|
715
|
-
enableHiding ? (
|
714
|
+
(column.getCanPin() ? (React.createElement(MRT_ColumnPinningButtons, { column: column, table: table })) : (React.createElement(Box, { sx: { width: '70px' } }))),
|
715
|
+
enableHiding ? (React.createElement(FormControlLabel, { componentsProps: {
|
716
716
|
typography: {
|
717
717
|
sx: {
|
718
718
|
mb: 0,
|
719
719
|
opacity: columnDefType !== 'display' ? 1 : 0.5,
|
720
720
|
},
|
721
721
|
},
|
722
|
-
}, checked: switchChecked, control:
|
723
|
-
|
724
|
-
_a.map((c, i) => (
|
722
|
+
}, checked: switchChecked, control: React.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.toggleVisibility },
|
723
|
+
React.createElement(Switch, null)), disabled: (isSubMenu && switchChecked) || !column.getCanHide(), label: columnDef.header, onChange: () => handleToggleColumnHidden(column) })) : (React.createElement(Typography, { sx: { alignSelf: 'center' } }, columnDef.header)))), (_a = column.columns) === null || _a === void 0 ? void 0 :
|
724
|
+
_a.map((c, i) => (React.createElement(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: c, hoveredColumn: hoveredColumn, isSubMenu: isSubMenu, key: `${i}-${c.id}`, setHoveredColumn: setHoveredColumn, table: table })))));
|
725
725
|
};
|
726
726
|
|
727
727
|
const MRT_ShowHideColumnsMenu = ({ anchorEl, isSubMenu, setAnchorEl, table, }) => {
|
@@ -752,21 +752,21 @@ const MRT_ShowHideColumnsMenu = ({ anchorEl, isSubMenu, setAnchorEl, table, }) =
|
|
752
752
|
getRightLeafColumns(),
|
753
753
|
]);
|
754
754
|
const [hoveredColumn, setHoveredColumn] = useState(null);
|
755
|
-
return (
|
755
|
+
return (React.createElement(Menu, { anchorEl: anchorEl, open: !!anchorEl, onClose: () => setAnchorEl(null), MenuListProps: {
|
756
756
|
dense: density === 'compact',
|
757
757
|
} },
|
758
|
-
|
758
|
+
React.createElement(Box, { sx: {
|
759
759
|
display: 'flex',
|
760
760
|
justifyContent: isSubMenu ? 'center' : 'space-between',
|
761
761
|
p: '0.5rem',
|
762
762
|
pt: 0,
|
763
763
|
} },
|
764
|
-
!isSubMenu && enableHiding && (
|
765
|
-
!isSubMenu && enableColumnOrdering && (
|
766
|
-
!isSubMenu && enablePinning && (
|
767
|
-
enableHiding && (
|
768
|
-
|
769
|
-
allColumns.map((column, index) => (
|
764
|
+
!isSubMenu && enableHiding && (React.createElement(Button, { disabled: !getIsSomeColumnsVisible(), onClick: hideAllColumns }, localization.hideAll)),
|
765
|
+
!isSubMenu && enableColumnOrdering && (React.createElement(Button, { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options)) }, localization.resetOrder)),
|
766
|
+
!isSubMenu && enablePinning && (React.createElement(Button, { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true) }, localization.unpinAll)),
|
767
|
+
enableHiding && (React.createElement(Button, { disabled: getIsAllColumnsVisible(), onClick: () => toggleAllColumnsVisible(true) }, localization.showAll))),
|
768
|
+
React.createElement(Divider, null),
|
769
|
+
allColumns.map((column, index) => (React.createElement(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, isSubMenu: isSubMenu, key: `${index}-${column.id}`, setHoveredColumn: setHoveredColumn, table: table })))));
|
770
770
|
};
|
771
771
|
|
772
772
|
const commonMenuItemStyles = {
|
@@ -844,7 +844,7 @@ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
|
|
844
844
|
!isSelectFilter &&
|
845
845
|
(allowedColumnFilterOptions === undefined ||
|
846
846
|
!!(allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions.length));
|
847
|
-
return (
|
847
|
+
return (React.createElement(Menu, { anchorEl: anchorEl, open: !!anchorEl, onClose: () => setAnchorEl(null), MenuListProps: {
|
848
848
|
dense: density === 'compact',
|
849
849
|
} }, (_d = (_c = (_b = columnDef.renderColumnActionsMenuItems) === null || _b === void 0 ? void 0 : _b.call(columnDef, {
|
850
850
|
closeMenu: () => setAnchorEl(null),
|
@@ -856,101 +856,101 @@ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
|
|
856
856
|
table,
|
857
857
|
})) !== null && _d !== void 0 ? _d : (enableSorting &&
|
858
858
|
column.getCanSort() && [
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
859
|
+
React.createElement(MenuItem, { disabled: !column.getIsSorted(), key: 0, onClick: handleClearSort, sx: commonMenuItemStyles },
|
860
|
+
React.createElement(Box, { sx: commonListItemStyles },
|
861
|
+
React.createElement(ListItemIcon, null,
|
862
|
+
React.createElement(ClearAllIcon, null)),
|
863
863
|
localization.clearSort)),
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
864
|
+
React.createElement(MenuItem, { disabled: column.getIsSorted() === 'asc', key: 1, onClick: handleSortAsc, sx: commonMenuItemStyles },
|
865
|
+
React.createElement(Box, { sx: commonListItemStyles },
|
866
|
+
React.createElement(ListItemIcon, null,
|
867
|
+
React.createElement(SortIcon, { style: { transform: 'rotate(180deg) scaleX(-1)' } })), (_e = localization.sortByColumnAsc) === null || _e === void 0 ? void 0 :
|
868
868
|
_e.replace('{column}', String(columnDef.header)))),
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
869
|
+
React.createElement(MenuItem, { divider: enableColumnFilters || enableGrouping || enableHiding, key: 2, disabled: column.getIsSorted() === 'desc', onClick: handleSortDesc, sx: commonMenuItemStyles },
|
870
|
+
React.createElement(Box, { sx: commonListItemStyles },
|
871
|
+
React.createElement(ListItemIcon, null,
|
872
|
+
React.createElement(SortIcon, null)), (_f = localization.sortByColumnDesc) === null || _f === void 0 ? void 0 :
|
873
873
|
_f.replace('{column}', String(columnDef.header)))),
|
874
874
|
]),
|
875
875
|
enableColumnFilters &&
|
876
876
|
column.getCanFilter() &&
|
877
877
|
[
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
878
|
+
React.createElement(MenuItem, { disabled: !column.getFilterValue(), key: 0, onClick: handleClearFilter, sx: commonMenuItemStyles },
|
879
|
+
React.createElement(Box, { sx: commonListItemStyles },
|
880
|
+
React.createElement(ListItemIcon, null,
|
881
|
+
React.createElement(FilterListOffIcon, null)),
|
882
882
|
localization.clearFilter)),
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
883
|
+
React.createElement(MenuItem, { divider: enableGrouping || enableHiding, key: 1, onClick: handleFilterByColumn, sx: commonMenuItemStyles },
|
884
|
+
React.createElement(Box, { sx: commonListItemStyles },
|
885
|
+
React.createElement(ListItemIcon, null,
|
886
|
+
React.createElement(FilterListIcon, null)), (_g = localization.filterByColumn) === null || _g === void 0 ? void 0 :
|
887
887
|
_g.replace('{column}', String(columnDef.header))),
|
888
|
-
showFilterModeSubMenu && (
|
889
|
-
|
890
|
-
showFilterModeSubMenu && (
|
888
|
+
showFilterModeSubMenu && (React.createElement(IconButton, { onClick: handleOpenFilterModeMenu, onMouseEnter: handleOpenFilterModeMenu, size: "small", sx: { p: 0 } },
|
889
|
+
React.createElement(ArrowRightIcon, null)))),
|
890
|
+
showFilterModeSubMenu && (React.createElement(MRT_FilterOptionMenu, { anchorEl: filterMenuAnchorEl, header: header, key: 2, onSelect: handleFilterByColumn, setAnchorEl: setFilterMenuAnchorEl, table: table })),
|
891
891
|
].filter(Boolean),
|
892
892
|
enableGrouping &&
|
893
893
|
column.getCanGroup() && [
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
894
|
+
React.createElement(MenuItem, { divider: enablePinning, key: 0, onClick: handleGroupByColumn, sx: commonMenuItemStyles },
|
895
|
+
React.createElement(Box, { sx: commonListItemStyles },
|
896
|
+
React.createElement(ListItemIcon, null,
|
897
|
+
React.createElement(DynamicFeedIcon, null)), (_h = localization[column.getIsGrouped() ? 'ungroupByColumn' : 'groupByColumn']) === null || _h === void 0 ? void 0 :
|
898
898
|
_h.replace('{column}', String(columnDef.header)))),
|
899
899
|
],
|
900
900
|
enablePinning &&
|
901
901
|
column.getCanPin() && [
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
902
|
+
React.createElement(MenuItem, { disabled: column.getIsPinned() === 'left' || !column.getCanPin(), key: 0, onClick: () => handlePinColumn('left'), sx: commonMenuItemStyles },
|
903
|
+
React.createElement(Box, { sx: commonListItemStyles },
|
904
|
+
React.createElement(ListItemIcon, null,
|
905
|
+
React.createElement(PushPinIcon, { style: { transform: 'rotate(90deg)' } })),
|
906
906
|
localization.pinToLeft)),
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
907
|
+
React.createElement(MenuItem, { disabled: column.getIsPinned() === 'right' || !column.getCanPin(), key: 1, onClick: () => handlePinColumn('right'), sx: commonMenuItemStyles },
|
908
|
+
React.createElement(Box, { sx: commonListItemStyles },
|
909
|
+
React.createElement(ListItemIcon, null,
|
910
|
+
React.createElement(PushPinIcon, { style: { transform: 'rotate(-90deg)' } })),
|
911
911
|
localization.pinToRight)),
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
912
|
+
React.createElement(MenuItem, { disabled: !column.getIsPinned(), divider: enableHiding, key: 2, onClick: () => handlePinColumn(false), sx: commonMenuItemStyles },
|
913
|
+
React.createElement(Box, { sx: commonListItemStyles },
|
914
|
+
React.createElement(ListItemIcon, null,
|
915
|
+
React.createElement(PushPinIcon, null)),
|
916
916
|
localization.unpin)),
|
917
917
|
],
|
918
918
|
enableColumnResizing &&
|
919
919
|
column.getCanResize() && [
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
920
|
+
React.createElement(MenuItem, { disabled: !columnSizing[column.id], key: 0, onClick: handleResetColumnSize, sx: commonMenuItemStyles },
|
921
|
+
React.createElement(Box, { sx: commonListItemStyles },
|
922
|
+
React.createElement(ListItemIcon, null,
|
923
|
+
React.createElement(RestartAltIcon, null)),
|
924
924
|
localization.resetColumnSize)),
|
925
925
|
],
|
926
926
|
enableHiding && [
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
927
|
+
React.createElement(MenuItem, { disabled: !column.getCanHide(), key: 0, onClick: handleHideColumn, sx: commonMenuItemStyles },
|
928
|
+
React.createElement(Box, { sx: commonListItemStyles },
|
929
|
+
React.createElement(ListItemIcon, null,
|
930
|
+
React.createElement(VisibilityOffIcon, null)), (_j = localization.hideColumn) === null || _j === void 0 ? void 0 :
|
931
931
|
_j.replace('{column}', String(columnDef.header)))),
|
932
|
-
|
932
|
+
React.createElement(MenuItem, { disabled: !Object.values(columnVisibility).filter((visible) => !visible)
|
933
933
|
.length, key: 1, onClick: handleShowAllColumns, sx: commonMenuItemStyles },
|
934
|
-
|
935
|
-
|
936
|
-
|
934
|
+
React.createElement(Box, { sx: commonListItemStyles },
|
935
|
+
React.createElement(ListItemIcon, null,
|
936
|
+
React.createElement(ViewColumnIcon, null)), (_k = localization.showAllColumns) === null || _k === void 0 ? void 0 :
|
937
937
|
_k.replace('{column}', String(columnDef.header))),
|
938
|
-
|
939
|
-
|
940
|
-
|
938
|
+
React.createElement(IconButton, { onClick: handleOpenShowHideColumnsMenu, onMouseEnter: handleOpenShowHideColumnsMenu, size: "small", sx: { p: 0 } },
|
939
|
+
React.createElement(ArrowRightIcon, null))),
|
940
|
+
React.createElement(MRT_ShowHideColumnsMenu, { anchorEl: showHideColumnsMenuAnchorEl, isSubMenu: true, key: 2, setAnchorEl: setShowHideColumnsMenuAnchorEl, table: table }),
|
941
941
|
]));
|
942
942
|
};
|
943
943
|
|
944
944
|
const MRT_RowActionMenu = ({ anchorEl, handleEdit, row, setAnchorEl, table, }) => {
|
945
945
|
const { getState, options: { icons: { EditIcon }, enableEditing, localization, renderRowActionMenuItems, }, } = table;
|
946
946
|
const { density } = getState();
|
947
|
-
return (
|
947
|
+
return (React.createElement(Menu, { anchorEl: anchorEl, open: !!anchorEl, onClose: () => setAnchorEl(null), MenuListProps: {
|
948
948
|
dense: density === 'compact',
|
949
949
|
} },
|
950
|
-
enableEditing && (
|
951
|
-
|
952
|
-
|
953
|
-
|
950
|
+
enableEditing && (React.createElement(MenuItem, { onClick: handleEdit, sx: commonMenuItemStyles },
|
951
|
+
React.createElement(Box, { sx: commonListItemStyles },
|
952
|
+
React.createElement(ListItemIcon, null,
|
953
|
+
React.createElement(EditIcon, null)),
|
954
954
|
localization.edit))), renderRowActionMenuItems === null || renderRowActionMenuItems === void 0 ? void 0 :
|
955
955
|
renderRowActionMenuItems({
|
956
956
|
row,
|
@@ -983,15 +983,15 @@ const MRT_EditActionButtons = ({ row, table, variant = 'icon', }) => {
|
|
983
983
|
values: (_b = editingRow === null || editingRow === void 0 ? void 0 : editingRow._valuesCache) !== null && _b !== void 0 ? _b : Object.assign({}, row.original),
|
984
984
|
});
|
985
985
|
};
|
986
|
-
return (
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
986
|
+
return (React.createElement(Box, { onClick: (e) => e.stopPropagation(), sx: { display: 'flex', gap: '0.75rem' } }, variant === 'icon' ? (React.createElement(React.Fragment, null,
|
987
|
+
React.createElement(Tooltip, { arrow: true, title: localization.cancel },
|
988
|
+
React.createElement(IconButton, { "aria-label": localization.cancel, onClick: handleCancel },
|
989
|
+
React.createElement(CancelIcon, null))),
|
990
|
+
React.createElement(Tooltip, { arrow: true, title: localization.save },
|
991
|
+
React.createElement(IconButton, { "aria-label": localization.save, color: "info", onClick: handleSave },
|
992
|
+
React.createElement(SaveIcon, null))))) : (React.createElement(React.Fragment, null,
|
993
|
+
React.createElement(Button, { onClick: handleCancel }, localization.cancel),
|
994
|
+
React.createElement(Button, { onClick: handleSave, variant: "contained" }, localization.save)))));
|
995
995
|
};
|
996
996
|
|
997
997
|
const commonIconButtonStyles = {
|
@@ -1018,13 +1018,13 @@ const MRT_ToggleRowActionMenuButton = ({ cell, row, table, }) => {
|
|
1018
1018
|
setEditingRow(Object.assign({}, row));
|
1019
1019
|
setAnchorEl(null);
|
1020
1020
|
};
|
1021
|
-
return (
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1021
|
+
return (React.createElement(React.Fragment, null, renderRowActions ? (React.createElement(React.Fragment, null, renderRowActions({ cell, row, table }))) : row.id === (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) && editingMode === 'row' ? (React.createElement(MRT_EditActionButtons, { row: row, table: table })) : !renderRowActionMenuItems && enableEditing ? (React.createElement(Tooltip, { placement: "right", arrow: true, title: localization.edit },
|
1022
|
+
React.createElement(IconButton, { "aria-label": localization.edit, sx: commonIconButtonStyles, onClick: handleStartEditMode },
|
1023
|
+
React.createElement(EditIcon, null)))) : renderRowActionMenuItems ? (React.createElement(React.Fragment, null,
|
1024
|
+
React.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.rowActions },
|
1025
|
+
React.createElement(IconButton, { "aria-label": localization.rowActions, onClick: handleOpenRowActionMenu, size: "small", sx: commonIconButtonStyles },
|
1026
|
+
React.createElement(MoreHorizIcon, null))),
|
1027
|
+
React.createElement(MRT_RowActionMenu, { anchorEl: anchorEl, handleEdit: handleStartEditMode, row: row, setAnchorEl: setAnchorEl, table: table }))) : null));
|
1028
1028
|
};
|
1029
1029
|
|
1030
1030
|
const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
|
@@ -1057,9 +1057,9 @@ const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
|
|
1057
1057
|
}, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.5rem', width: density === 'compact' ? '1.75rem' : '2.5rem', m: density !== 'compact' ? '-0.4rem' : undefined }, ((checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx) instanceof Function
|
1058
1058
|
? checkboxProps.sx(theme)
|
1059
1059
|
: checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx))), title: undefined });
|
1060
|
-
return (
|
1060
|
+
return (React.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _a !== void 0 ? _a : (selectAll
|
1061
1061
|
? localization.toggleSelectAll
|
1062
|
-
: localization.toggleSelectRow) }, enableMultiRowSelection === false ? (
|
1062
|
+
: localization.toggleSelectRow) }, enableMultiRowSelection === false ? (React.createElement(Radio, Object.assign({}, commonProps))) : (React.createElement(Checkbox, Object.assign({ indeterminate: selectAll
|
1063
1063
|
? table.getIsSomeRowsSelected() &&
|
1064
1064
|
!(selectAllMode === 'page'
|
1065
1065
|
? table.getIsAllPageRowsSelected()
|
@@ -1096,24 +1096,24 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
1096
1096
|
handleClear();
|
1097
1097
|
}
|
1098
1098
|
}, [globalFilter]);
|
1099
|
-
return (
|
1100
|
-
|
1101
|
-
startAdornment: enableGlobalFilterModes ? (
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
endAdornment: (
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1099
|
+
return (React.createElement(Collapse, { in: showGlobalFilter, orientation: "horizontal", unmountOnExit: true, mountOnEnter: true },
|
1100
|
+
React.createElement(TextField, Object.assign({ placeholder: localization.search, onChange: handleChange, value: searchValue !== null && searchValue !== void 0 ? searchValue : '', variant: "standard", InputProps: {
|
1101
|
+
startAdornment: enableGlobalFilterModes ? (React.createElement(InputAdornment, { position: "start" },
|
1102
|
+
React.createElement(Tooltip, { arrow: true, title: localization.changeSearchMode },
|
1103
|
+
React.createElement(IconButton, { "aria-label": localization.changeSearchMode, onClick: handleGlobalFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' } },
|
1104
|
+
React.createElement(SearchIcon, null))))) : (React.createElement(SearchIcon, { style: { marginRight: '4px' } })),
|
1105
|
+
endAdornment: (React.createElement(InputAdornment, { position: "end" },
|
1106
|
+
React.createElement(Tooltip, { arrow: true, title: (_a = localization.clearSearch) !== null && _a !== void 0 ? _a : '' },
|
1107
|
+
React.createElement("span", null,
|
1108
|
+
React.createElement(IconButton, { "aria-label": localization.clearSearch, disabled: !(searchValue === null || searchValue === void 0 ? void 0 : searchValue.length), onClick: handleClear, size: "small" },
|
1109
|
+
React.createElement(CloseIcon, null)))))),
|
1110
1110
|
} }, textFieldProps, { inputRef: (inputRef) => {
|
1111
1111
|
searchInputRef.current = inputRef;
|
1112
1112
|
if (textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.inputRef) {
|
1113
1113
|
textFieldProps.inputRef = inputRef;
|
1114
1114
|
}
|
1115
1115
|
} })),
|
1116
|
-
|
1116
|
+
React.createElement(MRT_FilterOptionMenu, { anchorEl: anchorEl, setAnchorEl: setAnchorEl, table: table, onSelect: handleClear })));
|
1117
1117
|
};
|
1118
1118
|
|
1119
1119
|
const MRT_LinearProgressBar = ({ isTopToolbar, table }) => {
|
@@ -1122,13 +1122,13 @@ const MRT_LinearProgressBar = ({ isTopToolbar, table }) => {
|
|
1122
1122
|
const linearProgressProps = muiLinearProgressProps instanceof Function
|
1123
1123
|
? muiLinearProgressProps({ isTopToolbar, table })
|
1124
1124
|
: muiLinearProgressProps;
|
1125
|
-
return (
|
1125
|
+
return (React.createElement(Collapse, { in: isLoading || showProgressBars, mountOnEnter: true, unmountOnExit: true, sx: {
|
1126
1126
|
bottom: isTopToolbar ? 0 : undefined,
|
1127
1127
|
position: 'absolute',
|
1128
1128
|
top: !isTopToolbar ? 0 : undefined,
|
1129
1129
|
width: '100%',
|
1130
1130
|
} },
|
1131
|
-
|
1131
|
+
React.createElement(LinearProgress, Object.assign({ "aria-label": "Loading", "aria-busy": "true", sx: { position: 'relative' } }, linearProgressProps))));
|
1132
1132
|
};
|
1133
1133
|
|
1134
1134
|
const MRT_TablePagination = ({ table, position, }) => {
|
@@ -1142,7 +1142,7 @@ const MRT_TablePagination = ({ table, position, }) => {
|
|
1142
1142
|
const handleChangeRowsPerPage = (event) => {
|
1143
1143
|
setPageSize(+event.target.value);
|
1144
1144
|
};
|
1145
|
-
return (
|
1145
|
+
return (React.createElement(TablePagination, Object.assign({ component: "div", count: totalRowCount, getItemAriaLabel: (type) => type === 'first'
|
1146
1146
|
? localization.goToFirstPage
|
1147
1147
|
: type === 'last'
|
1148
1148
|
? localization.goToLastPage
|
@@ -1183,26 +1183,26 @@ const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
|
|
1183
1183
|
const selectMessage = getSelectedRowModel().rows.length > 0
|
1184
1184
|
? (_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())
|
1185
1185
|
: null;
|
1186
|
-
const groupedByMessage = grouping.length > 0 ? (
|
1186
|
+
const groupedByMessage = grouping.length > 0 ? (React.createElement("span", null,
|
1187
1187
|
localization.groupedBy,
|
1188
1188
|
' ',
|
1189
|
-
grouping.map((columnId, index) => (
|
1189
|
+
grouping.map((columnId, index) => (React.createElement(Fragment, { key: `${index}-${columnId}` },
|
1190
1190
|
index > 0 ? localization.thenBy : '',
|
1191
|
-
|
1192
|
-
return (
|
1193
|
-
|
1191
|
+
React.createElement(Chip, Object.assign({ label: table.getColumn(columnId).columnDef.header, onDelete: () => table.getColumn(columnId).toggleGrouping() }, chipProps))))))) : null;
|
1192
|
+
return (React.createElement(Collapse, { in: showAlertBanner || !!selectMessage || !!groupedByMessage, timeout: stackAlertBanner ? 200 : 0 },
|
1193
|
+
React.createElement(Alert, Object.assign({ color: "info", icon: false }, alertProps, { sx: (theme) => (Object.assign({ borderRadius: 0, fontSize: '1rem', left: 0, p: 0, position: 'relative', mb: stackAlertBanner
|
1194
1194
|
? 0
|
1195
1195
|
: positionToolbarAlertBanner === 'bottom'
|
1196
1196
|
? '-1rem'
|
1197
1197
|
: undefined, right: 0, top: 0, width: '100%', zIndex: 2 }, ((alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx) instanceof Function
|
1198
1198
|
? alertProps.sx(theme)
|
1199
1199
|
: alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx))) }),
|
1200
|
-
(alertProps === null || alertProps === void 0 ? void 0 : alertProps.title) &&
|
1201
|
-
|
1200
|
+
(alertProps === null || alertProps === void 0 ? void 0 : alertProps.title) && React.createElement(AlertTitle, null, alertProps.title),
|
1201
|
+
React.createElement(Box, { sx: { p: '0.5rem 1rem' } }, alertProps === null || alertProps === void 0 ? void 0 :
|
1202
1202
|
alertProps.children,
|
1203
|
-
(alertProps === null || alertProps === void 0 ? void 0 : alertProps.children) && (selectMessage || groupedByMessage) && (
|
1203
|
+
(alertProps === null || alertProps === void 0 ? void 0 : alertProps.children) && (selectMessage || groupedByMessage) && (React.createElement("br", null)),
|
1204
1204
|
selectMessage,
|
1205
|
-
selectMessage && groupedByMessage &&
|
1205
|
+
selectMessage && groupedByMessage && React.createElement("br", null),
|
1206
1206
|
groupedByMessage))));
|
1207
1207
|
};
|
1208
1208
|
|
@@ -1214,8 +1214,8 @@ const MRT_FullScreenToggleButton = (_a) => {
|
|
1214
1214
|
const handleToggleFullScreen = () => {
|
1215
1215
|
setIsFullScreen(!isFullScreen);
|
1216
1216
|
};
|
1217
|
-
return (
|
1218
|
-
|
1217
|
+
return (React.createElement(Tooltip, { arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleFullScreen },
|
1218
|
+
React.createElement(IconButton, Object.assign({ "aria-label": localization.showHideFilters, onClick: handleToggleFullScreen }, rest, { title: undefined }), isFullScreen ? React.createElement(FullscreenExitIcon, null) : React.createElement(FullscreenIcon, null))));
|
1219
1219
|
};
|
1220
1220
|
|
1221
1221
|
const MRT_ShowHideColumnsButton = (_a) => {
|
@@ -1226,11 +1226,11 @@ const MRT_ShowHideColumnsButton = (_a) => {
|
|
1226
1226
|
const handleClick = (event) => {
|
1227
1227
|
setAnchorEl(event.currentTarget);
|
1228
1228
|
};
|
1229
|
-
return (
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1229
|
+
return (React.createElement(React.Fragment, null,
|
1230
|
+
React.createElement(Tooltip, { arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.showHideColumns },
|
1231
|
+
React.createElement(IconButton, Object.assign({ "aria-label": localization.showHideColumns, onClick: handleClick }, rest, { title: undefined }),
|
1232
|
+
React.createElement(ViewColumnIcon, null))),
|
1233
|
+
React.createElement(MRT_ShowHideColumnsMenu, { anchorEl: anchorEl, setAnchorEl: setAnchorEl, table: table })));
|
1234
1234
|
};
|
1235
1235
|
|
1236
1236
|
const MRT_ToggleDensePaddingButton = (_a) => {
|
@@ -1246,8 +1246,8 @@ const MRT_ToggleDensePaddingButton = (_a) => {
|
|
1246
1246
|
: 'comfortable';
|
1247
1247
|
setDensity(nextDensity);
|
1248
1248
|
};
|
1249
|
-
return (
|
1250
|
-
|
1249
|
+
return (React.createElement(Tooltip, { arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleDensity },
|
1250
|
+
React.createElement(IconButton, Object.assign({ "aria-label": localization.toggleDensity, onClick: handleToggleDensePadding }, rest, { title: undefined }), density === 'compact' ? (React.createElement(DensitySmallIcon, null)) : density === 'comfortable' ? (React.createElement(DensityMediumIcon, null)) : (React.createElement(DensityLargeIcon, null)))));
|
1251
1251
|
};
|
1252
1252
|
|
1253
1253
|
const MRT_ToggleFiltersButton = (_a) => {
|
@@ -1258,8 +1258,8 @@ const MRT_ToggleFiltersButton = (_a) => {
|
|
1258
1258
|
const handleToggleShowFilters = () => {
|
1259
1259
|
setShowFilters(!showColumnFilters);
|
1260
1260
|
};
|
1261
|
-
return (
|
1262
|
-
|
1261
|
+
return (React.createElement(Tooltip, { arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.showHideFilters },
|
1262
|
+
React.createElement(IconButton, Object.assign({ "aria-label": localization.showHideFilters, onClick: handleToggleShowFilters }, rest, { title: undefined }), showColumnFilters ? React.createElement(FilterListOffIcon, null) : React.createElement(FilterListIcon, null))));
|
1263
1263
|
};
|
1264
1264
|
|
1265
1265
|
const MRT_ToggleGlobalFilterButton = (_a) => {
|
@@ -1271,40 +1271,40 @@ const MRT_ToggleGlobalFilterButton = (_a) => {
|
|
1271
1271
|
setShowGlobalFilter(!showGlobalFilter);
|
1272
1272
|
queueMicrotask(() => { var _a; return (_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); });
|
1273
1273
|
};
|
1274
|
-
return (
|
1275
|
-
|
1274
|
+
return (React.createElement(Tooltip, { arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.showHideSearch },
|
1275
|
+
React.createElement(IconButton, Object.assign({ disabled: !!globalFilter, onClick: handleToggleSearch }, rest, { title: undefined }), showGlobalFilter ? React.createElement(SearchOffIcon, null) : React.createElement(SearchIcon, null))));
|
1276
1276
|
};
|
1277
1277
|
|
1278
1278
|
const MRT_ToolbarInternalButtons = ({ table, }) => {
|
1279
1279
|
var _a;
|
1280
1280
|
const { options: { enableColumnFilters, enableColumnOrdering, enableDensityToggle, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, enablePinning, initialState, renderToolbarInternalActions, }, } = table;
|
1281
|
-
return (
|
1281
|
+
return (React.createElement(Box, { sx: {
|
1282
1282
|
alignItems: 'center',
|
1283
1283
|
display: 'flex',
|
1284
1284
|
zIndex: 3,
|
1285
1285
|
} }, (_a = renderToolbarInternalActions === null || renderToolbarInternalActions === void 0 ? void 0 : renderToolbarInternalActions({
|
1286
1286
|
table,
|
1287
|
-
})) !== null && _a !== void 0 ? _a : (
|
1287
|
+
})) !== null && _a !== void 0 ? _a : (React.createElement(React.Fragment, null,
|
1288
1288
|
enableFilters &&
|
1289
1289
|
enableGlobalFilter &&
|
1290
|
-
!(initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) && (
|
1291
|
-
enableFilters && enableColumnFilters && (
|
1292
|
-
(enableHiding || enableColumnOrdering || enablePinning) && (
|
1293
|
-
enableDensityToggle && (
|
1294
|
-
enableFullScreenToggle && (
|
1290
|
+
!(initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) && (React.createElement(MRT_ToggleGlobalFilterButton, { table: table })),
|
1291
|
+
enableFilters && enableColumnFilters && (React.createElement(MRT_ToggleFiltersButton, { table: table })),
|
1292
|
+
(enableHiding || enableColumnOrdering || enablePinning) && (React.createElement(MRT_ShowHideColumnsButton, { table: table })),
|
1293
|
+
enableDensityToggle && (React.createElement(MRT_ToggleDensePaddingButton, { table: table })),
|
1294
|
+
enableFullScreenToggle && (React.createElement(MRT_FullScreenToggleButton, { table: table }))))));
|
1295
1295
|
};
|
1296
1296
|
|
1297
|
-
const MRT_ToolbarDropZone = ({ table }) => {
|
1297
|
+
const MRT_ToolbarDropZone = ({ table, }) => {
|
1298
1298
|
var _a, _b;
|
1299
1299
|
const { getState, options: { enableGrouping, localization }, setHoveredColumn, } = table;
|
1300
1300
|
const { draggingColumn, hoveredColumn, grouping } = getState();
|
1301
1301
|
const handleDragEnter = (_event) => {
|
1302
1302
|
setHoveredColumn({ id: 'drop-zone' });
|
1303
1303
|
};
|
1304
|
-
return (
|
1304
|
+
return (React.createElement(Fade, { unmountOnExit: true, mountOnEnter: true, in: !!enableGrouping &&
|
1305
1305
|
!!draggingColumn &&
|
1306
1306
|
!grouping.includes(draggingColumn.id) },
|
1307
|
-
|
1307
|
+
React.createElement(Box, { sx: (theme) => ({
|
1308
1308
|
alignItems: 'center',
|
1309
1309
|
backgroundColor: alpha(theme.palette.info.main, (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone' ? 0.2 : 0.1),
|
1310
1310
|
border: `dashed ${theme.palette.info.main} 2px`,
|
@@ -1315,7 +1315,7 @@ const MRT_ToolbarDropZone = ({ table }) => {
|
|
1315
1315
|
width: 'calc(100% - 4px)',
|
1316
1316
|
zIndex: 2,
|
1317
1317
|
}), onDragEnter: handleDragEnter },
|
1318
|
-
|
1318
|
+
React.createElement(Typography, null, 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 : '')))));
|
1319
1319
|
};
|
1320
1320
|
|
1321
1321
|
const commonToolbarStyles = ({ theme }) => ({
|
@@ -1339,7 +1339,7 @@ const MRT_TopToolbar = ({ table }) => {
|
|
1339
1339
|
? muiTopToolbarProps({ table })
|
1340
1340
|
: muiTopToolbarProps;
|
1341
1341
|
const stackAlertBanner = isMobile || !!renderTopToolbarCustomActions || showGlobalFilter;
|
1342
|
-
return (
|
1342
|
+
return (React.createElement(Toolbar, Object.assign({ variant: "dense" }, toolbarProps, { ref: (ref) => {
|
1343
1343
|
topToolbarRef.current = ref;
|
1344
1344
|
if (toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.ref) {
|
1345
1345
|
// @ts-ignore
|
@@ -1348,9 +1348,9 @@ const MRT_TopToolbar = ({ table }) => {
|
|
1348
1348
|
}, sx: (theme) => (Object.assign(Object.assign({ position: isFullScreen ? 'sticky' : undefined, top: isFullScreen ? '0' : undefined }, commonToolbarStyles({ theme })), ((toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx) instanceof Function
|
1349
1349
|
? toolbarProps.sx(theme)
|
1350
1350
|
: toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx))) }),
|
1351
|
-
positionToolbarAlertBanner === 'top' && (
|
1352
|
-
['both', 'top'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (
|
1353
|
-
|
1351
|
+
positionToolbarAlertBanner === 'top' && (React.createElement(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })),
|
1352
|
+
['both', 'top'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (React.createElement(MRT_ToolbarDropZone, { table: table })),
|
1353
|
+
React.createElement(Box, { sx: {
|
1354
1354
|
alignItems: 'flex-start',
|
1355
1355
|
boxSizing: 'border-box',
|
1356
1356
|
display: 'flex',
|
@@ -1361,18 +1361,18 @@ const MRT_TopToolbar = ({ table }) => {
|
|
1361
1361
|
top: 0,
|
1362
1362
|
width: '100%',
|
1363
1363
|
} },
|
1364
|
-
enableGlobalFilter && positionGlobalFilter === 'left' && (
|
1365
|
-
enableToolbarInternalActions ? (
|
1364
|
+
enableGlobalFilter && positionGlobalFilter === 'left' && (React.createElement(MRT_GlobalFilterTextField, { table: table })), (_a = renderTopToolbarCustomActions === null || renderTopToolbarCustomActions === void 0 ? void 0 : renderTopToolbarCustomActions({ table })) !== null && _a !== void 0 ? _a : React.createElement("span", null),
|
1365
|
+
enableToolbarInternalActions ? (React.createElement(Box, { sx: {
|
1366
1366
|
display: 'flex',
|
1367
1367
|
flexWrap: 'wrap-reverse',
|
1368
1368
|
justifyContent: 'flex-end',
|
1369
1369
|
} },
|
1370
|
-
enableGlobalFilter && positionGlobalFilter === 'right' && (
|
1371
|
-
|
1372
|
-
positionGlobalFilter === 'right' && (
|
1370
|
+
enableGlobalFilter && positionGlobalFilter === 'right' && (React.createElement(MRT_GlobalFilterTextField, { table: table })),
|
1371
|
+
React.createElement(MRT_ToolbarInternalButtons, { table: table }))) : (enableGlobalFilter &&
|
1372
|
+
positionGlobalFilter === 'right' && (React.createElement(MRT_GlobalFilterTextField, { table: table })))),
|
1373
1373
|
enablePagination &&
|
1374
|
-
['top', 'both'].includes(positionPagination !== null && positionPagination !== void 0 ? positionPagination : '') && (
|
1375
|
-
|
1374
|
+
['top', 'both'].includes(positionPagination !== null && positionPagination !== void 0 ? positionPagination : '') && (React.createElement(MRT_TablePagination, { table: table, position: "top" })),
|
1375
|
+
React.createElement(MRT_LinearProgressBar, { isTopToolbar: true, table: table })));
|
1376
1376
|
};
|
1377
1377
|
|
1378
1378
|
const MRT_BottomToolbar = ({ table }) => {
|
@@ -1383,7 +1383,7 @@ const MRT_BottomToolbar = ({ table }) => {
|
|
1383
1383
|
? muiBottomToolbarProps({ table })
|
1384
1384
|
: muiBottomToolbarProps;
|
1385
1385
|
const stackAlertBanner = isMobile || !!renderBottomToolbarCustomActions;
|
1386
|
-
return (
|
1386
|
+
return (React.createElement(Toolbar, Object.assign({ variant: "dense" }, toolbarProps, { ref: (ref) => {
|
1387
1387
|
bottomToolbarRef.current = ref;
|
1388
1388
|
if (toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.ref) {
|
1389
1389
|
// @ts-ignore
|
@@ -1392,10 +1392,10 @@ const MRT_BottomToolbar = ({ table }) => {
|
|
1392
1392
|
}, sx: (theme) => (Object.assign(Object.assign(Object.assign({}, commonToolbarStyles({ theme })), { bottom: isFullScreen ? '0' : undefined, boxShadow: `0 1px 2px -1px ${alpha(theme.palette.common.black, 0.1)} inset`, left: 0, position: isFullScreen ? 'fixed' : 'relative', right: 0 }), ((toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx) instanceof Function
|
1393
1393
|
? toolbarProps.sx(theme)
|
1394
1394
|
: toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx))) }),
|
1395
|
-
|
1396
|
-
positionToolbarAlertBanner === 'bottom' && (
|
1397
|
-
['both', 'bottom'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (
|
1398
|
-
|
1395
|
+
React.createElement(MRT_LinearProgressBar, { isTopToolbar: false, table: table }),
|
1396
|
+
positionToolbarAlertBanner === 'bottom' && (React.createElement(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })),
|
1397
|
+
['both', 'bottom'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (React.createElement(MRT_ToolbarDropZone, { table: table })),
|
1398
|
+
React.createElement(Box, { sx: {
|
1399
1399
|
alignItems: 'center',
|
1400
1400
|
boxSizing: 'border-box',
|
1401
1401
|
display: 'flex',
|
@@ -1403,15 +1403,15 @@ const MRT_BottomToolbar = ({ table }) => {
|
|
1403
1403
|
p: '0.5rem',
|
1404
1404
|
width: '100%',
|
1405
1405
|
} },
|
1406
|
-
renderBottomToolbarCustomActions ? (renderBottomToolbarCustomActions({ table })) : (
|
1407
|
-
|
1406
|
+
renderBottomToolbarCustomActions ? (renderBottomToolbarCustomActions({ table })) : (React.createElement("span", null)),
|
1407
|
+
React.createElement(Box, { sx: {
|
1408
1408
|
display: 'flex',
|
1409
1409
|
justifyContent: 'flex-end',
|
1410
1410
|
position: stackAlertBanner ? 'relative' : 'absolute',
|
1411
1411
|
right: 0,
|
1412
1412
|
top: 0,
|
1413
1413
|
} }, enablePagination &&
|
1414
|
-
['bottom', 'both'].includes(positionPagination !== null && positionPagination !== void 0 ? positionPagination : '') && (
|
1414
|
+
['bottom', 'both'].includes(positionPagination !== null && positionPagination !== void 0 ? positionPagination : '') && (React.createElement(MRT_TablePagination, { table: table, position: "bottom" }))))));
|
1415
1415
|
};
|
1416
1416
|
|
1417
1417
|
const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
|
@@ -1435,15 +1435,15 @@ const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
|
|
1435
1435
|
})
|
1436
1436
|
: columnDef.muiTableHeadCellColumnActionsButtonProps;
|
1437
1437
|
const iconButtonProps = Object.assign(Object.assign({}, mTableHeadCellColumnActionsButtonProps), mcTableHeadCellColumnActionsButtonProps);
|
1438
|
-
return (
|
1439
|
-
|
1440
|
-
|
1438
|
+
return (React.createElement(React.Fragment, null,
|
1439
|
+
React.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : localization.columnActions },
|
1440
|
+
React.createElement(IconButton, Object.assign({ "aria-label": localization.columnActions, onClick: handleClick, size: "small" }, iconButtonProps, { sx: (theme) => (Object.assign({ height: '2rem', m: '-8px -4px', opacity: 0.5, transform: 'scale(0.85)', transition: 'opacity 150ms', width: '2rem', '&:hover': {
|
1441
1441
|
opacity: 1,
|
1442
1442
|
} }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
|
1443
1443
|
? iconButtonProps.sx(theme)
|
1444
1444
|
: iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined }),
|
1445
|
-
|
1446
|
-
anchorEl && (
|
1445
|
+
React.createElement(MoreVertIcon, null))),
|
1446
|
+
anchorEl && (React.createElement(MRT_ColumnActionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table }))));
|
1447
1447
|
};
|
1448
1448
|
|
1449
1449
|
const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
@@ -1554,17 +1554,17 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1554
1554
|
isMounted.current = true;
|
1555
1555
|
}, [column.getFilterValue()]);
|
1556
1556
|
if (columnDef.Filter) {
|
1557
|
-
return (
|
1557
|
+
return (React.createElement(React.Fragment, null, (_e = columnDef.Filter) === null || _e === void 0 ? void 0 : _e.call(columnDef, { column, header, rangeFilterIndex, table })));
|
1558
1558
|
}
|
1559
|
-
return (
|
1560
|
-
|
1559
|
+
return (React.createElement(React.Fragment, null,
|
1560
|
+
React.createElement(TextField, Object.assign({ fullWidth: true, inputProps: {
|
1561
1561
|
disabled: !!filterChipLabel,
|
1562
1562
|
sx: {
|
1563
1563
|
textOverflow: 'ellipsis',
|
1564
1564
|
width: filterChipLabel ? 0 : undefined,
|
1565
1565
|
},
|
1566
1566
|
title: filterPlaceholder,
|
1567
|
-
}, helperText: showChangeModeButton ? (
|
1567
|
+
}, helperText: showChangeModeButton ? (React.createElement("label", null, localization.filterMode.replace('{filterType}',
|
1568
1568
|
// @ts-ignore
|
1569
1569
|
localization[`filter${((_f = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _f === void 0 ? void 0 : _f.toUpperCase()) +
|
1570
1570
|
(currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]))) : null, FormHelperTextProps: {
|
@@ -1576,30 +1576,30 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1576
1576
|
}, margin: "none", placeholder: filterChipLabel || isSelectFilter || isMultiSelectFilter
|
1577
1577
|
? undefined
|
1578
1578
|
: filterPlaceholder, onChange: handleChange, onClick: (e) => e.stopPropagation(), select: isSelectFilter || isMultiSelectFilter, value: filterValue, variant: "standard", InputProps: {
|
1579
|
-
startAdornment: showChangeModeButton ? (
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
|
1584
|
-
filterChipLabel && (
|
1585
|
-
endAdornment: !filterChipLabel && (
|
1586
|
-
|
1587
|
-
|
1588
|
-
|
1579
|
+
startAdornment: showChangeModeButton ? (React.createElement(InputAdornment, { position: "start" },
|
1580
|
+
React.createElement(Tooltip, { arrow: true, title: localization.changeFilterMode },
|
1581
|
+
React.createElement("span", null,
|
1582
|
+
React.createElement(IconButton, { "aria-label": localization.changeFilterMode, onClick: handleFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' } },
|
1583
|
+
React.createElement(FilterListIcon, null)))),
|
1584
|
+
filterChipLabel && (React.createElement(Chip, { onDelete: handleClearEmptyFilterChip, label: filterChipLabel })))) : null,
|
1585
|
+
endAdornment: !filterChipLabel && (React.createElement(InputAdornment, { position: "end" },
|
1586
|
+
React.createElement(Tooltip, { arrow: true, placement: "right", title: (_g = localization.clearFilter) !== null && _g !== void 0 ? _g : '' },
|
1587
|
+
React.createElement("span", null,
|
1588
|
+
React.createElement(IconButton, { "aria-label": localization.clearFilter, disabled: !(filterValue === null || filterValue === void 0 ? void 0 : filterValue.length), onClick: handleClear, size: "small", sx: {
|
1589
1589
|
height: '1.75rem',
|
1590
1590
|
width: '1.75rem',
|
1591
1591
|
} },
|
1592
|
-
|
1592
|
+
React.createElement(CloseIcon, null)))))),
|
1593
1593
|
}, SelectProps: {
|
1594
1594
|
displayEmpty: true,
|
1595
1595
|
multiple: isMultiSelectFilter,
|
1596
1596
|
renderValue: isMultiSelectFilter
|
1597
|
-
? (selected) => !(selected === null || selected === void 0 ? void 0 : selected.length) ? (
|
1597
|
+
? (selected) => !(selected === null || selected === void 0 ? void 0 : selected.length) ? (React.createElement(Box, { sx: { opacity: 0.5 } }, filterPlaceholder)) : (React.createElement(Box, { sx: { display: 'flex', flexWrap: 'wrap', gap: '2px' } }, selected === null || selected === void 0 ? void 0 : selected.map((value) => {
|
1598
1598
|
var _a;
|
1599
1599
|
const selectedValue = (_a = columnDef.filterSelectOptions) === null || _a === void 0 ? void 0 : _a.find((option) => option instanceof Object
|
1600
1600
|
? option.value === value
|
1601
1601
|
: option === value);
|
1602
|
-
return (
|
1602
|
+
return (React.createElement(Chip, { key: value, label: selectedValue instanceof Object
|
1603
1603
|
? selectedValue.text
|
1604
1604
|
: selectedValue }));
|
1605
1605
|
})))
|
@@ -1619,8 +1619,8 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1619
1619
|
} }, ((textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx) instanceof Function
|
1620
1620
|
? textFieldProps.sx(theme)
|
1621
1621
|
: textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx))) }),
|
1622
|
-
(isSelectFilter || isMultiSelectFilter) && (
|
1623
|
-
|
1622
|
+
(isSelectFilter || isMultiSelectFilter) && (React.createElement(MenuItem, { divider: true, disabled: true, hidden: true, value: "" },
|
1623
|
+
React.createElement(Box, { sx: { opacity: 0.5 } }, filterPlaceholder))), (_h = columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterSelectOptions) === null || _h === void 0 ? void 0 :
|
1624
1624
|
_h.map((option) => {
|
1625
1625
|
var _a;
|
1626
1626
|
let value;
|
@@ -1633,22 +1633,22 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1633
1633
|
value = option.value;
|
1634
1634
|
text = option.text;
|
1635
1635
|
}
|
1636
|
-
return (
|
1636
|
+
return (React.createElement(MenuItem, { key: value, sx: {
|
1637
1637
|
display: 'flex',
|
1638
1638
|
m: 0,
|
1639
1639
|
alignItems: 'center',
|
1640
1640
|
gap: '0.5rem',
|
1641
1641
|
}, value: value },
|
1642
|
-
isMultiSelectFilter && (
|
1642
|
+
isMultiSelectFilter && (React.createElement(Checkbox, { checked: ((_a = column.getFilterValue()) !== null && _a !== void 0 ? _a : []).includes(value), sx: { mr: '0.5rem' } })),
|
1643
1643
|
text));
|
1644
1644
|
})),
|
1645
|
-
|
1645
|
+
React.createElement(MRT_FilterOptionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table, setFilterValue: setFilterValue })));
|
1646
1646
|
};
|
1647
1647
|
|
1648
1648
|
const MRT_FilterRangeFields = ({ header, table }) => {
|
1649
|
-
return (
|
1650
|
-
|
1651
|
-
|
1649
|
+
return (React.createElement(Box, { sx: { display: 'grid', gridTemplateColumns: '6fr 6fr', gap: '1rem' } },
|
1650
|
+
React.createElement(MRT_FilterTextField, { header: header, rangeFilterIndex: 0, table: table }),
|
1651
|
+
React.createElement(MRT_FilterTextField, { header: header, rangeFilterIndex: 1, table: table })));
|
1652
1652
|
};
|
1653
1653
|
|
1654
1654
|
const MRT_FilterCheckbox = ({ column, table }) => {
|
@@ -1670,8 +1670,8 @@ const MRT_FilterCheckbox = ({ column, table }) => {
|
|
1670
1670
|
: columnDef.muiTableHeadCellFilterCheckboxProps;
|
1671
1671
|
const checkboxProps = Object.assign(Object.assign({}, mTableHeadCellFilterCheckboxProps), mcTableHeadCellFilterCheckboxProps);
|
1672
1672
|
const filterLabel = (_a = localization.filterByColumn) === null || _a === void 0 ? void 0 : _a.replace('{column}', columnDef.header);
|
1673
|
-
return (
|
1674
|
-
|
1673
|
+
return (React.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_b = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _b !== void 0 ? _b : filterLabel },
|
1674
|
+
React.createElement(FormControlLabel, { control: React.createElement(Checkbox, Object.assign({ checked: column.getFilterValue() === 'true', indeterminate: column.getFilterValue() === undefined, color: column.getFilterValue() === undefined ? 'default' : 'primary', size: density === 'compact' ? 'small' : 'medium' }, checkboxProps, { onClick: (e) => {
|
1675
1675
|
var _a;
|
1676
1676
|
e.stopPropagation();
|
1677
1677
|
(_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
|
@@ -1693,8 +1693,8 @@ const MRT_TableHeadCellFilterContainer = ({ header, table, }) => {
|
|
1693
1693
|
const { showColumnFilters } = getState();
|
1694
1694
|
const { column } = header;
|
1695
1695
|
const { columnDef } = column;
|
1696
|
-
return (
|
1697
|
-
['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn) ? (
|
1696
|
+
return (React.createElement(Collapse, { in: showColumnFilters, mountOnEnter: true, unmountOnExit: true }, columnDef.filterVariant === 'checkbox' ? (React.createElement(MRT_FilterCheckbox, { column: column, table: table })) : columnDef.filterVariant === 'range' ||
|
1697
|
+
['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn) ? (React.createElement(MRT_FilterRangeFields, { header: header, table: table })) : (React.createElement(MRT_FilterTextField, { header: header, table: table }))));
|
1698
1698
|
};
|
1699
1699
|
|
1700
1700
|
const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
|
@@ -1715,12 +1715,12 @@ const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
|
|
1715
1715
|
? column.getFilterValue().join(`" ${isRangeFilter ? localization.and : localization.or} "`)
|
1716
1716
|
: column.getFilterValue()}"`)
|
1717
1717
|
.replace('" "', '');
|
1718
|
-
return (
|
1718
|
+
return (React.createElement(Grow, { unmountOnExit: true, in: (!!column.getFilterValue() && !isRangeFilter) ||
|
1719
1719
|
(isRangeFilter && // @ts-ignore
|
1720
1720
|
(!!((_b = column.getFilterValue()) === null || _b === void 0 ? void 0 : _b[0]) || !!((_c = column.getFilterValue()) === null || _c === void 0 ? void 0 : _c[1]))) },
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1721
|
+
React.createElement(Box, { component: "span", sx: { flex: '0 0' } },
|
1722
|
+
React.createElement(Tooltip, { arrow: true, placement: "top", title: filterTooltip },
|
1723
|
+
React.createElement(IconButton, { disableRipple: true, onClick: (event) => {
|
1724
1724
|
setShowFilters(true);
|
1725
1725
|
queueMicrotask(() => {
|
1726
1726
|
var _a, _b;
|
@@ -1736,7 +1736,7 @@ const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
|
|
1736
1736
|
transform: 'scale(0.66)',
|
1737
1737
|
width: '12px',
|
1738
1738
|
} },
|
1739
|
-
|
1739
|
+
React.createElement(FilterAltIcon, null))))));
|
1740
1740
|
};
|
1741
1741
|
|
1742
1742
|
const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
|
@@ -1770,7 +1770,7 @@ const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
|
|
1770
1770
|
setDraggingColumn(null);
|
1771
1771
|
setHoveredColumn(null);
|
1772
1772
|
};
|
1773
|
-
return (
|
1773
|
+
return (React.createElement(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
|
1774
1774
|
};
|
1775
1775
|
|
1776
1776
|
const MRT_TableHeadCellResizeHandle = ({ header, table }) => {
|
@@ -1780,7 +1780,7 @@ const MRT_TableHeadCellResizeHandle = ({ header, table }) => {
|
|
1780
1780
|
const { column } = header;
|
1781
1781
|
const { columnDef } = column;
|
1782
1782
|
const { columnDefType } = columnDef;
|
1783
|
-
return (
|
1783
|
+
return (React.createElement(Box, { onDoubleClick: () => column.resetSize(), onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), sx: (theme) => ({
|
1784
1784
|
cursor: 'col-resize',
|
1785
1785
|
mr: density === 'compact' ? '-0.5rem' : '-1rem',
|
1786
1786
|
position: 'absolute',
|
@@ -1796,7 +1796,7 @@ const MRT_TableHeadCellResizeHandle = ({ header, table }) => {
|
|
1796
1796
|
(columnResizeMode === 'onChange' ? 16 : 1)}px)`
|
1797
1797
|
: undefined,
|
1798
1798
|
} },
|
1799
|
-
|
1799
|
+
React.createElement(Divider, { flexItem: true, orientation: "vertical", sx: {
|
1800
1800
|
borderRadius: '2px',
|
1801
1801
|
borderWidth: '2px',
|
1802
1802
|
height: showColumnFilters && columnDefType === 'data' ? '3.5rem' : '1.5rem',
|
@@ -1818,8 +1818,8 @@ const MRT_TableHeadCellSortLabel = ({ header, table, tableCellProps, }) => {
|
|
1818
1818
|
? localization.sortedByColumnDesc.replace('{column}', columnDef.header)
|
1819
1819
|
: localization.sortedByColumnAsc.replace('{column}', columnDef.header)
|
1820
1820
|
: localization.unsorted;
|
1821
|
-
return (
|
1822
|
-
|
1821
|
+
return (React.createElement(Tooltip, { arrow: true, placement: "top", title: sortTooltip },
|
1822
|
+
React.createElement(TableSortLabel, { "aria-label": sortTooltip, active: !!column.getIsSorted(), direction: column.getIsSorted()
|
1823
1823
|
? column.getIsSorted()
|
1824
1824
|
: undefined, sx: {
|
1825
1825
|
flex: '0 0',
|
@@ -1891,7 +1891,7 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
1891
1891
|
table,
|
1892
1892
|
})
|
1893
1893
|
: (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) !== null && _b !== void 0 ? _b : columnDef.header;
|
1894
|
-
return (
|
1894
|
+
return (React.createElement(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: (node) => {
|
1895
1895
|
if (node) {
|
1896
1896
|
tableHeadCellRefs.current[column.id] = node;
|
1897
1897
|
}
|
@@ -1922,7 +1922,7 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
1922
1922
|
tableCellProps,
|
1923
1923
|
theme,
|
1924
1924
|
})), draggingBorders)) }),
|
1925
|
-
header.isPlaceholder ? null : (
|
1925
|
+
header.isPlaceholder ? null : (React.createElement(Box, { className: "Mui-TableHeadCell-Content", sx: {
|
1926
1926
|
alignItems: 'flex-start',
|
1927
1927
|
display: 'flex',
|
1928
1928
|
flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
|
@@ -1934,7 +1934,7 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
1934
1934
|
position: 'relative',
|
1935
1935
|
width: '100%',
|
1936
1936
|
} },
|
1937
|
-
|
1937
|
+
React.createElement(Box, { className: "Mui-TableHeadCell-Content-Labels", onClick: column.getToggleSortingHandler(), sx: {
|
1938
1938
|
alignItems: 'center',
|
1939
1939
|
cursor: column.getCanSort() && columnDefType !== 'group'
|
1940
1940
|
? 'pointer'
|
@@ -1946,20 +1946,20 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
1946
1946
|
? `${headerPL}rem`
|
1947
1947
|
: undefined,
|
1948
1948
|
} },
|
1949
|
-
|
1949
|
+
React.createElement(Box, { className: "Mui-TableHeadCell-Content-Wrapper", sx: {
|
1950
1950
|
overflow: columnDefType === 'data' ? 'hidden' : undefined,
|
1951
1951
|
textOverflow: 'ellipsis',
|
1952
1952
|
whiteSpace: ((_d = (_c = columnDef.header) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) < 20 ? 'nowrap' : 'normal',
|
1953
1953
|
}, title: columnDefType === 'data' ? columnDef.header : undefined }, headerElement),
|
1954
|
-
column.getCanSort() && (
|
1955
|
-
column.getCanFilter() && (
|
1956
|
-
columnDefType !== 'group' && (
|
1957
|
-
showDragHandle && (
|
1954
|
+
column.getCanSort() && (React.createElement(MRT_TableHeadCellSortLabel, { header: header, table: table, tableCellProps: tableCellProps })),
|
1955
|
+
column.getCanFilter() && (React.createElement(MRT_TableHeadCellFilterLabel, { header: header, table: table }))),
|
1956
|
+
columnDefType !== 'group' && (React.createElement(Box, { className: "Mui-TableHeadCell-Content-Actions", sx: { whiteSpace: 'nowrap' } },
|
1957
|
+
showDragHandle && (React.createElement(MRT_TableHeadCellGrabHandle, { column: column, table: table, tableHeadCellRef: {
|
1958
1958
|
current: tableHeadCellRefs.current[column.id],
|
1959
1959
|
} })),
|
1960
|
-
showColumnActions && (
|
1961
|
-
column.getCanResize() && (
|
1962
|
-
column.getCanFilter() && (
|
1960
|
+
showColumnActions && (React.createElement(MRT_TableHeadCellColumnActionsButton, { header: header, table: table })))),
|
1961
|
+
column.getCanResize() && (React.createElement(MRT_TableHeadCellResizeHandle, { header: header, table: table })))),
|
1962
|
+
column.getCanFilter() && (React.createElement(MRT_TableHeadCellFilterContainer, { header: header, table: table }))));
|
1963
1963
|
};
|
1964
1964
|
|
1965
1965
|
const MRT_TableHeadRow = ({ headerGroup, table }) => {
|
@@ -1967,586 +1967,23 @@ const MRT_TableHeadRow = ({ headerGroup, table }) => {
|
|
1967
1967
|
const tableRowProps = muiTableHeadRowProps instanceof Function
|
1968
1968
|
? muiTableHeadRowProps({ headerGroup, table })
|
1969
1969
|
: muiTableHeadRowProps;
|
1970
|
-
return (
|
1970
|
+
return (React.createElement(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.04), boxShadow: `4px 0 8px ${alpha(theme.palette.common.black, 0.1)}`, display: layoutMode === 'grid' ? 'flex' : 'table-row', top: 0 }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
|
1971
1971
|
? tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx(theme)
|
1972
|
-
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))) }), headerGroup.headers.map((header) => (
|
1972
|
+
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))) }), headerGroup.headers.map((header) => (React.createElement(MRT_TableHeadCell, { header: header, key: header.id, table: table })))));
|
1973
1973
|
};
|
1974
1974
|
|
1975
1975
|
const MRT_TableHead = ({ table }) => {
|
1976
|
-
const { getHeaderGroups, getState, options: {
|
1976
|
+
const { getHeaderGroups, getState, options: { enableStickyHeader, layoutMode, muiTableHeadProps }, } = table;
|
1977
1977
|
const { isFullScreen } = getState();
|
1978
1978
|
const tableHeadProps = muiTableHeadProps instanceof Function
|
1979
1979
|
? muiTableHeadProps({ table })
|
1980
1980
|
: muiTableHeadProps;
|
1981
|
-
const stickyHeader = enableStickyHeader ||
|
1982
|
-
return (
|
1981
|
+
const stickyHeader = enableStickyHeader || isFullScreen;
|
1982
|
+
return (React.createElement(TableHead, Object.assign({}, tableHeadProps, { 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 }, ((tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx) instanceof Function
|
1983
1983
|
? tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx(theme)
|
1984
|
-
: tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx))) }), getHeaderGroups().map((headerGroup) => (
|
1984
|
+
: tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx))) }), getHeaderGroups().map((headerGroup) => (React.createElement(MRT_TableHeadRow, { headerGroup: headerGroup, key: headerGroup.id, table: table })))));
|
1985
1985
|
};
|
1986
1986
|
|
1987
|
-
/**
|
1988
|
-
* virtual-core
|
1989
|
-
*
|
1990
|
-
* Copyright (c) TanStack
|
1991
|
-
*
|
1992
|
-
* This source code is licensed under the MIT license found in the
|
1993
|
-
* LICENSE.md file in the root directory of this source tree.
|
1994
|
-
*
|
1995
|
-
* @license MIT
|
1996
|
-
*/
|
1997
|
-
function memo(getDeps, fn, opts) {
|
1998
|
-
let deps = [];
|
1999
|
-
let result;
|
2000
|
-
return () => {
|
2001
|
-
let depTime;
|
2002
|
-
if (opts.key && opts.debug != null && opts.debug()) depTime = Date.now();
|
2003
|
-
const newDeps = getDeps();
|
2004
|
-
const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep);
|
2005
|
-
if (!depsChanged) {
|
2006
|
-
return result;
|
2007
|
-
}
|
2008
|
-
deps = newDeps;
|
2009
|
-
let resultTime;
|
2010
|
-
if (opts.key && opts.debug != null && opts.debug()) resultTime = Date.now();
|
2011
|
-
result = fn(...newDeps);
|
2012
|
-
opts == null ? void 0 : opts.onChange == null ? void 0 : opts.onChange(result);
|
2013
|
-
if (opts.key && opts.debug != null && opts.debug()) {
|
2014
|
-
const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
|
2015
|
-
const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
|
2016
|
-
const resultFpsPercentage = resultEndTime / 16;
|
2017
|
-
const pad = (str, num) => {
|
2018
|
-
str = String(str);
|
2019
|
-
while (str.length < num) {
|
2020
|
-
str = ' ' + str;
|
2021
|
-
}
|
2022
|
-
return str;
|
2023
|
-
};
|
2024
|
-
console.info(`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`, `
|
2025
|
-
font-size: .6rem;
|
2026
|
-
font-weight: bold;
|
2027
|
-
color: hsl(${Math.max(0, Math.min(120 - 120 * resultFpsPercentage, 120))}deg 100% 31%);`, opts == null ? void 0 : opts.key);
|
2028
|
-
}
|
2029
|
-
return result;
|
2030
|
-
};
|
2031
|
-
}
|
2032
|
-
|
2033
|
-
/**
|
2034
|
-
* virtual-core
|
2035
|
-
*
|
2036
|
-
* Copyright (c) TanStack
|
2037
|
-
*
|
2038
|
-
* This source code is licensed under the MIT license found in the
|
2039
|
-
* LICENSE.md file in the root directory of this source tree.
|
2040
|
-
*
|
2041
|
-
* @license MIT
|
2042
|
-
*/
|
2043
|
-
|
2044
|
-
//
|
2045
|
-
|
2046
|
-
//
|
2047
|
-
|
2048
|
-
const defaultKeyExtractor = index => index;
|
2049
|
-
const defaultRangeExtractor = range => {
|
2050
|
-
const start = Math.max(range.startIndex - range.overscan, 0);
|
2051
|
-
const end = Math.min(range.endIndex + range.overscan, range.count - 1);
|
2052
|
-
const arr = [];
|
2053
|
-
for (let i = start; i <= end; i++) {
|
2054
|
-
arr.push(i);
|
2055
|
-
}
|
2056
|
-
return arr;
|
2057
|
-
};
|
2058
|
-
const observeElementRect = (instance, cb) => {
|
2059
|
-
const observer = new ResizeObserver(entries => {
|
2060
|
-
var _entries$, _entries$2;
|
2061
|
-
cb({
|
2062
|
-
width: (_entries$ = entries[0]) == null ? void 0 : _entries$.contentRect.width,
|
2063
|
-
height: (_entries$2 = entries[0]) == null ? void 0 : _entries$2.contentRect.height
|
2064
|
-
});
|
2065
|
-
});
|
2066
|
-
if (!instance.scrollElement) {
|
2067
|
-
return;
|
2068
|
-
}
|
2069
|
-
cb(instance.scrollElement.getBoundingClientRect());
|
2070
|
-
observer.observe(instance.scrollElement);
|
2071
|
-
return () => {
|
2072
|
-
observer.unobserve(instance.scrollElement);
|
2073
|
-
};
|
2074
|
-
};
|
2075
|
-
const scrollProps = {
|
2076
|
-
element: ['scrollLeft', 'scrollTop'],
|
2077
|
-
window: ['scrollX', 'scrollY']
|
2078
|
-
};
|
2079
|
-
const createOffsetObserver = mode => {
|
2080
|
-
return (instance, cb) => {
|
2081
|
-
if (!instance.scrollElement) {
|
2082
|
-
return;
|
2083
|
-
}
|
2084
|
-
const propX = scrollProps[mode][0];
|
2085
|
-
const propY = scrollProps[mode][1];
|
2086
|
-
let prevX = instance.scrollElement[propX];
|
2087
|
-
let prevY = instance.scrollElement[propY];
|
2088
|
-
const scroll = () => {
|
2089
|
-
const offset = instance.scrollElement[instance.options.horizontal ? propX : propY];
|
2090
|
-
cb(Math.max(0, offset - instance.options.scrollMargin));
|
2091
|
-
};
|
2092
|
-
scroll();
|
2093
|
-
const onScroll = e => {
|
2094
|
-
const target = e.currentTarget;
|
2095
|
-
const scrollX = target[propX];
|
2096
|
-
const scrollY = target[propY];
|
2097
|
-
if (instance.options.horizontal ? prevX - scrollX : prevY - scrollY) {
|
2098
|
-
scroll();
|
2099
|
-
}
|
2100
|
-
prevX = scrollX;
|
2101
|
-
prevY = scrollY;
|
2102
|
-
};
|
2103
|
-
instance.scrollElement.addEventListener('scroll', onScroll, {
|
2104
|
-
capture: false,
|
2105
|
-
passive: true
|
2106
|
-
});
|
2107
|
-
return () => {
|
2108
|
-
instance.scrollElement.removeEventListener('scroll', onScroll);
|
2109
|
-
};
|
2110
|
-
};
|
2111
|
-
};
|
2112
|
-
const observeElementOffset = createOffsetObserver('element');
|
2113
|
-
const measureElement = (element, instance) => {
|
2114
|
-
return Math.round(element.getBoundingClientRect()[instance.options.horizontal ? 'width' : 'height']);
|
2115
|
-
};
|
2116
|
-
const elementScroll = (offset, _ref2, instance) => {
|
2117
|
-
var _instance$scrollEleme2;
|
2118
|
-
let {
|
2119
|
-
adjustments,
|
2120
|
-
behavior,
|
2121
|
-
sync
|
2122
|
-
} = _ref2;
|
2123
|
-
const toOffset = (sync ? offset : offset + instance.options.scrollMargin) + (adjustments ?? 0);
|
2124
|
-
(_instance$scrollEleme2 = instance.scrollElement) == null ? void 0 : _instance$scrollEleme2.scrollTo == null ? void 0 : _instance$scrollEleme2.scrollTo({
|
2125
|
-
[instance.options.horizontal ? 'left' : 'top']: toOffset,
|
2126
|
-
behavior
|
2127
|
-
});
|
2128
|
-
};
|
2129
|
-
class Virtualizer {
|
2130
|
-
constructor(_opts) {
|
2131
|
-
var _this = this;
|
2132
|
-
this.unsubs = [];
|
2133
|
-
this.scrollElement = null;
|
2134
|
-
this.isScrolling = false;
|
2135
|
-
this.isScrollingTimeoutId = null;
|
2136
|
-
this.measurementsCache = [];
|
2137
|
-
this.itemMeasurementsCache = {};
|
2138
|
-
this.pendingMeasuredCacheIndexes = [];
|
2139
|
-
this.scrollAdjustments = 0;
|
2140
|
-
this.measureElementCache = {};
|
2141
|
-
this.pendingScrollToIndexCallback = null;
|
2142
|
-
this.getResizeObserver = (() => {
|
2143
|
-
let _ro = null;
|
2144
|
-
return () => {
|
2145
|
-
if (_ro) {
|
2146
|
-
return _ro;
|
2147
|
-
} else if (typeof ResizeObserver !== 'undefined') {
|
2148
|
-
return _ro = new ResizeObserver(entries => {
|
2149
|
-
entries.forEach(entry => {
|
2150
|
-
this._measureElement(entry.target, false);
|
2151
|
-
});
|
2152
|
-
});
|
2153
|
-
} else {
|
2154
|
-
return null;
|
2155
|
-
}
|
2156
|
-
};
|
2157
|
-
})();
|
2158
|
-
this.range = {
|
2159
|
-
startIndex: 0,
|
2160
|
-
endIndex: 0
|
2161
|
-
};
|
2162
|
-
this.setOptions = opts => {
|
2163
|
-
Object.entries(opts).forEach(_ref3 => {
|
2164
|
-
let [key, value] = _ref3;
|
2165
|
-
if (typeof value === 'undefined') delete opts[key];
|
2166
|
-
});
|
2167
|
-
this.options = {
|
2168
|
-
debug: false,
|
2169
|
-
initialOffset: 0,
|
2170
|
-
overscan: 1,
|
2171
|
-
paddingStart: 0,
|
2172
|
-
paddingEnd: 0,
|
2173
|
-
scrollPaddingStart: 0,
|
2174
|
-
scrollPaddingEnd: 0,
|
2175
|
-
horizontal: false,
|
2176
|
-
getItemKey: defaultKeyExtractor,
|
2177
|
-
rangeExtractor: defaultRangeExtractor,
|
2178
|
-
onChange: () => {},
|
2179
|
-
measureElement,
|
2180
|
-
initialRect: {
|
2181
|
-
width: 0,
|
2182
|
-
height: 0
|
2183
|
-
},
|
2184
|
-
scrollMargin: 0,
|
2185
|
-
scrollingDelay: 150,
|
2186
|
-
indexAttribute: 'data-index',
|
2187
|
-
...opts
|
2188
|
-
};
|
2189
|
-
};
|
2190
|
-
this.notify = () => {
|
2191
|
-
var _this$options$onChang, _this$options;
|
2192
|
-
(_this$options$onChang = (_this$options = this.options).onChange) == null ? void 0 : _this$options$onChang.call(_this$options, this);
|
2193
|
-
};
|
2194
|
-
this.cleanup = () => {
|
2195
|
-
this.unsubs.filter(Boolean).forEach(d => d());
|
2196
|
-
this.unsubs = [];
|
2197
|
-
this.scrollElement = null;
|
2198
|
-
};
|
2199
|
-
this._didMount = () => {
|
2200
|
-
const ro = this.getResizeObserver();
|
2201
|
-
Object.values(this.measureElementCache).forEach(node => ro == null ? void 0 : ro.observe(node));
|
2202
|
-
return () => {
|
2203
|
-
ro == null ? void 0 : ro.disconnect();
|
2204
|
-
this.cleanup();
|
2205
|
-
};
|
2206
|
-
};
|
2207
|
-
this._willUpdate = () => {
|
2208
|
-
var _this$pendingScrollTo;
|
2209
|
-
(_this$pendingScrollTo = this.pendingScrollToIndexCallback) == null ? void 0 : _this$pendingScrollTo.call(this);
|
2210
|
-
const scrollElement = this.options.getScrollElement();
|
2211
|
-
if (this.scrollElement !== scrollElement) {
|
2212
|
-
this.cleanup();
|
2213
|
-
this.scrollElement = scrollElement;
|
2214
|
-
this._scrollToOffset(this.scrollOffset, {
|
2215
|
-
adjustments: undefined,
|
2216
|
-
behavior: undefined,
|
2217
|
-
sync: true
|
2218
|
-
});
|
2219
|
-
this.unsubs.push(this.options.observeElementRect(this, rect => {
|
2220
|
-
this.scrollRect = rect;
|
2221
|
-
this.calculateRange();
|
2222
|
-
}));
|
2223
|
-
this.unsubs.push(this.options.observeElementOffset(this, offset => {
|
2224
|
-
if (this.isScrollingTimeoutId !== null) {
|
2225
|
-
clearTimeout(this.isScrollingTimeoutId);
|
2226
|
-
this.isScrollingTimeoutId = null;
|
2227
|
-
}
|
2228
|
-
if (this.scrollOffset !== offset) {
|
2229
|
-
this.scrollOffset = offset;
|
2230
|
-
this.isScrolling = true;
|
2231
|
-
this.scrollAdjustments = 0;
|
2232
|
-
this.isScrollingTimeoutId = setTimeout(() => {
|
2233
|
-
this.isScrollingTimeoutId = null;
|
2234
|
-
this.isScrolling = false;
|
2235
|
-
this.notify();
|
2236
|
-
}, this.options.scrollingDelay);
|
2237
|
-
} else {
|
2238
|
-
this.isScrolling = false;
|
2239
|
-
this.scrollAdjustments = 0;
|
2240
|
-
}
|
2241
|
-
this.calculateRange();
|
2242
|
-
}));
|
2243
|
-
} else if (!this.isScrolling) {
|
2244
|
-
this.calculateRange();
|
2245
|
-
}
|
2246
|
-
};
|
2247
|
-
this.getSize = () => {
|
2248
|
-
return this.scrollRect[this.options.horizontal ? 'width' : 'height'];
|
2249
|
-
};
|
2250
|
-
this.getMeasurements = memo(() => [this.options.count, this.options.paddingStart, this.options.getItemKey, this.itemMeasurementsCache], (count, paddingStart, getItemKey, measurementsCache) => {
|
2251
|
-
const min = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
|
2252
|
-
this.pendingMeasuredCacheIndexes = [];
|
2253
|
-
const measurements = this.measurementsCache.slice(0, min);
|
2254
|
-
for (let i = min; i < count; i++) {
|
2255
|
-
const key = getItemKey(i);
|
2256
|
-
const measuredSize = measurementsCache[key];
|
2257
|
-
const start = measurements[i - 1] ? measurements[i - 1].end : paddingStart;
|
2258
|
-
const size = typeof measuredSize === 'number' ? measuredSize : this.options.estimateSize(i);
|
2259
|
-
const end = start + size;
|
2260
|
-
measurements[i] = {
|
2261
|
-
index: i,
|
2262
|
-
start,
|
2263
|
-
size,
|
2264
|
-
end,
|
2265
|
-
key
|
2266
|
-
};
|
2267
|
-
}
|
2268
|
-
this.measurementsCache = measurements;
|
2269
|
-
return measurements;
|
2270
|
-
}, {
|
2271
|
-
key: process.env.NODE_ENV !== 'production' && 'getMeasurements',
|
2272
|
-
debug: () => this.options.debug
|
2273
|
-
});
|
2274
|
-
this.calculateRange = memo(() => [this.getMeasurements(), this.getSize(), this.scrollOffset], (measurements, outerSize, scrollOffset) => {
|
2275
|
-
const range = calculateRange({
|
2276
|
-
measurements,
|
2277
|
-
outerSize,
|
2278
|
-
scrollOffset
|
2279
|
-
});
|
2280
|
-
if (range.startIndex !== this.range.startIndex || range.endIndex !== this.range.endIndex) {
|
2281
|
-
this.range = range;
|
2282
|
-
this.notify();
|
2283
|
-
}
|
2284
|
-
return this.range;
|
2285
|
-
}, {
|
2286
|
-
key: process.env.NODE_ENV !== 'production' && 'calculateRange',
|
2287
|
-
debug: () => this.options.debug
|
2288
|
-
});
|
2289
|
-
this.getIndexes = memo(() => [this.options.rangeExtractor, this.range, this.options.overscan, this.options.count], (rangeExtractor, range, overscan, count) => {
|
2290
|
-
return rangeExtractor({
|
2291
|
-
...range,
|
2292
|
-
overscan,
|
2293
|
-
count: count
|
2294
|
-
});
|
2295
|
-
}, {
|
2296
|
-
key: process.env.NODE_ENV !== 'production' && 'getIndexes',
|
2297
|
-
debug: () => this.options.debug
|
2298
|
-
});
|
2299
|
-
this.indexFromElement = node => {
|
2300
|
-
const attributeName = this.options.indexAttribute;
|
2301
|
-
const indexStr = node.getAttribute(attributeName);
|
2302
|
-
if (!indexStr) {
|
2303
|
-
console.warn(`Missing attribute name '${attributeName}={index}' on measured element.`);
|
2304
|
-
return -1;
|
2305
|
-
}
|
2306
|
-
return parseInt(indexStr, 10);
|
2307
|
-
};
|
2308
|
-
this._measureElement = (node, _sync) => {
|
2309
|
-
const index = this.indexFromElement(node);
|
2310
|
-
const item = this.measurementsCache[index];
|
2311
|
-
if (!item) {
|
2312
|
-
return;
|
2313
|
-
}
|
2314
|
-
const prevNode = this.measureElementCache[item.key];
|
2315
|
-
const ro = this.getResizeObserver();
|
2316
|
-
if (!node.isConnected) {
|
2317
|
-
if (prevNode) {
|
2318
|
-
ro == null ? void 0 : ro.unobserve(prevNode);
|
2319
|
-
delete this.measureElementCache[item.key];
|
2320
|
-
}
|
2321
|
-
return;
|
2322
|
-
}
|
2323
|
-
if (!prevNode || prevNode !== node) {
|
2324
|
-
if (prevNode) {
|
2325
|
-
ro == null ? void 0 : ro.unobserve(prevNode);
|
2326
|
-
}
|
2327
|
-
this.measureElementCache[item.key] = node;
|
2328
|
-
ro == null ? void 0 : ro.observe(node);
|
2329
|
-
}
|
2330
|
-
const measuredItemSize = this.options.measureElement(node, this);
|
2331
|
-
const itemSize = this.itemMeasurementsCache[item.key] ?? item.size;
|
2332
|
-
const delta = measuredItemSize - itemSize;
|
2333
|
-
if (delta !== 0) {
|
2334
|
-
if (item.start < this.scrollOffset && this.isScrolling) {
|
2335
|
-
if (process.env.NODE_ENV !== 'production' && this.options.debug) {
|
2336
|
-
console.info('correction', delta);
|
2337
|
-
}
|
2338
|
-
this._scrollToOffset(this.scrollOffset, {
|
2339
|
-
adjustments: this.scrollAdjustments += delta,
|
2340
|
-
behavior: undefined,
|
2341
|
-
sync: false
|
2342
|
-
});
|
2343
|
-
}
|
2344
|
-
this.pendingMeasuredCacheIndexes.push(index);
|
2345
|
-
this.itemMeasurementsCache = {
|
2346
|
-
...this.itemMeasurementsCache,
|
2347
|
-
[item.key]: measuredItemSize
|
2348
|
-
};
|
2349
|
-
this.notify();
|
2350
|
-
}
|
2351
|
-
};
|
2352
|
-
this.measureElement = node => {
|
2353
|
-
if (!node) {
|
2354
|
-
return;
|
2355
|
-
}
|
2356
|
-
this._measureElement(node, true);
|
2357
|
-
};
|
2358
|
-
this.getVirtualItems = memo(() => [this.getIndexes(), this.getMeasurements()], (indexes, measurements) => {
|
2359
|
-
const virtualItems = [];
|
2360
|
-
for (let k = 0, len = indexes.length; k < len; k++) {
|
2361
|
-
const i = indexes[k];
|
2362
|
-
const measurement = measurements[i];
|
2363
|
-
virtualItems.push(measurement);
|
2364
|
-
}
|
2365
|
-
return virtualItems;
|
2366
|
-
}, {
|
2367
|
-
key: process.env.NODE_ENV !== 'production' && 'getIndexes',
|
2368
|
-
debug: () => this.options.debug
|
2369
|
-
});
|
2370
|
-
this.scrollToOffset = function (toOffset, _temp) {
|
2371
|
-
let {
|
2372
|
-
align = 'start',
|
2373
|
-
behavior
|
2374
|
-
} = _temp === void 0 ? {} : _temp;
|
2375
|
-
const offset = _this.scrollOffset;
|
2376
|
-
const size = _this.getSize();
|
2377
|
-
if (align === 'auto') {
|
2378
|
-
if (toOffset <= offset) {
|
2379
|
-
align = 'start';
|
2380
|
-
} else if (toOffset >= offset + size) {
|
2381
|
-
align = 'end';
|
2382
|
-
} else {
|
2383
|
-
align = 'start';
|
2384
|
-
}
|
2385
|
-
}
|
2386
|
-
const options = {
|
2387
|
-
adjustments: undefined,
|
2388
|
-
behavior,
|
2389
|
-
sync: false
|
2390
|
-
};
|
2391
|
-
if (align === 'start') {
|
2392
|
-
_this._scrollToOffset(toOffset, options);
|
2393
|
-
} else if (align === 'end') {
|
2394
|
-
_this._scrollToOffset(toOffset - size, options);
|
2395
|
-
} else if (align === 'center') {
|
2396
|
-
_this._scrollToOffset(toOffset - size / 2, options);
|
2397
|
-
}
|
2398
|
-
};
|
2399
|
-
this.scrollToIndex = function (index, _temp2) {
|
2400
|
-
let {
|
2401
|
-
align = 'auto',
|
2402
|
-
...rest
|
2403
|
-
} = _temp2 === void 0 ? {} : _temp2;
|
2404
|
-
_this.pendingScrollToIndexCallback = null;
|
2405
|
-
const measurements = _this.getMeasurements();
|
2406
|
-
const offset = _this.scrollOffset;
|
2407
|
-
const size = _this.getSize();
|
2408
|
-
const {
|
2409
|
-
count
|
2410
|
-
} = _this.options;
|
2411
|
-
const measurement = measurements[Math.max(0, Math.min(index, count - 1))];
|
2412
|
-
if (!measurement) {
|
2413
|
-
return;
|
2414
|
-
}
|
2415
|
-
if (align === 'auto') {
|
2416
|
-
if (measurement.end >= offset + size - _this.options.scrollPaddingEnd) {
|
2417
|
-
align = 'end';
|
2418
|
-
} else if (measurement.start <= offset + _this.options.scrollPaddingStart) {
|
2419
|
-
align = 'start';
|
2420
|
-
} else {
|
2421
|
-
return;
|
2422
|
-
}
|
2423
|
-
}
|
2424
|
-
const toOffset = align === 'end' ? measurement.end + _this.options.scrollPaddingEnd : measurement.start - _this.options.scrollPaddingStart;
|
2425
|
-
_this.scrollToOffset(toOffset, {
|
2426
|
-
align,
|
2427
|
-
...rest
|
2428
|
-
});
|
2429
|
-
const isDynamic = Object.keys(_this.measureElementCache).length > 0;
|
2430
|
-
if (isDynamic) {
|
2431
|
-
const didSeen = () => typeof _this.itemMeasurementsCache[_this.options.getItemKey(index)] === 'number';
|
2432
|
-
if (!didSeen()) {
|
2433
|
-
_this.pendingScrollToIndexCallback = () => {
|
2434
|
-
if (didSeen()) {
|
2435
|
-
_this.pendingScrollToIndexCallback = null;
|
2436
|
-
_this.scrollToIndex(index, {
|
2437
|
-
align,
|
2438
|
-
...rest
|
2439
|
-
});
|
2440
|
-
}
|
2441
|
-
};
|
2442
|
-
}
|
2443
|
-
}
|
2444
|
-
};
|
2445
|
-
this.getTotalSize = () => {
|
2446
|
-
var _this$getMeasurements;
|
2447
|
-
return (((_this$getMeasurements = this.getMeasurements()[this.options.count - 1]) == null ? void 0 : _this$getMeasurements.end) || this.options.paddingStart) + this.options.paddingEnd;
|
2448
|
-
};
|
2449
|
-
this._scrollToOffset = (offset, _ref4) => {
|
2450
|
-
let {
|
2451
|
-
adjustments,
|
2452
|
-
behavior,
|
2453
|
-
sync
|
2454
|
-
} = _ref4;
|
2455
|
-
this.options.scrollToFn(offset, {
|
2456
|
-
behavior,
|
2457
|
-
sync,
|
2458
|
-
adjustments
|
2459
|
-
}, this);
|
2460
|
-
};
|
2461
|
-
this.measure = () => {
|
2462
|
-
this.itemMeasurementsCache = {};
|
2463
|
-
this.notify();
|
2464
|
-
};
|
2465
|
-
this.setOptions(_opts);
|
2466
|
-
this.scrollRect = this.options.initialRect;
|
2467
|
-
this.scrollOffset = this.options.initialOffset;
|
2468
|
-
this.calculateRange();
|
2469
|
-
}
|
2470
|
-
}
|
2471
|
-
const findNearestBinarySearch = (low, high, getCurrentValue, value) => {
|
2472
|
-
while (low <= high) {
|
2473
|
-
const middle = (low + high) / 2 | 0;
|
2474
|
-
const currentValue = getCurrentValue(middle);
|
2475
|
-
if (currentValue < value) {
|
2476
|
-
low = middle + 1;
|
2477
|
-
} else if (currentValue > value) {
|
2478
|
-
high = middle - 1;
|
2479
|
-
} else {
|
2480
|
-
return middle;
|
2481
|
-
}
|
2482
|
-
}
|
2483
|
-
if (low > 0) {
|
2484
|
-
return low - 1;
|
2485
|
-
} else {
|
2486
|
-
return 0;
|
2487
|
-
}
|
2488
|
-
};
|
2489
|
-
function calculateRange(_ref5) {
|
2490
|
-
let {
|
2491
|
-
measurements,
|
2492
|
-
outerSize,
|
2493
|
-
scrollOffset
|
2494
|
-
} = _ref5;
|
2495
|
-
const count = measurements.length - 1;
|
2496
|
-
const getOffset = index => measurements[index].start;
|
2497
|
-
const startIndex = findNearestBinarySearch(0, count, getOffset, scrollOffset);
|
2498
|
-
let endIndex = startIndex;
|
2499
|
-
while (endIndex < count && measurements[endIndex].end < scrollOffset + outerSize) {
|
2500
|
-
endIndex++;
|
2501
|
-
}
|
2502
|
-
return {
|
2503
|
-
startIndex,
|
2504
|
-
endIndex
|
2505
|
-
};
|
2506
|
-
}
|
2507
|
-
|
2508
|
-
/**
|
2509
|
-
* react-virtual
|
2510
|
-
*
|
2511
|
-
* Copyright (c) TanStack
|
2512
|
-
*
|
2513
|
-
* This source code is licensed under the MIT license found in the
|
2514
|
-
* LICENSE.md file in the root directory of this source tree.
|
2515
|
-
*
|
2516
|
-
* @license MIT
|
2517
|
-
*/
|
2518
|
-
|
2519
|
-
//
|
2520
|
-
|
2521
|
-
const useIsomorphicLayoutEffect$1 = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
2522
|
-
function useVirtualizerBase(options) {
|
2523
|
-
const rerender = React.useReducer(() => ({}), {})[1];
|
2524
|
-
const resolvedOptions = {
|
2525
|
-
...options,
|
2526
|
-
onChange: instance => {
|
2527
|
-
rerender();
|
2528
|
-
options.onChange == null ? void 0 : options.onChange(instance);
|
2529
|
-
}
|
2530
|
-
};
|
2531
|
-
const [instance] = React.useState(() => new Virtualizer(resolvedOptions));
|
2532
|
-
instance.setOptions(resolvedOptions);
|
2533
|
-
React.useEffect(() => {
|
2534
|
-
return instance._didMount();
|
2535
|
-
}, []);
|
2536
|
-
useIsomorphicLayoutEffect$1(() => {
|
2537
|
-
return instance._willUpdate();
|
2538
|
-
});
|
2539
|
-
return instance;
|
2540
|
-
}
|
2541
|
-
function useVirtualizer(options) {
|
2542
|
-
return useVirtualizerBase({
|
2543
|
-
observeElementRect: observeElementRect,
|
2544
|
-
observeElementOffset: observeElementOffset,
|
2545
|
-
scrollToFn: elementScroll,
|
2546
|
-
...options
|
2547
|
-
});
|
2548
|
-
}
|
2549
|
-
|
2550
1987
|
const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
|
2551
1988
|
var _a;
|
2552
1989
|
const { getState, options: { muiTableBodyCellEditTextFieldProps }, refs: { editInputRefs }, setEditingCell, setEditingRow, } = table;
|
@@ -2593,9 +2030,9 @@ const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
|
|
2593
2030
|
}
|
2594
2031
|
};
|
2595
2032
|
if (columnDef.Edit) {
|
2596
|
-
return
|
2033
|
+
return React.createElement(React.Fragment, null, (_a = columnDef.Edit) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table }));
|
2597
2034
|
}
|
2598
|
-
return (
|
2035
|
+
return (React.createElement(TextField, Object.assign({ disabled: columnDef.enableEditing === false, fullWidth: true, inputRef: (inputRef) => {
|
2599
2036
|
if (inputRef) {
|
2600
2037
|
editInputRefs.current[column.id] = inputRef;
|
2601
2038
|
if (textFieldProps.inputRef) {
|
@@ -2633,8 +2070,8 @@ const MRT_CopyButton = ({ cell, children, table, }) => {
|
|
2633
2070
|
})
|
2634
2071
|
: columnDef.muiTableBodyCellCopyButtonProps;
|
2635
2072
|
const buttonProps = Object.assign(Object.assign({}, mTableBodyCellCopyButtonProps), mcTableBodyCellCopyButtonProps);
|
2636
|
-
return (
|
2637
|
-
|
2073
|
+
return (React.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_a = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.title) !== null && _a !== void 0 ? _a : (copied ? localization.copiedToClipboard : localization.clickToCopy) },
|
2074
|
+
React.createElement(Button, Object.assign({ onClick: (e) => handleCopy(e, cell.getValue()), size: "small", type: "button", variant: "text" }, buttonProps, { sx: (theme) => (Object.assign({ backgroundColor: 'transparent', border: 'none', color: 'inherit', cursor: 'copy', fontFamily: 'inherit', fontSize: 'inherit', letterSpacing: 'inherit', m: '-0.25rem', minWidth: 'unset', textAlign: 'inherit', textTransform: 'inherit' }, ((buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx) instanceof Function
|
2638
2075
|
? buttonProps.sx(theme)
|
2639
2076
|
: buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx))), title: undefined }), children)));
|
2640
2077
|
};
|
@@ -2657,14 +2094,14 @@ const MRT_TableBodyRowGrabHandle = ({ cell, rowRef, table, }) => {
|
|
2657
2094
|
table.setDraggingRow(null);
|
2658
2095
|
table.setHoveredRow(null);
|
2659
2096
|
};
|
2660
|
-
return (
|
2097
|
+
return (React.createElement(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
|
2661
2098
|
};
|
2662
2099
|
|
2663
2100
|
const MRT_TableBodyCellValue = ({ cell, table }) => {
|
2664
2101
|
var _a, _b;
|
2665
2102
|
const { column, row } = cell;
|
2666
2103
|
const { columnDef } = column;
|
2667
|
-
return (
|
2104
|
+
return (React.createElement(React.Fragment, null, cell.getIsAggregated() && columnDef.AggregatedCell
|
2668
2105
|
? columnDef.AggregatedCell({
|
2669
2106
|
cell,
|
2670
2107
|
column,
|
@@ -2755,7 +2192,7 @@ const MRT_TableBodyCell = ({ cell, enableHover, numRows, rowIndex, rowRef, table
|
|
2755
2192
|
setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
2756
2193
|
}
|
2757
2194
|
};
|
2758
|
-
return (
|
2195
|
+
return (React.createElement(TableCell, Object.assign({}, tableCellProps, { onDragEnter: handleDragEnter, onDoubleClick: handleDoubleClick, sx: (theme) => (Object.assign(Object.assign({ alignItems: layoutMode === 'grid' ? 'center' : undefined, cursor: isEditable && editingMode === 'cell' ? 'pointer' : 'inherit', overflow: 'hidden', p: density === 'compact'
|
2759
2196
|
? columnDefType === 'display'
|
2760
2197
|
? '0 0.5rem'
|
2761
2198
|
: '0.5rem'
|
@@ -2782,36 +2219,45 @@ const MRT_TableBodyCell = ({ cell, enableHover, numRows, rowIndex, rowRef, table
|
|
2782
2219
|
: `${darken(theme.palette.background.default, 0.1)} !important`
|
2783
2220
|
: undefined,
|
2784
2221
|
} }, getCommonCellStyles({ column, table, theme, tableCellProps })), draggingBorders)) }),
|
2785
|
-
|
2222
|
+
React.createElement(React.Fragment, null, cell.getIsPlaceholder() ? null : isLoading || showSkeletons ? (React.createElement(Skeleton, Object.assign({ animation: "wave", height: 20, width: skeletonWidth }, skeletonProps))) : enableRowNumbers &&
|
2786
2223
|
rowNumberMode === 'static' &&
|
2787
|
-
column.id === 'mrt-row-numbers' ? (rowIndex + 1) : column.id === 'mrt-row-drag' ? (
|
2224
|
+
column.id === 'mrt-row-numbers' ? (rowIndex + 1) : column.id === 'mrt-row-drag' ? (React.createElement(MRT_TableBodyRowGrabHandle, { cell: cell, rowRef: rowRef, table: table })) : columnDefType === 'display' &&
|
2788
2225
|
(column.id === 'mrt-row-select' ||
|
2789
2226
|
column.id === 'mrt-row-expand' ||
|
2790
|
-
!row.getIsGrouped()) ? ((_a = columnDef.Cell) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table })) : isEditing ? (
|
2791
|
-
columnDef.enableClickToCopy !== false ? (
|
2792
|
-
|
2793
|
-
cell.getIsGrouped() && !columnDef.GroupedCell && (
|
2227
|
+
!row.getIsGrouped()) ? ((_a = columnDef.Cell) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table })) : isEditing ? (React.createElement(MRT_EditCellTextField, { cell: cell, table: table })) : (enableClickToCopy || columnDef.enableClickToCopy) &&
|
2228
|
+
columnDef.enableClickToCopy !== false ? (React.createElement(MRT_CopyButton, { cell: cell, table: table },
|
2229
|
+
React.createElement(MRT_TableBodyCellValue, { cell: cell, table: table }))) : (React.createElement(MRT_TableBodyCellValue, { cell: cell, table: table }))),
|
2230
|
+
cell.getIsGrouped() && !columnDef.GroupedCell && (React.createElement(React.Fragment, null,
|
2794
2231
|
" (", (_b = row.subRows) === null || _b === void 0 ? void 0 :
|
2795
2232
|
_b.length,
|
2796
2233
|
")"))));
|
2797
2234
|
};
|
2798
|
-
const Memo_MRT_TableBodyCell = memo
|
2235
|
+
const Memo_MRT_TableBodyCell = memo(MRT_TableBodyCell, (prev, next) => next.cell === prev.cell);
|
2799
2236
|
|
2800
|
-
const MRT_TableDetailPanel = ({ row, table }) => {
|
2237
|
+
const MRT_TableDetailPanel = ({ parentRowRef, row, table, virtualRow, }) => {
|
2801
2238
|
const { getVisibleLeafColumns, getState, options: { layoutMode, muiTableBodyRowProps, muiTableDetailPanelProps, renderDetailPanel, }, } = table;
|
2802
2239
|
const { isLoading } = getState();
|
2803
2240
|
const tableRowProps = muiTableBodyRowProps instanceof Function
|
2804
|
-
? muiTableBodyRowProps({ row, table })
|
2241
|
+
? muiTableBodyRowProps({ isDetailPanel: true, row, table })
|
2805
2242
|
: muiTableBodyRowProps;
|
2806
2243
|
const tableCellProps = muiTableDetailPanelProps instanceof Function
|
2807
2244
|
? muiTableDetailPanelProps({ row, table })
|
2808
2245
|
: muiTableDetailPanelProps;
|
2809
|
-
return (
|
2810
|
-
|
2811
|
-
|
2812
|
-
|
2246
|
+
return (React.createElement(TableRow, Object.assign({ className: "Mui-TableBodyCell-DetailPanel" }, tableRowProps, { sx: (theme) => {
|
2247
|
+
var _a, _b;
|
2248
|
+
return (Object.assign({ display: layoutMode === 'grid' ? 'flex' : 'table-row', position: virtualRow ? 'absolute' : undefined, top: virtualRow
|
2249
|
+
? `${(_b = (_a = parentRowRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.height}px`
|
2250
|
+
: undefined, transform: virtualRow
|
2251
|
+
? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
|
2252
|
+
: undefined, width: '100%', zIndex: virtualRow ? 2 : undefined }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
|
2253
|
+
? tableRowProps.sx(theme)
|
2254
|
+
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx)));
|
2255
|
+
} }),
|
2256
|
+
React.createElement(TableCell, Object.assign({ className: "Mui-TableBodyCell-DetailPanel", colSpan: getVisibleLeafColumns().length }, tableCellProps, { sx: (theme) => (Object.assign({ backgroundColor: virtualRow
|
2257
|
+
? lighten(theme.palette.background.default, 0.06)
|
2258
|
+
: 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` }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
|
2813
2259
|
? tableCellProps.sx(theme)
|
2814
|
-
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))) }), renderDetailPanel && (
|
2260
|
+
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))) }), renderDetailPanel && (React.createElement(Collapse, { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true }, !isLoading && renderDetailPanel({ row, table }))))));
|
2815
2261
|
};
|
2816
2262
|
|
2817
2263
|
const MRT_TableBodyRow = ({ measureElement, numRows, row, rowIndex, table, virtualRow, }) => {
|
@@ -2837,8 +2283,8 @@ const MRT_TableBodyRow = ({ measureElement, numRows, row, rowIndex, table, virtu
|
|
2837
2283
|
border: draggingBorder,
|
2838
2284
|
}
|
2839
2285
|
: undefined;
|
2840
|
-
return (
|
2841
|
-
|
2286
|
+
return (React.createElement(React.Fragment, null,
|
2287
|
+
React.createElement(TableRow, Object.assign({ "data-index": virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.index, hover: true, onDragEnter: handleDragEnter, selected: row.getIsSelected(), ref: (node) => {
|
2842
2288
|
if (node) {
|
2843
2289
|
rowRef.current = node;
|
2844
2290
|
measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
|
@@ -2868,11 +2314,11 @@ const MRT_TableBodyRow = ({ measureElement, numRows, row, rowIndex, table, virtu
|
|
2868
2314
|
!draggingColumn &&
|
2869
2315
|
!draggingRow &&
|
2870
2316
|
(editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) !== cell.id &&
|
2871
|
-
(editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) !== row.id ? (
|
2317
|
+
(editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) !== row.id ? (React.createElement(Memo_MRT_TableBodyCell, Object.assign({}, props))) : (React.createElement(MRT_TableBodyCell, Object.assign({}, props)));
|
2872
2318
|
})),
|
2873
|
-
renderDetailPanel && !row.getIsGrouped() && (
|
2319
|
+
renderDetailPanel && !row.getIsGrouped() && (React.createElement(MRT_TableDetailPanel, { parentRowRef: rowRef, row: row, table: table, virtualRow: virtualRow }))));
|
2874
2320
|
};
|
2875
|
-
const Memo_MRT_TableBodyRow = memo
|
2321
|
+
const Memo_MRT_TableBodyRow = memo(MRT_TableBodyRow, (prev, next) => prev.row === next.row);
|
2876
2322
|
|
2877
2323
|
const MRT_TableBody = ({ table }) => {
|
2878
2324
|
var _a, _b, _c;
|
@@ -2910,17 +2356,17 @@ const MRT_TableBody = ({ table }) => {
|
|
2910
2356
|
pagination.pageSize,
|
2911
2357
|
]);
|
2912
2358
|
const virtualizer = enableRowVirtualization
|
2913
|
-
? useVirtualizer(Object.assign({ count: rows.length, estimateSize: () => density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73, getScrollElement: () => tableContainerRef.current, measureElement: (element) => element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height, overscan:
|
2359
|
+
? useVirtualizer(Object.assign({ count: rows.length, estimateSize: () => density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73, getScrollElement: () => tableContainerRef.current, measureElement: (element) => element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height, overscan: 4 }, vProps))
|
2914
2360
|
: undefined;
|
2915
2361
|
if (virtualizerInstanceRef && virtualizer) {
|
2916
2362
|
virtualizerInstanceRef.current = virtualizer;
|
2917
2363
|
}
|
2918
2364
|
const virtualRows = virtualizer ? virtualizer.getVirtualItems() : undefined;
|
2919
|
-
return (
|
2365
|
+
return (React.createElement(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', height: virtualizer ? `${virtualizer.getTotalSize()}px` : 'inherit', position: 'relative' }, ((tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx) instanceof Function
|
2920
2366
|
? tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx(theme)
|
2921
|
-
: tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx))) }), ((_a = tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.children) !== null && _a !== void 0 ? _a : !rows.length) ? (
|
2922
|
-
|
2923
|
-
|
2367
|
+
: tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx))) }), ((_a = tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.children) !== null && _a !== void 0 ? _a : !rows.length) ? (React.createElement("tr", { style: { display: layoutMode === 'grid' ? 'grid' : 'table-row' } },
|
2368
|
+
React.createElement("td", { colSpan: table.getVisibleLeafColumns().length, style: { display: layoutMode === 'grid' ? 'grid' : 'table-cell' } },
|
2369
|
+
React.createElement(Typography, { sx: {
|
2924
2370
|
color: 'text.secondary',
|
2925
2371
|
fontStyle: 'italic',
|
2926
2372
|
maxWidth: `min(100vw, ${(_c = (_b = tablePaperRef.current) === null || _b === void 0 ? void 0 : _b.clientWidth) !== null && _c !== void 0 ? _c : 360}px)`,
|
@@ -2929,7 +2375,7 @@ const MRT_TableBody = ({ table }) => {
|
|
2929
2375
|
width: '100%',
|
2930
2376
|
} }, globalFilter || columnFilters.length
|
2931
2377
|
? localization.noResultsFound
|
2932
|
-
: localization.noRecordsToDisplay)))) : (
|
2378
|
+
: localization.noRecordsToDisplay)))) : (React.createElement(React.Fragment, null, (virtualRows !== null && virtualRows !== void 0 ? virtualRows : rows).map((rowOrVirtualRow, rowIndex) => {
|
2933
2379
|
const row = virtualizer
|
2934
2380
|
? rows[rowOrVirtualRow.index]
|
2935
2381
|
: rowOrVirtualRow;
|
@@ -2946,10 +2392,10 @@ const MRT_TableBody = ({ table }) => {
|
|
2946
2392
|
? rowOrVirtualRow
|
2947
2393
|
: undefined,
|
2948
2394
|
};
|
2949
|
-
return memoMode === 'rows' ? (
|
2395
|
+
return memoMode === 'rows' ? (React.createElement(Memo_MRT_TableBodyRow, Object.assign({}, props))) : (React.createElement(MRT_TableBodyRow, Object.assign({}, props)));
|
2950
2396
|
})))));
|
2951
2397
|
};
|
2952
|
-
const Memo_MRT_TableBody = memo
|
2398
|
+
const Memo_MRT_TableBody = memo(MRT_TableBody, (prev, next) => prev.table.options.data === next.table.options.data);
|
2953
2399
|
|
2954
2400
|
const MRT_TableFooterCell = ({ footer, table }) => {
|
2955
2401
|
var _a, _b, _c;
|
@@ -2965,12 +2411,12 @@ const MRT_TableFooterCell = ({ footer, table }) => {
|
|
2965
2411
|
? columnDef.muiTableFooterCellProps({ column, table })
|
2966
2412
|
: columnDef.muiTableFooterCellProps;
|
2967
2413
|
const tableCellProps = Object.assign(Object.assign({}, mTableFooterCellProps), mcTableFooterCellProps);
|
2968
|
-
return (
|
2414
|
+
return (React.createElement(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'
|
2969
2415
|
? '0.5rem'
|
2970
2416
|
: density === 'comfortable'
|
2971
2417
|
? '1rem'
|
2972
2418
|
: '1.5rem', verticalAlign: 'top', zIndex: column.getIsPinned() && columnDefType !== 'group' ? 2 : 1 }, getCommonCellStyles({ column, table, theme, tableCellProps }))) }),
|
2973
|
-
|
2419
|
+
React.createElement(React.Fragment, null, footer.isPlaceholder
|
2974
2420
|
? null
|
2975
2421
|
: (_c = (_b = (columnDef.Footer instanceof Function
|
2976
2422
|
? (_a = columnDef.Footer) === null || _a === void 0 ? void 0 : _a.call(columnDef, {
|
@@ -2992,9 +2438,9 @@ const MRT_TableFooterRow = ({ footerGroup, table }) => {
|
|
2992
2438
|
const tableRowProps = muiTableFooterRowProps instanceof Function
|
2993
2439
|
? muiTableFooterRowProps({ footerGroup, table })
|
2994
2440
|
: muiTableFooterRowProps;
|
2995
|
-
return (
|
2441
|
+
return (React.createElement(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'flex' : 'table-row' }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
|
2996
2442
|
? tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx(theme)
|
2997
|
-
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))) }), footerGroup.headers.map((footer) => (
|
2443
|
+
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))) }), footerGroup.headers.map((footer) => (React.createElement(MRT_TableFooterCell, { footer: footer, key: footer.id, table: table })))));
|
2998
2444
|
};
|
2999
2445
|
|
3000
2446
|
const MRT_TableFooter = ({ table }) => {
|
@@ -3004,32 +2450,32 @@ const MRT_TableFooter = ({ table }) => {
|
|
3004
2450
|
? muiTableFooterProps({ table })
|
3005
2451
|
: muiTableFooterProps;
|
3006
2452
|
const stickFooter = (isFullScreen || enableStickyFooter) && enableStickyFooter !== false;
|
3007
|
-
return (
|
2453
|
+
return (React.createElement(TableFooter, Object.assign({}, tableFooterProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.06), bottom: stickFooter ? 0 : undefined, display: layoutMode === 'grid' ? 'grid' : 'table-row-group', opacity: stickFooter ? 0.97 : undefined, outline: stickFooter
|
3008
2454
|
? theme.palette.mode === 'light'
|
3009
2455
|
? `1px solid ${theme.palette.grey[300]}`
|
3010
2456
|
: `1px solid ${theme.palette.grey[700]}`
|
3011
2457
|
: undefined, position: stickFooter ? 'sticky' : undefined }, ((tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx) instanceof Function
|
3012
2458
|
? tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx(theme)
|
3013
|
-
: tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx))) }), getFooterGroups().map((footerGroup) => (
|
2459
|
+
: tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx))) }), getFooterGroups().map((footerGroup) => (React.createElement(MRT_TableFooterRow, { footerGroup: footerGroup, key: footerGroup.id, table: table })))));
|
3014
2460
|
};
|
3015
2461
|
|
3016
2462
|
const MRT_Table = ({ table }) => {
|
3017
|
-
const { getState, options: { enableColumnResizing,
|
2463
|
+
const { getState, options: { enableColumnResizing, enableStickyHeader, enableTableFooter, enableTableHead, layoutMode, memoMode, muiTableProps, }, } = table;
|
3018
2464
|
const { isFullScreen } = getState();
|
3019
2465
|
const tableProps = muiTableProps instanceof Function
|
3020
2466
|
? muiTableProps({ table })
|
3021
2467
|
: muiTableProps;
|
3022
|
-
return (
|
2468
|
+
return (React.createElement(Table, Object.assign({ stickyHeader: enableStickyHeader || isFullScreen }, tableProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table', tableLayout: enableColumnResizing ? 'fixed' : 'auto' }, ((tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx) instanceof Function
|
3023
2469
|
? tableProps.sx(theme)
|
3024
2470
|
: tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx))) }),
|
3025
|
-
enableTableHead &&
|
3026
|
-
memoMode === 'table-body' ? (
|
3027
|
-
enableTableFooter &&
|
2471
|
+
enableTableHead && React.createElement(MRT_TableHead, { table: table }),
|
2472
|
+
memoMode === 'table-body' ? (React.createElement(Memo_MRT_TableBody, { table: table })) : (React.createElement(MRT_TableBody, { table: table })),
|
2473
|
+
enableTableFooter && React.createElement(MRT_TableFooter, { table: table })));
|
3028
2474
|
};
|
3029
2475
|
|
3030
2476
|
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
3031
2477
|
const MRT_TableContainer = ({ table }) => {
|
3032
|
-
const { getState, options: { enableStickyHeader,
|
2478
|
+
const { getState, options: { enableStickyHeader, muiTableContainerProps }, refs: { tableContainerRef, bottomToolbarRef, topToolbarRef }, } = table;
|
3033
2479
|
const { isFullScreen } = getState();
|
3034
2480
|
const [totalToolbarHeight, setTotalToolbarHeight] = useState(0);
|
3035
2481
|
const tableContainerProps = muiTableContainerProps instanceof Function
|
@@ -3045,7 +2491,7 @@ const MRT_TableContainer = ({ table }) => {
|
|
3045
2491
|
: 0;
|
3046
2492
|
setTotalToolbarHeight(topToolbarHeight + bottomToolbarHeight);
|
3047
2493
|
});
|
3048
|
-
return (
|
2494
|
+
return (React.createElement(TableContainer, Object.assign({}, tableContainerProps, { ref: (node) => {
|
3049
2495
|
if (node) {
|
3050
2496
|
tableContainerRef.current = node;
|
3051
2497
|
if (tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.ref) {
|
@@ -3053,14 +2499,14 @@ const MRT_TableContainer = ({ table }) => {
|
|
3053
2499
|
tableContainerProps.ref.current = node;
|
3054
2500
|
}
|
3055
2501
|
}
|
3056
|
-
}, sx: (theme) => (Object.assign({ maxWidth: '100%', maxHeight: enableStickyHeader
|
2502
|
+
}, sx: (theme) => (Object.assign({ maxWidth: '100%', maxHeight: enableStickyHeader
|
3057
2503
|
? `clamp(350px, calc(100vh - ${totalToolbarHeight}px), 9999px)`
|
3058
2504
|
: undefined, overflow: 'auto' }, ((tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx) instanceof Function
|
3059
2505
|
? tableContainerProps.sx(theme)
|
3060
2506
|
: tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx))), style: Object.assign({ maxHeight: isFullScreen
|
3061
2507
|
? `calc(100vh - ${totalToolbarHeight}px)`
|
3062
2508
|
: undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style) }),
|
3063
|
-
|
2509
|
+
React.createElement(MRT_Table, { table: table })));
|
3064
2510
|
};
|
3065
2511
|
|
3066
2512
|
const MRT_TablePaper = ({ table }) => {
|
@@ -3069,7 +2515,7 @@ const MRT_TablePaper = ({ table }) => {
|
|
3069
2515
|
const tablePaperProps = muiTablePaperProps instanceof Function
|
3070
2516
|
? muiTablePaperProps({ table })
|
3071
2517
|
: muiTablePaperProps;
|
3072
|
-
return (
|
2518
|
+
return (React.createElement(Paper, Object.assign({ elevation: 2 }, tablePaperProps, { ref: (ref) => {
|
3073
2519
|
tablePaperRef.current = ref;
|
3074
2520
|
if (tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.ref) {
|
3075
2521
|
//@ts-ignore
|
@@ -3090,21 +2536,21 @@ const MRT_TablePaper = ({ table }) => {
|
|
3090
2536
|
enableTopToolbar &&
|
3091
2537
|
(renderTopToolbar instanceof Function
|
3092
2538
|
? renderTopToolbar({ table })
|
3093
|
-
: renderTopToolbar !== null && renderTopToolbar !== void 0 ? renderTopToolbar :
|
3094
|
-
|
2539
|
+
: renderTopToolbar !== null && renderTopToolbar !== void 0 ? renderTopToolbar : React.createElement(MRT_TopToolbar, { table: table })),
|
2540
|
+
React.createElement(MRT_TableContainer, { table: table }),
|
3095
2541
|
enableBottomToolbar &&
|
3096
2542
|
(renderBottomToolbar instanceof Function
|
3097
2543
|
? renderBottomToolbar({ table })
|
3098
|
-
: renderBottomToolbar !== null && renderBottomToolbar !== void 0 ? renderBottomToolbar :
|
2544
|
+
: renderBottomToolbar !== null && renderBottomToolbar !== void 0 ? renderBottomToolbar : React.createElement(MRT_BottomToolbar, { table: table }))));
|
3099
2545
|
};
|
3100
2546
|
|
3101
2547
|
const MRT_EditRowModal = ({ open, row, table, }) => {
|
3102
2548
|
const { options: { localization }, } = table;
|
3103
|
-
return (
|
3104
|
-
|
3105
|
-
|
3106
|
-
|
3107
|
-
|
2549
|
+
return (React.createElement(Dialog, { open: open },
|
2550
|
+
React.createElement(DialogTitle, { textAlign: "center" }, localization.edit),
|
2551
|
+
React.createElement(DialogContent, null,
|
2552
|
+
React.createElement("form", { onSubmit: (e) => e.preventDefault() },
|
2553
|
+
React.createElement(Stack, { sx: {
|
3108
2554
|
gap: '1.5rem',
|
3109
2555
|
minWidth: { xs: '300px', sm: '360px', md: '400px' },
|
3110
2556
|
pt: '1rem',
|
@@ -3112,9 +2558,9 @@ const MRT_EditRowModal = ({ open, row, table, }) => {
|
|
3112
2558
|
} }, row
|
3113
2559
|
.getAllCells()
|
3114
2560
|
.filter((cell) => cell.column.columnDef.columnDefType === 'data')
|
3115
|
-
.map((cell) => (
|
3116
|
-
|
3117
|
-
|
2561
|
+
.map((cell) => (React.createElement(MRT_EditCellTextField, { cell: cell, key: cell.id, showLabel: true, table: table })))))),
|
2562
|
+
React.createElement(DialogActions, { sx: { p: '1.25rem' } },
|
2563
|
+
React.createElement(MRT_EditActionButtons, { row: row, table: table, variant: "text" }))));
|
3118
2564
|
};
|
3119
2565
|
|
3120
2566
|
const MRT_TableRoot = (props) => {
|
@@ -3161,13 +2607,13 @@ const MRT_TableRoot = (props) => {
|
|
3161
2607
|
var _a, _b, _c, _d, _e;
|
3162
2608
|
return [
|
3163
2609
|
columnOrder.includes('mrt-row-drag') && Object.assign(Object.assign(Object.assign({ header: props.localization.move, size: 60 }, props.defaultDisplayColumn), (_a = props.displayColumnDefOptions) === null || _a === void 0 ? void 0 : _a['mrt-row-drag']), { id: 'mrt-row-drag' }),
|
3164
|
-
columnOrder.includes('mrt-row-actions') && Object.assign(Object.assign(Object.assign({ Cell: ({ cell, row }) => (
|
2610
|
+
columnOrder.includes('mrt-row-actions') && Object.assign(Object.assign(Object.assign({ Cell: ({ cell, row }) => (React.createElement(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, table: table })), header: props.localization.actions, size: 70 }, props.defaultDisplayColumn), (_b = props.displayColumnDefOptions) === null || _b === void 0 ? void 0 : _b['mrt-row-actions']), { id: 'mrt-row-actions' }),
|
3165
2611
|
columnOrder.includes('mrt-row-expand') &&
|
3166
|
-
showExpandColumn(props, grouping) && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (
|
3167
|
-
? () =>
|
2612
|
+
showExpandColumn(props, grouping) && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React.createElement(MRT_ExpandButton, { row: row, table: table })), Header: props.enableExpandAll
|
2613
|
+
? () => React.createElement(MRT_ExpandAllButton, { table: table })
|
3168
2614
|
: null, header: props.localization.expand, size: 60 }, props.defaultDisplayColumn), (_c = props.displayColumnDefOptions) === null || _c === void 0 ? void 0 : _c['mrt-row-expand']), { id: 'mrt-row-expand' }),
|
3169
|
-
columnOrder.includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (
|
3170
|
-
? () =>
|
2615
|
+
columnOrder.includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React.createElement(MRT_SelectCheckbox, { row: row, table: table })), Header: props.enableSelectAll && props.enableMultiRowSelection
|
2616
|
+
? () => React.createElement(MRT_SelectCheckbox, { selectAll: true, table: table })
|
3171
2617
|
: null, header: props.localization.select, size: 60 }, props.defaultDisplayColumn), (_d = props.displayColumnDefOptions) === null || _d === void 0 ? void 0 : _d['mrt-row-select']), { id: 'mrt-row-select' }),
|
3172
2618
|
columnOrder.includes('mrt-row-numbers') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => row.index + 1, Header: () => props.localization.rowNumber, header: props.localization.rowNumbers, size: 60 }, props.defaultDisplayColumn), (_e = props.displayColumnDefOptions) === null || _e === void 0 ? void 0 : _e['mrt-row-numbers']), { id: 'mrt-row-numbers' }),
|
3173
2619
|
].filter(Boolean);
|
@@ -3271,11 +2717,11 @@ const MRT_TableRoot = (props) => {
|
|
3271
2717
|
}
|
3272
2718
|
}
|
3273
2719
|
}, [table.getState().isFullScreen]);
|
3274
|
-
return (
|
3275
|
-
|
3276
|
-
|
3277
|
-
!table.getState().isFullScreen && (
|
3278
|
-
editingRow && props.editingMode === 'modal' && (
|
2720
|
+
return (React.createElement(React.Fragment, null,
|
2721
|
+
React.createElement(Dialog, { PaperComponent: Box, TransitionComponent: !props.enableRowVirtualization ? Grow : undefined, disablePortal: true, fullScreen: true, keepMounted: false, onClose: () => table.setIsFullScreen(false), open: table.getState().isFullScreen, transitionDuration: 400 },
|
2722
|
+
React.createElement(MRT_TablePaper, { table: table })),
|
2723
|
+
!table.getState().isFullScreen && (React.createElement(MRT_TablePaper, { table: table })),
|
2724
|
+
editingRow && props.editingMode === 'modal' && (React.createElement(MRT_EditRowModal, { row: editingRow, table: table, open: true }))));
|
3279
2725
|
};
|
3280
2726
|
|
3281
2727
|
const MRT_Localization_EN = {
|
@@ -3379,10 +2825,12 @@ const MaterialReactTable = (_a) => {
|
|
3379
2825
|
const _sortingFns = useMemo(() => (Object.assign(Object.assign({}, MRT_SortingFns), sortingFns)), []);
|
3380
2826
|
const _defaultColumn = useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultColumn), defaultColumn)), []);
|
3381
2827
|
const _defaultDisplayColumn = useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultDisplayColumn), defaultDisplayColumn)), []);
|
3382
|
-
if (rest.enableRowVirtualization)
|
2828
|
+
if (rest.enableRowVirtualization) {
|
3383
2829
|
layoutMode = 'grid';
|
3384
|
-
|
2830
|
+
enableStickyHeader = true;
|
2831
|
+
}
|
2832
|
+
return (React.createElement(MRT_TableRoot, Object.assign({ aggregationFns: _aggregationFns, autoResetExpanded: autoResetExpanded, columnResizeMode: columnResizeMode, defaultColumn: _defaultColumn, defaultDisplayColumn: _defaultDisplayColumn, editingMode: editingMode, enableBottomToolbar: enableBottomToolbar, enableColumnActions: enableColumnActions, enableColumnFilters: enableColumnFilters, enableColumnOrdering: enableColumnOrdering, enableColumnResizing: enableColumnResizing, enableDensityToggle: enableDensityToggle, enableExpandAll: enableExpandAll, enableFilters: enableFilters, enableFullScreenToggle: enableFullScreenToggle, enableGlobalFilter: enableGlobalFilter, enableGlobalFilterRankedResults: enableGlobalFilterRankedResults, enableGrouping: enableGrouping, enableHiding: enableHiding, enableMultiRowSelection: enableMultiRowSelection, enableMultiSort: enableMultiSort, enablePagination: enablePagination, enablePinning: enablePinning, enableRowSelection: enableRowSelection, enableSelectAll: enableSelectAll, enableSorting: enableSorting, enableStickyHeader: enableStickyHeader, enableTableFooter: enableTableFooter, enableTableHead: enableTableHead, enableToolbarInternalActions: enableToolbarInternalActions, enableTopToolbar: enableTopToolbar, filterFns: _filterFns, icons: _icons, layoutMode: layoutMode, localization: _localization, positionActionsColumn: positionActionsColumn, positionExpandColumn: positionExpandColumn, positionGlobalFilter: positionGlobalFilter, positionPagination: positionPagination, positionToolbarAlertBanner: positionToolbarAlertBanner, positionToolbarDropZone: positionToolbarDropZone, rowNumberMode: rowNumberMode, selectAllMode: selectAllMode, sortingFns: _sortingFns }, rest)));
|
3385
2833
|
};
|
3386
2834
|
|
3387
|
-
export { MRT_CopyButton, MRT_FilterOptionMenu, MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_ShowHideColumnsButton, MRT_TablePagination, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MRT_ToolbarInternalButtons, MaterialReactTable as default };
|
2835
|
+
export { MRT_CopyButton, MRT_FilterOptionMenu, MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_ShowHideColumnsButton, MRT_TablePagination, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MRT_ToolbarAlertBanner, MRT_ToolbarDropZone, MRT_ToolbarInternalButtons, MaterialReactTable as default };
|
3388
2836
|
//# sourceMappingURL=material-react-table.esm.js.map
|