material-react-table-narender 2.13.22 → 2.13.23

Sign up to get free protection for your applications and to get access to all the features.
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);
@@ -4295,7 +4299,9 @@ const MRT_ToggleNavigationButton = (_a) => {
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 &&