material-react-table-narender 2.13.18 → 2.13.19

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.13.18",
2
+ "version": "2.13.19",
3
3
  "license": "MIT",
4
4
  "name": "material-react-table-narender",
5
5
  "description": "A fully featured Material UI V5 implementation of TanStack React Table V8, written from the ground up in TypeScript.",
@@ -96,16 +96,33 @@ if (event.altKey) {
96
96
  const currentCell = event.currentTarget;
97
97
 
98
98
 
99
- if (enableKeyboardShortcuts) {
100
- currentCell.style.outline = '2px solid red';
101
- // setTimeout(() => {
102
- // currentCell.style.outline = '';
103
- // },
104
- // 1000);
105
- currentCell.focus();
106
- return;
107
- }
99
+ if (enableKeyboardShortcuts) {
100
+ const input = currentCell.querySelector('input') as HTMLInputElement;
101
+ const select = currentCell.querySelector('select') as HTMLSelectElement;
102
+ const checkbox = currentCell.querySelector('input[type="checkbox"]') as HTMLInputElement;
103
+ const button = currentCell.querySelector('button') as HTMLButtonElement;
104
+ const autocomplete = currentCell.querySelector('.MuiAutocomplete-root input[type="text"]') as HTMLInputElement;
105
+
106
+
107
+ if (autocomplete) {
108
+ autocomplete.focus();
109
+ autocomplete.select?.();
110
+ } else if (input) {
111
+ input.focus();
112
+ input.select?.();
113
+ } else if (select) {
114
+ select.focus();
115
+ } else if (checkbox) {
116
+ checkbox.focus();
117
+ // checkbox.click();
118
+ } else if (button) {
119
+ button.focus();
120
+ } else {
121
+ currentCell.focus();
108
122
  }
123
+ }
124
+
125
+ }
109
126
 
110
127
  // if (!table.options.enableKeyboardShortcuts) return;
111
128
  if (!enableKeyboardShortcuts) return