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.js CHANGED
@@ -526,7 +526,7 @@ const openEditingCell = ({ cell, table, }) => {
526
526
  }
527
527
  };
528
528
  const cellKeyboardShortcuts = ({ cell, cellElements, cellValue, containerElement, event, header, parentElement, table, }) => {
529
- var _a, _b, _c, _d, _e, _f, _g, _h;
529
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
530
530
  debugger;
531
531
  if (!table.options.enableKeyboardShortcuts)
532
532
  return;
@@ -582,6 +582,35 @@ const cellKeyboardShortcuts = ({ cell, cellElements, cellValue, containerElement
582
582
  event.preventDefault();
583
583
  header.column.toggleSorting();
584
584
  }
585
+ else if ("Enter" === event.key) {
586
+ debugger;
587
+ event.preventDefault();
588
+ const input = currentCell.querySelector('input');
589
+ const select = currentCell.querySelector('select');
590
+ const checkbox = currentCell.querySelector('input[type="checkbox"]');
591
+ const button = currentCell.querySelector('button');
592
+ const autocomplete = currentCell.querySelector('.MuiAutocomplete-root input[type="text"]');
593
+ // Focus the appropriate element
594
+ if (input) {
595
+ input.focus();
596
+ (_j = input.select) === null || _j === void 0 ? void 0 : _j.call(input);
597
+ }
598
+ else if (select) {
599
+ select.focus();
600
+ }
601
+ else if (checkbox) {
602
+ checkbox.focus();
603
+ checkbox.click();
604
+ }
605
+ else if (button) {
606
+ button.focus();
607
+ button.click();
608
+ }
609
+ else if (autocomplete) {
610
+ autocomplete.focus();
611
+ (_k = autocomplete.select) === null || _k === void 0 ? void 0 : _k.call(autocomplete);
612
+ }
613
+ }
585
614
  }
586
615
  else if ([
587
616
  'ArrowRight',
@@ -614,9 +643,8 @@ const cellKeyboardShortcuts = ({ cell, cellElements, cellValue, containerElement
614
643
  return; // Exit if it's an Autocomplete and it is focused
615
644
  }
616
645
  if (event.key === 'ArrowUp') {
617
- // check if the autocomplete is open
618
- const autocompleteList = currentCell.querySelector('.MuiAutocomplete-popper');
619
- if (autocompleteList) {
646
+ const popper = document.querySelector('.MuiPopper-root');
647
+ if (popper && getComputedStyle(popper).visibility === 'visible') {
620
648
  return;
621
649
  }
622
650
  }