material-react-table-narender 2.13.8 → 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 +32 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +32 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/utils/cell.utils.ts +30 -4
package/package.json
CHANGED
package/src/utils/cell.utils.ts
CHANGED
@@ -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
|
-
|
183
|
-
|
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
|
|