@infinite-table/infinite-react 3.3.1 → 3.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React$1 from 'react';
2
- import React__default, { CSSProperties, HTMLProps, RefCallback, MutableRefObject, MouseEvent, KeyboardEvent, ReactNode, EffectCallback } from 'react';
2
+ import React__default, { KeyboardEvent, CSSProperties, HTMLProps, RefCallback, MutableRefObject, MouseEvent, ReactNode, EffectCallback } from 'react';
3
3
 
4
4
  declare type SortDir = 1 | -1;
5
5
  declare type MultisortInfo<T> = {
@@ -160,6 +160,15 @@ declare function useInfiniteColumnFilterEditor<T>(): {
160
160
  className: string;
161
161
  };
162
162
 
163
+ declare type HotKeyEventDescriptor = {
164
+ key: KeyboardEvent['key'];
165
+ metaKey: KeyboardEvent['metaKey'];
166
+ altKey: KeyboardEvent['altKey'];
167
+ ctrlKey: KeyboardEvent['ctrlKey'];
168
+ shiftKey: KeyboardEvent['shiftKey'];
169
+ };
170
+ declare function eventMatchesKeyboardShortcut(event: HotKeyEventDescriptor, keyDescriptors: string | string[]): boolean;
171
+
163
172
  declare const InfiniteTableClassName: string;
164
173
  declare const InfiniteTableComponent: React$1.MemoExoticComponent<(<T>() => React$1.JSX.Element)>;
165
174
  declare type InfiniteTableComponent = {
@@ -1459,6 +1468,7 @@ interface InfiniteTableMappedState<T> {
1459
1468
  getCellContextMenuItems: InfiniteTableProps<T>['getCellContextMenuItems'];
1460
1469
  getColumnMenuItems: InfiniteTableProps<T>['getColumnMenuItems'];
1461
1470
  getFilterOperatorMenuItems: InfiniteTableProps<T>['getFilterOperatorMenuItems'];
1471
+ keyboardShortcuts: InfiniteTableProps<T>['keyboardShortcuts'];
1462
1472
  columnPinning: InfiniteTablePropColumnPinning;
1463
1473
  loadingText: InfiniteTableProps<T>['loadingText'];
1464
1474
  components: InfiniteTableProps<T>['components'];
@@ -2791,6 +2801,9 @@ declare type InfiniteTableColumnApi<_T> = {
2791
2801
  getCellValuesByPrimaryKey: (id: any) => null | ColumnCellValues;
2792
2802
  getCellValueByPrimaryKey: (id: any) => any | null;
2793
2803
  };
2804
+ declare type InfiniteTableApiStartEditParams = InfiniteTableApiIsCellEditableParams & {
2805
+ value?: any;
2806
+ };
2794
2807
  declare type InfiniteTableApiStopEditParams = {
2795
2808
  cancel: true;
2796
2809
  reject?: never;
@@ -2845,7 +2858,8 @@ interface InfiniteTableApi<T> {
2845
2858
  get scrollTop(): number;
2846
2859
  set scrollTop(value: number);
2847
2860
  isCellEditable: (params: InfiniteTableApiIsCellEditableParams) => Promise<boolean>;
2848
- startEdit: (params: InfiniteTableApiIsCellEditableParams) => Promise<boolean>;
2861
+ getColumnAtIndex: (index: number) => InfiniteTableComputedColumn<T> | null;
2862
+ startEdit: (params: InfiniteTableApiStartEditParams) => Promise<boolean>;
2849
2863
  stopEdit: (params?: InfiniteTableApiStopEditParams) => Promise<InfiniteTableApiStopEditPromiseResolveType>;
2850
2864
  persistEdit: (params?: {
2851
2865
  value?: any;
@@ -2992,12 +3006,20 @@ declare type InfiniteTablePropOnEditRejectedParams<T> = InfiniteTableRowInfoData
2992
3006
  };
2993
3007
  declare type InfiniteTablePropOnEditPersistParams<T> = InfiniteTablePropOnEditAcceptedParams<T>;
2994
3008
  declare type InfiniteTablePropMultiSortBehavior = 'append' | 'replace';
3009
+ declare type InfiniteTablePropKeyboardShorcut = {
3010
+ key: string | string[];
3011
+ when?: (context: InfiniteTableKeyboardEventHandlerContext<any>) => boolean | Promise<boolean>;
3012
+ handler: (context: InfiniteTableKeyboardEventHandlerContext<any>, event: KeyboardEvent) => void | {
3013
+ stopNext: boolean;
3014
+ } | Promise<any>;
3015
+ };
2995
3016
  interface InfiniteTableProps<T> {
2996
3017
  debugId?: string;
2997
3018
  columns: InfiniteTablePropColumns<T>;
2998
3019
  pivotColumns?: InfiniteTableColumnsMap<T, InfiniteTablePivotColumn<T>>;
2999
3020
  loadingText?: Renderable;
3000
3021
  components?: InfiniteTablePropComponents<T>;
3022
+ keyboardShortcuts?: InfiniteTablePropKeyboardShorcut[];
3001
3023
  viewportReservedWidth?: number;
3002
3024
  onViewportReservedWidthChange?: (viewportReservedWidth: number) => void;
3003
3025
  showColumnFilters?: boolean;
@@ -3215,6 +3237,10 @@ declare function useEffectWithObject(fn: EffectCallback, deps: Record<string, an
3215
3237
  declare function StringFilterEditor<T>(): React$1.JSX.Element;
3216
3238
  declare function NumberFilterEditor<T>(): React$1.JSX.Element;
3217
3239
 
3240
+ declare const keyboardShortcuts: {
3241
+ instantEdit: InfiniteTablePropKeyboardShorcut;
3242
+ };
3243
+
3218
3244
  declare type InterceptedMapFns<K, V> = {
3219
3245
  set?: (k: K, v: V) => void;
3220
3246
  beforeClear?: (map: Map<K, V>) => void;
@@ -3280,4 +3306,4 @@ declare const components: {
3280
3306
  NumberFilterEditor: typeof NumberFilterEditor;
3281
3307
  };
3282
3308
 
3283
- export { AdvancedAlignable, CellSelectionState, CellSelectionStateObject, ColumnTypeWithInherit, DataSource, DataSourceAction, DataSourceActionType, DataSourceAggregationReducer, DataSourceApi, DataSourceCRUDParam, DataSourceComponentActions, DataSourceContextValue, DataSourceData, DataSourceDataParams, DataSourceDataParamsChanges, DataSourceDerivedState, DataSourceFilterFunctionParam, DataSourceFilterOperator, DataSourceFilterOperatorFunction, DataSourceFilterOperatorFunctionParam, DataSourceFilterType, DataSourceFilterValueItem, DataSourceFilterValueItemValueGetter, DataSourceGroupBy, DataSourceGroupRowsList, DataSourceInsertParam, DataSourceLivePaginationCursorFn, DataSourceLivePaginationCursorParams, DataSourceLivePaginationCursorValue, DataSourceMappedState, DataSourceMappings, DataSourceMasterDetailContextValue, DataSourcePivotBy, DataSourcePropAggregationReducers, DataSourcePropCellSelection, DataSourcePropCellSelection_MultiCell, DataSourcePropCellSelection_SingleCell, DataSourcePropFilterFunction, DataSourcePropFilterTypes, DataSourcePropFilterValue, DataSourcePropGroupBy, DataSourcePropGroupRowsStateObject, DataSourcePropIsRowSelected, DataSourcePropLivePaginationCursor, DataSourcePropMultiRowSelectionChangeParamType, DataSourcePropOnCellSelectionChange, DataSourcePropOnCellSelectionChange_MultiCell, DataSourcePropOnCellSelectionChange_SingleCell, DataSourcePropOnRowSelectionChange, DataSourcePropOnRowSelectionChange_MultiRow, DataSourcePropOnRowSelectionChange_SingleRow, DataSourcePropPivotBy, DataSourcePropRowInfoReducers, DataSourcePropRowSelection, DataSourcePropRowSelection_MultiRow, DataSourcePropRowSelection_SingleRow, DataSourcePropSelectionMode, DataSourcePropSortFn, DataSourcePropSortInfo, DataSourcePropSortTypes, DataSourceProps, DataSourceRawReducer, DataSourceRemoteData, DataSourceRowInfoReducer, DataSourceSetupState, DataSourceSingleSortInfo, DataSourceSortInfo, DataSourceState, DebugLogger, DeepMap, ElementContainerGetter, FixedSizeSet, GroupRowsState, InfiniteColumnEditorContextType, InfiniteTable, InfiniteTableAction, InfiniteTableActionType, InfiniteTableApi, InfiniteTableClassName, InfiniteTableColumn, InfiniteTableColumnAggregator, InfiniteTableColumnApi, InfiniteTableColumnCellContextType, InfiniteTableColumnComparer, InfiniteTableColumnGroup, InfiniteTableColumnRenderFunctionForGroupRows, InfiniteTableColumnRenderFunctionForNormalRows, InfiniteTableColumnRenderValueParam, InfiniteTableColumnRowspanParam, InfiniteTableColumnSizingOptions, InfiniteTableColumnValueFormatterParams, InfiniteTableColumnValueGetterParams, InfiniteTableColumnsMap, InfiniteTableComponent, InfiniteTableComputedColumn, InfiniteTableComputedValues, InfiniteTableContextValue, InfiniteTableGroupColumnBase, InfiniteTableGroupColumnFunction, InfiniteTableGroupColumnGetterOptions, InfiniteTablePivotColumn, InfiniteTablePropAutoSizeColumnsKey, InfiniteTablePropColumnGroups, InfiniteTablePropColumnOrder, InfiniteTablePropColumnPinning, InfiniteTablePropColumnSizing, InfiniteTablePropColumnTypes, InfiniteTablePropColumnVisibility, InfiniteTablePropColumns, InfiniteTablePropComponents, InfiniteTablePropGetCellContextMenuItems, InfiniteTablePropGetColumnMenuItems, InfiniteTablePropGroupColumn, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropHeaderOptions, InfiniteTablePropKeyboardNavigation, InfiniteTablePropMultiSortBehavior, InfiniteTablePropRowClassName, InfiniteTablePropRowStyle, InfiniteTableProps, InfiniteTableRowClassNameFn, InfiniteTableRowInfo, InfiniteTableRowStyleFn, InfiniteTableState, LazyGroupDataDeepMap, LazyGroupDataItem, LazyRowInfoGroup, Menu, MenuChildrenFnParam, MenuColumn, MenuColumnRenderParam, MenuDecoration, MenuIconProps, MenuItemActionContext, MenuItemDefinition, MenuItemObject, MenuProps, MenuRenderable, MenuRuntimeItem, MenuRuntimeItemSelectable, MenuSeparator, OverlayShowParams, RowDetailCache, RowDetailState, RowDetailStateObject, RowSelectionState, Scrollbars, ShowOverlayFn, WeakFixedSizeSet, components, debounce, debug, defaultFilterTypes, defaultFilterTypes as filterTypes, flatten, getComponentStateRoot, group, interceptMap, multisort, useComponentState, useDataSource, useEffectWithChanges, useEffectWithObject, useInfiniteColumnCell, useInfiniteColumnEditor, useInfiniteColumnFilterEditor, useInfiniteHeaderCell, useMasterRowInfo, useOverlay, useOverlayPortal, useRowInfoReducers };
3309
+ export { AdvancedAlignable, CellSelectionState, CellSelectionStateObject, ColumnTypeWithInherit, DataSource, DataSourceAction, DataSourceActionType, DataSourceAggregationReducer, DataSourceApi, DataSourceCRUDParam, DataSourceComponentActions, DataSourceContextValue, DataSourceData, DataSourceDataParams, DataSourceDataParamsChanges, DataSourceDerivedState, DataSourceFilterFunctionParam, DataSourceFilterOperator, DataSourceFilterOperatorFunction, DataSourceFilterOperatorFunctionParam, DataSourceFilterType, DataSourceFilterValueItem, DataSourceFilterValueItemValueGetter, DataSourceGroupBy, DataSourceGroupRowsList, DataSourceInsertParam, DataSourceLivePaginationCursorFn, DataSourceLivePaginationCursorParams, DataSourceLivePaginationCursorValue, DataSourceMappedState, DataSourceMappings, DataSourceMasterDetailContextValue, DataSourcePivotBy, DataSourcePropAggregationReducers, DataSourcePropCellSelection, DataSourcePropCellSelection_MultiCell, DataSourcePropCellSelection_SingleCell, DataSourcePropFilterFunction, DataSourcePropFilterTypes, DataSourcePropFilterValue, DataSourcePropGroupBy, DataSourcePropGroupRowsStateObject, DataSourcePropIsRowSelected, DataSourcePropLivePaginationCursor, DataSourcePropMultiRowSelectionChangeParamType, DataSourcePropOnCellSelectionChange, DataSourcePropOnCellSelectionChange_MultiCell, DataSourcePropOnCellSelectionChange_SingleCell, DataSourcePropOnRowSelectionChange, DataSourcePropOnRowSelectionChange_MultiRow, DataSourcePropOnRowSelectionChange_SingleRow, DataSourcePropPivotBy, DataSourcePropRowInfoReducers, DataSourcePropRowSelection, DataSourcePropRowSelection_MultiRow, DataSourcePropRowSelection_SingleRow, DataSourcePropSelectionMode, DataSourcePropSortFn, DataSourcePropSortInfo, DataSourcePropSortTypes, DataSourceProps, DataSourceRawReducer, DataSourceRemoteData, DataSourceRowInfoReducer, DataSourceSetupState, DataSourceSingleSortInfo, DataSourceSortInfo, DataSourceState, DebugLogger, DeepMap, ElementContainerGetter, FixedSizeSet, GroupRowsState, InfiniteColumnEditorContextType, InfiniteTable, InfiniteTableAction, InfiniteTableActionType, InfiniteTableApi, InfiniteTableClassName, InfiniteTableColumn, InfiniteTableColumnAggregator, InfiniteTableColumnApi, InfiniteTableColumnCellContextType, InfiniteTableColumnComparer, InfiniteTableColumnGroup, InfiniteTableColumnRenderFunctionForGroupRows, InfiniteTableColumnRenderFunctionForNormalRows, InfiniteTableColumnRenderValueParam, InfiniteTableColumnRowspanParam, InfiniteTableColumnSizingOptions, InfiniteTableColumnValueFormatterParams, InfiniteTableColumnValueGetterParams, InfiniteTableColumnsMap, InfiniteTableComponent, InfiniteTableComputedColumn, InfiniteTableComputedValues, InfiniteTableContextValue, InfiniteTableGroupColumnBase, InfiniteTableGroupColumnFunction, InfiniteTableGroupColumnGetterOptions, InfiniteTablePivotColumn, InfiniteTablePropAutoSizeColumnsKey, InfiniteTablePropColumnGroups, InfiniteTablePropColumnOrder, InfiniteTablePropColumnPinning, InfiniteTablePropColumnSizing, InfiniteTablePropColumnTypes, InfiniteTablePropColumnVisibility, InfiniteTablePropColumns, InfiniteTablePropComponents, InfiniteTablePropGetCellContextMenuItems, InfiniteTablePropGetColumnMenuItems, InfiniteTablePropGroupColumn, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropHeaderOptions, InfiniteTablePropKeyboardNavigation, InfiniteTablePropKeyboardShorcut, InfiniteTablePropMultiSortBehavior, InfiniteTablePropRowClassName, InfiniteTablePropRowStyle, InfiniteTableProps, InfiniteTableRowClassNameFn, InfiniteTableRowInfo, InfiniteTableRowStyleFn, InfiniteTableState, LazyGroupDataDeepMap, LazyGroupDataItem, LazyRowInfoGroup, Menu, MenuChildrenFnParam, MenuColumn, MenuColumnRenderParam, MenuDecoration, MenuIconProps, MenuItemActionContext, MenuItemDefinition, MenuItemObject, MenuProps, MenuRenderable, MenuRuntimeItem, MenuRuntimeItemSelectable, MenuSeparator, OverlayShowParams, RowDetailCache, RowDetailState, RowDetailStateObject, RowSelectionState, Scrollbars, ShowOverlayFn, WeakFixedSizeSet, components, debounce, debug, defaultFilterTypes, eventMatchesKeyboardShortcut, defaultFilterTypes as filterTypes, flatten, getComponentStateRoot, group, interceptMap, keyboardShortcuts, multisort, useComponentState, useDataSource, useEffectWithChanges, useEffectWithObject, useInfiniteColumnCell, useInfiniteColumnEditor, useInfiniteColumnFilterEditor, useInfiniteHeaderCell, useMasterRowInfo, useOverlay, useOverlayPortal, useRowInfoReducers };
package/index.dev.js CHANGED
@@ -79,6 +79,15 @@ var __async = (__this, __arguments, generator) => {
79
79
  step((generator = generator.apply(__this, __arguments)).next());
80
80
  });
81
81
  };
82
+ var __forAwait = (obj, it, method) => {
83
+ it = obj[Symbol.asyncIterator];
84
+ method = (key, fn) => (fn = obj[key]) && (it[key] = (arg) => new Promise((resolve, reject, done) => {
85
+ arg = fn.call(obj, arg);
86
+ done = arg.done;
87
+ return Promise.resolve(arg.value).then((value) => resolve({ value, done }), reject);
88
+ }));
89
+ return it ? it.call(obj) : (obj = obj[Symbol.iterator](), it = {}, method("next"), method("return"), it);
90
+ };
82
91
 
83
92
  // ../node_modules/binary-search/index.js
84
93
  var require_binary_search = __commonJS({
@@ -135,11 +144,13 @@ __export(src_exports, {
135
144
  debounce: () => debounce,
136
145
  debug: () => debug,
137
146
  defaultFilterTypes: () => defaultFilterTypes2,
147
+ eventMatchesKeyboardShortcut: () => eventMatchesKeyboardShortcut,
138
148
  filterTypes: () => defaultFilterTypes2,
139
149
  flatten: () => flatten,
140
150
  getComponentStateRoot: () => getComponentStateRoot,
141
151
  group: () => group,
142
152
  interceptMap: () => interceptMap,
153
+ keyboardShortcuts: () => keyboardShortcuts,
143
154
  multisort: () => multisort,
144
155
  useComponentState: () => useComponentState,
145
156
  useDataSource: () => useDataSource,
@@ -15638,6 +15649,10 @@ var InfiniteTableApiImpl = class {
15638
15649
  this.rejectEdit = (reason) => {
15639
15650
  return this.stopEdit({ reject: reason });
15640
15651
  };
15652
+ this.getColumnAtIndex = (index) => {
15653
+ var _a;
15654
+ return (_a = this.getComputed().computedVisibleColumns[index]) != null ? _a : null;
15655
+ };
15641
15656
  this.isCellEditable = (params) => {
15642
15657
  const { rowIndex: index, primaryKey, columnId } = params;
15643
15658
  const rowIndex = index != null ? index : this.context.dataSourceApi.getIndexByPrimaryKey(primaryKey);
@@ -15896,7 +15911,12 @@ var InfiniteTableApiImpl = class {
15896
15911
  }
15897
15912
  startEdit(params) {
15898
15913
  return __async(this, null, function* () {
15899
- const { columnId, rowIndex: index, primaryKey } = params;
15914
+ const {
15915
+ columnId,
15916
+ rowIndex: index,
15917
+ primaryKey,
15918
+ value: valueToSetInitially
15919
+ } = params;
15900
15920
  const rowIndex = index != null ? index : this.context.dataSourceApi.getIndexByPrimaryKey(primaryKey);
15901
15921
  return this.isCellEditable({
15902
15922
  rowIndex,
@@ -15908,7 +15928,7 @@ var InfiniteTableApiImpl = class {
15908
15928
  const columnsMap = this.getComputed().computedColumnsMap;
15909
15929
  const column = columnsMap.get(columnId);
15910
15930
  const rowInfo = dataArray[rowIndex];
15911
- let value = getColumnValueToEdit({
15931
+ let value = valueToSetInitially != null ? valueToSetInitially : getColumnValueToEdit({
15912
15932
  column,
15913
15933
  rowInfo
15914
15934
  // columnsMap,
@@ -17419,6 +17439,7 @@ var forwardProps4 = (setupState) => {
17419
17439
  columnDefaultEditable: 1,
17420
17440
  columnDefaultFilterable: 1,
17421
17441
  columnDefaultSortable: 1,
17442
+ keyboardShortcuts: 1,
17422
17443
  rowStyle: 1,
17423
17444
  cellStyle: 1,
17424
17445
  rowProps: 1,
@@ -18779,7 +18800,7 @@ var useLicense = (licenseKey = "") => {
18779
18800
  }
18780
18801
  let valid2 = isValidLicense(licenseKey, {
18781
18802
  publishedAt: 1624970570587,
18782
- version: "3.3.1"
18803
+ version: "3.3.3"
18783
18804
  });
18784
18805
  if (!licenseKey && !valid2 && isInsidePlayground) {
18785
18806
  return true;
@@ -19551,46 +19572,171 @@ function handleBrowserFocusChangeOnKeyboardNavigation(context, event) {
19551
19572
  return true;
19552
19573
  }
19553
19574
 
19575
+ // src/components/utils/hotkey.ts
19576
+ var KeyModifierAliases = {
19577
+ control: "ctrl"
19578
+ };
19579
+ var CmdOrCtrlAliases = {
19580
+ "control|cmd": "ctrl",
19581
+ "cmd|control": "ctrl",
19582
+ "ctrl|cmd": "ctrl",
19583
+ "cmd|ctrl": "ctrl"
19584
+ };
19585
+ var KeyAliases = {
19586
+ esc: "escape"
19587
+ };
19588
+ var keyModifierChecker = {
19589
+ cmd: (event) => event.metaKey,
19590
+ alt: (event) => event.altKey,
19591
+ ctrl: (event) => event.ctrlKey,
19592
+ shift: (event) => event.shiftKey
19593
+ };
19594
+ var keyModifierNames = Object.keys(keyModifierChecker);
19595
+ var keyModifierSet = new Set(keyModifierNames);
19596
+ var allowedStarModifiers = /* @__PURE__ */ new Set(["shift", "alt"]);
19597
+ function eventMatchesKeyboardShortcut(event, keyDescriptors) {
19598
+ if (!Array.isArray(keyDescriptors)) {
19599
+ return eventMatchesSingleShortcut(event, keyDescriptors);
19600
+ }
19601
+ return keyDescriptors.some(
19602
+ (keyDescriptor) => eventMatchesSingleShortcut(event, keyDescriptor)
19603
+ );
19604
+ }
19605
+ function eventMatchesSingleShortcut(event, keyDescriptor) {
19606
+ const keyLowercase = event.key.toLowerCase();
19607
+ const splitPartsLowercase = keyDescriptor.split("+").map((part) => part.toLowerCase().trim());
19608
+ const hasCmdOrCtrlAlias = splitPartsLowercase.find(
19609
+ (part) => CmdOrCtrlAliases[part]
19610
+ );
19611
+ const parts = splitPartsLowercase.map(
19612
+ (part) => KeyModifierAliases[part] || CmdOrCtrlAliases[part] || KeyAliases[part] || part
19613
+ );
19614
+ const expectedModifiers = parts.filter(
19615
+ (part) => keyModifierSet.has(part)
19616
+ );
19617
+ const nonModifierParts = parts.filter(
19618
+ (part) => !keyModifierSet.has(part)
19619
+ );
19620
+ const currentModifierMatches = keyModifierNames.reduce((acc, modifier) => {
19621
+ acc[modifier] = keyModifierChecker[modifier](event);
19622
+ return acc;
19623
+ }, {});
19624
+ if (hasCmdOrCtrlAlias && currentModifierMatches.cmd) {
19625
+ currentModifierMatches.cmd = false;
19626
+ currentModifierMatches.ctrl = true;
19627
+ }
19628
+ const currentModifierMatchesList = Object.keys(currentModifierMatches).filter(
19629
+ (key) => currentModifierMatches[key]
19630
+ );
19631
+ const hasAllModifiers = expectedModifiers.every(
19632
+ (modifier) => currentModifierMatches[modifier] === true
19633
+ );
19634
+ if (!hasAllModifiers) {
19635
+ return false;
19636
+ }
19637
+ const hasStar = nonModifierParts.includes("*");
19638
+ if (!hasStar) {
19639
+ if (expectedModifiers.length != currentModifierMatchesList.length) {
19640
+ return false;
19641
+ }
19642
+ } else {
19643
+ if (currentModifierMatchesList.length < expectedModifiers.length) {
19644
+ return false;
19645
+ }
19646
+ const nonAllowedModifiers = currentModifierMatchesList.filter(
19647
+ (modifier) => !allowedStarModifiers.has(modifier)
19648
+ );
19649
+ if (nonAllowedModifiers.length) {
19650
+ return false;
19651
+ }
19652
+ }
19653
+ if (!nonModifierParts.length) {
19654
+ return false;
19655
+ }
19656
+ if (keyModifierSet.has(keyLowercase) || keyLowercase === "meta" || KeyModifierAliases[keyLowercase]) {
19657
+ return false;
19658
+ }
19659
+ return nonModifierParts.reduce((acc, part) => {
19660
+ if (!acc) {
19661
+ return false;
19662
+ }
19663
+ const res = part === "*" || keyLowercase === part;
19664
+ return res;
19665
+ }, true);
19666
+ }
19667
+
19554
19668
  // src/components/InfiniteTable/eventHandlers/onKeyDown.ts
19555
19669
  function onKeyDown(context, event) {
19556
- var _a, _b;
19557
- const keyboardHandlerContext = __spreadProps(__spreadValues({}, context), {
19558
- cloneRowSelection: (rowSelection) => {
19559
- return cloneRowSelection(rowSelection, context.getDataSourceState);
19670
+ return __async(this, null, function* () {
19671
+ var _a, _b;
19672
+ const keyboardHandlerContext = __spreadProps(__spreadValues({}, context), {
19673
+ cloneRowSelection: (rowSelection) => {
19674
+ return cloneRowSelection(rowSelection, context.getDataSourceState);
19675
+ }
19676
+ });
19677
+ if (handleKeyboardSelection(keyboardHandlerContext, event)) {
19678
+ event.preventDefault();
19560
19679
  }
19561
- });
19562
- if (handleKeyboardSelection(keyboardHandlerContext, event)) {
19563
- event.preventDefault();
19564
- }
19565
- if (handleBrowserFocusChangeOnKeyboardNavigation(keyboardHandlerContext, event)) {
19566
- event.preventDefault();
19567
- } else {
19568
- if (!context.getState().focusedWithin && handleKeyboardNavigation(keyboardHandlerContext, event)) {
19680
+ if (handleBrowserFocusChangeOnKeyboardNavigation(keyboardHandlerContext, event)) {
19569
19681
  event.preventDefault();
19682
+ } else {
19683
+ if (!context.getState().focusedWithin && handleKeyboardNavigation(keyboardHandlerContext, event)) {
19684
+ event.preventDefault();
19685
+ }
19570
19686
  }
19571
- }
19572
- if (event.key === "Enter") {
19573
- const { activeCellIndex } = context.getState();
19574
- if (activeCellIndex) {
19575
- const [rowIndex, colIndex] = activeCellIndex;
19576
- const column = context.getComputed().computedVisibleColumns[colIndex];
19577
- if (column.computedEditable) {
19578
- context.api.startEdit({
19579
- rowIndex,
19580
- columnId: column.id
19581
- });
19687
+ if (event.key === "Enter" && !context.api.isEditInProgress()) {
19688
+ const { activeCellIndex } = context.getState();
19689
+ if (activeCellIndex) {
19690
+ const [rowIndex, colIndex] = activeCellIndex;
19691
+ const column = context.getComputed().computedVisibleColumns[colIndex];
19692
+ if (column.computedEditable) {
19693
+ context.api.startEdit({
19694
+ rowIndex,
19695
+ columnId: column.id
19696
+ });
19697
+ }
19582
19698
  }
19583
19699
  }
19584
- }
19585
- if (context.api.isEditInProgress()) {
19586
- if (event.key === "Escape") {
19587
- context.api.stopEdit({ cancel: true });
19700
+ if (context.api.isEditInProgress()) {
19701
+ if (event.key === "Escape") {
19702
+ context.api.stopEdit({ cancel: true });
19703
+ }
19704
+ if (event.key === "Tab") {
19705
+ event.preventDefault();
19706
+ }
19588
19707
  }
19589
- if (event.key === "Tab") {
19590
- event.preventDefault();
19708
+ (_b = (_a = context.getState()).onKeyDown) == null ? void 0 : _b.call(_a, context, event);
19709
+ const { keyboardShortcuts: keyboardShortcuts2 } = context.getState();
19710
+ if (keyboardShortcuts2) {
19711
+ try {
19712
+ for (var iter = __forAwait(keyboardShortcuts2), more, temp, error2; more = !(temp = yield iter.next()).done; more = false) {
19713
+ const shortcut = temp.value;
19714
+ if (!eventMatchesKeyboardShortcut(event, shortcut.key)) {
19715
+ continue;
19716
+ }
19717
+ if (shortcut.when) {
19718
+ const result = yield shortcut.when(context);
19719
+ if (!result) {
19720
+ continue;
19721
+ }
19722
+ }
19723
+ const maybeStopNext = yield shortcut.handler(context, event);
19724
+ if (maybeStopNext && maybeStopNext.stopNext) {
19725
+ break;
19726
+ }
19727
+ }
19728
+ } catch (temp) {
19729
+ error2 = [temp];
19730
+ } finally {
19731
+ try {
19732
+ more && (temp = iter.return) && (yield temp.call(iter));
19733
+ } finally {
19734
+ if (error2)
19735
+ throw error2[0];
19736
+ }
19737
+ }
19591
19738
  }
19592
- }
19593
- (_b = (_a = context.getState()).onKeyDown) == null ? void 0 : _b.call(_a, context, event);
19739
+ });
19594
19740
  }
19595
19741
 
19596
19742
  // src/components/InfiniteTable/eventHandlers/index.ts
@@ -22523,6 +22669,50 @@ var InfiniteTable = function(props) {
22523
22669
  return table;
22524
22670
  };
22525
22671
 
22672
+ // src/components/InfiniteTable/eventHandlers/keyboardShortcuts.ts
22673
+ var instantEdit = {
22674
+ key: "*",
22675
+ when: (context) => {
22676
+ const { activeCellIndex } = context.getState();
22677
+ if (activeCellIndex) {
22678
+ const [rowIndex, colIndex] = activeCellIndex;
22679
+ const column = context.api.getColumnAtIndex(colIndex);
22680
+ if (!column) {
22681
+ return false;
22682
+ }
22683
+ return context.api.isCellEditable({
22684
+ rowIndex,
22685
+ columnId: column.id
22686
+ });
22687
+ }
22688
+ return false;
22689
+ },
22690
+ handler: (context, event) => {
22691
+ const { key } = event;
22692
+ if (key != "Escape" && key.length === 1) {
22693
+ const { activeCellIndex } = context.getState();
22694
+ if (activeCellIndex) {
22695
+ const [rowIndex, colIndex] = activeCellIndex;
22696
+ const column = context.api.getColumnAtIndex(colIndex);
22697
+ if (!column) {
22698
+ return;
22699
+ }
22700
+ requestAnimationFrame(() => {
22701
+ context.api.startEdit({
22702
+ rowIndex,
22703
+ // value: '',
22704
+ value: key,
22705
+ columnId: column.id
22706
+ });
22707
+ });
22708
+ }
22709
+ }
22710
+ }
22711
+ };
22712
+ var keyboardShortcuts = {
22713
+ instantEdit
22714
+ };
22715
+
22526
22716
  // src/utils/FixedSizeSet.ts
22527
22717
  var _FixedSizeSet = class {
22528
22718
  constructor(clone, size) {
@@ -22670,11 +22860,13 @@ var components = {
22670
22860
  debounce,
22671
22861
  debug,
22672
22862
  defaultFilterTypes,
22863
+ eventMatchesKeyboardShortcut,
22673
22864
  filterTypes,
22674
22865
  flatten,
22675
22866
  getComponentStateRoot,
22676
22867
  group,
22677
22868
  interceptMap,
22869
+ keyboardShortcuts,
22678
22870
  multisort,
22679
22871
  useComponentState,
22680
22872
  useDataSource,