material-react-table 3.0.0-beta.0 → 3.0.0-beta.2

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.js CHANGED
@@ -325,6 +325,20 @@ const createRow = (table, originalRow, rowIndex = -1, depth = 0, subRows, parent
325
325
  [getColumnId(col)]: '',
326
326
  }))), rowIndex, depth, subRows, parentId);
327
327
 
328
+ const fuzzy$1 = (rowA, rowB, columnId) => {
329
+ let dir = 0;
330
+ if (rowA.columnFiltersMeta[columnId]) {
331
+ dir = matchSorterUtils.compareItems(rowA.columnFiltersMeta[columnId], rowB.columnFiltersMeta[columnId]);
332
+ }
333
+ // Provide a fallback for when the item ranks are equal
334
+ return dir === 0
335
+ ? reactTable.sortingFns.alphanumeric(rowA, rowB, columnId)
336
+ : dir;
337
+ };
338
+ const MRT_SortingFns = Object.assign(Object.assign({}, reactTable.sortingFns), { fuzzy: fuzzy$1 });
339
+ const rankGlobalFuzzy = (rowA, rowB) => Math.max(...Object.values(rowB.columnFiltersMeta).map((v) => v.rank)) -
340
+ Math.max(...Object.values(rowA.columnFiltersMeta).map((v) => v.rank));
341
+
328
342
  const parseFromValuesOrFunc = (fn, arg) => (fn instanceof Function ? fn(arg) : fn);
