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/dist/index.d.ts CHANGED
@@ -376,7 +376,6 @@ interface MRT_Localization {
376
376
  thenBy: string;
377
377
  toggleDensity: string;
378
378
  toggleFullScreen: string;
379
- keyboardNavigation: string;
380
379
  toggleSelectAll: string;
381
380
  toggleSelectRow: string;
382
381
  toggleVisibility: string;
package/dist/index.esm.js CHANGED
@@ -439,35 +439,39 @@ const cellKeyboardShortcuts = ({ cell, cellElements, cellValue, containerElement
439
439
  debugger;
440
440
  const { getState, setEnableKeyboardShortcuts, } = table;
441
441
  const { enableKeyboardShortcuts } = getState();
442
- // alt + n
443
- // if (event.altKey && event.key.toLocaleLowerCase() === 'n') {
444
- // event.preventDefault();
445
- // setEnableKeyboardShortcuts(!enableKeyboardShortcuts);
446
- // const currentCell = event.currentTarget;
447
- // if (enableKeyboardShortcuts) {
448
- // const input = currentCell.querySelector('input') as HTMLInputElement;
449
- // const select = currentCell.querySelector('select') as HTMLSelectElement;
450
- // const checkbox = currentCell.querySelector('input[type="checkbox"]') as HTMLInputElement;
451
- // const button = currentCell.querySelector('button') as HTMLButtonElement;
452
- // const autocomplete = currentCell.querySelector('.MuiAutocomplete-root input[type="text"]') as HTMLInputElement;
453
- // if (autocomplete) {
454
- // autocomplete.focus();
455
- // autocomplete.select?.();
456
- // } else if (input) {
457
- // input.focus();
458
- // input.select?.();
459
- // } else if (select) {
460
- // select.focus();
461
- // } else if (checkbox) {
462
- // checkbox.focus();
463
- // // checkbox.click();
464
- // } else if (button) {
465
- // button.focus();
466
- // } else {
467
- // currentCell.focus();
468
- // }
469
- // }
470
- // }
442
+ if (event.altKey && event.key.toLocaleLowerCase() === 'n') {
443
+ event.preventDefault();
444
+ setEnableKeyboardShortcuts(!enableKeyboardShortcuts);
445
+ const currentCell = event.currentTarget;
446
+ if (enableKeyboardShortcuts) {
447
+ const input = currentCell.querySelector('input');
448
+ const select = currentCell.querySelector('select');
449
+ const checkbox = currentCell.querySelector('input[type="checkbox"]');
450
+ const button = currentCell.querySelector('button');
451
+ const autocomplete = currentCell.querySelector('.MuiAutocomplete-root input[type="text"]');
452
+ if (autocomplete) {
453
+ autocomplete.focus();
454
+ // autocomplete.select?.();
455
+ }
456
+ else if (input) {
457
+ input.focus();
458
+ // input.select?.();
459
+ }
460
+ else if (select) {
461
+ select.focus();
462
+ }
463
+ else if (checkbox) {
464
+ checkbox.focus();
465
+ // checkbox.click();
466
+ }
467
+ else if (button) {
468
+ button.focus();
469
+ }
470
+ else {
471
+ currentCell.focus();
472
+ }
473
+ }
474
+ }
471
475
  // if (event.altKey && event.key.toLocaleLowerCase() === 'n') {
472
476
  // event.preventDefault();
473
477
  // setEnableKeyboardShortcuts(!enableKeyboardShortcuts);
@@ -4289,20 +4293,22 @@ const MRT_ToggleNavigationButton = (_a) => {
4289
4293
  setTooltipOpened(false);
4290
4294
  setEnableKeyboardShortcuts(!enableKeyboardShortcuts);
4291
4295
  };
4292
- return (jsx(Tooltip, { open: tooltipOpened, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.keyboardNavigation, children: jsx(IconButton, Object.assign({ "aria-label": localization.keyboardNavigation, onClick: handleToggleFullScreen, onMouseEnter: () => setTooltipOpened(true), onMouseLeave: () => setTooltipOpened(false) }, rest, { title: undefined, children: enableKeyboardShortcuts ? jsx(FullscreenExitIcon, {}) : jsx(FullscreenIcon, {}) })) }));
4296
+ return (jsx(Tooltip, { open: tooltipOpened, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleFullScreen, children: jsx(IconButton, Object.assign({ "aria-label": localization.toggleFullScreen, onClick: handleToggleFullScreen, onMouseEnter: () => setTooltipOpened(true), onMouseLeave: () => setTooltipOpened(false) }, rest, { title: undefined, children: enableKeyboardShortcuts ? jsx(FullscreenExitIcon, {}) : jsx(FullscreenIcon, {}) })) }));
4293
4297
  };
4294
4298
 
4295
4299
  const MRT_ToolbarInternalButtons = (_a) => {
4296
4300
  var _b;
4297
4301
  var { table } = _a, rest = __rest(_a, ["table"]);
4298
- const { options: { columnFilterDisplayMode, enableColumnFilters, enableColumnOrdering, enableColumnPinning, enableDensityToggle, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, initialState, renderToolbarInternalActions, enableKeyboardShortcuts }, } = table;
4302
+ const { options: { columnFilterDisplayMode, enableColumnFilters, enableColumnOrdering, enableColumnPinning, enableDensityToggle, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, initialState, renderToolbarInternalActions,
4303
+ // enableKeyboardShortcuts
4304
+ }, } = table;
4299
4305
  return (jsx(Box, Object.assign({}, rest, { sx: (theme) => (Object.assign({ alignItems: 'center', display: 'flex', zIndex: 3 }, parseFromValuesOrFunc(rest === null || rest === void 0 ? void 0 : rest.sx, theme))), children: (_b = renderToolbarInternalActions === null || renderToolbarInternalActions === void 0 ? void 0 : renderToolbarInternalActions({
4300
4306
  table,
4301
4307
  })) !== null && _b !== void 0 ? _b : (jsxs(Fragment, { children: [enableFilters &&
4302
4308
  enableGlobalFilter &&
4303
4309
  !(initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) && (jsx(MRT_ToggleGlobalFilterButton, { table: table })), enableFilters &&
4304
4310
  enableColumnFilters &&
4305
- columnFilterDisplayMode !== 'popover' && (jsx(MRT_ToggleFiltersButton, { table: table })), (enableHiding || enableColumnOrdering || enableColumnPinning) && (jsx(MRT_ShowHideColumnsButton, { table: table })), enableDensityToggle && (jsx(MRT_ToggleDensePaddingButton, { table: table })), enableFullScreenToggle && (jsx(MRT_ToggleFullScreenButton, { table: table })), enableKeyboardShortcuts && (jsx(MRT_ToggleNavigationButton, { table: table }))] })) })));
4311
+ columnFilterDisplayMode !== 'popover' && (jsx(MRT_ToggleFiltersButton, { table: table })), (enableHiding || enableColumnOrdering || enableColumnPinning) && (jsx(MRT_ShowHideColumnsButton, { table: table })), enableDensityToggle && (jsx(MRT_ToggleDensePaddingButton, { table: table })), enableFullScreenToggle && (jsx(MRT_ToggleFullScreenButton, { table: table })), jsx(MRT_ToggleNavigationButton, { table: table })] })) })));
4306
4312
  };
4307
4313
 
4308
4314
  const MRT_GlobalFilterTextField = (_a) => {