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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.13.8",
2
+ "version": "2.13.10",
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.",
@@ -136,6 +136,33 @@ export const cellKeyboardShortcuts = <TData extends MRT_RowData = MRT_RowData>({
136
136
  event.preventDefault();
137
137
  header.column.toggleSorting();
138
138
  }
139
+ else if ("Enter" === event.key) {
140
+
141
+ debugger;
142
+ event.preventDefault();
143
+ const input = currentCell.querySelector('input') as HTMLInputElement;
144
+ const select = currentCell.querySelector('select') as HTMLSelectElement;
145
+ const checkbox = currentCell.querySelector('input[type="checkbox"]') as HTMLInputElement;
146
+ const button = currentCell.querySelector('button') as HTMLButtonElement;
147
+ const autocomplete = currentCell.querySelector('.MuiAutocomplete-root input[type="text"]') as HTMLInputElement;
148
+
149
+ // Focus the appropriate element
150
+ if (input) {
151
+ input.focus();
152
+ input.select?.();
153
+ } else if (select) {
154
+ select.focus();
155
+ } else if (checkbox) {
156
+ checkbox.focus();
157
+ checkbox.click();
158
+ } else if (button) {
159
+ button.focus();
160
+ button.click();
161
+ } else if (autocomplete) {
162
+ autocomplete.focus();
163
+ autocomplete.select?.();
164
+ }
165
+ }
139
166
  } else if (
140
167
  [
141
168
  'ArrowRight',
@@ -179,11 +206,10 @@ if (['ArrowDown','ArrowUp'].includes(event.key)) {
179
206
  return; // Exit if it's an Autocomplete and it is focused
180
207
  }
181
208
  if (event.key === 'ArrowUp') {
182
- // check if the autocomplete is open
183
- const autocompleteList = currentCell.querySelector('.MuiAutocomplete-popper');
184
- if (autocompleteList) {
209
+ const popper = document.querySelector('.MuiPopper-root');
210
+ if (popper && getComputedStyle(popper).visibility === 'visible') {
185
211
  return;
186
- }
212
+ }
187
213
  }
188
214
  }
189
215