material-react-table 2.0.0-beta.2 → 2.0.0-beta.4
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 +417 -410
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/body/MRT_TableBody.d.ts +4 -3
- package/dist/cjs/types/body/MRT_TableBodyCell.d.ts +5 -5
- package/dist/cjs/types/body/MRT_TableBodyRowGrabHandle.d.ts +3 -2
- package/dist/cjs/types/body/MRT_TableBodyRowPinButton.d.ts +3 -2
- package/dist/cjs/types/body/MRT_TableDetailPanel.d.ts +3 -2
- package/dist/cjs/types/buttons/MRT_ColumnPinningButtons.d.ts +3 -2
- package/dist/cjs/types/buttons/MRT_CopyButton.d.ts +3 -4
- package/dist/cjs/types/buttons/MRT_EditActionButtons.d.ts +3 -2
- package/dist/cjs/types/buttons/MRT_ExpandAllButton.d.ts +3 -2
- package/dist/cjs/types/buttons/MRT_ExpandButton.d.ts +2 -1
- package/dist/cjs/types/buttons/MRT_GrabHandleButton.d.ts +2 -2
- package/dist/cjs/types/buttons/MRT_RowPinButton.d.ts +3 -2
- package/dist/cjs/types/buttons/MRT_ToggleRowActionMenuButton.d.ts +3 -2
- package/dist/cjs/types/footer/MRT_TableFooter.d.ts +3 -2
- package/dist/cjs/types/footer/MRT_TableFooterCell.d.ts +3 -2
- package/dist/cjs/types/footer/MRT_TableFooterRow.d.ts +3 -2
- package/dist/cjs/types/head/MRT_TableHead.d.ts +3 -2
- package/dist/cjs/types/head/MRT_TableHeadCell.d.ts +3 -2
- package/dist/cjs/types/head/MRT_TableHeadCellColumnActionsButton.d.ts +3 -2
- package/dist/cjs/types/head/MRT_TableHeadCellFilterContainer.d.ts +3 -2
- package/dist/cjs/types/head/MRT_TableHeadCellFilterLabel.d.ts +3 -2
- package/dist/cjs/types/head/MRT_TableHeadCellGrabHandle.d.ts +3 -2
- package/dist/cjs/types/head/MRT_TableHeadCellResizeHandle.d.ts +3 -2
- package/dist/cjs/types/head/MRT_TableHeadCellSortLabel.d.ts +3 -2
- package/dist/cjs/types/head/MRT_TableHeadRow.d.ts +3 -2
- package/dist/cjs/types/inputs/MRT_EditCellTextField.d.ts +3 -2
- package/dist/cjs/types/inputs/MRT_FilterCheckbox.d.ts +3 -2
- package/dist/cjs/types/inputs/MRT_FilterRangeFields.d.ts +3 -2
- package/dist/cjs/types/inputs/MRT_FilterRangeSlider.d.ts +3 -2
- package/dist/cjs/types/inputs/MRT_FilterTextField.d.ts +3 -2
- package/dist/cjs/types/inputs/MRT_GlobalFilterTextField.d.ts +3 -2
- package/dist/cjs/types/inputs/MRT_SelectCheckbox.d.ts +3 -2
- package/dist/cjs/types/menus/MRT_ColumnActionMenu.d.ts +3 -2
- package/dist/cjs/types/menus/MRT_FilterOptionMenu.d.ts +3 -2
- package/dist/cjs/types/menus/MRT_RowActionMenu.d.ts +3 -2
- package/dist/cjs/types/menus/MRT_ShowHideColumnsMenu.d.ts +3 -2
- package/dist/cjs/types/menus/MRT_ShowHideColumnsMenuItems.d.ts +3 -2
- package/dist/cjs/types/modals/MRT_EditRowModal.d.ts +3 -2
- package/dist/cjs/types/table/MRT_Table.d.ts +3 -2
- package/dist/cjs/types/table/MRT_TableContainer.d.ts +3 -2
- package/dist/cjs/types/table/MRT_TableLoadingOverlay.d.ts +7 -0
- package/dist/cjs/types/table/MRT_TablePaper.d.ts +3 -2
- package/dist/cjs/types/table/index.d.ts +1 -0
- package/dist/cjs/types/toolbar/MRT_BottomToolbar.d.ts +3 -2
- package/dist/cjs/types/toolbar/MRT_LinearProgressBar.d.ts +3 -2
- package/dist/cjs/types/toolbar/MRT_TablePagination.d.ts +6 -2
- package/dist/cjs/types/toolbar/MRT_ToolbarAlertBanner.d.ts +3 -2
- package/dist/cjs/types/toolbar/MRT_ToolbarDropZone.d.ts +3 -2
- package/dist/cjs/types/toolbar/MRT_ToolbarInternalButtons.d.ts +3 -2
- package/dist/cjs/types/toolbar/MRT_TopToolbar.d.ts +1 -2
- package/dist/cjs/types/types.d.ts +3 -3
- package/dist/esm/material-react-table.esm.js +415 -408
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/types/body/MRT_TableBody.d.ts +4 -3
- package/dist/esm/types/body/MRT_TableBodyCell.d.ts +5 -5
- package/dist/esm/types/body/MRT_TableBodyRowGrabHandle.d.ts +3 -2
- package/dist/esm/types/body/MRT_TableBodyRowPinButton.d.ts +3 -2
- package/dist/esm/types/body/MRT_TableDetailPanel.d.ts +3 -2
- package/dist/esm/types/buttons/MRT_ColumnPinningButtons.d.ts +3 -2
- package/dist/esm/types/buttons/MRT_CopyButton.d.ts +3 -4
- package/dist/esm/types/buttons/MRT_EditActionButtons.d.ts +3 -2
- package/dist/esm/types/buttons/MRT_ExpandAllButton.d.ts +3 -2
- package/dist/esm/types/buttons/MRT_ExpandButton.d.ts +2 -1
- package/dist/esm/types/buttons/MRT_GrabHandleButton.d.ts +2 -2
- package/dist/esm/types/buttons/MRT_RowPinButton.d.ts +3 -2
- package/dist/esm/types/buttons/MRT_ToggleRowActionMenuButton.d.ts +3 -2
- package/dist/esm/types/footer/MRT_TableFooter.d.ts +3 -2
- package/dist/esm/types/footer/MRT_TableFooterCell.d.ts +3 -2
- package/dist/esm/types/footer/MRT_TableFooterRow.d.ts +3 -2
- package/dist/esm/types/head/MRT_TableHead.d.ts +3 -2
- package/dist/esm/types/head/MRT_TableHeadCell.d.ts +3 -2
- package/dist/esm/types/head/MRT_TableHeadCellColumnActionsButton.d.ts +3 -2
- package/dist/esm/types/head/MRT_TableHeadCellFilterContainer.d.ts +3 -2
- package/dist/esm/types/head/MRT_TableHeadCellFilterLabel.d.ts +3 -2
- package/dist/esm/types/head/MRT_TableHeadCellGrabHandle.d.ts +3 -2
- package/dist/esm/types/head/MRT_TableHeadCellResizeHandle.d.ts +3 -2
- package/dist/esm/types/head/MRT_TableHeadCellSortLabel.d.ts +3 -2
- package/dist/esm/types/head/MRT_TableHeadRow.d.ts +3 -2
- package/dist/esm/types/inputs/MRT_EditCellTextField.d.ts +3 -2
- package/dist/esm/types/inputs/MRT_FilterCheckbox.d.ts +3 -2
- package/dist/esm/types/inputs/MRT_FilterRangeFields.d.ts +3 -2
- package/dist/esm/types/inputs/MRT_FilterRangeSlider.d.ts +3 -2
- package/dist/esm/types/inputs/MRT_FilterTextField.d.ts +3 -2
- package/dist/esm/types/inputs/MRT_GlobalFilterTextField.d.ts +3 -2
- package/dist/esm/types/inputs/MRT_SelectCheckbox.d.ts +3 -2
- package/dist/esm/types/menus/MRT_ColumnActionMenu.d.ts +3 -2
- package/dist/esm/types/menus/MRT_FilterOptionMenu.d.ts +3 -2
- package/dist/esm/types/menus/MRT_RowActionMenu.d.ts +3 -2
- package/dist/esm/types/menus/MRT_ShowHideColumnsMenu.d.ts +3 -2
- package/dist/esm/types/menus/MRT_ShowHideColumnsMenuItems.d.ts +3 -2
- package/dist/esm/types/modals/MRT_EditRowModal.d.ts +3 -2
- package/dist/esm/types/table/MRT_Table.d.ts +3 -2
- package/dist/esm/types/table/MRT_TableContainer.d.ts +3 -2
- package/dist/esm/types/table/MRT_TableLoadingOverlay.d.ts +7 -0
- package/dist/esm/types/table/MRT_TablePaper.d.ts +3 -2
- package/dist/esm/types/table/index.d.ts +1 -0
- package/dist/esm/types/toolbar/MRT_BottomToolbar.d.ts +3 -2
- package/dist/esm/types/toolbar/MRT_LinearProgressBar.d.ts +3 -2
- package/dist/esm/types/toolbar/MRT_TablePagination.d.ts +6 -2
- package/dist/esm/types/toolbar/MRT_ToolbarAlertBanner.d.ts +3 -2
- package/dist/esm/types/toolbar/MRT_ToolbarDropZone.d.ts +3 -2
- package/dist/esm/types/toolbar/MRT_ToolbarInternalButtons.d.ts +3 -2
- package/dist/esm/types/toolbar/MRT_TopToolbar.d.ts +1 -2
- package/dist/esm/types/types.d.ts +3 -3
- package/dist/index.d.ts +130 -119
- package/package.json +1 -1
- package/src/body/MRT_TableBody.tsx +8 -4
- package/src/body/MRT_TableBodyCell.tsx +60 -61
- package/src/body/MRT_TableBodyRow.tsx +3 -3
- package/src/body/MRT_TableBodyRowGrabHandle.tsx +10 -5
- package/src/body/MRT_TableBodyRowPinButton.tsx +12 -5
- package/src/body/MRT_TableDetailPanel.tsx +11 -7
- package/src/buttons/MRT_ColumnPinningButtons.tsx +12 -3
- package/src/buttons/MRT_CopyButton.tsx +6 -8
- package/src/buttons/MRT_EditActionButtons.tsx +9 -3
- package/src/buttons/MRT_ExpandAllButton.tsx +9 -5
- package/src/buttons/MRT_ExpandButton.tsx +2 -2
- package/src/buttons/MRT_GrabHandleButton.tsx +8 -5
- package/src/buttons/MRT_RowPinButton.tsx +8 -4
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +7 -3
- package/src/column.utils.ts +1 -1
- package/src/footer/MRT_TableFooter.tsx +9 -5
- package/src/footer/MRT_TableFooterCell.tsx +12 -12
- package/src/footer/MRT_TableFooterRow.tsx +10 -6
- package/src/head/MRT_TableHead.tsx +8 -4
- package/src/head/MRT_TableHeadCell.tsx +93 -84
- package/src/head/MRT_TableHeadCellColumnActionsButton.tsx +5 -3
- package/src/head/MRT_TableHeadCellFilterContainer.tsx +4 -2
- package/src/head/MRT_TableHeadCellFilterLabel.tsx +8 -4
- package/src/head/MRT_TableHeadCellGrabHandle.tsx +4 -1
- package/src/head/MRT_TableHeadCellResizeHandle.tsx +7 -4
- package/src/head/MRT_TableHeadCellSortLabel.tsx +28 -12
- package/src/head/MRT_TableHeadRow.tsx +10 -6
- package/src/hooks/useMRT_DisplayColumns.tsx +2 -1
- package/src/inputs/MRT_EditCellTextField.tsx +16 -2
- package/src/inputs/MRT_FilterCheckbox.tsx +4 -2
- package/src/inputs/MRT_FilterRangeFields.tsx +13 -3
- package/src/inputs/MRT_FilterRangeSlider.tsx +4 -2
- package/src/inputs/MRT_FilterTextField.tsx +3 -1
- package/src/inputs/MRT_GlobalFilterTextField.tsx +9 -5
- package/src/inputs/MRT_SelectCheckbox.tsx +8 -4
- package/src/menus/MRT_ColumnActionMenu.tsx +4 -2
- package/src/menus/MRT_FilterOptionMenu.tsx +4 -2
- package/src/menus/MRT_RowActionMenu.tsx +4 -2
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +4 -2
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +6 -3
- package/src/modals/MRT_EditRowModal.tsx +5 -3
- package/src/table/MRT_Table.tsx +25 -31
- package/src/table/MRT_TableContainer.tsx +15 -44
- package/src/table/MRT_TableLoadingOverlay.tsx +53 -0
- package/src/table/MRT_TablePaper.tsx +7 -3
- package/src/table/index.ts +1 -0
- package/src/toolbar/MRT_BottomToolbar.tsx +9 -7
- package/src/toolbar/MRT_LinearProgressBar.tsx +14 -8
- package/src/toolbar/MRT_TablePagination.tsx +18 -8
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +9 -5
- package/src/toolbar/MRT_ToolbarDropZone.tsx +6 -2
- package/src/toolbar/MRT_ToolbarInternalButtons.tsx +8 -4
- package/src/toolbar/MRT_TopToolbar.tsx +5 -8
- package/src/types.ts +5 -5
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import Paper from '@mui/material/Paper';
|
|
3
3
|
import { useState, memo, useEffect, useMemo, useRef, useCallback, Fragment as Fragment$1, useLayoutEffect, useReducer } from 'react';
|
|
4
|
-
import Box from '@mui/material/Box';
|
|
5
|
-
import CircularProgress from '@mui/material/CircularProgress';
|
|
6
4
|
import TableContainer from '@mui/material/TableContainer';
|
|
7
|
-
import { darken, lighten, alpha, useTheme } from '@mui/material/styles';
|
|
8
5
|
import { defaultRangeExtractor, useVirtualizer } from '@tanstack/react-virtual';
|
|
9
6
|
import Table from '@mui/material/Table';
|
|
10
7
|
import TableBody from '@mui/material/TableBody';
|
|
11
8
|
import Typography from '@mui/material/Typography';
|
|
12
9
|
import TableRow from '@mui/material/TableRow';
|
|
10
|
+
import { darken, lighten, alpha, useTheme } from '@mui/material/styles';
|
|
13
11
|
import Skeleton from '@mui/material/Skeleton';
|
|
14
12
|
import TableCell from '@mui/material/TableCell';
|
|
13
|
+
import Box from '@mui/material/Box';
|
|
15
14
|
import highlightWords from 'highlight-words';
|
|
16
15
|
import IconButton from '@mui/material/IconButton';
|
|
17
16
|
import Tooltip from '@mui/material/Tooltip';
|
|
@@ -40,7 +39,6 @@ import Popover from '@mui/material/Popover';
|
|
|
40
39
|
import Divider from '@mui/material/Divider';
|
|
41
40
|
import Badge from '@mui/material/Badge';
|
|
42
41
|
import TableSortLabel from '@mui/material/TableSortLabel';
|
|
43
|
-
import Toolbar from '@mui/material/Toolbar';
|
|
44
42
|
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
45
43
|
import LinearProgress from '@mui/material/LinearProgress';
|
|
46
44
|
import InputLabel from '@mui/material/InputLabel';
|
|
@@ -52,6 +50,7 @@ import AlertTitle from '@mui/material/AlertTitle';
|
|
|
52
50
|
import Radio from '@mui/material/Radio';
|
|
53
51
|
import Fade from '@mui/material/Fade';
|
|
54
52
|
import Switch from '@mui/material/Switch';
|
|
53
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
|
55
54
|
import Dialog from '@mui/material/Dialog';
|
|
56
55
|
import DialogActions from '@mui/material/DialogActions';
|
|
57
56
|
import DialogContent from '@mui/material/DialogContent';
|
|
@@ -90,6 +89,33 @@ import SyncAltIcon from '@mui/icons-material/SyncAlt';
|
|
|
90
89
|
import ViewColumnIcon from '@mui/icons-material/ViewColumn';
|
|
91
90
|
import VisibilityOffIcon from '@mui/icons-material/VisibilityOff';
|
|
92
91
|
|
|
92
|
+
/******************************************************************************
|
|
93
|
+
Copyright (c) Microsoft Corporation.
|
|
94
|
+
|
|
95
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
96
|
+
purpose with or without fee is hereby granted.
|
|
97
|
+
|
|
98
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
99
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
100
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
101
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
102
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
103
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
104
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
105
|
+
***************************************************************************** */
|
|
106
|
+
function __rest(s, e) {
|
|
107
|
+
var t = {};
|
|
108
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
109
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
110
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
111
|
+
}
|
|
112
|
+
return t;
|
|
113
|
+
}
|
|
114
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
115
|
+
var e = new Error(message);
|
|
116
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
117
|
+
};
|
|
118
|
+
|
|
93
119
|
const allowedTypes = ['string', 'number'];
|
|
94
120
|
const MRT_TableBodyCellValue = ({ cell, table, }) => {
|
|
95
121
|
var _a, _b, _c;
|
|
@@ -250,7 +276,6 @@ const getLeadingDisplayColumnIds = (props) => {
|
|
|
250
276
|
'mrt-row-expand',
|
|
251
277
|
props.enableRowSelection && 'mrt-row-select',
|
|
252
278
|
props.enableRowNumbers && 'mrt-row-numbers',
|
|
253
|
-
props.layoutMode === 'grid-no-grow' && 'mrt-row-spacer',
|
|
254
279
|
].filter(Boolean);
|
|
255
280
|
};
|
|
256
281
|
const getTrailingDisplayColumnIds = (props) => {
|
|
@@ -264,6 +289,7 @@ const getTrailingDisplayColumnIds = (props) => {
|
|
|
264
289
|
props.positionExpandColumn === 'last' &&
|
|
265
290
|
showExpandColumn(props) &&
|
|
266
291
|
'mrt-row-expand',
|
|
292
|
+
props.layoutMode === 'grid-no-grow' && 'mrt-row-spacer',
|
|
267
293
|
].filter(Boolean);
|
|
268
294
|
};
|
|
269
295
|
const getDefaultColumnOrderIds = (props) => {
|
|
@@ -417,27 +443,30 @@ function createMRTColumnHelper() {
|
|
|
417
443
|
};
|
|
418
444
|
}
|
|
419
445
|
|
|
420
|
-
const MRT_GrabHandleButton = (
|
|
421
|
-
var
|
|
446
|
+
const MRT_GrabHandleButton = (_a) => {
|
|
447
|
+
var _b;
|
|
448
|
+
var { iconButtonProps, location, onDragEnd, onDragStart, table } = _a, rest = __rest(_a, ["iconButtonProps", "location", "onDragEnd", "onDragStart", "table"]);
|
|
422
449
|
const { options: { icons: { DragHandleIcon }, localization, }, } = table;
|
|
423
|
-
|
|
450
|
+
const _iconButtonProps = Object.assign(Object.assign({}, iconButtonProps), rest);
|
|
451
|
+
return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_b = _iconButtonProps === null || _iconButtonProps === void 0 ? void 0 : _iconButtonProps.title) !== null && _b !== void 0 ? _b : localization.move, children: jsx(IconButton, Object.assign({ disableRipple: true, draggable: "true", size: "small" }, _iconButtonProps, { onClick: (e) => {
|
|
424
452
|
var _a;
|
|
425
453
|
e.stopPropagation();
|
|
426
|
-
(_a =
|
|
454
|
+
(_a = _iconButtonProps === null || _iconButtonProps === void 0 ? void 0 : _iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(_iconButtonProps, e);
|
|
427
455
|
}, onDragEnd: onDragEnd, onDragStart: onDragStart, sx: (theme) => (Object.assign({ '&:active': {
|
|
428
456
|
cursor: 'grabbing',
|
|
429
457
|
}, '&:hover': {
|
|
430
458
|
backgroundColor: 'transparent',
|
|
431
459
|
opacity: 1,
|
|
432
|
-
}, cursor: 'grab', m: '0 -0.1rem', opacity: location === 'row' ? 1 : 0.3, p: '2px', transition: 'all 150ms ease-in-out' }, parseFromValuesOrFunc(
|
|
460
|
+
}, cursor: 'grab', m: '0 -0.1rem', opacity: location === 'row' ? 1 : 0.3, p: '2px', transition: 'all 150ms ease-in-out' }, parseFromValuesOrFunc(_iconButtonProps === null || _iconButtonProps === void 0 ? void 0 : _iconButtonProps.sx, theme))), title: undefined, children: jsx(DragHandleIcon, {}) })) }));
|
|
433
461
|
};
|
|
434
462
|
|
|
435
|
-
const MRT_TableBodyRowGrabHandle = (
|
|
463
|
+
const MRT_TableBodyRowGrabHandle = (_a) => {
|
|
464
|
+
var { row, rowRef, table } = _a, rest = __rest(_a, ["row", "rowRef", "table"]);
|
|
436
465
|
const { options: { muiRowDragHandleProps }, } = table;
|
|
437
|
-
const iconButtonProps = parseFromValuesOrFunc(muiRowDragHandleProps, {
|
|
466
|
+
const iconButtonProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiRowDragHandleProps, {
|
|
438
467
|
row,
|
|
439
468
|
table,
|
|
440
|
-
});
|
|
469
|
+
})), rest);
|
|
441
470
|
const handleDragStart = (event) => {
|
|
442
471
|
var _a;
|
|
443
472
|
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
|
@@ -453,8 +482,9 @@ const MRT_TableBodyRowGrabHandle = ({ row, rowRef, table, }) => {
|
|
|
453
482
|
return (jsx(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, location: "row", onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table }));
|
|
454
483
|
};
|
|
455
484
|
|
|
456
|
-
const MRT_CopyButton = (
|
|
457
|
-
var
|
|
485
|
+
const MRT_CopyButton = (_a) => {
|
|
486
|
+
var _b;
|
|
487
|
+
var { cell, table } = _a, rest = __rest(_a, ["cell", "table"]);
|
|
458
488
|
const { options: { localization, muiCopyButtonProps }, } = table;
|
|
459
489
|
const { column, row } = cell;
|
|
460
490
|
const { columnDef } = column;
|
|
@@ -465,7 +495,7 @@ const MRT_CopyButton = ({ cell, children, table, }) => {
|
|
|
465
495
|
setCopied(true);
|
|
466
496
|
setTimeout(() => setCopied(false), 4000);
|
|
467
497
|
};
|
|
468
|
-
const buttonProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiCopyButtonProps, {
|
|
498
|
+
const buttonProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiCopyButtonProps, {
|
|
469
499
|
cell,
|
|
470
500
|
column,
|
|
471
501
|
row,
|
|
@@ -475,12 +505,13 @@ const MRT_CopyButton = ({ cell, children, table, }) => {
|
|
|
475
505
|
column,
|
|
476
506
|
row,
|
|
477
507
|
table,
|
|
478
|
-
}));
|
|
479
|
-
return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (
|
|
508
|
+
})), rest);
|
|
509
|
+
return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_b = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.title) !== null && _b !== void 0 ? _b : (copied ? localization.copiedToClipboard : localization.clickToCopy), children: jsx(Button, Object.assign({ onClick: (e) => handleCopy(e, cell.getValue()), size: "small", type: "button", variant: "text" }, buttonProps, { sx: (theme) => (Object.assign({ backgroundColor: 'transparent', border: 'none', color: 'inherit', cursor: 'copy', fontFamily: 'inherit', fontSize: 'inherit', letterSpacing: 'inherit', m: '-0.25rem', minWidth: 'unset', textAlign: 'inherit', textTransform: 'inherit' }, parseFromValuesOrFunc(buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx, theme))), title: undefined })) }));
|
|
480
510
|
};
|
|
481
511
|
|
|
482
|
-
const MRT_EditCellTextField = (
|
|
483
|
-
var
|
|
512
|
+
const MRT_EditCellTextField = (_a) => {
|
|
513
|
+
var _b, _c, _d, _e;
|
|
514
|
+
var { cell, table } = _a, rest = __rest(_a, ["cell", "table"]);
|
|
484
515
|
const { getState, options: { createDisplayMode, editDisplayMode, muiEditTextFieldProps }, refs: { editInputRefs }, setCreatingRow, setEditingCell, setEditingRow, } = table;
|
|
485
516
|
const { column, row } = cell;
|
|
486
517
|
const { columnDef } = column;
|
|
@@ -489,7 +520,7 @@ const MRT_EditCellTextField = ({ cell, table, }) => {
|
|
|
489
520
|
const isEditing = (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) === row.id;
|
|
490
521
|
const isSelectEdit = columnDef.editVariant === 'select';
|
|
491
522
|
const [value, setValue] = useState(() => cell.getValue());
|
|
492
|
-
const textFieldProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditTextFieldProps, {
|
|
523
|
+
const textFieldProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditTextFieldProps, {
|
|
493
524
|
cell,
|
|
494
525
|
column,
|
|
495
526
|
row,
|
|
@@ -499,7 +530,7 @@ const MRT_EditCellTextField = ({ cell, table, }) => {
|
|
|
499
530
|
column,
|
|
500
531
|
row,
|
|
501
532
|
table,
|
|
502
|
-
}));
|
|
533
|
+
})), rest);
|
|
503
534
|
const saveInputValueToRowCache = (newValue) => {
|
|
504
535
|
//@ts-ignore
|
|
505
536
|
row._valuesCache[column.id] = newValue;
|
|
@@ -532,7 +563,7 @@ const MRT_EditCellTextField = ({ cell, table, }) => {
|
|
|
532
563
|
}
|
|
533
564
|
};
|
|
534
565
|
if (columnDef.Edit) {
|
|
535
|
-
return jsx(Fragment, { children: (
|
|
566
|
+
return jsx(Fragment, { children: (_b = columnDef.Edit) === null || _b === void 0 ? void 0 : _b.call(columnDef, { cell, column, row, table }) });
|
|
536
567
|
}
|
|
537
568
|
return (jsx(TextField, Object.assign({ disabled: parseFromValuesOrFunc(columnDef.enableEditing, row) === false, fullWidth: true, inputRef: (inputRef) => {
|
|
538
569
|
if (inputRef) {
|
|
@@ -541,15 +572,18 @@ const MRT_EditCellTextField = ({ cell, table, }) => {
|
|
|
541
572
|
textFieldProps.inputRef = inputRef;
|
|
542
573
|
}
|
|
543
574
|
}
|
|
544
|
-
}, label:
|
|
575
|
+
}, label: ['custom', 'modal'].includes((isCreating ? createDisplayMode : editDisplayMode))
|
|
545
576
|
? columnDef.header
|
|
546
577
|
: undefined, margin: "none", name: column.id, placeholder: !['custom', 'modal'].includes((isCreating ? createDisplayMode : editDisplayMode))
|
|
547
578
|
? columnDef.header
|
|
548
|
-
: undefined, select: isSelectEdit, value: value, variant: "standard" }, textFieldProps, { InputProps: Object.assign({ disableUnderline: editDisplayMode === 'table' }, textFieldProps.InputProps),
|
|
579
|
+
: undefined, select: isSelectEdit, size: "small", value: value, variant: "standard" }, textFieldProps, { InputProps: Object.assign(Object.assign({ disableUnderline: editDisplayMode === 'table' }, textFieldProps.InputProps), { sx: (theme) => {
|
|
580
|
+
var _a;
|
|
581
|
+
return (Object.assign({ mb: 0 }, parseFromValuesOrFunc((_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.InputProps) === null || _a === void 0 ? void 0 : _a.sx, theme)));
|
|
582
|
+
} }), inputProps: Object.assign({ autoComplete: 'new-password', sx: Object.assign({ p: 0 }, (_c = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.inputProps) === null || _c === void 0 ? void 0 : _c.sx) }, textFieldProps.inputProps), onBlur: handleBlur, onChange: handleChange, onClick: (e) => {
|
|
549
583
|
var _a;
|
|
550
584
|
e.stopPropagation();
|
|
551
585
|
(_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.onClick) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, e);
|
|
552
|
-
}, onKeyDown: handleEnterKeyDown, children: (
|
|
586
|
+
}, onKeyDown: handleEnterKeyDown, children: (_d = textFieldProps.children) !== null && _d !== void 0 ? _d : (_e = columnDef === null || columnDef === void 0 ? void 0 : columnDef.editSelectOptions) === null || _e === void 0 ? void 0 : _e.map((option) => {
|
|
553
587
|
let value;
|
|
554
588
|
let text;
|
|
555
589
|
if (typeof option !== 'object') {
|
|
@@ -569,25 +603,17 @@ const MRT_EditCellTextField = ({ cell, table, }) => {
|
|
|
569
603
|
}) })));
|
|
570
604
|
};
|
|
571
605
|
|
|
572
|
-
const MRT_TableBodyCell = (
|
|
573
|
-
var
|
|
606
|
+
const MRT_TableBodyCell = (_a) => {
|
|
607
|
+
var _b, _c, _d, _e, _f;
|
|
608
|
+
var { cell, measureElement, numRows, rowIndex, rowRef, table, virtualIndex } = _a, rest = __rest(_a, ["cell", "measureElement", "numRows", "rowIndex", "rowRef", "table", "virtualIndex"]);
|
|
574
609
|
const theme = useTheme();
|
|
575
610
|
const { getState, options: { createDisplayMode, editDisplayMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping, enableRowNumbers, layoutMode, muiSkeletonProps, muiTableBodyCellProps, rowNumberMode, }, refs: { editInputRefs }, setEditingCell, setHoveredColumn, } = table;
|
|
576
611
|
const { columnSizingInfo, creatingRow, density, draggingColumn, draggingRow, editingCell, editingRow, hoveredColumn, hoveredRow, isLoading, showSkeletons, } = getState();
|
|
577
612
|
const { column, row } = cell;
|
|
578
613
|
const { columnDef } = column;
|
|
579
614
|
const { columnDefType } = columnDef;
|
|
580
|
-
const
|
|
581
|
-
|
|
582
|
-
column,
|
|
583
|
-
row,
|
|
584
|
-
table,
|
|
585
|
-
})), parseFromValuesOrFunc(columnDef.muiTableBodyCellProps, {
|
|
586
|
-
cell,
|
|
587
|
-
column,
|
|
588
|
-
row,
|
|
589
|
-
table,
|
|
590
|
-
}));
|
|
615
|
+
const args = { cell, column, row, table };
|
|
616
|
+
const tableCellProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableBodyCellProps, args)), parseFromValuesOrFunc(columnDef.muiTableBodyCellProps, args)), rest);
|
|
591
617
|
const skeletonProps = parseFromValuesOrFunc(muiSkeletonProps, {
|
|
592
618
|
cell,
|
|
593
619
|
column,
|
|
@@ -683,12 +709,12 @@ const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, ta
|
|
|
683
709
|
setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
|
684
710
|
}
|
|
685
711
|
};
|
|
686
|
-
return (jsx(TableCell, Object.assign({ "data-index":
|
|
712
|
+
return (jsx(TableCell, Object.assign({ "data-index": virtualIndex, ref: (node) => {
|
|
687
713
|
if (node) {
|
|
688
714
|
measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
|
|
689
715
|
}
|
|
690
716
|
} }, tableCellProps, { onDoubleClick: handleDoubleClick, onDragEnter: handleDragEnter, sx: (theme) => (Object.assign(Object.assign({ '&:hover': {
|
|
691
|
-
outline: ['cell', 'table'].includes(editDisplayMode !== null && editDisplayMode !== void 0 ? editDisplayMode : '')
|
|
717
|
+
outline: ['cell', 'table'].includes(editDisplayMode !== null && editDisplayMode !== void 0 ? editDisplayMode : '') && isEditable
|
|
692
718
|
? `1px solid ${theme.palette.text.secondary}`
|
|
693
719
|
: undefined,
|
|
694
720
|
outlineOffset: '-1px',
|
|
@@ -717,23 +743,24 @@ const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, ta
|
|
|
717
743
|
table,
|
|
718
744
|
tableCellProps,
|
|
719
745
|
theme,
|
|
720
|
-
})), draggingBorders)), children: jsxs(Fragment, { children: [cell.getIsPlaceholder() ? ((
|
|
746
|
+
})), draggingBorders)), children: (_b = tableCellProps.children) !== null && _b !== void 0 ? _b : (jsxs(Fragment, { children: [cell.getIsPlaceholder() ? ((_d = (_c = columnDef.PlaceholderCell) === null || _c === void 0 ? void 0 : _c.call(columnDef, { cell, column, row, table })) !== null && _d !== void 0 ? _d : null) : showSkeletons !== false && (isLoading || showSkeletons) ? (jsx(Skeleton, Object.assign({ animation: "wave", height: 20, width: skeletonWidth }, skeletonProps))) : enableRowNumbers &&
|
|
721
747
|
rowNumberMode === 'static' &&
|
|
722
748
|
column.id === 'mrt-row-numbers' ? (rowIndex + 1) : column.id === 'mrt-row-drag' ? (jsx(MRT_TableBodyRowGrabHandle, { row: row, rowRef: rowRef, table: table })) : columnDefType === 'display' &&
|
|
723
749
|
(column.id === 'mrt-row-select' ||
|
|
724
750
|
column.id === 'mrt-row-expand' ||
|
|
725
|
-
!row.getIsGrouped()) ? ((
|
|
751
|
+
!row.getIsGrouped()) ? ((_e = columnDef.Cell) === null || _e === void 0 ? void 0 : _e.call(columnDef, {
|
|
726
752
|
cell,
|
|
727
753
|
column,
|
|
728
754
|
renderedCellValue: cell.renderValue(),
|
|
729
755
|
row,
|
|
730
756
|
table,
|
|
731
757
|
})) : isCreating || isEditing ? (jsx(MRT_EditCellTextField, { cell: cell, table: table })) : (enableClickToCopy || columnDef.enableClickToCopy) &&
|
|
732
|
-
columnDef.enableClickToCopy !== false ? (jsx(MRT_CopyButton, { cell: cell, table: table, children: jsx(MRT_TableBodyCellValue, { cell: cell, table: table }) })) : (jsx(MRT_TableBodyCellValue, { cell: cell, table: table })), cell.getIsGrouped() && !columnDef.GroupedCell && (jsxs(Fragment, { children: [" (", (
|
|
758
|
+
columnDef.enableClickToCopy !== false ? (jsx(MRT_CopyButton, { cell: cell, table: table, children: jsx(MRT_TableBodyCellValue, { cell: cell, table: table }) })) : (jsx(MRT_TableBodyCellValue, { cell: cell, table: table })), cell.getIsGrouped() && !columnDef.GroupedCell && (jsxs(Fragment, { children: [" (", (_f = row.subRows) === null || _f === void 0 ? void 0 : _f.length, ")"] }))] })) })));
|
|
733
759
|
};
|
|
734
760
|
const Memo_MRT_TableBodyCell = memo(MRT_TableBodyCell, (prev, next) => next.cell === prev.cell);
|
|
735
761
|
|
|
736
|
-
const MRT_TableDetailPanel = (
|
|
762
|
+
const MRT_TableDetailPanel = (_a) => {
|
|
763
|
+
var { parentRowRef, row, rowIndex, table, virtualRow } = _a, rest = __rest(_a, ["parentRowRef", "row", "rowIndex", "table", "virtualRow"]);
|
|
737
764
|
const { getState, getVisibleLeafColumns, options: { layoutMode, muiDetailPanelProps, muiTableBodyRowProps, renderDetailPanel, }, } = table;
|
|
738
765
|
const { isLoading } = getState();
|
|
739
766
|
const tableRowProps = parseFromValuesOrFunc(muiTableBodyRowProps, {
|
|
@@ -742,10 +769,10 @@ const MRT_TableDetailPanel = ({ parentRowRef, row, rowIndex, table, virtualRow,
|
|
|
742
769
|
staticRowIndex: rowIndex,
|
|
743
770
|
table,
|
|
744
771
|
});
|
|
745
|
-
const tableCellProps = parseFromValuesOrFunc(muiDetailPanelProps, {
|
|
772
|
+
const tableCellProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiDetailPanelProps, {
|
|
746
773
|
row,
|
|
747
774
|
table,
|
|
748
|
-
});
|
|
775
|
+
})), rest);
|
|
749
776
|
return (jsx(TableRow, Object.assign({ className: "Mui-TableBodyCell-DetailPanel" }, tableRowProps, { sx: (theme) => {
|
|
750
777
|
var _a, _b;
|
|
751
778
|
return (Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, position: virtualRow ? 'absolute' : undefined, top: virtualRow
|
|
@@ -755,7 +782,7 @@ const MRT_TableDetailPanel = ({ parentRowRef, row, rowIndex, table, virtualRow,
|
|
|
755
782
|
: undefined, width: '100%', zIndex: virtualRow ? 2 : undefined }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme)));
|
|
756
783
|
}, children: jsx(TableCell, Object.assign({ className: "Mui-TableBodyCell-DetailPanel", colSpan: getVisibleLeafColumns().length }, tableCellProps, { sx: (theme) => (Object.assign({ backgroundColor: virtualRow
|
|
757
784
|
? lighten(theme.palette.background.default, 0.05)
|
|
758
|
-
: undefined, borderBottom: !row.getIsExpanded() ? 'none' : undefined, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' :
|
|
785
|
+
: undefined, borderBottom: !row.getIsExpanded() ? 'none' : undefined, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, py: row.getIsExpanded() ? '1rem' : 0, transition: 'all 150ms ease-in-out', width: `${table.getTotalSize()}px` }, parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme))), children: renderDetailPanel && (jsx(Collapse, { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true, children: !isLoading && renderDetailPanel({ row, table }) })) })) })));
|
|
759
786
|
};
|
|
760
787
|
|
|
761
788
|
const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRowIds, row, rowIndex, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, virtualRow, }) => {
|
|
@@ -814,7 +841,7 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRo
|
|
|
814
841
|
? `${bottomPinnedIndex * rowHeight +
|
|
815
842
|
(enableStickyFooter ? tableFooterHeight - 1 : 0)}px`
|
|
816
843
|
: undefined, boxSizing: 'border-box', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, opacity: isPinned
|
|
817
|
-
? 0.
|
|
844
|
+
? 0.97
|
|
818
845
|
: (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id || (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id
|
|
819
846
|
? 0.5
|
|
820
847
|
: 1, position: virtualRow
|
|
@@ -845,8 +872,8 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, pinnedRo
|
|
|
845
872
|
rowIndex,
|
|
846
873
|
rowRef,
|
|
847
874
|
table,
|
|
848
|
-
|
|
849
|
-
? cellOrVirtualCell
|
|
875
|
+
virtualIndex: columnVirtualizer
|
|
876
|
+
? cellOrVirtualCell.index
|
|
850
877
|
: undefined,
|
|
851
878
|
};
|
|
852
879
|
return cell ? (memoMode === 'cells' &&
|
|
@@ -873,18 +900,19 @@ const MRT_SortingFns = Object.assign(Object.assign({}, sortingFns), { fuzzy: fuz
|
|
|
873
900
|
const rankGlobalFuzzy = (rowA, rowB) => Math.max(...Object.values(rowB.columnFiltersMeta).map((v) => v.rank)) -
|
|
874
901
|
Math.max(...Object.values(rowA.columnFiltersMeta).map((v) => v.rank));
|
|
875
902
|
|
|
876
|
-
const MRT_TableBody = (
|
|
877
|
-
var
|
|
903
|
+
const MRT_TableBody = (_a) => {
|
|
904
|
+
var _b, _c, _d, _e, _f, _g;
|
|
905
|
+
var { columnVirtualizer, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight } = _a, rest = __rest(_a, ["columnVirtualizer", "table", "virtualColumns", "virtualPaddingLeft", "virtualPaddingRight"]);
|
|
878
906
|
const { getBottomRows, getCenterRows, getIsSomeRowsPinned, getPrePaginationRowModel, getRowModel, getState, getTopRows, options: { createDisplayMode, enableGlobalFilterRankedResults, enablePagination, enableRowPinning, enableRowVirtualization, enableStickyFooter, enableStickyHeader, layoutMode, localization, manualExpanding, manualFiltering, manualGrouping, manualPagination, manualSorting, memoMode, muiTableBodyProps, renderEmptyRowsFallback, rowPinningDisplayMode, rowVirtualizerInstanceRef, rowVirtualizerOptions, }, refs: { tableContainerRef, tableFooterRef, tableHeadRef, tablePaperRef }, } = table;
|
|
879
907
|
const { columnFilters, creatingRow, density, draggingRow, expanded, globalFilter, isFullScreen, pagination, rowPinning, sorting, } = getState();
|
|
880
|
-
const tableBodyProps = parseFromValuesOrFunc(muiTableBodyProps, { table });
|
|
908
|
+
const tableBodyProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableBodyProps, { table })), rest);
|
|
881
909
|
const rowVirtualizerProps = parseFromValuesOrFunc(rowVirtualizerOptions, {
|
|
882
910
|
table,
|
|
883
911
|
});
|
|
884
912
|
const tableHeadHeight = ((enableStickyHeader || isFullScreen) &&
|
|
885
|
-
((
|
|
913
|
+
((_b = tableHeadRef.current) === null || _b === void 0 ? void 0 : _b.clientHeight)) ||
|
|
886
914
|
0;
|
|
887
|
-
const tableFooterHeight = (enableStickyFooter && ((
|
|
915
|
+
const tableFooterHeight = (enableStickyFooter && ((_c = tableFooterRef.current) === null || _c === void 0 ? void 0 : _c.clientHeight)) || 0;
|
|
888
916
|
const shouldRankRows = useMemo(() => getCanRankRows(table) &&
|
|
889
917
|
!Object.values(sorting).some(Boolean) &&
|
|
890
918
|
globalFilter, [
|
|
@@ -961,16 +989,16 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
|
|
|
961
989
|
return memoMode === 'rows' ? (jsx(Memo_MRT_TableBodyRow, Object.assign({}, props), row.id)) : (jsx(MRT_TableBodyRow, Object.assign({}, props), row.id));
|
|
962
990
|
}) }))), jsxs(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, height: rowVirtualizer
|
|
963
991
|
? `${rowVirtualizer.getTotalSize()}px`
|
|
964
|
-
: 'inherit', minHeight: !rows.length ? '100px' : undefined, position: 'relative' }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: [creatingRow && createDisplayMode === 'row' && (jsx(MRT_TableBodyRow, { row: creatingRow, rowIndex: -1, table: table })), (
|
|
992
|
+
: 'inherit', minHeight: !rows.length ? '100px' : undefined, position: 'relative' }, parseFromValuesOrFunc(tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx, theme))), children: [creatingRow && createDisplayMode === 'row' && (jsx(MRT_TableBodyRow, { row: creatingRow, rowIndex: -1, table: table })), (_d = tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.children) !== null && _d !== void 0 ? _d : (!rows.length ? (jsx("tr", { style: {
|
|
965
993
|
display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined,
|
|
966
994
|
}, children: jsx("td", { colSpan: table.getVisibleLeafColumns().length, style: {
|
|
967
995
|
display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid'))
|
|
968
996
|
? 'grid'
|
|
969
|
-
:
|
|
970
|
-
}, children: (
|
|
997
|
+
: undefined,
|
|
998
|
+
}, children: (_e = renderEmptyRowsFallback === null || renderEmptyRowsFallback === void 0 ? void 0 : renderEmptyRowsFallback({ table })) !== null && _e !== void 0 ? _e : (jsx(Typography, { sx: {
|
|
971
999
|
color: 'text.secondary',
|
|
972
1000
|
fontStyle: 'italic',
|
|
973
|
-
maxWidth: `min(100vw, ${(
|
|
1001
|
+
maxWidth: `min(100vw, ${(_g = (_f = tablePaperRef.current) === null || _f === void 0 ? void 0 : _f.clientWidth) !== null && _g !== void 0 ? _g : 360}px)`,
|
|
974
1002
|
py: '2rem',
|
|
975
1003
|
textAlign: 'center',
|
|
976
1004
|
width: '100%',
|
|
@@ -1014,18 +1042,17 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
|
|
|
1014
1042
|
};
|
|
1015
1043
|
const Memo_MRT_TableBody = memo(MRT_TableBody, (prev, next) => prev.table.options.data === next.table.options.data);
|
|
1016
1044
|
|
|
1017
|
-
const MRT_TableFooterCell = (
|
|
1018
|
-
var
|
|
1045
|
+
const MRT_TableFooterCell = (_a) => {
|
|
1046
|
+
var _b, _c, _d;
|
|
1047
|
+
var { footer, table } = _a, rest = __rest(_a, ["footer", "table"]);
|
|
1019
1048
|
const { getState, options: { layoutMode, muiTableFooterCellProps }, } = table;
|
|
1020
1049
|
const { density } = getState();
|
|
1021
1050
|
const { column } = footer;
|
|
1022
1051
|
const { columnDef } = column;
|
|
1023
1052
|
const { columnDefType } = columnDef;
|
|
1024
|
-
const
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
}));
|
|
1028
|
-
return (jsx(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: footer.colSpan, variant: "head" }, tableCellProps, { sx: (theme) => (Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : 'table-cell', fontWeight: 'bold', justifyContent: columnDefType === 'group' ? 'center' : undefined, p: density === 'compact'
|
|
1053
|
+
const args = { column, table };
|
|
1054
|
+
const tableCellProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterCellProps, args)), parseFromValuesOrFunc(columnDef.muiTableFooterCellProps, args)), rest);
|
|
1055
|
+
return (jsx(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: footer.colSpan, variant: "head" }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined, fontWeight: 'bold', justifyContent: columnDefType === 'group' ? 'center' : undefined, p: density === 'compact'
|
|
1029
1056
|
? '0.5rem'
|
|
1030
1057
|
: density === 'comfortable'
|
|
1031
1058
|
? '1rem'
|
|
@@ -1034,27 +1061,28 @@ const MRT_TableFooterCell = ({ footer, table, }) => {
|
|
|
1034
1061
|
table,
|
|
1035
1062
|
tableCellProps,
|
|
1036
1063
|
theme,
|
|
1037
|
-
}))), children:
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1064
|
+
})), parseFromValuesOrFunc(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx, theme))), children: (_b = tableCellProps.children) !== null && _b !== void 0 ? _b : (footer.isPlaceholder
|
|
1065
|
+
? null
|
|
1066
|
+
: (_d = (_c = parseFromValuesOrFunc(columnDef.Footer, {
|
|
1067
|
+
column,
|
|
1068
|
+
footer,
|
|
1069
|
+
table,
|
|
1070
|
+
})) !== null && _c !== void 0 ? _c : columnDef.footer) !== null && _d !== void 0 ? _d : null) })));
|
|
1044
1071
|
};
|
|
1045
1072
|
|
|
1046
|
-
const MRT_TableFooterRow = (
|
|
1047
|
-
var
|
|
1073
|
+
const MRT_TableFooterRow = (_a) => {
|
|
1074
|
+
var _b;
|
|
1075
|
+
var { footerGroup, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight } = _a, rest = __rest(_a, ["footerGroup", "table", "virtualColumns", "virtualPaddingLeft", "virtualPaddingRight"]);
|
|
1048
1076
|
const { options: { layoutMode, muiTableFooterRowProps }, } = table;
|
|
1049
1077
|
// if no content in row, skip row
|
|
1050
|
-
if (!((
|
|
1078
|
+
if (!((_b = footerGroup.headers) === null || _b === void 0 ? void 0 : _b.some((header) => (typeof header.column.columnDef.footer === 'string' &&
|
|
1051
1079
|
!!header.column.columnDef.footer) ||
|
|
1052
1080
|
header.column.columnDef.Footer)))
|
|
1053
1081
|
return null;
|
|
1054
|
-
const tableRowProps = parseFromValuesOrFunc(muiTableFooterRowProps, {
|
|
1082
|
+
const tableRowProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterRowProps, {
|
|
1055
1083
|
footerGroup,
|
|
1056
1084
|
table,
|
|
1057
|
-
});
|
|
1085
|
+
})), rest);
|
|
1058
1086
|
return (jsxs(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.05), display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, width: '100%' }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme))), children: [virtualPaddingLeft ? (jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : footerGroup.headers).map((footerOrVirtualFooter) => {
|
|
1059
1087
|
const footer = virtualColumns
|
|
1060
1088
|
? footerGroup.headers[footerOrVirtualFooter.index]
|
|
@@ -1063,12 +1091,13 @@ const MRT_TableFooterRow = ({ footerGroup, table, virtualColumns, virtualPadding
|
|
|
1063
1091
|
}), virtualPaddingRight ? (jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
|
|
1064
1092
|
};
|
|
1065
1093
|
|
|
1066
|
-
const MRT_TableFooter = (
|
|
1094
|
+
const MRT_TableFooter = (_a) => {
|
|
1095
|
+
var { table, virtualColumns, virtualPaddingLeft, virtualPaddingRight } = _a, rest = __rest(_a, ["table", "virtualColumns", "virtualPaddingLeft", "virtualPaddingRight"]);
|
|
1067
1096
|
const { getFooterGroups, getState, options: { enableStickyFooter, layoutMode, muiTableFooterProps }, refs: { tableFooterRef }, } = table;
|
|
1068
1097
|
const { isFullScreen } = getState();
|
|
1069
|
-
const tableFooterProps = parseFromValuesOrFunc(muiTableFooterProps, {
|
|
1098
|
+
const tableFooterProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterProps, {
|
|
1070
1099
|
table,
|
|
1071
|
-
});
|
|
1100
|
+
})), rest);
|
|
1072
1101
|
const stickFooter = (isFullScreen || enableStickyFooter) && enableStickyFooter !== false;
|
|
1073
1102
|
return (jsx(TableFooter, Object.assign({}, tableFooterProps, { ref: (ref) => {
|
|
1074
1103
|
tableFooterRef.current = ref;
|
|
@@ -1173,14 +1202,15 @@ const rangeModes = ['between', 'betweenInclusive', 'inNumberRange'];
|
|
|
1173
1202
|
const emptyModes = ['empty', 'notEmpty'];
|
|
1174
1203
|
const arrModes = ['arrIncludesSome', 'arrIncludesAll', 'arrIncludes'];
|
|
1175
1204
|
const rangeVariants = ['range-slider', 'date-range', 'range'];
|
|
1176
|
-
const MRT_FilterOptionMenu = (
|
|
1177
|
-
var
|
|
1205
|
+
const MRT_FilterOptionMenu = (_a) => {
|
|
1206
|
+
var _b, _c, _d, _e;
|
|
1207
|
+
var { anchorEl, header, onSelect, setAnchorEl, setFilterValue, table } = _a, rest = __rest(_a, ["anchorEl", "header", "onSelect", "setAnchorEl", "setFilterValue", "table"]);
|
|
1178
1208
|
const { getState, options: { columnFilterModeOptions, globalFilterModeOptions, localization, renderColumnFilterModeMenuItems, renderGlobalFilterModeMenuItems, }, setColumnFilterFns, setGlobalFilterFn, } = table;
|
|
1179
1209
|
const { density, globalFilterFn } = getState();
|
|
1180
1210
|
const { column } = header !== null && header !== void 0 ? header : {};
|
|
1181
1211
|
const { columnDef } = column !== null && column !== void 0 ? column : {};
|
|
1182
1212
|
const currentFilterValue = column === null || column === void 0 ? void 0 : column.getFilterValue();
|
|
1183
|
-
let allowedColumnFilterOptions = (
|
|
1213
|
+
let allowedColumnFilterOptions = (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _b !== void 0 ? _b : columnFilterModeOptions;
|
|
1184
1214
|
if (rangeVariants.includes(columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant)) {
|
|
1185
1215
|
allowedColumnFilterOptions = [
|
|
1186
1216
|
...rangeModes,
|
|
@@ -1254,15 +1284,15 @@ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilt
|
|
|
1254
1284
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect();
|
|
1255
1285
|
};
|
|
1256
1286
|
const filterOption = !!header && columnDef ? columnDef._filterFn : globalFilterFn;
|
|
1257
|
-
return (jsx(Menu, { MenuListProps: {
|
|
1287
|
+
return (jsx(Menu, Object.assign({ MenuListProps: {
|
|
1258
1288
|
dense: density === 'compact',
|
|
1259
|
-
}, anchorEl: anchorEl, anchorOrigin: { horizontal: 'right', vertical: 'center' }, onClose: () => setAnchorEl(null), open: !!anchorEl, children: (
|
|
1260
|
-
? (
|
|
1289
|
+
}, anchorEl: anchorEl, anchorOrigin: { horizontal: 'right', vertical: 'center' }, onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: (_e = (header && column && columnDef
|
|
1290
|
+
? (_d = (_c = columnDef.renderColumnFilterModeMenuItems) === null || _c === void 0 ? void 0 : _c.call(columnDef, {
|
|
1261
1291
|
column: column,
|
|
1262
1292
|
internalFilterOptions,
|
|
1263
1293
|
onSelectFilterMode: handleSelectFilterMode,
|
|
1264
1294
|
table,
|
|
1265
|
-
})) !== null &&
|
|
1295
|
+
})) !== null && _d !== void 0 ? _d : renderColumnFilterModeMenuItems === null || renderColumnFilterModeMenuItems === void 0 ? void 0 : renderColumnFilterModeMenuItems({
|
|
1266
1296
|
column: column,
|
|
1267
1297
|
internalFilterOptions,
|
|
1268
1298
|
onSelectFilterMode: handleSelectFilterMode,
|
|
@@ -1272,13 +1302,13 @@ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilt
|
|
|
1272
1302
|
internalFilterOptions,
|
|
1273
1303
|
onSelectFilterMode: handleSelectFilterMode,
|
|
1274
1304
|
table,
|
|
1275
|
-
}))) !== null &&
|
|
1305
|
+
}))) !== null && _e !== void 0 ? _e : internalFilterOptions.map(({ divider, label, option, symbol }, index) => (jsxs(MenuItem, { divider: divider, onClick: () => handleSelectFilterMode(option), selected: option === filterOption, sx: {
|
|
1276
1306
|
alignItems: 'center',
|
|
1277
1307
|
display: 'flex',
|
|
1278
1308
|
gap: '2ch',
|
|
1279
1309
|
my: 0,
|
|
1280
1310
|
py: '6px',
|
|
1281
|
-
}, value: option, children: [jsx(Box, { sx: { fontSize: '1.25rem', width: '2ch' }, children: symbol }), label] }, index))) }));
|
|
1311
|
+
}, value: option, children: [jsx(Box, { sx: { fontSize: '1.25rem', width: '2ch' }, children: symbol }), label] }, index))) })));
|
|
1282
1312
|
};
|
|
1283
1313
|
|
|
1284
1314
|
const commonMenuItemStyles = {
|
|
@@ -1291,8 +1321,9 @@ const commonListItemStyles = {
|
|
|
1291
1321
|
alignItems: 'center',
|
|
1292
1322
|
display: 'flex',
|
|
1293
1323
|
};
|
|
1294
|
-
const MRT_ColumnActionMenu = (
|
|
1295
|
-
var
|
|
1324
|
+
const MRT_ColumnActionMenu = (_a) => {
|
|
1325
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1326
|
+
var { anchorEl, header, setAnchorEl, table } = _a, rest = __rest(_a, ["anchorEl", "header", "setAnchorEl", "table"]);
|
|
1296
1327
|
const { getState, options: { columnFilterDisplayMode, columnFilterModeOptions, enableColumnFilterModes, enableColumnFilters, enableColumnPinning, enableColumnResizing, enableGrouping, enableHiding, enableSorting, enableSortingRemoval, icons: { ArrowRightIcon, ClearAllIcon, DynamicFeedIcon, FilterListIcon, FilterListOffIcon, PushPinIcon, RestartAltIcon, SortIcon, ViewColumnIcon, VisibilityOffIcon, }, localization, renderColumnActionsMenuItems, }, refs: { filterInputRefs }, setColumnOrder, setColumnSizingInfo, setShowColumnFilters, toggleAllColumnsVisible, } = table;
|
|
1297
1328
|
const { column } = header;
|
|
1298
1329
|
const { columnDef } = column;
|
|
@@ -1347,7 +1378,7 @@ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
|
|
|
1347
1378
|
setFilterMenuAnchorEl(event.currentTarget);
|
|
1348
1379
|
};
|
|
1349
1380
|
const isSelectFilter = !!columnDef.filterSelectOptions;
|
|
1350
|
-
const allowedColumnFilterOptions = (
|
|
1381
|
+
const allowedColumnFilterOptions = (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _b !== void 0 ? _b : columnFilterModeOptions;
|
|
1351
1382
|
const showFilterModeSubMenu = enableColumnFilterModes &&
|
|
1352
1383
|
columnDef.enableColumnFilterModes !== false &&
|
|
1353
1384
|
!isSelectFilter &&
|
|
@@ -1357,8 +1388,8 @@ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
|
|
|
1357
1388
|
...(enableSorting && column.getCanSort()
|
|
1358
1389
|
? [
|
|
1359
1390
|
enableSortingRemoval !== false && (jsx(MenuItem, { disabled: !column.getIsSorted(), onClick: handleClearSort, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(ClearAllIcon, {}) }), localization.clearSort] }) }, 0)),
|
|
1360
|
-
jsx(MenuItem, { disabled: column.getIsSorted() === 'asc', onClick: handleSortAsc, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(SortIcon, { style: { transform: 'rotate(180deg) scaleX(-1)' } }) }), (
|
|
1361
|
-
jsx(MenuItem, { disabled: column.getIsSorted() === 'desc', divider: enableColumnFilters || enableGrouping || enableHiding, onClick: handleSortDesc, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(SortIcon, {}) }), (
|
|
1391
|
+
jsx(MenuItem, { disabled: column.getIsSorted() === 'asc', onClick: handleSortAsc, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(SortIcon, { style: { transform: 'rotate(180deg) scaleX(-1)' } }) }), (_c = localization.sortByColumnAsc) === null || _c === void 0 ? void 0 : _c.replace('{column}', String(columnDef.header))] }) }, 1),
|
|
1392
|
+
jsx(MenuItem, { disabled: column.getIsSorted() === 'desc', divider: enableColumnFilters || enableGrouping || enableHiding, onClick: handleSortDesc, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(SortIcon, {}) }), (_d = localization.sortByColumnDesc) === null || _d === void 0 ? void 0 : _d.replace('{column}', String(columnDef.header))] }) }, 2),
|
|
1362
1393
|
]
|
|
1363
1394
|
: []),
|
|
1364
1395
|
...(enableColumnFilters && column.getCanFilter()
|
|
@@ -1368,13 +1399,13 @@ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
|
|
|
1368
1399
|
!columnFilterValue.filter((value) => value).length), onClick: handleClearFilter, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(FilterListOffIcon, {}) }), localization.clearFilter] }) }, 3),
|
|
1369
1400
|
columnFilterDisplayMode === 'subheader' && (jsxs(MenuItem, { disabled: showColumnFilters && !enableColumnFilterModes, divider: enableGrouping || enableHiding, onClick: showColumnFilters
|
|
1370
1401
|
? handleOpenFilterModeMenu
|
|
1371
|
-
: handleFilterByColumn, sx: commonMenuItemStyles, children: [jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(FilterListIcon, {}) }), (
|
|
1402
|
+
: handleFilterByColumn, sx: commonMenuItemStyles, children: [jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(FilterListIcon, {}) }), (_e = localization.filterByColumn) === null || _e === void 0 ? void 0 : _e.replace('{column}', String(columnDef.header))] }), showFilterModeSubMenu && (jsx(IconButton, { onClick: handleOpenFilterModeMenu, onMouseEnter: handleOpenFilterModeMenu, size: "small", sx: { p: 0 }, children: jsx(ArrowRightIcon, {}) }))] }, 4)),
|
|
1372
1403
|
showFilterModeSubMenu && (jsx(MRT_FilterOptionMenu, { anchorEl: filterMenuAnchorEl, header: header, onSelect: handleFilterByColumn, setAnchorEl: setFilterMenuAnchorEl, table: table }, 5)),
|
|
1373
1404
|
].filter(Boolean)
|
|
1374
1405
|
: []),
|
|
1375
1406
|
...(enableGrouping && column.getCanGroup()
|
|
1376
1407
|
? [
|
|
1377
|
-
jsx(MenuItem, { divider: enableColumnPinning, onClick: handleGroupByColumn, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(DynamicFeedIcon, {}) }), (
|
|
1408
|
+
jsx(MenuItem, { divider: enableColumnPinning, onClick: handleGroupByColumn, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(DynamicFeedIcon, {}) }), (_f = localization[column.getIsGrouped() ? 'ungroupByColumn' : 'groupByColumn']) === null || _f === void 0 ? void 0 : _f.replace('{column}', String(columnDef.header))] }) }, 6),
|
|
1378
1409
|
]
|
|
1379
1410
|
: []),
|
|
1380
1411
|
...(enableColumnPinning && column.getCanPin()
|
|
@@ -1391,29 +1422,30 @@ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
|
|
|
1391
1422
|
: []),
|
|
1392
1423
|
...(enableHiding
|
|
1393
1424
|
? [
|
|
1394
|
-
jsx(MenuItem, { disabled: !column.getCanHide(), onClick: handleHideColumn, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(VisibilityOffIcon, {}) }), (
|
|
1425
|
+
jsx(MenuItem, { disabled: !column.getCanHide(), onClick: handleHideColumn, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(VisibilityOffIcon, {}) }), (_g = localization.hideColumn) === null || _g === void 0 ? void 0 : _g.replace('{column}', String(columnDef.header))] }) }, 11),
|
|
1395
1426
|
jsx(MenuItem, { disabled: !Object.values(columnVisibility).filter((visible) => !visible)
|
|
1396
|
-
.length, onClick: handleShowAllColumns, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(ViewColumnIcon, {}) }), (
|
|
1427
|
+
.length, onClick: handleShowAllColumns, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(ViewColumnIcon, {}) }), (_h = localization.showAllColumns) === null || _h === void 0 ? void 0 : _h.replace('{column}', String(columnDef.header))] }) }, 12),
|
|
1397
1428
|
]
|
|
1398
1429
|
: []),
|
|
1399
1430
|
].filter(Boolean);
|
|
1400
|
-
return (jsx(Menu, { MenuListProps: {
|
|
1431
|
+
return (jsx(Menu, Object.assign({ MenuListProps: {
|
|
1401
1432
|
dense: density === 'compact',
|
|
1402
|
-
}, anchorEl: anchorEl, onClose: () => setAnchorEl(null), open: !!anchorEl, children: (
|
|
1433
|
+
}, anchorEl: anchorEl, onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: (_l = (_k = (_j = columnDef.renderColumnActionsMenuItems) === null || _j === void 0 ? void 0 : _j.call(columnDef, {
|
|
1403
1434
|
closeMenu: () => setAnchorEl(null),
|
|
1404
1435
|
column,
|
|
1405
1436
|
internalColumnMenuItems,
|
|
1406
1437
|
table,
|
|
1407
|
-
})) !== null &&
|
|
1438
|
+
})) !== null && _k !== void 0 ? _k : renderColumnActionsMenuItems === null || renderColumnActionsMenuItems === void 0 ? void 0 : renderColumnActionsMenuItems({
|
|
1408
1439
|
closeMenu: () => setAnchorEl(null),
|
|
1409
1440
|
column,
|
|
1410
1441
|
internalColumnMenuItems,
|
|
1411
1442
|
table,
|
|
1412
|
-
})) !== null &&
|
|
1443
|
+
})) !== null && _l !== void 0 ? _l : internalColumnMenuItems })));
|
|
1413
1444
|
};
|
|
1414
1445
|
|
|
1415
|
-
const MRT_TableHeadCellColumnActionsButton = (
|
|
1416
|
-
var
|
|
1446
|
+
const MRT_TableHeadCellColumnActionsButton = (_a) => {
|
|
1447
|
+
var _b;
|
|
1448
|
+
var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
|
|
1417
1449
|
const { options: { columnFilterDisplayMode, icons: { MoreVertIcon }, localization, muiColumnActionsButtonProps, }, } = table;
|
|
1418
1450
|
const { column } = header;
|
|
1419
1451
|
const { columnDef } = column;
|
|
@@ -1423,32 +1455,33 @@ const MRT_TableHeadCellColumnActionsButton = ({ header, table, }) => {
|
|
|
1423
1455
|
event.preventDefault();
|
|
1424
1456
|
setAnchorEl(event.currentTarget);
|
|
1425
1457
|
};
|
|
1426
|
-
const iconButtonProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiColumnActionsButtonProps, {
|
|
1458
|
+
const iconButtonProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiColumnActionsButtonProps, {
|
|
1427
1459
|
column,
|
|
1428
1460
|
table,
|
|
1429
1461
|
})), parseFromValuesOrFunc(columnDef.muiColumnActionsButtonProps, {
|
|
1430
1462
|
column,
|
|
1431
1463
|
table,
|
|
1432
|
-
}));
|
|
1433
|
-
return (jsxs(Fragment, { children: [jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (
|
|
1464
|
+
})), rest);
|
|
1465
|
+
return (jsxs(Fragment, { children: [jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _b !== void 0 ? _b : localization.columnActions, children: jsx(IconButton, Object.assign({ "aria-label": localization.columnActions, onClick: handleClick, size: "small" }, iconButtonProps, { sx: (theme) => (Object.assign({ '&:hover': {
|
|
1434
1466
|
opacity: 1,
|
|
1435
|
-
}, height: '2rem', m: '-4px', opacity: 0.3, transform: `scale(0.
|
|
1467
|
+
}, height: '2rem', m: '-4px', opacity: 0.3, transform: `scale(0.8) ${columnFilterDisplayMode !== 'popover' ? 'translateX(-4px)' : ''}`, transition: 'opacity 150ms', width: '2rem' }, parseFromValuesOrFunc(iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx, theme))), title: undefined, children: jsx(MoreVertIcon, {}) })) }), anchorEl && (jsx(MRT_ColumnActionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table }))] }));
|
|
1436
1468
|
};
|
|
1437
1469
|
|
|
1438
|
-
const MRT_FilterCheckbox = (
|
|
1439
|
-
var
|
|
1470
|
+
const MRT_FilterCheckbox = (_a) => {
|
|
1471
|
+
var _b, _c, _d;
|
|
1472
|
+
var { column, table } = _a, rest = __rest(_a, ["column", "table"]);
|
|
1440
1473
|
const { getState, options: { localization, muiFilterCheckboxProps }, } = table;
|
|
1441
1474
|
const { density } = getState();
|
|
1442
1475
|
const { columnDef } = column;
|
|
1443
|
-
const checkboxProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterCheckboxProps, {
|
|
1476
|
+
const checkboxProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterCheckboxProps, {
|
|
1444
1477
|
column,
|
|
1445
1478
|
table,
|
|
1446
1479
|
})), parseFromValuesOrFunc(columnDef.muiFilterCheckboxProps, {
|
|
1447
1480
|
column,
|
|
1448
1481
|
table,
|
|
1449
|
-
}));
|
|
1450
|
-
const filterLabel = (
|
|
1451
|
-
return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (
|
|
1482
|
+
})), rest);
|
|
1483
|
+
const filterLabel = (_b = localization.filterByColumn) === null || _b === void 0 ? void 0 : _b.replace('{column}', columnDef.header);
|
|
1484
|
+
return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_c = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _c !== void 0 ? _c : filterLabel, children: jsx(FormControlLabel, { control: jsx(Checkbox, Object.assign({ checked: column.getFilterValue() === 'true', color: column.getFilterValue() === undefined ? 'default' : 'primary', indeterminate: column.getFilterValue() === undefined, size: density === 'compact' ? 'small' : 'medium' }, checkboxProps, { onChange: (e, checked) => {
|
|
1452
1485
|
var _a;
|
|
1453
1486
|
column.setFilterValue(column.getFilterValue() === undefined
|
|
1454
1487
|
? 'true'
|
|
@@ -1460,19 +1493,20 @@ const MRT_FilterCheckbox = ({ column, table, }) => {
|
|
|
1460
1493
|
var _a;
|
|
1461
1494
|
e.stopPropagation();
|
|
1462
1495
|
(_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
|
|
1463
|
-
}, sx: (theme) => (Object.assign({ height: '2.5rem', width: '2.5rem' }, parseFromValuesOrFunc(checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx, theme))) })), disableTypography: true, label: (
|
|
1496
|
+
}, sx: (theme) => (Object.assign({ height: '2.5rem', width: '2.5rem' }, parseFromValuesOrFunc(checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx, theme))) })), disableTypography: true, label: (_d = checkboxProps.title) !== null && _d !== void 0 ? _d : filterLabel, sx: { color: 'text.secondary', fontWeight: 'normal', mt: '-4px' }, title: undefined }) }));
|
|
1464
1497
|
};
|
|
1465
1498
|
|
|
1466
|
-
const MRT_FilterTextField = (
|
|
1467
|
-
var
|
|
1499
|
+
const MRT_FilterTextField = (_a) => {
|
|
1500
|
+
var _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
1501
|
+
var { header, rangeFilterIndex, table } = _a, rest = __rest(_a, ["header", "rangeFilterIndex", "table"]);
|
|
1468
1502
|
const { options: { columnFilterModeOptions, enableColumnFilterModes, icons: { CloseIcon, FilterListIcon }, localization, manualFiltering, muiFilterAutocompleteProps, muiFilterDatePickerProps, muiFilterTextFieldProps, }, refs: { filterInputRefs }, setColumnFilterFns, } = table;
|
|
1469
1503
|
const { column } = header;
|
|
1470
1504
|
const { columnDef } = column;
|
|
1471
1505
|
const { filterVariant } = columnDef;
|
|
1472
|
-
const textFieldProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterTextFieldProps, { column, table })), parseFromValuesOrFunc(columnDef.muiFilterTextFieldProps, {
|
|
1506
|
+
const textFieldProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterTextFieldProps, { column, table })), parseFromValuesOrFunc(columnDef.muiFilterTextFieldProps, {
|
|
1473
1507
|
column,
|
|
1474
1508
|
table,
|
|
1475
|
-
}));
|
|
1509
|
+
})), rest);
|
|
1476
1510
|
const autocompleteProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterAutocompleteProps, { column, table })), parseFromValuesOrFunc(columnDef.muiFilterAutocompleteProps, {
|
|
1477
1511
|
column,
|
|
1478
1512
|
table,
|
|
@@ -1491,17 +1525,17 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1491
1525
|
const currentFilterOption = columnDef._filterFn;
|
|
1492
1526
|
const filterChipLabel = ['empty', 'notEmpty'].includes(currentFilterOption)
|
|
1493
1527
|
? //@ts-ignore
|
|
1494
|
-
localization[`filter${((
|
|
1528
|
+
localization[`filter${((_c = (_b = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt) === null || _b === void 0 ? void 0 : _b.call(currentFilterOption, 0)) === null || _c === void 0 ? void 0 : _c.toUpperCase()) +
|
|
1495
1529
|
(currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]
|
|
1496
1530
|
: '';
|
|
1497
1531
|
const filterPlaceholder = !isRangeFilter
|
|
1498
|
-
? (
|
|
1532
|
+
? (_d = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.placeholder) !== null && _d !== void 0 ? _d : (_f = localization.filterByColumn) === null || _f === void 0 ? void 0 : _f.replace('{column}', String(columnDef.header))
|
|
1499
1533
|
: rangeFilterIndex === 0
|
|
1500
1534
|
? localization.min
|
|
1501
1535
|
: rangeFilterIndex === 1
|
|
1502
1536
|
? localization.max
|
|
1503
1537
|
: '';
|
|
1504
|
-
const allowedColumnFilterOptions = (
|
|
1538
|
+
const allowedColumnFilterOptions = (_g = columnDef === null || columnDef === void 0 ? void 0 : columnDef.columnFilterModeOptions) !== null && _g !== void 0 ? _g : columnFilterModeOptions;
|
|
1505
1539
|
const showChangeModeButton = enableColumnFilterModes &&
|
|
1506
1540
|
columnDef.enableColumnFilterModes !== false &&
|
|
1507
1541
|
!rangeFilterIndex &&
|
|
@@ -1589,7 +1623,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1589
1623
|
isMounted.current = true;
|
|
1590
1624
|
}, [column.getFilterValue()]);
|
|
1591
1625
|
if (columnDef.Filter) {
|
|
1592
|
-
return (jsx(Fragment, { children: (
|
|
1626
|
+
return (jsx(Fragment, { children: (_h = columnDef.Filter) === null || _h === void 0 ? void 0 : _h.call(columnDef, { column, header, rangeFilterIndex, table }) }));
|
|
1593
1627
|
}
|
|
1594
1628
|
const dropdownOptions = useMemo(() => {
|
|
1595
1629
|
var _a;
|
|
@@ -1605,7 +1639,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1605
1639
|
isMultiSelectFilter,
|
|
1606
1640
|
isSelectFilter,
|
|
1607
1641
|
]);
|
|
1608
|
-
const endAdornment = !isAutocompleteFilter && !isDateFilter && !filterChipLabel ? (jsx(InputAdornment, { position: "end", sx: { mr: isSelectFilter || isMultiSelectFilter ? '20px' : undefined }, children: jsx(Tooltip, { arrow: true, placement: "right", title: (
|
|
1642
|
+
const endAdornment = !isAutocompleteFilter && !isDateFilter && !filterChipLabel ? (jsx(InputAdornment, { position: "end", sx: { mr: isSelectFilter || isMultiSelectFilter ? '20px' : undefined }, children: jsx(Tooltip, { arrow: true, placement: "right", title: (_j = localization.clearFilter) !== null && _j !== void 0 ? _j : '', children: jsx("span", { children: jsx(IconButton, { "aria-label": localization.clearFilter, disabled: !((_k = filterValue === null || filterValue === void 0 ? void 0 : filterValue.toString()) === null || _k === void 0 ? void 0 : _k.length), onClick: handleClear, size: "small", sx: {
|
|
1609
1643
|
height: '2rem',
|
|
1610
1644
|
transform: 'scale(0.9)',
|
|
1611
1645
|
width: '2rem',
|
|
@@ -1621,7 +1655,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1621
1655
|
? { endAdornment, startAdornment }
|
|
1622
1656
|
: { startAdornment }, fullWidth: true, helperText: showChangeModeButton ? (jsx("label", { children: localization.filterMode.replace('{filterType}',
|
|
1623
1657
|
// @ts-ignore
|
|
1624
|
-
localization[`filter${((
|
|
1658
|
+
localization[`filter${((_l = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _l === void 0 ? void 0 : _l.toUpperCase()) +
|
|
1625
1659
|
(currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]) })) : null, inputProps: {
|
|
1626
1660
|
autoComplete: 'new-password',
|
|
1627
1661
|
disabled: !!filterChipLabel,
|
|
@@ -1650,8 +1684,8 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1650
1684
|
return (jsxs(Fragment, { children: [isDateFilter ? (jsx(DatePicker, Object.assign({ onChange: (newDate) => {
|
|
1651
1685
|
handleChange(newDate);
|
|
1652
1686
|
}, value: filterValue || null }, datePickerProps, { slotProps: {
|
|
1653
|
-
field: Object.assign({ clearable: true, onClear: () => handleClear() }, (
|
|
1654
|
-
textField: Object.assign(Object.assign({}, commonTextFieldProps), (
|
|
1687
|
+
field: Object.assign({ clearable: true, onClear: () => handleClear() }, (_m = datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.slotProps) === null || _m === void 0 ? void 0 : _m.field),
|
|
1688
|
+
textField: Object.assign(Object.assign({}, commonTextFieldProps), (_o = datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.slotProps) === null || _o === void 0 ? void 0 : _o.textField),
|
|
1655
1689
|
} }))) : isAutocompleteFilter ? (jsx(Autocomplete, Object.assign({ freeSolo: true, getOptionLabel: (option) => option, onChange: (_e, newValue) => handleChange(newValue), options: dropdownOptions !== null && dropdownOptions !== void 0 ? dropdownOptions : [] }, autocompleteProps, { renderInput: (builtinTextFieldProps) => {
|
|
1656
1690
|
var _a;
|
|
1657
1691
|
return (jsx(TextField, Object.assign({}, builtinTextFieldProps, commonTextFieldProps, { InputProps: Object.assign(Object.assign({}, builtinTextFieldProps.InputProps), { startAdornment: (_a = commonTextFieldProps === null || commonTextFieldProps === void 0 ? void 0 : commonTextFieldProps.InputProps) === null || _a === void 0 ? void 0 : _a.startAdornment }), inputProps: Object.assign(Object.assign({}, builtinTextFieldProps.inputProps), commonTextFieldProps === null || commonTextFieldProps === void 0 ? void 0 : commonTextFieldProps.inputProps), onChange: handleTextFieldChange })));
|
|
@@ -1671,7 +1705,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1671
1705
|
}, onChange: handleTextFieldChange, select: isSelectFilter || isMultiSelectFilter }, commonTextFieldProps, { value: filterValue !== null && filterValue !== void 0 ? filterValue : '', children: (isSelectFilter || isMultiSelectFilter) && [
|
|
1672
1706
|
jsx(MenuItem, { disabled: true, divider: true, hidden: true, value: "", children: jsx(Box, { sx: { opacity: 0.5 }, children: filterPlaceholder }) }, "p"),
|
|
1673
1707
|
...[
|
|
1674
|
-
(
|
|
1708
|
+
(_p = textFieldProps.children) !== null && _p !== void 0 ? _p : dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map((option, index) => {
|
|
1675
1709
|
var _a;
|
|
1676
1710
|
if (!option)
|
|
1677
1711
|
return '';
|
|
@@ -1697,21 +1731,23 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1697
1731
|
] }))), jsx(MRT_FilterOptionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, setFilterValue: setFilterValue, table: table })] }));
|
|
1698
1732
|
};
|
|
1699
1733
|
|
|
1700
|
-
const MRT_FilterRangeFields = (
|
|
1701
|
-
|
|
1734
|
+
const MRT_FilterRangeFields = (_a) => {
|
|
1735
|
+
var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
|
|
1736
|
+
return (jsxs(Box, Object.assign({}, rest, { sx: (theme) => (Object.assign({ display: 'grid', gap: '1rem', gridTemplateColumns: '1fr 1fr' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: [jsx(MRT_FilterTextField, { header: header, rangeFilterIndex: 0, table: table }), jsx(MRT_FilterTextField, { header: header, rangeFilterIndex: 1, table: table })] })));
|
|
1702
1737
|
};
|
|
1703
1738
|
|
|
1704
|
-
const MRT_FilterRangeSlider = (
|
|
1705
|
-
var
|
|
1739
|
+
const MRT_FilterRangeSlider = (_a) => {
|
|
1740
|
+
var _b, _c;
|
|
1741
|
+
var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
|
|
1706
1742
|
const { options: { enableColumnFilterModes, localization, muiFilterSliderProps }, refs: { filterInputRefs }, } = table;
|
|
1707
1743
|
const { column } = header;
|
|
1708
1744
|
const { columnDef } = column;
|
|
1709
1745
|
const currentFilterOption = columnDef._filterFn;
|
|
1710
1746
|
const showChangeModeButton = enableColumnFilterModes && columnDef.enableColumnFilterModes !== false;
|
|
1711
|
-
const sliderProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterSliderProps, { column, table })), parseFromValuesOrFunc(columnDef.muiFilterSliderProps, { column, table }));
|
|
1747
|
+
const sliderProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterSliderProps, { column, table })), parseFromValuesOrFunc(columnDef.muiFilterSliderProps, { column, table })), rest);
|
|
1712
1748
|
let [min, max] = sliderProps.min !== undefined && sliderProps.max !== undefined
|
|
1713
1749
|
? [sliderProps.min, sliderProps.max]
|
|
1714
|
-
: (
|
|
1750
|
+
: (_b = column.getFacetedMinMaxValues()) !== null && _b !== void 0 ? _b : [0, 1];
|
|
1715
1751
|
//fix potential TanStack Table bugs where min or max is an array
|
|
1716
1752
|
if (Array.isArray(min))
|
|
1717
1753
|
min = min[0];
|
|
@@ -1768,22 +1804,24 @@ const MRT_FilterRangeSlider = ({ header, table, }) => {
|
|
|
1768
1804
|
whiteSpace: 'nowrap',
|
|
1769
1805
|
}, children: localization.filterMode.replace('{filterType}',
|
|
1770
1806
|
// @ts-ignore
|
|
1771
|
-
localization[`filter${((
|
|
1807
|
+
localization[`filter${((_c = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _c === void 0 ? void 0 : _c.toUpperCase()) +
|
|
1772
1808
|
(currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]) })) : null] }));
|
|
1773
1809
|
};
|
|
1774
1810
|
|
|
1775
|
-
const MRT_TableHeadCellFilterContainer = (
|
|
1776
|
-
var
|
|
1811
|
+
const MRT_TableHeadCellFilterContainer = (_a) => {
|
|
1812
|
+
var _b;
|
|
1813
|
+
var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
|
|
1777
1814
|
const { getState, options: { columnFilterDisplayMode }, } = table;
|
|
1778
1815
|
const { showColumnFilters } = getState();
|
|
1779
1816
|
const { column } = header;
|
|
1780
1817
|
const { columnDef } = column;
|
|
1781
|
-
return (jsx(Collapse, { in: showColumnFilters || columnFilterDisplayMode === 'popover', mountOnEnter: true, unmountOnExit: true, children: columnDef.filterVariant === 'checkbox' ? (jsx(MRT_FilterCheckbox, { column: column, table: table })) : columnDef.filterVariant === 'range-slider' ? (jsx(MRT_FilterRangeSlider, { header: header, table: table })) : ((
|
|
1782
|
-
['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn) ? (jsx(MRT_FilterRangeFields, { header: header, table: table })) : (jsx(MRT_FilterTextField, { header: header, table: table })) }));
|
|
1818
|
+
return (jsx(Collapse, Object.assign({ in: showColumnFilters || columnFilterDisplayMode === 'popover', mountOnEnter: true, unmountOnExit: true }, rest, { children: columnDef.filterVariant === 'checkbox' ? (jsx(MRT_FilterCheckbox, { column: column, table: table })) : columnDef.filterVariant === 'range-slider' ? (jsx(MRT_FilterRangeSlider, { header: header, table: table })) : ((_b = columnDef.filterVariant) === null || _b === void 0 ? void 0 : _b.includes('range')) ||
|
|
1819
|
+
['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn) ? (jsx(MRT_FilterRangeFields, { header: header, table: table })) : (jsx(MRT_FilterTextField, { header: header, table: table })) })));
|
|
1783
1820
|
};
|
|
1784
1821
|
|
|
1785
|
-
const MRT_TableHeadCellFilterLabel = (
|
|
1786
|
-
var
|
|
1822
|
+
const MRT_TableHeadCellFilterLabel = (_a) => {
|
|
1823
|
+
var _b, _c, _d;
|
|
1824
|
+
var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
|
|
1787
1825
|
const { options: { columnFilterDisplayMode, icons: { FilterAltIcon }, localization, }, refs: { filterInputRefs }, setShowColumnFilters, } = table;
|
|
1788
1826
|
const { column } = header;
|
|
1789
1827
|
const { columnDef } = column;
|
|
@@ -1791,16 +1829,16 @@ const MRT_TableHeadCellFilterLabel = ({ header, table, }) => {
|
|
|
1791
1829
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
1792
1830
|
const isFilterActive = (Array.isArray(filterValue) && filterValue.some(Boolean)) ||
|
|
1793
1831
|
(!!filterValue && !Array.isArray(filterValue));
|
|
1794
|
-
const isRangeFilter = ((
|
|
1832
|
+
const isRangeFilter = ((_b = columnDef.filterVariant) === null || _b === void 0 ? void 0 : _b.includes('range')) ||
|
|
1795
1833
|
['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn);
|
|
1796
1834
|
const currentFilterOption = columnDef._filterFn;
|
|
1797
1835
|
const filterTooltip = columnFilterDisplayMode === 'popover' && !isFilterActive
|
|
1798
|
-
? (
|
|
1836
|
+
? (_c = localization.filterByColumn) === null || _c === void 0 ? void 0 : _c.replace('{column}', String(columnDef.header))
|
|
1799
1837
|
: localization.filteringByColumn
|
|
1800
1838
|
.replace('{column}', String(columnDef.header))
|
|
1801
1839
|
.replace('{filterType}', currentFilterOption
|
|
1802
1840
|
? // @ts-ignore
|
|
1803
|
-
localization[`filter${((
|
|
1841
|
+
localization[`filter${((_d = currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.charAt(0)) === null || _d === void 0 ? void 0 : _d.toUpperCase()) +
|
|
1804
1842
|
(currentFilterOption === null || currentFilterOption === void 0 ? void 0 : currentFilterOption.slice(1))}`]
|
|
1805
1843
|
: '')
|
|
1806
1844
|
.replace('{filterValue}', `"${Array.isArray(filterValue)
|
|
@@ -1810,7 +1848,7 @@ const MRT_TableHeadCellFilterLabel = ({ header, table, }) => {
|
|
|
1810
1848
|
return (jsxs(Fragment, { children: [jsx(Grow, { in: columnFilterDisplayMode === 'popover' ||
|
|
1811
1849
|
(!!filterValue && !isRangeFilter) ||
|
|
1812
1850
|
(isRangeFilter && // @ts-ignore
|
|
1813
|
-
(!!(filterValue === null || filterValue === void 0 ? void 0 : filterValue[0]) || !!(filterValue === null || filterValue === void 0 ? void 0 : filterValue[1]))), unmountOnExit: true, children: jsx(Box, { component: "span", sx: { flex: '0 0' }, children: jsx(Tooltip, { arrow: true, placement: "top", title: filterTooltip, children: jsx(IconButton, { disableRipple: true, onClick: (event) => {
|
|
1851
|
+
(!!(filterValue === null || filterValue === void 0 ? void 0 : filterValue[0]) || !!(filterValue === null || filterValue === void 0 ? void 0 : filterValue[1]))), unmountOnExit: true, children: jsx(Box, { component: "span", sx: { flex: '0 0' }, children: jsx(Tooltip, { arrow: true, placement: "top", title: filterTooltip, children: jsx(IconButton, Object.assign({ disableRipple: true, onClick: (event) => {
|
|
1814
1852
|
if (columnFilterDisplayMode === 'popover') {
|
|
1815
1853
|
setAnchorEl(event.currentTarget);
|
|
1816
1854
|
}
|
|
@@ -1823,15 +1861,7 @@ const MRT_TableHeadCellFilterLabel = ({ header, table, }) => {
|
|
|
1823
1861
|
(_b = filterInputRefs.current[`${column.id}-0`]) === null || _b === void 0 ? void 0 : _b.select();
|
|
1824
1862
|
});
|
|
1825
1863
|
event.stopPropagation();
|
|
1826
|
-
}, size: "small", sx: {
|
|
1827
|
-
height: '16px',
|
|
1828
|
-
ml: '4px',
|
|
1829
|
-
opacity: isFilterActive ? 1 : 0.3,
|
|
1830
|
-
p: '8px',
|
|
1831
|
-
transform: 'scale(0.75)',
|
|
1832
|
-
transition: 'all 150ms ease-in-out',
|
|
1833
|
-
width: '16px',
|
|
1834
|
-
}, children: jsx(FilterAltIcon, {}) }) }) }) }), jsx(Popover, { anchorEl: anchorEl, anchorOrigin: {
|
|
1864
|
+
}, size: "small" }, rest, { sx: (theme) => (Object.assign({ height: '16px', ml: '4px', opacity: isFilterActive ? 1 : 0.3, p: '8px', transform: 'scale(0.75)', transition: 'all 150ms ease-in-out', width: '16px' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: jsx(FilterAltIcon, {}) })) }) }) }), jsx(Popover, { anchorEl: anchorEl, anchorOrigin: {
|
|
1835
1865
|
horizontal: 'center',
|
|
1836
1866
|
vertical: 'top',
|
|
1837
1867
|
}, onClick: (event) => event.stopPropagation(), onClose: (event) => {
|
|
@@ -1844,14 +1874,15 @@ const MRT_TableHeadCellFilterLabel = ({ header, table, }) => {
|
|
|
1844
1874
|
}, children: jsx(Box, { sx: { p: '1rem' }, children: jsx(MRT_TableHeadCellFilterContainer, { header: header, table: table }) }) })] }));
|
|
1845
1875
|
};
|
|
1846
1876
|
|
|
1847
|
-
const MRT_TableHeadCellGrabHandle = (
|
|
1877
|
+
const MRT_TableHeadCellGrabHandle = (_a) => {
|
|
1878
|
+
var { column, table, tableHeadCellRef } = _a, rest = __rest(_a, ["column", "table", "tableHeadCellRef"]);
|
|
1848
1879
|
const { getState, options: { enableColumnOrdering, muiColumnDragHandleProps }, setColumnOrder, setDraggingColumn, setHoveredColumn, } = table;
|
|
1849
1880
|
const { columnDef } = column;
|
|
1850
1881
|
const { columnOrder, draggingColumn, hoveredColumn } = getState();
|
|
1851
|
-
const iconButtonProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiColumnDragHandleProps, { column, table })), parseFromValuesOrFunc(columnDef.muiColumnDragHandleProps, {
|
|
1882
|
+
const iconButtonProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiColumnDragHandleProps, { column, table })), parseFromValuesOrFunc(columnDef.muiColumnDragHandleProps, {
|
|
1852
1883
|
column,
|
|
1853
1884
|
table,
|
|
1854
|
-
}));
|
|
1885
|
+
})), rest);
|
|
1855
1886
|
const handleDragStart = (event) => {
|
|
1856
1887
|
var _a;
|
|
1857
1888
|
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
|
@@ -1875,8 +1906,9 @@ const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
|
|
|
1875
1906
|
return (jsx(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragEnd: handleDragEnd, onDragStart: handleDragStart, table: table }));
|
|
1876
1907
|
};
|
|
1877
1908
|
|
|
1878
|
-
const MRT_TableHeadCellResizeHandle = (
|
|
1879
|
-
var
|
|
1909
|
+
const MRT_TableHeadCellResizeHandle = (_a) => {
|
|
1910
|
+
var _b;
|
|
1911
|
+
var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
|
|
1880
1912
|
const { getState, options: { columnResizeMode }, setColumnSizingInfo, } = table;
|
|
1881
1913
|
const { density } = getState();
|
|
1882
1914
|
const { column } = header;
|
|
@@ -1885,7 +1917,7 @@ const MRT_TableHeadCellResizeHandle = ({ header, table, }) => {
|
|
|
1885
1917
|
column.resetSize();
|
|
1886
1918
|
}, onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), style: {
|
|
1887
1919
|
transform: column.getIsResizing() && columnResizeMode === 'onEnd'
|
|
1888
|
-
? `translateX(${(
|
|
1920
|
+
? `translateX(${(_b = getState().columnSizingInfo.deltaOffset) !== null && _b !== void 0 ? _b : 0}px)`
|
|
1889
1921
|
: undefined,
|
|
1890
1922
|
}, sx: (theme) => ({
|
|
1891
1923
|
'&:active > hr': {
|
|
@@ -1901,58 +1933,53 @@ const MRT_TableHeadCellResizeHandle = ({ header, table, }) => {
|
|
|
1901
1933
|
position: 'absolute',
|
|
1902
1934
|
px: '4px',
|
|
1903
1935
|
right: '0',
|
|
1904
|
-
}), children: jsx(Divider, { className: "Mui-TableHeadCell-ResizeHandle-Divider", flexItem: true, orientation: "vertical", sx: {
|
|
1905
|
-
borderRadius: '2px',
|
|
1906
|
-
borderWidth: '2px',
|
|
1907
|
-
height: '24px',
|
|
1908
|
-
touchAction: 'none',
|
|
1909
|
-
transition: column.getIsResizing()
|
|
1936
|
+
}), children: jsx(Divider, { className: "Mui-TableHeadCell-ResizeHandle-Divider", flexItem: true, orientation: "vertical", sx: (theme) => (Object.assign({ borderRadius: '2px', borderWidth: '2px', height: '24px', touchAction: 'none', transition: column.getIsResizing()
|
|
1910
1937
|
? undefined
|
|
1911
|
-
: 'all 150ms ease-in-out',
|
|
1912
|
-
userSelect: 'none',
|
|
1913
|
-
zIndex: 4,
|
|
1914
|
-
} }) }));
|
|
1938
|
+
: 'all 150ms ease-in-out', userSelect: 'none', zIndex: 4 }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))) }) }));
|
|
1915
1939
|
};
|
|
1916
1940
|
|
|
1917
|
-
const MRT_TableHeadCellSortLabel = (
|
|
1941
|
+
const MRT_TableHeadCellSortLabel = (_a) => {
|
|
1942
|
+
var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
|
|
1918
1943
|
const { getState, options: { icons: { ArrowDownwardIcon, SyncAltIcon }, localization, }, } = table;
|
|
1919
1944
|
const { column } = header;
|
|
1920
1945
|
const { columnDef } = column;
|
|
1921
|
-
const { sorting } = getState();
|
|
1946
|
+
const { isLoading, showSkeletons, sorting } = getState();
|
|
1922
1947
|
const isSorted = !!column.getIsSorted();
|
|
1923
|
-
const sortTooltip =
|
|
1924
|
-
?
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
:
|
|
1930
|
-
|
|
1948
|
+
const sortTooltip = isLoading || showSkeletons
|
|
1949
|
+
? ''
|
|
1950
|
+
: column.getIsSorted()
|
|
1951
|
+
? column.getIsSorted() === 'desc'
|
|
1952
|
+
? localization.sortedByColumnDesc.replace('{column}', columnDef.header)
|
|
1953
|
+
: localization.sortedByColumnAsc.replace('{column}', columnDef.header)
|
|
1954
|
+
: column.getNextSortingOrder() === 'desc'
|
|
1955
|
+
? localization.sortByColumnDesc.replace('{column}', columnDef.header)
|
|
1956
|
+
: localization.sortByColumnAsc.replace('{column}', columnDef.header);
|
|
1957
|
+
return (jsx(Tooltip, { arrow: true, placement: "top", title: sortTooltip, children: jsx(Badge, { badgeContent: sorting.length > 1 ? column.getSortIndex() + 1 : 0, overlap: "circular", children: jsx(TableSortLabel, Object.assign({ IconComponent: !isSorted
|
|
1931
1958
|
? (props) => (jsx(SyncAltIcon, Object.assign({}, props, { style: { transform: 'rotate(-90deg) scaleX(0.8)' } })))
|
|
1932
1959
|
: ArrowDownwardIcon, active: true, "aria-label": sortTooltip, direction: isSorted ? column.getIsSorted() : undefined, onClick: (e) => {
|
|
1933
1960
|
var _a;
|
|
1934
1961
|
e.stopPropagation();
|
|
1935
1962
|
(_a = header.column.getToggleSortingHandler()) === null || _a === void 0 ? void 0 : _a(e);
|
|
1936
|
-
}, sx: {
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
width: '3ch',
|
|
1941
|
-
} }) }) }));
|
|
1963
|
+
} }, rest, { sx: (theme) => (Object.assign({ '.MuiTableSortLabel-icon': {
|
|
1964
|
+
color: `${theme.palette.mode === 'dark'
|
|
1965
|
+
? theme.palette.text.primary
|
|
1966
|
+
: theme.palette.text.secondary} !important`,
|
|
1967
|
+
}, flex: '0 0', opacity: isSorted ? 1 : 0.3, transition: 'all 150ms ease-in-out', width: '3ch' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))) })) }) }));
|
|
1942
1968
|
};
|
|
1943
1969
|
|
|
1944
|
-
const MRT_TableHeadCell = (
|
|
1945
|
-
var
|
|
1970
|
+
const MRT_TableHeadCell = (_a) => {
|
|
1971
|
+
var _b, _c, _d, _f, _g, _h;
|
|
1972
|
+
var { header, table } = _a, rest = __rest(_a, ["header", "table"]);
|
|
1946
1973
|
const theme = useTheme();
|
|
1947
1974
|
const { getState, options: { columnFilterDisplayMode, enableColumnActions, enableColumnDragging, enableColumnOrdering, enableGrouping, enableMultiSort, layoutMode, muiTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
|
|
1948
1975
|
const { columnSizingInfo, density, draggingColumn, grouping, hoveredColumn, showColumnFilters, } = getState();
|
|
1949
1976
|
const { column } = header;
|
|
1950
1977
|
const { columnDef } = column;
|
|
1951
1978
|
const { columnDefType } = columnDef;
|
|
1952
|
-
const tableCellProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableHeadCellProps, { column, table })), parseFromValuesOrFunc(columnDef.muiTableHeadCellProps, {
|
|
1979
|
+
const tableCellProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableHeadCellProps, { column, table })), parseFromValuesOrFunc(columnDef.muiTableHeadCellProps, {
|
|
1953
1980
|
column,
|
|
1954
1981
|
table,
|
|
1955
|
-
}));
|
|
1982
|
+
})), rest);
|
|
1956
1983
|
const showColumnActions = (enableColumnActions || columnDef.enableColumnActions) &&
|
|
1957
1984
|
columnDef.enableColumnActions !== false;
|
|
1958
1985
|
const showDragHandle = enableColumnDragging !== false &&
|
|
@@ -2001,11 +2028,11 @@ const MRT_TableHeadCell = ({ header, table, }) => {
|
|
|
2001
2028
|
setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
|
2002
2029
|
}
|
|
2003
2030
|
};
|
|
2004
|
-
const headerElement = (
|
|
2031
|
+
const headerElement = (_b = parseFromValuesOrFunc(columnDef.Header, {
|
|
2005
2032
|
column,
|
|
2006
2033
|
header,
|
|
2007
2034
|
table,
|
|
2008
|
-
})) !== null &&
|
|
2035
|
+
})) !== null && _b !== void 0 ? _b : columnDef.header;
|
|
2009
2036
|
return (jsxs(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: (node) => {
|
|
2010
2037
|
if (node) {
|
|
2011
2038
|
tableHeadCellRefs.current[column.id] = node;
|
|
@@ -2040,47 +2067,53 @@ const MRT_TableHeadCell = ({ header, table, }) => {
|
|
|
2040
2067
|
table,
|
|
2041
2068
|
tableCellProps,
|
|
2042
2069
|
theme,
|
|
2043
|
-
})), draggingBorders)), children: [header.isPlaceholder
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
? '
|
|
2049
|
-
:
|
|
2050
|
-
? '
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
:
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
?
|
|
2064
|
-
: undefined,
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2070
|
+
})), draggingBorders)), children: [header.isPlaceholder
|
|
2071
|
+
? null
|
|
2072
|
+
: (_c = tableCellProps.children) !== null && _c !== void 0 ? _c : (jsxs(Box, { className: "Mui-TableHeadCell-Content", sx: {
|
|
2073
|
+
alignItems: 'center',
|
|
2074
|
+
display: 'flex',
|
|
2075
|
+
flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
|
|
2076
|
+
justifyContent: columnDefType === 'group' ||
|
|
2077
|
+
(tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
|
|
2078
|
+
? 'center'
|
|
2079
|
+
: column.getCanResize()
|
|
2080
|
+
? 'space-between'
|
|
2081
|
+
: 'flex-start',
|
|
2082
|
+
position: 'relative',
|
|
2083
|
+
width: '100%',
|
|
2084
|
+
}, children: [jsxs(Box, { className: "Mui-TableHeadCell-Content-Labels", onClick: column.getToggleSortingHandler(), sx: {
|
|
2085
|
+
alignItems: 'center',
|
|
2086
|
+
cursor: column.getCanSort() && columnDefType !== 'group'
|
|
2087
|
+
? 'pointer'
|
|
2088
|
+
: undefined,
|
|
2089
|
+
display: 'flex',
|
|
2090
|
+
flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
|
|
2091
|
+
overflow: columnDefType === 'data' ? 'hidden' : undefined,
|
|
2092
|
+
pl: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
|
|
2093
|
+
? `${headerPL}rem`
|
|
2094
|
+
: undefined,
|
|
2095
|
+
}, children: [jsx(Box, { className: "Mui-TableHeadCell-Content-Wrapper", sx: {
|
|
2096
|
+
'&:hover': {
|
|
2097
|
+
textOverflow: 'clip',
|
|
2098
|
+
},
|
|
2099
|
+
minWidth: `${Math.min((_f = (_d = columnDef.header) === null || _d === void 0 ? void 0 : _d.length) !== null && _f !== void 0 ? _f : 0, 4)}ch`,
|
|
2100
|
+
overflow: columnDefType === 'data' ? 'hidden' : undefined,
|
|
2101
|
+
textOverflow: 'ellipsis',
|
|
2102
|
+
whiteSpace: ((_h = (_g = columnDef.header) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 0) < 20
|
|
2103
|
+
? 'nowrap'
|
|
2104
|
+
: 'normal',
|
|
2105
|
+
}, title: columnDefType === 'data' ? columnDef.header : undefined, children: headerElement }), column.getCanFilter() && (jsx(MRT_TableHeadCellFilterLabel, { header: header, table: table })), column.getCanSort() && (jsx(MRT_TableHeadCellSortLabel, { header: header, table: table, tableCellProps: tableCellProps }))] }), columnDefType !== 'group' && (jsxs(Box, { className: "Mui-TableHeadCell-Content-Actions", sx: { whiteSpace: 'nowrap' }, children: [showDragHandle && (jsx(MRT_TableHeadCellGrabHandle, { column: column, table: table, tableHeadCellRef: {
|
|
2106
|
+
current: tableHeadCellRefs.current[column.id],
|
|
2107
|
+
} })), showColumnActions && (jsx(MRT_TableHeadCellColumnActionsButton, { header: header, table: table }))] })), column.getCanResize() && (jsx(MRT_TableHeadCellResizeHandle, { header: header, table: table }))] })), columnFilterDisplayMode === 'subheader' && column.getCanFilter() && (jsx(MRT_TableHeadCellFilterContainer, { header: header, table: table }))] })));
|
|
2108
|
+
};
|
|
2109
|
+
|
|
2110
|
+
const MRT_TableHeadRow = (_a) => {
|
|
2111
|
+
var { headerGroup, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight } = _a, rest = __rest(_a, ["headerGroup", "table", "virtualColumns", "virtualPaddingLeft", "virtualPaddingRight"]);
|
|
2079
2112
|
const { options: { layoutMode, muiTableHeadRowProps }, } = table;
|
|
2080
|
-
const tableRowProps = parseFromValuesOrFunc(muiTableHeadRowProps, {
|
|
2113
|
+
const tableRowProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableHeadRowProps, {
|
|
2081
2114
|
headerGroup,
|
|
2082
2115
|
table,
|
|
2083
|
-
});
|
|
2116
|
+
})), { rest });
|
|
2084
2117
|
return (jsxs(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.05), boxShadow: `4px 0 8px ${alpha(theme.palette.common.black, 0.1)}`, display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'flex' : undefined, top: 0 }, parseFromValuesOrFunc(tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx, theme))), children: [virtualPaddingLeft ? (jsx("th", { style: { display: 'flex', width: virtualPaddingLeft } })) : null, (virtualColumns !== null && virtualColumns !== void 0 ? virtualColumns : headerGroup.headers).map((headerOrVirtualHeader) => {
|
|
2085
2118
|
const header = virtualColumns
|
|
2086
2119
|
? headerGroup.headers[headerOrVirtualHeader.index]
|
|
@@ -2089,14 +2122,15 @@ const MRT_TableHeadRow = ({ headerGroup, table, virtualColumns, virtualPaddingLe
|
|
|
2089
2122
|
}), virtualPaddingRight ? (jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
|
|
2090
2123
|
};
|
|
2091
2124
|
|
|
2092
|
-
const MRT_LinearProgressBar = (
|
|
2125
|
+
const MRT_LinearProgressBar = (_a) => {
|
|
2126
|
+
var { isTopToolbar, table } = _a, rest = __rest(_a, ["isTopToolbar", "table"]);
|
|
2093
2127
|
const { getState, options: { muiLinearProgressProps }, } = table;
|
|
2094
|
-
const { showProgressBars } = getState();
|
|
2095
|
-
const linearProgressProps = parseFromValuesOrFunc(muiLinearProgressProps, {
|
|
2128
|
+
const { isSaving, showProgressBars } = getState();
|
|
2129
|
+
const linearProgressProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiLinearProgressProps, {
|
|
2096
2130
|
isTopToolbar,
|
|
2097
2131
|
table,
|
|
2098
|
-
});
|
|
2099
|
-
return (jsx(Collapse, { in: showProgressBars, mountOnEnter: true, sx: {
|
|
2132
|
+
})), rest);
|
|
2133
|
+
return (jsx(Collapse, { in: showProgressBars !== false && (showProgressBars || isSaving), mountOnEnter: true, sx: {
|
|
2100
2134
|
bottom: isTopToolbar ? 0 : undefined,
|
|
2101
2135
|
position: 'absolute',
|
|
2102
2136
|
top: !isTopToolbar ? 0 : undefined,
|
|
@@ -2104,46 +2138,20 @@ const MRT_LinearProgressBar = ({ isTopToolbar, table, }) => {
|
|
|
2104
2138
|
}, unmountOnExit: true, children: jsx(LinearProgress, Object.assign({ "aria-busy": "true", "aria-label": "Loading", sx: { position: 'relative' } }, linearProgressProps)) }));
|
|
2105
2139
|
};
|
|
2106
2140
|
|
|
2107
|
-
/******************************************************************************
|
|
2108
|
-
Copyright (c) Microsoft Corporation.
|
|
2109
|
-
|
|
2110
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
2111
|
-
purpose with or without fee is hereby granted.
|
|
2112
|
-
|
|
2113
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2114
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2115
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2116
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2117
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2118
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2119
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
2120
|
-
***************************************************************************** */
|
|
2121
|
-
function __rest(s, e) {
|
|
2122
|
-
var t = {};
|
|
2123
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2124
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2125
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2126
|
-
}
|
|
2127
|
-
return t;
|
|
2128
|
-
}
|
|
2129
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
2130
|
-
var e = new Error(message);
|
|
2131
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
2132
|
-
};
|
|
2133
|
-
|
|
2134
2141
|
const defaultRowsPerPage = [5, 10, 15, 20, 25, 30, 50, 100];
|
|
2135
|
-
const MRT_TablePagination = (
|
|
2142
|
+
const MRT_TablePagination = (_a) => {
|
|
2143
|
+
var { position = 'bottom', table } = _a, rest = __rest(_a, ["position", "table"]);
|
|
2136
2144
|
const { getPrePaginationRowModel, getState, options: { enableToolbarInternalActions, icons: { ChevronLeftIcon, ChevronRightIcon, FirstPageIcon, LastPageIcon }, localization, muiPaginationProps, paginationDisplayMode, rowCount, }, setPageIndex, setPageSize, } = table;
|
|
2137
2145
|
const { pagination: { pageIndex = 0, pageSize = 10 }, showGlobalFilter, } = getState();
|
|
2138
|
-
const paginationProps = parseFromValuesOrFunc(muiPaginationProps, {
|
|
2146
|
+
const paginationProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiPaginationProps, {
|
|
2139
2147
|
table,
|
|
2140
|
-
});
|
|
2148
|
+
})), rest);
|
|
2141
2149
|
const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
|
|
2142
2150
|
const numberOfPages = Math.ceil(totalRowCount / pageSize);
|
|
2143
2151
|
const showFirstLastPageButtons = numberOfPages > 2;
|
|
2144
2152
|
const firstRowIndex = pageIndex * pageSize;
|
|
2145
2153
|
const lastRowIndex = Math.min(pageIndex * pageSize + pageSize, totalRowCount);
|
|
2146
|
-
const
|
|
2154
|
+
const _b = paginationProps !== null && paginationProps !== void 0 ? paginationProps : {}, { rowsPerPageOptions = defaultRowsPerPage, showFirstButton = showFirstLastPageButtons, showLastButton = showFirstLastPageButtons, showRowsPerPage = true } = _b, _rest = __rest(_b, ["rowsPerPageOptions", "showFirstButton", "showLastButton", "showRowsPerPage"]);
|
|
2147
2155
|
return (jsxs(Box, { sx: {
|
|
2148
2156
|
alignItems: 'center',
|
|
2149
2157
|
display: 'flex',
|
|
@@ -2157,7 +2165,7 @@ const MRT_TablePagination = ({ position = 'bottom', table, }) => {
|
|
|
2157
2165
|
? '3rem'
|
|
2158
2166
|
: undefined,
|
|
2159
2167
|
position: 'relative',
|
|
2160
|
-
px: '
|
|
2168
|
+
px: '8px',
|
|
2161
2169
|
py: '12px',
|
|
2162
2170
|
zIndex: 2,
|
|
2163
2171
|
}, children: [showRowsPerPage && (jsxs(Box, { sx: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [jsx(InputLabel, { htmlFor: "mrt-rows-per-page", sx: { mb: 0 }, children: localization.rowsPerPage }), jsx(Select, { disableUnderline: true, id: "mrt-rows-per-page", inputProps: { 'aria-label': localization.rowsPerPage }, label: localization.rowsPerPage, onChange: (event) => setPageSize(+event.target.value), sx: { mb: 0 }, value: pageSize, variant: "standard", children: rowsPerPageOptions.map((value) => (jsx(MenuItem, { sx: { m: 0 }, value: value, children: value }, value))) })] })), paginationDisplayMode === 'pages' ? (jsx(Pagination, Object.assign({ count: numberOfPages, onChange: (_e, newPageIndex) => setPageIndex(newPageIndex - 1), page: pageIndex + 1, renderItem: (item) => (jsx(PaginationItem, Object.assign({ slots: {
|
|
@@ -2165,16 +2173,17 @@ const MRT_TablePagination = ({ position = 'bottom', table, }) => {
|
|
|
2165
2173
|
last: LastPageIcon,
|
|
2166
2174
|
next: ChevronRightIcon,
|
|
2167
2175
|
previous: ChevronLeftIcon,
|
|
2168
|
-
} }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton },
|
|
2176
|
+
} }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton }, _rest))) : paginationDisplayMode === 'default' ? (jsxs(Fragment, { children: [jsx(Typography, { align: "center", sx: { mb: 0, minWidth: '8ch', mx: '4px' }, variant: "body2", children: `${lastRowIndex === 0 ? 0 : (firstRowIndex + 1).toLocaleString()}-${lastRowIndex.toLocaleString()} ${localization.of} ${totalRowCount.toLocaleString()}` }), jsxs(Box, { gap: "xs", children: [showFirstButton && (jsx(IconButton, { "aria-label": localization.goToFirstPage, disabled: pageIndex <= 0, onClick: () => setPageIndex(0), size: "small", children: jsx(FirstPageIcon, {}) })), jsx(IconButton, { "aria-label": localization.goToPreviousPage, disabled: pageIndex <= 0, onClick: () => setPageIndex(pageIndex - 1), size: "small", children: jsx(ChevronLeftIcon, {}) }), jsx(IconButton, { "aria-label": localization.goToNextPage, disabled: lastRowIndex >= totalRowCount, onClick: () => setPageIndex(pageIndex + 1), size: "small", children: jsx(ChevronRightIcon, {}) }), showLastButton && (jsx(IconButton, { "aria-label": localization.goToLastPage, disabled: lastRowIndex >= totalRowCount, onClick: () => setPageIndex(numberOfPages - 1), size: "small", children: jsx(LastPageIcon, {}) }))] })] })) : null] }));
|
|
2169
2177
|
};
|
|
2170
2178
|
|
|
2171
|
-
const MRT_GlobalFilterTextField = (
|
|
2172
|
-
var
|
|
2179
|
+
const MRT_GlobalFilterTextField = (_a) => {
|
|
2180
|
+
var _b;
|
|
2181
|
+
var { table } = _a, rest = __rest(_a, ["table"]);
|
|
2173
2182
|
const { getState, options: { enableGlobalFilterModes, icons: { CloseIcon, SearchIcon }, localization, manualFiltering, muiSearchTextFieldProps, }, refs: { searchInputRef }, setGlobalFilter, } = table;
|
|
2174
2183
|
const { globalFilter, showGlobalFilter } = getState();
|
|
2175
|
-
const textFieldProps = parseFromValuesOrFunc(muiSearchTextFieldProps, {
|
|
2184
|
+
const textFieldProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiSearchTextFieldProps, {
|
|
2176
2185
|
table,
|
|
2177
|
-
});
|
|
2186
|
+
})), rest);
|
|
2178
2187
|
const isMounted = useRef(false);
|
|
2179
2188
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
2180
2189
|
const [searchValue, setSearchValue] = useState(globalFilter !== null && globalFilter !== void 0 ? globalFilter : '');
|
|
@@ -2205,7 +2214,7 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
|
2205
2214
|
isMounted.current = true;
|
|
2206
2215
|
}, [globalFilter]);
|
|
2207
2216
|
return (jsxs(Collapse, { in: showGlobalFilter, mountOnEnter: true, orientation: "horizontal", unmountOnExit: true, children: [jsx(TextField, Object.assign({ InputProps: {
|
|
2208
|
-
endAdornment: (jsx(InputAdornment, { position: "end", children: jsx(Tooltip, { arrow: true, title: (
|
|
2217
|
+
endAdornment: (jsx(InputAdornment, { position: "end", children: jsx(Tooltip, { arrow: true, title: (_b = localization.clearSearch) !== null && _b !== void 0 ? _b : '', children: jsx("span", { children: jsx(IconButton, { "aria-label": localization.clearSearch, disabled: !(searchValue === null || searchValue === void 0 ? void 0 : searchValue.length), onClick: handleClear, size: "small", children: jsx(CloseIcon, {}) }) }) }) })),
|
|
2209
2218
|
startAdornment: enableGlobalFilterModes ? (jsx(InputAdornment, { position: "start", children: jsx(Tooltip, { arrow: true, title: localization.changeSearchMode, children: jsx(IconButton, { "aria-label": localization.changeSearchMode, onClick: handleGlobalFilterMenuOpen, size: "small", sx: { height: '1.75rem', width: '1.75rem' }, children: jsx(SearchIcon, {}) }) }) })) : (jsx(SearchIcon, { style: { marginRight: '4px' } })),
|
|
2210
2219
|
}, onChange: handleChange, placeholder: localization.search, value: searchValue !== null && searchValue !== void 0 ? searchValue : '', variant: "standard" }, textFieldProps, { inputRef: (inputRef) => {
|
|
2211
2220
|
searchInputRef.current = inputRef;
|
|
@@ -2215,13 +2224,14 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
|
2215
2224
|
} })), jsx(MRT_FilterOptionMenu, { anchorEl: anchorEl, onSelect: handleClear, setAnchorEl: setAnchorEl, table: table })] }));
|
|
2216
2225
|
};
|
|
2217
2226
|
|
|
2218
|
-
const MRT_SelectCheckbox = (
|
|
2219
|
-
var
|
|
2227
|
+
const MRT_SelectCheckbox = (_a) => {
|
|
2228
|
+
var _b;
|
|
2229
|
+
var { row, selectAll, table } = _a, rest = __rest(_a, ["row", "selectAll", "table"]);
|
|
2220
2230
|
const { getState, options: { enableMultiRowSelection, enableRowPinning, localization, muiSelectAllCheckboxProps, muiSelectCheckboxProps, rowPinningDisplayMode, selectAllMode, }, } = table;
|
|
2221
2231
|
const { density, isLoading } = getState();
|
|
2222
|
-
const checkboxProps = !row
|
|
2232
|
+
const checkboxProps = Object.assign(Object.assign({}, (!row
|
|
2223
2233
|
? parseFromValuesOrFunc(muiSelectAllCheckboxProps, { table })
|
|
2224
|
-
: parseFromValuesOrFunc(muiSelectCheckboxProps, { row, table });
|
|
2234
|
+
: parseFromValuesOrFunc(muiSelectCheckboxProps, { row, table }))), rest);
|
|
2225
2235
|
const allRowsSelected = selectAll
|
|
2226
2236
|
? selectAllMode === 'page'
|
|
2227
2237
|
? table.getIsAllPageRowsSelected()
|
|
@@ -2255,25 +2265,26 @@ const MRT_SelectCheckbox = ({ row, selectAll, table, }) => {
|
|
|
2255
2265
|
e.stopPropagation();
|
|
2256
2266
|
(_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
|
|
2257
2267
|
}, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.5rem', m: density !== 'compact' ? '-0.4rem' : undefined, width: density === 'compact' ? '1.75rem' : '2.5rem', zIndex: 0 }, parseFromValuesOrFunc(checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx, theme))), title: undefined });
|
|
2258
|
-
return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (
|
|
2268
|
+
return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_b = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _b !== void 0 ? _b : (selectAll
|
|
2259
2269
|
? localization.toggleSelectAll
|
|
2260
2270
|
: localization.toggleSelectRow), children: enableMultiRowSelection === false ? (jsx(Radio, Object.assign({}, commonProps))) : (jsx(Checkbox, Object.assign({ indeterminate: selectAll
|
|
2261
2271
|
? table.getIsSomeRowsSelected() && !allRowsSelected
|
|
2262
2272
|
: row === null || row === void 0 ? void 0 : row.getIsSomeSelected() }, commonProps))) }));
|
|
2263
2273
|
};
|
|
2264
2274
|
|
|
2265
|
-
const MRT_ToolbarAlertBanner = (
|
|
2266
|
-
var
|
|
2275
|
+
const MRT_ToolbarAlertBanner = (_a) => {
|
|
2276
|
+
var _b, _c, _d;
|
|
2277
|
+
var { stackAlertBanner, table } = _a, rest = __rest(_a, ["stackAlertBanner", "table"]);
|
|
2267
2278
|
const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { enableRowSelection, enableSelectAll, localization, muiToolbarAlertBannerChipProps, muiToolbarAlertBannerProps, positionToolbarAlertBanner, renderToolbarAlertBannerContent, rowCount, }, refs: { tablePaperRef }, } = table;
|
|
2268
2279
|
const { density, grouping, showAlertBanner } = getState();
|
|
2269
|
-
const alertProps = parseFromValuesOrFunc(muiToolbarAlertBannerProps, {
|
|
2280
|
+
const alertProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiToolbarAlertBannerProps, {
|
|
2270
2281
|
table,
|
|
2271
|
-
});
|
|
2282
|
+
})), rest);
|
|
2272
2283
|
const chipProps = parseFromValuesOrFunc(muiToolbarAlertBannerChipProps, {
|
|
2273
2284
|
table,
|
|
2274
2285
|
});
|
|
2275
2286
|
const selectedAlert = getSelectedRowModel().rows.length > 0
|
|
2276
|
-
? (
|
|
2287
|
+
? (_c = (_b = localization.selectedCountOfRowCountRowsSelected) === null || _b === void 0 ? void 0 : _b.replace('{selectedCount}', getSelectedRowModel().rows.length.toString())) === null || _c === void 0 ? void 0 : _c.replace('{rowCount}', (rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length).toString())
|
|
2277
2288
|
: null;
|
|
2278
2289
|
const groupedAlert = grouping.length > 0 ? (jsxs("span", { children: [localization.groupedBy, ' ', grouping.map((columnId, index) => (jsxs(Fragment$1, { children: [index > 0 ? localization.thenBy : '', jsx(Chip, Object.assign({ label: table.getColumn(columnId).columnDef.header, onDelete: () => table.getColumn(columnId).toggleGrouping() }, chipProps))] }, `${index}-${columnId}`)))] })) : null;
|
|
2279
2290
|
return (jsx(Collapse, { in: showAlertBanner || !!selectedAlert || !!groupedAlert, timeout: stackAlertBanner ? 200 : 0, children: jsx(Alert, Object.assign({ color: "info", icon: false }, alertProps, { sx: (theme) => {
|
|
@@ -2286,11 +2297,11 @@ const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
|
|
|
2286
2297
|
: positionToolbarAlertBanner === 'bottom'
|
|
2287
2298
|
? '-1rem'
|
|
2288
2299
|
: undefined, p: 0, position: 'relative', right: 0, top: 0, width: '100%', zIndex: 2 }, parseFromValuesOrFunc(alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx, theme)));
|
|
2289
|
-
}, children: (
|
|
2300
|
+
}, children: (_d = renderToolbarAlertBannerContent === null || renderToolbarAlertBannerContent === void 0 ? void 0 : renderToolbarAlertBannerContent({
|
|
2290
2301
|
groupedAlert,
|
|
2291
2302
|
selectedAlert,
|
|
2292
2303
|
table,
|
|
2293
|
-
})) !== null &&
|
|
2304
|
+
})) !== null && _d !== void 0 ? _d : (jsxs(Fragment, { children: [(alertProps === null || alertProps === void 0 ? void 0 : alertProps.title) && jsx(AlertTitle, { children: alertProps.title }), jsxs(Stack, { sx: {
|
|
2294
2305
|
p: positionToolbarAlertBanner !== 'head-overlay'
|
|
2295
2306
|
? '0.5rem 1rem'
|
|
2296
2307
|
: density === 'spacious'
|
|
@@ -2303,8 +2314,9 @@ const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
|
|
|
2303
2314
|
positionToolbarAlertBanner === 'head-overlay' && (jsx(MRT_SelectCheckbox, { selectAll: true, table: table })), ' ', selectedAlert] }), selectedAlert && groupedAlert && jsx("br", {}), groupedAlert] })] })) })) }));
|
|
2304
2315
|
};
|
|
2305
2316
|
|
|
2306
|
-
const MRT_ToolbarDropZone = (
|
|
2307
|
-
var
|
|
2317
|
+
const MRT_ToolbarDropZone = (_a) => {
|
|
2318
|
+
var _b, _c;
|
|
2319
|
+
var { table } = _a, rest = __rest(_a, ["table"]);
|
|
2308
2320
|
const { getState, options: { enableGrouping, localization }, setHoveredColumn, setShowToolbarDropZone, } = table;
|
|
2309
2321
|
const { draggingColumn, grouping, hoveredColumn, showToolbarDropZone } = getState();
|
|
2310
2322
|
const handleDragEnter = (_event) => {
|
|
@@ -2319,35 +2331,25 @@ const MRT_ToolbarDropZone = ({ table, }) => {
|
|
|
2319
2331
|
!grouping.includes(draggingColumn.id));
|
|
2320
2332
|
}
|
|
2321
2333
|
}, [enableGrouping, draggingColumn, grouping]);
|
|
2322
|
-
return (jsx(Fade, { in: showToolbarDropZone, children: jsx(Box, { className: "Mui-ToolbarDropZone", onDragEnter: handleDragEnter, sx: (theme) => ({
|
|
2323
|
-
alignItems: 'center',
|
|
2324
|
-
backdropFilter: 'blur(4px)',
|
|
2325
|
-
backgroundColor: alpha(theme.palette.info.main, (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone' ? 0.2 : 0.1),
|
|
2326
|
-
border: `dashed ${theme.palette.info.main} 2px`,
|
|
2327
|
-
boxSizing: 'border-box',
|
|
2328
|
-
display: 'flex',
|
|
2329
|
-
height: '100%',
|
|
2330
|
-
justifyContent: 'center',
|
|
2331
|
-
position: 'absolute',
|
|
2332
|
-
width: '100%',
|
|
2333
|
-
zIndex: 4,
|
|
2334
|
-
}), children: jsx(Typography, { fontStyle: "italic", children: localization.dropToGroupBy.replace('{column}', (_b = (_a = draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.columnDef) === null || _a === void 0 ? void 0 : _a.header) !== null && _b !== void 0 ? _b : '') }) }) }));
|
|
2334
|
+
return (jsx(Fade, { in: showToolbarDropZone, children: jsx(Box, Object.assign({ className: "Mui-ToolbarDropZone", onDragEnter: handleDragEnter }, rest, { sx: (theme) => (Object.assign({ alignItems: 'center', backdropFilter: 'blur(4px)', backgroundColor: alpha(theme.palette.info.main, (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone' ? 0.2 : 0.1), border: `dashed ${theme.palette.info.main} 2px`, boxSizing: 'border-box', display: 'flex', height: '100%', justifyContent: 'center', position: 'absolute', width: '100%', zIndex: 4 }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: jsx(Typography, { fontStyle: "italic", children: localization.dropToGroupBy.replace('{column}', (_c = (_b = draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.columnDef) === null || _b === void 0 ? void 0 : _b.header) !== null && _c !== void 0 ? _c : '') }) })) }));
|
|
2335
2335
|
};
|
|
2336
2336
|
|
|
2337
|
-
const MRT_ColumnPinningButtons = (
|
|
2337
|
+
const MRT_ColumnPinningButtons = (_a) => {
|
|
2338
|
+
var { column, table } = _a, rest = __rest(_a, ["column", "table"]);
|
|
2338
2339
|
const { options: { icons: { PushPinIcon }, localization, }, } = table;
|
|
2339
2340
|
const handlePinColumn = (pinDirection) => {
|
|
2340
2341
|
column.pin(pinDirection);
|
|
2341
2342
|
};
|
|
2342
|
-
return (jsx(Box, { sx: { minWidth: '70px', textAlign: 'center' }, children: column.getIsPinned() ? (jsx(Tooltip, { arrow: true, title: localization.unpin, children: jsx(IconButton, { onClick: () => handlePinColumn(false), size: "small", children: jsx(PushPinIcon, {}) }) })) : (jsxs(Fragment, { children: [jsx(Tooltip, { arrow: true, title: localization.pinToLeft, children: jsx(IconButton, { onClick: () => handlePinColumn('left'), size: "small", children: jsx(PushPinIcon, { style: {
|
|
2343
|
+
return (jsx(Box, Object.assign({}, rest, { sx: (theme) => (Object.assign({ minWidth: '70px', textAlign: 'center' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: column.getIsPinned() ? (jsx(Tooltip, { arrow: true, title: localization.unpin, children: jsx(IconButton, { onClick: () => handlePinColumn(false), size: "small", children: jsx(PushPinIcon, {}) }) })) : (jsxs(Fragment, { children: [jsx(Tooltip, { arrow: true, title: localization.pinToLeft, children: jsx(IconButton, { onClick: () => handlePinColumn('left'), size: "small", children: jsx(PushPinIcon, { style: {
|
|
2343
2344
|
transform: 'rotate(90deg)',
|
|
2344
2345
|
} }) }) }), jsx(Tooltip, { arrow: true, title: localization.pinToRight, children: jsx(IconButton, { onClick: () => handlePinColumn('right'), size: "small", children: jsx(PushPinIcon, { style: {
|
|
2345
2346
|
transform: 'rotate(-90deg)',
|
|
2346
|
-
} }) }) })] })) }));
|
|
2347
|
+
} }) }) })] })) })));
|
|
2347
2348
|
};
|
|
2348
2349
|
|
|
2349
|
-
const MRT_ShowHideColumnsMenuItems = (
|
|
2350
|
-
var
|
|
2350
|
+
const MRT_ShowHideColumnsMenuItems = (_a) => {
|
|
2351
|
+
var _b;
|
|
2352
|
+
var { allColumns, column, hoveredColumn, setHoveredColumn, table } = _a, rest = __rest(_a, ["allColumns", "column", "hoveredColumn", "setHoveredColumn", "table"]);
|
|
2351
2353
|
const { getState, options: { enableColumnOrdering, enableColumnPinning, enableHiding, localization, }, setColumnOrder, } = table;
|
|
2352
2354
|
const { columnOrder } = getState();
|
|
2353
2355
|
const { columnDef } = column;
|
|
@@ -2384,20 +2386,11 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, column, hoveredColumn, setHo
|
|
|
2384
2386
|
setHoveredColumn(column);
|
|
2385
2387
|
}
|
|
2386
2388
|
};
|
|
2387
|
-
return (jsxs(Fragment, { children: [jsx(MenuItem, { disableRipple: true, onDragEnter: handleDragEnter, ref: menuItemRef, sx: (theme) => ({
|
|
2388
|
-
alignItems: 'center',
|
|
2389
|
-
justifyContent: 'flex-start',
|
|
2390
|
-
my: 0,
|
|
2391
|
-
opacity: isDragging ? 0.5 : 1,
|
|
2392
|
-
outline: isDragging
|
|
2389
|
+
return (jsxs(Fragment, { children: [jsx(MenuItem, Object.assign({ disableRipple: true, onDragEnter: handleDragEnter, ref: menuItemRef }, rest, { sx: (theme) => (Object.assign({ alignItems: 'center', justifyContent: 'flex-start', my: 0, opacity: isDragging ? 0.5 : 1, outline: isDragging
|
|
2393
2390
|
? `2px dashed ${theme.palette.divider}`
|
|
2394
2391
|
: (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
|
|
2395
2392
|
? `2px dashed ${theme.palette.primary.main}`
|
|
2396
|
-
: 'none',
|
|
2397
|
-
outlineOffset: '-2px',
|
|
2398
|
-
pl: `${(column.depth + 0.5) * 2}rem`,
|
|
2399
|
-
py: '6px',
|
|
2400
|
-
}), children: jsxs(Box, { sx: {
|
|
2393
|
+
: 'none', outlineOffset: '-2px', pl: `${(column.depth + 0.5) * 2}rem`, py: '6px' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: jsxs(Box, { sx: {
|
|
2401
2394
|
display: 'flex',
|
|
2402
2395
|
flexWrap: 'nowrap',
|
|
2403
2396
|
gap: '8px',
|
|
@@ -2412,10 +2405,11 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, column, hoveredColumn, setHo
|
|
|
2412
2405
|
opacity: columnDefType !== 'display' ? 1 : 0.5,
|
|
2413
2406
|
},
|
|
2414
2407
|
},
|
|
2415
|
-
}, control: jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.toggleVisibility, children: jsx(Switch, {}) }), disabled: !column.getCanHide(), label: columnDef.header, onChange: () => handleToggleColumnHidden(column) })) : (jsx(Typography, { sx: { alignSelf: 'center' }, children: columnDef.header }))] }) }), (
|
|
2408
|
+
}, control: jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.toggleVisibility, children: jsx(Switch, {}) }), disabled: !column.getCanHide(), label: columnDef.header, onChange: () => handleToggleColumnHidden(column) })) : (jsx(Typography, { sx: { alignSelf: 'center' }, children: columnDef.header }))] }) })), (_b = column.columns) === null || _b === void 0 ? void 0 : _b.map((c, i) => (jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: c, hoveredColumn: hoveredColumn, setHoveredColumn: setHoveredColumn, table: table }, `${i}-${c.id}`)))] }));
|
|
2416
2409
|
};
|
|
2417
2410
|
|
|
2418
|
-
const MRT_ShowHideColumnsMenu = (
|
|
2411
|
+
const MRT_ShowHideColumnsMenu = (_a) => {
|
|
2412
|
+
var { anchorEl, setAnchorEl, table } = _a, rest = __rest(_a, ["anchorEl", "setAnchorEl", "table"]);
|
|
2419
2413
|
const { getAllColumns, getAllLeafColumns, getCenterLeafColumns, getIsAllColumnsVisible, getIsSomeColumnsPinned, getIsSomeColumnsVisible, getLeftLeafColumns, getRightLeafColumns, getState, options: { enableColumnOrdering, enableColumnPinning, enableHiding, localization, }, toggleAllColumnsVisible, } = table;
|
|
2420
2414
|
const { columnOrder, columnPinning, density } = getState();
|
|
2421
2415
|
const hideAllColumns = () => {
|
|
@@ -2443,14 +2437,14 @@ const MRT_ShowHideColumnsMenu = ({ anchorEl, setAnchorEl, table, }) => {
|
|
|
2443
2437
|
getRightLeafColumns(),
|
|
2444
2438
|
]);
|
|
2445
2439
|
const [hoveredColumn, setHoveredColumn] = useState(null);
|
|
2446
|
-
return (jsxs(Menu, { MenuListProps: {
|
|
2440
|
+
return (jsxs(Menu, Object.assign({ MenuListProps: {
|
|
2447
2441
|
dense: density === 'compact',
|
|
2448
|
-
}, anchorEl: anchorEl, onClose: () => setAnchorEl(null), open: !!anchorEl, children: [jsxs(Box, { sx: {
|
|
2442
|
+
}, anchorEl: anchorEl, onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: [jsxs(Box, { sx: {
|
|
2449
2443
|
display: 'flex',
|
|
2450
2444
|
justifyContent: 'space-between',
|
|
2451
2445
|
p: '0.5rem',
|
|
2452
2446
|
pt: 0,
|
|
2453
|
-
}, children: [enableHiding && (jsx(Button, { disabled: !getIsSomeColumnsVisible(), onClick: hideAllColumns, children: localization.hideAll })), enableColumnOrdering && (jsx(Button, { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options)), children: localization.resetOrder })), enableColumnPinning && (jsx(Button, { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true), children: localization.unpinAll })), enableHiding && (jsx(Button, { disabled: getIsAllColumnsVisible(), onClick: () => toggleAllColumnsVisible(true), children: localization.showAll }))] }), jsx(Divider, {}), allColumns.map((column, index) => (jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, setHoveredColumn: setHoveredColumn, table: table }, `${index}-${column.id}`)))] }));
|
|
2447
|
+
}, children: [enableHiding && (jsx(Button, { disabled: !getIsSomeColumnsVisible(), onClick: hideAllColumns, children: localization.hideAll })), enableColumnOrdering && (jsx(Button, { onClick: () => table.setColumnOrder(getDefaultColumnOrderIds(table.options)), children: localization.resetOrder })), enableColumnPinning && (jsx(Button, { disabled: !getIsSomeColumnsPinned(), onClick: () => table.resetColumnPinning(true), children: localization.unpinAll })), enableHiding && (jsx(Button, { disabled: getIsAllColumnsVisible(), onClick: () => toggleAllColumnsVisible(true), children: localization.showAll }))] }), jsx(Divider, {}), allColumns.map((column, index) => (jsx(MRT_ShowHideColumnsMenuItems, { allColumns: allColumns, column: column, hoveredColumn: hoveredColumn, setHoveredColumn: setHoveredColumn, table: table }, `${index}-${column.id}`)))] })));
|
|
2454
2448
|
};
|
|
2455
2449
|
|
|
2456
2450
|
const MRT_ShowHideColumnsButton = (_a) => {
|
|
@@ -2516,31 +2510,27 @@ const MRT_ToggleGlobalFilterButton = (_a) => {
|
|
|
2516
2510
|
return (jsx(Tooltip, { arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.showHideSearch, children: jsx(IconButton, Object.assign({ "aria-label": (_c = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _c !== void 0 ? _c : localization.showHideSearch, disabled: !!globalFilter, onClick: handleToggleSearch }, rest, { title: undefined, children: showGlobalFilter ? jsx(SearchOffIcon, {}) : jsx(SearchIcon, {}) })) }));
|
|
2517
2511
|
};
|
|
2518
2512
|
|
|
2519
|
-
const MRT_ToolbarInternalButtons = (
|
|
2520
|
-
var
|
|
2513
|
+
const MRT_ToolbarInternalButtons = (_a) => {
|
|
2514
|
+
var _b;
|
|
2515
|
+
var { table } = _a, rest = __rest(_a, ["table"]);
|
|
2521
2516
|
const { options: { columnFilterDisplayMode, enableColumnFilters, enableColumnOrdering, enableColumnPinning, enableDensityToggle, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, initialState, renderToolbarInternalActions, }, } = table;
|
|
2522
|
-
return (jsx(Box, { sx: {
|
|
2523
|
-
alignItems: 'center',
|
|
2524
|
-
display: 'flex',
|
|
2525
|
-
zIndex: 3,
|
|
2526
|
-
}, children: (_a = renderToolbarInternalActions === null || renderToolbarInternalActions === void 0 ? void 0 : renderToolbarInternalActions({
|
|
2517
|
+
return (jsx(Box, Object.assign({}, rest, { sx: (theme) => (Object.assign({ alignItems: 'center', display: 'flex', zIndex: 3 }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: (_b = renderToolbarInternalActions === null || renderToolbarInternalActions === void 0 ? void 0 : renderToolbarInternalActions({
|
|
2527
2518
|
table,
|
|
2528
|
-
})) !== null &&
|
|
2519
|
+
})) !== null && _b !== void 0 ? _b : (jsxs(Fragment, { children: [enableFilters &&
|
|
2529
2520
|
enableGlobalFilter &&
|
|
2530
2521
|
!(initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) && (jsx(MRT_ToggleGlobalFilterButton, { table: table })), enableFilters &&
|
|
2531
2522
|
enableColumnFilters &&
|
|
2532
|
-
columnFilterDisplayMode !== 'popover' && (jsx(MRT_ToggleFiltersButton, { table: table })), (enableHiding || enableColumnOrdering || enableColumnPinning) && (jsx(MRT_ShowHideColumnsButton, { table: table })), enableDensityToggle && (jsx(MRT_ToggleDensePaddingButton, { table: table })), enableFullScreenToggle && (jsx(MRT_ToggleFullScreenButton, { table: table }))] })) }));
|
|
2523
|
+
columnFilterDisplayMode !== 'popover' && (jsx(MRT_ToggleFiltersButton, { table: table })), (enableHiding || enableColumnOrdering || enableColumnPinning) && (jsx(MRT_ShowHideColumnsButton, { table: table })), enableDensityToggle && (jsx(MRT_ToggleDensePaddingButton, { table: table })), enableFullScreenToggle && (jsx(MRT_ToggleFullScreenButton, { table: table }))] })) })));
|
|
2533
2524
|
};
|
|
2534
2525
|
|
|
2535
2526
|
const commonToolbarStyles = ({ theme }) => ({
|
|
2536
2527
|
alignItems: 'flex-start',
|
|
2537
2528
|
backgroundColor: lighten(theme.palette.background.default, 0.05),
|
|
2538
|
-
backgroundImage: 'none',
|
|
2539
2529
|
display: 'grid',
|
|
2540
2530
|
flexWrap: 'wrap-reverse',
|
|
2541
2531
|
minHeight: '3.5rem',
|
|
2542
2532
|
overflow: 'hidden',
|
|
2543
|
-
|
|
2533
|
+
position: 'relative',
|
|
2544
2534
|
transition: 'all 150ms ease-in-out',
|
|
2545
2535
|
zIndex: 1,
|
|
2546
2536
|
});
|
|
@@ -2551,13 +2541,13 @@ const MRT_TopToolbar = ({ table, }) => {
|
|
|
2551
2541
|
const isMobile = useMediaQuery('(max-width:720px)');
|
|
2552
2542
|
const toolbarProps = parseFromValuesOrFunc(muiTopToolbarProps, { table });
|
|
2553
2543
|
const stackAlertBanner = isMobile || !!renderTopToolbarCustomActions || showGlobalFilter;
|
|
2554
|
-
return (jsxs(
|
|
2544
|
+
return (jsxs(Box, Object.assign({}, toolbarProps, { ref: (ref) => {
|
|
2555
2545
|
topToolbarRef.current = ref;
|
|
2556
2546
|
if (toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.ref) {
|
|
2557
2547
|
// @ts-ignore
|
|
2558
2548
|
toolbarProps.ref.current = ref;
|
|
2559
2549
|
}
|
|
2560
|
-
}, sx: (theme) => (Object.assign(Object.assign({ position: isFullScreen ? 'sticky' :
|
|
2550
|
+
}, sx: (theme) => (Object.assign(Object.assign(Object.assign({}, commonToolbarStyles({ theme })), { position: isFullScreen ? 'sticky' : 'relative', top: isFullScreen ? '0' : undefined }), parseFromValuesOrFunc(toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx, theme))), children: [positionToolbarAlertBanner === 'top' && (jsx(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })), ['both', 'top'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (jsx(MRT_ToolbarDropZone, { table: table })), jsxs(Box, { sx: {
|
|
2561
2551
|
alignItems: 'flex-start',
|
|
2562
2552
|
boxSizing: 'border-box',
|
|
2563
2553
|
display: 'flex',
|
|
@@ -2576,13 +2566,14 @@ const MRT_TopToolbar = ({ table, }) => {
|
|
|
2576
2566
|
['both', 'top'].includes(positionPagination !== null && positionPagination !== void 0 ? positionPagination : '') && (jsx(MRT_TablePagination, { position: "top", table: table })), jsx(MRT_LinearProgressBar, { isTopToolbar: true, table: table })] })));
|
|
2577
2567
|
};
|
|
2578
2568
|
|
|
2579
|
-
const MRT_BottomToolbar = (
|
|
2569
|
+
const MRT_BottomToolbar = (_a) => {
|
|
2570
|
+
var { table } = _a, rest = __rest(_a, ["table"]);
|
|
2580
2571
|
const { getState, options: { enablePagination, muiBottomToolbarProps, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderBottomToolbarCustomActions, }, refs: { bottomToolbarRef }, } = table;
|
|
2581
2572
|
const { isFullScreen } = getState();
|
|
2582
2573
|
const isMobile = useMediaQuery('(max-width:720px)');
|
|
2583
|
-
const toolbarProps = parseFromValuesOrFunc(muiBottomToolbarProps, { table });
|
|
2574
|
+
const toolbarProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiBottomToolbarProps, { table })), rest);
|
|
2584
2575
|
const stackAlertBanner = isMobile || !!renderBottomToolbarCustomActions;
|
|
2585
|
-
return (jsxs(
|
|
2576
|
+
return (jsxs(Box, Object.assign({}, toolbarProps, { ref: (node) => {
|
|
2586
2577
|
if (node) {
|
|
2587
2578
|
bottomToolbarRef.current = node;
|
|
2588
2579
|
if (toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.ref) {
|
|
@@ -2607,10 +2598,11 @@ const MRT_BottomToolbar = ({ table, }) => {
|
|
|
2607
2598
|
['both', 'bottom'].includes(positionPagination !== null && positionPagination !== void 0 ? positionPagination : '') && (jsx(MRT_TablePagination, { position: "bottom", table: table })) })] })] })));
|
|
2608
2599
|
};
|
|
2609
2600
|
|
|
2610
|
-
const MRT_TableHead = (
|
|
2601
|
+
const MRT_TableHead = (_a) => {
|
|
2602
|
+
var { table, virtualColumns, virtualPaddingLeft, virtualPaddingRight } = _a, rest = __rest(_a, ["table", "virtualColumns", "virtualPaddingLeft", "virtualPaddingRight"]);
|
|
2611
2603
|
const { getHeaderGroups, getSelectedRowModel, getState, options: { enableStickyHeader, layoutMode, muiTableHeadProps, positionToolbarAlertBanner, }, refs: { tableHeadRef }, } = table;
|
|
2612
2604
|
const { isFullScreen, showAlertBanner } = getState();
|
|
2613
|
-
const tableHeadProps = parseFromValuesOrFunc(muiTableHeadProps, { table });
|
|
2605
|
+
const tableHeadProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableHeadProps, { table })), rest);
|
|
2614
2606
|
const stickyHeader = enableStickyHeader || isFullScreen;
|
|
2615
2607
|
return (jsx(TableHead, Object.assign({}, tableHeadProps, { ref: (ref) => {
|
|
2616
2608
|
tableHeadRef.current = ref;
|
|
@@ -2622,16 +2614,17 @@ const MRT_TableHead = ({ table, virtualColumns, virtualPaddingLeft, virtualPaddi
|
|
|
2622
2614
|
(showAlertBanner || getSelectedRowModel().rows.length > 0) ? (jsx("tr", { style: {
|
|
2623
2615
|
display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined,
|
|
2624
2616
|
}, children: jsx("th", { colSpan: table.getVisibleLeafColumns().length, style: {
|
|
2625
|
-
display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' :
|
|
2617
|
+
display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined,
|
|
2626
2618
|
padding: 0,
|
|
2627
2619
|
}, children: jsx(MRT_ToolbarAlertBanner, { table: table }) }) })) : (getHeaderGroups().map((headerGroup) => (jsx(MRT_TableHeadRow, { headerGroup: headerGroup, table: table, virtualColumns: virtualColumns, virtualPaddingLeft: virtualPaddingLeft, virtualPaddingRight: virtualPaddingRight }, headerGroup.id)))) })));
|
|
2628
2620
|
};
|
|
2629
2621
|
|
|
2630
|
-
const MRT_Table = (
|
|
2631
|
-
var
|
|
2632
|
-
|
|
2622
|
+
const MRT_Table = (_a) => {
|
|
2623
|
+
var _b, _c, _d, _e;
|
|
2624
|
+
var { table } = _a, rest = __rest(_a, ["table"]);
|
|
2625
|
+
const { getFlatHeaders, getState, options: { columnVirtualizerInstanceRef, columnVirtualizerOptions, columns, enableColumnPinning, enableColumnVirtualization, enableStickyHeader, enableTableFooter, enableTableHead, layoutMode, memoMode, muiTableProps, }, refs: { tableContainerRef }, } = table;
|
|
2633
2626
|
const { columnPinning, columnSizing, columnSizingInfo, columnVisibility, draggingColumn, isFullScreen, } = getState();
|
|
2634
|
-
const tableProps = parseFromValuesOrFunc(muiTableProps, { table });
|
|
2627
|
+
const tableProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableProps, { table })), rest);
|
|
2635
2628
|
const columnVirtualizerProps = parseFromValuesOrFunc(columnVirtualizerOptions, { table });
|
|
2636
2629
|
const columnSizeVars = useMemo(() => {
|
|
2637
2630
|
const headers = getFlatHeaders();
|
|
@@ -2686,10 +2679,10 @@ const MRT_Table = ({ table, }) => {
|
|
|
2686
2679
|
let virtualPaddingLeft;
|
|
2687
2680
|
let virtualPaddingRight;
|
|
2688
2681
|
if (columnVirtualizer && (virtualColumns === null || virtualColumns === void 0 ? void 0 : virtualColumns.length)) {
|
|
2689
|
-
virtualPaddingLeft = (
|
|
2682
|
+
virtualPaddingLeft = (_c = (_b = virtualColumns[leftPinnedIndexes.length]) === null || _b === void 0 ? void 0 : _b.start) !== null && _c !== void 0 ? _c : 0;
|
|
2690
2683
|
virtualPaddingRight =
|
|
2691
2684
|
columnVirtualizer.getTotalSize() -
|
|
2692
|
-
((
|
|
2685
|
+
((_e = (_d = virtualColumns[virtualColumns.length - 1 - rightPinnedIndexes.length]) === null || _d === void 0 ? void 0 : _d.end) !== null && _e !== void 0 ? _e : 0);
|
|
2693
2686
|
}
|
|
2694
2687
|
const props = {
|
|
2695
2688
|
table,
|
|
@@ -2697,12 +2690,31 @@ const MRT_Table = ({ table, }) => {
|
|
|
2697
2690
|
virtualPaddingLeft,
|
|
2698
2691
|
virtualPaddingRight,
|
|
2699
2692
|
};
|
|
2700
|
-
return (
|
|
2701
|
-
? 'fixed'
|
|
2702
|
-
: undefined }, parseFromValuesOrFunc(tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx, theme))), children: [enableTableHead && jsx(MRT_TableHead, Object.assign({}, props)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsx(Memo_MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))) : (jsx(MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))), enableTableFooter && jsx(MRT_TableFooter, Object.assign({}, props))] })) }));
|
|
2693
|
+
return (jsxs(Table, Object.assign({ stickyHeader: enableStickyHeader || isFullScreen }, tableProps, { style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style), sx: (theme) => (Object.assign({ borderCollapse: 'separate', display: (layoutMode === null || layoutMode === void 0 ? void 0 : layoutMode.startsWith('grid')) ? 'grid' : undefined }, parseFromValuesOrFunc(tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx, theme))), children: [enableTableHead && jsx(MRT_TableHead, Object.assign({}, props)), memoMode === 'table-body' || columnSizingInfo.isResizingColumn ? (jsx(Memo_MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))) : (jsx(MRT_TableBody, Object.assign({ columnVirtualizer: columnVirtualizer }, props))), enableTableFooter && jsx(MRT_TableFooter, Object.assign({}, props))] })));
|
|
2703
2694
|
};
|
|
2704
2695
|
|
|
2705
|
-
const
|
|
2696
|
+
const MRT_TableLoadingOverlay = (_a) => {
|
|
2697
|
+
var { table } = _a, rest = __rest(_a, ["table"]);
|
|
2698
|
+
const { options: { localization, muiCircularProgressProps }, } = table;
|
|
2699
|
+
const circularProgressProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiCircularProgressProps, { table })), rest);
|
|
2700
|
+
return (jsx(Box, { sx: (theme) => ({
|
|
2701
|
+
alignItems: 'center',
|
|
2702
|
+
backgroundColor: alpha(lighten(theme.palette.background.paper, 0.05), 0.5),
|
|
2703
|
+
bottom: 0,
|
|
2704
|
+
display: 'flex',
|
|
2705
|
+
justifyContent: 'center',
|
|
2706
|
+
left: 0,
|
|
2707
|
+
maxHeight: '100vh',
|
|
2708
|
+
position: 'absolute',
|
|
2709
|
+
right: 0,
|
|
2710
|
+
top: 0,
|
|
2711
|
+
width: '100%',
|
|
2712
|
+
zIndex: 2,
|
|
2713
|
+
}), children: jsx(CircularProgress, Object.assign({ "aria-label": localization.noRecordsToDisplay, id: "mrt-progress" }, circularProgressProps)) }));
|
|
2714
|
+
};
|
|
2715
|
+
|
|
2716
|
+
const MRT_EditActionButtons = (_a) => {
|
|
2717
|
+
var { row, table, variant = 'icon' } = _a, rest = __rest(_a, ["row", "table", "variant"]);
|
|
2706
2718
|
const { getState, options: { icons: { CancelIcon, SaveIcon }, localization, onCreatingRowCancel, onCreatingRowSave, onEditingRowCancel, onEditingRowSave, }, refs: { editInputRefs }, setCreatingRow, setEditingRow, } = table;
|
|
2707
2719
|
const { creatingRow, editingRow, isSaving } = getState();
|
|
2708
2720
|
const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
|
|
@@ -2745,16 +2757,17 @@ const MRT_EditActionButtons = ({ row, table, variant = 'icon', }) => {
|
|
|
2745
2757
|
});
|
|
2746
2758
|
}
|
|
2747
2759
|
};
|
|
2748
|
-
return (jsx(Box, { onClick: (e) => e.stopPropagation(), sx: { display: 'flex', gap: '0.75rem' }, children: variant === 'icon' ? (jsxs(Fragment, { children: [jsx(Tooltip, { arrow: true, title: localization.cancel, children: jsx(IconButton, { "aria-label": localization.cancel, onClick: handleCancel, children: jsx(CancelIcon, {}) }) }), jsx(Tooltip, { arrow: true, title: localization.save, children: jsx(IconButton, { "aria-label": localization.save, color: "info", onClick: handleSubmitRow, children: isSaving ? jsx(CircularProgress, { size: 18 }) : jsx(SaveIcon, {}) }) })] })) : (jsxs(Fragment, { children: [jsx(Button, { onClick: handleCancel, sx: { minWidth: '100px' }, children: localization.cancel }), jsxs(Button, { onClick: handleSubmitRow, sx: { minWidth: '100px' }, variant: "contained", children: [isSaving && jsx(CircularProgress, { color: "inherit", size: 18 }), localization.save] })] })) }));
|
|
2760
|
+
return (jsx(Box, { onClick: (e) => e.stopPropagation(), sx: (theme) => (Object.assign({ display: 'flex', gap: '0.75rem' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: variant === 'icon' ? (jsxs(Fragment, { children: [jsx(Tooltip, { arrow: true, title: localization.cancel, children: jsx(IconButton, { "aria-label": localization.cancel, onClick: handleCancel, children: jsx(CancelIcon, {}) }) }), jsx(Tooltip, { arrow: true, title: localization.save, children: jsx(IconButton, { "aria-label": localization.save, color: "info", onClick: handleSubmitRow, children: isSaving ? jsx(CircularProgress, { size: 18 }) : jsx(SaveIcon, {}) }) })] })) : (jsxs(Fragment, { children: [jsx(Button, { onClick: handleCancel, sx: { minWidth: '100px' }, children: localization.cancel }), jsxs(Button, { onClick: handleSubmitRow, sx: { minWidth: '100px' }, variant: "contained", children: [isSaving && jsx(CircularProgress, { color: "inherit", size: 18 }), localization.save] })] })) }));
|
|
2749
2761
|
};
|
|
2750
2762
|
|
|
2751
|
-
const MRT_EditRowModal = (
|
|
2752
|
-
var
|
|
2763
|
+
const MRT_EditRowModal = (_a) => {
|
|
2764
|
+
var _b;
|
|
2765
|
+
var { open, table } = _a, rest = __rest(_a, ["open", "table"]);
|
|
2753
2766
|
const { getState, options: { localization, muiCreateRowModalProps, muiEditRowModalProps, onCreatingRowCancel, onEditingRowCancel, renderCreateRowModalContent, renderEditRowModalContent, }, setCreatingRow, setEditingRow, } = table;
|
|
2754
2767
|
const { creatingRow, editingRow } = getState();
|
|
2755
2768
|
const row = (creatingRow !== null && creatingRow !== void 0 ? creatingRow : editingRow);
|
|
2756
|
-
const dialogProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditRowModalProps, { row, table })), (creatingRow &&
|
|
2757
|
-
parseFromValuesOrFunc(muiCreateRowModalProps, { row, table })));
|
|
2769
|
+
const dialogProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiEditRowModalProps, { row, table })), (creatingRow &&
|
|
2770
|
+
parseFromValuesOrFunc(muiCreateRowModalProps, { row, table }))), rest);
|
|
2758
2771
|
const internalEditComponents = row
|
|
2759
2772
|
.getAllCells()
|
|
2760
2773
|
.filter((cell) => cell.column.columnDef.columnDefType === 'data')
|
|
@@ -2771,7 +2784,7 @@ const MRT_EditRowModal = ({ open, table, }) => {
|
|
|
2771
2784
|
}
|
|
2772
2785
|
row._valuesCache = {}; //reset values cache
|
|
2773
2786
|
(_a = dialogProps.onClose) === null || _a === void 0 ? void 0 : _a.call(dialogProps, event, reason);
|
|
2774
|
-
}, open: open }, dialogProps, { children: (
|
|
2787
|
+
}, open: open }, dialogProps, { children: (_b = ((creatingRow &&
|
|
2775
2788
|
(renderCreateRowModalContent === null || renderCreateRowModalContent === void 0 ? void 0 : renderCreateRowModalContent({
|
|
2776
2789
|
internalEditComponents,
|
|
2777
2790
|
row,
|
|
@@ -2781,23 +2794,23 @@ const MRT_EditRowModal = ({ open, table, }) => {
|
|
|
2781
2794
|
internalEditComponents,
|
|
2782
2795
|
row,
|
|
2783
2796
|
table,
|
|
2784
|
-
})))) !== null &&
|
|
2785
|
-
gap: '
|
|
2797
|
+
})))) !== null && _b !== void 0 ? _b : (jsxs(Fragment, { children: [jsx(DialogTitle, { sx: { textAlign: 'center' }, children: localization.edit }), jsx(DialogContent, { children: jsx("form", { onSubmit: (e) => e.preventDefault(), children: jsx(Stack, { sx: {
|
|
2798
|
+
gap: '32px',
|
|
2786
2799
|
paddingTop: '16px',
|
|
2787
2800
|
width: '100%',
|
|
2788
2801
|
}, children: internalEditComponents }) }) }), jsx(DialogActions, { sx: { p: '1.25rem' }, children: jsx(MRT_EditActionButtons, { row: row, table: table, variant: "text" }) })] })) })));
|
|
2789
2802
|
};
|
|
2790
2803
|
|
|
2791
2804
|
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
2792
|
-
const MRT_TableContainer = (
|
|
2793
|
-
|
|
2805
|
+
const MRT_TableContainer = (_a) => {
|
|
2806
|
+
var { table } = _a, rest = __rest(_a, ["table"]);
|
|
2807
|
+
const { getState, options: { createDisplayMode, editDisplayMode, enableStickyHeader, muiTableContainerProps, }, refs: { bottomToolbarRef, tableContainerRef, topToolbarRef }, } = table;
|
|
2794
2808
|
const { creatingRow, editingRow, isFullScreen, isLoading, showLoadingOverlay, } = getState();
|
|
2795
|
-
const loading = (isLoading || showLoadingOverlay)
|
|
2809
|
+
const loading = showLoadingOverlay !== false && (isLoading || showLoadingOverlay);
|
|
2796
2810
|
const [totalToolbarHeight, setTotalToolbarHeight] = useState(0);
|
|
2797
|
-
const tableContainerProps = parseFromValuesOrFunc(muiTableContainerProps, {
|
|
2811
|
+
const tableContainerProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableContainerProps, {
|
|
2798
2812
|
table,
|
|
2799
|
-
});
|
|
2800
|
-
const circularProgressProps = parseFromValuesOrFunc(muiCircularProgressProps, { table });
|
|
2813
|
+
})), rest);
|
|
2801
2814
|
useIsomorphicLayoutEffect(() => {
|
|
2802
2815
|
var _a, _b, _c, _d;
|
|
2803
2816
|
const topToolbarHeight = typeof document !== 'undefined'
|
|
@@ -2810,7 +2823,7 @@ const MRT_TableContainer = ({ table, }) => {
|
|
|
2810
2823
|
});
|
|
2811
2824
|
const createModalOpen = createDisplayMode === 'modal' && creatingRow;
|
|
2812
2825
|
const editModalOpen = editDisplayMode === 'modal' && editingRow;
|
|
2813
|
-
return (jsxs(TableContainer, Object.assign({ "aria-busy": loading, "aria-describedby":
|
|
2826
|
+
return (jsxs(TableContainer, Object.assign({ "aria-busy": loading, "aria-describedby": loading ? 'mrt-progress' : undefined }, tableContainerProps, { ref: (node) => {
|
|
2814
2827
|
if (node) {
|
|
2815
2828
|
tableContainerRef.current = node;
|
|
2816
2829
|
if (tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.ref) {
|
|
@@ -2822,27 +2835,15 @@ const MRT_TableContainer = ({ table, }) => {
|
|
|
2822
2835
|
? `calc(100vh - ${totalToolbarHeight}px)`
|
|
2823
2836
|
: undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style), sx: (theme) => (Object.assign({ maxHeight: enableStickyHeader
|
|
2824
2837
|
? `clamp(350px, calc(100vh - ${totalToolbarHeight}px), 9999px)`
|
|
2825
|
-
: undefined, maxWidth: '100%', overflow: 'auto', position: 'relative' }, parseFromValuesOrFunc(tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx, theme))), children: [loading ? (jsx(
|
|
2826
|
-
alignItems: 'center',
|
|
2827
|
-
backgroundColor: alpha(lighten(theme.palette.background.paper, 0.05), 0.5),
|
|
2828
|
-
bottom: 0,
|
|
2829
|
-
display: 'flex',
|
|
2830
|
-
justifyContent: 'center',
|
|
2831
|
-
left: 0,
|
|
2832
|
-
maxHeight: '100vh',
|
|
2833
|
-
position: 'absolute',
|
|
2834
|
-
right: 0,
|
|
2835
|
-
top: 0,
|
|
2836
|
-
width: '100%',
|
|
2837
|
-
zIndex: 2,
|
|
2838
|
-
}), children: jsx(CircularProgress, Object.assign({ "aria-label": localization.noRecordsToDisplay, id: "mrt-progress" }, circularProgressProps)) })) : null, jsx(MRT_Table, { table: table }), (createModalOpen || editModalOpen) && (jsx(MRT_EditRowModal, { open: true, table: table }))] })));
|
|
2838
|
+
: undefined, maxWidth: '100%', overflow: 'auto', position: 'relative' }, parseFromValuesOrFunc(tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx, theme))), children: [loading ? jsx(MRT_TableLoadingOverlay, { table: table }) : null, jsx(MRT_Table, { table: table }), (createModalOpen || editModalOpen) && (jsx(MRT_EditRowModal, { open: true, table: table }))] })));
|
|
2839
2839
|
};
|
|
2840
2840
|
|
|
2841
|
-
const MRT_TablePaper = (
|
|
2842
|
-
var
|
|
2841
|
+
const MRT_TablePaper = (_a) => {
|
|
2842
|
+
var _b, _c;
|
|
2843
|
+
var { table } = _a, rest = __rest(_a, ["table"]);
|
|
2843
2844
|
const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps, renderBottomToolbar, renderTopToolbar, }, refs: { tablePaperRef }, } = table;
|
|
2844
2845
|
const { isFullScreen } = getState();
|
|
2845
|
-
const tablePaperProps = parseFromValuesOrFunc(muiTablePaperProps, { table });
|
|
2846
|
+
const tablePaperProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTablePaperProps, { table })), rest);
|
|
2846
2847
|
return (jsxs(Paper, Object.assign({ elevation: 2 }, tablePaperProps, { ref: (ref) => {
|
|
2847
2848
|
tablePaperRef.current = ref;
|
|
2848
2849
|
if (tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.ref) {
|
|
@@ -2865,11 +2866,12 @@ const MRT_TablePaper = ({ table, }) => {
|
|
|
2865
2866
|
zIndex: 9999,
|
|
2866
2867
|
}
|
|
2867
2868
|
: {})), tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style), sx: (theme) => (Object.assign({ overflow: 'hidden', transition: 'all 100ms ease-in-out' }, parseFromValuesOrFunc(tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx, theme))), children: [enableTopToolbar &&
|
|
2868
|
-
((
|
|
2869
|
-
((
|
|
2869
|
+
((_b = parseFromValuesOrFunc(renderTopToolbar, { table })) !== null && _b !== void 0 ? _b : (jsx(MRT_TopToolbar, { table: table }))), jsx(MRT_TableContainer, { table: table }), enableBottomToolbar &&
|
|
2870
|
+
((_c = parseFromValuesOrFunc(renderBottomToolbar, { table })) !== null && _c !== void 0 ? _c : (jsx(MRT_BottomToolbar, { table: table })))] })));
|
|
2870
2871
|
};
|
|
2871
2872
|
|
|
2872
|
-
const MRT_RowPinButton = (
|
|
2873
|
+
const MRT_RowPinButton = (_a) => {
|
|
2874
|
+
var { pinningPosition, row, table } = _a, rest = __rest(_a, ["pinningPosition", "row", "table"]);
|
|
2873
2875
|
const { options: { icons: { CloseIcon, PushPinIcon }, localization, rowPinningDisplayMode, }, } = table;
|
|
2874
2876
|
const isPinned = row.getIsPinned();
|
|
2875
2877
|
const [tooltipOpened, setTooltipOpened] = useState(false);
|
|
@@ -2878,42 +2880,43 @@ const MRT_RowPinButton = ({ pinningPosition, row, table, }) => {
|
|
|
2878
2880
|
event.stopPropagation();
|
|
2879
2881
|
row.pin(isPinned ? false : pinningPosition);
|
|
2880
2882
|
};
|
|
2881
|
-
return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, open: tooltipOpened, title: isPinned ? localization.unpin : localization.pin, children: jsx(IconButton, { "aria-label": localization.pin, onClick: handleTogglePin, onMouseEnter: () => setTooltipOpened(true), onMouseLeave: () => setTooltipOpened(false), size: "small", sx: {
|
|
2882
|
-
height: '24px',
|
|
2883
|
-
width: '24px',
|
|
2884
|
-
}, children: isPinned ? (jsx(CloseIcon, {})) : (jsx(PushPinIcon, { fontSize: "small", style: {
|
|
2883
|
+
return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, open: tooltipOpened, title: isPinned ? localization.unpin : localization.pin, children: jsx(IconButton, Object.assign({ "aria-label": localization.pin, onClick: handleTogglePin, onMouseEnter: () => setTooltipOpened(true), onMouseLeave: () => setTooltipOpened(false), size: "small" }, rest, { sx: (theme) => (Object.assign({ height: '24px', width: '24px' }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: isPinned ? (jsx(CloseIcon, {})) : (jsx(PushPinIcon, { fontSize: "small", style: {
|
|
2885
2884
|
transform: `rotate(${rowPinningDisplayMode === 'sticky'
|
|
2886
2885
|
? 135
|
|
2887
2886
|
: pinningPosition === 'top'
|
|
2888
2887
|
? 180
|
|
2889
2888
|
: 0}deg)`,
|
|
2890
|
-
} })) }) }));
|
|
2889
|
+
} })) })) }));
|
|
2891
2890
|
};
|
|
2892
2891
|
|
|
2893
|
-
const MRT_TableBodyRowPinButton = (
|
|
2892
|
+
const MRT_TableBodyRowPinButton = (_a) => {
|
|
2893
|
+
var { row, table } = _a, rest = __rest(_a, ["row", "table"]);
|
|
2894
2894
|
const { getState, options: { enableRowPinning, rowPinningDisplayMode }, } = table;
|
|
2895
2895
|
const { density } = getState();
|
|
2896
2896
|
const canPin = parseFromValuesOrFunc(enableRowPinning, row);
|
|
2897
2897
|
if (!canPin)
|
|
2898
2898
|
return null;
|
|
2899
|
+
const rowPinButtonProps = Object.assign({ row,
|
|
2900
|
+
table }, rest);
|
|
2899
2901
|
if (rowPinningDisplayMode === 'top-and-bottom' && !row.getIsPinned()) {
|
|
2900
2902
|
return (jsxs(Box, { sx: {
|
|
2901
2903
|
display: 'flex',
|
|
2902
2904
|
flexDirection: density === 'compact' ? 'row' : 'column',
|
|
2903
|
-
}, children: [jsx(MRT_RowPinButton, { pinningPosition: "top"
|
|
2905
|
+
}, children: [jsx(MRT_RowPinButton, Object.assign({ pinningPosition: "top" }, rowPinButtonProps)), jsx(MRT_RowPinButton, Object.assign({ pinningPosition: "bottom" }, rowPinButtonProps))] }));
|
|
2904
2906
|
}
|
|
2905
|
-
return (jsx(MRT_RowPinButton, { pinningPosition: rowPinningDisplayMode === 'bottom' ? 'bottom' : 'top'
|
|
2907
|
+
return (jsx(MRT_RowPinButton, Object.assign({ pinningPosition: rowPinningDisplayMode === 'bottom' ? 'bottom' : 'top' }, rowPinButtonProps)));
|
|
2906
2908
|
};
|
|
2907
2909
|
|
|
2908
|
-
const MRT_ExpandAllButton = (
|
|
2909
|
-
var
|
|
2910
|
+
const MRT_ExpandAllButton = (_a) => {
|
|
2911
|
+
var _b, _c;
|
|
2912
|
+
var { table } = _a, rest = __rest(_a, ["table"]);
|
|
2910
2913
|
const { getCanSomeRowsExpand, getIsAllRowsExpanded, getIsSomeRowsExpanded, getState, options: { icons: { KeyboardDoubleArrowDownIcon }, localization, muiExpandAllButtonProps, renderDetailPanel, }, toggleAllRowsExpanded, } = table;
|
|
2911
2914
|
const { density, isLoading } = getState();
|
|
2912
|
-
const iconButtonProps = parseFromValuesOrFunc(muiExpandAllButtonProps, {
|
|
2915
|
+
const iconButtonProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiExpandAllButtonProps, {
|
|
2913
2916
|
table,
|
|
2914
|
-
});
|
|
2917
|
+
})), rest);
|
|
2915
2918
|
const isAllRowsExpanded = getIsAllRowsExpanded();
|
|
2916
|
-
return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (
|
|
2919
|
+
return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _b !== void 0 ? _b : (isAllRowsExpanded ? localization.collapseAll : localization.expandAll), children: jsx("span", { children: jsx(IconButton, Object.assign({ "aria-label": localization.expandAll, disabled: isLoading || (!renderDetailPanel && !getCanSomeRowsExpand()), onClick: () => toggleAllRowsExpanded(!isAllRowsExpanded) }, iconButtonProps, { sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', mt: density !== 'compact' ? '-0.25rem' : undefined, width: density === 'compact' ? '1.75rem' : '2.25rem' }, parseFromValuesOrFunc(iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx, theme))), title: undefined, children: (_c = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _c !== void 0 ? _c : (jsx(KeyboardDoubleArrowDownIcon, { style: {
|
|
2917
2920
|
transform: `rotate(${isAllRowsExpanded ? -180 : getIsSomeRowsExpanded() ? -90 : 0}deg)`,
|
|
2918
2921
|
transition: 'transform 150ms',
|
|
2919
2922
|
} })) })) }) }));
|
|
@@ -2941,16 +2944,17 @@ const MRT_ExpandButton = ({ row, table, }) => {
|
|
|
2941
2944
|
} })) })) }) }));
|
|
2942
2945
|
};
|
|
2943
2946
|
|
|
2944
|
-
const MRT_RowActionMenu = (
|
|
2947
|
+
const MRT_RowActionMenu = (_a) => {
|
|
2948
|
+
var { anchorEl, handleEdit, row, setAnchorEl, table } = _a, rest = __rest(_a, ["anchorEl", "handleEdit", "row", "setAnchorEl", "table"]);
|
|
2945
2949
|
const { getState, options: { enableEditing, icons: { EditIcon }, localization, renderRowActionMenuItems, }, } = table;
|
|
2946
2950
|
const { density } = getState();
|
|
2947
|
-
return (jsxs(Menu, { MenuListProps: {
|
|
2951
|
+
return (jsxs(Menu, Object.assign({ MenuListProps: {
|
|
2948
2952
|
dense: density === 'compact',
|
|
2949
|
-
}, anchorEl: anchorEl, onClick: (event) => event.stopPropagation(), onClose: () => setAnchorEl(null), open: !!anchorEl, children: [parseFromValuesOrFunc(enableEditing, row) && (jsx(MenuItem, { onClick: handleEdit, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(EditIcon, {}) }), localization.edit] }) })), renderRowActionMenuItems === null || renderRowActionMenuItems === void 0 ? void 0 : renderRowActionMenuItems({
|
|
2953
|
+
}, anchorEl: anchorEl, onClick: (event) => event.stopPropagation(), onClose: () => setAnchorEl(null), open: !!anchorEl }, rest, { children: [parseFromValuesOrFunc(enableEditing, row) && (jsx(MenuItem, { onClick: handleEdit, sx: commonMenuItemStyles, children: jsxs(Box, { sx: commonListItemStyles, children: [jsx(ListItemIcon, { children: jsx(EditIcon, {}) }), localization.edit] }) })), renderRowActionMenuItems === null || renderRowActionMenuItems === void 0 ? void 0 : renderRowActionMenuItems({
|
|
2950
2954
|
closeMenu: () => setAnchorEl(null),
|
|
2951
2955
|
row,
|
|
2952
2956
|
table,
|
|
2953
|
-
})] }));
|
|
2957
|
+
})] })));
|
|
2954
2958
|
};
|
|
2955
2959
|
|
|
2956
2960
|
const commonIconButtonStyles = {
|
|
@@ -2963,7 +2967,8 @@ const commonIconButtonStyles = {
|
|
|
2963
2967
|
transition: 'opacity 150ms',
|
|
2964
2968
|
width: '2rem',
|
|
2965
2969
|
};
|
|
2966
|
-
const MRT_ToggleRowActionMenuButton = (
|
|
2970
|
+
const MRT_ToggleRowActionMenuButton = (_a) => {
|
|
2971
|
+
var { cell, row, table } = _a, rest = __rest(_a, ["cell", "row", "table"]);
|
|
2967
2972
|
const { getState, options: { createDisplayMode, editDisplayMode, enableEditing, icons: { EditIcon, MoreHorizIcon }, localization, renderRowActionMenuItems, renderRowActions, }, setEditingRow, } = table;
|
|
2968
2973
|
const { creatingRow, editingRow } = getState();
|
|
2969
2974
|
const isCreating = (creatingRow === null || creatingRow === void 0 ? void 0 : creatingRow.id) === row.id;
|
|
@@ -2982,10 +2987,12 @@ const MRT_ToggleRowActionMenuButton = ({ cell, row, table, }) => {
|
|
|
2982
2987
|
setAnchorEl(null);
|
|
2983
2988
|
};
|
|
2984
2989
|
return (jsx(Fragment, { children: renderRowActions && !showEditActionButtons ? (renderRowActions({ cell, row, table })) : showEditActionButtons ? (jsx(MRT_EditActionButtons, { row: row, table: table })) : !renderRowActionMenuItems &&
|
|
2985
|
-
parseFromValuesOrFunc(enableEditing, row)
|
|
2990
|
+
parseFromValuesOrFunc(enableEditing, row) &&
|
|
2991
|
+
['modal', 'row'].includes(editDisplayMode) ? (jsx(Tooltip, { arrow: true, placement: "right", title: localization.edit, children: jsx(IconButton, Object.assign({ "aria-label": localization.edit, onClick: handleStartEditMode, sx: commonIconButtonStyles }, rest, { children: jsx(EditIcon, {}) })) })) : renderRowActionMenuItems ? (jsxs(Fragment, { children: [jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.rowActions, children: jsx(IconButton, Object.assign({ "aria-label": localization.rowActions, onClick: handleOpenRowActionMenu, size: "small", sx: commonIconButtonStyles }, rest, { children: jsx(MoreHorizIcon, {}) })) }), jsx(MRT_RowActionMenu, { anchorEl: anchorEl, handleEdit: handleStartEditMode, row: row, setAnchorEl: setAnchorEl, table: table })] })) : null }));
|
|
2986
2992
|
};
|
|
2987
2993
|
|
|
2988
2994
|
const blankColProps = {
|
|
2995
|
+
children: null,
|
|
2989
2996
|
sx: {
|
|
2990
2997
|
flex: '1 0 auto',
|
|
2991
2998
|
minWidth: 0,
|
|
@@ -3014,7 +3021,7 @@ const useMRT_DisplayColumns = ({ columnOrder, creatingRow, grouping, tableOption
|
|
|
3014
3021
|
((_x = (_w = tableOptions.state) === null || _w === void 0 ? void 0 : _w.columnOrder) !== null && _x !== void 0 ? _x : columnOrder).includes('mrt-row-spacer') && {
|
|
3015
3022
|
columnDefType: 'display',
|
|
3016
3023
|
header: '',
|
|
3017
|
-
id: 'spacer',
|
|
3024
|
+
id: 'mrt-row-spacer',
|
|
3018
3025
|
muiTableBodyCellProps: blankColProps,
|
|
3019
3026
|
muiTableFooterCellProps: blankColProps,
|
|
3020
3027
|
muiTableHeadCellProps: blankColProps,
|
|
@@ -3601,5 +3608,5 @@ const MaterialReactTable = (props) => {
|
|
|
3601
3608
|
return jsx(MRT_TablePaper, { table: table });
|
|
3602
3609
|
};
|
|
3603
3610
|
|
|
3604
|
-
export { MRT_AggregationFns, MRT_BottomToolbar, MRT_ColumnActionMenu, MRT_ColumnPinningButtons, MRT_CopyButton, MRT_DefaultColumn, MRT_DefaultDisplayColumn, MRT_EditActionButtons, MRT_EditCellTextField, MRT_EditRowModal, MRT_ExpandAllButton, MRT_ExpandButton, MRT_FilterCheckbox, MRT_FilterFns, MRT_FilterOptionMenu, MRT_FilterRangeFields, MRT_FilterRangeSlider, MRT_FilterTextField, MRT_GlobalFilterTextField, MRT_GrabHandleButton, MRT_LinearProgressBar, MRT_RowActionMenu, MRT_RowPinButton, MRT_SelectCheckbox, MRT_ShowHideColumnsButton, MRT_ShowHideColumnsMenu, MRT_ShowHideColumnsMenuItems, MRT_SortingFns, MRT_Table, MRT_TableBody, MRT_TableBodyCell, MRT_TableBodyCellValue, MRT_TableBodyRow, MRT_TableBodyRowGrabHandle, MRT_TableBodyRowPinButton, MRT_TableContainer, MRT_TableDetailPanel, MRT_TableFooter, MRT_TableFooterCell, MRT_TableFooterRow, MRT_TableHead, MRT_TableHeadCell, MRT_TableHeadCellColumnActionsButton, MRT_TableHeadCellFilterContainer, MRT_TableHeadCellFilterLabel, MRT_TableHeadCellGrabHandle, MRT_TableHeadCellResizeHandle, MRT_TableHeadCellSortLabel, MRT_TableHeadRow, MRT_TablePagination, MRT_TablePaper, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleFullScreenButton, MRT_ToggleGlobalFilterButton, MRT_ToggleRowActionMenuButton, MRT_ToolbarAlertBanner, MRT_ToolbarDropZone, MRT_ToolbarInternalButtons, MRT_TopToolbar, MaterialReactTable, Memo_MRT_TableBody, Memo_MRT_TableBodyCell, Memo_MRT_TableBodyRow, commonListItemStyles, commonMenuItemStyles, commonToolbarStyles, createMRTColumnHelper, createRow, extraIndexRangeExtractor, flexRender, getAllLeafColumnDefs, getCanRankRows, getColumnId, getCommonCellStyles, getDefaultColumnFilterFn, getDefaultColumnOrderIds, getIsFirstColumn, getIsFirstRightPinnedColumn, getIsLastColumn, getIsLastLeftPinnedColumn, getLeadingDisplayColumnIds, getTotalRight, getTrailingDisplayColumnIds, mrtFilterOptions, parseCSSVarId, parseFromValuesOrFunc, prepareColumns, rankGlobalFuzzy, reorderColumn, showExpandColumn, useMaterialReactTable };
|
|
3611
|
+
export { MRT_AggregationFns, MRT_BottomToolbar, MRT_ColumnActionMenu, MRT_ColumnPinningButtons, MRT_CopyButton, MRT_DefaultColumn, MRT_DefaultDisplayColumn, MRT_EditActionButtons, MRT_EditCellTextField, MRT_EditRowModal, MRT_ExpandAllButton, MRT_ExpandButton, MRT_FilterCheckbox, MRT_FilterFns, MRT_FilterOptionMenu, MRT_FilterRangeFields, MRT_FilterRangeSlider, MRT_FilterTextField, MRT_GlobalFilterTextField, MRT_GrabHandleButton, MRT_LinearProgressBar, MRT_RowActionMenu, MRT_RowPinButton, MRT_SelectCheckbox, MRT_ShowHideColumnsButton, MRT_ShowHideColumnsMenu, MRT_ShowHideColumnsMenuItems, MRT_SortingFns, MRT_Table, MRT_TableBody, MRT_TableBodyCell, MRT_TableBodyCellValue, MRT_TableBodyRow, MRT_TableBodyRowGrabHandle, MRT_TableBodyRowPinButton, MRT_TableContainer, MRT_TableDetailPanel, MRT_TableFooter, MRT_TableFooterCell, MRT_TableFooterRow, MRT_TableHead, MRT_TableHeadCell, MRT_TableHeadCellColumnActionsButton, MRT_TableHeadCellFilterContainer, MRT_TableHeadCellFilterLabel, MRT_TableHeadCellGrabHandle, MRT_TableHeadCellResizeHandle, MRT_TableHeadCellSortLabel, MRT_TableHeadRow, MRT_TableLoadingOverlay, MRT_TablePagination, MRT_TablePaper, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleFullScreenButton, MRT_ToggleGlobalFilterButton, MRT_ToggleRowActionMenuButton, MRT_ToolbarAlertBanner, MRT_ToolbarDropZone, MRT_ToolbarInternalButtons, MRT_TopToolbar, MaterialReactTable, Memo_MRT_TableBody, Memo_MRT_TableBodyCell, Memo_MRT_TableBodyRow, commonListItemStyles, commonMenuItemStyles, commonToolbarStyles, createMRTColumnHelper, createRow, extraIndexRangeExtractor, flexRender, getAllLeafColumnDefs, getCanRankRows, getColumnId, getCommonCellStyles, getDefaultColumnFilterFn, getDefaultColumnOrderIds, getIsFirstColumn, getIsFirstRightPinnedColumn, getIsLastColumn, getIsLastLeftPinnedColumn, getLeadingDisplayColumnIds, getTotalRight, getTrailingDisplayColumnIds, mrtFilterOptions, parseCSSVarId, parseFromValuesOrFunc, prepareColumns, rankGlobalFuzzy, reorderColumn, showExpandColumn, useMaterialReactTable };
|
|
3605
3612
|
//# sourceMappingURL=material-react-table.esm.js.map
|