material-react-table 1.4.0-beta.1 → 1.4.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +624 -65
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/MaterialReactTable.d.ts +4 -11
- package/dist/cjs/types/_locales/nl.d.ts +2 -0
- package/dist/cjs/types/body/MRT_TableBodyRow.d.ts +3 -1
- package/dist/cjs/types/table/MRT_TableRoot.d.ts +3 -3
- package/dist/esm/material-react-table.esm.js +909 -368
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/types/MaterialReactTable.d.ts +4 -11
- package/dist/esm/types/_locales/nl.d.ts +2 -0
- package/dist/esm/types/body/MRT_TableBodyRow.d.ts +3 -1
- package/dist/esm/types/table/MRT_TableRoot.d.ts +3 -3
- package/dist/index.d.ts +5 -12
- package/locales/nl.d.ts +2 -0
- package/locales/nl.esm.d.ts +2 -0
- package/locales/nl.esm.js +94 -0
- package/locales/nl.esm.js.map +1 -0
- package/locales/nl.js +98 -0
- package/locales/nl.js.map +1 -0
- package/package.json +4 -3
- package/src/MaterialReactTable.tsx +9 -20
- package/src/_locales/nl.ts +94 -0
- package/src/body/MRT_TableBody.tsx +45 -72
- package/src/body/MRT_TableBodyRow.tsx +14 -5
- package/src/table/MRT_TableContainer.tsx +7 -5
@@ -1,4 +1,5 @@
|
|
1
|
-
import
|
1
|
+
import * as React from 'react';
|
2
|
+
import React__default, { useMemo, useRef, useState, useCallback, useEffect, Fragment, memo as memo$1, useLayoutEffect } from 'react';
|
2
3
|
import { aggregationFns, filterFns, sortingFns, useReactTable, getCoreRowModel, getExpandedRowModel, getFacetedRowModel, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel } from '@tanstack/react-table';
|
3
4
|
import { alpha, lighten, useTheme, darken } from '@mui/material/styles';
|
4
5
|
import { rankItem, rankings, compareItems } from '@tanstack/match-sorter-utils';
|
@@ -67,7 +68,6 @@ import TableHead from '@mui/material/TableHead';
|
|
67
68
|
import TableRow from '@mui/material/TableRow';
|
68
69
|
import TableCell from '@mui/material/TableCell';
|
69
70
|
import TableSortLabel from '@mui/material/TableSortLabel';
|
70
|
-
import { useVirtual } from '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__default.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__default.createElement("span", null,
|
418
|
+
React__default.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__default.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__default.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__default.createElement("span", null,
|
446
|
+
React__default.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__default.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__default.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__default.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__default.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__default.createElement(Box, { sx: { minWidth: '70px', textAlign: 'center' } }, column.getIsPinned() ? (React__default.createElement(Tooltip, { arrow: true, title: localization.unpin },
|
617
|
+
React__default.createElement(IconButton, { onClick: () => handlePinColumn(false), size: "small" },
|
618
|
+
React__default.createElement(PushPinIcon, null)))) : (React__default.createElement(React__default.Fragment, null,
|
619
|
+
React__default.createElement(Tooltip, { arrow: true, title: localization.pinToLeft },
|
620
|
+
React__default.createElement(IconButton, { onClick: () => handlePinColumn('left'), size: "small" },
|
621
|
+
React__default.createElement(PushPinIcon, { style: {
|
622
622
|
transform: 'rotate(90deg)',
|
623
623
|
} }))),
|
624
|
-
|
625
|
-
|
626
|
-
|
624
|
+
React__default.createElement(Tooltip, { arrow: true, title: localization.pinToRight },
|
625
|
+
React__default.createElement(IconButton, { onClick: () => handlePinColumn('right'), size: "small" },
|
626
|
+
React__default.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__default.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__default.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__default.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__default.createElement(React__default.Fragment, null,
|
689
|
+
React__default.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__default.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__default.createElement(MRT_GrabHandleButton, { onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table })) : (React__default.createElement(Box, { sx: { width: '28px' } }))),
|
712
712
|
!isSubMenu &&
|
713
713
|
enablePinning &&
|
714
|
-
(column.getCanPin() ? (
|
715
|
-
enableHiding ? (
|
714
|
+
(column.getCanPin() ? (React__default.createElement(MRT_ColumnPinningButtons, { column: column, table: table })) : (React__default.createElement(Box, { sx: { width: '70px' } }))),
|
715
|
+
enableHiding ? (React__default.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__default.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.toggleVisibility },
|
723
|
+
React__default.createElement(Switch, null)), disabled: (isSubMenu && switchChecked) || !column.getCanHide(), label: columnDef.header, onChange: () => handleToggleColumnHidden(column) })) : (React__default.createElement(Typography, { sx: { alignSelf: 'center' } }, columnDef.header)))), (_a = column.columns) === null || _a === void 0 ? void 0 :
|
724
|
+
_a.map((c, i) => (React__default.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__default.createElement(Menu, { anchorEl: anchorEl, open: !!anchorEl, onClose: () => setAnchorEl(null), MenuListProps: {
|
756
756
|
dense: density === 'compact',
|
757
757
|
} },
|
758
|
-
|
758
|
+
React__default.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__default.createElement(Button, { disabled: !getIsSomeColumnsVisible(), onClick: hideAllColumns }, localization.hideAll)),
|
765
|
+
!isSubMenu && enableColumnOrdering && (React__default.createElement(Button, { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options)) }, localization.resetOrder)),
|
766
|
+
!isSubMenu && enablePinning && (React__default.createElement(Button, { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true) }, localization.unpinAll)),
|
767
|
+
enableHiding && (React__default.createElement(Button, { disabled: getIsAllColumnsVisible(), onClick: () => toggleAllColumnsVisible(true) }, localization.showAll))),
|
768
|
+
React__default.createElement(Divider, null),
|
769
|
+
allColumns.map((column, index) => (React__default.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__default.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__default.createElement(MenuItem, { disabled: !column.getIsSorted(), key: 0, onClick: handleClearSort, sx: commonMenuItemStyles },
|
860
|
+
React__default.createElement(Box, { sx: commonListItemStyles },
|
861
|
+
React__default.createElement(ListItemIcon, null,
|
862
|
+
React__default.createElement(ClearAllIcon, null)),
|
863
863
|
localization.clearSort)),
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
864
|
+
React__default.createElement(MenuItem, { disabled: column.getIsSorted() === 'asc', key: 1, onClick: handleSortAsc, sx: commonMenuItemStyles },
|
865
|
+
React__default.createElement(Box, { sx: commonListItemStyles },
|
866
|
+
React__default.createElement(ListItemIcon, null,
|
867
|
+
React__default.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__default.createElement(MenuItem, { divider: enableColumnFilters || enableGrouping || enableHiding, key: 2, disabled: column.getIsSorted() === 'desc', onClick: handleSortDesc, sx: commonMenuItemStyles },
|
870
|
+
React__default.createElement(Box, { sx: commonListItemStyles },
|
871
|
+
React__default.createElement(ListItemIcon, null,
|
872
|
+
React__default.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__default.createElement(MenuItem, { disabled: !column.getFilterValue(), key: 0, onClick: handleClearFilter, sx: commonMenuItemStyles },
|
879
|
+
React__default.createElement(Box, { sx: commonListItemStyles },
|
880
|
+
React__default.createElement(ListItemIcon, null,
|
881
|
+
React__default.createElement(FilterListOffIcon, null)),
|
882
882
|
localization.clearFilter)),
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
883
|
+
React__default.createElement(MenuItem, { divider: enableGrouping || enableHiding, key: 1, onClick: handleFilterByColumn, sx: commonMenuItemStyles },
|
884
|
+
React__default.createElement(Box, { sx: commonListItemStyles },
|
885
|
+
React__default.createElement(ListItemIcon, null,
|
886
|
+
React__default.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__default.createElement(IconButton, { onClick: handleOpenFilterModeMenu, onMouseEnter: handleOpenFilterModeMenu, size: "small", sx: { p: 0 } },
|
889
|
+
React__default.createElement(ArrowRightIcon, null)))),
|
890
|
+
showFilterModeSubMenu && (React__default.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__default.createElement(MenuItem, { divider: enablePinning, key: 0, onClick: handleGroupByColumn, sx: commonMenuItemStyles },
|
895
|
+
React__default.createElement(Box, { sx: commonListItemStyles },
|
896
|
+
React__default.createElement(ListItemIcon, null,
|
897
|
+
React__default.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__default.createElement(MenuItem, { disabled: column.getIsPinned() === 'left' || !column.getCanPin(), key: 0, onClick: () => handlePinColumn('left'), sx: commonMenuItemStyles },
|
903
|
+
React__default.createElement(Box, { sx: commonListItemStyles },
|
904
|
+
React__default.createElement(ListItemIcon, null,
|
905
|
+
React__default.createElement(PushPinIcon, { style: { transform: 'rotate(90deg)' } })),
|
906
906
|
localization.pinToLeft)),
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
907
|
+
React__default.createElement(MenuItem, { disabled: column.getIsPinned() === 'right' || !column.getCanPin(), key: 1, onClick: () => handlePinColumn('right'), sx: commonMenuItemStyles },
|
908
|
+
React__default.createElement(Box, { sx: commonListItemStyles },
|
909
|
+
React__default.createElement(ListItemIcon, null,
|
910
|
+
React__default.createElement(PushPinIcon, { style: { transform: 'rotate(-90deg)' } })),
|
911
911
|
localization.pinToRight)),
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
912
|
+
React__default.createElement(MenuItem, { disabled: !column.getIsPinned(), divider: enableHiding, key: 2, onClick: () => handlePinColumn(false), sx: commonMenuItemStyles },
|
913
|
+
React__default.createElement(Box, { sx: commonListItemStyles },
|
914
|
+
React__default.createElement(ListItemIcon, null,
|
915
|
+
React__default.createElement(PushPinIcon, null)),
|
916
916
|
localization.unpin)),
|
917
917
|
],
|
918
918
|
enableColumnResizing &&
|
919
919
|
column.getCanResize() && [
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
920
|
+
React__default.createElement(MenuItem, { disabled: !columnSizing[column.id], key: 0, onClick: handleResetColumnSize, sx: commonMenuItemStyles },
|
921
|
+
React__default.createElement(Box, { sx: commonListItemStyles },
|
922
|
+
React__default.createElement(ListItemIcon, null,
|
923
|
+
React__default.createElement(RestartAltIcon, null)),
|
924
924
|
localization.resetColumnSize)),
|
925
925
|
],
|
926
926
|
enableHiding && [
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
927
|
+
React__default.createElement(MenuItem, { disabled: !column.getCanHide(), key: 0, onClick: handleHideColumn, sx: commonMenuItemStyles },
|
928
|
+
React__default.createElement(Box, { sx: commonListItemStyles },
|
929
|
+
React__default.createElement(ListItemIcon, null,
|
930
|
+
React__default.createElement(VisibilityOffIcon, null)), (_j = localization.hideColumn) === null || _j === void 0 ? void 0 :
|
931
931
|
_j.replace('{column}', String(columnDef.header)))),
|
932
|
-
|
932
|
+
React__default.createElement(MenuItem, { disabled: !Object.values(columnVisibility).filter((visible) => !visible)
|
933
933
|
.length, key: 1, onClick: handleShowAllColumns, sx: commonMenuItemStyles },
|
934
|
-
|
935
|
-
|
936
|
-
|
934
|
+
React__default.createElement(Box, { sx: commonListItemStyles },
|
935
|
+
React__default.createElement(ListItemIcon, null,
|
936
|
+
React__default.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__default.createElement(IconButton, { onClick: handleOpenShowHideColumnsMenu, onMouseEnter: handleOpenShowHideColumnsMenu, size: "small", sx: { p: 0 } },
|
939
|
+
React__default.createElement(ArrowRightIcon, null))),
|
940
|
+
React__default.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__default.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__default.createElement(MenuItem, { onClick: handleEdit, sx: commonMenuItemStyles },
|
951
|
+
React__default.createElement(Box, { sx: commonListItemStyles },
|
952
|
+
React__default.createElement(ListItemIcon, null,
|
953
|
+
React__default.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__default.createElement(Box, { onClick: (e) => e.stopPropagation(), sx: { display: 'flex', gap: '0.75rem' } }, variant === 'icon' ? (React__default.createElement(React__default.Fragment, null,
|
987
|
+
React__default.createElement(Tooltip, { arrow: true, title: localization.cancel },
|
988
|
+
React__default.createElement(IconButton, { "aria-label": localization.cancel, onClick: handleCancel },
|
989
|
+
React__default.createElement(CancelIcon, null))),
|
990
|
+
React__default.createElement(Tooltip, { arrow: true, title: localization.save },
|
991
|
+
React__default.createElement(IconButton, { "aria-label": localization.save, color: "info", onClick: handleSave },
|
992
|
+
React__default.createElement(SaveIcon, null))))) : (React__default.createElement(React__default.Fragment, null,
|
993
|
+
React__default.createElement(Button, { onClick: handleCancel }, localization.cancel),
|
994
|
+
React__default.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__default.createElement(React__default.Fragment, null, renderRowActions ? (React__default.createElement(React__default.Fragment, null, renderRowActions({ cell, row, table }))) : row.id === (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) && editingMode === 'row' ? (React__default.createElement(MRT_EditActionButtons, { row: row, table: table })) : !renderRowActionMenuItems && enableEditing ? (React__default.createElement(Tooltip, { placement: "right", arrow: true, title: localization.edit },
|
1022
|
+
React__default.createElement(IconButton, { "aria-label": localization.edit, sx: commonIconButtonStyles, onClick: handleStartEditMode },
|
1023
|
+
React__default.createElement(EditIcon, null)))) : renderRowActionMenuItems ? (React__default.createElement(React__default.Fragment, null,
|
1024
|
+
React__default.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.rowActions },
|
1025
|
+
React__default.createElement(IconButton, { "aria-label": localization.rowActions, onClick: handleOpenRowActionMenu, size: "small", sx: commonIconButtonStyles },
|
1026
|
+
React__default.createElement(MoreHorizIcon, null))),
|
1027
|
+
React__default.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__default.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__default.createElement(Radio, Object.assign({}, commonProps))) : (React__default.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__default.createElement(Collapse, { in: showGlobalFilter, orientation: "horizontal", unmountOnExit: true, mountOnEnter: true },
|
1100
|
+
React__default.createElement(TextField, Object.assign({ placeholder: localization.search, onChange: handleChange, value: searchValue !== null && searchValue !== void 0 ? searchValue : '', variant: "standard", InputProps: {
|
1101
|
+
startAdornment: enableGlobalFilterModes ? (React__default.createElement(InputAdornment, { position: "start" },
|
1102
|
+
React__default.createElement(Tooltip, { arrow: true, title: localization.changeSearchMode },
|
1103
|
+
React__default.createElement(IconButton, { "aria-label": localization.changeSearchMode, onClick: handleGlobalFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' } },
|
1104
|
+
React__default.createElement(SearchIcon, null))))) : (React__default.createElement(SearchIcon, { style: { marginRight: '4px' } })),
|
1105
|
+
endAdornment: (React__default.createElement(InputAdornment, { position: "end" },
|
1106
|
+
React__default.createElement(Tooltip, { arrow: true, title: (_a = localization.clearSearch) !== null && _a !== void 0 ? _a : '' },
|
1107
|
+
React__default.createElement("span", null,
|
1108
|
+
React__default.createElement(IconButton, { "aria-label": localization.clearSearch, disabled: !(searchValue === null || searchValue === void 0 ? void 0 : searchValue.length), onClick: handleClear, size: "small" },
|
1109
|
+
React__default.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__default.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__default.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__default.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__default.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__default.createElement("span", null,
|
1187
1187
|
localization.groupedBy,
|
1188
1188
|
' ',
|
1189
|
-
grouping.map((columnId, index) => (
|
1189
|
+
grouping.map((columnId, index) => (React__default.createElement(Fragment, { key: `${index}-${columnId}` },
|
1190
1190
|
index > 0 ? localization.thenBy : '',
|
1191
|
-
|
1192
|
-
return (
|
1193
|
-
|
1191
|
+
React__default.createElement(Chip, Object.assign({ label: table.getColumn(columnId).columnDef.header, onDelete: () => table.getColumn(columnId).toggleGrouping() }, chipProps))))))) : null;
|
1192
|
+
return (React__default.createElement(Collapse, { in: showAlertBanner || !!selectMessage || !!groupedByMessage, timeout: stackAlertBanner ? 200 : 0 },
|
1193
|
+
React__default.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__default.createElement(AlertTitle, null, alertProps.title),
|
1201
|
+
React__default.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__default.createElement("br", null)),
|
1204
1204
|
selectMessage,
|
1205
|
-
selectMessage && groupedByMessage &&
|
1205
|
+
selectMessage && groupedByMessage && React__default.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__default.createElement(Tooltip, { arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleFullScreen },
|
1218
|
+
React__default.createElement(IconButton, Object.assign({ "aria-label": localization.showHideFilters, onClick: handleToggleFullScreen }, rest, { title: undefined }), isFullScreen ? React__default.createElement(FullscreenExitIcon, null) : React__default.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__default.createElement(React__default.Fragment, null,
|
1230
|
+
React__default.createElement(Tooltip, { arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.showHideColumns },
|
1231
|
+
React__default.createElement(IconButton, Object.assign({ "aria-label": localization.showHideColumns, onClick: handleClick }, rest, { title: undefined }),
|
1232
|
+
React__default.createElement(ViewColumnIcon, null))),
|
1233
|
+
React__default.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__default.createElement(Tooltip, { arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleDensity },
|
1250
|
+
React__default.createElement(IconButton, Object.assign({ "aria-label": localization.toggleDensity, onClick: handleToggleDensePadding }, rest, { title: undefined }), density === 'compact' ? (React__default.createElement(DensitySmallIcon, null)) : density === 'comfortable' ? (React__default.createElement(DensityMediumIcon, null)) : (React__default.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__default.createElement(Tooltip, { arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.showHideFilters },
|
1262
|
+
React__default.createElement(IconButton, Object.assign({ "aria-label": localization.showHideFilters, onClick: handleToggleShowFilters }, rest, { title: undefined }), showColumnFilters ? React__default.createElement(FilterListOffIcon, null) : React__default.createElement(FilterListIcon, null))));
|
1263
1263
|
};
|
1264
1264
|
|
1265
1265
|
const MRT_ToggleGlobalFilterButton = (_a) => {
|
@@ -1271,27 +1271,27 @@ 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__default.createElement(Tooltip, { arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.showHideSearch },
|
1275
|
+
React__default.createElement(IconButton, Object.assign({ disabled: !!globalFilter, onClick: handleToggleSearch }, rest, { title: undefined }), showGlobalFilter ? React__default.createElement(SearchOffIcon, null) : React__default.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__default.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__default.createElement(React__default.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__default.createElement(MRT_ToggleGlobalFilterButton, { table: table })),
|
1291
|
+
enableFilters && enableColumnFilters && (React__default.createElement(MRT_ToggleFiltersButton, { table: table })),
|
1292
|
+
(enableHiding || enableColumnOrdering || enablePinning) && (React__default.createElement(MRT_ShowHideColumnsButton, { table: table })),
|
1293
|
+
enableDensityToggle && (React__default.createElement(MRT_ToggleDensePaddingButton, { table: table })),
|
1294
|
+
enableFullScreenToggle && (React__default.createElement(MRT_FullScreenToggleButton, { table: table }))))));
|
1295
1295
|
};
|
1296
1296
|
|
1297
1297
|
const MRT_ToolbarDropZone = ({ table }) => {
|
@@ -1301,10 +1301,10 @@ const MRT_ToolbarDropZone = ({ table }) => {
|
|
1301
1301
|
const handleDragEnter = (_event) => {
|
1302
1302
|
setHoveredColumn({ id: 'drop-zone' });
|
1303
1303
|
};
|
1304
|
-
return (
|
1304
|
+
return (React__default.createElement(Fade, { unmountOnExit: true, mountOnEnter: true, in: !!enableGrouping &&
|
1305
1305
|
!!draggingColumn &&
|
1306
1306
|
!grouping.includes(draggingColumn.id) },
|
1307
|
-
|
1307
|
+
React__default.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__default.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__default.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__default.createElement(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })),
|
1352
|
+
['both', 'top'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (React__default.createElement(MRT_ToolbarDropZone, { table: table })),
|
1353
|
+
React__default.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__default.createElement(MRT_GlobalFilterTextField, { table: table })), (_a = renderTopToolbarCustomActions === null || renderTopToolbarCustomActions === void 0 ? void 0 : renderTopToolbarCustomActions({ table })) !== null && _a !== void 0 ? _a : React__default.createElement("span", null),
|
1365
|
+
enableToolbarInternalActions ? (React__default.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__default.createElement(MRT_GlobalFilterTextField, { table: table })),
|
1371
|
+
React__default.createElement(MRT_ToolbarInternalButtons, { table: table }))) : (enableGlobalFilter &&
|
1372
|
+
positionGlobalFilter === 'right' && (React__default.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__default.createElement(MRT_TablePagination, { table: table, position: "top" })),
|
1375
|
+
React__default.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__default.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__default.createElement(MRT_LinearProgressBar, { isTopToolbar: false, table: table }),
|
1396
|
+
positionToolbarAlertBanner === 'bottom' && (React__default.createElement(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })),
|
1397
|
+
['both', 'bottom'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (React__default.createElement(MRT_ToolbarDropZone, { table: table })),
|
1398
|
+
React__default.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__default.createElement("span", null)),
|
1407
|
+
React__default.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__default.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__default.createElement(React__default.Fragment, null,
|
1439
|
+
React__default.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__default.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__default.createElement(MoreVertIcon, null))),
|
1446
|
+
anchorEl && (React__default.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__default.createElement(React__default.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__default.createElement(React__default.Fragment, null,
|
1560
|
+
React__default.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__default.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__default.createElement(InputAdornment, { position: "start" },
|
1580
|
+
React__default.createElement(Tooltip, { arrow: true, title: localization.changeFilterMode },
|
1581
|
+
React__default.createElement("span", null,
|
1582
|
+
React__default.createElement(IconButton, { "aria-label": localization.changeFilterMode, onClick: handleFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' } },
|
1583
|
+
React__default.createElement(FilterListIcon, null)))),
|
1584
|
+
filterChipLabel && (React__default.createElement(Chip, { onDelete: handleClearEmptyFilterChip, label: filterChipLabel })))) : null,
|
1585
|
+
endAdornment: !filterChipLabel && (React__default.createElement(InputAdornment, { position: "end" },
|
1586
|
+
React__default.createElement(Tooltip, { arrow: true, placement: "right", title: (_g = localization.clearFilter) !== null && _g !== void 0 ? _g : '' },
|
1587
|
+
React__default.createElement("span", null,
|
1588
|
+
React__default.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__default.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__default.createElement(Box, { sx: { opacity: 0.5 } }, filterPlaceholder)) : (React__default.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__default.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__default.createElement(MenuItem, { divider: true, disabled: true, hidden: true, value: "" },
|
1623
|
+
React__default.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__default.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__default.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__default.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__default.createElement(Box, { sx: { display: 'grid', gridTemplateColumns: '6fr 6fr', gap: '1rem' } },
|
1650
|
+
React__default.createElement(MRT_FilterTextField, { header: header, rangeFilterIndex: 0, table: table }),
|
1651
|
+
React__default.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__default.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__default.createElement(FormControlLabel, { control: React__default.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__default.createElement(Collapse, { in: showColumnFilters, mountOnEnter: true, unmountOnExit: true }, columnDef.filterVariant === 'checkbox' ? (React__default.createElement(MRT_FilterCheckbox, { column: column, table: table })) : columnDef.filterVariant === 'range' ||
|
1697
|
+
['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn) ? (React__default.createElement(MRT_FilterRangeFields, { header: header, table: table })) : (React__default.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__default.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__default.createElement(Box, { component: "span", sx: { flex: '0 0' } },
|
1722
|
+
React__default.createElement(Tooltip, { arrow: true, placement: "top", title: filterTooltip },
|
1723
|
+
React__default.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__default.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__default.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__default.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__default.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__default.createElement(Tooltip, { arrow: true, placement: "top", title: sortTooltip },
|
1822
|
+
React__default.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__default.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__default.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__default.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__default.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__default.createElement(MRT_TableHeadCellSortLabel, { header: header, table: table, tableCellProps: tableCellProps })),
|
1955
|
+
column.getCanFilter() && (React__default.createElement(MRT_TableHeadCellFilterLabel, { header: header, table: table }))),
|
1956
|
+
columnDefType !== 'group' && (React__default.createElement(Box, { className: "Mui-TableHeadCell-Content-Actions", sx: { whiteSpace: 'nowrap' } },
|
1957
|
+
showDragHandle && (React__default.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__default.createElement(MRT_TableHeadCellColumnActionsButton, { header: header, table: table })))),
|
1961
|
+
column.getCanResize() && (React__default.createElement(MRT_TableHeadCellResizeHandle, { header: header, table: table })))),
|
1962
|
+
column.getCanFilter() && (React__default.createElement(MRT_TableHeadCellFilterContainer, { header: header, table: table }))));
|
1963
1963
|
};
|
1964
1964
|
|
1965
1965
|
const MRT_TableHeadRow = ({ headerGroup, table }) => {
|
@@ -1967,9 +1967,9 @@ 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__default.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__default.createElement(MRT_TableHeadCell, { header: header, key: header.id, table: table })))));
|
1973
1973
|
};
|
1974
1974
|
|
1975
1975
|
const MRT_TableHead = ({ table }) => {
|
@@ -1979,11 +1979,574 @@ const MRT_TableHead = ({ table }) => {
|
|
1979
1979
|
? muiTableHeadProps({ table })
|
1980
1980
|
: muiTableHeadProps;
|
1981
1981
|
const stickyHeader = enableStickyHeader || enableRowVirtualization || isFullScreen;
|
1982
|
-
return (
|
1982
|
+
return (React__default.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__default.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
|
+
|
1987
2550
|
const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
|
1988
2551
|
var _a;
|
1989
2552
|
const { getState, options: { muiTableBodyCellEditTextFieldProps }, refs: { editInputRefs }, setEditingCell, setEditingRow, } = table;
|
@@ -2030,9 +2593,9 @@ const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
|
|
2030
2593
|
}
|
2031
2594
|
};
|
2032
2595
|
if (columnDef.Edit) {
|
2033
|
-
return
|
2596
|
+
return React__default.createElement(React__default.Fragment, null, (_a = columnDef.Edit) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table }));
|
2034
2597
|
}
|
2035
|
-
return (
|
2598
|
+
return (React__default.createElement(TextField, Object.assign({ disabled: columnDef.enableEditing === false, fullWidth: true, inputRef: (inputRef) => {
|
2036
2599
|
if (inputRef) {
|
2037
2600
|
editInputRefs.current[column.id] = inputRef;
|
2038
2601
|
if (textFieldProps.inputRef) {
|
@@ -2070,8 +2633,8 @@ const MRT_CopyButton = ({ cell, children, table, }) => {
|
|
2070
2633
|
})
|
2071
2634
|
: columnDef.muiTableBodyCellCopyButtonProps;
|
2072
2635
|
const buttonProps = Object.assign(Object.assign({}, mTableBodyCellCopyButtonProps), mcTableBodyCellCopyButtonProps);
|
2073
|
-
return (
|
2074
|
-
|
2636
|
+
return (React__default.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) },
|
2637
|
+
React__default.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
|
2075
2638
|
? buttonProps.sx(theme)
|
2076
2639
|
: buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx))), title: undefined }), children)));
|
2077
2640
|
};
|
@@ -2094,14 +2657,14 @@ const MRT_TableBodyRowGrabHandle = ({ cell, rowRef, table, }) => {
|
|
2094
2657
|
table.setDraggingRow(null);
|
2095
2658
|
table.setHoveredRow(null);
|
2096
2659
|
};
|
2097
|
-
return (
|
2660
|
+
return (React__default.createElement(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
|
2098
2661
|
};
|
2099
2662
|
|
2100
2663
|
const MRT_TableBodyCellValue = ({ cell, table }) => {
|
2101
2664
|
var _a, _b;
|
2102
2665
|
const { column, row } = cell;
|
2103
2666
|
const { columnDef } = column;
|
2104
|
-
return (
|
2667
|
+
return (React__default.createElement(React__default.Fragment, null, cell.getIsAggregated() && columnDef.AggregatedCell
|
2105
2668
|
? columnDef.AggregatedCell({
|
2106
2669
|
cell,
|
2107
2670
|
column,
|
@@ -2192,7 +2755,7 @@ const MRT_TableBodyCell = ({ cell, enableHover, numRows, rowIndex, rowRef, table
|
|
2192
2755
|
setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
2193
2756
|
}
|
2194
2757
|
};
|
2195
|
-
return (
|
2758
|
+
return (React__default.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'
|
2196
2759
|
? columnDefType === 'display'
|
2197
2760
|
? '0 0.5rem'
|
2198
2761
|
: '0.5rem'
|
@@ -2219,20 +2782,20 @@ const MRT_TableBodyCell = ({ cell, enableHover, numRows, rowIndex, rowRef, table
|
|
2219
2782
|
: `${darken(theme.palette.background.default, 0.1)} !important`
|
2220
2783
|
: undefined,
|
2221
2784
|
} }, getCommonCellStyles({ column, table, theme, tableCellProps })), draggingBorders)) }),
|
2222
|
-
|
2785
|
+
React__default.createElement(React__default.Fragment, null, cell.getIsPlaceholder() ? null : isLoading || showSkeletons ? (React__default.createElement(Skeleton, Object.assign({ animation: "wave", height: 20, width: skeletonWidth }, skeletonProps))) : enableRowNumbers &&
|
2223
2786
|
rowNumberMode === 'static' &&
|
2224
|
-
column.id === 'mrt-row-numbers' ? (rowIndex + 1) : column.id === 'mrt-row-drag' ? (
|
2787
|
+
column.id === 'mrt-row-numbers' ? (rowIndex + 1) : column.id === 'mrt-row-drag' ? (React__default.createElement(MRT_TableBodyRowGrabHandle, { cell: cell, rowRef: rowRef, table: table })) : columnDefType === 'display' &&
|
2225
2788
|
(column.id === 'mrt-row-select' ||
|
2226
2789
|
column.id === 'mrt-row-expand' ||
|
2227
|
-
!row.getIsGrouped()) ? ((_a = columnDef.Cell) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table })) : isEditing ? (
|
2228
|
-
columnDef.enableClickToCopy !== false ? (
|
2229
|
-
|
2230
|
-
cell.getIsGrouped() && !columnDef.GroupedCell && (
|
2790
|
+
!row.getIsGrouped()) ? ((_a = columnDef.Cell) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table })) : isEditing ? (React__default.createElement(MRT_EditCellTextField, { cell: cell, table: table })) : (enableClickToCopy || columnDef.enableClickToCopy) &&
|
2791
|
+
columnDef.enableClickToCopy !== false ? (React__default.createElement(MRT_CopyButton, { cell: cell, table: table },
|
2792
|
+
React__default.createElement(MRT_TableBodyCellValue, { cell: cell, table: table }))) : (React__default.createElement(MRT_TableBodyCellValue, { cell: cell, table: table }))),
|
2793
|
+
cell.getIsGrouped() && !columnDef.GroupedCell && (React__default.createElement(React__default.Fragment, null,
|
2231
2794
|
" (", (_b = row.subRows) === null || _b === void 0 ? void 0 :
|
2232
2795
|
_b.length,
|
2233
2796
|
")"))));
|
2234
2797
|
};
|
2235
|
-
const Memo_MRT_TableBodyCell = memo(MRT_TableBodyCell, (prev, next) => next.cell === prev.cell);
|
2798
|
+
const Memo_MRT_TableBodyCell = memo$1(MRT_TableBodyCell, (prev, next) => next.cell === prev.cell);
|
2236
2799
|
|
2237
2800
|
const MRT_TableDetailPanel = ({ row, table }) => {
|
2238
2801
|
const { getVisibleLeafColumns, getState, options: { layoutMode, muiTableBodyRowProps, muiTableDetailPanelProps, renderDetailPanel, }, } = table;
|
@@ -2243,15 +2806,15 @@ const MRT_TableDetailPanel = ({ row, table }) => {
|
|
2243
2806
|
const tableCellProps = muiTableDetailPanelProps instanceof Function
|
2244
2807
|
? muiTableDetailPanelProps({ row, table })
|
2245
2808
|
: muiTableDetailPanelProps;
|
2246
|
-
return (
|
2809
|
+
return (React__default.createElement(TableRow, Object.assign({ sx: {
|
2247
2810
|
display: layoutMode === 'grid' ? 'flex' : 'table-row',
|
2248
2811
|
} }, tableRowProps),
|
2249
|
-
|
2812
|
+
React__default.createElement(TableCell, Object.assign({ colSpan: getVisibleLeafColumns().length }, tableCellProps, { sx: (theme) => (Object.assign({ borderBottom: !row.getIsExpanded() ? 'none' : undefined, 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
|
2250
2813
|
? tableCellProps.sx(theme)
|
2251
|
-
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))) }), renderDetailPanel && (
|
2814
|
+
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))) }), renderDetailPanel && (React__default.createElement(Collapse, { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true }, !isLoading && renderDetailPanel({ row, table }))))));
|
2252
2815
|
};
|
2253
2816
|
|
2254
|
-
const MRT_TableBodyRow = ({ numRows, row, rowIndex, table, virtualRow, }) => {
|
2817
|
+
const MRT_TableBodyRow = ({ measureElement, numRows, row, rowIndex, table, virtualRow, }) => {
|
2255
2818
|
const theme = useTheme();
|
2256
2819
|
const { getIsSomeColumnsPinned, getState, options: { enableRowOrdering, layoutMode, memoMode, muiTableBodyRowProps, renderDetailPanel, }, setHoveredRow, } = table;
|
2257
2820
|
const { draggingColumn, draggingRow, editingCell, editingRow, hoveredRow } = getState();
|
@@ -2274,13 +2837,15 @@ const MRT_TableBodyRow = ({ numRows, row, rowIndex, table, virtualRow, }) => {
|
|
2274
2837
|
border: draggingBorder,
|
2275
2838
|
}
|
2276
2839
|
: undefined;
|
2277
|
-
return (
|
2278
|
-
|
2279
|
-
|
2280
|
-
|
2281
|
-
|
2840
|
+
return (React__default.createElement(React__default.Fragment, null,
|
2841
|
+
React__default.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
|
+
if (node) {
|
2843
|
+
rowRef.current = node;
|
2844
|
+
measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
|
2282
2845
|
}
|
2283
|
-
} }, tableRowProps, { sx: (theme) => (Object.assign(Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.06), display: layoutMode === 'grid' ? 'flex' : 'table-row', opacity: (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id || (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id ? 0.5 : 1,
|
2846
|
+
} }, tableRowProps, { sx: (theme) => (Object.assign(Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.06), display: layoutMode === 'grid' ? 'flex' : 'table-row', opacity: (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id || (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id ? 0.5 : 1, position: virtualRow ? 'absolute' : undefined, top: virtualRow ? 0 : undefined, transform: virtualRow
|
2847
|
+
? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
|
2848
|
+
: undefined, transition: virtualRow ? 'none' : 'all 150ms ease-in-out', '&:hover td': {
|
2284
2849
|
backgroundColor: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false && getIsSomeColumnsPinned()
|
2285
2850
|
? theme.palette.mode === 'dark'
|
2286
2851
|
? `${lighten(theme.palette.background.default, 0.12)}`
|
@@ -2303,16 +2868,16 @@ const MRT_TableBodyRow = ({ numRows, row, rowIndex, table, virtualRow, }) => {
|
|
2303
2868
|
!draggingColumn &&
|
2304
2869
|
!draggingRow &&
|
2305
2870
|
(editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) !== cell.id &&
|
2306
|
-
(editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) !== row.id ? (
|
2871
|
+
(editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) !== row.id ? (React__default.createElement(Memo_MRT_TableBodyCell, Object.assign({}, props))) : (React__default.createElement(MRT_TableBodyCell, Object.assign({}, props)));
|
2307
2872
|
})),
|
2308
|
-
renderDetailPanel && !row.getIsGrouped() && (
|
2873
|
+
renderDetailPanel && !row.getIsGrouped() && (React__default.createElement(MRT_TableDetailPanel, { row: row, table: table }))));
|
2309
2874
|
};
|
2310
|
-
const Memo_MRT_TableBodyRow = memo(MRT_TableBodyRow, (prev, next) => prev.row === next.row);
|
2875
|
+
const Memo_MRT_TableBodyRow = memo$1(MRT_TableBodyRow, (prev, next) => prev.row === next.row);
|
2311
2876
|
|
2312
2877
|
const MRT_TableBody = ({ table }) => {
|
2313
2878
|
var _a, _b, _c;
|
2314
2879
|
const { getRowModel, getPrePaginationRowModel, getState, options: { enableGlobalFilterRankedResults, enablePagination, enableRowVirtualization, layoutMode, localization, manualFiltering, manualSorting, memoMode, muiTableBodyProps, virtualizerInstanceRef, virtualizerProps, }, refs: { tableContainerRef, tablePaperRef }, } = table;
|
2315
|
-
const { columnFilters, globalFilter, pagination, sorting } = getState();
|
2880
|
+
const { columnFilters, density, globalFilter, pagination, sorting } = getState();
|
2316
2881
|
const tableBodyProps = muiTableBodyProps instanceof Function
|
2317
2882
|
? muiTableBodyProps({ table })
|
2318
2883
|
: muiTableBodyProps;
|
@@ -2345,43 +2910,17 @@ const MRT_TableBody = ({ table }) => {
|
|
2345
2910
|
pagination.pageSize,
|
2346
2911
|
]);
|
2347
2912
|
const virtualizer = enableRowVirtualization
|
2348
|
-
?
|
2349
|
-
:
|
2350
|
-
if (virtualizerInstanceRef) {
|
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: 10 }, vProps))
|
2914
|
+
: undefined;
|
2915
|
+
if (virtualizerInstanceRef && virtualizer) {
|
2351
2916
|
virtualizerInstanceRef.current = virtualizer;
|
2352
2917
|
}
|
2353
|
-
|
2354
|
-
|
2355
|
-
// count: rows.length,
|
2356
|
-
// estimateSize: () => (density === 'compact' ? 25 : 50),
|
2357
|
-
// getScrollElement: () => tableContainerRef.current as HTMLDivElement,
|
2358
|
-
// overscan: 15,
|
2359
|
-
// ...vProps,
|
2360
|
-
// })
|
2361
|
-
// : ({} as any);
|
2362
|
-
const virtualRows = enableRowVirtualization ? virtualizer.virtualItems : [];
|
2363
|
-
// const virtualRows = enableRowVirtualization
|
2364
|
-
// ? virtualizer.getVirtualItems()
|
2365
|
-
// : [];
|
2366
|
-
let paddingTop = 0;
|
2367
|
-
let paddingBottom = 0;
|
2368
|
-
if (enableRowVirtualization) {
|
2369
|
-
paddingTop = virtualRows.length ? virtualRows[0].start : 0;
|
2370
|
-
paddingBottom = virtualRows.length
|
2371
|
-
? virtualizer.totalSize - virtualRows[virtualRows.length - 1].end
|
2372
|
-
: 0;
|
2373
|
-
}
|
2374
|
-
// if (enableRowVirtualization) {
|
2375
|
-
// paddingTop = !!virtualRows.length ? virtualRows[0].start : 0;
|
2376
|
-
// paddingBottom = !!virtualRows.length
|
2377
|
-
// ? virtualizer.getTotalSize() - virtualRows[virtualRows.length - 1].end
|
2378
|
-
// : 0;
|
2379
|
-
// }
|
2380
|
-
return (React.createElement(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group' }, ((tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx) instanceof Function
|
2918
|
+
const virtualRows = virtualizer ? virtualizer.getVirtualItems() : undefined;
|
2919
|
+
return (React__default.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
|
2381
2920
|
? tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx(theme)
|
2382
|
-
: 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) ? (
|
2383
|
-
|
2384
|
-
|
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) ? (React__default.createElement("tr", { style: { display: layoutMode === 'grid' ? 'grid' : 'table-row' } },
|
2922
|
+
React__default.createElement("td", { colSpan: table.getVisibleLeafColumns().length, style: { display: layoutMode === 'grid' ? 'grid' : 'table-cell' } },
|
2923
|
+
React__default.createElement(Typography, { sx: {
|
2385
2924
|
color: 'text.secondary',
|
2386
2925
|
fontStyle: 'italic',
|
2387
2926
|
maxWidth: `min(100vw, ${(_c = (_b = tablePaperRef.current) === null || _b === void 0 ? void 0 : _b.clientWidth) !== null && _c !== void 0 ? _c : 360}px)`,
|
@@ -2390,29 +2929,27 @@ const MRT_TableBody = ({ table }) => {
|
|
2390
2929
|
width: '100%',
|
2391
2930
|
} }, globalFilter || columnFilters.length
|
2392
2931
|
? localization.noResultsFound
|
2393
|
-
: localization.noRecordsToDisplay)))) : (
|
2394
|
-
|
2395
|
-
|
2396
|
-
|
2397
|
-
|
2398
|
-
|
2399
|
-
|
2400
|
-
|
2401
|
-
|
2402
|
-
|
2403
|
-
|
2404
|
-
|
2405
|
-
|
2406
|
-
|
2407
|
-
|
2408
|
-
|
2409
|
-
|
2410
|
-
|
2411
|
-
|
2412
|
-
enableRowVirtualization && paddingBottom > 0 && (React.createElement("tr", null,
|
2413
|
-
React.createElement("td", { style: { height: `${paddingBottom}px` } })))))));
|
2932
|
+
: localization.noRecordsToDisplay)))) : (React__default.createElement(React__default.Fragment, null, (virtualRows !== null && virtualRows !== void 0 ? virtualRows : rows).map((rowOrVirtualRow, rowIndex) => {
|
2933
|
+
const row = virtualizer
|
2934
|
+
? rows[rowOrVirtualRow.index]
|
2935
|
+
: rowOrVirtualRow;
|
2936
|
+
const props = {
|
2937
|
+
key: row.id,
|
2938
|
+
measureElement: virtualizer
|
2939
|
+
? virtualizer.measureElement
|
2940
|
+
: undefined,
|
2941
|
+
numRows: rows.length,
|
2942
|
+
row,
|
2943
|
+
rowIndex: virtualizer ? rowOrVirtualRow.index : rowIndex,
|
2944
|
+
table,
|
2945
|
+
virtualRow: virtualizer
|
2946
|
+
? rowOrVirtualRow
|
2947
|
+
: undefined,
|
2948
|
+
};
|
2949
|
+
return memoMode === 'rows' ? (React__default.createElement(Memo_MRT_TableBodyRow, Object.assign({}, props))) : (React__default.createElement(MRT_TableBodyRow, Object.assign({}, props)));
|
2950
|
+
})))));
|
2414
2951
|
};
|
2415
|
-
const Memo_MRT_TableBody = memo(MRT_TableBody, (prev, next) => prev.table.options.data === next.table.options.data);
|
2952
|
+
const Memo_MRT_TableBody = memo$1(MRT_TableBody, (prev, next) => prev.table.options.data === next.table.options.data);
|
2416
2953
|
|
2417
2954
|
const MRT_TableFooterCell = ({ footer, table }) => {
|
2418
2955
|
var _a, _b, _c;
|
@@ -2428,12 +2965,12 @@ const MRT_TableFooterCell = ({ footer, table }) => {
|
|
2428
2965
|
? columnDef.muiTableFooterCellProps({ column, table })
|
2429
2966
|
: columnDef.muiTableFooterCellProps;
|
2430
2967
|
const tableCellProps = Object.assign(Object.assign({}, mTableFooterCellProps), mcTableFooterCellProps);
|
2431
|
-
return (
|
2968
|
+
return (React__default.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'
|
2432
2969
|
? '0.5rem'
|
2433
2970
|
: density === 'comfortable'
|
2434
2971
|
? '1rem'
|
2435
2972
|
: '1.5rem', verticalAlign: 'top', zIndex: column.getIsPinned() && columnDefType !== 'group' ? 2 : 1 }, getCommonCellStyles({ column, table, theme, tableCellProps }))) }),
|
2436
|
-
|
2973
|
+
React__default.createElement(React__default.Fragment, null, footer.isPlaceholder
|
2437
2974
|
? null
|
2438
2975
|
: (_c = (_b = (columnDef.Footer instanceof Function
|
2439
2976
|
? (_a = columnDef.Footer) === null || _a === void 0 ? void 0 : _a.call(columnDef, {
|
@@ -2455,9 +2992,9 @@ const MRT_TableFooterRow = ({ footerGroup, table }) => {
|
|
2455
2992
|
const tableRowProps = muiTableFooterRowProps instanceof Function
|
2456
2993
|
? muiTableFooterRowProps({ footerGroup, table })
|
2457
2994
|
: muiTableFooterRowProps;
|
2458
|
-
return (
|
2995
|
+
return (React__default.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
|
2459
2996
|
? tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx(theme)
|
2460
|
-
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))) }), footerGroup.headers.map((footer) => (
|
2997
|
+
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))) }), footerGroup.headers.map((footer) => (React__default.createElement(MRT_TableFooterCell, { footer: footer, key: footer.id, table: table })))));
|
2461
2998
|
};
|
2462
2999
|
|
2463
3000
|
const MRT_TableFooter = ({ table }) => {
|
@@ -2467,13 +3004,13 @@ const MRT_TableFooter = ({ table }) => {
|
|
2467
3004
|
? muiTableFooterProps({ table })
|
2468
3005
|
: muiTableFooterProps;
|
2469
3006
|
const stickFooter = (isFullScreen || enableStickyFooter) && enableStickyFooter !== false;
|
2470
|
-
return (
|
3007
|
+
return (React__default.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
|
2471
3008
|
? theme.palette.mode === 'light'
|
2472
3009
|
? `1px solid ${theme.palette.grey[300]}`
|
2473
3010
|
: `1px solid ${theme.palette.grey[700]}`
|
2474
3011
|
: undefined, position: stickFooter ? 'sticky' : undefined }, ((tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx) instanceof Function
|
2475
3012
|
? tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx(theme)
|
2476
|
-
: tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx))) }), getFooterGroups().map((footerGroup) => (
|
3013
|
+
: tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx))) }), getFooterGroups().map((footerGroup) => (React__default.createElement(MRT_TableFooterRow, { footerGroup: footerGroup, key: footerGroup.id, table: table })))));
|
2477
3014
|
};
|
2478
3015
|
|
2479
3016
|
const MRT_Table = ({ table }) => {
|
@@ -2482,12 +3019,12 @@ const MRT_Table = ({ table }) => {
|
|
2482
3019
|
const tableProps = muiTableProps instanceof Function
|
2483
3020
|
? muiTableProps({ table })
|
2484
3021
|
: muiTableProps;
|
2485
|
-
return (
|
3022
|
+
return (React__default.createElement(Table, Object.assign({ stickyHeader: enableStickyHeader || enableRowVirtualization || isFullScreen }, tableProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table', tableLayout: enableColumnResizing || enableRowVirtualization ? 'fixed' : 'auto' }, ((tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx) instanceof Function
|
2486
3023
|
? tableProps.sx(theme)
|
2487
3024
|
: tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx))) }),
|
2488
|
-
enableTableHead &&
|
2489
|
-
memoMode === 'table-body' ? (
|
2490
|
-
enableTableFooter &&
|
3025
|
+
enableTableHead && React__default.createElement(MRT_TableHead, { table: table }),
|
3026
|
+
memoMode === 'table-body' ? (React__default.createElement(Memo_MRT_TableBody, { table: table })) : (React__default.createElement(MRT_TableBody, { table: table })),
|
3027
|
+
enableTableFooter && React__default.createElement(MRT_TableFooter, { table: table })));
|
2491
3028
|
};
|
2492
3029
|
|
2493
3030
|
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
@@ -2508,11 +3045,13 @@ const MRT_TableContainer = ({ table }) => {
|
|
2508
3045
|
: 0;
|
2509
3046
|
setTotalToolbarHeight(topToolbarHeight + bottomToolbarHeight);
|
2510
3047
|
});
|
2511
|
-
return (
|
2512
|
-
|
2513
|
-
|
2514
|
-
|
2515
|
-
|
3048
|
+
return (React__default.createElement(TableContainer, Object.assign({}, tableContainerProps, { ref: (node) => {
|
3049
|
+
if (node) {
|
3050
|
+
tableContainerRef.current = node;
|
3051
|
+
if (tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.ref) {
|
3052
|
+
//@ts-ignore
|
3053
|
+
tableContainerProps.ref.current = node;
|
3054
|
+
}
|
2516
3055
|
}
|
2517
3056
|
}, sx: (theme) => (Object.assign({ maxWidth: '100%', maxHeight: enableStickyHeader || enableRowVirtualization
|
2518
3057
|
? `clamp(350px, calc(100vh - ${totalToolbarHeight}px), 9999px)`
|
@@ -2521,7 +3060,7 @@ const MRT_TableContainer = ({ table }) => {
|
|
2521
3060
|
: tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx))), style: Object.assign({ maxHeight: isFullScreen
|
2522
3061
|
? `calc(100vh - ${totalToolbarHeight}px)`
|
2523
3062
|
: undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style) }),
|
2524
|
-
|
3063
|
+
React__default.createElement(MRT_Table, { table: table })));
|
2525
3064
|
};
|
2526
3065
|
|
2527
3066
|
const MRT_TablePaper = ({ table }) => {
|
@@ -2530,7 +3069,7 @@ const MRT_TablePaper = ({ table }) => {
|
|
2530
3069
|
const tablePaperProps = muiTablePaperProps instanceof Function
|
2531
3070
|
? muiTablePaperProps({ table })
|
2532
3071
|
: muiTablePaperProps;
|
2533
|
-
return (
|
3072
|
+
return (React__default.createElement(Paper, Object.assign({ elevation: 2 }, tablePaperProps, { ref: (ref) => {
|
2534
3073
|
tablePaperRef.current = ref;
|
2535
3074
|
if (tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.ref) {
|
2536
3075
|
//@ts-ignore
|
@@ -2551,21 +3090,21 @@ const MRT_TablePaper = ({ table }) => {
|
|
2551
3090
|
enableTopToolbar &&
|
2552
3091
|
(renderTopToolbar instanceof Function
|
2553
3092
|
? renderTopToolbar({ table })
|
2554
|
-
: renderTopToolbar !== null && renderTopToolbar !== void 0 ? renderTopToolbar :
|
2555
|
-
|
3093
|
+
: renderTopToolbar !== null && renderTopToolbar !== void 0 ? renderTopToolbar : React__default.createElement(MRT_TopToolbar, { table: table })),
|
3094
|
+
React__default.createElement(MRT_TableContainer, { table: table }),
|
2556
3095
|
enableBottomToolbar &&
|
2557
3096
|
(renderBottomToolbar instanceof Function
|
2558
3097
|
? renderBottomToolbar({ table })
|
2559
|
-
: renderBottomToolbar !== null && renderBottomToolbar !== void 0 ? renderBottomToolbar :
|
3098
|
+
: renderBottomToolbar !== null && renderBottomToolbar !== void 0 ? renderBottomToolbar : React__default.createElement(MRT_BottomToolbar, { table: table }))));
|
2560
3099
|
};
|
2561
3100
|
|
2562
3101
|
const MRT_EditRowModal = ({ open, row, table, }) => {
|
2563
3102
|
const { options: { localization }, } = table;
|
2564
|
-
return (
|
2565
|
-
|
2566
|
-
|
2567
|
-
|
2568
|
-
|
3103
|
+
return (React__default.createElement(Dialog, { open: open },
|
3104
|
+
React__default.createElement(DialogTitle, { textAlign: "center" }, localization.edit),
|
3105
|
+
React__default.createElement(DialogContent, null,
|
3106
|
+
React__default.createElement("form", { onSubmit: (e) => e.preventDefault() },
|
3107
|
+
React__default.createElement(Stack, { sx: {
|
2569
3108
|
gap: '1.5rem',
|
2570
3109
|
minWidth: { xs: '300px', sm: '360px', md: '400px' },
|
2571
3110
|
pt: '1rem',
|
@@ -2573,9 +3112,9 @@ const MRT_EditRowModal = ({ open, row, table, }) => {
|
|
2573
3112
|
} }, row
|
2574
3113
|
.getAllCells()
|
2575
3114
|
.filter((cell) => cell.column.columnDef.columnDefType === 'data')
|
2576
|
-
.map((cell) => (
|
2577
|
-
|
2578
|
-
|
3115
|
+
.map((cell) => (React__default.createElement(MRT_EditCellTextField, { cell: cell, key: cell.id, showLabel: true, table: table })))))),
|
3116
|
+
React__default.createElement(DialogActions, { sx: { p: '1.25rem' } },
|
3117
|
+
React__default.createElement(MRT_EditActionButtons, { row: row, table: table, variant: "text" }))));
|
2579
3118
|
};
|
2580
3119
|
|
2581
3120
|
const MRT_TableRoot = (props) => {
|
@@ -2622,13 +3161,13 @@ const MRT_TableRoot = (props) => {
|
|
2622
3161
|
var _a, _b, _c, _d, _e;
|
2623
3162
|
return [
|
2624
3163
|
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' }),
|
2625
|
-
columnOrder.includes('mrt-row-actions') && Object.assign(Object.assign(Object.assign({ Cell: ({ cell, row }) => (
|
3164
|
+
columnOrder.includes('mrt-row-actions') && Object.assign(Object.assign(Object.assign({ Cell: ({ cell, row }) => (React__default.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' }),
|
2626
3165
|
columnOrder.includes('mrt-row-expand') &&
|
2627
|
-
showExpandColumn(props, grouping) && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (
|
2628
|
-
? () =>
|
3166
|
+
showExpandColumn(props, grouping) && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React__default.createElement(MRT_ExpandButton, { row: row, table: table })), Header: props.enableExpandAll
|
3167
|
+
? () => React__default.createElement(MRT_ExpandAllButton, { table: table })
|
2629
3168
|
: 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' }),
|
2630
|
-
columnOrder.includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (
|
2631
|
-
? () =>
|
3169
|
+
columnOrder.includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React__default.createElement(MRT_SelectCheckbox, { row: row, table: table })), Header: props.enableSelectAll && props.enableMultiRowSelection
|
3170
|
+
? () => React__default.createElement(MRT_SelectCheckbox, { selectAll: true, table: table })
|
2632
3171
|
: 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' }),
|
2633
3172
|
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' }),
|
2634
3173
|
].filter(Boolean);
|
@@ -2732,11 +3271,11 @@ const MRT_TableRoot = (props) => {
|
|
2732
3271
|
}
|
2733
3272
|
}
|
2734
3273
|
}, [table.getState().isFullScreen]);
|
2735
|
-
return (
|
2736
|
-
|
2737
|
-
|
2738
|
-
!table.getState().isFullScreen && (
|
2739
|
-
editingRow && props.editingMode === 'modal' && (
|
3274
|
+
return (React__default.createElement(React__default.Fragment, null,
|
3275
|
+
React__default.createElement(Dialog, { PaperComponent: Box, TransitionComponent: Grow, disablePortal: true, fullScreen: true, keepMounted: false, onClose: () => table.setIsFullScreen(false), open: table.getState().isFullScreen, transitionDuration: 400 },
|
3276
|
+
React__default.createElement(MRT_TablePaper, { table: table })),
|
3277
|
+
!table.getState().isFullScreen && (React__default.createElement(MRT_TablePaper, { table: table })),
|
3278
|
+
editingRow && props.editingMode === 'modal' && (React__default.createElement(MRT_EditRowModal, { row: editingRow, table: table, open: true }))));
|
2740
3279
|
};
|
2741
3280
|
|
2742
3281
|
const MRT_Localization_EN = {
|
@@ -2840,7 +3379,9 @@ const MaterialReactTable = (_a) => {
|
|
2840
3379
|
const _sortingFns = useMemo(() => (Object.assign(Object.assign({}, MRT_SortingFns), sortingFns)), []);
|
2841
3380
|
const _defaultColumn = useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultColumn), defaultColumn)), []);
|
2842
3381
|
const _defaultDisplayColumn = useMemo(() => (Object.assign(Object.assign({}, MRT_DefaultDisplayColumn), defaultDisplayColumn)), []);
|
2843
|
-
|
3382
|
+
if (rest.enableRowVirtualization)
|
3383
|
+
layoutMode = 'grid';
|
3384
|
+
return (React__default.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)));
|
2844
3385
|
};
|
2845
3386
|
|
2846
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 };
|