material-react-table-narender 2.13.21 → 2.13.23

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.21",
2
+ "version": "2.13.23",
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.",
@@ -32,10 +32,10 @@ export const MRT_ToggleNavigationButton = <TData extends MRT_RowData>({
32
32
  return (
33
33
  <Tooltip
34
34
  open={tooltipOpened}
35
- title={rest?.title ?? localization.keyboardNavigation}
35
+ title={rest?.title ?? localization.toggleFullScreen}
36
36
  >
37
37
  <IconButton
38
- aria-label={localization.keyboardNavigation}
38
+ aria-label={localization.toggleFullScreen}
39
39
  onClick={handleToggleFullScreen}
40
40
  onMouseEnter={() => setTooltipOpened(true)}
41
41
  onMouseLeave={() => setTooltipOpened(false)}
@@ -30,7 +30,7 @@ export const MRT_ToolbarInternalButtons = <TData extends MRT_RowData>({
30
30
  enableHiding,
31
31
  initialState,
32
32
  renderToolbarInternalActions,
33
- enableKeyboardShortcuts
33
+ // enableKeyboardShortcuts
34
34
  },
35
35
  } = table;
36
36
 
@@ -67,9 +67,10 @@ export const MRT_ToolbarInternalButtons = <TData extends MRT_RowData>({
67
67
  {enableFullScreenToggle && (
68
68
  <MRT_ToggleFullScreenButton table={table} />
69
69
  )}
70
- {enableKeyboardShortcuts && (
70
+ {/* {enableKeyboardShortcuts && (
71
71
  <MRT_ToggleNavigationButton table={table} />
72
- )}
72
+ )} */}
73
+ <MRT_ToggleNavigationButton table={table} />
73
74
  </>
74
75
  )}
75
76
  </Box>
package/src/types.ts CHANGED
@@ -247,7 +247,7 @@ export interface MRT_Localization {
247
247
  thenBy: string;
248
248
  toggleDensity: string;
249
249
  toggleFullScreen: string;
250
- keyboardNavigation: string;
250
+ // keyboardNavigation: string;
251
251
  toggleSelectAll: string;
252
252
  toggleSelectRow: string;
253
253
  toggleVisibility: string;
@@ -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') {