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.js
CHANGED
@@ -54,7 +54,7 @@ var ViewColumnIcon = require('@mui/icons-material/ViewColumn');
|
|
54
54
|
var VisibilityOffIcon = require('@mui/icons-material/VisibilityOff');
|
55
55
|
var reactVirtual = require('@tanstack/react-virtual');
|
56
56
|
var Paper = require('@mui/material/Paper');
|
57
|
-
var
|
57
|
+
var FocusTrap = require('@mui/material/Unstable_TrapFocus/FocusTrap');
|
58
58
|
var TableContainer = require('@mui/material/TableContainer');
|
59
59
|
var Table = require('@mui/material/Table');
|
60
60
|
var TableBody = require('@mui/material/TableBody');
|
@@ -145,6 +145,7 @@ var SyncAltIcon__default = /*#__PURE__*/_interopDefaultLegacy(SyncAltIcon);
|
|
145
145
|
var ViewColumnIcon__default = /*#__PURE__*/_interopDefaultLegacy(ViewColumnIcon);
|
146
146
|
var VisibilityOffIcon__default = /*#__PURE__*/_interopDefaultLegacy(VisibilityOffIcon);
|
147
147
|
var Paper__default = /*#__PURE__*/_interopDefaultLegacy(Paper);
|
148
|
+
var FocusTrap__default = /*#__PURE__*/_interopDefaultLegacy(FocusTrap);
|
148
149
|
var TableContainer__default = /*#__PURE__*/_interopDefaultLegacy(TableContainer);
|
149
150
|
var Table__default = /*#__PURE__*/_interopDefaultLegacy(Table);
|
150
151
|
var TableBody__default = /*#__PURE__*/_interopDefaultLegacy(TableBody);
|
@@ -497,6 +498,10 @@ const getMRT_SelectAllHandler = ({ table }) => (event, value, forceAll) => {
|
|
497
498
|
lastSelectedRowId.current = null;
|
498
499
|
};
|
499
500
|
|
501
|
+
const isWinCtrlMacMeta = (event) => {
|
502
|
+
return ((event.ctrlKey && navigator.platform.toLowerCase().includes('win')) ||
|
503
|
+
(event.metaKey && navigator.platform.toLowerCase().includes('mac')));
|
504
|
+
};
|
500
505
|
const isCellEditable = ({ cell, table, }) => {
|
501
506
|
const { enableEditing } = table.options;
|
502
507
|
const { column: { columnDef }, row, } = cell;
|
@@ -519,13 +524,17 @@ const openEditingCell = ({ cell, table, }) => {
|
|
519
524
|
});
|
520
525
|
}
|
521
526
|
};
|
522
|
-
const
|
527
|
+
const cellKeyboardShortcuts = ({ cell, cellElements, cellValue, containerElement, event, header, parentElement, table, }) => {
|
523
528
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
524
|
-
if (
|
529
|
+
if (!table.options.enableKeyboardShortcuts)
|
530
|
+
return;
|
531
|
+
const currentCell = event.currentTarget;
|
532
|
+
if (cellValue && isWinCtrlMacMeta(event) && event.key === 'c') {
|
525
533
|
navigator.clipboard.writeText(cellValue);
|
526
534
|
}
|
527
535
|
else if (['Enter', ' '].includes(event.key)) {
|
528
536
|
if (((_a = cell === null || cell === void 0 ? void 0 : cell.column) === null || _a === void 0 ? void 0 : _a.id) === 'mrt-row-select') {
|
537
|
+
event.preventDefault();
|
529
538
|
getMRT_RowSelectionHandler({
|
530
539
|
row: cell.row,
|
531
540
|
table,
|
@@ -535,6 +544,7 @@ const cellNavigation = ({ cell, cellElements, cellValue, containerElement, event
|
|
535
544
|
}
|
536
545
|
else if (((_b = header === null || header === void 0 ? void 0 : header.column) === null || _b === void 0 ? void 0 : _b.id) === 'mrt-row-select' &&
|
537
546
|
table.options.enableSelectAll) {
|
547
|
+
event.preventDefault();
|
538
548
|
getMRT_SelectAllHandler({
|
539
549
|
table,
|
540
550
|
})(event);
|
@@ -542,26 +552,44 @@ const cellNavigation = ({ cell, cellElements, cellValue, containerElement, event
|
|
542
552
|
else if (((_c = cell === null || cell === void 0 ? void 0 : cell.column) === null || _c === void 0 ? void 0 : _c.id) === 'mrt-row-expand' &&
|
543
553
|
(cell.row.getCanExpand() ||
|
544
554
|
((_e = (_d = table.options).renderDetailPanel) === null || _e === void 0 ? void 0 : _e.call(_d, { row: cell.row, table })))) {
|
555
|
+
event.preventDefault();
|
545
556
|
cell.row.toggleExpanded();
|
546
557
|
}
|
547
558
|
else if (((_f = header === null || header === void 0 ? void 0 : header.column) === null || _f === void 0 ? void 0 : _f.id) === 'mrt-row-expand' &&
|
548
559
|
table.options.enableExpandAll) {
|
560
|
+
event.preventDefault();
|
549
561
|
table.toggleAllRowsExpanded();
|
550
562
|
}
|
551
|
-
else if ((_g = header === null || header === void 0 ? void 0 : header.column) === null || _g === void 0 ? void 0 : _g.getCanSort()) {
|
552
|
-
header.column.toggleSorting();
|
553
|
-
}
|
554
563
|
else if ((cell === null || cell === void 0 ? void 0 : cell.column.id) === 'mrt-row-pin') {
|
564
|
+
event.preventDefault();
|
555
565
|
cell.row.getIsPinned()
|
556
566
|
? cell.row.pin(false)
|
557
|
-
: cell.row.pin(((
|
567
|
+
: cell.row.pin(((_g = table.options.rowPinningDisplayMode) === null || _g === void 0 ? void 0 : _g.includes('bottom'))
|
558
568
|
? 'bottom'
|
559
569
|
: 'top');
|
560
570
|
}
|
571
|
+
else if (header && isWinCtrlMacMeta(event)) {
|
572
|
+
const actionsButton = currentCell.querySelector(`button[aria-label="${table.options.localization.columnActions}"]`);
|
573
|
+
if (actionsButton) {
|
574
|
+
actionsButton.click();
|
575
|
+
}
|
576
|
+
}
|
577
|
+
else if ((_h = header === null || header === void 0 ? void 0 : header.column) === null || _h === void 0 ? void 0 : _h.getCanSort()) {
|
578
|
+
event.preventDefault();
|
579
|
+
header.column.toggleSorting();
|
580
|
+
}
|
561
581
|
}
|
562
|
-
else if ([
|
582
|
+
else if ([
|
583
|
+
'ArrowRight',
|
584
|
+
'ArrowLeft',
|
585
|
+
'ArrowUp',
|
586
|
+
'ArrowDown',
|
587
|
+
'Home',
|
588
|
+
'End',
|
589
|
+
'PageUp',
|
590
|
+
'PageDown',
|
591
|
+
].includes(event.key)) {
|
563
592
|
event.preventDefault();
|
564
|
-
const currentCell = event.currentTarget;
|
565
593
|
const currentRow = parentElement || currentCell.closest('tr');
|
566
594
|
const tableElement = containerElement || currentCell.closest('table');
|
567
595
|
const allCells = cellElements ||
|
@@ -581,6 +609,16 @@ const cellNavigation = ({ cell, cellElements, cellValue, containerElement, event
|
|
581
609
|
const targetCell = edge === 'f' ? rowCells[0] : rowCells[rowCells.length - 1];
|
582
610
|
return targetCell;
|
583
611
|
};
|
612
|
+
//page up/down first or last cell in column
|
613
|
+
const findBottomTopCell = (columnIndex, edge) => {
|
614
|
+
var _a;
|
615
|
+
const row = edge === 't'
|
616
|
+
? tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelector('tr')
|
617
|
+
: (_a = tableElement === null || tableElement === void 0 ? void 0 : tableElement.lastElementChild) === null || _a === void 0 ? void 0 : _a.lastElementChild;
|
618
|
+
const rowCells = Array.from((row === null || row === void 0 ? void 0 : row.children) || []);
|
619
|
+
const targetCell = rowCells[columnIndex];
|
620
|
+
return targetCell;
|
621
|
+
};
|
584
622
|
const findAdjacentCell = (columnIndex, searchDirection) => {
|
585
623
|
const searchArray = searchDirection === 'f'
|
586
624
|
? allCells.slice(currentCellIndex + 1)
|
@@ -601,10 +639,16 @@ const cellNavigation = ({ cell, cellElements, cellValue, containerElement, event
|
|
601
639
|
nextCell = findAdjacentCell(currentIndex, 'f');
|
602
640
|
break;
|
603
641
|
case 'Home':
|
604
|
-
nextCell = findEdgeCell(event
|
642
|
+
nextCell = findEdgeCell(isWinCtrlMacMeta(event) ? 'f' : 'c', 'f');
|
605
643
|
break;
|
606
644
|
case 'End':
|
607
|
-
nextCell = findEdgeCell(event
|
645
|
+
nextCell = findEdgeCell(isWinCtrlMacMeta(event) ? 'l' : 'c', 'l');
|
646
|
+
break;
|
647
|
+
case 'PageUp':
|
648
|
+
nextCell = findBottomTopCell(currentIndex, 't');
|
649
|
+
break;
|
650
|
+
case 'PageDown':
|
651
|
+
nextCell = findBottomTopCell(currentIndex, 'b');
|
608
652
|
break;
|
609
653
|
}
|
610
654
|
if (nextCell) {
|
@@ -1208,7 +1252,7 @@ const MRT_RowPinButton = (_a) => {
|
|
1208
1252
|
event.stopPropagation();
|
1209
1253
|
row.pin(isPinned ? false : pinningPosition);
|
1210
1254
|
};
|
1211
|
-
return (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, getCommonTooltipProps(), { open: tooltipOpened, title: isPinned ? localization.unpin : localization.pin, children: jsxRuntime.jsx(IconButton__default["default"], 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 ? (jsxRuntime.jsx(CloseIcon, {})) : (jsxRuntime.jsx(PushPinIcon, { fontSize: "small", style: {
|
1255
|
+
return (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, getCommonTooltipProps(), { open: tooltipOpened, title: isPinned ? localization.unpin : localization.pin, children: jsxRuntime.jsx(IconButton__default["default"], 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 ? (jsxRuntime.jsx(CloseIcon, {})) : (jsxRuntime.jsx(PushPinIcon, { fontSize: "small", style: {
|
1212
1256
|
transform: `rotate(${rowPinningDisplayMode === 'sticky'
|
1213
1257
|
? 135
|
1214
1258
|
: pinningPosition === 'top'
|
@@ -1459,7 +1503,7 @@ const MRT_DefaultDisplayColumn = {
|
|
1459
1503
|
};
|
1460
1504
|
const useMRT_TableOptions = (_a) => {
|
1461
1505
|
var _b;
|
1462
|
-
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,
|
1506
|
+
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 = react.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"]);
|
1463
1507
|
const theme = styles.useTheme();
|
1464
1508
|
icons = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), [icons]);
|
1465
1509
|
localization = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), [localization]);
|
@@ -1520,7 +1564,7 @@ const useMRT_TableOptions = (_a) => {
|
|
1520
1564
|
enableGlobalFilterRankedResults,
|
1521
1565
|
enableGrouping,
|
1522
1566
|
enableHiding,
|
1523
|
-
|
1567
|
+
enableKeyboardShortcuts,
|
1524
1568
|
enableMultiRowSelection,
|
1525
1569
|
enableMultiSort,
|
1526
1570
|
enablePagination,
|
@@ -1544,6 +1588,7 @@ const useMRT_TableOptions = (_a) => {
|
|
1544
1588
|
: undefined, getGroupedRowModel: enableGrouping && !manualGrouping ? reactTable.getGroupedRowModel() : undefined, getPaginationRowModel: enablePagination && !manualPagination
|
1545
1589
|
? reactTable.getPaginationRowModel()
|
1546
1590
|
: undefined, getSortedRowModel: enableSorting && !manualSorting ? reactTable.getSortedRowModel() : undefined, getSubRows: (row) => row === null || row === void 0 ? void 0 : row.subRows, icons,
|
1591
|
+
id,
|
1547
1592
|
layoutMode,
|
1548
1593
|
localization,
|
1549
1594
|
manualFiltering,
|
@@ -2167,7 +2212,7 @@ const MRT_TableBodyCell = (_a) => {
|
|
2167
2212
|
var _b, _c, _d, _e, _f;
|
2168
2213
|
var { cell, numRows, rowRef, staticColumnIndex, staticRowIndex, table } = _a, rest = __rest(_a, ["cell", "numRows", "rowRef", "staticColumnIndex", "staticRowIndex", "table"]);
|
2169
2214
|
const theme = styles.useTheme();
|
2170
|
-
const { getState, options: { columnResizeDirection, columnResizeMode, createDisplayMode, editDisplayMode, enableCellActions, enableClickToCopy, enableColumnOrdering, enableColumnPinning, enableGrouping,
|
2215
|
+
const { getState, options: { columnResizeDirection, columnResizeMode, createDisplayMode, editDisplayMode, enableCellActions, enableClickToCopy, enableColumnOrdering, enableColumnPinning, enableGrouping, enableKeyboardShortcuts, layoutMode, mrtTheme: { draggingBorderColor }, muiSkeletonProps, muiTableBodyCellProps, }, setHoveredColumn, } = table;
|
2171
2216
|
const { actionCell, columnSizingInfo, creatingRow, density, draggingColumn, draggingRow, editingCell, editingRow, hoveredColumn, hoveredRow, isLoading, showSkeletons, } = getState();
|
2172
2217
|
const { column, row } = cell;
|
2173
2218
|
const { columnDef } = column;
|
@@ -2291,17 +2336,15 @@ const MRT_TableBodyCell = (_a) => {
|
|
2291
2336
|
};
|
2292
2337
|
const handleKeyDown = (event) => {
|
2293
2338
|
var _a;
|
2294
|
-
|
2295
|
-
|
2296
|
-
|
2297
|
-
|
2298
|
-
|
2299
|
-
|
2300
|
-
});
|
2301
|
-
}
|
2339
|
+
cellKeyboardShortcuts({
|
2340
|
+
cell,
|
2341
|
+
cellValue: cell.getValue(),
|
2342
|
+
event,
|
2343
|
+
table,
|
2344
|
+
});
|
2302
2345
|
(_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, event);
|
2303
2346
|
};
|
2304
|
-
return (jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: theme.direction === 'rtl' ? 'right' : 'left', "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, tabIndex:
|
2347
|
+
return (jsxRuntime.jsx(TableCell__default["default"], 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': {
|
2305
2348
|
outline: (actionCell === null || actionCell === void 0 ? void 0 : actionCell.id) === cell.id ||
|
2306
2349
|
(editDisplayMode === 'cell' && isEditable) ||
|
2307
2350
|
(editDisplayMode === 'table' && (isCreating || isEditing))
|
@@ -2562,7 +2605,7 @@ const MRT_TableFooterCell = (_a) => {
|
|
2562
2605
|
var _b, _c, _d;
|
2563
2606
|
var { footer, staticColumnIndex, table } = _a, rest = __rest(_a, ["footer", "staticColumnIndex", "table"]);
|
2564
2607
|
const theme = styles.useTheme();
|
2565
|
-
const { getState, options: { enableColumnPinning, muiTableFooterCellProps,
|
2608
|
+
const { getState, options: { enableColumnPinning, muiTableFooterCellProps, enableKeyboardShortcuts, }, } = table;
|
2566
2609
|
const { density } = getState();
|
2567
2610
|
const { column } = footer;
|
2568
2611
|
const { columnDef } = column;
|
@@ -2574,20 +2617,18 @@ const MRT_TableFooterCell = (_a) => {
|
|
2574
2617
|
const tableCellProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterCellProps, args)), parseFromValuesOrFunc(columnDef.muiTableFooterCellProps, args)), rest);
|
2575
2618
|
const handleKeyDown = (event) => {
|
2576
2619
|
var _a;
|
2577
|
-
|
2578
|
-
|
2579
|
-
|
2580
|
-
|
2581
|
-
|
2582
|
-
});
|
2583
|
-
}
|
2620
|
+
cellKeyboardShortcuts({
|
2621
|
+
event,
|
2622
|
+
cellValue: footer.column.columnDef.footer,
|
2623
|
+
table,
|
2624
|
+
});
|
2584
2625
|
(_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, event);
|
2585
2626
|
};
|
2586
2627
|
return (jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: columnDefType === 'group'
|
2587
2628
|
? 'center'
|
2588
2629
|
: theme.direction === 'rtl'
|
2589
2630
|
? 'right'
|
2590
|
-
: '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'
|
2631
|
+
: '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'
|
2591
2632
|
? '0.5rem'
|
2592
2633
|
: density === 'comfortable'
|
2593
2634
|
? '1rem'
|
@@ -3517,7 +3558,7 @@ const MRT_TableHeadCell = (_a) => {
|
|
3517
3558
|
var _b, _c, _d, _f, _g, _h;
|
3518
3559
|
var { columnVirtualizer, header, staticColumnIndex, table } = _a, rest = __rest(_a, ["columnVirtualizer", "header", "staticColumnIndex", "table"]);
|
3519
3560
|
const theme = styles.useTheme();
|
3520
|
-
const { getState, options: { columnFilterDisplayMode, columnResizeDirection, columnResizeMode, enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnPinning, enableGrouping,
|
3561
|
+
const { getState, options: { columnFilterDisplayMode, columnResizeDirection, columnResizeMode, enableKeyboardShortcuts, enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnPinning, enableGrouping, enableMultiSort, layoutMode, mrtTheme: { draggingBorderColor }, muiTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
|
3521
3562
|
const { columnSizingInfo, density, draggingColumn, grouping, hoveredColumn, showColumnFilters, } = getState();
|
3522
3563
|
const { column } = header;
|
3523
3564
|
const { columnDef } = column;
|
@@ -3588,14 +3629,12 @@ const MRT_TableHeadCell = (_a) => {
|
|
3588
3629
|
};
|
3589
3630
|
const handleKeyDown = (event) => {
|
3590
3631
|
var _a;
|
3591
|
-
|
3592
|
-
|
3593
|
-
|
3594
|
-
|
3595
|
-
|
3596
|
-
|
3597
|
-
});
|
3598
|
-
}
|
3632
|
+
cellKeyboardShortcuts({
|
3633
|
+
event,
|
3634
|
+
cellValue: header.column.columnDef.header,
|
3635
|
+
table,
|
3636
|
+
header,
|
3637
|
+
});
|
3599
3638
|
(_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, event);
|
3600
3639
|
};
|
3601
3640
|
const HeaderElement = (_b = parseFromValuesOrFunc(columnDef.Header, {
|
@@ -3619,7 +3658,7 @@ const MRT_TableHeadCell = (_a) => {
|
|
3619
3658
|
(_a = columnVirtualizer === null || columnVirtualizer === void 0 ? void 0 : columnVirtualizer.measureElement) === null || _a === void 0 ? void 0 : _a.call(columnVirtualizer, node);
|
3620
3659
|
}
|
3621
3660
|
}
|
3622
|
-
}, tabIndex:
|
3661
|
+
}, tabIndex: enableKeyboardShortcuts ? 0 : undefined }, tableCellProps, { onKeyDown: handleKeyDown, sx: (theme) => (Object.assign(Object.assign({ '& :hover': {
|
3623
3662
|
'.MuiButtonBase-root': {
|
3624
3663
|
opacity: 1,
|
3625
3664
|
},
|
@@ -3803,7 +3842,7 @@ const MRT_Table = (_a) => {
|
|
3803
3842
|
const MRT_TableLoadingOverlay = (_a) => {
|
3804
3843
|
var _b;
|
3805
3844
|
var { table } = _a, rest = __rest(_a, ["table"]);
|
3806
|
-
const { options: { localization, mrtTheme: { baseBackgroundColor }, muiCircularProgressProps, }, } = table;
|
3845
|
+
const { options: { id, localization, mrtTheme: { baseBackgroundColor }, muiCircularProgressProps, }, } = table;
|
3807
3846
|
const circularProgressProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiCircularProgressProps, { table })), rest);
|
3808
3847
|
return (jsxRuntime.jsx(Box__default["default"], { sx: {
|
3809
3848
|
alignItems: 'center',
|
@@ -3818,7 +3857,7 @@ const MRT_TableLoadingOverlay = (_a) => {
|
|
3818
3857
|
top: 0,
|
3819
3858
|
width: '100%',
|
3820
3859
|
zIndex: 3,
|
3821
|
-
}, children: (_b = circularProgressProps === null || circularProgressProps === void 0 ? void 0 : circularProgressProps.Component) !== null && _b !== void 0 ? _b : (jsxRuntime.jsx(CircularProgress__default["default"], Object.assign({ "aria-label": localization.noRecordsToDisplay, id:
|
3860
|
+
}, children: (_b = circularProgressProps === null || circularProgressProps === void 0 ? void 0 : circularProgressProps.Component) !== null && _b !== void 0 ? _b : (jsxRuntime.jsx(CircularProgress__default["default"], Object.assign({ "aria-label": localization.noRecordsToDisplay, id: `mrt-progress-${id}` }, circularProgressProps))) }));
|
3822
3861
|
};
|
3823
3862
|
|
3824
3863
|
const MRT_CellActionMenu = (_a) => {
|
@@ -3964,7 +4003,7 @@ const MRT_TablePagination = (_a) => {
|
|
3964
4003
|
var { position = 'bottom', table } = _a, rest = __rest(_a, ["position", "table"]);
|
3965
4004
|
const theme = styles.useTheme();
|
3966
4005
|
const isMobile = useMediaQuery__default["default"]('(max-width: 720px)');
|
3967
|
-
const { getState, options: { enableToolbarInternalActions, icons: { ChevronLeftIcon, ChevronRightIcon, FirstPageIcon, LastPageIcon }, localization, muiPaginationProps, paginationDisplayMode, }, } = table;
|
4006
|
+
const { getState, options: { enableToolbarInternalActions, icons: { ChevronLeftIcon, ChevronRightIcon, FirstPageIcon, LastPageIcon }, id, localization, muiPaginationProps, paginationDisplayMode, }, } = table;
|
3968
4007
|
const { pagination: { pageIndex = 0, pageSize = 10 }, showGlobalFilter, } = getState();
|
3969
4008
|
const paginationProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiPaginationProps, {
|
3970
4009
|
table,
|
@@ -3997,9 +4036,9 @@ const MRT_TablePagination = (_a) => {
|
|
3997
4036
|
px: '8px',
|
3998
4037
|
py: '12px',
|
3999
4038
|
zIndex: 2,
|
4000
|
-
}, children: [showRowsPerPage && (jsxRuntime.jsxs(Box__default["default"], { sx: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [jsxRuntime.jsx(InputLabel__default["default"], { htmlFor:
|
4039
|
+
}, children: [showRowsPerPage && (jsxRuntime.jsxs(Box__default["default"], { sx: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [jsxRuntime.jsx(InputLabel__default["default"], { htmlFor: `mrt-rows-per-page-${id}`, sx: { mb: 0 }, children: localization.rowsPerPage }), jsxRuntime.jsx(Select__default["default"], Object.assign({ MenuProps: { disableScrollLock: true }, disableUnderline: true, disabled: disabled, inputProps: {
|
4001
4040
|
'aria-label': localization.rowsPerPage,
|
4002
|
-
id:
|
4041
|
+
id: `mrt-rows-per-page-${id}`,
|
4003
4042
|
}, label: localization.rowsPerPage, onChange: (event) => table.setPageSize(+event.target.value), sx: { mb: 0 }, value: pageSize, variant: "standard" }, SelectProps, { children: rowsPerPageOptions.map((option) => {
|
4004
4043
|
var _a;
|
4005
4044
|
const value = typeof option !== 'number' ? option.value : option;
|
@@ -4239,7 +4278,7 @@ const MRT_ToggleFullScreenButton = (_a) => {
|
|
4239
4278
|
setTooltipOpened(false);
|
4240
4279
|
setIsFullScreen(!isFullScreen);
|
4241
4280
|
};
|
4242
|
-
return (jsxRuntime.jsx(Tooltip__default["default"], { open: tooltipOpened, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleFullScreen, children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": localization.toggleFullScreen, onClick: handleToggleFullScreen, onMouseEnter: () => setTooltipOpened(true), onMouseLeave: () => setTooltipOpened(false) }, rest, { title: undefined, children: isFullScreen ? jsxRuntime.jsx(FullscreenExitIcon, {}) : jsxRuntime.jsx(FullscreenIcon, {}) })) }));
|
4281
|
+
return (jsxRuntime.jsx(Tooltip__default["default"], { open: tooltipOpened, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleFullScreen, children: jsxRuntime.jsx(IconButton__default["default"], 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 ? jsxRuntime.jsx(FullscreenExitIcon, {}) : jsxRuntime.jsx(FullscreenIcon, {}) })) }));
|
4243
4282
|
};
|
4244
4283
|
|
4245
4284
|
const MRT_ToggleGlobalFilterButton = (_a) => {
|
@@ -4367,31 +4406,31 @@ const MRT_TablePaper = (_a) => {
|
|
4367
4406
|
const { getState, options: { enableBottomToolbar, enableTopToolbar, mrtTheme: { baseBackgroundColor }, muiTablePaperProps, renderBottomToolbar, renderTopToolbar, }, refs: { tablePaperRef }, } = table;
|
4368
4407
|
const { isFullScreen } = getState();
|
4369
4408
|
const paperProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTablePaperProps, { table })), rest);
|
4370
|
-
const theme =
|
4371
|
-
return (jsxRuntime.jsxs(Paper__default["default"], Object.assign({ elevation: 2 }, paperProps, { ref: (ref) => {
|
4372
|
-
|
4373
|
-
|
4374
|
-
|
4375
|
-
|
4376
|
-
|
4377
|
-
|
4378
|
-
|
4379
|
-
|
4380
|
-
|
4381
|
-
|
4382
|
-
|
4383
|
-
|
4384
|
-
|
4385
|
-
|
4386
|
-
|
4387
|
-
|
4388
|
-
|
4389
|
-
|
4390
|
-
|
4391
|
-
|
4392
|
-
|
4393
|
-
|
4394
|
-
|
4409
|
+
const theme = styles.useTheme();
|
4410
|
+
return (jsxRuntime.jsx(FocusTrap__default["default"], { open: isFullScreen, children: jsxRuntime.jsxs(Paper__default["default"], Object.assign({ elevation: 2, onKeyDown: (e) => e.key === 'Escape' && table.setIsFullScreen(false) }, paperProps, { ref: (ref) => {
|
4411
|
+
tablePaperRef.current = ref;
|
4412
|
+
if (paperProps === null || paperProps === void 0 ? void 0 : paperProps.ref) {
|
4413
|
+
//@ts-ignore
|
4414
|
+
paperProps.ref.current = ref;
|
4415
|
+
}
|
4416
|
+
}, style: Object.assign(Object.assign({}, (isFullScreen
|
4417
|
+
? {
|
4418
|
+
bottom: 0,
|
4419
|
+
height: '100dvh',
|
4420
|
+
left: 0,
|
4421
|
+
margin: 0,
|
4422
|
+
maxHeight: '100dvh',
|
4423
|
+
maxWidth: '100dvw',
|
4424
|
+
padding: 0,
|
4425
|
+
position: 'fixed',
|
4426
|
+
right: 0,
|
4427
|
+
top: 0,
|
4428
|
+
width: '100dvw',
|
4429
|
+
zIndex: theme.zIndex.modal,
|
4430
|
+
}
|
4431
|
+
: {})), 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 &&
|
4432
|
+
((_b = parseFromValuesOrFunc(renderTopToolbar, { table })) !== null && _b !== void 0 ? _b : (jsxRuntime.jsx(MRT_TopToolbar, { table: table }))), jsxRuntime.jsx(MRT_TableContainer, { table: table }), enableBottomToolbar &&
|
4433
|
+
((_c = parseFromValuesOrFunc(renderBottomToolbar, { table })) !== null && _c !== void 0 ? _c : (jsxRuntime.jsx(MRT_BottomToolbar, { table: table })))] })) }));
|
4395
4434
|
};
|
4396
4435
|
|
4397
4436
|
const isTableInstanceProp = (props) => props.table !== undefined;
|
@@ -4472,7 +4511,7 @@ exports.MaterialReactTable = MaterialReactTable;
|
|
4472
4511
|
exports.Memo_MRT_TableBody = Memo_MRT_TableBody;
|
4473
4512
|
exports.Memo_MRT_TableBodyCell = Memo_MRT_TableBodyCell;
|
4474
4513
|
exports.Memo_MRT_TableBodyRow = Memo_MRT_TableBodyRow;
|
4475
|
-
exports.
|
4514
|
+
exports.cellKeyboardShortcuts = cellKeyboardShortcuts;
|
4476
4515
|
exports.createMRTColumnHelper = createMRTColumnHelper;
|
4477
4516
|
exports.createRow = createRow;
|
4478
4517
|
exports.defaultDisplayColumnProps = defaultDisplayColumnProps;
|