329
343
  const getValueAndLabel = (option) => {
330
344
  var _a, _b;
@@ -343,161 +357,6 @@ const getValueAndLabel = (option) => {
343
357
  return { label, value };
344
358
  };
345
359
 
346
- const isCellEditable = ({ cell, table, }) => {
347
- const { enableEditing } = table.options;
348
- const { column: { columnDef }, row, } = cell;
349
- return (!cell.getIsPlaceholder() &&
350
- parseFromValuesOrFunc(enableEditing, row) &&
351
- parseFromValuesOrFunc(columnDef.enableEditing, row) !== false);
352
- };
353
- const openEditingCell = ({ cell, table, }) => {
354
- const { options: { editDisplayMode }, refs: { editInputRefs }, } = table;
355
- const { column } = cell;
356
- if (isCellEditable({ cell, table }) && editDisplayMode === 'cell') {
357
- table.setEditingCell(cell);
358
- queueMicrotask(() => {
359
- var _a;
360
- const textField = editInputRefs.current[column.id];
361
- if (textField) {
362
- textField.focus();
363
- (_a = textField.select) === null || _a === void 0 ? void 0 : _a.call(textField);
364
- }
365
- });
366
- }
367
- };
368
- const cellNavigation = (e) => {
369
- if (['ArrowRight', 'ArrowLeft', 'ArrowUp', 'ArrowDown', 'Home', 'End'].includes(e.key)) {
370
- e.preventDefault();
371
- const currentCell = e.currentTarget;
372
- const currentRow = currentCell.closest('tr');
373
- const tableElement = currentCell.closest('table');
374
- const allCells = Array.from((tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelectorAll('th, td')) || []);
375
- const currentCellIndex = allCells.indexOf(currentCell);
376
- const currentIndex = parseInt(currentCell.getAttribute('data-index') || '0');
377
- let nextCell = undefined;
378
- //home/end first or last cell in row
379
- const findEdgeCell = (rowIndex, edge) => {
380
- var _a, _b, _c;
381
- const row = rowIndex === 'c'
382
- ? currentRow
383
- : rowIndex === 'f'
384
- ? (_a = currentCell.closest('table')) === null || _a === void 0 ? void 0 : _a.querySelector('tr')
385
- : (_c = (_b = currentCell.closest('table')) === null || _b === void 0 ? void 0 : _b.lastElementChild) === null || _c === void 0 ? void 0 : _c.lastElementChild;
386
- const rowCells = Array.from((row === null || row === void 0 ? void 0 : row.children) || []);
387
- const targetCell = edge === 'f' ? rowCells[0] : rowCells[rowCells.length - 1];
388
- return targetCell;
389
- };
390
- const findAdjacentCell = (columnIndex, searchDirection) => {
391
- const searchArray = searchDirection === 'f'
392
- ? allCells.slice(currentCellIndex + 1)
393
- : allCells.slice(0, currentCellIndex).reverse();
394
- return searchArray.find((cell) => cell.matches(`[data-index="${columnIndex}"]`));
395
- };
396
- switch (e.key) {
397
- case 'ArrowRight':
398
- nextCell = findAdjacentCell(currentIndex + 1, 'f');
399
- break;
400
- case 'ArrowLeft':
401
- nextCell = findAdjacentCell(currentIndex - 1, 'b');
402
- break;
403
- case 'ArrowUp':
404
- nextCell = findAdjacentCell(currentIndex, 'b');
405
- break;
406
- case 'ArrowDown':
407
- nextCell = findAdjacentCell(currentIndex, 'f');
408
- break;
409
- case 'Home':
410
- nextCell = findEdgeCell(e.ctrlKey ? 'f' : 'c', 'f');
411
- break;
412
- case 'End':
413
- nextCell = findEdgeCell(e.ctrlKey ? 'l' : 'c', 'l');
414
- break;
415
- }
416
- if (nextCell) {
417
- nextCell.focus();
418
- }
419
- }
420
- };
421
-
422
- function defaultDisplayColumnProps({ header, id, size, tableOptions, }) {
423
- const { defaultDisplayColumn, displayColumnDefOptions, localization } = tableOptions;
424
- return Object.assign(Object.assign(Object.assign(Object.assign({}, defaultDisplayColumn), { header: header ? localization[header] : '', size }), displayColumnDefOptions === null || displayColumnDefOptions === void 0 ? void 0 : displayColumnDefOptions[id]), { id });
425
- }
426
- const showRowPinningColumn = (tableOptions) => {
427
- const { enableRowPinning, rowPinningDisplayMode } = tableOptions;
428
- return !!(enableRowPinning && !(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.startsWith('select')));
429
- };
430
- const showRowDragColumn = (tableOptions) => {
431
- const { enableRowDragging, enableRowOrdering } = tableOptions;
432
- return !!(enableRowDragging || enableRowOrdering);
433
- };
434
- const showRowExpandColumn = (tableOptions) => {
435
- const { enableExpanding, enableGrouping, renderDetailPanel, state: { grouping }, } = tableOptions;
436
- return !!(enableExpanding ||
437
- (enableGrouping && (grouping === null || grouping === void 0 ? void 0 : grouping.length)) ||
438
- renderDetailPanel);
439
- };
440
- const showRowActionsColumn = (tableOptions) => {
441
- const { createDisplayMode, editDisplayMode, enableEditing, enableRowActions, state: { creatingRow }, } = tableOptions;
442
- return !!(enableRowActions ||
443
- (creatingRow && createDisplayMode === 'row') ||
444
- (enableEditing && ['modal', 'row'].includes(editDisplayMode !== null && editDisplayMode !== void 0 ? editDisplayMode : '')));
445
- };
446
- const showRowSelectionColumn = (tableOptions) => !!tableOptions.enableRowSelection;
447
- const showRowNumbersColumn = (tableOptions) => !!tableOptions.enableRowNumbers;
448
- const showRowSpacerColumn = (tableOptions) => tableOptions.layoutMode === 'grid-no-grow';
449
- const getLeadingDisplayColumnIds = (tableOptions) => [
450
- showRowPinningColumn(tableOptions) && 'mrt-row-pin',
451
- showRowDragColumn(tableOptions) && 'mrt-row-drag',
452
- tableOptions.positionActionsColumn === 'first' &&
453
- showRowActionsColumn(tableOptions) &&
454
- 'mrt-row-actions',
455
- tableOptions.positionExpandColumn === 'first' &&
456
- showRowExpandColumn(tableOptions) &&
457
- 'mrt-row-expand',
458
- showRowSelectionColumn(tableOptions) && 'mrt-row-select',
459
- showRowNumbersColumn(tableOptions) && 'mrt-row-numbers',
460
- ].filter(Boolean);
461
- const getTrailingDisplayColumnIds = (tableOptions) => [
462
- tableOptions.positionActionsColumn === 'last' &&
463
- showRowActionsColumn(tableOptions) &&
464
- 'mrt-row-actions',
465
- tableOptions.positionExpandColumn === 'last' &&
466
- showRowExpandColumn(tableOptions) &&
467
- 'mrt-row-expand',
468
- showRowSpacerColumn(tableOptions) && 'mrt-row-spacer',
469
- ].filter(Boolean);
470
- const getDefaultColumnOrderIds = (tableOptions, reset = false) => {
471
- const { state: { columnOrder: currentColumnOrderIds = [] }, } = tableOptions;
472
- const leadingDisplayColIds = getLeadingDisplayColumnIds(tableOptions);
473
- const trailingDisplayColIds = getTrailingDisplayColumnIds(tableOptions);
474
- const defaultColumnDefIds = getAllLeafColumnDefs(tableOptions.columns).map((columnDef) => getColumnId(columnDef));
475
- let allLeafColumnDefIds = reset
476
- ? defaultColumnDefIds
477
- : Array.from(new Set([...currentColumnOrderIds, ...defaultColumnDefIds]));
478
- allLeafColumnDefIds = allLeafColumnDefIds.filter((colId) => !leadingDisplayColIds.includes(colId) &&
479
- !trailingDisplayColIds.includes(colId));
480
- return [
481
- ...leadingDisplayColIds,
482
- ...allLeafColumnDefIds,
483
- ...trailingDisplayColIds,
484
- ];
485
- };
486
-
487
- const fuzzy$1 = (rowA, rowB, columnId) => {
488
- let dir = 0;
489
- if (rowA.columnFiltersMeta[columnId]) {
490
- dir = matchSorterUtils.compareItems(rowA.columnFiltersMeta[columnId], rowB.columnFiltersMeta[columnId]);
491
- }
492
- // Provide a fallback for when the item ranks are equal
493
- return dir === 0
494
- ? reactTable.sortingFns.alphanumeric(rowA, rowB, columnId)
495
- : dir;
496
- };
497
- const MRT_SortingFns = Object.assign(Object.assign({}, reactTable.sortingFns), { fuzzy: fuzzy$1 });
498
- const rankGlobalFuzzy = (rowA, rowB) => Math.max(...Object.values(rowB.columnFiltersMeta).map((v) => v.rank)) -
499
- Math.max(...Object.values(rowA.columnFiltersMeta).map((v) => v.rank));
500
-
501
360
  const getMRT_Rows = (table, all) => {
502
361
  const { getCenterRows, getPrePaginationRowModel, getRowModel, getState, getTopRows, options: { createDisplayMode, enablePagination, enableRowPinning, manualPagination, positionCreatingRow, rowPinningDisplayMode, }, } = table;
503
362
  const { creatingRow, pagination } = getState();
@@ -638,6 +497,230 @@ const getMRT_SelectAllHandler = ({ table }) => (event, value, forceAll) => {
638
497
  lastSelectedRowId.current = null;
639
498
  };
640
499
 
500
+ const isWinCtrlMacMeta = (event) => {
501
+ return ((event.ctrlKey && navigator.platform.toLowerCase().includes('win')) ||
502
+ (event.metaKey && navigator.platform.toLowerCase().includes('mac')));
503
+ };
504
+ const isCellEditable = ({ cell, table, }) => {
505
+ const { enableEditing } = table.options;
506
+ const { column: { columnDef }, row, } = cell;
507
+ return (!cell.getIsPlaceholder() &&
508
+ parseFromValuesOrFunc(enableEditing, row) &&
509
+ parseFromValuesOrFunc(columnDef.enableEditing, row) !== false);
510
+ };
511
+ const openEditingCell = ({ cell, table, }) => {
512
+ const { options: { editDisplayMode }, refs: { editInputRefs }, } = table;
513
+ const { column } = cell;
514
+ if (isCellEditable({ cell, table }) && editDisplayMode === 'cell') {
515
+ table.setEditingCell(cell);
516
+ queueMicrotask(() => {
517
+ var _a;
518
+ const textField = editInputRefs.current[column.id];
519
+ if (textField) {
520
+ textField.focus();
521
+ (_a = textField.select) === null || _a === void 0 ? void 0 : _a.call(textField);
522
+ }
523
+ });
524
+ }
525
+ };
526
+ const cellKeyboardShortcuts = ({ cell, cellElements, cellValue, containerElement, event, header, parentElement, table, }) => {
527
+ var _a, _b, _c, _d, _e, _f, _g, _h;
528
+ if (!table.options.enableKeyboardShortcuts)
529
+ return;
530
+ const currentCell = event.currentTarget;
531
+ if (cellValue && isWinCtrlMacMeta(event) && event.key === 'c') {
532
+ navigator.clipboard.writeText(cellValue);
533
+ }
534
+ else if (['Enter', ' '].includes(event.key)) {
535
+ if (((_a = cell === null || cell === void 0 ? void 0 : cell.column) === null || _a === void 0 ? void 0 : _a.id) === 'mrt-row-select') {
536
+ event.preventDefault();
537
+ getMRT_RowSelectionHandler({
538
+ row: cell.row,
539
+ table,
540
+ //@ts-ignore
541
+ staticRowIndex: +event.target.getAttribute('data-index'),
542
+ })(event);
543
+ }
544
+ else if (((_b = header === null || header === void 0 ? void 0 : header.column) === null || _b === void 0 ? void 0 : _b.id) === 'mrt-row-select' &&
545
+ table.options.enableSelectAll) {
546
+ event.preventDefault();
547
+ getMRT_SelectAllHandler({
548
+ table,
549
+ })(event);
550
+ }
551
+ else if (((_c = cell === null || cell === void 0 ? void 0 : cell.column) === null || _c === void 0 ? void 0 : _c.id) === 'mrt-row-expand' &&
552
+ (cell.row.getCanExpand() ||
553
+ ((_e = (_d = table.options).renderDetailPanel) === null || _e === void 0 ? void 0 : _e.call(_d, { row: cell.row, table })))) {
554
+ event.preventDefault();
555
+ cell.row.toggleExpanded();
556
+ }
557
+ else if (((_f = header === null || header === void 0 ? void 0 : header.column) === null || _f === void 0 ? void 0 : _f.id) === 'mrt-row-expand' &&
558
+ table.options.enableExpandAll) {
559
+ event.preventDefault();
560
+ table.toggleAllRowsExpanded();
561
+ }
562
+ else if ((cell === null || cell === void 0 ? void 0 : cell.column.id) === 'mrt-row-pin') {
563
+ event.preventDefault();
564
+ cell.row.getIsPinned()
565
+ ? cell.row.pin(false)
566
+ : cell.row.pin(((_g = table.options.rowPinningDisplayMode) === null || _g === void 0 ? void 0 : _g.includes('bottom'))
567
+ ? 'bottom'
568
+ : 'top');
569
+ }
570
+ else if (header && isWinCtrlMacMeta(event)) {
571
+ const actionsButton = currentCell.querySelector(`button[aria-label="${table.options.localization.columnActions}"]`);
572
+ if (actionsButton) {
573
+ actionsButton.click();
574
+ }
575
+ }
576
+ else if ((_h = header === null || header === void 0 ? void 0 : header.column) === null || _h === void 0 ? void 0 : _h.getCanSort()) {
577
+ event.preventDefault();
578
+ header.column.toggleSorting();
579
+ }
580
+ }
581
+ else if ([
582
+ 'ArrowRight',
583
+ 'ArrowLeft',
584
+ 'ArrowUp',
585
+ 'ArrowDown',
586
+ 'Home',
587
+ 'End',
588
+ 'PageUp',
589
+ 'PageDown',
590
+ ].includes(event.key)) {
591
+ event.preventDefault();
592
+ const currentRow = parentElement || currentCell.closest('tr');
593
+ const tableElement = containerElement || currentCell.closest('table');
594
+ const allCells = cellElements ||
595
+ Array.from((tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelectorAll('th, td')) || []);
596
+ const currentCellIndex = allCells.indexOf(currentCell);
597
+ const currentIndex = parseInt(currentCell.getAttribute('data-index') || '0');
598
+ let nextCell = undefined;
599
+ //home/end first or last cell in row
600
+ const findEdgeCell = (rowIndex, edge) => {
601
+ var _a;
602
+ const row = rowIndex === 'c'
603
+ ? currentRow
604
+ : rowIndex === 'f'
605
+ ? tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelector('tr')
606
+ : (_a = tableElement === null || tableElement === void 0 ? void 0 : tableElement.lastElementChild) === null || _a === void 0 ? void 0 : _a.lastElementChild;
607
+ const rowCells = Array.from((row === null || row === void 0 ? void 0 : row.children) || []);
608
+ const targetCell = edge === 'f' ? rowCells[0] : rowCells[rowCells.length - 1];
609
+ return targetCell;
610
+ };
611
+ //page up/down first or last cell in column
612
+ const findBottomTopCell = (columnIndex, edge) => {
613
+ var _a;
614
+ const row = edge === 't'
615
+ ? tableElement === null || tableElement === void 0 ? void 0 : tableElement.querySelector('tr')
616
+ : (_a = tableElement === null || tableElement === void 0 ? void 0 : tableElement.lastElementChild) === null || _a === void 0 ? void 0 : _a.lastElementChild;
617
+ const rowCells = Array.from((row === null || row === void 0 ? void 0 : row.children) || []);
618
+ const targetCell = rowCells[columnIndex];
619
+ return targetCell;
620
+ };
621
+ const findAdjacentCell = (columnIndex, searchDirection) => {
622
+ const searchArray = searchDirection === 'f'
623
+ ? allCells.slice(currentCellIndex + 1)
624
+ : allCells.slice(0, currentCellIndex).reverse();
625
+ return searchArray.find((cell) => cell.matches(`[data-index="${columnIndex}"]`));
626
+ };
627
+ switch (event.key) {
628
+ case 'ArrowRight':
629
+ nextCell = findAdjacentCell(currentIndex + 1, 'f');
630
+ break;
631
+ case 'ArrowLeft':
632
+ nextCell = findAdjacentCell(currentIndex - 1, 'b');
633
+ break;
634
+ case 'ArrowUp':
635
+ nextCell = findAdjacentCell(currentIndex, 'b');
636
+ break;
637
+ case 'ArrowDown':
638
+ nextCell = findAdjacentCell(currentIndex, 'f');
639
+ break;
640
+ case 'Home':
641
+ nextCell = findEdgeCell(isWinCtrlMacMeta(event) ? 'f' : 'c', 'f');
642
+ break;
643
+ case 'End':
644
+ nextCell = findEdgeCell(isWinCtrlMacMeta(event) ? 'l' : 'c', 'l');
645
+ break;
646
+ case 'PageUp':
647
+ nextCell = findBottomTopCell(currentIndex, 't');
648
+ break;
649
+ case 'PageDown':
650
+ nextCell = findBottomTopCell(currentIndex, 'b');
651
+ break;
652
+ }
653
+ if (nextCell) {
654
+ nextCell.focus();
655
+ }
656
+ }
657
+ };
658
+
659
+ function defaultDisplayColumnProps({ header, id, size, tableOptions, }) {
660
+ const { defaultDisplayColumn, displayColumnDefOptions, localization } = tableOptions;
661
+ return Object.assign(Object.assign(Object.assign(Object.assign({}, defaultDisplayColumn), { header: header ? localization[header] : '', size }), displayColumnDefOptions === null || displayColumnDefOptions === void 0 ? void 0 : displayColumnDefOptions[id]), { id });
662
+ }
663
+ const showRowPinningColumn = (tableOptions) => {
664
+ const { enableRowPinning, rowPinningDisplayMode } = tableOptions;
665
+ return !!(enableRowPinning && !(rowPinningDisplayMode === null || rowPinningDisplayMode === void 0 ? void 0 : rowPinningDisplayMode.startsWith('select')));
666
+ };
667
+ const showRowDragColumn = (tableOptions) => {
668
+ const { enableRowDragging, enableRowOrdering } = tableOptions;
669
+ return !!(enableRowDragging || enableRowOrdering);
670
+ };
671
+ const showRowExpandColumn = (tableOptions) => {
672
+ const { enableExpanding, enableGrouping, renderDetailPanel, state: { grouping }, } = tableOptions;
673
+ return !!(enableExpanding ||
674
+ (enableGrouping && (grouping === null || grouping === void 0 ? void 0 : grouping.length)) ||
675
+ renderDetailPanel);
676
+ };
677
+ const showRowActionsColumn = (tableOptions) => {
678
+ const { createDisplayMode, editDisplayMode, enableEditing, enableRowActions, state: { creatingRow }, } = tableOptions;
679
+ return !!(enableRowActions ||
680
+ (creatingRow && createDisplayMode === 'row') ||
681
+ (enableEditing && ['modal', 'row'].includes(editDisplayMode !== null && editDisplayMode !== void 0 ? editDisplayMode : '')));
682
+ };
683
+ const showRowSelectionColumn = (tableOptions) => !!tableOptions.enableRowSelection;
684
+ const showRowNumbersColumn = (tableOptions) => !!tableOptions.enableRowNumbers;
685
+ const showRowSpacerColumn = (tableOptions) => tableOptions.layoutMode === 'grid-no-grow';
686
+ const getLeadingDisplayColumnIds = (tableOptions) => [
687
+ showRowPinningColumn(tableOptions) && 'mrt-row-pin',
688
+ showRowDragColumn(tableOptions) && 'mrt-row-drag',
689
+ tableOptions.positionActionsColumn === 'first' &&
690
+ showRowActionsColumn(tableOptions) &&
691
+ 'mrt-row-actions',
692
+ tableOptions.positionExpandColumn === 'first' &&
693
+ showRowExpandColumn(tableOptions) &&
694
+ 'mrt-row-expand',
695
+ showRowSelectionColumn(tableOptions) && 'mrt-row-select',
696
+ showRowNumbersColumn(tableOptions) && 'mrt-row-numbers',
697
+ ].filter(Boolean);
698
+ const getTrailingDisplayColumnIds = (tableOptions) => [
699
+ tableOptions.positionActionsColumn === 'last' &&
700
+ showRowActionsColumn(tableOptions) &&
701
+ 'mrt-row-actions',
702
+ tableOptions.positionExpandColumn === 'last' &&
703
+ showRowExpandColumn(tableOptions) &&
704
+ 'mrt-row-expand',
705
+ showRowSpacerColumn(tableOptions) && 'mrt-row-spacer',
706
+ ].filter(Boolean);
707
+ const getDefaultColumnOrderIds = (tableOptions, reset = false) => {
708
+ const { state: { columnOrder: currentColumnOrderIds = [] }, } = tableOptions;
709
+ const leadingDisplayColIds = getLeadingDisplayColumnIds(tableOptions);
710
+ const trailingDisplayColIds = getTrailingDisplayColumnIds(tableOptions);
711
+ const defaultColumnDefIds = getAllLeafColumnDefs(tableOptions.columns).map((columnDef) => getColumnId(columnDef));
712
+ let allLeafColumnDefIds = reset
713
+ ? defaultColumnDefIds
714
+ : Array.from(new Set([...currentColumnOrderIds, ...defaultColumnDefIds]));
715
+ allLeafColumnDefIds = allLeafColumnDefIds.filter((colId) => !leadingDisplayColIds.includes(colId) &&
716
+ !trailingDisplayColIds.includes(colId));
717
+ return [
718
+ ...leadingDisplayColIds,
719
+ ...allLeafColumnDefIds,
720
+ ...trailingDisplayColIds,
721
+ ];
722
+ };
723
+
641
724
  const MRT_AggregationFns = Object.assign({}, reactTable.aggregationFns);
642
725
 
643
726
  const fuzzy = (row, columnId, filterValue, addMeta) => {
@@ -919,7 +1002,7 @@ const MRT_ActionMenuItem = (_a) => {
919
1002
  minWidth: '120px',
920
1003
  my: 0,
921
1004
  py: '6px',
922
- } }, rest, { children: [jsxRuntime.jsxs(Box__default["default"], { sx: {
1005
+ }, tabIndex: 0 }, rest, { children: [jsxRuntime.jsxs(Box__default["default"], { sx: {
923
1006
  alignItems: 'center',
924
1007
  display: 'flex',
925
1008
  }, children: [jsxRuntime.jsx(ListItemIcon__default["default"], { children: icon }), label] }), onOpenSubMenu && (jsxRuntime.jsx(IconButton__default["default"], { onClick: onOpenSubMenu, onMouseEnter: onOpenSubMenu, size: "small", sx: { p: 0 }, children: jsxRuntime.jsx(ArrowRightIcon, {}) }))] })));
@@ -1419,7 +1502,7 @@ const MRT_DefaultDisplayColumn = {
1419
1502
  };
1420
1503
  const useMRT_TableOptions = (_a) => {
1421
1504
  var _b;
1422
- 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, enableCellNavigation = 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, 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", "enableCellNavigation", "enableMultiRowSelection", "enableMultiSort", "enablePagination", "enableRowPinning", "enableRowSelection", "enableRowVirtualization", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarInternalActions", "enableTopToolbar", "filterFns", "icons", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "mrtTheme", "paginationDisplayMode", "positionActionsColumn", "positionCreatingRow", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberDisplayMode", "rowPinningDisplayMode", "selectAllMode", "sortingFns"]);
1505
+ 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, 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", "layoutMode", "localization", "manualFiltering", "manualGrouping", "manualPagination", "manualSorting", "mrtTheme", "paginationDisplayMode", "positionActionsColumn", "positionCreatingRow", "positionExpandColumn", "positionGlobalFilter", "positionPagination", "positionToolbarAlertBanner", "positionToolbarDropZone", "rowNumberDisplayMode", "rowPinningDisplayMode", "selectAllMode", "sortingFns"]);
1423
1506
  const theme = styles.useTheme();
1424
1507
  icons = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Default_Icons), icons)), [icons]);
