material-react-table 2.0.0-alpha.0 → 2.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +437 -384
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/body/MRT_TableBodyRow.d.ts +3 -2
- package/dist/cjs/types/body/MRT_TableBodyRowPinButton.d.ts +7 -0
- package/dist/cjs/types/body/index.d.ts +1 -0
- package/dist/cjs/types/buttons/MRT_RowPinButton.d.ts +9 -0
- package/dist/cjs/types/buttons/index.d.ts +2 -1
- package/dist/cjs/types/column.utils.d.ts +1 -0
- package/dist/cjs/types/types.d.ts +15 -9
- package/dist/esm/material-react-table.esm.js +433 -383
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/types/body/MRT_TableBodyRow.d.ts +3 -2
- package/dist/esm/types/body/MRT_TableBodyRowPinButton.d.ts +7 -0
- package/dist/esm/types/body/index.d.ts +1 -0
- package/dist/esm/types/buttons/MRT_RowPinButton.d.ts +9 -0
- package/dist/esm/types/buttons/index.d.ts +2 -1
- package/dist/esm/types/column.utils.d.ts +1 -0
- package/dist/esm/types/types.d.ts +15 -9
- package/dist/index.d.ts +68 -47
- package/locales/en.esm.js +1 -0
- package/locales/en.esm.js.map +1 -1
- package/locales/en.js +1 -0
- package/locales/en.js.map +1 -1
- package/package.json +9 -9
- package/src/body/MRT_TableBody.tsx +178 -74
- package/src/body/MRT_TableBodyCell.tsx +23 -21
- package/src/body/MRT_TableBodyRow.tsx +104 -16
- package/src/body/MRT_TableBodyRowGrabHandle.tsx +5 -4
- package/src/body/MRT_TableBodyRowPinButton.tsx +46 -0
- package/src/body/MRT_TableDetailPanel.tsx +13 -19
- package/src/body/index.ts +2 -1
- package/src/buttons/MRT_CopyButton.tsx +14 -20
- package/src/buttons/MRT_ExpandAllButton.tsx +5 -7
- package/src/buttons/MRT_ExpandButton.tsx +6 -7
- package/src/buttons/MRT_GrabHandleButton.tsx +2 -3
- package/src/buttons/MRT_RowPinButton.tsx +74 -0
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +2 -3
- package/src/buttons/index.ts +2 -1
- package/src/column.utils.ts +11 -5
- package/src/footer/MRT_TableFooter.tsx +13 -7
- package/src/footer/MRT_TableFooterCell.tsx +7 -20
- package/src/footer/MRT_TableFooterRow.tsx +6 -7
- package/src/head/MRT_TableHead.tsx +11 -7
- package/src/head/MRT_TableHeadCell.tsx +9 -20
- package/src/head/MRT_TableHeadCellColumnActionsButton.tsx +10 -18
- package/src/head/MRT_TableHeadCellGrabHandle.tsx +6 -13
- package/src/head/MRT_TableHeadRow.tsx +6 -7
- package/src/hooks/useMRT_DisplayColumns.tsx +13 -0
- package/src/hooks/useMRT_TableInstance.ts +6 -0
- package/src/hooks/useMRT_TableOptions.ts +6 -2
- package/src/inputs/MRT_EditCellTextField.tsx +14 -22
- package/src/inputs/MRT_FilterCheckbox.tsx +11 -23
- package/src/inputs/MRT_FilterRangeSlider.tsx +6 -23
- package/src/inputs/MRT_FilterTextField.tsx +9 -25
- package/src/inputs/MRT_GlobalFilterTextField.tsx +4 -4
- package/src/inputs/MRT_SelectCheckbox.tsx +31 -17
- package/src/locales/en.ts +1 -1
- package/src/menus/MRT_RowActionMenu.tsx +11 -12
- package/src/modals/MRT_EditRowModal.tsx +5 -13
- package/src/table/MRT_Table.tsx +8 -13
- package/src/table/MRT_TableContainer.tsx +6 -12
- package/src/table/MRT_TablePaper.tsx +9 -13
- package/src/toolbar/MRT_BottomToolbar.tsx +14 -20
- package/src/toolbar/MRT_LinearProgressBar.tsx +5 -4
- package/src/toolbar/MRT_TablePagination.tsx +5 -7
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +8 -11
- package/src/toolbar/MRT_TopToolbar.tsx +8 -14
- package/src/types.ts +25 -8
- package/locales/tr.d.ts +0 -2
- package/locales/tr.esm.d.ts +0 -2
- package/locales/tr.esm.js +0 -93
- package/locales/tr.esm.js.map +0 -1
- package/locales/tr.js +0 -97
- package/locales/tr.js.map +0 -1
- package/locales/uk.d.ts +0 -2
- package/locales/uk.esm.d.ts +0 -2
- package/locales/uk.esm.js +0 -93
- package/locales/uk.esm.js.map +0 -1
- package/locales/uk.js +0 -97
- package/locales/uk.js.map +0 -1
- package/locales/vi.d.ts +0 -2
- package/locales/vi.esm.d.ts +0 -2
- package/locales/vi.esm.js +0 -93
- package/locales/vi.esm.js.map +0 -1
- package/locales/vi.js +0 -97
- package/locales/vi.js.map +0 -1
- package/locales/zh-Hans.d.ts +0 -2
- package/locales/zh-Hans.esm.d.ts +0 -2
- package/locales/zh-Hans.esm.js +0 -93
- package/locales/zh-Hans.esm.js.map +0 -1
- package/locales/zh-Hans.js +0 -97
- package/locales/zh-Hans.js.map +0 -1
- package/locales/zh-Hant.d.ts +0 -2
- package/locales/zh-Hant.esm.d.ts +0 -2
- package/locales/zh-Hant.esm.js +0 -93
- package/locales/zh-Hant.esm.js.map +0 -1
- package/locales/zh-Hant.js +0 -97
- package/locales/zh-Hant.js.map +0 -1
package/dist/cjs/index.js
CHANGED
@@ -35,6 +35,9 @@ var SearchOffIcon = require('@mui/icons-material/SearchOff');
|
|
35
35
|
var SortIcon = require('@mui/icons-material/Sort');
|
36
36
|
var ViewColumnIcon = require('@mui/icons-material/ViewColumn');
|
37
37
|
var VisibilityOffIcon = require('@mui/icons-material/VisibilityOff');
|
38
|
+
var Box = require('@mui/material/Box');
|
39
|
+
var IconButton = require('@mui/material/IconButton');
|
40
|
+
var Tooltip = require('@mui/material/Tooltip');
|
38
41
|
var reactVirtual = require('@tanstack/react-virtual');
|
39
42
|
var TableBody = require('@mui/material/TableBody');
|
40
43
|
var Typography = require('@mui/material/Typography');
|
@@ -44,9 +47,6 @@ var TableCell = require('@mui/material/TableCell');
|
|
44
47
|
var TextField = require('@mui/material/TextField');
|
45
48
|
var MenuItem = require('@mui/material/MenuItem');
|
46
49
|
var Button = require('@mui/material/Button');
|
47
|
-
var Tooltip = require('@mui/material/Tooltip');
|
48
|
-
var IconButton = require('@mui/material/IconButton');
|
49
|
-
var Box = require('@mui/material/Box');
|
50
50
|
var highlightWords = require('highlight-words');
|
51
51
|
var Collapse = require('@mui/material/Collapse');
|
52
52
|
var ListItemIcon = require('@mui/material/ListItemIcon');
|
@@ -113,6 +113,9 @@ var SearchOffIcon__default = /*#__PURE__*/_interopDefaultLegacy(SearchOffIcon);
|
|
113
113
|
var SortIcon__default = /*#__PURE__*/_interopDefaultLegacy(SortIcon);
|
114
114
|
var ViewColumnIcon__default = /*#__PURE__*/_interopDefaultLegacy(ViewColumnIcon);
|
115
115
|
var VisibilityOffIcon__default = /*#__PURE__*/_interopDefaultLegacy(VisibilityOffIcon);
|
116
|
+
var Box__default = /*#__PURE__*/_interopDefaultLegacy(Box);
|
117
|
+
var IconButton__default = /*#__PURE__*/_interopDefaultLegacy(IconButton);
|
118
|
+
var Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip);
|
116
119
|
var TableBody__default = /*#__PURE__*/_interopDefaultLegacy(TableBody);
|
117
120
|
var Typography__default = /*#__PURE__*/_interopDefaultLegacy(Typography);
|
118
121
|
var TableRow__default = /*#__PURE__*/_interopDefaultLegacy(TableRow);
|
@@ -121,9 +124,6 @@ var TableCell__default = /*#__PURE__*/_interopDefaultLegacy(TableCell);
|
|
121
124
|
var TextField__default = /*#__PURE__*/_interopDefaultLegacy(TextField);
|
122
125
|
var MenuItem__default = /*#__PURE__*/_interopDefaultLegacy(MenuItem);
|
123
126
|
var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
|
124
|
-
var Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip);
|
125
|
-
var IconButton__default = /*#__PURE__*/_interopDefaultLegacy(IconButton);
|
126
|
-
var Box__default = /*#__PURE__*/_interopDefaultLegacy(Box);
|
127
127
|
var highlightWords__default = /*#__PURE__*/_interopDefaultLegacy(highlightWords);
|
128
128
|
var Collapse__default = /*#__PURE__*/_interopDefaultLegacy(Collapse);
|
129
129
|
var ListItemIcon__default = /*#__PURE__*/_interopDefaultLegacy(ListItemIcon);
|
@@ -361,13 +361,16 @@ const showExpandColumn = (props, grouping) => !!(props.enableExpanding ||
|
|
361
361
|
(props.enableGrouping && (grouping === undefined || (grouping === null || grouping === void 0 ? void 0 : grouping.length))) ||
|
362
362
|
props.renderDetailPanel);
|
363
363
|
const getLeadingDisplayColumnIds = (props) => {
|
364
|
-
var _a;
|
364
|
+
var _a, _b;
|
365
365
|
return [
|
366
|
+
props.enableRowPinning &&
|
367
|
+
!((_a = props.rowPinningDisplayMode) === null || _a === void 0 ? void 0 : _a.startsWith('select')) &&
|
368
|
+
'mrt-row-pin',
|
366
369
|
(props.enableRowDragging || props.enableRowOrdering) && 'mrt-row-drag',
|
367
370
|
props.positionActionsColumn === 'first' &&
|
368
371
|
(props.enableRowActions ||
|
369
372
|
(props.enableEditing &&
|
370
|
-
['row', 'modal'].includes((
|
373
|
+
['row', 'modal'].includes((_b = props.editDisplayMode) !== null && _b !== void 0 ? _b : ''))) &&
|
371
374
|
'mrt-row-actions',
|
372
375
|
props.positionExpandColumn === 'first' &&
|
373
376
|
showExpandColumn(props) &&
|
@@ -478,9 +481,7 @@ const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, })
|
|
478
481
|
? `${getTotalRight(table, column)}px`
|
479
482
|
: undefined, transition: table.options.enableColumnVirtualization
|
480
483
|
? 'none'
|
481
|
-
: `padding 150ms ease-in-out` }, (!table.options.enableColumnResizing && widthStyles)), (
|
482
|
-
? tableCellProps.sx(theme)
|
483
|
-
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), (table.options.enableColumnResizing && widthStyles));
|
484
|
+
: `padding 150ms ease-in-out` }, (!table.options.enableColumnResizing && widthStyles)), parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme)), (table.options.enableColumnResizing && widthStyles));
|
484
485
|
};
|
485
486
|
const MRT_DefaultColumn = {
|
486
487
|
filterVariant: 'text',
|
@@ -502,6 +503,7 @@ const MRT_DefaultDisplayColumn = {
|
|
502
503
|
enableResizing: false,
|
503
504
|
enableSorting: false,
|
504
505
|
};
|
506
|
+
const parseFromValuesOrFunc = (fn, arg) => (fn instanceof Function ? fn(arg) : fn);
|
505
507
|
const parseCSSVarId = (id) => id.replace(/[^a-zA-Z0-9]/g, '_');
|
506
508
|
const flexRender = reactTable.flexRender;
|
507
509
|
const createRow = (table, originalRow) => reactTable.createRow(table, 'mrt-row-create', originalRow !== null && originalRow !== void 0 ? originalRow : Object.assign({}, ...getAllLeafColumnDefs(table.options.columns).map((col) => ({
|
@@ -567,6 +569,7 @@ const MRT_Localization_EN = {
|
|
567
569
|
noResultsFound: 'No results found',
|
568
570
|
of: 'of',
|
569
571
|
or: 'or',
|
572
|
+
pin: 'Pin',
|
570
573
|
pinToLeft: 'Pin to left',
|
571
574
|
pinToRight: 'Pin to right',
|
572
575
|
resetColumnSize: 'Reset column size',
|
@@ -632,7 +635,7 @@ const MRT_Default_Icons = {
|
|
632
635
|
|
633
636
|
const useMRT_TableOptions = (_a) => {
|
634
637
|
var _b;
|
635
|
-
var { aggregationFns, autoResetExpanded = false, columnFilterDisplayMode = 'subheader', columnResizeMode = 'onChange', createDisplayMode = 'modal', defaultColumn, defaultDisplayColumn, editDisplayMode = 'modal', enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnResizing = false, enableDensityToggle = true, enableExpandAll = true, enableExpanding, enableFilterMatchHighlighting = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterRankedResults = true, enableGrouping = false, enableHiding = true, enableMultiRowSelection = true, enableMultiSort = true, enablePagination = true,
|
638
|
+
var { aggregationFns, autoResetExpanded = false, columnFilterDisplayMode = 'subheader', columnResizeMode = 'onChange', createDisplayMode = 'modal', defaultColumn, defaultDisplayColumn, editDisplayMode = 'modal', enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnPinning = false, enableColumnResizing = false, enableDensityToggle = true, enableExpandAll = true, enableExpanding, enableFilterMatchHighlighting = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterRankedResults = true, enableGrouping = false, enableHiding = true, enableMultiRowSelection = true, enableMultiSort = true, enablePagination = true, enableRowPinning = false, enableRowSelection = false, enableSelectAll = true, enableSorting = true, enableStickyHeader = false, enableTableFooter = true, enableTableHead = true, enableToolbarInternalActions = true, enableTopToolbar = true, filterFns, icons, layoutMode = 'semantic', localization, manualFiltering, manualGrouping, manualPagination, manualSorting, paginationDisplayMode = 'default', positionActionsColumn = 'first', positionExpandColumn = 'first', positionGlobalFilter = 'right', positionPagination = 'bottom', positionToolbarAlertBanner = 'top', positionToolbarDropZone = 'top', rowNumberMode = 'static', rowPinningDisplayMode = 'sticky', selectAllMode = 'page', sortingFns } = _a, rest = __rest(_a, ["aggregationFns", "autoResetExpanded", "columnFilterDisplayMode", "columnResizeMode", "createDisplayMode", "defaultColumn", "defaultDisplayColumn", "editDisplayMode", "enableBottomToolbar", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnPinning", "enableColumnResizing", "enableDensityToggle", "enableExpandAll", "enableExpanding", "enableFilterMatchHighlighting", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enableRowPinning", "enableRowSelection", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "paginationDisplayMode", "positionActionsColumn", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberMode", "rowPinningDisplayMode", "selectAllMode", "sortingFns"]);
|
636
639
|
const _icons = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), [icons]);
|
637
640
|
const _localization = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), [localization]);
|
638
641
|
const _aggregationFns = react.useMemo(() => (Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns)), []);
|
@@ -663,6 +666,7 @@ const useMRT_TableOptions = (_a) => {
|
|
663
666
|
enableColumnActions,
|
664
667
|
enableColumnFilters,
|
665
668
|
enableColumnOrdering,
|
669
|
+
enableColumnPinning,
|
666
670
|
enableColumnResizing,
|
667
671
|
enableDensityToggle,
|
668
672
|
enableExpandAll,
|
@@ -677,7 +681,7 @@ const useMRT_TableOptions = (_a) => {
|
|
677
681
|
enableMultiRowSelection,
|
678
682
|
enableMultiSort,
|
679
683
|
enablePagination,
|
680
|
-
|
684
|
+
enableRowPinning,
|
681
685
|
enableRowSelection,
|
682
686
|
enableSelectAll,
|
683
687
|
enableSorting,
|
@@ -697,9 +701,46 @@ const useMRT_TableOptions = (_a) => {
|
|
697
701
|
positionToolbarAlertBanner,
|
698
702
|
positionToolbarDropZone,
|
699
703
|
rowNumberMode,
|
704
|
+
rowPinningDisplayMode,
|
700
705
|
selectAllMode, sortingFns: _sortingFns }, rest);
|
701
706
|
};
|
702
707
|
|
708
|
+
const MRT_RowPinButton = ({ row, table, pinningPosition, }) => {
|
709
|
+
const { options: { icons: { PushPinIcon, CloseIcon }, localization, rowPinningDisplayMode, }, } = table;
|
710
|
+
const isPinned = row.getIsPinned();
|
711
|
+
const [tooltipOpened, setTooltipOpened] = react.useState(false);
|
712
|
+
const handleTogglePin = (event) => {
|
713
|
+
setTooltipOpened(false);
|
714
|
+
event.stopPropagation();
|
715
|
+
row.pin(isPinned ? false : pinningPosition);
|
716
|
+
};
|
717
|
+
return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, open: tooltipOpened, enterDelay: 1000, enterNextDelay: 1000, title: isPinned ? localization.unpin : localization.pin, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.pin, onClick: handleTogglePin, onMouseEnter: () => setTooltipOpened(true), onMouseLeave: () => setTooltipOpened(false), size: "small", sx: {
|
718
|
+
height: '24px',
|
719
|
+
width: '24px',
|
720
|
+
}, children: isPinned ? (jsxRuntime.jsx(CloseIcon, {})) : (jsxRuntime.jsx(PushPinIcon, { fontSize: "small", style: {
|
721
|
+
transform: `rotate(${rowPinningDisplayMode === 'sticky'
|
722
|
+
? 135
|
723
|
+
: pinningPosition === 'top'
|
724
|
+
? 180
|
725
|
+
: 0}deg)`,
|
726
|
+
} })) }) }));
|
727
|
+
};
|
728
|
+
|
729
|
+
const MRT_TableBodyRowPinButton = ({ row, table, }) => {
|
730
|
+
const { getState, options: { enableRowPinning, rowPinningDisplayMode }, } = table;
|
731
|
+
const { density } = getState();
|
732
|
+
const canPin = parseFromValuesOrFunc(enableRowPinning, row);
|
733
|
+
if (!canPin)
|
734
|
+
return null;
|
735
|
+
if (rowPinningDisplayMode === 'top-and-bottom' && !row.getIsPinned()) {
|
736
|
+
return (jsxRuntime.jsxs(Box__default["default"], { sx: {
|
737
|
+
display: 'flex',
|
738
|
+
flexDirection: density === 'compact' ? 'row' : 'column',
|
739
|
+
}, children: [jsxRuntime.jsx(MRT_RowPinButton, { row: row, table: table, pinningPosition: "top" }), jsxRuntime.jsx(MRT_RowPinButton, { row: row, table: table, pinningPosition: "bottom" })] }));
|
740
|
+
}
|
741
|
+
return (jsxRuntime.jsx(MRT_RowPinButton, { row: row, table: table, pinningPosition: rowPinningDisplayMode === 'bottom' ? 'bottom' : 'top' }));
|
742
|
+
};
|
743
|
+
|
703
744
|
const MRT_EditCellTextField = ({ cell, table, }) => {
|
704
745
|
var _a, _b, _c;
|
705
746
|
const { getState, options: { createDisplayMode, editDisplayMode, muiEditTextFieldProps }, refs: { editInputRefs }, setEditingCell, setEditingRow, setCreatingRow, } = table;
|
@@ -710,18 +751,17 @@ const MRT_EditCellTextField = ({ cell, table, }) => {
|
|
710
751
|
const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
|
711
752
|
const isSelectEdit = columnDef.editVariant === 'select';
|
712
753
|
const [value, setValue] = react.useState(() => cell.getValue());
|
713
|
-
const
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
const textFieldProps = Object.assign(Object.assign({}, mTableBodyCellEditTextFieldProps), mcTableBodyCellEditTextFieldProps);
|
754
|
+
const textFieldProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditTextFieldProps, {
|
755
|
+
cell,
|
756
|
+
column,
|
757
|
+
row,
|
758
|
+
table,
|
759
|
+
})), parseFromValuesOrFunc(columnDef.muiEditTextFieldProps, {
|
760
|
+
cell,
|
761
|
+
column,
|
762
|
+
row,
|
763
|
+
table,
|
764
|
+
}));
|
725
765
|
const saveInputValueToRowCache = (newValue) => {
|
726
766
|
//@ts-ignore
|
727
767
|
row._valuesCache[column.id] = newValue;
|
@@ -756,9 +796,7 @@ const MRT_EditCellTextField = ({ cell, table, }) => {
|
|
756
796
|
if (columnDef.Edit) {
|
757
797
|
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: (_a = columnDef.Edit) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table }) });
|
758
798
|
}
|
759
|
-
return (jsxRuntime.jsx(TextField__default["default"], Object.assign({ disabled: (columnDef.enableEditing
|
760
|
-
? columnDef.enableEditing(row)
|
761
|
-
: columnDef.enableEditing) === false, fullWidth: true, inputRef: (inputRef) => {
|
799
|
+
return (jsxRuntime.jsx(TextField__default["default"], Object.assign({ disabled: parseFromValuesOrFunc(columnDef.enableEditing, row) === false, fullWidth: true, inputRef: (inputRef) => {
|
762
800
|
if (inputRef) {
|
763
801
|
editInputRefs.current[column.id] = inputRef;
|
764
802
|
if (textFieldProps.inputRef) {
|
@@ -805,21 +843,18 @@ const MRT_CopyButton = ({ cell, children, table, }) => {
|
|
805
843
|
setCopied(true);
|
806
844
|
setTimeout(() => setCopied(false), 4000);
|
807
845
|
};
|
808
|
-
const
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
return (jsxRuntime.jsx(Tooltip__default["default"], { 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), children: jsxRuntime.jsx(Button__default["default"], 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
|
821
|
-
? buttonProps.sx(theme)
|
822
|
-
: buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx))), title: undefined, children: children })) }));
|
846
|
+
const buttonProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiCopyButtonProps, {
|
847
|
+
cell,
|
848
|
+
column,
|
849
|
+
row,
|
850
|
+
table,
|
851
|
+
})), parseFromValuesOrFunc(columnDef.muiCopyButtonProps, {
|
852
|
+
cell,
|
853
|
+
column,
|
854
|
+
row,
|
855
|
+
table,
|
856
|
+
}));
|
857
|
+
return (jsxRuntime.jsx(Tooltip__default["default"], { 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), children: jsxRuntime.jsx(Button__default["default"], 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' }, parseFromValuesOrFunc(buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx, theme))), title: undefined, children: children })) }));
|
823
858
|
};
|
824
859
|
|
825
860
|
const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table, }) => {
|
@@ -834,16 +869,15 @@ const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table,
|
|
834
869
|
opacity: 1,
|
835
870
|
}, '&:active': {
|
836
871
|
cursor: 'grabbing',
|
837
|
-
} }, (
|
838
|
-
? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
|
839
|
-
: iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined, children: jsxRuntime.jsx(DragHandleIcon, {}) })) }));
|
872
|
+
} }, parseFromValuesOrFunc(iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx, theme))), title: undefined, children: jsxRuntime.jsx(DragHandleIcon, {}) })) }));
|
840
873
|
};
|
841
874
|
|
842
875
|
const MRT_TableBodyRowGrabHandle = ({ row, rowRef, table, }) => {
|
843
876
|
const { options: { muiRowDragHandleProps }, } = table;
|
844
|
-
const iconButtonProps = muiRowDragHandleProps
|
845
|
-
|
846
|
-
|
877
|
+
const iconButtonProps = parseFromValuesOrFunc(muiRowDragHandleProps, {
|
878
|
+
row,
|
879
|
+
table,
|
880
|
+
});
|
847
881
|
const handleDragStart = (event) => {
|
848
882
|
var _a;
|
849
883
|
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
@@ -936,16 +970,23 @@ const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, ta
|
|
936
970
|
const { column, row } = cell;
|
937
971
|
const { columnDef } = column;
|
938
972
|
const { columnDefType } = columnDef;
|
939
|
-
const
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
973
|
+
const tableCellProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableBodyCellProps, {
|
974
|
+
cell,
|
975
|
+
column,
|
976
|
+
row,
|
977
|
+
table,
|
978
|
+
})), parseFromValuesOrFunc(columnDef.muiTableBodyCellProps, {
|
979
|
+
cell,
|
980
|
+
column,
|
981
|
+
row,
|
982
|
+
table,
|
983
|
+
}));
|
984
|
+
const skeletonProps = parseFromValuesOrFunc(muiSkeletonProps, {
|
985
|
+
cell,
|
986
|
+
column,
|
987
|
+
row,
|
988
|
+
table,
|
989
|
+
});
|
949
990
|
const [skeletonWidth, setSkeletonWidth] = react.useState(100);
|
950
991
|
react.useEffect(() => {
|
951
992
|
if ((!isLoading && !showSkeletons) || skeletonWidth !== 100)
|
@@ -987,10 +1028,8 @@ const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, ta
|
|
987
1028
|
}
|
988
1029
|
: undefined;
|
989
1030
|
}, [draggingColumn, draggingRow, hoveredColumn, hoveredRow, rowIndex]);
|
990
|
-
const isEditable = (enableEditing
|
991
|
-
(columnDef.enableEditing
|
992
|
-
? columnDef.enableEditing(row)
|
993
|
-
: columnDef.enableEditing) !== false;
|
1031
|
+
const isEditable = parseFromValuesOrFunc(enableEditing, row) &&
|
1032
|
+
parseFromValuesOrFunc(columnDef.enableEditing, row) !== false;
|
994
1033
|
const isEditing = isEditable &&
|
995
1034
|
!['modal', 'custom'].includes(editDisplayMode) &&
|
996
1035
|
(editDisplayMode === 'table' ||
|
@@ -1044,7 +1083,7 @@ const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, ta
|
|
1044
1083
|
: density === 'comfortable'
|
1045
1084
|
? 0.75
|
1046
1085
|
: 1.25)}rem`
|
1047
|
-
: undefined, textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined, whiteSpace: density === 'compact' ? 'nowrap' : 'normal', zIndex: (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id ? 2 : column.getIsPinned() ? 1 : 0, '&:hover': {
|
1086
|
+
: undefined, textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined, whiteSpace: row.getIsPinned() || density === 'compact' ? 'nowrap' : 'normal', zIndex: (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id ? 2 : column.getIsPinned() ? 1 : 0, '&:hover': {
|
1048
1087
|
outline: ['table', 'cell'].includes(editDisplayMode !== null && editDisplayMode !== void 0 ? editDisplayMode : '')
|
1049
1088
|
? `1px solid ${theme.palette.text.secondary}`
|
1050
1089
|
: undefined,
|
@@ -1074,39 +1113,59 @@ const Memo_MRT_TableBodyCell = react.memo(MRT_TableBodyCell, (prev, next) => nex
|
|
1074
1113
|
const MRT_TableDetailPanel = ({ parentRowRef, row, rowIndex, table, virtualRow, }) => {
|
1075
1114
|
const { getVisibleLeafColumns, getState, options: { layoutMode, muiTableBodyRowProps, muiDetailPanelProps, renderDetailPanel, }, } = table;
|
1076
1115
|
const { isLoading } = getState();
|
1077
|
-
const tableRowProps = muiTableBodyRowProps
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
: muiDetailPanelProps;
|
1116
|
+
const tableRowProps = parseFromValuesOrFunc(muiTableBodyRowProps, {
|
1117
|
+
isDetailPanel: true,
|
1118
|
+
row,
|
1119
|
+
staticRowIndex: rowIndex,
|
1120
|
+
table,
|
1121
|
+
});
|
1122
|
+
const tableCellProps = parseFromValuesOrFunc(muiDetailPanelProps, {
|
1123
|
+
row,
|
1124
|
+
table,
|
1125
|
+
});
|
1088
1126
|
return (jsxRuntime.jsx(TableRow__default["default"], Object.assign({ className: "Mui-TableBodyCell-DetailPanel" }, tableRowProps, { sx: (theme) => {
|
1089
1127
|
var _a, _b;
|
1090
1128
|
return (Object.assign({ display: layoutMode === 'grid' ? 'flex' : 'table-row', position: virtualRow ? 'absolute' : undefined, top: virtualRow
|
1091
1129
|
? `${(_b = (_a = parentRowRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.height}px`
|
1092
1130
|
: undefined, transform: virtualRow
|
1093
1131
|
? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
|
1094
|
-
: undefined, width: '100%', zIndex: virtualRow ? 2 : undefined }, (
|
1095
|
-
? tableRowProps.sx(theme)
|
1096
|
-
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx)));
|
1132
|
+
: undefined, width: '100%', zIndex: virtualRow ? 2 : undefined }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme)));
|
1097
1133
|
}, children: jsxRuntime.jsx(TableCell__default["default"], Object.assign({ className: "Mui-TableBodyCell-DetailPanel", colSpan: getVisibleLeafColumns().length }, tableCellProps, { sx: (theme) => (Object.assign({ backgroundColor: virtualRow
|
1098
1134
|
? styles.lighten(theme.palette.background.default, 0.06)
|
1099
|
-
: undefined, borderBottom: !row.getIsExpanded() ? 'none' : undefined, display: layoutMode === 'grid' ? 'flex' : 'table-cell', pb: row.getIsExpanded() ? '1rem' : 0, pt: row.getIsExpanded() ? '1rem' : 0, transition: 'all 150ms ease-in-out', width: `${table.getTotalSize()}px` }, (
|
1100
|
-
? tableCellProps.sx(theme)
|
1101
|
-
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))), children: renderDetailPanel && (jsxRuntime.jsx(Collapse__default["default"], { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true, children: !isLoading && renderDetailPanel({ row, table }) })) })) })));
|
1135
|
+
: undefined, borderBottom: !row.getIsExpanded() ? 'none' : undefined, display: layoutMode === 'grid' ? 'flex' : 'table-cell', pb: row.getIsExpanded() ? '1rem' : 0, pt: row.getIsExpanded() ? '1rem' : 0, transition: 'all 150ms ease-in-out', width: `${table.getTotalSize()}px` }, parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme))), children: renderDetailPanel && (jsxRuntime.jsx(Collapse__default["default"], { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true, children: !isLoading && renderDetailPanel({ row, table }) })) })) })));
|
1102
1136
|
};
|
1103
1137
|
|
1104
|
-
const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, row, rowIndex, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, virtualRow, }) => {
|
1105
|
-
|
1106
|
-
const
|
1107
|
-
const
|
1108
|
-
|
1109
|
-
|
1138
|
+
const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRowIds, row, rowIndex, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, virtualRow, }) => {
|
1139
|
+
var _a, _b, _c, _d;
|
1140
|
+
const theme = styles.useTheme();
|
1141
|
+
const { getState, options: { enableRowOrdering, enableRowPinning, enableStickyFooter, enableStickyHeader, layoutMode, rowPinningDisplayMode, memoMode, muiTableBodyRowProps, renderDetailPanel, }, refs: { tableHeadRef, tableFooterRef }, setHoveredRow, } = table;
|
1142
|
+
const { density, draggingColumn, draggingRow, editingCell, editingRow, hoveredRow, isFullScreen, rowPinning, } = getState();
|
1143
|
+
const isPinned = enableRowPinning && row.getIsPinned();
|
1144
|
+
const tableRowProps = parseFromValuesOrFunc(muiTableBodyRowProps, {
|
1145
|
+
row,
|
1146
|
+
staticRowIndex: rowIndex,
|
1147
|
+
table,
|
1148
|
+
});
|
1149
|
+
const [bottomPinnedIndex, topPinnedIndex] = react.useMemo(() => {
|
1150
|
+
if (!enableRowPinning ||
|
1151
|
+
!(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) ||
|
1152
|
+
!pinnedRowIds ||
|
1153
|
+
!row.getIsPinned())
|
1154
|
+
return [];
|
1155
|
+
return [
|
1156
|
+
[...pinnedRowIds].reverse().indexOf(row.id),
|
1157
|
+
pinnedRowIds.indexOf(row.id),
|
1158
|
+
];
|
1159
|
+
}, [pinnedRowIds, rowPinning]);
|
1160
|
+
const tableHeadHeight = ((enableStickyHeader || isFullScreen) &&
|
1161
|
+
((_a = tableHeadRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight)) ||
|
1162
|
+
0;
|
1163
|
+
const tableFooterHeight = (enableStickyFooter && ((_b = tableFooterRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight)) || 0;
|
1164
|
+
const sx = parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme);
|
1165
|
+
const rowHeight =
|
1166
|
+
// @ts-ignore
|
1167
|
+
parseInt((_d = (_c = tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : sx === null || sx === void 0 ? void 0 : sx.height, 10) ||
|
1168
|
+
(density === 'compact' ? 37 : density === 'comfortable' ? 53 : 69);
|
1110
1169
|
const handleDragEnter = (_e) => {
|
1111
1170
|
if (enableRowOrdering && draggingRow) {
|
1112
1171
|
setHoveredRow(row);
|
@@ -1118,7 +1177,31 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, row, row
|
|
1118
1177
|
rowRef.current = node;
|
1119
1178
|
measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
|
1120
1179
|
}
|
1121
|
-
} }, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: styles.lighten(theme.palette.background.default, 0.06)
|
1180
|
+
} }, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: `${styles.lighten(theme.palette.background.default, 0.06)} !important`, boxSizing: 'border-box', bottom: bottomPinnedIndex !== undefined && isPinned
|
1181
|
+
? `${bottomPinnedIndex * rowHeight +
|
1182
|
+
(enableStickyFooter ? tableFooterHeight - 1 : 0)}px`
|
1183
|
+
: undefined, display: layoutMode === 'grid' ? 'flex' : 'table-row', opacity: isPinned
|
1184
|
+
? 0.98
|
1185
|
+
: (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id || (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id
|
1186
|
+
? 0.5
|
1187
|
+
: 1, position: virtualRow
|
1188
|
+
? 'absolute'
|
1189
|
+
: (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) && isPinned
|
1190
|
+
? 'sticky'
|
1191
|
+
: undefined, transition: virtualRow ? 'none' : 'all 150ms ease-in-out', top: virtualRow
|
1192
|
+
? 0
|
1193
|
+
: topPinnedIndex !== undefined && isPinned
|
1194
|
+
? `${topPinnedIndex * rowHeight +
|
1195
|
+
(enableStickyHeader || isFullScreen ? tableHeadHeight - 1 : 0)}px`
|
1196
|
+
: undefined, width: '100%', zIndex: (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) && isPinned
|
1197
|
+
? 1
|
1198
|
+
: undefined, td: {
|
1199
|
+
backgroundColor: row.getIsSelected()
|
1200
|
+
? styles.alpha(theme.palette.primary.main, 0.2)
|
1201
|
+
: isPinned
|
1202
|
+
? styles.alpha(theme.palette.primary.main, 0.1)
|
1203
|
+
: undefined,
|
1204
|
+
}, '&:hover td': {
|
1122
1205
|
backgroundColor: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false
|
1123
1206
|
? row.getIsSelected()
|
1124
1207
|
? `${styles.alpha(theme.palette.primary.main, 0.2)}`
|
@@ -1126,9 +1209,7 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, row, row
|
|
1126
1209
|
? `${styles.lighten(theme.palette.background.default, 0.12)}`
|
1127
1210
|
: `${styles.darken(theme.palette.background.default, 0.05)}`
|
1128
1211
|
: undefined,
|
1129
|
-
} },
|
1130
|
-
? tableRowProps.sx(theme)
|
1131
|
-
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))), style: Object.assign({ transform: virtualRow
|
1212
|
+
} }, sx)), style: Object.assign({ transform: virtualRow
|
1132
1213
|
? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
|
1133
1214
|
: undefined }, tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.style), children: [virtualPaddingLeft ? (jsxRuntime.jsx("td", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : row.getVisibleCells()).map((cellOrVirtualCell) => {
|
1134
1215
|
const cell = columnVirtualizer
|
@@ -1156,15 +1237,17 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, row, row
|
|
1156
1237
|
const Memo_MRT_TableBodyRow = react.memo(MRT_TableBodyRow, (prev, next) => prev.row === next.row && prev.rowIndex === next.rowIndex);
|
1157
1238
|
|
1158
1239
|
const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
|
1159
|
-
var _a, _b, _c, _d;
|
1160
|
-
const {
|
1161
|
-
const { columnFilters, density, expanded, globalFilter, globalFilterFn, pagination, sorting, } = getState();
|
1162
|
-
const tableBodyProps = muiTableBodyProps
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
:
|
1240
|
+
var _a, _b, _c, _d, _e, _f;
|
1241
|
+
const { getBottomRows, getCenterRows, getPrePaginationRowModel, getRowModel, getState, getIsSomeRowsPinned, getTopRows, options: { enableGlobalFilterRankedResults, enablePagination, enableRowPinning, enableRowVirtualization, enableStickyHeader, enableStickyFooter, layoutMode, localization, manualExpanding, manualFiltering, manualGrouping, manualPagination, manualSorting, memoMode, muiTableBodyProps, renderEmptyRowsFallback, rowPinningDisplayMode, rowVirtualizerInstanceRef, rowVirtualizerOptions, }, refs: { tableContainerRef, tablePaperRef, tableFooterRef, tableHeadRef }, } = table;
|
1242
|
+
const { columnFilters, density, expanded, globalFilter, globalFilterFn, pagination, sorting, rowPinning, isFullScreen, } = getState();
|
1243
|
+
const tableBodyProps = parseFromValuesOrFunc(muiTableBodyProps, { table });
|
1244
|
+
const rowVirtualizerProps = parseFromValuesOrFunc(rowVirtualizerOptions, {
|
1245
|
+
table,
|
1246
|
+
});
|
1247
|
+
const tableHeadHeight = ((enableStickyHeader || isFullScreen) &&
|
1248
|
+
((_a = tableHeadRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight)) ||
|
1249
|
+
0;
|
1250
|
+
const tableFooterHeight = (enableStickyFooter && ((_b = tableFooterRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight)) || 0;
|
1168
1251
|
const shouldRankResults = react.useMemo(() => !manualExpanding &&
|
1169
1252
|
!manualFiltering &&
|
1170
1253
|
!manualGrouping &&
|
@@ -1184,26 +1267,44 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
|
|
1184
1267
|
manualSorting,
|
1185
1268
|
sorting,
|
1186
1269
|
]);
|
1270
|
+
const pinnedRowIds = react.useMemo(() => getRowModel()
|
1271
|
+
.rows.filter((row) => row.getIsPinned())
|
1272
|
+
.map((r) => r.id), [rowPinning, table.getRowModel().rows]);
|
1187
1273
|
const rows = react.useMemo(() => {
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1274
|
+
let rows = [];
|
1275
|
+
if (!shouldRankResults) {
|
1276
|
+
rows =
|
1277
|
+
!enableRowPinning || (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky'))
|
1278
|
+
? getRowModel().rows
|
1279
|
+
: getCenterRows();
|
1194
1280
|
}
|
1195
|
-
|
1281
|
+
else {
|
1282
|
+
rows = getPrePaginationRowModel().rows.sort((a, b) => rankGlobalFuzzy(a, b));
|
1283
|
+
if (enablePagination && !manualPagination) {
|
1284
|
+
const start = pagination.pageIndex * pagination.pageSize;
|
1285
|
+
rows = rows.slice(start, start + pagination.pageSize);
|
1286
|
+
}
|
1287
|
+
}
|
1288
|
+
if (enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky'))) {
|
1289
|
+
rows = [
|
1290
|
+
...getTopRows().filter((row) => !pinnedRowIds.includes(row.id)),
|
1291
|
+
...rows,
|
1292
|
+
...getBottomRows().filter((row) => !pinnedRowIds.includes(row.id)),
|
1293
|
+
];
|
1294
|
+
}
|
1295
|
+
return rows;
|
1196
1296
|
}, [
|
1197
1297
|
shouldRankResults,
|
1198
1298
|
shouldRankResults ? getPrePaginationRowModel().rows : getRowModel().rows,
|
1199
1299
|
pagination.pageIndex,
|
1200
1300
|
pagination.pageSize,
|
1301
|
+
rowPinning,
|
1201
1302
|
]);
|
1202
1303
|
const rowVirtualizer = enableRowVirtualization
|
1203
1304
|
? reactVirtual.useVirtualizer(Object.assign({ count: rows.length, estimateSize: () => density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73, getScrollElement: () => tableContainerRef.current, measureElement: typeof window !== 'undefined' &&
|
1204
1305
|
navigator.userAgent.indexOf('Firefox') === -1
|
1205
1306
|
? (element) => element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height
|
1206
|
-
: undefined, overscan: 4 },
|
1307
|
+
: undefined, overscan: 4 }, rowVirtualizerProps))
|
1207
1308
|
: undefined;
|
1208
1309
|
if (rowVirtualizerInstanceRef && rowVirtualizer) {
|
1209
1310
|
rowVirtualizerInstanceRef.current = rowVirtualizer;
|
@@ -1211,41 +1312,68 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
|
|
1211
1312
|
const virtualRows = rowVirtualizer
|
1212
1313
|
? rowVirtualizer.getVirtualItems()
|
1213
1314
|
: undefined;
|
1214
|
-
return (jsxRuntime.
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
},
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1315
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
|
1316
|
+
getIsSomeRowsPinned('top') && (jsxRuntime.jsx(TableBody__default["default"], Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', position: 'sticky', top: tableHeadHeight - 1, zIndex: 1 }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: getTopRows().map((row, rowIndex) => {
|
1317
|
+
const props = {
|
1318
|
+
columnVirtualizer,
|
1319
|
+
measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
|
1320
|
+
numRows: rows.length,
|
1321
|
+
row,
|
1322
|
+
rowIndex,
|
1323
|
+
table,
|
1324
|
+
virtualColumns,
|
1325
|
+
virtualPaddingLeft,
|
1326
|
+
virtualPaddingRight,
|
1327
|
+
};
|
1328
|
+
return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
|
1329
|
+
}) }))), jsxRuntime.jsx(TableBody__default["default"], Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', height: rowVirtualizer
|
1330
|
+
? `${rowVirtualizer.getTotalSize()}px`
|
1331
|
+
: 'inherit', minHeight: !rows.length ? '100px' : undefined, position: 'relative' }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: (_c = tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.children) !== null && _c !== void 0 ? _c : (!rows.length ? (jsxRuntime.jsx("tr", { style: { display: layoutMode === 'grid' ? 'grid' : 'table-row' }, children: jsxRuntime.jsx("td", { colSpan: table.getVisibleLeafColumns().length, style: {
|
1332
|
+
display: layoutMode === 'grid' ? 'grid' : 'table-cell',
|
1333
|
+
}, children: (_d = renderEmptyRowsFallback === null || renderEmptyRowsFallback === void 0 ? void 0 : renderEmptyRowsFallback({ table })) !== null && _d !== void 0 ? _d : (jsxRuntime.jsx(Typography__default["default"], { sx: {
|
1334
|
+
color: 'text.secondary',
|
1335
|
+
fontStyle: 'italic',
|
1336
|
+
maxWidth: `min(100vw, ${(_f = (_e = tablePaperRef.current) === null || _e === void 0 ? void 0 : _e.clientWidth) !== null && _f !== void 0 ? _f : 360}px)`,
|
1337
|
+
py: '2rem',
|
1338
|
+
textAlign: 'center',
|
1339
|
+
width: '100%',
|
1340
|
+
}, children: globalFilter || columnFilters.length
|
1341
|
+
? localization.noResultsFound
|
1342
|
+
: localization.noRecordsToDisplay })) }) })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: (virtualRows !== null && virtualRows !== void 0 ? virtualRows : rows).map((rowOrVirtualRow, rowIndex) => {
|
1343
|
+
const row = rowVirtualizer
|
1344
|
+
? rows[rowOrVirtualRow.index]
|
1345
|
+
: rowOrVirtualRow;
|
1346
|
+
const props = {
|
1347
|
+
columnVirtualizer,
|
1348
|
+
measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
|
1349
|
+
numRows: rows.length,
|
1350
|
+
pinnedRowIds,
|
1351
|
+
row,
|
1352
|
+
rowIndex: rowVirtualizer ? rowOrVirtualRow.index : rowIndex,
|
1353
|
+
table,
|
1354
|
+
virtualColumns,
|
1355
|
+
virtualPaddingLeft,
|
1356
|
+
virtualPaddingRight,
|
1357
|
+
virtualRow: rowVirtualizer
|
1358
|
+
? rowOrVirtualRow
|
1359
|
+
: undefined,
|
1360
|
+
};
|
1361
|
+
return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
|
1362
|
+
}) }))) })), !(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('sticky')) &&
|
1363
|
+
getIsSomeRowsPinned('bottom') && (jsxRuntime.jsx(TableBody__default["default"], Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', position: 'sticky', bottom: tableFooterHeight - 1, zIndex: 1 }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: getBottomRows().map((row, rowIndex) => {
|
1364
|
+
const props = {
|
1365
|
+
columnVirtualizer,
|
1366
|
+
measureElement: rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.measureElement,
|
1367
|
+
numRows: rows.length,
|
1368
|
+
row,
|
1369
|
+
rowIndex,
|
1370
|
+
table,
|
1371
|
+
virtualColumns,
|
1372
|
+
virtualPaddingLeft,
|
1373
|
+
virtualPaddingRight,
|
1374
|
+
};
|
1375
|
+
return memoMode === 'rows' ? (jsxRuntime.jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsxRuntime.jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
|
1376
|
+
}) })))] }));
|
1249
1377
|
};
|
1250
1378
|
const Memo_MRT_TableBody = react.memo(MRT_TableBody, (prev, next) => prev.table.options.data === next.table.options.data);
|
1251
1379
|
|
@@ -1253,15 +1381,13 @@ const MRT_ExpandAllButton = ({ table, }) => {
|
|
1253
1381
|
var _a, _b;
|
1254
1382
|
const { getIsAllRowsExpanded, getIsSomeRowsExpanded, getCanSomeRowsExpand, getState, options: { icons: { KeyboardDoubleArrowDownIcon }, localization, muiExpandAllButtonProps, renderDetailPanel, }, toggleAllRowsExpanded, } = table;
|
1255
1383
|
const { density, isLoading } = getState();
|
1256
|
-
const iconButtonProps = muiExpandAllButtonProps
|
1257
|
-
|
1258
|
-
|
1384
|
+
const iconButtonProps = parseFromValuesOrFunc(muiExpandAllButtonProps, {
|
1385
|
+
table,
|
1386
|
+
});
|
1259
1387
|
const isAllRowsExpanded = getIsAllRowsExpanded();
|
1260
1388
|
return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: ((_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : isAllRowsExpanded)
|
1261
1389
|
? localization.collapseAll
|
1262
|
-
: localization.expandAll, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], 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 }, (
|
1263
|
-
? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
|
1264
|
-
: iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined, children: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _b !== void 0 ? _b : (jsxRuntime.jsx(KeyboardDoubleArrowDownIcon, { style: {
|
1390
|
+
: localization.expandAll, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], 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 }, parseFromValuesOrFunc(iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx, theme))), title: undefined, children: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _b !== void 0 ? _b : (jsxRuntime.jsx(KeyboardDoubleArrowDownIcon, { style: {
|
1265
1391
|
transform: `rotate(${isAllRowsExpanded ? -180 : getIsSomeRowsExpanded() ? -90 : 0}deg)`,
|
1266
1392
|
transition: 'transform 150ms',
|
1267
1393
|
} })) })) }) }));
|
@@ -1271,9 +1397,10 @@ const MRT_ExpandButton = ({ row, table, }) => {
|
|
1271
1397
|
var _a, _b;
|
1272
1398
|
const { getState, options: { icons: { ExpandMoreIcon }, localization, muiExpandButtonProps, renderDetailPanel, }, } = table;
|
1273
1399
|
const { density } = getState();
|
1274
|
-
const iconButtonProps = muiExpandButtonProps
|
1275
|
-
|
1276
|
-
|
1400
|
+
const iconButtonProps = parseFromValuesOrFunc(muiExpandButtonProps, {
|
1401
|
+
row,
|
1402
|
+
table,
|
1403
|
+
});
|
1277
1404
|
const canExpand = row.getCanExpand();
|
1278
1405
|
const isExpanded = row.getIsExpanded();
|
1279
1406
|
const handleToggleExpand = (event) => {
|
@@ -1284,9 +1411,7 @@ const MRT_ExpandButton = ({ row, table, }) => {
|
|
1284
1411
|
};
|
1285
1412
|
return (jsxRuntime.jsx(Tooltip__default["default"], { 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)
|
1286
1413
|
? localization.collapse
|
1287
|
-
: localization.expand, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], 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' }, (
|
1288
|
-
? iconButtonProps.sx(theme)
|
1289
|
-
: iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined, children: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _b !== void 0 ? _b : (jsxRuntime.jsx(ExpandMoreIcon, { style: {
|
1414
|
+
: localization.expand, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], 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' }, parseFromValuesOrFunc(iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx, theme))), title: undefined, children: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _b !== void 0 ? _b : (jsxRuntime.jsx(ExpandMoreIcon, { style: {
|
1290
1415
|
transform: `rotate(${!canExpand && !renderDetailPanel ? -90 : isExpanded ? -180 : 0}deg)`,
|
1291
1416
|
transition: 'transform 150ms',
|
1292
1417
|
} })) })) }) }));
|
@@ -1626,9 +1751,7 @@ const MRT_RowActionMenu = ({ anchorEl, handleEdit, row, setAnchorEl, table, }) =
|
|
1626
1751
|
const { density } = getState();
|
1627
1752
|
return (jsxRuntime.jsxs(Menu__default["default"], { anchorEl: anchorEl, open: !!anchorEl, onClick: (event) => event.stopPropagation(), onClose: () => setAnchorEl(null), MenuListProps: {
|
1628
1753
|
dense: density === 'compact',
|
1629
|
-
}, children: [enableEditing
|
1630
|
-
? enableEditing(row)
|
1631
|
-
: enableEditing && (jsxRuntime.jsx(MenuItem__default["default"], { onClick: handleEdit, sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(EditIcon, {}) }), localization.edit] }) })), renderRowActionMenuItems === null || renderRowActionMenuItems === void 0 ? void 0 : renderRowActionMenuItems({
|
1754
|
+
}, children: [parseFromValuesOrFunc(enableEditing, row) && (jsxRuntime.jsx(MenuItem__default["default"], { onClick: handleEdit, sx: commonMenuItemStyles, children: jsxRuntime.jsxs(Box__default["default"], { sx: commonListItemStyles, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: jsxRuntime.jsx(EditIcon, {}) }), localization.edit] }) })), renderRowActionMenuItems === null || renderRowActionMenuItems === void 0 ? void 0 : renderRowActionMenuItems({
|
1632
1755
|
row,
|
1633
1756
|
table,
|
1634
1757
|
closeMenu: () => setAnchorEl(null),
|
@@ -1710,22 +1833,16 @@ const MRT_ToggleRowActionMenuButton = ({ cell, row, table, }) => {
|
|
1710
1833
|
setAnchorEl(null);
|
1711
1834
|
};
|
1712
1835
|
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderRowActions && !showEditActionButtons ? (renderRowActions({ cell, row, table })) : showEditActionButtons ? (jsxRuntime.jsx(MRT_EditActionButtons, { row: row, table: table })) : !renderRowActionMenuItems &&
|
1713
|
-
(enableEditing
|
1714
|
-
? enableEditing(row)
|
1715
|
-
: enableEditing) ? (jsxRuntime.jsx(Tooltip__default["default"], { placement: "right", arrow: true, title: localization.edit, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.edit, sx: commonIconButtonStyles, onClick: handleStartEditMode, children: jsxRuntime.jsx(EditIcon, {}) }) })) : renderRowActionMenuItems ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.rowActions, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.rowActions, onClick: handleOpenRowActionMenu, size: "small", sx: commonIconButtonStyles, children: jsxRuntime.jsx(MoreHorizIcon, {}) }) }), jsxRuntime.jsx(MRT_RowActionMenu, { anchorEl: anchorEl, handleEdit: handleStartEditMode, row: row, setAnchorEl: setAnchorEl, table: table })] })) : null }));
|
1836
|
+
parseFromValuesOrFunc(enableEditing, row) ? (jsxRuntime.jsx(Tooltip__default["default"], { placement: "right", arrow: true, title: localization.edit, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.edit, sx: commonIconButtonStyles, onClick: handleStartEditMode, children: jsxRuntime.jsx(EditIcon, {}) }) })) : renderRowActionMenuItems ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.rowActions, children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.rowActions, onClick: handleOpenRowActionMenu, size: "small", sx: commonIconButtonStyles, children: jsxRuntime.jsx(MoreHorizIcon, {}) }) }), jsxRuntime.jsx(MRT_RowActionMenu, { anchorEl: anchorEl, handleEdit: handleStartEditMode, row: row, setAnchorEl: setAnchorEl, table: table })] })) : null }));
|
1716
1837
|
};
|
1717
1838
|
|
1718
1839
|
const MRT_SelectCheckbox = ({ row, selectAll, table, }) => {
|
1719
1840
|
var _a;
|
1720
|
-
const { getState, options: { localization, enableMultiRowSelection, muiSelectCheckboxProps, muiSelectAllCheckboxProps, selectAllMode, }, } = table;
|
1841
|
+
const { getState, options: { localization, enableMultiRowSelection, rowPinningDisplayMode, enableRowPinning, muiSelectCheckboxProps, muiSelectAllCheckboxProps, selectAllMode, }, } = table;
|
1721
1842
|
const { density, isLoading } = getState();
|
1722
1843
|
const checkboxProps = !row
|
1723
|
-
? muiSelectAllCheckboxProps
|
1724
|
-
|
1725
|
-
: muiSelectAllCheckboxProps
|
1726
|
-
: muiSelectCheckboxProps instanceof Function
|
1727
|
-
? muiSelectCheckboxProps({ row, table })
|
1728
|
-
: muiSelectCheckboxProps;
|
1844
|
+
? parseFromValuesOrFunc(muiSelectAllCheckboxProps, { table })
|
1845
|
+
: parseFromValuesOrFunc(muiSelectCheckboxProps, { row, table });
|
1729
1846
|
const allRowsSelected = selectAll
|
1730
1847
|
? selectAllMode === 'page'
|
1731
1848
|
? table.getIsAllPageRowsSelected()
|
@@ -1735,17 +1852,30 @@ const MRT_SelectCheckbox = ({ row, selectAll, table, }) => {
|
|
1735
1852
|
'aria-label': selectAll
|
1736
1853
|
? localization.toggleSelectAll
|
1737
1854
|
: localization.toggleSelectRow,
|
1738
|
-
}, onChange:
|
1739
|
-
|
1740
|
-
|
1741
|
-
?
|
1742
|
-
:
|
1855
|
+
}, onChange: (event) => {
|
1856
|
+
event.stopPropagation();
|
1857
|
+
row
|
1858
|
+
? row.getToggleSelectedHandler()(event)
|
1859
|
+
: selectAllMode === 'all'
|
1860
|
+
? table.getToggleAllRowsSelectedHandler()(event)
|
1861
|
+
: table.getToggleAllPageRowsSelectedHandler()(event);
|
1862
|
+
if (enableRowPinning && (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('select'))) {
|
1863
|
+
if (row) {
|
1864
|
+
row.pin(!row.getIsPinned() && event.target.checked
|
1865
|
+
? (rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.includes('bottom'))
|
1866
|
+
? 'bottom'
|
1867
|
+
: 'top'
|
1868
|
+
: false);
|
1869
|
+
}
|
1870
|
+
else {
|
1871
|
+
table.setRowPinning({ bottom: [], top: [] });
|
1872
|
+
}
|
1873
|
+
}
|
1874
|
+
}, size: (density === 'compact' ? 'small' : 'medium') }, checkboxProps), { onClick: (e) => {
|
1743
1875
|
var _a;
|
1744
1876
|
e.stopPropagation();
|
1745
1877
|
(_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
|
1746
|
-
}, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.5rem', width: density === 'compact' ? '1.75rem' : '2.5rem', m: density !== 'compact' ? '-0.4rem' : undefined }, (
|
1747
|
-
? checkboxProps.sx(theme)
|
1748
|
-
: checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx))), title: undefined });
|
1878
|
+
}, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.5rem', width: density === 'compact' ? '1.75rem' : '2.5rem', m: density !== 'compact' ? '-0.4rem' : undefined, zIndex: 0 }, parseFromValuesOrFunc(checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx, theme))), title: undefined });
|
1749
1879
|
return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _a !== void 0 ? _a : (selectAll
|
1750
1880
|
? localization.toggleSelectAll
|
1751
1881
|
: localization.toggleSelectRow), children: enableMultiRowSelection === false ? (jsxRuntime.jsx(Radio__default["default"], Object.assign({}, commonProps))) : (jsxRuntime.jsx(Checkbox__default["default"], Object.assign({ indeterminate: selectAll
|
@@ -1756,20 +1886,21 @@ const MRT_SelectCheckbox = ({ row, selectAll, table, }) => {
|
|
1756
1886
|
const useMRT_DisplayColumns = ({ creatingRow, columnOrder, grouping, tableOptions, }) => {
|
1757
1887
|
var _a, _b;
|
1758
1888
|
return react.useMemo(() => {
|
1759
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
1889
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
1760
1890
|
return [
|
1761
|
-
((_b = (_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.columnOrder) !== null && _b !== void 0 ? _b : columnOrder).includes('mrt-row-
|
1762
|
-
((
|
1763
|
-
|
1764
|
-
|
1765
|
-
|
1891
|
+
((_b = (_a = tableOptions.state) === null || _a === void 0 ? void 0 : _a.columnOrder) !== null && _b !== void 0 ? _b : columnOrder).includes('mrt-row-pin') && Object.assign(Object.assign(Object.assign({ Cell: ({ row, table }) => (jsxRuntime.jsx(MRT_TableBodyRowPinButton, { row: row, table: table })), header: tableOptions.localization.pin, size: 60 }, tableOptions.defaultDisplayColumn), (_c = tableOptions.displayColumnDefOptions) === null || _c === void 0 ? void 0 : _c['mrt-row-pin']), { id: 'mrt-row-pin' }),
|
1892
|
+
((_e = (_d = tableOptions.state) === null || _d === void 0 ? void 0 : _d.columnOrder) !== null && _e !== void 0 ? _e : columnOrder).includes('mrt-row-drag') && Object.assign(Object.assign(Object.assign({ Cell: ({ row, rowRef, table }) => (jsxRuntime.jsx(MRT_TableBodyRowGrabHandle, { row: row, rowRef: rowRef, table: table })), header: tableOptions.localization.move, size: 60 }, tableOptions.defaultDisplayColumn), (_f = tableOptions.displayColumnDefOptions) === null || _f === void 0 ? void 0 : _f['mrt-row-drag']), { id: 'mrt-row-drag' }),
|
1893
|
+
(((_h = (_g = tableOptions.state) === null || _g === void 0 ? void 0 : _g.columnOrder) !== null && _h !== void 0 ? _h : columnOrder).includes('mrt-row-actions') ||
|
1894
|
+
(creatingRow && tableOptions.createDisplayMode === 'row')) && Object.assign(Object.assign(Object.assign({ Cell: ({ cell, row, table }) => (jsxRuntime.jsx(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, table: table })), header: tableOptions.localization.actions, size: 70 }, tableOptions.defaultDisplayColumn), (_j = tableOptions.displayColumnDefOptions) === null || _j === void 0 ? void 0 : _j['mrt-row-actions']), { id: 'mrt-row-actions' }),
|
1895
|
+
((_l = (_k = tableOptions.state) === null || _k === void 0 ? void 0 : _k.columnOrder) !== null && _l !== void 0 ? _l : columnOrder).includes('mrt-row-expand') &&
|
1896
|
+
showExpandColumn(tableOptions, (_o = (_m = tableOptions.state) === null || _m === void 0 ? void 0 : _m.grouping) !== null && _o !== void 0 ? _o : grouping) && Object.assign(Object.assign(Object.assign({ Cell: ({ row, table }) => (jsxRuntime.jsx(MRT_ExpandButton, { row: row, table: table })), Header: tableOptions.enableExpandAll
|
1766
1897
|
? ({ table }) => jsxRuntime.jsx(MRT_ExpandAllButton, { table: table })
|
1767
|
-
: null, header: tableOptions.localization.expand, size: 60 }, tableOptions.defaultDisplayColumn), (
|
1768
|
-
((
|
1898
|
+
: null, header: tableOptions.localization.expand, size: 60 }, tableOptions.defaultDisplayColumn), (_p = tableOptions.displayColumnDefOptions) === null || _p === void 0 ? void 0 : _p['mrt-row-expand']), { id: 'mrt-row-expand' }),
|
1899
|
+
((_r = (_q = tableOptions.state) === null || _q === void 0 ? void 0 : _q.columnOrder) !== null && _r !== void 0 ? _r : columnOrder).includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({ row, table }) => (jsxRuntime.jsx(MRT_SelectCheckbox, { row: row, table: table })), Header: tableOptions.enableSelectAll &&
|
1769
1900
|
tableOptions.enableMultiRowSelection
|
1770
1901
|
? ({ table }) => jsxRuntime.jsx(MRT_SelectCheckbox, { selectAll: true, table: table })
|
1771
|
-
: null, header: tableOptions.localization.select, size: 60 }, tableOptions.defaultDisplayColumn), (
|
1772
|
-
((
|
1902
|
+
: null, header: tableOptions.localization.select, size: 60 }, tableOptions.defaultDisplayColumn), (_s = tableOptions.displayColumnDefOptions) === null || _s === void 0 ? void 0 : _s['mrt-row-select']), { id: 'mrt-row-select' }),
|
1903
|
+
((_u = (_t = tableOptions.state) === null || _t === void 0 ? void 0 : _t.columnOrder) !== null && _u !== void 0 ? _u : columnOrder).includes('mrt-row-numbers') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => row.index + 1, Header: () => tableOptions.localization.rowNumber, header: tableOptions.localization.rowNumbers, size: 60 }, tableOptions.defaultDisplayColumn), (_v = tableOptions.displayColumnDefOptions) === null || _v === void 0 ? void 0 : _v['mrt-row-numbers']), { id: 'mrt-row-numbers' }),
|
1773
1904
|
].filter(Boolean);
|
1774
1905
|
}, [
|
1775
1906
|
columnOrder,
|
@@ -1869,6 +2000,8 @@ const useMRT_TableInstance = (tableOptions) => {
|
|
1869
2000
|
const tableHeadCellRefs = react.useRef({});
|
1870
2001
|
const tablePaperRef = react.useRef(null);
|
1871
2002
|
const topToolbarRef = react.useRef(null);
|
2003
|
+
const tableHeadRef = react.useRef(null);
|
2004
|
+
const tableFooterRef = react.useRef(null);
|
1872
2005
|
const initialState = react.useMemo(() => {
|
1873
2006
|
var _a, _b, _c;
|
1874
2007
|
const initState = (_a = tableOptions.initialState) !== null && _a !== void 0 ? _a : {};
|
@@ -1993,6 +2126,10 @@ const useMRT_TableInstance = (tableOptions) => {
|
|
1993
2126
|
tablePaperRef,
|
1994
2127
|
// @ts-ignore
|
1995
2128
|
topToolbarRef,
|
2129
|
+
// @ts-ignore
|
2130
|
+
tableFooterRef,
|
2131
|
+
// @ts-ignore
|
2132
|
+
tableHeadRef,
|
1996
2133
|
};
|
1997
2134
|
const setCreatingRow = (row) => {
|
1998
2135
|
if (row === true) {
|
@@ -2039,9 +2176,9 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
2039
2176
|
var _a;
|
2040
2177
|
const { getState, setGlobalFilter, options: { enableGlobalFilterModes, icons: { SearchIcon, CloseIcon }, localization, manualFiltering, muiSearchTextFieldProps, }, refs: { searchInputRef }, } = table;
|
2041
2178
|
const { globalFilter, showGlobalFilter } = getState();
|
2042
|
-
const textFieldProps = muiSearchTextFieldProps
|
2043
|
-
|
2044
|
-
|
2179
|
+
const textFieldProps = parseFromValuesOrFunc(muiSearchTextFieldProps, {
|
2180
|
+
table,
|
2181
|
+
});
|
2045
2182
|
const isMounted = react.useRef(false);
|
2046
2183
|
const [anchorEl, setAnchorEl] = react.useState(null);
|
2047
2184
|
const [searchValue, setSearchValue] = react.useState(globalFilter !== null && globalFilter !== void 0 ? globalFilter : '');
|
@@ -2085,9 +2222,10 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
2085
2222
|
const MRT_LinearProgressBar = ({ isTopToolbar, table, }) => {
|
2086
2223
|
const { options: { muiLinearProgressProps }, getState, } = table;
|
2087
2224
|
const { isLoading, showProgressBars } = getState();
|
2088
|
-
const linearProgressProps = muiLinearProgressProps
|
2089
|
-
|
2090
|
-
|
2225
|
+
const linearProgressProps = parseFromValuesOrFunc(muiLinearProgressProps, {
|
2226
|
+
isTopToolbar,
|
2227
|
+
table,
|
2228
|
+
});
|
2091
2229
|
return (jsxRuntime.jsx(Collapse__default["default"], { in: isLoading || showProgressBars, mountOnEnter: true, unmountOnExit: true, sx: {
|
2092
2230
|
bottom: isTopToolbar ? 0 : undefined,
|
2093
2231
|
position: 'absolute',
|
@@ -2101,9 +2239,9 @@ const MRT_TablePagination = ({ table, position = 'bottom', }) => {
|
|
2101
2239
|
const { pagination: { pageSize = 10, pageIndex = 0 }, showGlobalFilter, } = getState();
|
2102
2240
|
const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
|
2103
2241
|
const showFirstLastPageButtons = totalRowCount / pageSize > 2;
|
2104
|
-
const tablePaginationProps = muiTablePaginationProps
|
2105
|
-
|
2106
|
-
|
2242
|
+
const tablePaginationProps = parseFromValuesOrFunc(muiTablePaginationProps, {
|
2243
|
+
table,
|
2244
|
+
});
|
2107
2245
|
const handleChangeRowsPerPage = (event) => {
|
2108
2246
|
setPageSize(+event.target.value);
|
2109
2247
|
};
|
@@ -2130,21 +2268,19 @@ const MRT_TablePagination = ({ table, position = 'bottom', }) => {
|
|
2130
2268
|
enableToolbarInternalActions &&
|
2131
2269
|
!showGlobalFilter
|
2132
2270
|
? '3.5rem'
|
2133
|
-
: undefined, position: 'relative', zIndex: 2 }, (
|
2134
|
-
? tablePaginationProps.sx(theme)
|
2135
|
-
: tablePaginationProps === null || tablePaginationProps === void 0 ? void 0 : tablePaginationProps.sx))) })));
|
2271
|
+
: undefined, position: 'relative', zIndex: 2 }, parseFromValuesOrFunc(tablePaginationProps === null || tablePaginationProps === void 0 ? void 0 : tablePaginationProps.sx, theme))) })));
|
2136
2272
|
};
|
2137
2273
|
|
2138
2274
|
const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
|
2139
2275
|
var _a, _b;
|
2140
2276
|
const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { localization, muiToolbarAlertBannerProps, muiToolbarAlertBannerChipProps, positionToolbarAlertBanner, rowCount, }, } = table;
|
2141
2277
|
const { grouping, showAlertBanner } = getState();
|
2142
|
-
const alertProps = muiToolbarAlertBannerProps
|
2143
|
-
|
2144
|
-
|
2145
|
-
const chipProps = muiToolbarAlertBannerChipProps
|
2146
|
-
|
2147
|
-
|
2278
|
+
const alertProps = parseFromValuesOrFunc(muiToolbarAlertBannerProps, {
|
2279
|
+
table,
|
2280
|
+
});
|
2281
|
+
const chipProps = parseFromValuesOrFunc(muiToolbarAlertBannerChipProps, {
|
2282
|
+
table,
|
2283
|
+
});
|
2148
2284
|
const selectMessage = getSelectedRowModel().rows.length > 0
|
2149
2285
|
? (_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())
|
2150
2286
|
: null;
|
@@ -2153,9 +2289,7 @@ const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
|
|
2153
2289
|
? 0
|
2154
2290
|
: positionToolbarAlertBanner === 'bottom'
|
2155
2291
|
? '-1rem'
|
2156
|
-
: undefined, right: 0, top: 0, width: '100%', zIndex: 2 }, ((alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx)
|
2157
|
-
? alertProps.sx(theme)
|
2158
|
-
: alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx))), children: [(alertProps === null || alertProps === void 0 ? void 0 : alertProps.title) && jsxRuntime.jsx(AlertTitle__default["default"], { children: alertProps.title }), jsxRuntime.jsxs(Box__default["default"], { sx: { p: '0.5rem 1rem' }, children: [alertProps === null || alertProps === void 0 ? void 0 : alertProps.children, (alertProps === null || alertProps === void 0 ? void 0 : alertProps.children) && (selectMessage || groupedByMessage) && (jsxRuntime.jsx("br", {})), selectMessage, selectMessage && groupedByMessage && jsxRuntime.jsx("br", {}), groupedByMessage] })] })) }));
|
2292
|
+
: undefined, right: 0, top: 0, width: '100%', zIndex: 2 }, parseFromValuesOrFunc(alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx, theme))), children: [(alertProps === null || alertProps === void 0 ? void 0 : alertProps.title) && jsxRuntime.jsx(AlertTitle__default["default"], { children: alertProps.title }), jsxRuntime.jsxs(Box__default["default"], { sx: { p: '0.5rem 1rem' }, children: [alertProps === null || alertProps === void 0 ? void 0 : alertProps.children, (alertProps === null || alertProps === void 0 ? void 0 : alertProps.children) && (selectMessage || groupedByMessage) && (jsxRuntime.jsx("br", {})), selectMessage, selectMessage && groupedByMessage && jsxRuntime.jsx("br", {}), groupedByMessage] })] })) }));
|
2159
2293
|
};
|
2160
2294
|
|
2161
2295
|
const MRT_ToggleFullScreenButton = (_a) => {
|
@@ -2402,9 +2536,7 @@ const MRT_TopToolbar = ({ table, }) => {
|
|
2402
2536
|
const { getState, options: { enableGlobalFilter, enablePagination, enableToolbarInternalActions, muiTopToolbarProps, positionGlobalFilter, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderTopToolbarCustomActions, }, refs: { topToolbarRef }, } = table;
|
2403
2537
|
const { isFullScreen, showGlobalFilter } = getState();
|
2404
2538
|
const isMobile = useMediaQuery__default["default"]('(max-width:720px)');
|
2405
|
-
const toolbarProps = muiTopToolbarProps
|
2406
|
-
? muiTopToolbarProps({ table })
|
2407
|
-
: muiTopToolbarProps;
|
2539
|
+
const toolbarProps = parseFromValuesOrFunc(muiTopToolbarProps, { table });
|
2408
2540
|
const stackAlertBanner = isMobile || !!renderTopToolbarCustomActions || showGlobalFilter;
|
2409
2541
|
return (jsxRuntime.jsxs(Toolbar__default["default"], Object.assign({ variant: "dense" }, toolbarProps, { ref: (ref) => {
|
2410
2542
|
topToolbarRef.current = ref;
|
@@ -2412,9 +2544,7 @@ const MRT_TopToolbar = ({ table, }) => {
|
|
2412
2544
|
// @ts-ignore
|
2413
2545
|
toolbarProps.ref.current = ref;
|
2414
2546
|
}
|
2415
|
-
}, sx: (theme) => (Object.assign(Object.assign({ position: isFullScreen ? 'sticky' : undefined, top: isFullScreen ? '0' : undefined }, commonToolbarStyles({ theme })), (
|
2416
|
-
? toolbarProps.sx(theme)
|
2417
|
-
: toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx))), children: [positionToolbarAlertBanner === 'top' && (jsxRuntime.jsx(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })), ['both', 'top'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (jsxRuntime.jsx(MRT_ToolbarDropZone, { table: table })), jsxRuntime.jsxs(Box__default["default"], { sx: {
|
2547
|
+
}, sx: (theme) => (Object.assign(Object.assign({ position: isFullScreen ? 'sticky' : undefined, top: isFullScreen ? '0' : undefined }, commonToolbarStyles({ theme })), parseFromValuesOrFunc(toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx, theme))), children: [positionToolbarAlertBanner === 'top' && (jsxRuntime.jsx(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })), ['both', 'top'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (jsxRuntime.jsx(MRT_ToolbarDropZone, { table: table })), jsxRuntime.jsxs(Box__default["default"], { sx: {
|
2418
2548
|
alignItems: 'flex-start',
|
2419
2549
|
boxSizing: 'border-box',
|
2420
2550
|
display: 'flex',
|
@@ -2437,9 +2567,7 @@ const MRT_BottomToolbar = ({ table, }) => {
|
|
2437
2567
|
const { getState, options: { enablePagination, muiBottomToolbarProps, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderBottomToolbarCustomActions, }, refs: { bottomToolbarRef }, } = table;
|
2438
2568
|
const { isFullScreen } = getState();
|
2439
2569
|
const isMobile = useMediaQuery__default["default"]('(max-width:720px)');
|
2440
|
-
const toolbarProps = muiBottomToolbarProps
|
2441
|
-
? muiBottomToolbarProps({ table })
|
2442
|
-
: muiBottomToolbarProps;
|
2570
|
+
const toolbarProps = parseFromValuesOrFunc(muiBottomToolbarProps, { table });
|
2443
2571
|
const stackAlertBanner = isMobile || !!renderBottomToolbarCustomActions;
|
2444
2572
|
return (jsxRuntime.jsxs(Toolbar__default["default"], Object.assign({ variant: "dense" }, toolbarProps, { ref: (node) => {
|
2445
2573
|
if (node) {
|
@@ -2449,9 +2577,7 @@ const MRT_BottomToolbar = ({ table, }) => {
|
|
2449
2577
|
toolbarProps.ref.current = node;
|
2450
2578
|
}
|
2451
2579
|
}
|
2452
|
-
}, sx: (theme) => (Object.assign(Object.assign(Object.assign({}, commonToolbarStyles({ theme })), { bottom: isFullScreen ? '0' : undefined, boxShadow: `0 1px 2px -1px ${styles.alpha(theme.palette.common.black, 0.1)} inset`, left: 0, position: isFullScreen ? 'fixed' : 'relative', right: 0 }), (
|
2453
|
-
? toolbarProps.sx(theme)
|
2454
|
-
: toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx))), children: [jsxRuntime.jsx(MRT_LinearProgressBar, { isTopToolbar: false, table: table }), positionToolbarAlertBanner === 'bottom' && (jsxRuntime.jsx(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })), ['both', 'bottom'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (jsxRuntime.jsx(MRT_ToolbarDropZone, { table: table })), jsxRuntime.jsxs(Box__default["default"], { sx: {
|
2580
|
+
}, sx: (theme) => (Object.assign(Object.assign(Object.assign({}, commonToolbarStyles({ theme })), { bottom: isFullScreen ? '0' : undefined, boxShadow: `0 1px 2px -1px ${styles.alpha(theme.palette.common.black, 0.1)} inset`, left: 0, position: isFullScreen ? 'fixed' : 'relative', right: 0 }), parseFromValuesOrFunc(toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx, theme))), children: [jsxRuntime.jsx(MRT_LinearProgressBar, { isTopToolbar: false, table: table }), positionToolbarAlertBanner === 'bottom' && (jsxRuntime.jsx(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })), ['both', 'bottom'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (jsxRuntime.jsx(MRT_ToolbarDropZone, { table: table })), jsxRuntime.jsxs(Box__default["default"], { sx: {
|
2455
2581
|
alignItems: 'center',
|
2456
2582
|
boxSizing: 'border-box',
|
2457
2583
|
display: 'flex',
|
@@ -2479,21 +2605,16 @@ const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
|
|
2479
2605
|
event.preventDefault();
|
2480
2606
|
setAnchorEl(event.currentTarget);
|
2481
2607
|
};
|
2482
|
-
const
|
2483
|
-
|
2484
|
-
|
2485
|
-
|
2486
|
-
|
2487
|
-
|
2488
|
-
|
2489
|
-
})
|
2490
|
-
: columnDef.muiColumnActionsButtonProps;
|
2491
|
-
const iconButtonProps = Object.assign(Object.assign({}, mTableHeadCellColumnActionsButtonProps), mcTableHeadCellColumnActionsButtonProps);
|
2608
|
+
const iconButtonProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiColumnActionsButtonProps, {
|
2609
|
+
column,
|
2610
|
+
table,
|
2611
|
+
})), parseFromValuesOrFunc(columnDef.muiColumnActionsButtonProps, {
|
2612
|
+
column,
|
2613
|
+
table,
|
2614
|
+
}));
|
2492
2615
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip__default["default"], { 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, children: jsxRuntime.jsx(IconButton__default["default"], 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) translateX(-4px)', transition: 'opacity 150ms', width: '2rem', '&:hover': {
|
2493
2616
|
opacity: 1,
|
2494
|
-
} }, (
|
2495
|
-
? iconButtonProps.sx(theme)
|
2496
|
-
: iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined, children: jsxRuntime.jsx(MoreVertIcon, {}) })) }), anchorEl && (jsxRuntime.jsx(MRT_ColumnActionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table }))] }));
|
2617
|
+
} }, parseFromValuesOrFunc(iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx, theme))), title: undefined, children: jsxRuntime.jsx(MoreVertIcon, {}) })) }), anchorEl && (jsxRuntime.jsx(MRT_ColumnActionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table }))] }));
|
2497
2618
|
};
|
2498
2619
|
|
2499
2620
|
const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
@@ -2501,21 +2622,10 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
2501
2622
|
const { options: { enableColumnFilterModes, columnFilterModeOptions, icons: { FilterListIcon, CloseIcon }, localization, manualFiltering, muiFilterTextFieldProps, }, refs: { filterInputRefs }, setColumnFilterFns, } = table;
|
2502
2623
|
const { column } = header;
|
2503
2624
|
const { columnDef } = column;
|
2504
|
-
const
|
2505
|
-
|
2506
|
-
|
2507
|
-
|
2508
|
-
rangeFilterIndex,
|
2509
|
-
})
|
2510
|
-
: muiFilterTextFieldProps;
|
2511
|
-
const mcTableHeadCellFilterTextFieldProps = columnDef.muiFilterTextFieldProps instanceof Function
|
2512
|
-
? columnDef.muiFilterTextFieldProps({
|
2513
|
-
column,
|
2514
|
-
table,
|
2515
|
-
rangeFilterIndex,
|
2516
|
-
})
|
2517
|
-
: columnDef.muiFilterTextFieldProps;
|
2518
|
-
const textFieldProps = Object.assign(Object.assign({}, mTableHeadCellFilterTextFieldProps), mcTableHeadCellFilterTextFieldProps);
|
2625
|
+
const textFieldProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterTextFieldProps, { column, table })), parseFromValuesOrFunc(columnDef.muiFilterTextFieldProps, {
|
2626
|
+
column,
|
2627
|
+
table,
|
2628
|
+
}));
|
2519
2629
|
const isRangeFilter = columnDef.filterVariant === 'range' || rangeFilterIndex !== undefined;
|
2520
2630
|
const isSelectFilter = columnDef.filterVariant === 'select';
|
2521
2631
|
const isMultiSelectFilter = columnDef.filterVariant === 'multi-select';
|
@@ -2681,9 +2791,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
2681
2791
|
? '120px'
|
2682
2792
|
: 'auto', width: 'calc(100% + 4px)', mx: '-2px', '& .MuiSelect-icon': {
|
2683
2793
|
mr: '1.5rem',
|
2684
|
-
} }, (
|
2685
|
-
? textFieldProps.sx(theme)
|
2686
|
-
: textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx))), children: [(isSelectFilter || isMultiSelectFilter) && (jsxRuntime.jsx(MenuItem__default["default"], { divider: true, disabled: true, hidden: true, value: "", children: jsxRuntime.jsx(Box__default["default"], { sx: { opacity: 0.5 }, children: filterPlaceholder }) })), (_k = textFieldProps.children) !== null && _k !== void 0 ? _k : filterSelectOptions === null || filterSelectOptions === void 0 ? void 0 : filterSelectOptions.map((option) => {
|
2794
|
+
} }, parseFromValuesOrFunc(textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx, theme))), children: [(isSelectFilter || isMultiSelectFilter) && (jsxRuntime.jsx(MenuItem__default["default"], { divider: true, disabled: true, hidden: true, value: "", children: jsxRuntime.jsx(Box__default["default"], { sx: { opacity: 0.5 }, children: filterPlaceholder }) })), (_k = textFieldProps.children) !== null && _k !== void 0 ? _k : filterSelectOptions === null || filterSelectOptions === void 0 ? void 0 : filterSelectOptions.map((option) => {
|
2687
2795
|
var _a;
|
2688
2796
|
if (!option)
|
2689
2797
|
return '';
|
@@ -2716,19 +2824,13 @@ const MRT_FilterCheckbox = ({ column, table, }) => {
|
|
2716
2824
|
const { getState, options: { localization, muiFilterCheckboxProps }, } = table;
|
2717
2825
|
const { density } = getState();
|
2718
2826
|
const { columnDef } = column;
|
2719
|
-
const
|
2720
|
-
|
2721
|
-
|
2722
|
-
|
2723
|
-
|
2724
|
-
|
2725
|
-
|
2726
|
-
? columnDef.muiFilterCheckboxProps({
|
2727
|
-
column,
|
2728
|
-
table,
|
2729
|
-
})
|
2730
|
-
: columnDef.muiFilterCheckboxProps;
|
2731
|
-
const checkboxProps = Object.assign(Object.assign({}, mTableHeadCellFilterCheckboxProps), mcTableHeadCellFilterCheckboxProps);
|
2827
|
+
const checkboxProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterCheckboxProps, {
|
2828
|
+
column,
|
2829
|
+
table,
|
2830
|
+
})), parseFromValuesOrFunc(columnDef.muiFilterCheckboxProps, {
|
2831
|
+
column,
|
2832
|
+
table,
|
2833
|
+
}));
|
2732
2834
|
const filterLabel = (_a = localization.filterByColumn) === null || _a === void 0 ? void 0 : _a.replace('{column}', columnDef.header);
|
2733
2835
|
return (jsxRuntime.jsx(Tooltip__default["default"], { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_b = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _b !== void 0 ? _b : filterLabel, children: jsxRuntime.jsx(FormControlLabel__default["default"], { control: jsxRuntime.jsx(Checkbox__default["default"], Object.assign({ checked: column.getFilterValue() === 'true', indeterminate: column.getFilterValue() === undefined, color: column.getFilterValue() === undefined ? 'default' : 'primary', size: density === 'compact' ? 'small' : 'medium' }, checkboxProps, { onClick: (e) => {
|
2734
2836
|
var _a;
|
@@ -2742,9 +2844,7 @@ const MRT_FilterCheckbox = ({ column, table, }) => {
|
|
2742
2844
|
? 'false'
|
2743
2845
|
: undefined);
|
2744
2846
|
(_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onChange) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e, checked);
|
2745
|
-
}, sx: (theme) => (Object.assign({ height: '2.5rem', width: '2.5rem' }, (
|
2746
|
-
? checkboxProps.sx(theme)
|
2747
|
-
: checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx))) })), disableTypography: true, label: (_c = checkboxProps.title) !== null && _c !== void 0 ? _c : filterLabel, sx: { color: 'text.secondary', mt: '-4px', fontWeight: 'normal' }, title: undefined }) }));
|
2847
|
+
}, sx: (theme) => (Object.assign({ height: '2.5rem', width: '2.5rem' }, parseFromValuesOrFunc(checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx, theme))) })), disableTypography: true, label: (_c = checkboxProps.title) !== null && _c !== void 0 ? _c : filterLabel, sx: { color: 'text.secondary', mt: '-4px', fontWeight: 'normal' }, title: undefined }) }));
|
2748
2848
|
};
|
2749
2849
|
|
2750
2850
|
const MRT_FilterRangeSlider = ({ header, table, }) => {
|
@@ -2754,19 +2854,7 @@ const MRT_FilterRangeSlider = ({ header, table, }) => {
|
|
2754
2854
|
const { columnDef } = column;
|
2755
2855
|
const currentFilterOption = columnDef._filterFn;
|
2756
2856
|
const showChangeModeButton = enableColumnFilterModes && columnDef.enableColumnFilterModes !== false;
|
2757
|
-
const
|
2758
|
-
? muiFilterSliderProps({
|
2759
|
-
column,
|
2760
|
-
table,
|
2761
|
-
})
|
2762
|
-
: muiFilterSliderProps;
|
2763
|
-
const mcFilterSliderProps = columnDef.muiFilterSliderProps instanceof Function
|
2764
|
-
? columnDef.muiFilterSliderProps({
|
2765
|
-
column,
|
2766
|
-
table,
|
2767
|
-
})
|
2768
|
-
: columnDef.muiFilterSliderProps;
|
2769
|
-
const sliderProps = Object.assign(Object.assign({}, mFilterSliderProps), mcFilterSliderProps);
|
2857
|
+
const sliderProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterSliderProps, { column, table })), parseFromValuesOrFunc(columnDef.muiFilterSliderProps, { column, table }));
|
2770
2858
|
let [min, max] = sliderProps.min !== undefined && sliderProps.max !== undefined
|
2771
2859
|
? [sliderProps.min, sliderProps.max]
|
2772
2860
|
: (_a = column.getFacetedMinMaxValues()) !== null && _a !== void 0 ? _a : [0, 1];
|
@@ -2819,9 +2907,7 @@ const MRT_FilterRangeSlider = ({ header, table, }) => {
|
|
2819
2907
|
}
|
2820
2908
|
},
|
2821
2909
|
},
|
2822
|
-
}, sx: (theme) => (Object.assign({ m: 'auto', mt: !showChangeModeButton ? '10px' : '6px', px: '4px', width: 'calc(100% - 8px)' }, (
|
2823
|
-
? sliderProps.sx(theme)
|
2824
|
-
: sliderProps === null || sliderProps === void 0 ? void 0 : sliderProps.sx))) })), showChangeModeButton ? (jsxRuntime.jsx(FormHelperText__default["default"], { sx: {
|
2910
|
+
}, sx: (theme) => (Object.assign({ m: 'auto', mt: !showChangeModeButton ? '10px' : '6px', px: '4px', width: 'calc(100% - 8px)' }, parseFromValuesOrFunc(sliderProps === null || sliderProps === void 0 ? void 0 : sliderProps.sx, theme))) })), showChangeModeButton ? (jsxRuntime.jsx(FormHelperText__default["default"], { sx: {
|
2825
2911
|
m: '-3px -6px',
|
2826
2912
|
fontSize: '0.75rem',
|
2827
2913
|
lineHeight: '0.8rem',
|
@@ -2883,13 +2969,10 @@ const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
|
|
2883
2969
|
const { getState, options: { enableColumnOrdering, muiColumnDragHandleProps }, setColumnOrder, setDraggingColumn, setHoveredColumn, } = table;
|
2884
2970
|
const { columnDef } = column;
|
2885
2971
|
const { hoveredColumn, draggingColumn, columnOrder } = getState();
|
2886
|
-
const
|
2887
|
-
|
2888
|
-
|
2889
|
-
|
2890
|
-
? columnDef.muiColumnDragHandleProps({ column, table })
|
2891
|
-
: columnDef.muiColumnDragHandleProps;
|
2892
|
-
const iconButtonProps = Object.assign(Object.assign({}, mIconButtonProps), mcIconButtonProps);
|
2972
|
+
const iconButtonProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiColumnDragHandleProps, { column, table })), parseFromValuesOrFunc(columnDef.muiColumnDragHandleProps, {
|
2973
|
+
column,
|
2974
|
+
table,
|
2975
|
+
}));
|
2893
2976
|
const handleDragStart = (event) => {
|
2894
2977
|
var _a;
|
2895
2978
|
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
@@ -2976,20 +3059,14 @@ const MRT_TableHeadCellSortLabel = ({ header, table, tableCellProps, }) => {
|
|
2976
3059
|
};
|
2977
3060
|
|
2978
3061
|
const MRT_TableHeadCell = ({ header, table, }) => {
|
2979
|
-
var _a, _b, _c, _d, _f
|
3062
|
+
var _a, _b, _c, _d, _f;
|
2980
3063
|
const theme = styles.useTheme();
|
2981
3064
|
const { getState, options: { enableColumnActions, enableColumnDragging, enableColumnOrdering, enableGrouping, enableMultiSort, layoutMode, muiTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
|
2982
3065
|
const { density, draggingColumn, grouping, hoveredColumn, showColumnFilters, } = getState();
|
2983
3066
|
const { column } = header;
|
2984
3067
|
const { columnDef } = column;
|
2985
3068
|
const { columnDefType } = columnDef;
|
2986
|
-
const
|
2987
|
-
? muiTableHeadCellProps({ column, table })
|
2988
|
-
: muiTableHeadCellProps;
|
2989
|
-
const mcTableHeadCellProps = columnDef.muiTableHeadCellProps instanceof Function
|
2990
|
-
? columnDef.muiTableHeadCellProps({ column, table })
|
2991
|
-
: columnDef.muiTableHeadCellProps;
|
2992
|
-
const tableCellProps = Object.assign(Object.assign({}, mTableHeadCellProps), mcTableHeadCellProps);
|
3069
|
+
const tableCellProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableHeadCellProps, { column, table })), parseFromValuesOrFunc(columnDef.muiTableHeadCellProps, { column, table }));
|
2993
3070
|
const showColumnActions = (enableColumnActions || columnDef.enableColumnActions) &&
|
2994
3071
|
columnDef.enableColumnActions !== false;
|
2995
3072
|
const showDragHandle = enableColumnDragging !== false &&
|
@@ -3029,13 +3106,11 @@ const MRT_TableHeadCell = ({ header, table, }) => {
|
|
3029
3106
|
setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
3030
3107
|
}
|
3031
3108
|
};
|
3032
|
-
const headerElement = (
|
3033
|
-
|
3034
|
-
|
3035
|
-
|
3036
|
-
|
3037
|
-
})
|
3038
|
-
: (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) !== null && _b !== void 0 ? _b : columnDef.header;
|
3109
|
+
const headerElement = (_a = parseFromValuesOrFunc(columnDef.Header, {
|
3110
|
+
column,
|
3111
|
+
header,
|
3112
|
+
table,
|
3113
|
+
})) !== null && _a !== void 0 ? _a : columnDef.header;
|
3039
3114
|
return (jsxRuntime.jsxs(TableCell__default["default"], Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: (node) => {
|
3040
3115
|
if (node) {
|
3041
3116
|
tableHeadCellRefs.current[column.id] = node;
|
@@ -3089,10 +3164,10 @@ const MRT_TableHeadCell = ({ header, table, }) => {
|
|
3089
3164
|
? `${headerPL}rem`
|
3090
3165
|
: undefined,
|
3091
3166
|
}, children: [jsxRuntime.jsx(Box__default["default"], { className: "Mui-TableHeadCell-Content-Wrapper", sx: {
|
3092
|
-
minWidth: `${Math.min((
|
3167
|
+
minWidth: `${Math.min((_c = (_b = columnDef.header) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0, 5)}ch`,
|
3093
3168
|
overflow: columnDefType === 'data' ? 'hidden' : undefined,
|
3094
3169
|
textOverflow: 'ellipsis',
|
3095
|
-
whiteSpace: ((
|
3170
|
+
whiteSpace: ((_f = (_d = columnDef.header) === null || _d === void 0 ? void 0 : _d.length) !== null && _f !== void 0 ? _f : 0) < 20 ? 'nowrap' : 'normal',
|
3096
3171
|
'&:hover': {
|
3097
3172
|
textOverflow: 'clip',
|
3098
3173
|
},
|
@@ -3103,12 +3178,11 @@ const MRT_TableHeadCell = ({ header, table, }) => {
|
|
3103
3178
|
|
3104
3179
|
const MRT_TableHeadRow = ({ headerGroup, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
|
3105
3180
|
const { options: { layoutMode, muiTableHeadRowProps }, } = table;
|
3106
|
-
const tableRowProps = muiTableHeadRowProps
|
3107
|
-
|
3108
|
-
|
3109
|
-
|
3110
|
-
|
3111
|
-
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))), children: [virtualPaddingLeft ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : headerGroup.headers).map((headerOrVirtualHeader) => {
|
3181
|
+
const tableRowProps = parseFromValuesOrFunc(muiTableHeadRowProps, {
|
3182
|
+
headerGroup,
|
3183
|
+
table,
|
3184
|
+
});
|
3185
|
+
return (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: styles.lighten(theme.palette.background.default, 0.04), boxShadow: `4px 0 8px ${styles.alpha(theme.palette.common.black, 0.1)}`, display: layoutMode === 'grid' ? 'flex' : 'table-row', top: 0 }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme))), children: [virtualPaddingLeft ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : headerGroup.headers).map((headerOrVirtualHeader) => {
|
3112
3186
|
const header = virtualColumns
|
3113
3187
|
? headerGroup.headers[headerOrVirtualHeader.index]
|
3114
3188
|
: headerOrVirtualHeader;
|
@@ -3117,31 +3191,30 @@ const MRT_TableHeadRow = ({ headerGroup, table, virtualColumns, virtualPaddingLe
|
|
3117
3191
|
};
|
3118
3192
|
|
3119
3193
|
const MRT_TableHead = ({ table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
|
3120
|
-
const { getHeaderGroups, getState, options: { enableStickyHeader, layoutMode, muiTableHeadProps }, } = table;
|
3194
|
+
const { getHeaderGroups, getState, options: { enableStickyHeader, layoutMode, muiTableHeadProps }, refs: { tableHeadRef }, } = table;
|
3121
3195
|
const { isFullScreen } = getState();
|
3122
|
-
const tableHeadProps = muiTableHeadProps
|
3123
|
-
? muiTableHeadProps({ table })
|
3124
|
-
: muiTableHeadProps;
|
3196
|
+
const tableHeadProps = parseFromValuesOrFunc(muiTableHeadProps, { table });
|
3125
3197
|
const stickyHeader = enableStickyHeader || isFullScreen;
|
3126
|
-
return (jsxRuntime.jsx(TableHead__default["default"], 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 }, (
|
3127
|
-
|
3128
|
-
|
3198
|
+
return (jsxRuntime.jsx(TableHead__default["default"], 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 }, parseFromValuesOrFunc(tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx, theme))), ref: (ref) => {
|
3199
|
+
tableHeadRef.current = ref;
|
3200
|
+
if (tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.ref) {
|
3201
|
+
// @ts-ignore
|
3202
|
+
tableHeadProps.ref.current = ref;
|
3203
|
+
}
|
3204
|
+
}, children: getHeaderGroups().map((headerGroup) => (jsxRuntime.jsx(MRT_TableHeadRow, { headerGroup: headerGroup, table: table, virtualColumns: virtualColumns, virtualPaddingLeft: virtualPaddingLeft, virtualPaddingRight: virtualPaddingRight }, headerGroup.id))) })));
|
3129
3205
|
};
|
3130
3206
|
|
3131
3207
|
const MRT_TableFooterCell = ({ footer, table, }) => {
|
3132
|
-
var _a, _b
|
3208
|
+
var _a, _b;
|
3133
3209
|
const { getState, options: { layoutMode, muiTableFooterCellProps }, } = table;
|
3134
3210
|
const { density } = getState();
|
3135
3211
|
const { column } = footer;
|
3136
3212
|
const { columnDef } = column;
|
3137
3213
|
const { columnDefType } = columnDef;
|
3138
|
-
const
|
3139
|
-
|
3140
|
-
|
3141
|
-
|
3142
|
-
? columnDef.muiTableFooterCellProps({ column, table })
|
3143
|
-
: columnDef.muiTableFooterCellProps;
|
3144
|
-
const tableCellProps = Object.assign(Object.assign({}, mTableFooterCellProps), mcTableFooterCellProps);
|
3214
|
+
const tableCellProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterCellProps, { column, table })), parseFromValuesOrFunc(columnDef.muiTableFooterCellProps, {
|
3215
|
+
column,
|
3216
|
+
table,
|
3217
|
+
}));
|
3145
3218
|
return (jsxRuntime.jsx(TableCell__default["default"], 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'
|
3146
3219
|
? '0.5rem'
|
3147
3220
|
: density === 'comfortable'
|
@@ -3153,13 +3226,7 @@ const MRT_TableFooterCell = ({ footer, table, }) => {
|
|
3153
3226
|
tableCellProps,
|
3154
3227
|
}))), children: jsxRuntime.jsx(jsxRuntime.Fragment, { children: footer.isPlaceholder
|
3155
3228
|
? null
|
3156
|
-
: (
|
3157
|
-
? (_a = columnDef.Footer) === null || _a === void 0 ? void 0 : _a.call(columnDef, {
|
3158
|
-
column,
|
3159
|
-
footer,
|
3160
|
-
table,
|
3161
|
-
})
|
3162
|
-
: columnDef.Footer)) !== null && _b !== void 0 ? _b : columnDef.footer) !== null && _c !== void 0 ? _c : null }) })));
|
3229
|
+
: (_b = (_a = parseFromValuesOrFunc(columnDef.Footer, { column, footer, table })) !== null && _a !== void 0 ? _a : columnDef.footer) !== null && _b !== void 0 ? _b : null }) })));
|
3163
3230
|
};
|
3164
3231
|
|
3165
3232
|
const MRT_TableFooterRow = ({ footerGroup, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
|
@@ -3170,12 +3237,11 @@ const MRT_TableFooterRow = ({ footerGroup, table, virtualColumns, virtualPadding
|
|
3170
3237
|
!!header.column.columnDef.footer) ||
|
3171
3238
|
header.column.columnDef.Footer)))
|
3172
3239
|
return null;
|
3173
|
-
const tableRowProps = muiTableFooterRowProps
|
3174
|
-
|
3175
|
-
|
3176
|
-
|
3177
|
-
|
3178
|
-
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))), children: [virtualPaddingLeft ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : footerGroup.headers).map((footerOrVirtualFooter) => {
|
3240
|
+
const tableRowProps = parseFromValuesOrFunc(muiTableFooterRowProps, {
|
3241
|
+
footerGroup,
|
3242
|
+
table,
|
3243
|
+
});
|
3244
|
+
return (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: styles.lighten(theme.palette.background.default, 0.04), display: layoutMode === 'grid' ? 'flex' : 'table-row', width: '100%' }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme))), children: [virtualPaddingLeft ? (jsxRuntime.jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : footerGroup.headers).map((footerOrVirtualFooter) => {
|
3179
3245
|
const footer = virtualColumns
|
3180
3246
|
? footerGroup.headers[footerOrVirtualFooter.index]
|
3181
3247
|
: footerOrVirtualFooter;
|
@@ -3184,31 +3250,31 @@ const MRT_TableFooterRow = ({ footerGroup, table, virtualColumns, virtualPadding
|
|
3184
3250
|
};
|
3185
3251
|
|
3186
3252
|
const MRT_TableFooter = ({ table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
|
3187
|
-
const { getFooterGroups, getState, options: { enableStickyFooter, layoutMode, muiTableFooterProps }, } = table;
|
3253
|
+
const { getFooterGroups, getState, options: { enableStickyFooter, layoutMode, muiTableFooterProps }, refs: { tableFooterRef }, } = table;
|
3188
3254
|
const { isFullScreen } = getState();
|
3189
|
-
const tableFooterProps = muiTableFooterProps
|
3190
|
-
|
3191
|
-
|
3255
|
+
const tableFooterProps = parseFromValuesOrFunc(muiTableFooterProps, {
|
3256
|
+
table,
|
3257
|
+
});
|
3192
3258
|
const stickFooter = (isFullScreen || enableStickyFooter) && enableStickyFooter !== false;
|
3193
3259
|
return (jsxRuntime.jsx(TableFooter__default["default"], Object.assign({}, tableFooterProps, { sx: (theme) => (Object.assign({ bottom: stickFooter ? 0 : undefined, display: layoutMode === 'grid' ? 'grid' : 'table-row-group', opacity: stickFooter ? 0.97 : undefined, outline: stickFooter
|
3194
3260
|
? theme.palette.mode === 'light'
|
3195
3261
|
? `1px solid ${theme.palette.grey[300]}`
|
3196
3262
|
: `1px solid ${theme.palette.grey[700]}`
|
3197
|
-
: undefined, position: stickFooter ? 'sticky' : undefined, zIndex: stickFooter ? 1 : undefined }, (
|
3198
|
-
|
3199
|
-
|
3263
|
+
: undefined, position: stickFooter ? 'sticky' : undefined, zIndex: stickFooter ? 1 : undefined }, parseFromValuesOrFunc(tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx, theme))), ref: (ref) => {
|
3264
|
+
tableFooterRef.current = ref;
|
3265
|
+
if (tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.ref) {
|
3266
|
+
// @ts-ignore
|
3267
|
+
tableFooterProps.ref.current = ref;
|
3268
|
+
}
|
3269
|
+
}, children: getFooterGroups().map((footerGroup) => (jsxRuntime.jsx(MRT_TableFooterRow, { footerGroup: footerGroup, table: table, virtualColumns: virtualColumns, virtualPaddingLeft: virtualPaddingLeft, virtualPaddingRight: virtualPaddingRight }, footerGroup.id))) })));
|
3200
3270
|
};
|
3201
3271
|
|
3202
3272
|
const MRT_Table = ({ table, }) => {
|
3203
3273
|
var _a, _b, _c, _d;
|
3204
3274
|
const { getFlatHeaders, getState, options: { columnVirtualizerInstanceRef, columnVirtualizerOptions, columns, enableColumnResizing, enableColumnVirtualization, enableColumnPinning, enableStickyHeader, enableTableFooter, enableTableHead, layoutMode, memoMode, muiTableProps, }, refs: { tableContainerRef }, } = table;
|
3205
3275
|
const { columnPinning, columnSizing, columnSizingInfo, columnVisibility, isFullScreen, } = getState();
|
3206
|
-
const tableProps = muiTableProps
|
3207
|
-
|
3208
|
-
: muiTableProps;
|
3209
|
-
const vProps = columnVirtualizerOptions instanceof Function
|
3210
|
-
? columnVirtualizerOptions({ table })
|
3211
|
-
: columnVirtualizerOptions;
|
3276
|
+
const tableProps = parseFromValuesOrFunc(muiTableProps, { table });
|
3277
|
+
const columnVirtualizerProps = parseFromValuesOrFunc(columnVirtualizerOptions, { table });
|
3212
3278
|
const columnSizeVars = react.useMemo(() => {
|
3213
3279
|
const headers = getFlatHeaders();
|
3214
3280
|
const colSizes = {};
|
@@ -3245,7 +3311,7 @@ const MRT_Table = ({ table, }) => {
|
|
3245
3311
|
...reactVirtual.defaultRangeExtractor(range),
|
3246
3312
|
...rightPinnedIndexes,
|
3247
3313
|
]),
|
3248
|
-
], [leftPinnedIndexes, rightPinnedIndexes]) },
|
3314
|
+
], [leftPinnedIndexes, rightPinnedIndexes]) }, columnVirtualizerProps))
|
3249
3315
|
: undefined;
|
3250
3316
|
if (columnVirtualizerInstanceRef && columnVirtualizer) {
|
3251
3317
|
columnVirtualizerInstanceRef.current = columnVirtualizer;
|
@@ -3267,9 +3333,7 @@ const MRT_Table = ({ table, }) => {
|
|
3267
3333
|
virtualPaddingLeft,
|
3268
3334
|
virtualPaddingRight,
|
3269
3335
|
};
|
3270
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(Table__default["default"], Object.assign({ stickyHeader: enableStickyHeader || isFullScreen }, tableProps, { sx: (theme) => (Object.assign({ borderCollapse: 'separate', display: layoutMode === 'grid' ? 'grid' : 'table', tableLayout: layoutMode !== 'grid' && enableColumnResizing ? 'fixed' : undefined }, (
|
3271
|
-
? tableProps.sx(theme)
|
3272
|
-
: tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx))), style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style), children: [enableTableHead && jsxRuntime.jsx(MRT_TableHead, Object.assign({}, props)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsxRuntime.jsx(Memo_MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))) : (jsxRuntime.jsx(MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))), enableTableFooter && jsxRuntime.jsx(MRT_TableFooter, Object.assign({}, props))] })) }));
|
3336
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(Table__default["default"], Object.assign({ stickyHeader: enableStickyHeader || isFullScreen }, tableProps, { sx: (theme) => (Object.assign({ borderCollapse: 'separate', display: layoutMode === 'grid' ? 'grid' : 'table', tableLayout: layoutMode !== 'grid' && enableColumnResizing ? 'fixed' : undefined }, parseFromValuesOrFunc(tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx, theme))), style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style), children: [enableTableHead && jsxRuntime.jsx(MRT_TableHead, Object.assign({}, props)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsxRuntime.jsx(Memo_MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))) : (jsxRuntime.jsx(MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))), enableTableFooter && jsxRuntime.jsx(MRT_TableFooter, Object.assign({}, props))] })) }));
|
3273
3337
|
};
|
3274
3338
|
|
3275
3339
|
const MRT_EditRowModal = ({ open, table, }) => {
|
@@ -3277,13 +3341,8 @@ const MRT_EditRowModal = ({ open, table, }) => {
|
|
3277
3341
|
const { getState, options: { localization, onEditingRowCancel, onCreatingRowCancel, renderEditRowModalContent, renderCreateRowModalContent, muiCreateRowModalProps, muiEditRowModalProps, }, setEditingRow, setCreatingRow, } = table;
|
3278
3342
|
const { creatingRow, editingRow } = getState();
|
3279
3343
|
const row = (creatingRow !== null && creatingRow !== void 0 ? creatingRow : editingRow);
|
3280
|
-
const
|
3281
|
-
|
3282
|
-
: muiCreateRowModalProps;
|
3283
|
-
const editModalProps = muiEditRowModalProps instanceof Function
|
3284
|
-
? muiEditRowModalProps({ row, table })
|
3285
|
-
: muiEditRowModalProps;
|
3286
|
-
const dialogProps = Object.assign(Object.assign({}, editModalProps), (creatingRow && createModalProps));
|
3344
|
+
const dialogProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditRowModalProps, { row, table })), (creatingRow &&
|
3345
|
+
parseFromValuesOrFunc(muiCreateRowModalProps, { row, table })));
|
3287
3346
|
const internalEditComponents = row
|
3288
3347
|
.getAllCells()
|
3289
3348
|
.filter((cell) => cell.column.columnDef.columnDefType === 'data')
|
@@ -3310,7 +3369,7 @@ const MRT_EditRowModal = ({ open, table, }) => {
|
|
3310
3369
|
row,
|
3311
3370
|
table,
|
3312
3371
|
internalEditComponents,
|
3313
|
-
})))) !== null && _a !== void 0 ? _a : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(DialogTitle__default["default"], { sx: { textAlign: 'center' }, children:
|
3372
|
+
})))) !== null && _a !== void 0 ? _a : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(DialogTitle__default["default"], { sx: { textAlign: 'center' }, children: localization.edit }), jsxRuntime.jsx(DialogContent__default["default"], { children: jsxRuntime.jsx("form", { onSubmit: (e) => e.preventDefault(), children: jsxRuntime.jsx(Stack__default["default"], { sx: {
|
3314
3373
|
gap: '24px',
|
3315
3374
|
paddingTop: '16px',
|
3316
3375
|
width: '100%',
|
@@ -3320,11 +3379,11 @@ const MRT_EditRowModal = ({ open, table, }) => {
|
|
3320
3379
|
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? react.useLayoutEffect : react.useEffect;
|
3321
3380
|
const MRT_TableContainer = ({ table, }) => {
|
3322
3381
|
const { getState, options: { createDisplayMode, editDisplayMode, enableStickyHeader, muiTableContainerProps, }, refs: { tableContainerRef, bottomToolbarRef, topToolbarRef }, } = table;
|
3323
|
-
const { isFullScreen, creatingRow, editingRow
|
3382
|
+
const { isFullScreen, creatingRow, editingRow } = getState();
|
3324
3383
|
const [totalToolbarHeight, setTotalToolbarHeight] = react.useState(0);
|
3325
|
-
const tableContainerProps = muiTableContainerProps
|
3326
|
-
|
3327
|
-
|
3384
|
+
const tableContainerProps = parseFromValuesOrFunc(muiTableContainerProps, {
|
3385
|
+
table,
|
3386
|
+
});
|
3328
3387
|
useIsomorphicLayoutEffect(() => {
|
3329
3388
|
var _a, _b, _c, _d;
|
3330
3389
|
const topToolbarHeight = typeof document !== 'undefined'
|
@@ -3347,28 +3406,23 @@ const MRT_TableContainer = ({ table, }) => {
|
|
3347
3406
|
}
|
3348
3407
|
}, sx: (theme) => (Object.assign({ maxWidth: '100%', maxHeight: enableStickyHeader
|
3349
3408
|
? `clamp(350px, calc(100vh - ${totalToolbarHeight}px), 9999px)`
|
3350
|
-
: undefined, overflow: 'auto' }, (
|
3351
|
-
? tableContainerProps.sx(theme)
|
3352
|
-
: tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx))), style: Object.assign({ maxHeight: isFullScreen
|
3409
|
+
: undefined, overflow: 'auto' }, parseFromValuesOrFunc(tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx, theme))), style: Object.assign({ maxHeight: isFullScreen
|
3353
3410
|
? `calc(100vh - ${totalToolbarHeight}px)`
|
3354
3411
|
: undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style), children: [jsxRuntime.jsx(MRT_Table, { table: table }), (createModalOpen || editModalOpen) && (jsxRuntime.jsx(MRT_EditRowModal, { open: true, table: table }))] })));
|
3355
3412
|
};
|
3356
3413
|
|
3357
3414
|
const MRT_TablePaper = ({ table, }) => {
|
3415
|
+
var _a, _b;
|
3358
3416
|
const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps, renderBottomToolbar, renderTopToolbar, }, refs: { tablePaperRef }, } = table;
|
3359
3417
|
const { isFullScreen } = getState();
|
3360
|
-
const tablePaperProps = muiTablePaperProps
|
3361
|
-
? muiTablePaperProps({ table })
|
3362
|
-
: muiTablePaperProps;
|
3418
|
+
const tablePaperProps = parseFromValuesOrFunc(muiTablePaperProps, { table });
|
3363
3419
|
return (jsxRuntime.jsxs(Paper__default["default"], Object.assign({ elevation: 2 }, tablePaperProps, { ref: (ref) => {
|
3364
3420
|
tablePaperRef.current = ref;
|
3365
3421
|
if (tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.ref) {
|
3366
3422
|
//@ts-ignore
|
3367
3423
|
tablePaperProps.ref.current = ref;
|
3368
3424
|
}
|
3369
|
-
}, sx: (theme) => (Object.assign({ overflow: 'hidden', transition: 'all 100ms ease-in-out' }, (
|
3370
|
-
? tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx(theme)
|
3371
|
-
: tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx))), style: Object.assign(Object.assign({}, tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style), (isFullScreen
|
3425
|
+
}, sx: (theme) => (Object.assign({ overflow: 'hidden', transition: 'all 100ms ease-in-out' }, parseFromValuesOrFunc(tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx, theme))), style: Object.assign(Object.assign({}, tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style), (isFullScreen
|
3372
3426
|
? {
|
3373
3427
|
bottom: 0,
|
3374
3428
|
height: '100vh',
|
@@ -3384,12 +3438,8 @@ const MRT_TablePaper = ({ table, }) => {
|
|
3384
3438
|
zIndex: 10,
|
3385
3439
|
}
|
3386
3440
|
: {})), children: [enableTopToolbar &&
|
3387
|
-
(renderTopToolbar
|
3388
|
-
|
3389
|
-
: renderTopToolbar !== null && renderTopToolbar !== void 0 ? renderTopToolbar : jsxRuntime.jsx(MRT_TopToolbar, { table: table })), jsxRuntime.jsx(MRT_TableContainer, { table: table }), enableBottomToolbar &&
|
3390
|
-
(renderBottomToolbar instanceof Function
|
3391
|
-
? renderBottomToolbar({ table })
|
3392
|
-
: renderBottomToolbar !== null && renderBottomToolbar !== void 0 ? renderBottomToolbar : jsxRuntime.jsx(MRT_BottomToolbar, { table: table }))] })));
|
3441
|
+
((_a = parseFromValuesOrFunc(renderTopToolbar, { table })) !== null && _a !== void 0 ? _a : (jsxRuntime.jsx(MRT_TopToolbar, { table: table }))), jsxRuntime.jsx(MRT_TableContainer, { table: table }), enableBottomToolbar &&
|
3442
|
+
((_b = parseFromValuesOrFunc(renderBottomToolbar, { table })) !== null && _b !== void 0 ? _b : (jsxRuntime.jsx(MRT_BottomToolbar, { table: table })))] })));
|
3393
3443
|
};
|
3394
3444
|
|
3395
3445
|
const isTableInstanceProp = (props) => props.table !== undefined;
|
@@ -3426,6 +3476,7 @@ exports.MRT_GlobalFilterTextField = MRT_GlobalFilterTextField;
|
|
3426
3476
|
exports.MRT_GrabHandleButton = MRT_GrabHandleButton;
|
3427
3477
|
exports.MRT_LinearProgressBar = MRT_LinearProgressBar;
|
3428
3478
|
exports.MRT_RowActionMenu = MRT_RowActionMenu;
|
3479
|
+
exports.MRT_RowPinButton = MRT_RowPinButton;
|
3429
3480
|
exports.MRT_SelectCheckbox = MRT_SelectCheckbox;
|
3430
3481
|
exports.MRT_ShowHideColumnsButton = MRT_ShowHideColumnsButton;
|
3431
3482
|
exports.MRT_ShowHideColumnsMenu = MRT_ShowHideColumnsMenu;
|
@@ -3437,6 +3488,7 @@ exports.MRT_TableBodyCell = MRT_TableBodyCell;
|
|
3437
3488
|
exports.MRT_TableBodyCellValue = MRT_TableBodyCellValue;
|
3438
3489
|
exports.MRT_TableBodyRow = MRT_TableBodyRow;
|
3439
3490
|
exports.MRT_TableBodyRowGrabHandle = MRT_TableBodyRowGrabHandle;
|
3491
|
+
exports.MRT_TableBodyRowPinButton = MRT_TableBodyRowPinButton;
|
3440
3492
|
exports.MRT_TableContainer = MRT_TableContainer;
|
3441
3493
|
exports.MRT_TableDetailPanel = MRT_TableDetailPanel;
|
3442
3494
|
exports.MRT_TableFooter = MRT_TableFooter;
|
@@ -3486,6 +3538,7 @@ exports.getTotalRight = getTotalRight;
|
|
3486
3538
|
exports.getTrailingDisplayColumnIds = getTrailingDisplayColumnIds;
|
3487
3539
|
exports.mrtFilterOptions = mrtFilterOptions;
|
3488
3540
|
exports.parseCSSVarId = parseCSSVarId;
|
3541
|
+
exports.parseFromValuesOrFunc = parseFromValuesOrFunc;
|
3489
3542
|
exports.prepareColumns = prepareColumns;
|
3490
3543
|
exports.rankGlobalFuzzy = rankGlobalFuzzy;
|
3491
3544
|
exports.reorderColumn = reorderColumn;
|