material-react-table-narender 2.13.22 → 2.13.24
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.esm.js +34 -30
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +34 -30
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/toolbar/MRT_ToolbarInternalButtons.tsx +2 -3
- package/src/utils/cell.utils.ts +33 -33
package/package.json
CHANGED
@@ -67,10 +67,9 @@ export const MRT_ToolbarInternalButtons = <TData extends MRT_RowData>({
|
|
67
67
|
{enableFullScreenToggle && (
|
68
68
|
<MRT_ToggleFullScreenButton table={table} />
|
69
69
|
)}
|
70
|
-
{
|
70
|
+
{enableKeyboardShortcuts && (
|
71
71
|
<MRT_ToggleNavigationButton table={table} />
|
72
|
-
)}
|
73
|
-
<MRT_ToggleNavigationButton table={table} />
|
72
|
+
)}
|
74
73
|
</>
|
75
74
|
)}
|
76
75
|
</Box>
|
package/src/utils/cell.utils.ts
CHANGED
@@ -90,40 +90,40 @@ export const cellKeyboardShortcuts = <TData extends MRT_RowData = MRT_RowData>({
|
|
90
90
|
|
91
91
|
const { enableKeyboardShortcuts } = getState();
|
92
92
|
|
93
|
-
// alt + n
|
94
|
-
// if (event.altKey && event.key.toLocaleLowerCase() === 'n') {
|
95
|
-
// event.preventDefault();
|
96
|
-
// setEnableKeyboardShortcuts(!enableKeyboardShortcuts);
|
97
|
-
// const currentCell = event.currentTarget;
|
98
|
-
|
99
|
-
|
100
|
-
// if (enableKeyboardShortcuts) {
|
101
|
-
// const input = currentCell.querySelector('input') as HTMLInputElement;
|
102
|
-
// const select = currentCell.querySelector('select') as HTMLSelectElement;
|
103
|
-
// const checkbox = currentCell.querySelector('input[type="checkbox"]') as HTMLInputElement;
|
104
|
-
// const button = currentCell.querySelector('button') as HTMLButtonElement;
|
105
|
-
// const autocomplete = currentCell.querySelector('.MuiAutocomplete-root input[type="text"]') as HTMLInputElement;
|
106
|
-
|
107
|
-
|
108
|
-
// if (autocomplete) {
|
109
|
-
// autocomplete.focus();
|
110
|
-
// autocomplete.select?.();
|
111
|
-
// } else if (input) {
|
112
|
-
// input.focus();
|
113
|
-
// input.select?.();
|
114
|
-
// } else if (select) {
|
115
|
-
// select.focus();
|
116
|
-
// } else if (checkbox) {
|
117
|
-
// checkbox.focus();
|
118
|
-
// // checkbox.click();
|
119
|
-
// } else if (button) {
|
120
|
-
// button.focus();
|
121
|
-
// } else {
|
122
|
-
// currentCell.focus();
|
123
|
-
// }
|
124
|
-
// }
|
125
93
|
|
126
|
-
|
94
|
+
if (event.altKey && event.key.toLocaleLowerCase() === 'n') {
|
95
|
+
event.preventDefault();
|
96
|
+
setEnableKeyboardShortcuts(!enableKeyboardShortcuts);
|
97
|
+
const currentCell = event.currentTarget;
|
98
|
+
|
99
|
+
|
100
|
+
if (enableKeyboardShortcuts) {
|
101
|
+
const input = currentCell.querySelector('input') as HTMLInputElement;
|
102
|
+
const select = currentCell.querySelector('select') as HTMLSelectElement;
|
103
|
+
const checkbox = currentCell.querySelector('input[type="checkbox"]') as HTMLInputElement;
|
104
|
+
const button = currentCell.querySelector('button') as HTMLButtonElement;
|
105
|
+
const autocomplete = currentCell.querySelector('.MuiAutocomplete-root input[type="text"]') as HTMLInputElement;
|
106
|
+
|
107
|
+
|
108
|
+
if (autocomplete) {
|
109
|
+
autocomplete.focus();
|
110
|
+
// autocomplete.select?.();
|
111
|
+
} else if (input) {
|
112
|
+
input.focus();
|
113
|
+
// input.select?.();
|
114
|
+
} else if (select) {
|
115
|
+
select.focus();
|
116
|
+
} else if (checkbox) {
|
117
|
+
checkbox.focus();
|
118
|
+
// checkbox.click();
|
119
|
+
} else if (button) {
|
120
|
+
button.focus();
|
121
|
+
} else {
|
122
|
+
currentCell.focus();
|
123
|
+
}
|
124
|
+
}
|
125
|
+
|
126
|
+
}
|
127
127
|
|
128
128
|
|
129
129
|
// if (event.altKey && event.key.toLocaleLowerCase() === 'n') {
|