@infinite-table/infinite-react 3.3.1 → 3.3.2
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 +29 -3
- package/index.dev.js +196 -34
- package/index.dev.mjs +194 -34
- package/index.js +2 -2
- package/index.mjs +2 -2
- package/package.json +2 -2
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,
|
|
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
|
-
|
|
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 {
|
|
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.
|
|
18803
|
+
version: "3.3.2"
|
|
18783
18804
|
});
|
|
18784
18805
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
18785
18806
|
return true;
|
|
@@ -19551,46 +19572,141 @@ 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 KeyAliases = {
|
|
19580
|
+
esc: "escape"
|
|
19581
|
+
};
|
|
19582
|
+
var keyModifierChecker = {
|
|
19583
|
+
cmd: (event) => event.metaKey,
|
|
19584
|
+
alt: (event) => event.altKey,
|
|
19585
|
+
ctrl: (event) => event.ctrlKey,
|
|
19586
|
+
shift: (event) => event.shiftKey
|
|
19587
|
+
};
|
|
19588
|
+
var keyModifierNames = Object.keys(keyModifierChecker);
|
|
19589
|
+
var keyModifierSet = new Set(keyModifierNames);
|
|
19590
|
+
function eventMatchesKeyboardShortcut(event, keyDescriptors) {
|
|
19591
|
+
if (!Array.isArray(keyDescriptors)) {
|
|
19592
|
+
return eventMatchesSingleShortcut(event, keyDescriptors);
|
|
19593
|
+
}
|
|
19594
|
+
return keyDescriptors.some(
|
|
19595
|
+
(keyDescriptor) => eventMatchesSingleShortcut(event, keyDescriptor)
|
|
19596
|
+
);
|
|
19597
|
+
}
|
|
19598
|
+
function eventMatchesSingleShortcut(event, keyDescriptor) {
|
|
19599
|
+
const keyLowercase = event.key.toLowerCase();
|
|
19600
|
+
const parts = keyDescriptor.split("+").map((part) => part.toLowerCase().trim()).map((part) => KeyModifierAliases[part] || KeyAliases[part] || part);
|
|
19601
|
+
const expectedModifiers = parts.filter(
|
|
19602
|
+
(part) => keyModifierSet.has(part)
|
|
19603
|
+
);
|
|
19604
|
+
const nonModifierParts = parts.filter(
|
|
19605
|
+
(part) => !keyModifierSet.has(part)
|
|
19606
|
+
);
|
|
19607
|
+
const currentModifierMatches = keyModifierNames.reduce((acc, modifier) => {
|
|
19608
|
+
acc[modifier] = keyModifierChecker[modifier](event);
|
|
19609
|
+
return acc;
|
|
19610
|
+
}, {});
|
|
19611
|
+
const currentModifierMatchesList = Object.keys(currentModifierMatches).filter(
|
|
19612
|
+
(key) => currentModifierMatches[key]
|
|
19613
|
+
);
|
|
19614
|
+
const hasAllModifiers = expectedModifiers.every(
|
|
19615
|
+
(modifier) => currentModifierMatches[modifier] === true
|
|
19616
|
+
);
|
|
19617
|
+
if (!hasAllModifiers) {
|
|
19618
|
+
return false;
|
|
19619
|
+
}
|
|
19620
|
+
if (expectedModifiers.length != currentModifierMatchesList.length) {
|
|
19621
|
+
return false;
|
|
19622
|
+
}
|
|
19623
|
+
if (!nonModifierParts.length) {
|
|
19624
|
+
return false;
|
|
19625
|
+
}
|
|
19626
|
+
if (keyModifierSet.has(keyLowercase)) {
|
|
19627
|
+
return false;
|
|
19628
|
+
}
|
|
19629
|
+
return nonModifierParts.reduce((acc, part) => {
|
|
19630
|
+
if (!acc) {
|
|
19631
|
+
return false;
|
|
19632
|
+
}
|
|
19633
|
+
const res = part === "*" || keyLowercase === part;
|
|
19634
|
+
return res;
|
|
19635
|
+
}, true);
|
|
19636
|
+
}
|
|
19637
|
+
|
|
19554
19638
|
// src/components/InfiniteTable/eventHandlers/onKeyDown.ts
|
|
19555
19639
|
function onKeyDown(context, event) {
|
|
19556
|
-
|
|
19557
|
-
|
|
19558
|
-
|
|
19559
|
-
|
|
19640
|
+
return __async(this, null, function* () {
|
|
19641
|
+
var _a, _b;
|
|
19642
|
+
const keyboardHandlerContext = __spreadProps(__spreadValues({}, context), {
|
|
19643
|
+
cloneRowSelection: (rowSelection) => {
|
|
19644
|
+
return cloneRowSelection(rowSelection, context.getDataSourceState);
|
|
19645
|
+
}
|
|
19646
|
+
});
|
|
19647
|
+
if (handleKeyboardSelection(keyboardHandlerContext, event)) {
|
|
19648
|
+
event.preventDefault();
|
|
19560
19649
|
}
|
|
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)) {
|
|
19650
|
+
if (handleBrowserFocusChangeOnKeyboardNavigation(keyboardHandlerContext, event)) {
|
|
19569
19651
|
event.preventDefault();
|
|
19652
|
+
} else {
|
|
19653
|
+
if (!context.getState().focusedWithin && handleKeyboardNavigation(keyboardHandlerContext, event)) {
|
|
19654
|
+
event.preventDefault();
|
|
19655
|
+
}
|
|
19570
19656
|
}
|
|
19571
|
-
|
|
19572
|
-
|
|
19573
|
-
|
|
19574
|
-
|
|
19575
|
-
|
|
19576
|
-
|
|
19577
|
-
|
|
19578
|
-
|
|
19579
|
-
|
|
19580
|
-
|
|
19581
|
-
}
|
|
19657
|
+
if (event.key === "Enter" && !context.api.isEditInProgress()) {
|
|
19658
|
+
const { activeCellIndex } = context.getState();
|
|
19659
|
+
if (activeCellIndex) {
|
|
19660
|
+
const [rowIndex, colIndex] = activeCellIndex;
|
|
19661
|
+
const column = context.getComputed().computedVisibleColumns[colIndex];
|
|
19662
|
+
if (column.computedEditable) {
|
|
19663
|
+
context.api.startEdit({
|
|
19664
|
+
rowIndex,
|
|
19665
|
+
columnId: column.id
|
|
19666
|
+
});
|
|
19667
|
+
}
|
|
19582
19668
|
}
|
|
19583
19669
|
}
|
|
19584
|
-
|
|
19585
|
-
|
|
19586
|
-
|
|
19587
|
-
|
|
19670
|
+
if (context.api.isEditInProgress()) {
|
|
19671
|
+
if (event.key === "Escape") {
|
|
19672
|
+
context.api.stopEdit({ cancel: true });
|
|
19673
|
+
}
|
|
19674
|
+
if (event.key === "Tab") {
|
|
19675
|
+
event.preventDefault();
|
|
19676
|
+
}
|
|
19588
19677
|
}
|
|
19589
|
-
|
|
19590
|
-
|
|
19678
|
+
(_b = (_a = context.getState()).onKeyDown) == null ? void 0 : _b.call(_a, context, event);
|
|
19679
|
+
const { keyboardShortcuts: keyboardShortcuts2 } = context.getState();
|
|
19680
|
+
if (keyboardShortcuts2) {
|
|
19681
|
+
try {
|
|
19682
|
+
for (var iter = __forAwait(keyboardShortcuts2), more, temp, error2; more = !(temp = yield iter.next()).done; more = false) {
|
|
19683
|
+
const shortcut = temp.value;
|
|
19684
|
+
if (!eventMatchesKeyboardShortcut(event, shortcut.key)) {
|
|
19685
|
+
continue;
|
|
19686
|
+
}
|
|
19687
|
+
if (shortcut.when) {
|
|
19688
|
+
const result = yield shortcut.when(context);
|
|
19689
|
+
if (!result) {
|
|
19690
|
+
continue;
|
|
19691
|
+
}
|
|
19692
|
+
}
|
|
19693
|
+
const maybeStopNext = yield shortcut.handler(context, event);
|
|
19694
|
+
if (maybeStopNext && maybeStopNext.stopNext) {
|
|
19695
|
+
break;
|
|
19696
|
+
}
|
|
19697
|
+
}
|
|
19698
|
+
} catch (temp) {
|
|
19699
|
+
error2 = [temp];
|
|
19700
|
+
} finally {
|
|
19701
|
+
try {
|
|
19702
|
+
more && (temp = iter.return) && (yield temp.call(iter));
|
|
19703
|
+
} finally {
|
|
19704
|
+
if (error2)
|
|
19705
|
+
throw error2[0];
|
|
19706
|
+
}
|
|
19707
|
+
}
|
|
19591
19708
|
}
|
|
19592
|
-
}
|
|
19593
|
-
(_b = (_a = context.getState()).onKeyDown) == null ? void 0 : _b.call(_a, context, event);
|
|
19709
|
+
});
|
|
19594
19710
|
}
|
|
19595
19711
|
|
|
19596
19712
|
// src/components/InfiniteTable/eventHandlers/index.ts
|
|
@@ -22523,6 +22639,50 @@ var InfiniteTable = function(props) {
|
|
|
22523
22639
|
return table;
|
|
22524
22640
|
};
|
|
22525
22641
|
|
|
22642
|
+
// src/components/InfiniteTable/eventHandlers/keyboardShortcuts.ts
|
|
22643
|
+
var instantEdit = {
|
|
22644
|
+
key: "*",
|
|
22645
|
+
when: (context) => {
|
|
22646
|
+
const { activeCellIndex } = context.getState();
|
|
22647
|
+
if (activeCellIndex) {
|
|
22648
|
+
const [rowIndex, colIndex] = activeCellIndex;
|
|
22649
|
+
const column = context.api.getColumnAtIndex(colIndex);
|
|
22650
|
+
if (!column) {
|
|
22651
|
+
return false;
|
|
22652
|
+
}
|
|
22653
|
+
return context.api.isCellEditable({
|
|
22654
|
+
rowIndex,
|
|
22655
|
+
columnId: column.id
|
|
22656
|
+
});
|
|
22657
|
+
}
|
|
22658
|
+
return false;
|
|
22659
|
+
},
|
|
22660
|
+
handler: (context, event) => {
|
|
22661
|
+
const { key } = event;
|
|
22662
|
+
if (key != "Escape" && key.length === 1) {
|
|
22663
|
+
const { activeCellIndex } = context.getState();
|
|
22664
|
+
if (activeCellIndex) {
|
|
22665
|
+
const [rowIndex, colIndex] = activeCellIndex;
|
|
22666
|
+
const column = context.api.getColumnAtIndex(colIndex);
|
|
22667
|
+
if (!column) {
|
|
22668
|
+
return;
|
|
22669
|
+
}
|
|
22670
|
+
requestAnimationFrame(() => {
|
|
22671
|
+
context.api.startEdit({
|
|
22672
|
+
rowIndex,
|
|
22673
|
+
// value: '',
|
|
22674
|
+
value: key,
|
|
22675
|
+
columnId: column.id
|
|
22676
|
+
});
|
|
22677
|
+
});
|
|
22678
|
+
}
|
|
22679
|
+
}
|
|
22680
|
+
}
|
|
22681
|
+
};
|
|
22682
|
+
var keyboardShortcuts = {
|
|
22683
|
+
instantEdit
|
|
22684
|
+
};
|
|
22685
|
+
|
|
22526
22686
|
// src/utils/FixedSizeSet.ts
|
|
22527
22687
|
var _FixedSizeSet = class {
|
|
22528
22688
|
constructor(clone, size) {
|
|
@@ -22670,11 +22830,13 @@ var components = {
|
|
|
22670
22830
|
debounce,
|
|
22671
22831
|
debug,
|
|
22672
22832
|
defaultFilterTypes,
|
|
22833
|
+
eventMatchesKeyboardShortcut,
|
|
22673
22834
|
filterTypes,
|
|
22674
22835
|
flatten,
|
|
22675
22836
|
getComponentStateRoot,
|
|
22676
22837
|
group,
|
|
22677
22838
|
interceptMap,
|
|
22839
|
+
keyboardShortcuts,
|
|
22678
22840
|
multisort,
|
|
22679
22841
|
useComponentState,
|
|
22680
22842
|
useDataSource,
|