1425
1508
  localization = react.useMemo(() => (Object.assign(Object.assign({}, MRT_Localization_EN), localization)), [localization]);
@@ -1480,7 +1563,7 @@ const useMRT_TableOptions = (_a) => {
1480
1563
  enableGlobalFilterRankedResults,
1481
1564
  enableGrouping,
1482
1565
  enableHiding,
1483
- enableCellNavigation,
1566
+ enableKeyboardShortcuts,
1484
1567
  enableMultiRowSelection,
1485
1568
  enableMultiSort,
1486
1569
  enablePagination,
@@ -2127,7 +2210,7 @@ const MRT_TableBodyCell = (_a) => {
2127
2210
  var _b, _c, _d, _e, _f;
2128
2211
  var { cell, numRows, rowRef, staticColumnIndex, staticRowIndex, table } = _a, rest = __rest(_a, ["cell", "numRows", "rowRef", "staticColumnIndex", "staticRowIndex", "table"]);
2129
2212
  const theme = styles.useTheme();
2130
- const { getState, options: { columnResizeDirection, columnResizeMode, createDisplayMode, editDisplayMode, enableCellActions, enableClickToCopy, enableColumnOrdering, enableColumnPinning, enableGrouping, enableCellNavigation, layoutMode, mrtTheme: { draggingBorderColor }, muiSkeletonProps, muiTableBodyCellProps, }, setHoveredColumn, } = table;
2213
+ const { getState, options: { columnResizeDirection, columnResizeMode, createDisplayMode, editDisplayMode, enableCellActions, enableClickToCopy, enableColumnOrdering, enableColumnPinning, enableGrouping, enableKeyboardShortcuts, layoutMode, mrtTheme: { draggingBorderColor }, muiSkeletonProps, muiTableBodyCellProps, }, setHoveredColumn, } = table;
2131
2214
  const { actionCell, columnSizingInfo, creatingRow, density, draggingColumn, draggingRow, editingCell, editingRow, hoveredColumn, hoveredRow, isLoading, showSkeletons, } = getState();
2132
2215
  const { column, row } = cell;
2133
2216
  const { columnDef } = column;
@@ -2249,14 +2332,17 @@ const MRT_TableBodyCell = (_a) => {
2249
2332
  table.refs.actionCellRef.current = e.currentTarget;
2250
2333
  }
2251
2334
  };
2252
- const handleKeyDown = (e) => {
2335
+ const handleKeyDown = (event) => {
2253
2336
  var _a;
2254
- if (enableCellNavigation) {
2255
- cellNavigation(e);
2256
- }
2257
- (_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, e);
2337
+ cellKeyboardShortcuts({
2338
+ cell,
2339
+ cellValue: cell.getValue(),
2340
+ event,
2341
+ table,
2342
+ });
2343
+ (_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, event);
2258
2344
  };
2259
- return (jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: theme.direction === 'rtl' ? 'right' : 'left', "data-index": staticColumnIndex, "data-pinned": !!isColumnPinned || undefined, tabIndex: enableCellNavigation ? 0 : undefined }, tableCellProps, { onKeyDown: handleKeyDown, onContextMenu: handleContextMenu, onDoubleClick: handleDoubleClick, onDragEnter: handleDragEnter, onDragOver: handleDragOver, sx: (theme) => (Object.assign(Object.assign({ '&:hover': {
2345
+ 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': {
2260
2346
  outline: (actionCell === null || actionCell === void 0 ? void 0 : actionCell.id) === cell.id ||
2261
2347
  (editDisplayMode === 'cell' && isEditable) ||
2262
2348
  (editDisplayMode === 'table' && (isCreating || isEditing))
@@ -2517,7 +2603,7 @@ const MRT_TableFooterCell = (_a) => {
2517
2603
  var _b, _c, _d;
2518
2604
  var { footer, staticColumnIndex, table } = _a, rest = __rest(_a, ["footer", "staticColumnIndex", "table"]);
2519
2605
  const theme = styles.useTheme();
2520
- const { getState, options: { enableColumnPinning, muiTableFooterCellProps, enableCellNavigation, }, } = table;
2606
+ const { getState, options: { enableColumnPinning, muiTableFooterCellProps, enableKeyboardShortcuts, }, } = table;
2521
2607
  const { density } = getState();
2522
2608
  const { column } = footer;
2523
2609
  const { columnDef } = column;
@@ -2527,18 +2613,20 @@ const MRT_TableFooterCell = (_a) => {
2527
2613
  column.getIsPinned();
2528
2614
  const args = { column, table };
2529
2615
  const tableCellProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiTableFooterCellProps, args)), parseFromValuesOrFunc(columnDef.muiTableFooterCellProps, args)), rest);
2530
- const handleKeyDown = (e) => {
2616
+ const handleKeyDown = (event) => {
2531
2617
  var _a;
2532
- if (enableCellNavigation) {
2533
- cellNavigation(e);
2534
- }
2535
- (_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, e);
2618
+ cellKeyboardShortcuts({
2619
+ event,
2620
+ cellValue: footer.column.columnDef.footer,
2621
+ table,
2622
+ });
2623
+ (_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, event);
2536
2624
  };
2537
2625
  return (jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: columnDefType === 'group'
2538
2626
  ? 'center'
2539
2627
  : theme.direction === 'rtl'
2540
2628
  ? 'right'
2541
- : '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'
2629
+ : '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'
2542
2630
  ? '0.5rem'
2543
2631
  : density === 'comfortable'
2544
2632
  ? '1rem'
@@ -3154,7 +3242,11 @@ const MRT_FilterTextField = (_a) => {
3154
3242
  }
3155
3243
  }, margin: 'none', placeholder: filterChipLabel || isSelectFilter || isMultiSelectFilter
3156
3244
  ? undefined
3157
- : filterPlaceholder, variant: 'standard' }, textFieldProps), { sx: (theme) => (Object.assign({ minWidth: isDateFilter
3245
+ : filterPlaceholder, variant: 'standard' }, textFieldProps), { onKeyDown: (e) => {
3246
+ var _a;
3247
+ e.stopPropagation();
3248
+ (_a = textFieldProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, e);
3249
+ }, sx: (theme) => (Object.assign({ minWidth: isDateFilter
3158
3250
  ? '160px'
3159
3251
  : enableColumnFilterModes && rangeFilterIndex === 0
3160
3252
  ? '110px'
@@ -3464,7 +3556,7 @@ const MRT_TableHeadCell = (_a) => {
3464
3556
  var _b, _c, _d, _f, _g, _h;
3465
3557
  var { columnVirtualizer, header, staticColumnIndex, table } = _a, rest = __rest(_a, ["columnVirtualizer", "header", "staticColumnIndex", "table"]);
3466
3558
  const theme = styles.useTheme();
3467
- const { getState, options: { columnFilterDisplayMode, columnResizeDirection, columnResizeMode, enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnPinning, enableGrouping, enableCellNavigation, enableMultiSort, layoutMode, mrtTheme: { draggingBorderColor }, muiTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
3559
+ const { getState, options: { columnFilterDisplayMode, columnResizeDirection, columnResizeMode, enableKeyboardShortcuts, enableColumnActions, enableColumnDragging, enableColumnOrdering, enableColumnPinning, enableGrouping, enableMultiSort, layoutMode, mrtTheme: { draggingBorderColor }, muiTableHeadCellProps, }, refs: { tableHeadCellRefs }, setHoveredColumn, } = table;
3468
3560
  const { columnSizingInfo, density, draggingColumn, grouping, hoveredColumn, showColumnFilters, } = getState();
3469
3561
  const { column } = header;
3470
3562
  const { columnDef } = column;
@@ -3533,12 +3625,15 @@ const MRT_TableHeadCell = (_a) => {
3533
3625
  e.preventDefault();
3534
3626
  }
3535
3627
  };
3536
- const handleKeyDown = (e) => {
3628
+ const handleKeyDown = (event) => {
3537
3629
  var _a;
3538
- if (enableCellNavigation) {
3539
- cellNavigation(e);
3540
- }
3541
- (_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, e);
3630
+ cellKeyboardShortcuts({
3631
+ event,
3632
+ cellValue: header.column.columnDef.header,
3633
+ table,
3634
+ header,
3635
+ });
3636
+ (_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, event);
3542
3637
  };
3543
3638
  const HeaderElement = (_b = parseFromValuesOrFunc(columnDef.Header, {
3544
3639
  column,
@@ -3561,7 +3656,7 @@ const MRT_TableHeadCell = (_a) => {
3561
3656
  (_a = columnVirtualizer === null || columnVirtualizer === void 0 ? void 0 : columnVirtualizer.measureElement) === null || _a === void 0 ? void 0 : _a.call(columnVirtualizer, node);
3562
3657
  }
3563
3658
  }
3564
- }, tabIndex: enableCellNavigation ? 0 : undefined }, tableCellProps, { onKeyDown: handleKeyDown, sx: (theme) => (Object.assign(Object.assign({ '& :hover': {
3659
+ }, tabIndex: enableKeyboardShortcuts ? 0 : undefined }, tableCellProps, { onKeyDown: handleKeyDown, sx: (theme) => (Object.assign(Object.assign({ '& :hover': {
3565
3660
  '.MuiButtonBase-root': {
3566
3661
  opacity: 1,
3567
3662
  },
@@ -4414,7 +4509,7 @@ exports.MaterialReactTable = MaterialReactTable;
4414
4509
  exports.Memo_MRT_TableBody = Memo_MRT_TableBody;
4415
4510
  exports.Memo_MRT_TableBodyCell = Memo_MRT_TableBodyCell;
4416
4511
  exports.Memo_MRT_TableBodyRow = Memo_MRT_TableBodyRow;
4417
- exports.cellNavigation = cellNavigation;
4512
+ exports.cellKeyboardShortcuts = cellKeyboardShortcuts;
4418
4513
  exports.createMRTColumnHelper = createMRTColumnHelper;
4419
4514
  exports.createRow = createRow;
4420
4515
  exports.defaultDisplayColumnProps = defaultDisplayColumnProps;