material-react-table-narender 2.13.8 → 2.13.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -435,7 +435,7 @@ const openEditingCell = ({ cell, table, }) => {
435
435
  }
436
436
  };
437
437
  const cellKeyboardShortcuts = ({ cell, cellElements, cellValue, containerElement, event, header, parentElement, table, }) => {
438
- var _a, _b, _c, _d, _e, _f, _g, _h;
438
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
439
439
  debugger;
440
440
  if (!table.options.enableKeyboardShortcuts)
441
441
  return;
@@ -491,6 +491,35 @@ const cellKeyboardShortcuts = ({ cell, cellElements, cellValue, containerElement
491
491
  event.preventDefault();
492
492
  header.column.toggleSorting();
493
493
  }
494
+ else if ("Enter" === event.key) {
495
+ debugger;
496
+ event.preventDefault();
497
+ const input = currentCell.querySelector('input');
498
+ const select = currentCell.querySelector('select');
499
+ const checkbox = currentCell.querySelector('input[type="checkbox"]');
500
+ const button = currentCell.querySelector('button');
501
+ const autocomplete = currentCell.querySelector('.MuiAutocomplete-root input[type="text"]');
502
+ // Focus the appropriate element
503
+ if (input) {
504
+ input.focus();
505
+ (_j = input.select) === null || _j === void 0 ? void 0 : _j.call(input);
506
+ }
507
+ else if (select) {
508
+ select.focus();
509
+ }
510
+ else if (checkbox) {
511
+ checkbox.focus();
512
+ checkbox.click();
513
+ }
514
+ else if (button) {
515
+ button.focus();
516
+ button.click();
517
+ }
518
+ else if (autocomplete) {
519
+ autocomplete.focus();
520
+ (_k = autocomplete.select) === null || _k === void 0 ? void 0 : _k.call(autocomplete);
521
+ }
522
+ }
494
523
  }
495
524
  else if ([
496
525
  'ArrowRight',
@@ -523,9 +552,8 @@ const cellKeyboardShortcuts = ({ cell, cellElements, cellValue, containerElement
523
552
  return; // Exit if it's an Autocomplete and it is focused
524
553
  }
525
554
  if (event.key === 'ArrowUp') {
526
- // check if the autocomplete is open
527
- const autocompleteList = currentCell.querySelector('.MuiAutocomplete-popper');
528
- if (autocompleteList) {
555
+ const popper = document.querySelector('.MuiPopper-root');
556
+ if (popper && getComputedStyle(popper).visibility === 'visible') {
529
557
  return;
530
558
  }
531
559
  }