@infinite-table/infinite-react 3.3.0 → 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.css +1 -1
- package/index.d.ts +29 -3
- package/index.dev.js +197 -35
- package/index.dev.mjs +195 -35
- package/index.js +2 -2
- package/index.mjs +2 -2
- package/package.json +2 -2
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,
|
|
@@ -1415,7 +1426,7 @@ var internalProps = {
|
|
|
1415
1426
|
};
|
|
1416
1427
|
|
|
1417
1428
|
// src/components/InfiniteTable/vars.css.ts
|
|
1418
|
-
var ThemeVars = { color: { accent: "var(--infinite-accent-color)", error: "var(--infinite-error-color)", color: "var(--infinite-color)" }, spacing: { "0": "var(--infinite-space-0)", "1": "var(--infinite-space-1)", "2": "var(--infinite-space-2)", "3": "var(--infinite-space-3)", "4": "var(--infinite-space-4)", "5": "var(--infinite-space-5)", "6": "var(--infinite-space-6)", "7": "var(--infinite-space-7)", "8": "var(--infinite-space-8)", "9": "var(--infinite-space-9)", "10": "var(--infinite-space-10)" }, fontSize: { "0": "var(--infinite-font-size-0)", "1": "var(--infinite-font-size-1)", "2": "var(--infinite-font-size-2)", "3": "var(--infinite-font-size-3)", "4": "var(--infinite-font-size-4)", "5": "var(--infinite-font-size-5)", "6": "var(--infinite-font-size-6)", "7": "var(--infinite-font-size-7)" }, fontFamily: "var(--infinite-font-family)", minHeight: "var(--infinite-min-height)", borderRadius: "var(--infinite-border-radius)", background: "var(--infinite-background)", iconSize: "var(--infinite-icon-size)", components: { LoadMask: { padding: "var(--infinite-load-mask-padding)", color: "var(--infinite-load-mask-color)", textBackground: "var(--infinite-load-mask-text-background)", overlayBackground: "var(--infinite-load-mask-overlay-background)", overlayOpacity: "var(--infinite-load-mask-overlay-opacity)", borderRadius: "var(--infinite-load-mask-border-radius)" }, Header: { background: "var(--infinite-header-background)", color: "var(--infinite-header-color)", columnHeaderHeight: "var(--infinite-column-header-height)" }, HeaderCell: { background: "var(--infinite-header-cell-background)", hoverBackground: "var(--infinite-header-cell-hover-background)", border: "var(--infinite-header-cell-border)", padding: "var(--infinite-header-cell-padding)", paddingX: "var(--infinite-header-cell-padding-x)", paddingY: "var(--infinite-header-cell-padding-y)", iconSize: "var(--infinite-header-cell-icon-size)", menuIconLineWidth: "var(--infinite-header-cell-menu-icon-line-width)", sortIconMargin: "var(--infinite-header-cell-sort-icon-margin)", borderRight: "var(--infinite-header-cell-border-right)", resizeHandleActiveAreaWidth: "var(--infinite-resize-handle-active-area-width)", resizeHandleWidth: "var(--infinite-resize-handle-width)", resizeHandleHoverBackground: "var(--infinite-resize-handle-hover-background)", resizeHandleConstrainedHoverBackground: "var(--infinite-resize-handle-constrained-hover-background)", filterOperatorPaddingX: "var(--infinite-filter-operator-padding-x)", filterEditorPaddingX: "var(--infinite-filter-editor-padding-x)", filterEditorMarginX: "var(--infinite-filter-editor-margin-x)", filterOperatorPaddingY: "var(--infinite-filter-operator-padding-y)", filterEditorPaddingY: "var(--infinite-filter-editor-padding-y)", filterEditorMarginY: "var(--infinite-filter-editor-margin-y)", filterEditorBackground: "var(--infinite-filter-editor-background)", filterEditorBorder: "var(--infinite-filter-editor-border)", filterEditorFocusBorderColor: "var(--infinite-filter-editor-focus-border-color)", filterEditorBorderRadius: "var(--infinite-filter-editor-border-radius)", filterEditorColor: "var(--infinite-filter-editor-color)" }, Cell: { padding: "var(--infinite-cell-padding)", borderWidth: "var(--infinite-cell-border-width)", border: "var(--infinite-cell-border)", borderLeft: "var(--infinite-cell-border-left)", borderRight: "var(--infinite-cell-border-right)", borderTop: "var(--infinite-cell-border-top)", borderInvisible: "var(--infinite-cell-border-invisible)", borderRadius: "var(--infinite-cell-border-radius)", reorderEffectDuration: "var(--infinite-column-reorder-effect-duration)", pinnedBorder: "var(--infinite-pinned-cell-border)", color: "var(--infinite-cell-color)", selectedBackground: "var(--infinite-selected-cell-background)", selectedBackgroundDefault: "var(--infinite-selected-cell-background-default)", selectedBackgroundAlpha: "var(--infinite-selected-cell-background-alpha)", selectedBackgroundAlphaWhenTableUnfocused: "var(--infinite-selected-cell-background-alpha--table-unfocused)", selectedBorderColor: "var(--infinite-selected-cell-border-color)", selectedBorderWidth: "var(--infinite-selected-cell-border-width)", selectedBorderStyle: "var(--infinite-selected-cell-border-style)", selectedBorder: "var(--infinite-selected-cell-border)", activeBackgroundAlpha: "var(--infinite-active-cell-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-cell-background-alpha--table-unfocused)", activeBackground: "var(--infinite-active-cell-background)", activeBackgroundDefault: "var(--infinite-active-cell-background-default)", activeBorderColor: "var(--infinite-active-cell-border-color)", activeBorderWidth: "var(--infinite-active-cell-border-width)", activeBorderStyle: "var(--infinite-active-cell-border-style)", activeBorder: "var(--infinite-active-cell-border)" }, SelectionCheckBox: { marginInline: "var(--infinite-selection-checkbox-margin-inline)" }, Menu: { background: "var(--infinite-menu-background)", color: "var(--infinite-menu-color)", padding: "var(--infinite-menu-padding)", cellPaddingVertical: "var(--infinite-menu-cell-padding-vertical)", cellPaddingHorizontal: "var(--infinite-menu-cell-padding-horizontal)", cellMarginVertical: "var(--infinite-menu-cell-margin-vertical)", itemDisabledBackground: "var(--infinite-menu-item-disabled-background)", itemActiveBackground: "var(--infinite-menu-item-active-background)", itemActiveOpacity: "var(--infinite-menu-item-active-opacity)", itemPressedOpacity: "var(--infinite-menu-item-pressed-opacity)", itemPressedBackground: "var(--infinite-menu-item-pressed-background)", itemDisabledOpacity: "var(--infinite-menu-item-disabled-opacity)", borderRadius: "var(--infinite-menu-border-radius)", shadowColor: "var(--infinite-menu-shadow-color)" }, RowDetail: { background: "var(--infinite-rowdetail-background)", padding: "var(--infinite-rowdetail-padding)", gridHeight: "var(--infinite-rowdetail-grid-height)" }, Row: { background: "var(--infinite-row-background)", oddBackground: "var(--infinite-row-odd-background)", selectedBackground: "var(--infinite-row-selected-background)", activeBackground: "var(--infinite-active-row-background)", activeBorderColor: "var(--infinite-active-row-border-color)", activeBorderWidth: "var(--infinite-active-row-border-width)", activeBorderStyle: "var(--infinite-active-row-border-style)", activeBorder: "var(--infinite-active-row-border)", activeBackgroundAlpha: "var(--infinite-active-row-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-row-background-alpha--table-unfocused)", hoverBackground: "var(--infinite-row-hover-background)", selectedHoverBackground: "var(--infinite-row-selected-hover-background)", groupRowBackground: "var(--infinite-group-row-background)", groupRowColumnNesting: "var(--infinite-group-row-column-nesting)", groupNesting: "var(--infinite-dont-override-group-row-nesting-length)", pointerEventsWhileScrolling: "var(--infinite-row-pointer-events-while-scrolling)" }, ColumnCell: { background: "var(--infinite-column-cell-bg-dont-override)" } } };
|
|
1429
|
+
var ThemeVars = { color: { accent: "var(--infinite-accent-color)", error: "var(--infinite-error-color)", color: "var(--infinite-color)" }, spacing: { "0": "var(--infinite-space-0)", "1": "var(--infinite-space-1)", "2": "var(--infinite-space-2)", "3": "var(--infinite-space-3)", "4": "var(--infinite-space-4)", "5": "var(--infinite-space-5)", "6": "var(--infinite-space-6)", "7": "var(--infinite-space-7)", "8": "var(--infinite-space-8)", "9": "var(--infinite-space-9)", "10": "var(--infinite-space-10)" }, fontSize: { "0": "var(--infinite-font-size-0)", "1": "var(--infinite-font-size-1)", "2": "var(--infinite-font-size-2)", "3": "var(--infinite-font-size-3)", "4": "var(--infinite-font-size-4)", "5": "var(--infinite-font-size-5)", "6": "var(--infinite-font-size-6)", "7": "var(--infinite-font-size-7)" }, fontFamily: "var(--infinite-font-family)", minHeight: "var(--infinite-min-height)", borderRadius: "var(--infinite-border-radius)", background: "var(--infinite-background)", iconSize: "var(--infinite-icon-size)", components: { LoadMask: { padding: "var(--infinite-load-mask-padding)", color: "var(--infinite-load-mask-color)", textBackground: "var(--infinite-load-mask-text-background)", overlayBackground: "var(--infinite-load-mask-overlay-background)", overlayOpacity: "var(--infinite-load-mask-overlay-opacity)", borderRadius: "var(--infinite-load-mask-border-radius)" }, Header: { background: "var(--infinite-header-background)", color: "var(--infinite-header-color)", columnHeaderHeight: "var(--infinite-column-header-height)" }, HeaderCell: { background: "var(--infinite-header-cell-background)", hoverBackground: "var(--infinite-header-cell-hover-background)", border: "var(--infinite-header-cell-border)", padding: "var(--infinite-header-cell-padding)", paddingX: "var(--infinite-header-cell-padding-x)", paddingY: "var(--infinite-header-cell-padding-y)", iconSize: "var(--infinite-header-cell-icon-size)", menuIconLineWidth: "var(--infinite-header-cell-menu-icon-line-width)", sortIconMargin: "var(--infinite-header-cell-sort-icon-margin)", borderRight: "var(--infinite-header-cell-border-right)", resizeHandleActiveAreaWidth: "var(--infinite-resize-handle-active-area-width)", resizeHandleWidth: "var(--infinite-resize-handle-width)", resizeHandleHoverBackground: "var(--infinite-resize-handle-hover-background)", resizeHandleConstrainedHoverBackground: "var(--infinite-resize-handle-constrained-hover-background)", filterOperatorPaddingX: "var(--infinite-filter-operator-padding-x)", filterEditorPaddingX: "var(--infinite-filter-editor-padding-x)", filterEditorMarginX: "var(--infinite-filter-editor-margin-x)", filterOperatorPaddingY: "var(--infinite-filter-operator-padding-y)", filterEditorPaddingY: "var(--infinite-filter-editor-padding-y)", filterEditorMarginY: "var(--infinite-filter-editor-margin-y)", filterEditorBackground: "var(--infinite-filter-editor-background)", filterEditorBorder: "var(--infinite-filter-editor-border)", filterEditorFocusBorderColor: "var(--infinite-filter-editor-focus-border-color)", filterEditorBorderRadius: "var(--infinite-filter-editor-border-radius)", filterEditorColor: "var(--infinite-filter-editor-color)" }, Cell: { padding: "var(--infinite-cell-padding)", borderWidth: "var(--infinite-cell-border-width)", border: "var(--infinite-cell-border)", borderLeft: "var(--infinite-cell-border-left)", borderRight: "var(--infinite-cell-border-right)", borderTop: "var(--infinite-cell-border-top)", borderInvisible: "var(--infinite-cell-border-invisible)", borderRadius: "var(--infinite-cell-border-radius)", reorderEffectDuration: "var(--infinite-column-reorder-effect-duration)", pinnedBorder: "var(--infinite-pinned-cell-border)", color: "var(--infinite-cell-color)", selectedBackground: "var(--infinite-selected-cell-background)", selectedBackgroundDefault: "var(--infinite-selected-cell-background-default)", selectedBackgroundAlpha: "var(--infinite-selected-cell-background-alpha)", selectedBackgroundAlphaWhenTableUnfocused: "var(--infinite-selected-cell-background-alpha--table-unfocused)", selectedBorderColor: "var(--infinite-selected-cell-border-color)", selectedBorderWidth: "var(--infinite-selected-cell-border-width)", selectedBorderStyle: "var(--infinite-selected-cell-border-style)", selectedBorder: "var(--infinite-selected-cell-border)", activeBackgroundAlpha: "var(--infinite-active-cell-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-cell-background-alpha--table-unfocused)", activeBackground: "var(--infinite-active-cell-background)", activeBackgroundDefault: "var(--infinite-active-cell-background-default)", activeBorderColor: "var(--infinite-active-cell-border-color)", activeBorderWidth: "var(--infinite-active-cell-border-width)", activeBorderStyle: "var(--infinite-active-cell-border-style)", activeBorder: "var(--infinite-active-cell-border)" }, SelectionCheckBox: { marginInline: "var(--infinite-selection-checkbox-margin-inline)" }, Menu: { background: "var(--infinite-menu-background)", color: "var(--infinite-menu-color)", separatorColor: "var(--infinite-menu-separator-color)", padding: "var(--infinite-menu-padding)", cellPaddingVertical: "var(--infinite-menu-cell-padding-vertical)", cellPaddingHorizontal: "var(--infinite-menu-cell-padding-horizontal)", cellMarginVertical: "var(--infinite-menu-cell-margin-vertical)", itemDisabledBackground: "var(--infinite-menu-item-disabled-background)", itemActiveBackground: "var(--infinite-menu-item-active-background)", itemActiveOpacity: "var(--infinite-menu-item-active-opacity)", itemPressedOpacity: "var(--infinite-menu-item-pressed-opacity)", itemPressedBackground: "var(--infinite-menu-item-pressed-background)", itemDisabledOpacity: "var(--infinite-menu-item-disabled-opacity)", borderRadius: "var(--infinite-menu-border-radius)", shadowColor: "var(--infinite-menu-shadow-color)" }, RowDetail: { background: "var(--infinite-rowdetail-background)", padding: "var(--infinite-rowdetail-padding)", gridHeight: "var(--infinite-rowdetail-grid-height)" }, Row: { background: "var(--infinite-row-background)", oddBackground: "var(--infinite-row-odd-background)", selectedBackground: "var(--infinite-row-selected-background)", activeBackground: "var(--infinite-active-row-background)", activeBorderColor: "var(--infinite-active-row-border-color)", activeBorderWidth: "var(--infinite-active-row-border-width)", activeBorderStyle: "var(--infinite-active-row-border-style)", activeBorder: "var(--infinite-active-row-border)", activeBackgroundAlpha: "var(--infinite-active-row-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-row-background-alpha--table-unfocused)", hoverBackground: "var(--infinite-row-hover-background)", selectedHoverBackground: "var(--infinite-row-selected-hover-background)", groupRowBackground: "var(--infinite-group-row-background)", groupRowColumnNesting: "var(--infinite-group-row-column-nesting)", groupNesting: "var(--infinite-dont-override-group-row-nesting-length)", pointerEventsWhileScrolling: "var(--infinite-row-pointer-events-while-scrolling)" }, ColumnCell: { background: "var(--infinite-column-cell-bg-dont-override)" } } };
|
|
1419
1430
|
var columnHeaderHeightName = "column-header-height";
|
|
1420
1431
|
|
|
1421
1432
|
// src/components/InfiniteTable/utils/infiniteDOMUtils.ts
|
|
@@ -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,
|