material-react-table 3.0.0-beta.1 → 3.0.0-rc.0
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/index.d.ts +91 -87
- package/dist/index.esm.js +114 -76
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +114 -75
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/body/MRT_TableBodyCell.tsx +9 -11
- package/src/components/buttons/MRT_RowPinButton.tsx +2 -0
- package/src/components/buttons/MRT_ToggleFullScreenButton.tsx +2 -0
- package/src/components/footer/MRT_TableFooterCell.tsx +8 -9
- package/src/components/head/MRT_TableHeadCell.tsx +10 -11
- package/src/components/table/MRT_TableLoadingOverlay.tsx +2 -1
- package/src/components/table/MRT_TablePaper.tsx +52 -48
- package/src/components/toolbar/MRT_TablePagination.tsx +3 -2
- package/src/hooks/useMRT_TableOptions.ts +5 -3
- package/src/types.ts +70 -66
- package/src/utils/cell.utils.ts +57 -11
package/dist/index.esm.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { flexRender as flexRender$1, createRow as createRow$1, sortingFns, aggregationFns, filterFns, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from '@tanstack/react-table';
|
2
|
-
import { useMemo, useState, useReducer, useRef, useEffect, useCallback, memo, Fragment as Fragment$1, useLayoutEffect } from 'react';
|
2
|
+
import { useMemo, useState, useId, useReducer, useRef, useEffect, useCallback, memo, Fragment as Fragment$1, useLayoutEffect } from 'react';
|
3
3
|
import { compareItems, rankItem, rankings } from '@tanstack/match-sorter-utils';
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
5
5
|
import IconButton from '@mui/material/IconButton';
|
@@ -50,7 +50,7 @@ import ViewColumnIcon from '@mui/icons-material/ViewColumn';
|
|
50
50
|
import VisibilityOffIcon from '@mui/icons-material/VisibilityOff';
|
51
51
|
import { defaultRangeExtractor, useVirtualizer } from '@tanstack/react-virtual';
|
52
52
|
import Paper from '@mui/material/Paper';
|
53
|
-
import
|
53
|
+
import FocusTrap from '@mui/material/Unstable_TrapFocus/FocusTrap';
|
54
54
|
import TableContainer from '@mui/material/TableContainer';
|
55
55
|
import Table from '@mui/material/Table';
|
56
56
|
import TableBody from '@mui/material/TableBody';
|
@@ -407,6 +407,10 @@ const getMRT_SelectAllHandler = ({ table }) => (event, value, forceAll) => {
|
|
407
407
|
lastSelectedRowId.current = null;
|
408
408
|
};
|
409
409
|
|
410
|
+
const isWinCtrlMacMeta = (event) => {
|
411
|
+
return ((event.ctrlKey && navigator.platform.toLowerCase().includes('win')) ||
|
412
|
+
(event.metaKey && navigator.platform.toLowerCase().includes('mac')));
|
413
|
+
};
|
410
414
|
const isCellEditable = ({ cell, table, }) => {
|
411
415
|
const { enableEditing } = table.options;
|
412
416
|
const { column: { columnDef }, row, } = cell;
|
@@ -429,13 +433,17 @@ const openEditingCell = ({ cell, table, }) => {
|
|
429
433
|
});
|
430
434
|
}
|
431
435
|
};
|
432
|
-
const
|
436
|
+
const cellKeyboardShortcuts = ({ cell, cellElements, cellValue, containerElement, event, header, parentElement, table, }) => {
|
433
437
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
434
|
-
if (
|
438
|
+
if (!table.options.enableKeyboardShortcuts)
|
439
|
+
return;
|
440
|
+
const currentCell = event.currentTarget;
|
441
|
+
if (cellValue && isWinCtrlMacMeta(event) && event.key === 'c') {
|
435
442
|
navigator.clipboard.writeText(cellValue);
|
436
443
|
}
|
437
444
|
else if (['Enter', ' '].includes(event.key)) {
|
438
445
|
if (((_a = cell === null || cell === void 0 ? void 0 : cell.column) === null || _a === void 0 ? void 0 : _a.id) === 'mrt-row-select') {
|
446
|
+
event.preventDefault();
|
439
447
|
getMRT_RowSelectionHandler({
|
440
448
|
row: cell.row,
|
441
449
|
table,
|
@@ -445,6 +453,7 @@ const cellNavigation = ({ cell, cellElements, cellValue, containerElement, event
|
|
445
453
|
}
|
446
454
|
else if (((_b = header === null || header === void 0 ? void 0 : header.column) === null || _b === void 0 ? void 0 : _b.id) === 'mrt-row-select' &&
|
447
455
|
table.options.enableSelectAll) {
|
456
|
+
event.preventDefault();
|
448
457
|
getMRT_SelectAllHandler({
|
449
458
|
table,
|
450
459
|
})(event);
|
@@ -452,26 +461,44 @@ const cellNavigation = ({ cell, cellElements, cellValue, containerElement, event
|
|
452
461
|
else if (((_c = cell === null || cell === void 0 ? void 0 : cell.column) === null || _c === void 0 ? void 0 : _c.id) === 'mrt-row-expand' &&
|
453
462
|
(cell.row.getCanExpand() ||
|
454
463
|
((_e = (_d = table.options).renderDetailPanel) === null || _e === void 0 ? void 0 : _e.call(_d, { row: cell.row, table })))) {
|
464
|
+
event.preventDefault();
|
455
465
|
cell.row.toggleExpanded();
|
456
466
|
}
|
457
467
|
else if (((_f = header === null || header === void 0 ? void 0 : header.column) === null || _f === void 0 ? void 0 : _f.id) === 'mrt-row-expand' &&
|
458
468
|
table.options.enableExpandAll) {
|
469
|
+
event.preventDefault();
|
459
470
|
table.toggleAllRowsExpanded();
|
460
471
|
}
|
461
|
-
else if ((_g = header === null || header === void 0 ? void 0 : header.column) === null || _g === void 0 ? void 0 : _g.getCanSort()) {
|
462
|
-
header.column.toggleSorting();
|
463
|
-
}
|
464
472
|
else if ((cell === null || cell === void 0 ? void 0 : cell.column.id) === 'mrt-row-pin') {
|
473
|
+
event.preventDefault();
|
465
474
|
cell.row.getIsPinned()
|
466
475
|
? cell.row.pin(false)
|
467
|
-
: cell.row.pin(((
|
476
|
+
: cell.row.pin(((_g = table.options.rowPinningDisplayMode) === null || _g === void 0 ? void 0 : _g.includes('bottom'))
|
468
477
|
? 'bottom'
|
469
478
|
: 'top');
|
470
479
|
}
|
480
|
+
else if (header && isWinCtrlMacMeta(event)) {
|
481
|
+
const actionsButton = currentCell.querySelector(`button[aria-label="${table.options.localization.columnActions}"]`);
|
482
|
+
if (actionsButton) {
|
483
|
+
actionsButton.click();
|
484
|
+
}
|
485
|
+
}
|
486
|
+
else if ((_h = header === null || header === void 0 ? void 0 : header.column) === null || _h === void 0 ? void 0 : _h.getCanSort()) {
|
487
|
+
event.preventDefault();
|
488
|
+
header.column.toggleSorting();
|
489
|
+
}
|
471
490
|
}
|
472
|
-
else if ([
|
491
|
+
else if ([
|
492
|
+
'ArrowRight',
|
493
|
+
'ArrowLeft',
|
494
|
+
'ArrowUp',
|
495
|
+
'ArrowDown',
|
496
|
+
'Home',
|
497
|
+
'End',
|
498
|
+
'PageUp',
|
499
|
+
'PageDown',
|
500
|
+
].includes(event.key)) {
|
473
501
|
event.preventDefault();
|
474
|
-
const currentCell = event.currentTarget;
|
475
502
|
const currentRow = parentElement || currentCell.closest('tr');
|
476
503
|
const tableElement = containerElement || currentCell.closest('table');
|
477
504
|
const allCells = cellElements ||
|
@@ -491,6 +518,16 @@ const cellNavigation = ({ cell, cellElements, cellValue, containerElement, event
|
|
491
518
|
const targetCell = edge === 'f' ? rowCells[0] : rowCells[rowCells.length - 1];
|
492
519
|
return targetCell;
|
493
520
|
};
|
521
|
+
//page up/down first or last cell in column
|
522
|
+
const findBottomTopCell = (columnIndex, edge) => {
|
523
|
+
var _a;
|
524
|
+
const row = edge === 't'
|
525
|
+
? tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelector('tr')
|
526
|
+
: (_a = tableElement === null || tableElement === void 0 ? void 0 : tableElement.lastElementChild) === null || _a === void 0 ? void 0 : _a.lastElementChild;
|
527
|
+
const rowCells = Array.from((row === null || row === void 0 ? void 0 : row.children) || []);
|
528
|
+
const targetCell = rowCells[columnIndex];
|
529
|
+
return targetCell;
|
530
|
+
};
|
494
531
|
const findAdjacentCell = (columnIndex, searchDirection) => {
|
495
532
|
const searchArray = searchDirection === 'f'
|
496
533
|
? allCells.slice(currentCellIndex + 1)
|
@@ -511,10 +548,16 @@ const cellNavigation = ({ cell, cellElements, cellValue, containerElement, event
|
|
511
548
|
nextCell = findAdjacentCell(currentIndex, 'f');
|
512
549
|
break;
|
513
550
|
case 'Home':
|
514
|
-
nextCell = findEdgeCell(event
|
551
|
+
nextCell = findEdgeCell(isWinCtrlMacMeta(event) ? 'f' : 'c', 'f');
|
515
552
|
break;
|
516
553
|
case 'End':
|
517
|
-
nextCell = findEdgeCell(event
|
554
|
+
nextCell = findEdgeCell(isWinCtrlMacMeta(event) ? 'l' : 'c', 'l');
|
555
|
+
break;
|
556
|
+
case 'PageUp':
|
557
|
+
nextCell = findBottomTopCell(currentIndex, 't');
|
558
|
+
break;
|
559
|
+
case 'PageDown':
|
560
|
+
nextCell = findBottomTopCell(currentIndex, 'b');
|
518
561
|
break;
|
519
562
|
}
|
520
563
|
if (nextCell) {
|
@@ -1118,7 +1161,7 @@ const MRT_RowPinButton = (_a) => {
|
|
1118
1161
|
event.stopPropagation();
|
1119
1162
|
row.pin(isPinned ? false : pinningPosition);
|
1120
1163
|
};
|
1121
|
-
return (jsx(Tooltip, Object.assign({}, getCommonTooltipProps(), { 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: {
|
1164
|
+
return (jsx(Tooltip, Object.assign({}, getCommonTooltipProps(), { open: tooltipOpened, title: isPinned ? localization.unpin : localization.pin, children: jsx(IconButton, Object.assign({ "aria-label": localization.pin, onBlur: () => setTooltipOpened(false), onClick: handleTogglePin, onFocus: () => setTooltipOpened(true), 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: {
|
1122
1165
|
transform: `rotate(${rowPinningDisplayMode === 'sticky'
|
1123
1166
|
? 135
|
1124
1167
|
: pinningPosition === 'top'
|
@@ -1369,7 +1412,7 @@ const MRT_DefaultDisplayColumn = {
|
|
1369
1412
|
};
|
1370
1413
|
const useMRT_TableOptions = (_a) => {
|
1371
1414
|
var _b;
|
1372
|
-
var { aggregationFns, autoResetExpanded = false, columnFilterDisplayMode = 'subheader', columnResizeDirection, columnResizeMode = 'onChange', createDisplayMode = 'modal', defaultColumn, defaultDisplayColumn, editDisplayMode = 'modal', enableBatchRowSelection = true, enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnPinning = false, enableColumnResizing = false, enableColumnVirtualization, enableDensityToggle = true, enableExpandAll = true, enableExpanding, enableFacetedValues = false, enableFilterMatchHighlighting = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterRankedResults = true, enableGrouping = false, enableHiding = true,
|
1415
|
+
var { aggregationFns, autoResetExpanded = false, columnFilterDisplayMode = 'subheader', columnResizeDirection, columnResizeMode = 'onChange', createDisplayMode = 'modal', defaultColumn, defaultDisplayColumn, editDisplayMode = 'modal', enableBatchRowSelection = true, enableBottomToolbar = true, enableColumnActions = true, enableColumnFilters = true, enableColumnOrdering = false, enableColumnPinning = false, enableColumnResizing = false, enableColumnVirtualization, enableDensityToggle = true, enableExpandAll = true, enableExpanding, enableFacetedValues = false, enableFilterMatchHighlighting = true, enableFilters = true, enableFullScreenToggle = true, enableGlobalFilter = true, enableGlobalFilterRankedResults = true, enableGrouping = false, enableHiding = true, enableKeyboardShortcuts = true, enableMultiRowSelection = true, enableMultiSort = true, enablePagination = true, enableRowPinning = false, enableRowSelection = false, enableRowVirtualization, enableSelectAll = true, enableSorting = true, enableStickyHeader = false, enableTableFooter = true, enableTableHead = true, enableToolbarInternalActions = true, enableTopToolbar = true, filterFns, icons, id = useId(), layoutMode, localization, manualFiltering, manualGrouping, manualPagination, manualSorting, mrtTheme, paginationDisplayMode = 'default', positionActionsColumn = 'first', positionCreatingRow = 'top', positionExpandColumn = 'first', positionGlobalFilter = 'right', positionPagination = 'bottom', positionToolbarAlertBanner = 'top', positionToolbarDropZone = 'top', rowNumberDisplayMode = 'static', rowPinningDisplayMode = 'sticky', selectAllMode = 'page', sortingFns } = _a, rest = __rest(_a, ["aggregationFns", "autoResetExpanded", "columnFilterDisplayMode", "columnResizeDirection", "columnResizeMode", "createDisplayMode", "defaultColumn", "defaultDisplayColumn", "editDisplayMode", "enableBatchRowSelection", "enableBottomToolbar", "enableColumnActions", "enableColumnFilters", "enableColumnOrdering", "enableColumnPinning", "enableColumnResizing", "enableColumnVirtualization", "enableDensityToggle", "enableExpandAll", "enableExpanding", "enableFacetedValues", "enableFilterMatchHighlighting", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableGlobalFilterRankedResults", "enableGrouping", "enableHiding", "enableKeyboardShortcuts", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enableRowPinning", "enableRowSelection", "enableRowVirtualization", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "id", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "mrtTheme", "paginationDisplayMode", "positionActionsColumn", "positionCreatingRow", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberDisplayMode", "rowPinningDisplayMode", "selectAllMode", "sortingFns"]);
|
1373
1416
|
const theme = useTheme();
|
1374
1417
|
icons = useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), [icons]);
|
1375
1418
|
localization = useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), [localization]);
|
@@ -1430,7 +1473,7 @@ const useMRT_TableOptions = (_a) => {
|
|
1430
1473
|
enableGlobalFilterRankedResults,
|
1431
1474
|
enableGrouping,
|
1432
1475
|
enableHiding,
|
1433
|
-
|
1476
|
+
enableKeyboardShortcuts,
|
1434
1477
|
enableMultiRowSelection,
|
1435
1478
|
enableMultiSort,
|
1436
1479
|
enablePagination,
|
@@ -1454,6 +1497,7 @@ const useMRT_TableOptions = (_a) => {
|
|
1454
1497
|
: undefined, getGroupedRowModel: enableGrouping && !manualGrouping ? getGroupedRowModel() : undefined, getPaginationRowModel: enablePagination && !manualPagination
|
1455
1498
|
? getPaginationRowModel()
|
1456
1499
|
: undefined, getSortedRowModel: enableSorting && !manualSorting ? getSortedRowModel() : undefined, getSubRows: (row) => row === null || row === void 0 ? void 0 : row.subRows, icons,
|
1500
|
+
id,
|
1457
1501
|
layoutMode,
|
1458
1502
|
localization,
|
1459
1503
|
manualFiltering,
|
@@ -2077,7 +2121,7 @@ const MRT_TableBodyCell = (_a) => {
|
|
2077
2121
|
var _b, _c, _d, _e, _f;
|
2078
2122
|
var { cell, numRows, rowRef, staticColumnIndex, staticRowIndex, table } = _a, rest = __rest(_a, ["cell", "numRows", "rowRef", "staticColumnIndex", "staticRowIndex", "table"]);
|
2079
2123
|
const theme = useTheme();
|
2080
|
-
const { getState, options: { columnResizeDirection, columnResizeMode, createDisplayMode, editDisplayMode, enableCellActions, enableClickToCopy, enableColumnOrdering, enableColumnPinning, enableGrouping,
|
2124
|
+
const { getState, options: { columnResizeDirection, columnResizeMode, createDisplayMode, editDisplayMode, enableCellActions, enableClickToCopy, enableColumnOrdering, enableColumnPinning, enableGrouping, enableKeyboardShortcuts, layoutMode, mrtTheme: { draggingBorderColor }, muiSkeletonProps, muiTableBodyCellProps, }, setHoveredColumn, } = table;
|
2081
2125
|
const { actionCell, columnSizingInfo, creatingRow, density, draggingColumn, draggingRow, editingCell, editingRow, hoveredColumn, hoveredRow, isLoading, showSkeletons, } = getState();
|
2082
2126
|
const { column, row } = cell;
|
2083
2127
|
const { columnDef } = column;
|
@@ -2201,17 +2245,15 @@ const MRT_TableBodyCell = (_a) => {
|
|
2201
2245
|
};
|
2202
2246
|
const handleKeyDown = (event) => {
|
2203
2247
|
var _a;
|
2204
|
-
|
2205
|
-
|
2206
|
-
|
2207
|
-
|
2208
|
-
|
2209
|
-
|
2210
|
-
});
|
2211
|
-
}
|
2248
|
+
cellKeyboardShortcuts({
|
2249
|
+
cell,
|
2250
|
+
cellValue: cell.getValue(),
|
2251
|
+
event,
|
2252
|
+
table,
|
2253
|
+
});
|
2212
2254
|
(_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, event);
|
2213
2255
|
};
|
2214
|
-
return (jsx(TableCell, Object.assign({ align: theme.direction === 'rtl' ? 'right' : 'left', "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, tabIndex:
|
2256
|
+
return (jsx(TableCell, Object.assign({ align: theme.direction === 'rtl' ? 'right' : 'left', "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, tabIndex: enableKeyboardShortcuts ? 0 : undefined }, tableCellProps, { onKeyDown: handleKeyDown, onContextMenu: handleContextMenu, onDoubleClick: handleDoubleClick, onDragEnter: handleDragEnter, onDragOver: handleDragOver, sx: (theme) => (Object.assign(Object.assign({ '&:hover': {
|
2215
2257
|
outline: (actionCell === null || actionCell === void 0 ? void 0 : actionCell.id) === cell.id ||
|
2216
2258
|
(editDisplayMode === 'cell' && isEditable) ||
|
2217
2259
|
(editDisplayMode === 'table' && (isCreating || isEditing))
|
@@ -2472,7 +2514,7 @@ const MRT_TableFooterCell = (_a) => {
|
|
2472
2514
|
var _b, _c, _d;
|
2473
2515
|
var { footer, staticColumnIndex, table } = _a, rest = __rest(_a, ["footer", "staticColumnIndex", "table"]);
|
2474
2516
|
const theme = useTheme();
|
2475
|
-
const { getState, options: { enableColumnPinning, muiTableFooterCellProps,
|
2517
|
+
const { getState, options: { enableColumnPinning, muiTableFooterCellProps, enableKeyboardShortcuts, }, } = table;
|
2476
2518
|
const { density } = getState();
|
2477
2519
|
const { column } = footer;
|
2478
2520
|
const { columnDef } = column;
|
@@ -2484,20 +2526,18 @@ const MRT_TableFooterCell = (_a) => {
|
|
2484
2526
|
const tableCellProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterCellProps, args)), parseFromValuesOrFunc(columnDef.muiTableFooterCellProps, args)), rest);
|
2485
2527
|
const handleKeyDown = (event) => {
|
2486
2528
|
var _a;
|
2487
|
-
|
2488
|
-
|
2489
|
-
|
2490
|
-
|
2491
|
-
|
2492
|
-
});
|
2493
|
-
}
|
2529
|
+
cellKeyboardShortcuts({
|
2530
|
+
event,
|
2531
|
+
cellValue: footer.column.columnDef.footer,
|
2532
|
+
table,
|
2533
|
+
});
|
2494
2534
|
(_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, event);
|
2495
2535
|
};
|
2496
2536
|
return (jsx(TableCell, Object.assign({ align: columnDefType === 'group'
|
2497
2537
|
? 'center'
|
2498
2538
|
: theme.direction === 'rtl'
|
2499
2539
|
? 'right'
|
2500
|
-
: 'left', colSpan: footer.colSpan, "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, variant: "footer" }, tableCellProps, { onKeyDown: handleKeyDown, sx: (theme) => (Object.assign(Object.assign({ fontWeight: 'bold', p: density === 'compact'
|
2540
|
+
: 'left', colSpan: footer.colSpan, "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, tabIndex: enableKeyboardShortcuts ? 0 : undefined, variant: "footer" }, tableCellProps, { onKeyDown: handleKeyDown, sx: (theme) => (Object.assign(Object.assign({ fontWeight: 'bold', p: density === 'compact'
|
2501
2541
|
? '0.5rem'
|
2502
2542
|
: density === 'comfortable'
|
2503
2543
|
? '1rem'
|
@@ -3427,7 +3467,7 @@ const MRT_TableHeadCell = (_a) => {
|
|
3427
3467
|
var _b, _c, _d, _f, _g, _h;
|
3428
3468
|
var { columnVirtualizer, header, staticColumnIndex, table } = _a, rest = __rest(_a, ["columnVirtualizer", "header", "staticColumnIndex", "table"]);
|
3429
3469
|
const theme = useTheme();
|
3430
|
-
const { getState, options: { columnFilterDisplayMode, columnResizeDirection, columnResizeMode, enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnPinning, enableGrouping,
|
3470
|
+
const { getState, options: { columnFilterDisplayMode, columnResizeDirection, columnResizeMode, enableKeyboardShortcuts, enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnPinning, enableGrouping, enableMultiSort, layoutMode, mrtTheme: { draggingBorderColor }, muiTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
|
3431
3471
|
const { columnSizingInfo, density, draggingColumn, grouping, hoveredColumn, showColumnFilters, } = getState();
|
3432
3472
|
const { column } = header;
|
3433
3473
|
const { columnDef } = column;
|
@@ -3498,14 +3538,12 @@ const MRT_TableHeadCell = (_a) => {
|
|
3498
3538
|
};
|
3499
3539
|
const handleKeyDown = (event) => {
|
3500
3540
|
var _a;
|
3501
|
-
|
3502
|
-
|
3503
|
-
|
3504
|
-
|
3505
|
-
|
3506
|
-
|
3507
|
-
});
|
3508
|
-
}
|
3541
|
+
cellKeyboardShortcuts({
|
3542
|
+
event,
|
3543
|
+
cellValue: header.column.columnDef.header,
|
3544
|
+
table,
|
3545
|
+
header,
|
3546
|
+
});
|
3509
3547
|
(_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, event);
|
3510
3548
|
};
|
3511
3549
|
const HeaderElement = (_b = parseFromValuesOrFunc(columnDef.Header, {
|
@@ -3529,7 +3567,7 @@ const MRT_TableHeadCell = (_a) => {
|
|
3529
3567
|
(_a = columnVirtualizer === null || columnVirtualizer === void 0 ? void 0 : columnVirtualizer.measureElement) === null || _a === void 0 ? void 0 : _a.call(columnVirtualizer, node);
|
3530
3568
|
}
|
3531
3569
|
}
|
3532
|
-
}, tabIndex:
|
3570
|
+
}, tabIndex: enableKeyboardShortcuts ? 0 : undefined }, tableCellProps, { onKeyDown: handleKeyDown, sx: (theme) => (Object.assign(Object.assign({ '& :hover': {
|
3533
3571
|
'.MuiButtonBase-root': {
|
3534
3572
|
opacity: 1,
|
3535
3573
|
},
|
@@ -3713,7 +3751,7 @@ const MRT_Table = (_a) => {
|
|
3713
3751
|
const MRT_TableLoadingOverlay = (_a) => {
|
3714
3752
|
var _b;
|
3715
3753
|
var { table } = _a, rest = __rest(_a, ["table"]);
|
3716
|
-
const { options: { localization, mrtTheme: { baseBackgroundColor }, muiCircularProgressProps, }, } = table;
|
3754
|
+
const { options: { id, localization, mrtTheme: { baseBackgroundColor }, muiCircularProgressProps, }, } = table;
|
3717
3755
|
const circularProgressProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiCircularProgressProps, { table })), rest);
|
3718
3756
|
return (jsx(Box, { sx: {
|
3719
3757
|
alignItems: 'center',
|
@@ -3728,7 +3766,7 @@ const MRT_TableLoadingOverlay = (_a) => {
|
|
3728
3766
|
top: 0,
|
3729
3767
|
width: '100%',
|
3730
3768
|
zIndex: 3,
|
3731
|
-
}, children: (_b = circularProgressProps === null || circularProgressProps === void 0 ? void 0 : circularProgressProps.Component) !== null && _b !== void 0 ? _b : (jsx(CircularProgress, Object.assign({ "aria-label": localization.noRecordsToDisplay, id:
|
3769
|
+
}, children: (_b = circularProgressProps === null || circularProgressProps === void 0 ? void 0 : circularProgressProps.Component) !== null && _b !== void 0 ? _b : (jsx(CircularProgress, Object.assign({ "aria-label": localization.noRecordsToDisplay, id: `mrt-progress-${id}` }, circularProgressProps))) }));
|
3732
3770
|
};
|
3733
3771
|
|
3734
3772
|
const MRT_CellActionMenu = (_a) => {
|
@@ -3874,7 +3912,7 @@ const MRT_TablePagination = (_a) => {
|
|
3874
3912
|
var { position = 'bottom', table } = _a, rest = __rest(_a, ["position", "table"]);
|
3875
3913
|
const theme = useTheme();
|
3876
3914
|
const isMobile = useMediaQuery('(max-width: 720px)');
|
3877
|
-
const { getState, options: { enableToolbarInternalActions, icons: { ChevronLeftIcon, ChevronRightIcon, FirstPageIcon, LastPageIcon }, localization, muiPaginationProps, paginationDisplayMode, }, } = table;
|
3915
|
+
const { getState, options: { enableToolbarInternalActions, icons: { ChevronLeftIcon, ChevronRightIcon, FirstPageIcon, LastPageIcon }, id, localization, muiPaginationProps, paginationDisplayMode, }, } = table;
|
3878
3916
|
const { pagination: { pageIndex = 0, pageSize = 10 }, showGlobalFilter, } = getState();
|
3879
3917
|
const paginationProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiPaginationProps, {
|
3880
3918
|
table,
|
@@ -3907,9 +3945,9 @@ const MRT_TablePagination = (_a) => {
|
|
3907
3945
|
px: '8px',
|
3908
3946
|
py: '12px',
|
3909
3947
|
zIndex: 2,
|
3910
|
-
}, children: [showRowsPerPage && (jsxs(Box, { sx: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [jsx(InputLabel, { htmlFor:
|
3948
|
+
}, children: [showRowsPerPage && (jsxs(Box, { sx: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [jsx(InputLabel, { htmlFor: `mrt-rows-per-page-${id}`, sx: { mb: 0 }, children: localization.rowsPerPage }), jsx(Select, Object.assign({ MenuProps: { disableScrollLock: true }, disableUnderline: true, disabled: disabled, inputProps: {
|
3911
3949
|
'aria-label': localization.rowsPerPage,
|
3912
|
-
id:
|
3950
|
+
id: `mrt-rows-per-page-${id}`,
|
3913
3951
|
}, label: localization.rowsPerPage, onChange: (event) => table.setPageSize(+event.target.value), sx: { mb: 0 }, value: pageSize, variant: "standard" }, SelectProps, { children: rowsPerPageOptions.map((option) => {
|
3914
3952
|
var _a;
|
3915
3953
|
const value = typeof option !== 'number' ? option.value : option;
|
@@ -4149,7 +4187,7 @@ const MRT_ToggleFullScreenButton = (_a) => {
|
|
4149
4187
|
setTooltipOpened(false);
|
4150
4188
|
setIsFullScreen(!isFullScreen);
|
4151
4189
|
};
|
4152
|
-
return (jsx(Tooltip, { open: tooltipOpened, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleFullScreen, children: jsx(IconButton, Object.assign({ "aria-label": localization.toggleFullScreen, onClick: handleToggleFullScreen, onMouseEnter: () => setTooltipOpened(true), onMouseLeave: () => setTooltipOpened(false) }, rest, { title: undefined, children: isFullScreen ? jsx(FullscreenExitIcon, {}) : jsx(FullscreenIcon, {}) })) }));
|
4190
|
+
return (jsx(Tooltip, { open: tooltipOpened, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleFullScreen, children: jsx(IconButton, Object.assign({ "aria-label": localization.toggleFullScreen, onBlur: () => setTooltipOpened(false), onClick: handleToggleFullScreen, onFocus: () => setTooltipOpened(true), onMouseEnter: () => setTooltipOpened(true), onMouseLeave: () => setTooltipOpened(false) }, rest, { title: undefined, children: isFullScreen ? jsx(FullscreenExitIcon, {}) : jsx(FullscreenIcon, {}) })) }));
|
4153
4191
|
};
|
4154
4192
|
|
4155
4193
|
const MRT_ToggleGlobalFilterButton = (_a) => {
|
@@ -4277,31 +4315,31 @@ const MRT_TablePaper = (_a) => {
|
|
4277
4315
|
const { getState, options: { enableBottomToolbar, enableTopToolbar, mrtTheme: { baseBackgroundColor }, muiTablePaperProps, renderBottomToolbar, renderTopToolbar, }, refs: { tablePaperRef }, } = table;
|
4278
4316
|
const { isFullScreen } = getState();
|
4279
4317
|
const paperProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTablePaperProps, { table })), rest);
|
4280
|
-
const theme = useTheme
|
4281
|
-
return (jsxs(Paper, Object.assign({ elevation: 2 }, paperProps, { ref: (ref) => {
|
4282
|
-
|
4283
|
-
|
4284
|
-
|
4285
|
-
|
4286
|
-
|
4287
|
-
|
4288
|
-
|
4289
|
-
|
4290
|
-
|
4291
|
-
|
4292
|
-
|
4293
|
-
|
4294
|
-
|
4295
|
-
|
4296
|
-
|
4297
|
-
|
4298
|
-
|
4299
|
-
|
4300
|
-
|
4301
|
-
|
4302
|
-
|
4303
|
-
|
4304
|
-
|
4318
|
+
const theme = useTheme();
|
4319
|
+
return (jsx(FocusTrap, { open: isFullScreen, children: jsxs(Paper, Object.assign({ elevation: 2, onKeyDown: (e) => e.key === 'Escape' && table.setIsFullScreen(false) }, paperProps, { ref: (ref) => {
|
4320
|
+
tablePaperRef.current = ref;
|
4321
|
+
if (paperProps === null || paperProps === void 0 ? void 0 : paperProps.ref) {
|
4322
|
+
//@ts-ignore
|
4323
|
+
paperProps.ref.current = ref;
|
4324
|
+
}
|
4325
|
+
}, style: Object.assign(Object.assign({}, (isFullScreen
|
4326
|
+
? {
|
4327
|
+
bottom: 0,
|
4328
|
+
height: '100dvh',
|
4329
|
+
left: 0,
|
4330
|
+
margin: 0,
|
4331
|
+
maxHeight: '100dvh',
|
4332
|
+
maxWidth: '100dvw',
|
4333
|
+
padding: 0,
|
4334
|
+
position: 'fixed',
|
4335
|
+
right: 0,
|
4336
|
+
top: 0,
|
4337
|
+
width: '100dvw',
|
4338
|
+
zIndex: theme.zIndex.modal,
|
4339
|
+
}
|
4340
|
+
: {})), paperProps === null || paperProps === void 0 ? void 0 : paperProps.style), sx: (theme) => (Object.assign({ backgroundColor: baseBackgroundColor, backgroundImage: 'unset', overflow: 'hidden', transition: 'all 100ms ease-in-out' }, parseFromValuesOrFunc(paperProps === null || paperProps === void 0 ? void 0 : paperProps.sx, theme))), children: [enableTopToolbar &&
|
4341
|
+
((_b = parseFromValuesOrFunc(renderTopToolbar, { table })) !== null && _b !== void 0 ? _b : (jsx(MRT_TopToolbar, { table: table }))), jsx(MRT_TableContainer, { table: table }), enableBottomToolbar &&
|
4342
|
+
((_c = parseFromValuesOrFunc(renderBottomToolbar, { table })) !== null && _c !== void 0 ? _c : (jsx(MRT_BottomToolbar, { table: table })))] })) }));
|
4305
4343
|
};
|
4306
4344
|
|
4307
4345
|
const isTableInstanceProp = (props) => props.table !== undefined;
|
@@ -4316,5 +4354,5 @@ const MaterialReactTable = (props) => {
|
|
4316
4354
|
return jsx(MRT_TablePaper, { table: table });
|
4317
4355
|
};
|
4318
4356
|
|
4319
|
-
export { MRT_ActionMenuItem, 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,
|
4357
|
+
export { MRT_ActionMenuItem, 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, cellKeyboardShortcuts, createMRTColumnHelper, createRow, defaultDisplayColumnProps, flexRender, getAllLeafColumnDefs, getCanRankRows, getColumnFilterInfo, getColumnId, getDefaultColumnFilterFn, getDefaultColumnOrderIds, getIsRankingRows, getIsRowSelected, getLeadingDisplayColumnIds, getMRT_RowSelectionHandler, getMRT_Rows, getMRT_SelectAllHandler, getTrailingDisplayColumnIds, isCellEditable, mrtFilterOptions, openEditingCell, prepareColumns, rankGlobalFuzzy, reorderColumn, showRowActionsColumn, showRowDragColumn, showRowExpandColumn, showRowNumbersColumn, showRowPinningColumn, showRowSelectionColumn, showRowSpacerColumn, useDropdownOptions, useMRT_ColumnVirtualizer, useMRT_Effects, useMRT_RowVirtualizer, useMRT_Rows, useMRT_TableInstance, useMRT_TableOptions, useMaterialReactTable };
|
4320
4358
|
//# sourceMappingURL=index.esm.js.map
|