material-react-table 0.41.0 → 1.0.0-beta.10
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/README.md +22 -20
- package/dist/cjs/MaterialReactTable.d.ts +96 -19
- package/dist/cjs/_locales/en.d.ts +2 -0
- package/dist/cjs/_locales/es.d.ts +2 -0
- package/dist/cjs/body/MRT_EditRowModal.d.ts +0 -1
- package/dist/cjs/body/MRT_TableBody.d.ts +1 -2
- package/dist/cjs/body/MRT_TableBodyCellValue.d.ts +2 -2
- package/dist/cjs/buttons/MRT_ColumnPinningButtons.d.ts +0 -1
- package/dist/cjs/buttons/MRT_EditActionButtons.d.ts +0 -1
- package/dist/cjs/buttons/MRT_FullScreenToggleButton.d.ts +0 -1
- package/dist/cjs/buttons/MRT_ShowHideColumnsButton.d.ts +0 -1
- package/dist/cjs/buttons/MRT_ToggleDensePaddingButton.d.ts +0 -1
- package/dist/cjs/buttons/MRT_ToggleFiltersButton.d.ts +0 -1
- package/dist/cjs/buttons/MRT_ToggleGlobalFilterButton.d.ts +0 -1
- package/dist/cjs/column.utils.d.ts +12 -1
- package/dist/cjs/index.d.ts +4 -3
- package/dist/cjs/index.js +244 -195
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/inputs/MRT_EditCellTextField.d.ts +0 -1
- package/dist/cjs/inputs/MRT_GlobalFilterTextField.d.ts +0 -1
- package/dist/cjs/menus/MRT_FilterOptionMenu.d.ts +3 -4
- package/dist/cjs/menus/MRT_ShowHideColumnsMenu.d.ts +0 -1
- package/dist/cjs/table/MRT_Table.d.ts +1 -2
- package/dist/cjs/table/MRT_TableRoot.d.ts +250 -3
- package/dist/cjs/toolbar/MRT_TablePagination.d.ts +3 -4
- package/dist/cjs/toolbar/MRT_ToolbarAlertBanner.d.ts +1 -1
- package/dist/cjs/toolbar/MRT_ToolbarInternalButtons.d.ts +3 -4
- package/dist/cjs/toolbar/MRT_TopToolbar.d.ts +1 -0
- package/dist/en.cjs +90 -0
- package/dist/en.cjs.d.ts +2 -0
- package/dist/en.cjs.map +1 -0
- package/dist/en.esm.d.ts +2 -0
- package/dist/en.esm.js +86 -0
- package/dist/en.esm.js.map +1 -0
- package/dist/esm/MaterialReactTable.d.ts +96 -19
- package/dist/esm/_locales/en.d.ts +2 -0
- package/dist/esm/_locales/es.d.ts +2 -0
- package/dist/esm/body/MRT_EditRowModal.d.ts +0 -1
- package/dist/esm/body/MRT_TableBody.d.ts +1 -2
- package/dist/esm/body/MRT_TableBodyCellValue.d.ts +2 -2
- package/dist/esm/buttons/MRT_ColumnPinningButtons.d.ts +0 -1
- package/dist/esm/buttons/MRT_EditActionButtons.d.ts +0 -1
- package/dist/esm/buttons/MRT_FullScreenToggleButton.d.ts +0 -1
- package/dist/esm/buttons/MRT_ShowHideColumnsButton.d.ts +0 -1
- package/dist/esm/buttons/MRT_ToggleDensePaddingButton.d.ts +0 -1
- package/dist/esm/buttons/MRT_ToggleFiltersButton.d.ts +0 -1
- package/dist/esm/buttons/MRT_ToggleGlobalFilterButton.d.ts +0 -1
- package/dist/esm/column.utils.d.ts +12 -1
- package/dist/esm/index.d.ts +4 -3
- package/dist/esm/inputs/MRT_EditCellTextField.d.ts +0 -1
- package/dist/esm/inputs/MRT_GlobalFilterTextField.d.ts +0 -1
- package/dist/esm/material-react-table.esm.js +245 -198
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/menus/MRT_FilterOptionMenu.d.ts +3 -4
- package/dist/esm/menus/MRT_ShowHideColumnsMenu.d.ts +0 -1
- package/dist/esm/table/MRT_Table.d.ts +1 -2
- package/dist/esm/table/MRT_TableRoot.d.ts +250 -3
- package/dist/esm/toolbar/MRT_TablePagination.d.ts +3 -4
- package/dist/esm/toolbar/MRT_ToolbarAlertBanner.d.ts +1 -1
- package/dist/esm/toolbar/MRT_ToolbarInternalButtons.d.ts +3 -4
- package/dist/esm/toolbar/MRT_TopToolbar.d.ts +1 -0
- package/dist/index.d.ts +47 -41
- package/package.json +7 -6
- package/src/MaterialReactTable.tsx +100 -23
- package/src/_locales/de.ts +0 -0
- package/src/{localization.ts → _locales/en.ts} +4 -82
- package/src/_locales/es.ts +86 -0
- package/src/_locales/fr.ts +0 -0
- package/src/_locales/hi.ts +0 -0
- package/src/_locales/id.ts +0 -0
- package/src/_locales/ja.ts +0 -0
- package/src/_locales/nl.ts +0 -0
- package/src/_locales/pt.ts +0 -0
- package/src/_locales/ru.ts +0 -0
- package/src/_locales/uk.ts +0 -0
- package/src/_locales/vi.ts +0 -0
- package/src/_locales/zh.ts +0 -0
- package/src/body/MRT_TableBody.tsx +54 -30
- package/src/body/MRT_TableBodyCell.tsx +11 -58
- package/src/body/MRT_TableBodyCellValue.tsx +7 -2
- package/src/body/MRT_TableBodyRowGrabHandle.tsx +5 -8
- package/src/buttons/MRT_GrabHandleButton.tsx +2 -2
- package/src/buttons/MRT_ToggleGlobalFilterButton.tsx +7 -2
- package/src/column.utils.ts +72 -0
- package/src/footer/MRT_TableFooter.tsx +3 -2
- package/src/footer/MRT_TableFooterCell.tsx +5 -15
- package/src/head/MRT_TableHead.tsx +10 -2
- package/src/head/MRT_TableHeadCell.tsx +9 -50
- package/src/head/MRT_TableHeadCellFilterLabel.tsx +7 -7
- package/src/head/MRT_TableHeadCellGrabHandle.tsx +5 -12
- package/src/index.tsx +6 -3
- package/src/inputs/MRT_FilterTextField.tsx +8 -7
- package/src/inputs/MRT_GlobalFilterTextField.tsx +7 -1
- package/src/menus/MRT_FilterOptionMenu.tsx +19 -2
- package/src/table/MRT_Table.tsx +3 -4
- package/src/table/MRT_TableContainer.tsx +2 -11
- package/src/table/MRT_TablePaper.tsx +34 -20
- package/src/table/MRT_TableRoot.tsx +34 -11
- package/src/toolbar/MRT_BottomToolbar.tsx +11 -2
- package/src/toolbar/MRT_TablePagination.tsx +7 -5
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +7 -1
- package/src/toolbar/MRT_ToolbarInternalButtons.tsx +14 -12
- package/src/toolbar/MRT_TopToolbar.tsx +13 -2
- package/dist/cjs/localization.d.ts +0 -82
- package/dist/esm/localization.d.ts +0 -82
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React, { useMemo, useRef, useState, useCallback, Fragment, useEffect, useLayoutEffect } from 'react';
|
|
1
|
+
import React, { useMemo, useRef, useState, useCallback, Fragment, memo, useEffect, useLayoutEffect } from 'react';
|
|
2
2
|
import { aggregationFns, filterFns, sortingFns, useReactTable, getCoreRowModel, getExpandedRowModel, getFacetedRowModel, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel } from '@tanstack/react-table';
|
|
3
3
|
import { ArrowRight, Cancel, CheckBox, ClearAll, Close, DensityLarge, DensityMedium, DensitySmall, DragHandle, DynamicFeed, Edit, ExpandLess, ExpandMore, FilterAlt, FilterAltOff, FilterList, FilterListOff, FullscreenExit, Fullscreen, KeyboardDoubleArrowDown, MoreHoriz, MoreVert, PushPin, RestartAlt, Save, Search, SearchOff, Sort, ViewColumn, VisibilityOff } from '@mui/icons-material';
|
|
4
4
|
import { rankItem, rankings, compareItems } from '@tanstack/match-sorter-utils';
|
|
5
|
-
import { Tooltip, IconButton, Menu, MenuItem, Box, FormControlLabel, Switch, Typography, Button, Divider, ListItemIcon, Checkbox, debounce, Collapse, TextField, InputAdornment, LinearProgress, TablePagination, Chip, Alert, AlertTitle, Fade,
|
|
5
|
+
import { Tooltip, IconButton, Menu, MenuItem, Box, alpha, lighten, FormControlLabel, Switch, Typography, Button, Divider, ListItemIcon, Checkbox, debounce, Collapse, TextField, InputAdornment, LinearProgress, TablePagination, Chip, Alert, AlertTitle, Fade, useMediaQuery, Toolbar, Grow, TableSortLabel, useTheme, TableCell, TableRow, TableHead, darken, Skeleton, TableBody, TableFooter, Table, TableContainer, Paper, Dialog, DialogTitle, DialogContent, Stack, DialogActions } from '@mui/material';
|
|
6
6
|
import { useVirtual } from 'react-virtual';
|
|
7
7
|
|
|
8
8
|
/******************************************************************************
|
|
@@ -151,7 +151,7 @@ const MRT_FilterFns = Object.assign(Object.assign({}, filterFns), { between,
|
|
|
151
151
|
notEquals,
|
|
152
152
|
startsWith });
|
|
153
153
|
|
|
154
|
-
const
|
|
154
|
+
const MRT_Localization_EN = {
|
|
155
155
|
actions: 'Actions',
|
|
156
156
|
and: 'and',
|
|
157
157
|
cancel: 'Cancel',
|
|
@@ -200,6 +200,8 @@ const MRT_DefaultLocalization_EN = {
|
|
|
200
200
|
max: 'Max',
|
|
201
201
|
min: 'Min',
|
|
202
202
|
move: 'Move',
|
|
203
|
+
noRecordsToDisplay: 'No records to display',
|
|
204
|
+
noResultsFound: 'No results found',
|
|
203
205
|
or: 'or',
|
|
204
206
|
pinToLeft: 'Pin to left',
|
|
205
207
|
pinToRight: 'Pin to right',
|
|
@@ -383,7 +385,7 @@ const mrtFilterOptions = (localization) => [
|
|
|
383
385
|
divider: false,
|
|
384
386
|
},
|
|
385
387
|
];
|
|
386
|
-
const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, table, }) => {
|
|
388
|
+
const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilterValue, table, }) => {
|
|
387
389
|
var _a, _b, _c, _d;
|
|
388
390
|
const { getState, options: { columnFilterModeOptions, globalFilterModeOptions, localization, renderColumnFilterModeMenuItems, renderGlobalFilterModeMenuItems, }, setColumnFilterFns, setGlobalFilterFn, } = table;
|
|
389
391
|
const { globalFilterFn, density } = getState();
|
|
@@ -402,11 +404,19 @@ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, table,
|
|
|
402
404
|
if (['empty', 'notEmpty'].includes(option)) {
|
|
403
405
|
column.setFilterValue(' ');
|
|
404
406
|
}
|
|
405
|
-
else if (
|
|
407
|
+
else if ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant) === 'multi-select' ||
|
|
408
|
+
['arrIncludesSome', 'arrIncludesAll', 'arrIncludes'].includes(option)) {
|
|
409
|
+
column.setFilterValue([]);
|
|
410
|
+
setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue([]);
|
|
411
|
+
}
|
|
412
|
+
else if ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant) === 'range' ||
|
|
413
|
+
['between', 'betweenInclusive', 'inNumberRange'].includes(option)) {
|
|
406
414
|
column.setFilterValue(['', '']);
|
|
415
|
+
setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue('');
|
|
407
416
|
}
|
|
408
417
|
else {
|
|
409
418
|
column.setFilterValue('');
|
|
419
|
+
setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue('');
|
|
410
420
|
}
|
|
411
421
|
}
|
|
412
422
|
else {
|
|
@@ -469,11 +479,11 @@ const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table,
|
|
|
469
479
|
var _a;
|
|
470
480
|
const { options: { icons: { DragHandleIcon }, localization, }, } = table;
|
|
471
481
|
return (React.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : localization.move },
|
|
472
|
-
React.createElement(IconButton, Object.assign({ disableRipple: true, draggable: "true",
|
|
482
|
+
React.createElement(IconButton, Object.assign({ disableRipple: true, draggable: "true", size: "small" }, iconButtonProps, { onClick: (e) => {
|
|
473
483
|
var _a;
|
|
474
484
|
e.stopPropagation();
|
|
475
485
|
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, e);
|
|
476
|
-
}, sx: (theme) => (Object.assign({ cursor: 'grab', m: 0, opacity: 0.5, p: '2px', transition: 'all 0.2s ease-in-out', '&:hover': {
|
|
486
|
+
}, onDragStart: onDragStart, onDragEnd: onDragEnd, sx: (theme) => (Object.assign({ cursor: 'grab', m: 0, opacity: 0.5, p: '2px', transition: 'all 0.2s ease-in-out', '&:hover': {
|
|
477
487
|
backgroundColor: 'transparent',
|
|
478
488
|
opacity: 1,
|
|
479
489
|
}, '&:active': {
|
|
@@ -587,6 +597,37 @@ const getDefaultColumnFilterFn = (columnDef) => {
|
|
|
587
597
|
return 'betweenInclusive';
|
|
588
598
|
return 'fuzzy';
|
|
589
599
|
};
|
|
600
|
+
const getIsLastLeftPinnedColumn = (table, column) => {
|
|
601
|
+
return (column.getIsPinned() === 'left' &&
|
|
602
|
+
table.getLeftLeafHeaders().length - 1 === column.getPinnedIndex());
|
|
603
|
+
};
|
|
604
|
+
const getIsFirstRightPinnedColumn = (column) => {
|
|
605
|
+
return column.getIsPinned() === 'right' && column.getPinnedIndex() === 0;
|
|
606
|
+
};
|
|
607
|
+
const getTotalRight = (table, column) => {
|
|
608
|
+
return ((table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 160);
|
|
609
|
+
};
|
|
610
|
+
const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
|
|
611
|
+
var _a, _b, _c, _d;
|
|
612
|
+
return (Object.assign(Object.assign({ backgroundColor: column.getIsPinned() && column.columnDef.columnDefType !== 'group'
|
|
613
|
+
? alpha(lighten(theme.palette.background.default, 0.04), 0.95)
|
|
614
|
+
: 'inherit', backgroundImage: 'inherit', boxShadow: getIsLastLeftPinnedColumn(table, column)
|
|
615
|
+
? `-4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
|
|
616
|
+
: getIsFirstRightPinnedColumn(column)
|
|
617
|
+
? `4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
|
|
618
|
+
: undefined, left: column.getIsPinned() === 'left'
|
|
619
|
+
? `${column.getStart('left')}px`
|
|
620
|
+
: undefined, opacity: ((_a = table.getState().draggingColumn) === null || _a === void 0 ? void 0 : _a.id) === column.id ||
|
|
621
|
+
((_b = table.getState().hoveredColumn) === null || _b === void 0 ? void 0 : _b.id) === column.id
|
|
622
|
+
? 0.5
|
|
623
|
+
: 1, position: column.getIsPinned() && column.columnDef.columnDefType !== 'group'
|
|
624
|
+
? 'sticky'
|
|
625
|
+
: undefined, right: column.getIsPinned() === 'right'
|
|
626
|
+
? `${getTotalRight(table, column)}px`
|
|
627
|
+
: undefined, transition: `all ${column.getIsResizing() ? 0 : '0.2s'} ease-in-out` }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
|
|
628
|
+
? tableCellProps.sx(theme)
|
|
629
|
+
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), { maxWidth: `min(${column.getSize()}px, fit-content)`, minWidth: `max(${column.getSize()}px, ${(_c = column.columnDef.minSize) !== null && _c !== void 0 ? _c : 30}px)`, width: (_d = header === null || header === void 0 ? void 0 : header.getSize()) !== null && _d !== void 0 ? _d : column.getSize() }));
|
|
630
|
+
};
|
|
590
631
|
|
|
591
632
|
const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredColumn, column, isSubMenu, table, }) => {
|
|
592
633
|
var _a;
|
|
@@ -1022,7 +1063,7 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
|
1022
1063
|
const textFieldProps = muiSearchTextFieldProps instanceof Function
|
|
1023
1064
|
? muiSearchTextFieldProps({ table })
|
|
1024
1065
|
: muiSearchTextFieldProps;
|
|
1025
|
-
return (React.createElement(Collapse, { in: showGlobalFilter, orientation: "horizontal" },
|
|
1066
|
+
return (React.createElement(Collapse, { in: showGlobalFilter, orientation: "horizontal", unmountOnExit: true, mountOnEnter: true },
|
|
1026
1067
|
React.createElement(TextField, Object.assign({ placeholder: localization.search, onChange: handleChange, value: searchValue !== null && searchValue !== void 0 ? searchValue : '', variant: "standard", InputProps: {
|
|
1027
1068
|
startAdornment: enableGlobalFilterModes ? (React.createElement(InputAdornment, { position: "start" },
|
|
1028
1069
|
React.createElement(Tooltip, { arrow: true, title: localization.changeSearchMode },
|
|
@@ -1039,7 +1080,7 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
|
|
|
1039
1080
|
textFieldProps.inputRef = inputRef;
|
|
1040
1081
|
}
|
|
1041
1082
|
} })),
|
|
1042
|
-
React.createElement(MRT_FilterOptionMenu, { anchorEl: anchorEl, setAnchorEl: setAnchorEl, table: table })));
|
|
1083
|
+
React.createElement(MRT_FilterOptionMenu, { anchorEl: anchorEl, setAnchorEl: setAnchorEl, table: table, onSelect: handleClear })));
|
|
1043
1084
|
};
|
|
1044
1085
|
|
|
1045
1086
|
const MRT_LinearProgressBar = ({ isTopToolbar, table }) => {
|
|
@@ -1057,7 +1098,7 @@ const MRT_LinearProgressBar = ({ isTopToolbar, table }) => {
|
|
|
1057
1098
|
React.createElement(LinearProgress, Object.assign({ "aria-label": "Loading", "aria-busy": "true", sx: { position: 'relative' } }, linearProgressProps))));
|
|
1058
1099
|
};
|
|
1059
1100
|
|
|
1060
|
-
const MRT_TablePagination = ({ table, position }) => {
|
|
1101
|
+
const MRT_TablePagination = ({ table, position, }) => {
|
|
1061
1102
|
const { getPrePaginationRowModel, getState, setPageIndex, setPageSize, options: { muiTablePaginationProps, enableToolbarInternalActions, rowCount, }, } = table;
|
|
1062
1103
|
const { pagination: { pageSize = 10, pageIndex = 0 }, showGlobalFilter, } = getState();
|
|
1063
1104
|
const totalRowCount = rowCount !== null && rowCount !== void 0 ? rowCount : getPrePaginationRowModel().rows.length;
|
|
@@ -1071,7 +1112,7 @@ const MRT_TablePagination = ({ table, position }) => {
|
|
|
1071
1112
|
return (React.createElement(TablePagination, Object.assign({ SelectProps: {
|
|
1072
1113
|
sx: { m: '0 1rem 0 1ch' },
|
|
1073
1114
|
MenuProps: { MenuListProps: { disablePadding: true } },
|
|
1074
|
-
}, component: "div", count: totalRowCount, onPageChange: (_, newPage) => setPageIndex(newPage), onRowsPerPageChange: handleChangeRowsPerPage, page: pageIndex, rowsPerPage: pageSize, rowsPerPageOptions: [5, 10, 15, 20, 25, 30, 50, 100], showFirstButton: showFirstLastPageButtons, showLastButton: showFirstLastPageButtons }, tablePaginationProps, { sx: (theme) => (Object.assign({
|
|
1115
|
+
}, component: "div", count: totalRowCount, onPageChange: (_, newPage) => setPageIndex(newPage), onRowsPerPageChange: handleChangeRowsPerPage, page: pageIndex, rowsPerPage: pageSize, rowsPerPageOptions: [5, 10, 15, 20, 25, 30, 50, 100], showFirstButton: showFirstLastPageButtons, showLastButton: showFirstLastPageButtons }, tablePaginationProps, { sx: (theme) => (Object.assign({ mt: position === 'top' &&
|
|
1075
1116
|
enableToolbarInternalActions &&
|
|
1076
1117
|
!showGlobalFilter
|
|
1077
1118
|
? '3.5rem'
|
|
@@ -1082,7 +1123,7 @@ const MRT_TablePagination = ({ table, position }) => {
|
|
|
1082
1123
|
|
|
1083
1124
|
const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
|
|
1084
1125
|
var _a, _b;
|
|
1085
|
-
const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { localization, muiToolbarAlertBannerProps, muiToolbarAlertBannerChipProps, }, } = table;
|
|
1126
|
+
const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { localization, muiToolbarAlertBannerProps, muiToolbarAlertBannerChipProps, positionToolbarAlertBanner, }, } = table;
|
|
1086
1127
|
const { grouping, showAlertBanner } = getState();
|
|
1087
1128
|
const alertProps = muiToolbarAlertBannerProps instanceof Function
|
|
1088
1129
|
? muiToolbarAlertBannerProps({ table })
|
|
@@ -1100,7 +1141,11 @@ const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
|
|
|
1100
1141
|
index > 0 ? localization.thenBy : '',
|
|
1101
1142
|
React.createElement(Chip, Object.assign({ label: table.getColumn(columnId).columnDef.header, onDelete: () => table.getColumn(columnId).toggleGrouping() }, chipProps))))))) : null;
|
|
1102
1143
|
return (React.createElement(Collapse, { in: showAlertBanner || !!selectMessage || !!groupedByMessage, timeout: stackAlertBanner ? 200 : 0 },
|
|
1103
|
-
React.createElement(Alert, Object.assign({ color: "info", icon: false }, alertProps, { sx: (theme) => (Object.assign({ borderRadius: 0, fontSize: '1rem', left: 0, p: 0, position: 'relative',
|
|
1144
|
+
React.createElement(Alert, Object.assign({ color: "info", icon: false }, alertProps, { sx: (theme) => (Object.assign({ borderRadius: 0, fontSize: '1rem', left: 0, p: 0, position: 'relative', mb: stackAlertBanner
|
|
1145
|
+
? 0
|
|
1146
|
+
: positionToolbarAlertBanner === 'bottom'
|
|
1147
|
+
? '-1rem'
|
|
1148
|
+
: undefined, right: 0, top: 0, width: '100%', zIndex: 2 }, ((alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx) instanceof Function
|
|
1104
1149
|
? alertProps.sx(theme)
|
|
1105
1150
|
: alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx))) }),
|
|
1106
1151
|
(alertProps === null || alertProps === void 0 ? void 0 : alertProps.title) && React.createElement(AlertTitle, null, alertProps.title),
|
|
@@ -1172,18 +1217,18 @@ const MRT_ToggleGlobalFilterButton = (_a) => {
|
|
|
1172
1217
|
var _b;
|
|
1173
1218
|
var { table } = _a, rest = __rest(_a, ["table"]);
|
|
1174
1219
|
const { getState, options: { icons: { SearchIcon, SearchOffIcon }, localization, }, refs: { searchInputRef }, setShowGlobalFilter, } = table;
|
|
1175
|
-
const { showGlobalFilter } = getState();
|
|
1220
|
+
const { globalFilter, showGlobalFilter } = getState();
|
|
1176
1221
|
const handleToggleSearch = () => {
|
|
1177
1222
|
setShowGlobalFilter(!showGlobalFilter);
|
|
1178
1223
|
queueMicrotask(() => { var _a; return (_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); });
|
|
1179
1224
|
};
|
|
1180
1225
|
return (React.createElement(Tooltip, { arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.showHideSearch },
|
|
1181
|
-
React.createElement(IconButton, Object.assign({ onClick: handleToggleSearch }, rest, { title: undefined }), showGlobalFilter ? React.createElement(SearchOffIcon, null) : React.createElement(SearchIcon, null))));
|
|
1226
|
+
React.createElement(IconButton, Object.assign({ disabled: !!globalFilter, onClick: handleToggleSearch }, rest, { title: undefined }), showGlobalFilter ? React.createElement(SearchOffIcon, null) : React.createElement(SearchIcon, null))));
|
|
1182
1227
|
};
|
|
1183
1228
|
|
|
1184
|
-
const MRT_ToolbarInternalButtons = ({ table }) => {
|
|
1229
|
+
const MRT_ToolbarInternalButtons = ({ table, }) => {
|
|
1185
1230
|
var _a;
|
|
1186
|
-
const { options: { enableColumnFilters, enableColumnOrdering, enableDensityToggle, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, enablePinning,
|
|
1231
|
+
const { options: { enableColumnFilters, enableColumnOrdering, enableDensityToggle, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, enablePinning, initialState, renderToolbarInternalActions, }, } = table;
|
|
1187
1232
|
return (React.createElement(Box, { sx: {
|
|
1188
1233
|
alignItems: 'center',
|
|
1189
1234
|
display: 'flex',
|
|
@@ -1191,8 +1236,9 @@ const MRT_ToolbarInternalButtons = ({ table }) => {
|
|
|
1191
1236
|
} }, (_a = renderToolbarInternalActions === null || renderToolbarInternalActions === void 0 ? void 0 : renderToolbarInternalActions({
|
|
1192
1237
|
table,
|
|
1193
1238
|
})) !== null && _a !== void 0 ? _a : (React.createElement(React.Fragment, null,
|
|
1194
|
-
|
|
1195
|
-
|
|
1239
|
+
enableFilters &&
|
|
1240
|
+
enableGlobalFilter &&
|
|
1241
|
+
!(initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) && (React.createElement(MRT_ToggleGlobalFilterButton, { table: table })),
|
|
1196
1242
|
enableFilters && enableColumnFilters && (React.createElement(MRT_ToggleFiltersButton, { table: table })),
|
|
1197
1243
|
(enableHiding || enableColumnOrdering || enablePinning) && (React.createElement(MRT_ShowHideColumnsButton, { table: table })),
|
|
1198
1244
|
enableDensityToggle && (React.createElement(MRT_ToggleDensePaddingButton, { table: table })),
|
|
@@ -1228,6 +1274,7 @@ const commonToolbarStyles = ({ theme }) => ({
|
|
|
1228
1274
|
backgroundColor: lighten(theme.palette.background.default, 0.04),
|
|
1229
1275
|
backgroundImage: 'none',
|
|
1230
1276
|
display: 'grid',
|
|
1277
|
+
flexWrap: 'wrap-reverse',
|
|
1231
1278
|
minHeight: '3.5rem',
|
|
1232
1279
|
overflow: 'hidden',
|
|
1233
1280
|
p: '0 !important',
|
|
@@ -1266,7 +1313,13 @@ const MRT_TopToolbar = ({ table }) => {
|
|
|
1266
1313
|
width: '100%',
|
|
1267
1314
|
} },
|
|
1268
1315
|
enableGlobalFilter && positionGlobalFilter === 'left' && (React.createElement(MRT_GlobalFilterTextField, { table: table })), (_a = renderTopToolbarCustomActions === null || renderTopToolbarCustomActions === void 0 ? void 0 : renderTopToolbarCustomActions({ table })) !== null && _a !== void 0 ? _a : React.createElement("span", null),
|
|
1269
|
-
enableToolbarInternalActions ? (React.createElement(
|
|
1316
|
+
enableToolbarInternalActions ? (React.createElement(Box, { sx: {
|
|
1317
|
+
display: 'flex',
|
|
1318
|
+
flexWrap: 'wrap-reverse',
|
|
1319
|
+
justifyContent: 'flex-end',
|
|
1320
|
+
} },
|
|
1321
|
+
enableGlobalFilter && positionGlobalFilter === 'right' && (React.createElement(MRT_GlobalFilterTextField, { table: table })),
|
|
1322
|
+
React.createElement(MRT_ToolbarInternalButtons, { table: table }))) : (enableGlobalFilter &&
|
|
1270
1323
|
positionGlobalFilter === 'right' && (React.createElement(MRT_GlobalFilterTextField, { table: table })))),
|
|
1271
1324
|
enablePagination &&
|
|
1272
1325
|
['top', 'both'].includes(positionPagination !== null && positionPagination !== void 0 ? positionPagination : '') && (React.createElement(MRT_TablePagination, { table: table, position: "top" })),
|
|
@@ -1287,15 +1340,18 @@ const MRT_BottomToolbar = ({ table }) => {
|
|
|
1287
1340
|
// @ts-ignore
|
|
1288
1341
|
toolbarProps.ref.current = ref;
|
|
1289
1342
|
}
|
|
1290
|
-
}, sx: (theme) => (Object.assign(Object.assign(Object.assign({}, commonToolbarStyles({ theme })), { bottom: isFullScreen ? '0' : undefined, boxShadow:
|
|
1343
|
+
}, sx: (theme) => (Object.assign(Object.assign(Object.assign({}, commonToolbarStyles({ theme })), { bottom: isFullScreen ? '0' : undefined, boxShadow: `0 1px 2px -1px ${alpha(theme.palette.common.black, 0.1)} inset`, left: 0, position: isFullScreen ? 'fixed' : 'relative', right: 0 }), ((toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx) instanceof Function
|
|
1291
1344
|
? toolbarProps.sx(theme)
|
|
1292
1345
|
: toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx))) }),
|
|
1293
1346
|
React.createElement(MRT_LinearProgressBar, { isTopToolbar: false, table: table }),
|
|
1294
|
-
positionToolbarAlertBanner === 'bottom' && (React.createElement(MRT_ToolbarAlertBanner, { table: table })),
|
|
1347
|
+
positionToolbarAlertBanner === 'bottom' && (React.createElement(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })),
|
|
1295
1348
|
['both', 'bottom'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (React.createElement(MRT_ToolbarDropZone, { table: table })),
|
|
1296
1349
|
React.createElement(Box, { sx: {
|
|
1350
|
+
alignItems: 'center',
|
|
1351
|
+
boxSizing: 'border-box',
|
|
1297
1352
|
display: 'flex',
|
|
1298
1353
|
justifyContent: 'space-between',
|
|
1354
|
+
p: '0.5rem',
|
|
1299
1355
|
width: '100%',
|
|
1300
1356
|
} },
|
|
1301
1357
|
renderBottomToolbarCustomActions ? (renderBottomToolbarCustomActions({ table })) : (React.createElement("span", null)),
|
|
@@ -1439,9 +1495,6 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1439
1495
|
const handleFilterMenuOpen = (event) => {
|
|
1440
1496
|
setAnchorEl(event.currentTarget);
|
|
1441
1497
|
};
|
|
1442
|
-
useEffect(() => {
|
|
1443
|
-
setFilterValue('');
|
|
1444
|
-
}, [columnDef._filterFn]);
|
|
1445
1498
|
if (columnDef.Filter) {
|
|
1446
1499
|
return React.createElement(React.Fragment, null, (_e = columnDef.Filter) === null || _e === void 0 ? void 0 : _e.call(columnDef, { column, header, table }));
|
|
1447
1500
|
}
|
|
@@ -1499,7 +1552,11 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1499
1552
|
if (textFieldProps.inputRef) {
|
|
1500
1553
|
textFieldProps.inputRef = inputRef;
|
|
1501
1554
|
}
|
|
1502
|
-
}, sx: (theme) => (Object.assign({ p: 0, minWidth:
|
|
1555
|
+
}, sx: (theme) => (Object.assign({ p: 0, minWidth: columnDef.filterVariant === 'range'
|
|
1556
|
+
? '90px'
|
|
1557
|
+
: !filterChipLabel
|
|
1558
|
+
? '120px'
|
|
1559
|
+
: 'auto', width: '100%', '& .MuiSelect-icon': {
|
|
1503
1560
|
mr: '1.5rem',
|
|
1504
1561
|
} }, ((textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx) instanceof Function
|
|
1505
1562
|
? textFieldProps.sx(theme)
|
|
@@ -1527,7 +1584,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
|
1527
1584
|
isMultiSelectFilter && (React.createElement(Checkbox, { checked: ((_a = column.getFilterValue()) !== null && _a !== void 0 ? _a : []).includes(value), sx: { mr: '0.5rem' } })),
|
|
1528
1585
|
text));
|
|
1529
1586
|
})),
|
|
1530
|
-
React.createElement(MRT_FilterOptionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table })));
|
|
1587
|
+
React.createElement(MRT_FilterOptionMenu, { anchorEl: anchorEl, header: header, setAnchorEl: setAnchorEl, table: table, setFilterValue: setFilterValue })));
|
|
1531
1588
|
};
|
|
1532
1589
|
|
|
1533
1590
|
const MRT_FilterRangeFields = ({ header, table }) => {
|
|
@@ -1549,11 +1606,8 @@ const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
|
|
|
1549
1606
|
const { options: { icons: { FilterAltIcon }, localization, }, } = table;
|
|
1550
1607
|
const { column } = header;
|
|
1551
1608
|
const { columnDef } = column;
|
|
1552
|
-
const isRangeFilter =
|
|
1553
|
-
'between',
|
|
1554
|
-
'betweenInclusive',
|
|
1555
|
-
'inNumberRange',
|
|
1556
|
-
].includes(columnDef._filterFn);
|
|
1609
|
+
const isRangeFilter = columnDef.filterVariant === 'range' ||
|
|
1610
|
+
['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn);
|
|
1557
1611
|
const currentFilterOption = columnDef._filterFn;
|
|
1558
1612
|
const filterTooltip = localization.filteringByColumn
|
|
1559
1613
|
.replace('{column}', String(columnDef.header))
|
|
@@ -1565,8 +1619,8 @@ const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
|
|
|
1565
1619
|
? column.getFilterValue().join(`" ${isRangeFilter ? localization.and : localization.or} "`)
|
|
1566
1620
|
: column.getFilterValue()}"`)
|
|
1567
1621
|
.replace('" "', '');
|
|
1568
|
-
return (React.createElement(Grow, { unmountOnExit: true, in: (!!column.getFilterValue() && isRangeFilter) ||
|
|
1569
|
-
(
|
|
1622
|
+
return (React.createElement(Grow, { unmountOnExit: true, in: (!!column.getFilterValue() && !isRangeFilter) ||
|
|
1623
|
+
(isRangeFilter && // @ts-ignore
|
|
1570
1624
|
(!!((_b = column.getFilterValue()) === null || _b === void 0 ? void 0 : _b[0]) || !!((_c = column.getFilterValue()) === null || _c === void 0 ? void 0 : _c[1]))) },
|
|
1571
1625
|
React.createElement("span", null,
|
|
1572
1626
|
React.createElement(Tooltip, { arrow: true, placement: "top", title: filterTooltip },
|
|
@@ -1583,7 +1637,7 @@ const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
|
|
|
1583
1637
|
};
|
|
1584
1638
|
|
|
1585
1639
|
const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
|
|
1586
|
-
const { getState, options: { enableColumnOrdering, muiTableHeadCellDragHandleProps
|
|
1640
|
+
const { getState, options: { enableColumnOrdering, muiTableHeadCellDragHandleProps }, setColumnOrder, setDraggingColumn, setHoveredColumn, } = table;
|
|
1587
1641
|
const { columnDef } = column;
|
|
1588
1642
|
const { hoveredColumn, draggingColumn, columnOrder } = getState();
|
|
1589
1643
|
const mIconButtonProps = muiTableHeadCellDragHandleProps instanceof Function
|
|
@@ -1593,16 +1647,15 @@ const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
|
|
|
1593
1647
|
? columnDef.muiTableHeadCellDragHandleProps({ column, table })
|
|
1594
1648
|
: columnDef.muiTableHeadCellDragHandleProps;
|
|
1595
1649
|
const iconButtonProps = Object.assign(Object.assign({}, mIconButtonProps), mcIconButtonProps);
|
|
1596
|
-
const handleDragStart = (
|
|
1650
|
+
const handleDragStart = (event) => {
|
|
1651
|
+
var _a;
|
|
1652
|
+
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
|
1597
1653
|
setDraggingColumn(column);
|
|
1598
|
-
|
|
1654
|
+
event.dataTransfer.setDragImage(tableHeadCellRef.current, 0, 0);
|
|
1599
1655
|
};
|
|
1600
1656
|
const handleDragEnd = (event) => {
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
draggedColumn: column,
|
|
1604
|
-
targetColumn: hoveredColumn,
|
|
1605
|
-
});
|
|
1657
|
+
var _a;
|
|
1658
|
+
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
|
1606
1659
|
if ((hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
|
|
1607
1660
|
column.toggleGrouping();
|
|
1608
1661
|
}
|
|
@@ -1670,7 +1723,7 @@ const MRT_TableHeadCellSortLabel = ({ header, table }) => {
|
|
|
1670
1723
|
const MRT_TableHeadCell = ({ header, table }) => {
|
|
1671
1724
|
var _a, _b, _c, _d;
|
|
1672
1725
|
const theme = useTheme();
|
|
1673
|
-
const { getState, options: { enableColumnActions, enableColumnDragging, enableColumnOrdering,
|
|
1726
|
+
const { getState, options: { enableColumnActions, enableColumnDragging, enableColumnOrdering, enableGrouping, enableMultiSort, muiTableHeadCellProps, }, setHoveredColumn, } = table;
|
|
1674
1727
|
const { density, draggingColumn, grouping, hoveredColumn, showColumnFilters, } = getState();
|
|
1675
1728
|
const { column } = header;
|
|
1676
1729
|
const { columnDef } = column;
|
|
@@ -1682,16 +1735,6 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1682
1735
|
? columnDef.muiTableHeadCellProps({ column, table })
|
|
1683
1736
|
: columnDef.muiTableHeadCellProps;
|
|
1684
1737
|
const tableCellProps = Object.assign(Object.assign({}, mTableHeadCellProps), mcTableHeadCellProps);
|
|
1685
|
-
const getIsLastLeftPinnedColumn = () => {
|
|
1686
|
-
return (column.getIsPinned() === 'left' &&
|
|
1687
|
-
table.getLeftLeafHeaders().length - 1 === column.getPinnedIndex());
|
|
1688
|
-
};
|
|
1689
|
-
const getIsFirstRightPinnedColumn = () => {
|
|
1690
|
-
return column.getIsPinned() === 'right' && column.getPinnedIndex() === 0;
|
|
1691
|
-
};
|
|
1692
|
-
const getTotalRight = () => {
|
|
1693
|
-
return ((table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 150);
|
|
1694
|
-
};
|
|
1695
1738
|
const handleDragEnter = (_e) => {
|
|
1696
1739
|
if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
|
|
1697
1740
|
setHoveredColumn(null);
|
|
@@ -1720,44 +1763,33 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1720
1763
|
})
|
|
1721
1764
|
: columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header)) !== null && _b !== void 0 ? _b : columnDef.header);
|
|
1722
1765
|
const tableHeadCellRef = React.useRef(null);
|
|
1723
|
-
return (React.createElement(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: tableHeadCellRef }, tableCellProps, { sx: (theme) => {
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
?
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
:
|
|
1730
|
-
?
|
|
1731
|
-
:
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
? 0.
|
|
1735
|
-
:
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
? '0.25rem'
|
|
1751
|
-
: density === 'comfortable'
|
|
1752
|
-
? '.75rem'
|
|
1753
|
-
: '1.25rem', right: column.getIsPinned() === 'right' ? `${getTotalRight()}px` : undefined, transition: `all ${enableColumnResizing ? 0 : '0.2s'} ease-in-out`, userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top', zIndex: column.getIsResizing() || (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
|
1754
|
-
? 3
|
|
1755
|
-
: column.getIsPinned() && columnDefType !== 'group'
|
|
1756
|
-
? 2
|
|
1757
|
-
: 1 }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
|
|
1758
|
-
? tableCellProps.sx(theme)
|
|
1759
|
-
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), draggingBorders), { maxWidth: `min(${column.getSize()}px, fit-content)`, minWidth: `max(${column.getSize()}px, ${(_a = columnDef.minSize) !== null && _a !== void 0 ? _a : 30}px)`, width: header.getSize() }));
|
|
1760
|
-
} }),
|
|
1766
|
+
return (React.createElement(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: tableHeadCellRef }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ fontWeight: 'bold', overflow: 'visible', p: density === 'compact'
|
|
1767
|
+
? '0.5rem'
|
|
1768
|
+
: density === 'comfortable'
|
|
1769
|
+
? columnDefType === 'display'
|
|
1770
|
+
? '0.75rem'
|
|
1771
|
+
: '1rem'
|
|
1772
|
+
: columnDefType === 'display'
|
|
1773
|
+
? '1rem 1.25rem'
|
|
1774
|
+
: '1.5rem', pb: columnDefType === 'display'
|
|
1775
|
+
? 0
|
|
1776
|
+
: showColumnFilters || density === 'compact'
|
|
1777
|
+
? '0.4rem'
|
|
1778
|
+
: '0.6rem', pt: columnDefType === 'group' || density === 'compact'
|
|
1779
|
+
? '0.25rem'
|
|
1780
|
+
: density === 'comfortable'
|
|
1781
|
+
? '.75rem'
|
|
1782
|
+
: '1.25rem', userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top', zIndex: column.getIsResizing() || (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
|
1783
|
+
? 3
|
|
1784
|
+
: column.getIsPinned() && columnDefType !== 'group'
|
|
1785
|
+
? 2
|
|
1786
|
+
: 1 }, getCommonCellStyles({
|
|
1787
|
+
column,
|
|
1788
|
+
header,
|
|
1789
|
+
table,
|
|
1790
|
+
tableCellProps,
|
|
1791
|
+
theme,
|
|
1792
|
+
})), draggingBorders)) }),
|
|
1761
1793
|
header.isPlaceholder ? null : (React.createElement(Box, { sx: {
|
|
1762
1794
|
alignItems: 'flex-start',
|
|
1763
1795
|
display: 'flex',
|
|
@@ -1812,11 +1844,13 @@ const MRT_TableHeadRow = ({ headerGroup, table }) => {
|
|
|
1812
1844
|
};
|
|
1813
1845
|
|
|
1814
1846
|
const MRT_TableHead = ({ table }) => {
|
|
1815
|
-
const { getHeaderGroups, options: { muiTableHeadProps }, } = table;
|
|
1847
|
+
const { getHeaderGroups, options: { enableStickyHeader, muiTableHeadProps }, } = table;
|
|
1816
1848
|
const tableHeadProps = muiTableHeadProps instanceof Function
|
|
1817
1849
|
? muiTableHeadProps({ table })
|
|
1818
1850
|
: muiTableHeadProps;
|
|
1819
|
-
return (React.createElement(TableHead, Object.assign({}, tableHeadProps
|
|
1851
|
+
return (React.createElement(TableHead, Object.assign({}, tableHeadProps, { sx: (theme) => (Object.assign({ opacity: enableStickyHeader ? 0.95 : undefined }, ((tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx) instanceof Function
|
|
1852
|
+
? tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx(theme)
|
|
1853
|
+
: tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx))) }), getHeaderGroups().map((headerGroup) => (React.createElement(MRT_TableHeadRow, { headerGroup: headerGroup, key: headerGroup.id, table: table })))));
|
|
1820
1854
|
};
|
|
1821
1855
|
|
|
1822
1856
|
const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
|
|
@@ -1912,28 +1946,27 @@ const MRT_CopyButton = ({ cell, children, table, }) => {
|
|
|
1912
1946
|
};
|
|
1913
1947
|
|
|
1914
1948
|
const MRT_TableBodyRowGrabHandle = ({ cell, rowRef, table, }) => {
|
|
1915
|
-
const { options: { muiTableBodyRowDragHandleProps
|
|
1949
|
+
const { options: { muiTableBodyRowDragHandleProps }, } = table;
|
|
1916
1950
|
const { row } = cell;
|
|
1917
1951
|
const iconButtonProps = muiTableBodyRowDragHandleProps instanceof Function
|
|
1918
1952
|
? muiTableBodyRowDragHandleProps({ row, table })
|
|
1919
1953
|
: muiTableBodyRowDragHandleProps;
|
|
1920
|
-
const handleDragStart = (
|
|
1921
|
-
|
|
1954
|
+
const handleDragStart = (event) => {
|
|
1955
|
+
var _a;
|
|
1956
|
+
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
|
1957
|
+
event.dataTransfer.setDragImage(rowRef.current, 0, 0);
|
|
1922
1958
|
table.setDraggingRow(row);
|
|
1923
1959
|
};
|
|
1924
1960
|
const handleDragEnd = (event) => {
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
draggedRow: table.getState().draggingRow,
|
|
1928
|
-
targetRow: table.getState().hoveredRow,
|
|
1929
|
-
});
|
|
1961
|
+
var _a;
|
|
1962
|
+
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
|
1930
1963
|
table.setDraggingRow(null);
|
|
1931
1964
|
table.setHoveredRow(null);
|
|
1932
1965
|
};
|
|
1933
1966
|
return (React.createElement(MRT_GrabHandleButton, { iconButtonProps: iconButtonProps, onDragStart: handleDragStart, onDragEnd: handleDragEnd, table: table }));
|
|
1934
1967
|
};
|
|
1935
1968
|
|
|
1936
|
-
const
|
|
1969
|
+
const _MRT_TableBodyCellValue = ({ cell, table }) => {
|
|
1937
1970
|
var _a, _b;
|
|
1938
1971
|
const { column, row } = cell;
|
|
1939
1972
|
const { columnDef } = column;
|
|
@@ -1955,6 +1988,7 @@ const MRT_TableBodyCellValue = ({ cell, table }) => {
|
|
|
1955
1988
|
})
|
|
1956
1989
|
: (_b = (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Cell) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table })) !== null && _b !== void 0 ? _b : cell.renderValue()));
|
|
1957
1990
|
};
|
|
1991
|
+
const MRT_TableBodyCellValue = memo(_MRT_TableBodyCellValue, (prev, next) => prev.cell.getValue() === next.cell.getValue());
|
|
1958
1992
|
|
|
1959
1993
|
const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
1960
1994
|
var _a, _b;
|
|
@@ -1971,6 +2005,9 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
1971
2005
|
? columnDef.muiTableBodyCellProps({ cell, table })
|
|
1972
2006
|
: columnDef.muiTableBodyCellProps;
|
|
1973
2007
|
const tableCellProps = Object.assign(Object.assign({}, mTableCellBodyProps), mcTableCellBodyProps);
|
|
2008
|
+
const skeletonProps = muiTableBodyCellSkeletonProps instanceof Function
|
|
2009
|
+
? muiTableBodyCellSkeletonProps({ cell, column, row, table })
|
|
2010
|
+
: muiTableBodyCellSkeletonProps;
|
|
1974
2011
|
const isEditable = (enableEditing || columnDef.enableEditing) &&
|
|
1975
2012
|
columnDef.enableEditing !== false;
|
|
1976
2013
|
const isEditing = isEditable &&
|
|
@@ -2001,16 +2038,6 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
2001
2038
|
});
|
|
2002
2039
|
}
|
|
2003
2040
|
};
|
|
2004
|
-
const getIsLastLeftPinnedColumn = () => {
|
|
2005
|
-
return (column.getIsPinned() === 'left' &&
|
|
2006
|
-
table.getLeftLeafHeaders().length - 1 === column.getPinnedIndex());
|
|
2007
|
-
};
|
|
2008
|
-
const getIsFirstRightPinnedColumn = () => {
|
|
2009
|
-
return column.getIsPinned() === 'right' && column.getPinnedIndex() === 0;
|
|
2010
|
-
};
|
|
2011
|
-
const getTotalRight = () => {
|
|
2012
|
-
return ((table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 150);
|
|
2013
|
-
};
|
|
2014
2041
|
const handleDragEnter = (e) => {
|
|
2015
2042
|
var _a;
|
|
2016
2043
|
(_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onDragEnter) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, e);
|
|
@@ -2039,53 +2066,34 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
2039
2066
|
: undefined,
|
|
2040
2067
|
}
|
|
2041
2068
|
: undefined;
|
|
2042
|
-
return (React.createElement(TableCell, Object.assign({}, tableCellProps, { onDragEnter: handleDragEnter, onDoubleClick: handleDoubleClick, sx: (theme) => {
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
? `4px 0 4px -2px ${alpha(theme.palette.common.black, 0.1)}`
|
|
2048
|
-
: getIsFirstRightPinnedColumn()
|
|
2049
|
-
? `-4px 0 4px -2px ${alpha(theme.palette.common.black, 0.1)}`
|
|
2050
|
-
: undefined, cursor: isEditable && editingMode === 'cell' ? 'pointer' : 'text', left: column.getIsPinned() === 'left'
|
|
2051
|
-
? `${column.getStart('left')}px`
|
|
2052
|
-
: undefined, opacity: (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id || (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
|
|
2053
|
-
? 0.5
|
|
2054
|
-
: 1, overflow: 'hidden', p: density === 'compact'
|
|
2069
|
+
return (React.createElement(TableCell, Object.assign({}, tableCellProps, { onDragEnter: handleDragEnter, onDoubleClick: handleDoubleClick, sx: (theme) => (Object.assign(Object.assign({ cursor: isEditable && editingMode === 'cell' ? 'pointer' : 'text', overflow: 'hidden', p: density === 'compact'
|
|
2070
|
+
? columnDefType === 'display'
|
|
2071
|
+
? '0 0.5rem'
|
|
2072
|
+
: '0.5rem'
|
|
2073
|
+
: density === 'comfortable'
|
|
2055
2074
|
? columnDefType === 'display'
|
|
2056
|
-
? '0 0.
|
|
2057
|
-
: '
|
|
2058
|
-
:
|
|
2059
|
-
?
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
?
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
columnDef.enableEditing !== false &&
|
|
2079
|
-
['table', 'cell'].includes(editingMode !== null && editingMode !== void 0 ? editingMode : '')
|
|
2080
|
-
? theme.palette.mode === 'dark'
|
|
2081
|
-
? `${lighten(theme.palette.background.default, 0.2)} !important`
|
|
2082
|
-
: `${darken(theme.palette.background.default, 0.1)} !important`
|
|
2083
|
-
: undefined,
|
|
2084
|
-
} }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
|
|
2085
|
-
? tableCellProps.sx(theme)
|
|
2086
|
-
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), draggingBorders), { maxWidth: `min(${column.getSize()}px, fit-content)`, minWidth: `max(${column.getSize()}px, ${(_a = columnDef.minSize) !== null && _a !== void 0 ? _a : 30}px)`, width: column.getSize() }));
|
|
2087
|
-
} }),
|
|
2088
|
-
React.createElement(React.Fragment, null, cell.getIsPlaceholder() ? null : isLoading || showSkeletons ? (React.createElement(Skeleton, Object.assign({ animation: "wave", height: 20, width: skeletonWidth }, muiTableBodyCellSkeletonProps))) : enableRowNumbers &&
|
|
2075
|
+
? '0.5rem 0.75rem'
|
|
2076
|
+
: '1rem'
|
|
2077
|
+
: columnDefType === 'display'
|
|
2078
|
+
? '1rem 1.25rem'
|
|
2079
|
+
: '1.5rem', pl: column.id === 'mrt-row-expand'
|
|
2080
|
+
? `${row.depth +
|
|
2081
|
+
(density === 'compact'
|
|
2082
|
+
? 0.5
|
|
2083
|
+
: density === 'comfortable'
|
|
2084
|
+
? 0.75
|
|
2085
|
+
: 1.25)}rem`
|
|
2086
|
+
: undefined, textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined, whiteSpace: density === 'compact' ? 'nowrap' : 'normal', zIndex: (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id ? 2 : column.getIsPinned() ? 1 : 0, '&:hover': {
|
|
2087
|
+
backgroundColor: enableHover &&
|
|
2088
|
+
enableEditing &&
|
|
2089
|
+
columnDef.enableEditing !== false &&
|
|
2090
|
+
['table', 'cell'].includes(editingMode !== null && editingMode !== void 0 ? editingMode : '')
|
|
2091
|
+
? theme.palette.mode === 'dark'
|
|
2092
|
+
? `${lighten(theme.palette.background.default, 0.2)} !important`
|
|
2093
|
+
: `${darken(theme.palette.background.default, 0.1)} !important`
|
|
2094
|
+
: undefined,
|
|
2095
|
+
} }, getCommonCellStyles({ column, table, theme, tableCellProps })), draggingBorders)) }),
|
|
2096
|
+
React.createElement(React.Fragment, null, cell.getIsPlaceholder() ? null : isLoading || showSkeletons ? (React.createElement(Skeleton, Object.assign({ animation: "wave", height: 20, width: skeletonWidth }, skeletonProps))) : enableRowNumbers &&
|
|
2089
2097
|
rowNumberMode === 'static' &&
|
|
2090
2098
|
column.id === 'mrt-row-numbers' ? (rowIndex + 1) : column.id === 'mrt-row-drag' ? (React.createElement(MRT_TableBodyRowGrabHandle, { cell: cell, rowRef: rowRef, table: table })) : columnDefType === 'display' &&
|
|
2091
2099
|
(column.id === 'mrt-row-select' ||
|
|
@@ -2155,9 +2163,10 @@ const MRT_TableBodyRow = ({ row, rowIndex, table, virtualRow, }) => {
|
|
|
2155
2163
|
renderDetailPanel && !row.getIsGrouped() && (React.createElement(MRT_TableDetailPanel, { row: row, table: table }))));
|
|
2156
2164
|
};
|
|
2157
2165
|
|
|
2158
|
-
const MRT_TableBody = ({ table
|
|
2159
|
-
|
|
2160
|
-
const {
|
|
2166
|
+
const MRT_TableBody = ({ table }) => {
|
|
2167
|
+
var _a;
|
|
2168
|
+
const { getRowModel, getPrePaginationRowModel, getState, options: { enableGlobalFilterRankedResults, enablePagination, enableRowVirtualization, localization, manualFiltering, manualSorting, muiTableBodyProps, virtualizerInstanceRef, virtualizerProps, }, refs: { tableContainerRef, tablePaperRef }, } = table;
|
|
2169
|
+
const { columnFilters, globalFilter, pagination, sorting } = getState();
|
|
2161
2170
|
const tableBodyProps = muiTableBodyProps instanceof Function
|
|
2162
2171
|
? muiTableBodyProps({ table })
|
|
2163
2172
|
: muiTableBodyProps;
|
|
@@ -2222,7 +2231,18 @@ const MRT_TableBody = ({ table, tableContainerRef }) => {
|
|
|
2222
2231
|
// ? virtualizer.getTotalSize() - virtualRows[virtualRows.length - 1].end
|
|
2223
2232
|
// : 0;
|
|
2224
2233
|
// }
|
|
2225
|
-
return (React.createElement(TableBody, Object.assign({}, tableBodyProps),
|
|
2234
|
+
return (React.createElement(TableBody, Object.assign({}, tableBodyProps), !rows.length ? (React.createElement("tr", null,
|
|
2235
|
+
React.createElement("td", { colSpan: table.getVisibleLeafColumns().length },
|
|
2236
|
+
React.createElement(Typography, { sx: {
|
|
2237
|
+
color: 'text.secondary',
|
|
2238
|
+
fontStyle: 'italic',
|
|
2239
|
+
maxWidth: `min(100vw, ${(_a = tablePaperRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth}px)`,
|
|
2240
|
+
py: '2rem',
|
|
2241
|
+
textAlign: 'center',
|
|
2242
|
+
width: '100%',
|
|
2243
|
+
} }, globalFilter || columnFilters.length
|
|
2244
|
+
? localization.noResultsFound
|
|
2245
|
+
: localization.noRecordsToDisplay)))) : (React.createElement(React.Fragment, null,
|
|
2226
2246
|
enableRowVirtualization && paddingTop > 0 && (React.createElement("tr", null,
|
|
2227
2247
|
React.createElement("td", { style: { height: `${paddingTop}px` } }))),
|
|
2228
2248
|
(enableRowVirtualization ? virtualRows : rows).map((rowOrVirtualRow, rowIndex) => {
|
|
@@ -2232,12 +2252,12 @@ const MRT_TableBody = ({ table, tableContainerRef }) => {
|
|
|
2232
2252
|
return (React.createElement(MRT_TableBodyRow, { key: row.id, row: row, rowIndex: enableRowVirtualization ? rowOrVirtualRow.index : rowIndex, table: table, virtualRow: enableRowVirtualization ? rowOrVirtualRow : null }));
|
|
2233
2253
|
}),
|
|
2234
2254
|
enableRowVirtualization && paddingBottom > 0 && (React.createElement("tr", null,
|
|
2235
|
-
React.createElement("td", { style: { height: `${paddingBottom}px` } })))));
|
|
2255
|
+
React.createElement("td", { style: { height: `${paddingBottom}px` } })))))));
|
|
2236
2256
|
};
|
|
2237
2257
|
|
|
2238
2258
|
const MRT_TableFooterCell = ({ footer, table }) => {
|
|
2239
2259
|
var _a, _b, _c;
|
|
2240
|
-
const { getState, options: { muiTableFooterCellProps
|
|
2260
|
+
const { getState, options: { muiTableFooterCellProps }, } = table;
|
|
2241
2261
|
const { density } = getState();
|
|
2242
2262
|
const { column } = footer;
|
|
2243
2263
|
const { columnDef } = column;
|
|
@@ -2249,13 +2269,11 @@ const MRT_TableFooterCell = ({ footer, table }) => {
|
|
|
2249
2269
|
? columnDef.muiTableFooterCellProps({ column, table })
|
|
2250
2270
|
: columnDef.muiTableFooterCellProps;
|
|
2251
2271
|
const tableCellProps = Object.assign(Object.assign({}, mTableFooterCellProps), mcTableFooterCellProps);
|
|
2252
|
-
return (React.createElement(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: footer.colSpan, variant: "head" }, tableCellProps, { sx: (theme) => (Object.assign({
|
|
2272
|
+
return (React.createElement(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: footer.colSpan, variant: "head" }, tableCellProps, { sx: (theme) => (Object.assign({ fontWeight: 'bold', p: density === 'compact'
|
|
2253
2273
|
? '0.5rem'
|
|
2254
2274
|
: density === 'comfortable'
|
|
2255
2275
|
? '1rem'
|
|
2256
|
-
: '1.5rem',
|
|
2257
|
-
? tableCellProps.sx(theme)
|
|
2258
|
-
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))) }),
|
|
2276
|
+
: '1.5rem', verticalAlign: 'top' }, getCommonCellStyles({ column, table, theme, tableCellProps }))) }),
|
|
2259
2277
|
React.createElement(React.Fragment, null, footer.isPlaceholder
|
|
2260
2278
|
? null
|
|
2261
2279
|
: (_c = (_b = (columnDef.Footer instanceof Function
|
|
@@ -2288,16 +2306,16 @@ const MRT_TableFooter = ({ table }) => {
|
|
|
2288
2306
|
? muiTableFooterProps({ table })
|
|
2289
2307
|
: muiTableFooterProps;
|
|
2290
2308
|
const stickFooter = (isFullScreen || enableStickyFooter) && enableStickyFooter !== false;
|
|
2291
|
-
return (React.createElement(TableFooter, Object.assign({}, tableFooterProps, { sx: (theme) => (Object.assign({
|
|
2309
|
+
return (React.createElement(TableFooter, Object.assign({}, tableFooterProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.06), bottom: stickFooter ? 0 : undefined, opacity: stickFooter ? 0.95 : undefined, outline: stickFooter
|
|
2292
2310
|
? theme.palette.mode === 'light'
|
|
2293
2311
|
? `1px solid ${theme.palette.grey[300]}`
|
|
2294
2312
|
: `1px solid ${theme.palette.grey[700]}`
|
|
2295
|
-
: undefined }, ((tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx) instanceof Function
|
|
2313
|
+
: undefined, position: stickFooter ? 'sticky' : undefined }, ((tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx) instanceof Function
|
|
2296
2314
|
? tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx(theme)
|
|
2297
2315
|
: tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx))) }), getFooterGroups().map((footerGroup) => (React.createElement(MRT_TableFooterRow, { footerGroup: footerGroup, key: footerGroup.id, table: table })))));
|
|
2298
2316
|
};
|
|
2299
2317
|
|
|
2300
|
-
const MRT_Table = ({
|
|
2318
|
+
const MRT_Table = ({ table }) => {
|
|
2301
2319
|
const { getState, options: { enableColumnResizing, enableRowVirtualization, enableStickyHeader, enableTableFooter, enableTableHead, muiTableProps, }, } = table;
|
|
2302
2320
|
const { isFullScreen } = getState();
|
|
2303
2321
|
const tableProps = muiTableProps instanceof Function
|
|
@@ -2307,7 +2325,7 @@ const MRT_Table = ({ tableContainerRef, table }) => {
|
|
|
2307
2325
|
? tableProps.sx(theme)
|
|
2308
2326
|
: tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx))) }),
|
|
2309
2327
|
enableTableHead && React.createElement(MRT_TableHead, { table: table }),
|
|
2310
|
-
React.createElement(MRT_TableBody, {
|
|
2328
|
+
React.createElement(MRT_TableBody, { table: table }),
|
|
2311
2329
|
enableTableFooter && React.createElement(MRT_TableFooter, { table: table })));
|
|
2312
2330
|
};
|
|
2313
2331
|
|
|
@@ -2342,31 +2360,42 @@ const MRT_TableContainer = ({ table }) => {
|
|
|
2342
2360
|
: tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx))), style: Object.assign({ maxHeight: isFullScreen
|
|
2343
2361
|
? `calc(100vh - ${totalToolbarHeight}px)`
|
|
2344
2362
|
: undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style) }),
|
|
2345
|
-
React.createElement(MRT_Table, {
|
|
2363
|
+
React.createElement(MRT_Table, { table: table })));
|
|
2346
2364
|
};
|
|
2347
2365
|
|
|
2348
2366
|
const MRT_TablePaper = ({ table }) => {
|
|
2349
|
-
const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps }, } = table;
|
|
2367
|
+
const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps, renderBottomToolbar, renderTopToolbar, }, refs: { tablePaperRef }, } = table;
|
|
2350
2368
|
const { isFullScreen } = getState();
|
|
2351
|
-
useEffect(() => {
|
|
2352
|
-
if (typeof window !== 'undefined') {
|
|
2353
|
-
if (isFullScreen) {
|
|
2354
|
-
document.body.style.height = '100vh';
|
|
2355
|
-
}
|
|
2356
|
-
else {
|
|
2357
|
-
document.body.style.height = 'auto';
|
|
2358
|
-
}
|
|
2359
|
-
}
|
|
2360
|
-
}, [isFullScreen]);
|
|
2361
2369
|
const tablePaperProps = muiTablePaperProps instanceof Function
|
|
2362
2370
|
? muiTablePaperProps({ table })
|
|
2363
2371
|
: muiTablePaperProps;
|
|
2364
|
-
return (React.createElement(Paper, Object.assign({ elevation: 2 }, tablePaperProps, {
|
|
2372
|
+
return (React.createElement(Paper, Object.assign({ elevation: 2 }, tablePaperProps, { ref: (ref) => {
|
|
2373
|
+
tablePaperRef.current = ref;
|
|
2374
|
+
if (tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.ref) {
|
|
2375
|
+
//@ts-ignore
|
|
2376
|
+
tablePaperProps.ref.current = ref;
|
|
2377
|
+
}
|
|
2378
|
+
}, sx: (theme) => (Object.assign({ transition: 'all 0.2s ease-in-out' }, ((tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx) instanceof Function
|
|
2365
2379
|
? tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx(theme)
|
|
2366
|
-
: tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx))), style: Object.assign(Object.assign({}, tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style),
|
|
2367
|
-
|
|
2380
|
+
: tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx))), style: Object.assign(Object.assign({}, tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style), (isFullScreen
|
|
2381
|
+
? {
|
|
2382
|
+
height: '100vh',
|
|
2383
|
+
margin: 0,
|
|
2384
|
+
maxHeight: '100vh',
|
|
2385
|
+
maxWidth: '100vw',
|
|
2386
|
+
padding: 0,
|
|
2387
|
+
width: '100vw',
|
|
2388
|
+
}
|
|
2389
|
+
: {})) }),
|
|
2390
|
+
enableTopToolbar &&
|
|
2391
|
+
(renderTopToolbar instanceof Function
|
|
2392
|
+
? renderTopToolbar({ table })
|
|
2393
|
+
: renderTopToolbar !== null && renderTopToolbar !== void 0 ? renderTopToolbar : React.createElement(MRT_TopToolbar, { table: table })),
|
|
2368
2394
|
React.createElement(MRT_TableContainer, { table: table }),
|
|
2369
|
-
enableBottomToolbar &&
|
|
2395
|
+
enableBottomToolbar &&
|
|
2396
|
+
(renderBottomToolbar instanceof Function
|
|
2397
|
+
? renderBottomToolbar({ table })
|
|
2398
|
+
: renderBottomToolbar !== null && renderBottomToolbar !== void 0 ? renderBottomToolbar : React.createElement(MRT_BottomToolbar, { table: table }))));
|
|
2370
2399
|
};
|
|
2371
2400
|
|
|
2372
2401
|
const MRT_EditRowModal = ({ open, row, table, }) => {
|
|
@@ -2394,6 +2423,7 @@ const MRT_TableRoot = (props) => {
|
|
|
2394
2423
|
const filterInputRefs = useRef({});
|
|
2395
2424
|
const searchInputRef = useRef(null);
|
|
2396
2425
|
const tableContainerRef = useRef(null);
|
|
2426
|
+
const tablePaperRef = useRef(null);
|
|
2397
2427
|
const topToolbarRef = useRef(null);
|
|
2398
2428
|
const initialState = useMemo(() => {
|
|
2399
2429
|
var _a, _b;
|
|
@@ -2429,14 +2459,14 @@ const MRT_TableRoot = (props) => {
|
|
|
2429
2459
|
const [showColumnFilters, setShowFilters] = useState((_p = initialState === null || initialState === void 0 ? void 0 : initialState.showColumnFilters) !== null && _p !== void 0 ? _p : false);
|
|
2430
2460
|
const [showGlobalFilter, setShowGlobalFilter] = useState((_q = initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) !== null && _q !== void 0 ? _q : false);
|
|
2431
2461
|
const displayColumns = useMemo(() => {
|
|
2432
|
-
var _a, _b, _c, _d, _e
|
|
2462
|
+
var _a, _b, _c, _d, _e;
|
|
2433
2463
|
return [
|
|
2434
|
-
columnOrder.includes('mrt-row-drag') && Object.assign(Object.assign(Object.assign({ header:
|
|
2435
|
-
columnOrder.includes('mrt-row-actions') && Object.assign(Object.assign(Object.assign({ Cell: ({ cell, row }) => (React.createElement(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, table: table })), header:
|
|
2464
|
+
columnOrder.includes('mrt-row-drag') && Object.assign(Object.assign(Object.assign({ header: props.localization.move, size: 60 }, props.defaultDisplayColumn), (_a = props.displayColumnDefOptions) === null || _a === void 0 ? void 0 : _a['mrt-row-drag']), { id: 'mrt-row-drag' }),
|
|
2465
|
+
columnOrder.includes('mrt-row-actions') && Object.assign(Object.assign(Object.assign({ Cell: ({ cell, row }) => (React.createElement(MRT_ToggleRowActionMenuButton, { cell: cell, row: row, table: table })), header: props.localization.actions, size: 70 }, props.defaultDisplayColumn), (_b = props.displayColumnDefOptions) === null || _b === void 0 ? void 0 : _b['mrt-row-actions']), { id: 'mrt-row-actions' }),
|
|
2436
2466
|
columnOrder.includes('mrt-row-expand') &&
|
|
2437
|
-
showExpandColumn(props, grouping) && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React.createElement(MRT_ExpandButton, { row: row, table: table })), Header: () => props.enableExpandAll ? (React.createElement(MRT_ExpandAllButton, { table: table })) : null, header:
|
|
2438
|
-
columnOrder.includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React.createElement(MRT_SelectCheckbox, { row: row, table: table })), Header: () => props.enableSelectAll ? (React.createElement(MRT_SelectCheckbox, { selectAll: true, table: table })) : null, header:
|
|
2439
|
-
columnOrder.includes('mrt-row-numbers') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => row.index + 1, Header: () =>
|
|
2467
|
+
showExpandColumn(props, grouping) && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React.createElement(MRT_ExpandButton, { row: row, table: table })), Header: () => props.enableExpandAll ? (React.createElement(MRT_ExpandAllButton, { table: table })) : null, header: props.localization.expand, size: 60 }, props.defaultDisplayColumn), (_c = props.displayColumnDefOptions) === null || _c === void 0 ? void 0 : _c['mrt-row-expand']), { id: 'mrt-row-expand' }),
|
|
2468
|
+
columnOrder.includes('mrt-row-select') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => (React.createElement(MRT_SelectCheckbox, { row: row, table: table })), Header: () => props.enableSelectAll ? (React.createElement(MRT_SelectCheckbox, { selectAll: true, table: table })) : null, header: props.localization.select, size: 60 }, props.defaultDisplayColumn), (_d = props.displayColumnDefOptions) === null || _d === void 0 ? void 0 : _d['mrt-row-select']), { id: 'mrt-row-select' }),
|
|
2469
|
+
columnOrder.includes('mrt-row-numbers') && Object.assign(Object.assign(Object.assign({ Cell: ({ row }) => row.index + 1, Header: () => props.localization.rowNumber, header: props.localization.rowNumbers, size: 60 }, props.defaultDisplayColumn), (_e = props.displayColumnDefOptions) === null || _e === void 0 ? void 0 : _e['mrt-row-numbers']), { id: 'mrt-row-numbers' }),
|
|
2440
2470
|
].filter(Boolean);
|
|
2441
2471
|
}, [
|
|
2442
2472
|
columnOrder,
|
|
@@ -2514,22 +2544,39 @@ const MRT_TableRoot = (props) => {
|
|
|
2514
2544
|
filterInputRefs,
|
|
2515
2545
|
searchInputRef,
|
|
2516
2546
|
tableContainerRef,
|
|
2547
|
+
tablePaperRef,
|
|
2517
2548
|
topToolbarRef,
|
|
2518
2549
|
}, setColumnFilterFns: (_x = props.onFilterFnsChange) !== null && _x !== void 0 ? _x : setColumnFilterFns, setDensity: (_y = props.onDensityChange) !== null && _y !== void 0 ? _y : setDensity, setDraggingColumn: (_z = props.onDraggingColumnChange) !== null && _z !== void 0 ? _z : setDraggingColumn, setDraggingRow: (_0 = props.onDraggingRowChange) !== null && _0 !== void 0 ? _0 : setDraggingRow, setEditingCell: (_1 = props.onEditingCellChange) !== null && _1 !== void 0 ? _1 : setEditingCell, setEditingRow: (_2 = props.onEditingRowChange) !== null && _2 !== void 0 ? _2 : setEditingRow, setGlobalFilterFn: (_3 = props.onGlobalFilterFnChange) !== null && _3 !== void 0 ? _3 : setGlobalFilterFn, setHoveredColumn: (_4 = props.onHoveredColumnChange) !== null && _4 !== void 0 ? _4 : setHoveredColumn, setHoveredRow: (_5 = props.onHoveredRowChange) !== null && _5 !== void 0 ? _5 : setHoveredRow, setIsFullScreen: (_6 = props.onIsFullScreenChange) !== null && _6 !== void 0 ? _6 : setIsFullScreen, setShowAlertBanner: (_7 = props.onShowAlertBannerChange) !== null && _7 !== void 0 ? _7 : setShowAlertBanner, setShowFilters: (_8 = props.onShowFiltersChange) !== null && _8 !== void 0 ? _8 : setShowFilters, setShowGlobalFilter: (_9 = props.onShowGlobalFilterChange) !== null && _9 !== void 0 ? _9 : setShowGlobalFilter });
|
|
2519
2550
|
if (props.tableInstanceRef) {
|
|
2520
2551
|
props.tableInstanceRef.current = table;
|
|
2521
2552
|
}
|
|
2553
|
+
const initialBodyHeight = useRef();
|
|
2554
|
+
useEffect(() => {
|
|
2555
|
+
if (typeof window !== 'undefined') {
|
|
2556
|
+
initialBodyHeight.current = document.body.style.height;
|
|
2557
|
+
}
|
|
2558
|
+
}, []);
|
|
2559
|
+
useEffect(() => {
|
|
2560
|
+
if (typeof window !== 'undefined') {
|
|
2561
|
+
if (table.getState().isFullScreen) {
|
|
2562
|
+
document.body.style.height = '100vh';
|
|
2563
|
+
}
|
|
2564
|
+
else {
|
|
2565
|
+
document.body.style.height = initialBodyHeight.current;
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2568
|
+
}, [table.getState().isFullScreen]);
|
|
2522
2569
|
return (React.createElement(React.Fragment, null,
|
|
2523
|
-
React.createElement(Dialog, { PaperComponent: Box, TransitionComponent: Grow, disablePortal: true, fullScreen: true, keepMounted: false, onClose: () => setIsFullScreen(false), open: isFullScreen, transitionDuration: 400 },
|
|
2570
|
+
React.createElement(Dialog, { PaperComponent: Box, TransitionComponent: Grow, disablePortal: true, fullScreen: true, keepMounted: false, onClose: () => table.setIsFullScreen(false), open: table.getState().isFullScreen, transitionDuration: 400 },
|
|
2524
2571
|
React.createElement(MRT_TablePaper, { table: table })),
|
|
2525
|
-
!isFullScreen && React.createElement(MRT_TablePaper, { table: table }),
|
|
2572
|
+
!table.getState().isFullScreen && (React.createElement(MRT_TablePaper, { table: table })),
|
|
2526
2573
|
editingRow && props.editingMode === 'modal' && (React.createElement(MRT_EditRowModal, { row: editingRow, table: table, open: true }))));
|
|
2527
2574
|
};
|
|
2528
2575
|
|
|
2529
2576
|
var MaterialReactTable = (_a) => {
|
|
2530
2577
|
var { aggregationFns, autoResetExpanded = false, columnResizeMode = 'onEnd', defaultColumn = { minSize: 40, maxSize: 1000, size: 180 }, defaultDisplayColumn, editingMode = 'modal', enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnResizing = false, enableDensityToggle = true, enableExpandAll = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterRankedResults = true, enableGrouping = false, enableHiding = true, enableMultiRowSelection = true, enableMultiSort = true, enablePagination = true, enablePinning = false, enableRowSelection = false, enableSelectAll = true, enableSorting = true, enableStickyHeader = false, enableTableFooter = true, enableTableHead = true, enableToolbarInternalActions = true, enableTopToolbar = true, filterFns, icons, localization, positionActionsColumn = 'first', positionExpandColumn = 'first', positionGlobalFilter = 'right', positionPagination = 'bottom', positionToolbarAlertBanner = 'top', positionToolbarDropZone = 'top', rowNumberMode = 'original', selectAllMode = 'all', sortingFns } = _a, rest = __rest(_a, ["aggregationFns", "autoResetExpanded", "columnResizeMode", "defaultColumn", "defaultDisplayColumn", "editingMode", "enableBottomToolbar", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnResizing", "enableDensityToggle", "enableExpandAll", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enablePinning", "enableRowSelection", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "localization", "positionActionsColumn", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberMode", "selectAllMode", "sortingFns"]);
|
|
2531
|
-
return (React.createElement(MRT_TableRoot, Object.assign({ aggregationFns: Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns), autoResetExpanded: autoResetExpanded, columnResizeMode: columnResizeMode, defaultColumn: defaultColumn, defaultDisplayColumn: Object.assign({ columnDefType: 'display', enableClickToCopy: false, enableColumnActions: false, enableColumnDragging: false, enableColumnFilter: false, enableColumnOrdering: false, enableEditing: false, enableGlobalFilter: false, enableGrouping: false, enableHiding: false, enableResizing: false, enableSorting: false }, defaultDisplayColumn), editingMode: editingMode, enableBottomToolbar: enableBottomToolbar, enableColumnActions: enableColumnActions, enableColumnFilters: enableColumnFilters, enableColumnOrdering: enableColumnOrdering, enableColumnResizing: enableColumnResizing, enableDensityToggle: enableDensityToggle, enableExpandAll: enableExpandAll, enableFilters: enableFilters, enableFullScreenToggle: enableFullScreenToggle, enableGlobalFilter: enableGlobalFilter, enableGlobalFilterRankedResults: enableGlobalFilterRankedResults, enableGrouping: enableGrouping, enableHiding: enableHiding, enableMultiRowSelection: enableMultiRowSelection, enableMultiSort: enableMultiSort, enablePagination: enablePagination, enablePinning: enablePinning, enableRowSelection: enableRowSelection, enableSelectAll: enableSelectAll, enableSorting: enableSorting, enableStickyHeader: enableStickyHeader, enableTableFooter: enableTableFooter, enableTableHead: enableTableHead, enableToolbarInternalActions: enableToolbarInternalActions, enableTopToolbar: enableTopToolbar, filterFns: Object.assign(Object.assign({}, MRT_FilterFns), filterFns), icons: Object.assign(Object.assign({}, MRT_Default_Icons), icons), localization: Object.assign(Object.assign({},
|
|
2578
|
+
return (React.createElement(MRT_TableRoot, Object.assign({ aggregationFns: Object.assign(Object.assign({}, MRT_AggregationFns), aggregationFns), autoResetExpanded: autoResetExpanded, columnResizeMode: columnResizeMode, defaultColumn: defaultColumn, defaultDisplayColumn: Object.assign({ columnDefType: 'display', enableClickToCopy: false, enableColumnActions: false, enableColumnDragging: false, enableColumnFilter: false, enableColumnOrdering: false, enableEditing: false, enableGlobalFilter: false, enableGrouping: false, enableHiding: false, enableResizing: false, enableSorting: false }, defaultDisplayColumn), editingMode: editingMode, enableBottomToolbar: enableBottomToolbar, enableColumnActions: enableColumnActions, enableColumnFilters: enableColumnFilters, enableColumnOrdering: enableColumnOrdering, enableColumnResizing: enableColumnResizing, enableDensityToggle: enableDensityToggle, enableExpandAll: enableExpandAll, enableFilters: enableFilters, enableFullScreenToggle: enableFullScreenToggle, enableGlobalFilter: enableGlobalFilter, enableGlobalFilterRankedResults: enableGlobalFilterRankedResults, enableGrouping: enableGrouping, enableHiding: enableHiding, enableMultiRowSelection: enableMultiRowSelection, enableMultiSort: enableMultiSort, enablePagination: enablePagination, enablePinning: enablePinning, enableRowSelection: enableRowSelection, enableSelectAll: enableSelectAll, enableSorting: enableSorting, enableStickyHeader: enableStickyHeader, enableTableFooter: enableTableFooter, enableTableHead: enableTableHead, enableToolbarInternalActions: enableToolbarInternalActions, enableTopToolbar: enableTopToolbar, filterFns: Object.assign(Object.assign({}, MRT_FilterFns), filterFns), icons: Object.assign(Object.assign({}, MRT_Default_Icons), icons), localization: Object.assign(Object.assign({}, MRT_Localization_EN), localization), positionActionsColumn: positionActionsColumn, positionExpandColumn: positionExpandColumn, positionGlobalFilter: positionGlobalFilter, positionPagination: positionPagination, positionToolbarAlertBanner: positionToolbarAlertBanner, positionToolbarDropZone: positionToolbarDropZone, rowNumberMode: rowNumberMode, selectAllMode: selectAllMode, sortingFns: Object.assign(Object.assign({}, MRT_SortingFns), sortingFns) }, rest)));
|
|
2532
2579
|
};
|
|
2533
2580
|
|
|
2534
|
-
export { MRT_CopyButton, MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_ShowHideColumnsButton, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MaterialReactTable as default };
|
|
2581
|
+
export { MRT_CopyButton, MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_ShowHideColumnsButton, MRT_TablePagination, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MRT_ToolbarInternalButtons, MaterialReactTable as default };
|
|
2535
2582
|
//# sourceMappingURL=material-react-table.esm.js.map
|