material-react-table-narender 2.13.9 → 2.13.10
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.esm.js +30 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +30 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/utils/cell.utils.ts +27 -0
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',
|