@revolist/revogrid 4.8.1 → 4.8.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/dist/cjs/base.plugin-75fc9e81.js.map +1 -1
- package/dist/cjs/{column.service-b3b5a4ee.js → column.service-43f8c476.js} +2 -2
- package/dist/cjs/{column.service-b3b5a4ee.js.map → column.service-43f8c476.js.map} +1 -1
- package/dist/cjs/{filter.button-147884a8.js → filter.button-35f508a0.js} +3 -3
- package/dist/cjs/filter.button-35f508a0.js.map +1 -0
- package/dist/cjs/{header-cell-renderer-96a37624.js → header-cell-renderer-a3b43bca.js} +2 -2
- package/dist/cjs/{header-cell-renderer-96a37624.js.map → header-cell-renderer-a3b43bca.js.map} +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/{key.utils-be4d0b46.js → key.utils-4a384064.js} +17 -12
- package/dist/cjs/key.utils-4a384064.js.map +1 -0
- package/dist/cjs/revo-grid.cjs.entry.js +14 -9
- package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-attribution_6.cjs.entry.js +41 -12
- package/dist/cjs/revogr-attribution_6.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js +5 -3
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-data_4.cjs.entry.js +10 -9
- package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +13 -8
- package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -1
- package/dist/cjs/{selection.helpers-032d7192.js → selection.helpers-26d856ba.js} +67 -20
- package/dist/cjs/selection.helpers-26d856ba.js.map +1 -0
- package/dist/collection/components/clipboard/revogr-clipboard.js +1 -0
- package/dist/collection/components/clipboard/revogr-clipboard.js.map +1 -1
- package/dist/collection/components/data/revogr-data.js +1 -1
- package/dist/collection/components/data/revogr-data.js.map +1 -1
- package/dist/collection/components/editors/text-editor.js +4 -3
- package/dist/collection/components/editors/text-editor.js.map +1 -1
- package/dist/collection/components/header/header-renderer.js +2 -2
- package/dist/collection/components/header/header-renderer.js.map +1 -1
- package/dist/collection/components/overlay/keyboard.service.js +15 -5
- package/dist/collection/components/overlay/keyboard.service.js.map +1 -1
- package/dist/collection/components/overlay/revogr-overlay-selection.js +44 -5
- package/dist/collection/components/overlay/revogr-overlay-selection.js.map +1 -1
- package/dist/collection/components/revoGrid/revo-grid.js +3 -3
- package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
- package/dist/collection/plugins/base.plugin.js.map +1 -1
- package/dist/collection/plugins/column.auto-size.plugin.js.map +1 -1
- package/dist/collection/plugins/column.stretch.plugin.js.map +1 -1
- package/dist/collection/plugins/filter/filter.button.js +2 -2
- package/dist/collection/plugins/filter/filter.button.js.map +1 -1
- package/dist/collection/plugins/filter/filter.plugin.js +7 -2
- package/dist/collection/plugins/filter/filter.plugin.js.map +1 -1
- package/dist/collection/plugins/filter/filter.pop.js +13 -8
- package/dist/collection/plugins/filter/filter.pop.js.map +1 -1
- package/dist/collection/plugins/groupingRow/grouping.row.plugin.js.map +1 -1
- package/dist/collection/plugins/moveColumn/column.drag.plugin.js.map +1 -1
- package/dist/collection/plugins/sorting/sorting.plugin.js.map +1 -1
- package/dist/collection/plugins/sorting/sorting.sign.js +2 -1
- package/dist/collection/plugins/sorting/sorting.sign.js.map +1 -1
- package/dist/collection/services/selection.store.connector.js +62 -19
- package/dist/collection/services/selection.store.connector.js.map +1 -1
- package/dist/collection/store/selection/selection.store.js +4 -0
- package/dist/collection/store/selection/selection.store.js.map +1 -1
- package/dist/collection/types/interfaces.js.map +1 -1
- package/dist/collection/types/plugin.js.map +1 -1
- package/dist/collection/types/plugin.types.js.map +1 -1
- package/dist/collection/types/selection.js.map +1 -1
- package/dist/collection/utils/key.codes.js +6 -2
- package/dist/collection/utils/key.codes.js.map +1 -1
- package/dist/collection/utils/key.utils.js +25 -13
- package/dist/collection/utils/key.utils.js.map +1 -1
- package/dist/esm/base.plugin-e6e2bac2.js.map +1 -1
- package/dist/esm/{column.service-ffe99cfc.js → column.service-6aab6fac.js} +2 -2
- package/dist/esm/{column.service-ffe99cfc.js.map → column.service-6aab6fac.js.map} +1 -1
- package/dist/esm/{filter.button-f132c10a.js → filter.button-f9883a78.js} +3 -3
- package/dist/esm/filter.button-f9883a78.js.map +1 -0
- package/dist/esm/{header-cell-renderer-cac333a3.js → header-cell-renderer-b8663a21.js} +2 -2
- package/dist/esm/{header-cell-renderer-cac333a3.js.map → header-cell-renderer-b8663a21.js.map} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/{key.utils-9120fde7.js → key.utils-c4a27968.js} +17 -12
- package/dist/esm/key.utils-c4a27968.js.map +1 -0
- package/dist/esm/revo-grid.entry.js +14 -9
- package/dist/esm/revo-grid.entry.js.map +1 -1
- package/dist/esm/revogr-attribution_6.entry.js +41 -12
- package/dist/esm/revogr-attribution_6.entry.js.map +1 -1
- package/dist/esm/revogr-clipboard_3.entry.js +5 -3
- package/dist/esm/revogr-clipboard_3.entry.js.map +1 -1
- package/dist/esm/revogr-data_4.entry.js +10 -9
- package/dist/esm/revogr-data_4.entry.js.map +1 -1
- package/dist/esm/revogr-filter-panel.entry.js +13 -8
- package/dist/esm/revogr-filter-panel.entry.js.map +1 -1
- package/dist/esm/{selection.helpers-0f3ed629.js → selection.helpers-dbf69cc1.js} +67 -20
- package/dist/esm/selection.helpers-dbf69cc1.js.map +1 -0
- package/dist/revo-grid/base.plugin-e6e2bac2.js.map +1 -1
- package/dist/revo-grid/{column.service-ffe99cfc.js → column.service-6aab6fac.js} +2 -2
- package/dist/revo-grid/{filter.button-f132c10a.js → filter.button-f9883a78.js} +2 -2
- package/dist/revo-grid/filter.button-f9883a78.js.map +1 -0
- package/dist/revo-grid/{header-cell-renderer-cac333a3.js → header-cell-renderer-b8663a21.js} +2 -2
- package/dist/revo-grid/index.esm.js +1 -1
- package/dist/revo-grid/{key.utils-9120fde7.js → key.utils-c4a27968.js} +2 -2
- package/dist/revo-grid/key.utils-c4a27968.js.map +1 -0
- package/dist/revo-grid/revo-grid.entry.js +1 -1
- package/dist/revo-grid/revo-grid.entry.js.map +1 -1
- package/dist/revo-grid/revogr-attribution_6.entry.js +1 -1
- package/dist/revo-grid/revogr-attribution_6.entry.js.map +1 -1
- package/dist/revo-grid/revogr-clipboard_3.entry.js +1 -1
- package/dist/revo-grid/revogr-clipboard_3.entry.js.map +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js +1 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js.map +1 -1
- package/dist/revo-grid/selection.helpers-dbf69cc1.js +5 -0
- package/dist/revo-grid/selection.helpers-dbf69cc1.js.map +1 -0
- package/dist/types/components/overlay/keyboard.service.d.ts +1 -1
- package/dist/types/components/overlay/revogr-overlay-selection.d.ts +9 -1
- package/dist/types/components.d.ts +5 -0
- package/dist/types/plugins/base.plugin.d.ts +8 -8
- package/dist/types/plugins/column.auto-size.plugin.d.ts +26 -16
- package/dist/types/plugins/column.stretch.plugin.d.ts +1 -1
- package/dist/types/plugins/filter/filter.button.d.ts +1 -1
- package/dist/types/plugins/filter/filter.plugin.d.ts +24 -16
- package/dist/types/plugins/groupingRow/grouping.row.plugin.d.ts +2 -2
- package/dist/types/plugins/moveColumn/column.drag.plugin.d.ts +3 -3
- package/dist/types/plugins/sorting/sorting.plugin.d.ts +8 -8
- package/dist/types/services/selection.store.connector.d.ts +20 -0
- package/dist/types/store/selection/selection.store.d.ts +1 -0
- package/dist/types/types/interfaces.d.ts +2 -2
- package/dist/types/types/plugin.d.ts +23 -0
- package/dist/types/types/plugin.types.d.ts +20 -0
- package/dist/types/types/selection.d.ts +24 -0
- package/dist/types/utils/key.codes.d.ts +5 -2
- package/dist/types/utils/key.utils.d.ts +2 -1
- package/hydrate/index.js +153 -59
- package/hydrate/index.mjs +153 -59
- package/package.json +1 -1
- package/standalone/column.service.js +66 -19
- package/standalone/column.service.js.map +1 -1
- package/standalone/filter.button.js +2 -2
- package/standalone/filter.button.js.map +1 -1
- package/standalone/revo-grid.js +10 -5
- package/standalone/revo-grid.js.map +1 -1
- package/standalone/revogr-clipboard2.js +1 -0
- package/standalone/revogr-clipboard2.js.map +1 -1
- package/standalone/revogr-data2.js +1 -1
- package/standalone/revogr-data2.js.map +1 -1
- package/standalone/revogr-edit2.js +19 -13
- package/standalone/revogr-edit2.js.map +1 -1
- package/standalone/revogr-filter-panel.js +12 -7
- package/standalone/revogr-filter-panel.js.map +1 -1
- package/standalone/revogr-header2.js +5 -4
- package/standalone/revogr-header2.js.map +1 -1
- package/standalone/revogr-overlay-selection2.js +39 -10
- package/standalone/revogr-overlay-selection2.js.map +1 -1
- package/dist/cjs/filter.button-147884a8.js.map +0 -1
- package/dist/cjs/key.utils-be4d0b46.js.map +0 -1
- package/dist/cjs/selection.helpers-032d7192.js.map +0 -1
- package/dist/esm/filter.button-f132c10a.js.map +0 -1
- package/dist/esm/key.utils-9120fde7.js.map +0 -1
- package/dist/esm/selection.helpers-0f3ed629.js.map +0 -1
- package/dist/revo-grid/filter.button-f132c10a.js.map +0 -1
- package/dist/revo-grid/key.utils-9120fde7.js.map +0 -1
- package/dist/revo-grid/selection.helpers-0f3ed629.js +0 -5
- package/dist/revo-grid/selection.helpers-0f3ed629.js.map +0 -1
- /package/dist/revo-grid/{column.service-ffe99cfc.js.map → column.service-6aab6fac.js.map} +0 -0
- /package/dist/revo-grid/{header-cell-renderer-cac333a3.js.map → header-cell-renderer-b8663a21.js.map} +0 -0
package/hydrate/index.mjs
CHANGED
|
@@ -2291,6 +2291,7 @@ class Clipboard {
|
|
|
2291
2291
|
// if html, then search for table if no table fallback to regular text parsing
|
|
2292
2292
|
if (beforePaste.detail.isHTML) {
|
|
2293
2293
|
const table = this.htmlParse(beforePaste.detail.raw);
|
|
2294
|
+
// fallback to text if not possible to parse as html
|
|
2294
2295
|
parsedData = table || this.textParse(dataText);
|
|
2295
2296
|
}
|
|
2296
2297
|
else {
|
|
@@ -2420,8 +2421,8 @@ const TrashButton = () => {
|
|
|
2420
2421
|
hAsync("svg", { class: "trash-img", viewBox: "0 0 24 24" },
|
|
2421
2422
|
hAsync("path", { fill: "currentColor", d: "M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z" }))));
|
|
2422
2423
|
};
|
|
2423
|
-
const AndOrButton = ({
|
|
2424
|
-
return hAsync("button", { class: { [AND_OR_BUTTON]: true, 'light revo-button': true } },
|
|
2424
|
+
const AndOrButton = ({ text }) => {
|
|
2425
|
+
return hAsync("button", { class: { [AND_OR_BUTTON]: true, 'light revo-button': true } }, text);
|
|
2425
2426
|
};
|
|
2426
2427
|
function isFilterBtn(e) {
|
|
2427
2428
|
if (e.classList.contains(FILTER_BUTTON_CLASS)) {
|
|
@@ -3012,6 +3013,10 @@ class FilterPanel {
|
|
|
3012
3013
|
// drops the filter
|
|
3013
3014
|
reset: 'Cancel',
|
|
3014
3015
|
cancel: 'Close',
|
|
3016
|
+
add: 'Add more condition...',
|
|
3017
|
+
placeholder: 'Enter value...',
|
|
3018
|
+
and: 'and',
|
|
3019
|
+
or: 'or',
|
|
3015
3020
|
};
|
|
3016
3021
|
this.debouncedApplyFilter = debounce_1(() => {
|
|
3017
3022
|
this.filterChange.emit(this.filterItems);
|
|
@@ -3061,7 +3066,8 @@ class FilterPanel {
|
|
|
3061
3066
|
const options = [];
|
|
3062
3067
|
const prop = (_a = this.changes) === null || _a === void 0 ? void 0 : _a.prop;
|
|
3063
3068
|
if (!isDefaultTypeRemoved) {
|
|
3064
|
-
|
|
3069
|
+
const capts = Object.assign(this.filterCaptionsInternal, this.filterCaptions);
|
|
3070
|
+
options.push(hAsync("option", { selected: this.currentFilterType === defaultType, value: defaultType }, prop && this.filterItems[prop] && this.filterItems[prop].length > 0 ? capts.add : this.filterNames[defaultType]));
|
|
3065
3071
|
}
|
|
3066
3072
|
for (let gIndex in this.filterTypes) {
|
|
3067
3073
|
options.push(...this.filterTypes[gIndex].map(k => (hAsync("option", { value: k, selected: type === k }, this.filterNames[k]))));
|
|
@@ -3075,7 +3081,8 @@ class FilterPanel {
|
|
|
3075
3081
|
return '';
|
|
3076
3082
|
if (this.filterEntities[currentFilter[index].type].extra !== 'input')
|
|
3077
3083
|
return '';
|
|
3078
|
-
|
|
3084
|
+
const capts = Object.assign(this.filterCaptionsInternal, this.filterCaptions);
|
|
3085
|
+
return (hAsync("input", { id: `filter-input-${currentFilter[index].id}`, placeholder: capts.placeholder, type: "text", value: currentFilter[index].value, onInput: this.onUserInput.bind(this, index, prop), onKeyDown: e => this.onKeyDown(e) }));
|
|
3079
3086
|
}
|
|
3080
3087
|
getFilterItemsList() {
|
|
3081
3088
|
var _a;
|
|
@@ -3083,11 +3090,12 @@ class FilterPanel {
|
|
|
3083
3090
|
if (!(prop || prop === 0))
|
|
3084
3091
|
return '';
|
|
3085
3092
|
const propFilters = this.filterItems[prop] || [];
|
|
3093
|
+
const capts = Object.assign(this.filterCaptionsInternal, this.filterCaptions);
|
|
3086
3094
|
return (hAsync("div", { key: this.filterId }, propFilters.map((d, index) => {
|
|
3087
3095
|
let andOrButton;
|
|
3088
3096
|
// hide toggle button if there is only one filter and the last one
|
|
3089
3097
|
if (index !== this.filterItems[prop].length - 1) {
|
|
3090
|
-
andOrButton = (hAsync("div", { onClick: () => this.toggleFilterAndOr(d.id) }, hAsync(AndOrButton, {
|
|
3098
|
+
andOrButton = (hAsync("div", { onClick: () => this.toggleFilterAndOr(d.id) }, hAsync(AndOrButton, { text: d.relation === 'and' ? capts.and : capts.or })));
|
|
3091
3099
|
}
|
|
3092
3100
|
return (hAsync("div", { key: d.id, class: FILTER_LIST_CLASS }, hAsync("div", { class: { 'select-input': true } }, hAsync("select", { class: "select-css select-filter", onChange: e => this.onFilterTypeChange(e, prop, index) }, this.renderSelectOptions(this.filterItems[prop][index].type, true)), hAsync("div", { class: FILTER_LIST_CLASS_ACTION }, andOrButton), hAsync("div", { onClick: () => this.onRemoveFilter(d.id) }, hAsync(TrashButton, null))), hAsync("div", null, this.renderExtra(prop, index))));
|
|
3093
3101
|
}), propFilters.length > 0 ? hAsync("div", { class: "add-filter-divider" }) : ''));
|
|
@@ -3107,8 +3115,7 @@ class FilterPanel {
|
|
|
3107
3115
|
}
|
|
3108
3116
|
onFilterTypeChange(e, prop, index) {
|
|
3109
3117
|
const el = e.target;
|
|
3110
|
-
|
|
3111
|
-
this.filterItems[prop][index].type = type;
|
|
3118
|
+
this.filterItems[prop][index].type = el.value;
|
|
3112
3119
|
// this re-renders the input to know if we need extra input
|
|
3113
3120
|
this.filterId++;
|
|
3114
3121
|
// adding setTimeout will wait for the next tick DOM update then focus on input
|
|
@@ -3122,8 +3129,7 @@ class FilterPanel {
|
|
|
3122
3129
|
}
|
|
3123
3130
|
onAddNewFilter(e) {
|
|
3124
3131
|
const el = e.target;
|
|
3125
|
-
|
|
3126
|
-
this.currentFilterType = type;
|
|
3132
|
+
this.currentFilterType = el.value;
|
|
3127
3133
|
this.addNewFilterToProp();
|
|
3128
3134
|
// reset value after adding new filter
|
|
3129
3135
|
const select = document.getElementById('add-filter');
|
|
@@ -7547,6 +7553,7 @@ function defaultState() {
|
|
|
7547
7553
|
focus: null,
|
|
7548
7554
|
edit: null,
|
|
7549
7555
|
lastCell: null,
|
|
7556
|
+
nextFocus: null,
|
|
7550
7557
|
};
|
|
7551
7558
|
}
|
|
7552
7559
|
class SelectionStore {
|
|
@@ -7578,6 +7585,9 @@ class SelectionStore {
|
|
|
7578
7585
|
});
|
|
7579
7586
|
}
|
|
7580
7587
|
}
|
|
7588
|
+
setNextFocus(focus) {
|
|
7589
|
+
setStore(this.store, { nextFocus: focus });
|
|
7590
|
+
}
|
|
7581
7591
|
setTempArea(range) {
|
|
7582
7592
|
setStore(this.store, { tempRange: range === null || range === void 0 ? void 0 : range.area, tempRangeType: range === null || range === void 0 ? void 0 : range.type, edit: null });
|
|
7583
7593
|
}
|
|
@@ -7763,42 +7773,91 @@ class SelectionStoreConnector {
|
|
|
7763
7773
|
this.focusByCell(storePos, editCell, editCell);
|
|
7764
7774
|
this.setEdit('');
|
|
7765
7775
|
}
|
|
7776
|
+
/**
|
|
7777
|
+
* Sets the next focus cell before the current one.
|
|
7778
|
+
*
|
|
7779
|
+
* @param focus - The cell to set as the next focus.
|
|
7780
|
+
*/
|
|
7781
|
+
beforeNextFocusCell(focus) {
|
|
7782
|
+
var _a;
|
|
7783
|
+
// If there is no focused store, return early.
|
|
7784
|
+
if (!this.focusedStore) {
|
|
7785
|
+
return;
|
|
7786
|
+
}
|
|
7787
|
+
// Get the next store based on the current focus and the last cell.
|
|
7788
|
+
const next = this.getNextStore(focus, this.focusedStore.position, this.focusedStore.entity.store.get('lastCell'));
|
|
7789
|
+
// Set the next focus cell in the store.
|
|
7790
|
+
(_a = next.store) === null || _a === void 0 ? void 0 : _a.setNextFocus(Object.assign(Object.assign({}, focus), next.item));
|
|
7791
|
+
}
|
|
7766
7792
|
focusByCell(storePos, start, end) {
|
|
7767
7793
|
const store = this.stores[storePos.y][storePos.x];
|
|
7768
7794
|
this.focus(store, { focus: start, end });
|
|
7769
7795
|
}
|
|
7770
7796
|
focus(store, { focus, end }) {
|
|
7797
|
+
const currentStorePointer = this.getCurrentStorePointer(store);
|
|
7798
|
+
if (!currentStorePointer) {
|
|
7799
|
+
return null;
|
|
7800
|
+
}
|
|
7801
|
+
// check for the focus in nearby store/viewport
|
|
7802
|
+
const lastCell = store.store.get('lastCell');
|
|
7803
|
+
const next = this.getNextStore(focus, currentStorePointer, lastCell);
|
|
7804
|
+
// if next store present - update
|
|
7805
|
+
if (next === null || next === void 0 ? void 0 : next.store) {
|
|
7806
|
+
const item = Object.assign(Object.assign({}, focus), next.item);
|
|
7807
|
+
this.focus(next.store, { focus: item, end: item });
|
|
7808
|
+
return null;
|
|
7809
|
+
}
|
|
7810
|
+
focus = cropCellToMax(focus, lastCell);
|
|
7811
|
+
end = cropCellToMax(end, lastCell);
|
|
7812
|
+
store.setFocus(focus, end);
|
|
7813
|
+
return focus;
|
|
7814
|
+
}
|
|
7815
|
+
/**
|
|
7816
|
+
* Retrieves the current store pointer based on the active store.
|
|
7817
|
+
* Clears focus from all stores except the active one.
|
|
7818
|
+
*/
|
|
7819
|
+
getCurrentStorePointer(store) {
|
|
7771
7820
|
let currentStorePointer;
|
|
7772
|
-
//
|
|
7821
|
+
// Iterate through all stores
|
|
7773
7822
|
for (let y in this.stores) {
|
|
7774
7823
|
for (let x in this.stores[y]) {
|
|
7775
7824
|
const s = this.stores[y][x];
|
|
7776
|
-
//
|
|
7825
|
+
// Clear focus from stores other than the active one
|
|
7777
7826
|
if (s !== store) {
|
|
7778
7827
|
s.clearFocus();
|
|
7779
7828
|
}
|
|
7780
7829
|
else {
|
|
7781
|
-
|
|
7830
|
+
// Update the current store pointer with the active store coordinates
|
|
7831
|
+
currentStorePointer = {
|
|
7832
|
+
x: parseInt(x, 10),
|
|
7833
|
+
y: parseInt(y, 10)
|
|
7834
|
+
};
|
|
7782
7835
|
}
|
|
7783
7836
|
}
|
|
7784
7837
|
}
|
|
7785
|
-
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
|
|
7789
|
-
|
|
7838
|
+
return currentStorePointer;
|
|
7839
|
+
}
|
|
7840
|
+
/**
|
|
7841
|
+
* Retrieves the next store based on the focus cell and current store pointer.
|
|
7842
|
+
* If the next store exists, returns an object with the next store and the item in the new store.
|
|
7843
|
+
* If the next store does not exist, returns null.
|
|
7844
|
+
*/
|
|
7845
|
+
getNextStore(focus, currentStorePointer, lastCell) {
|
|
7790
7846
|
// item in new store
|
|
7791
7847
|
const nextItem = nextCell(focus, lastCell);
|
|
7792
|
-
let nextStore;
|
|
7848
|
+
let nextStore = null;
|
|
7793
7849
|
if (nextItem) {
|
|
7794
7850
|
for (let i in nextItem) {
|
|
7795
7851
|
let type = i;
|
|
7796
7852
|
let stores;
|
|
7797
7853
|
switch (type) {
|
|
7798
7854
|
case 'x':
|
|
7855
|
+
// Get the X stores for the current Y coordinate of the current store pointer
|
|
7799
7856
|
stores = this.getXStores(currentStorePointer.y);
|
|
7800
7857
|
break;
|
|
7801
7858
|
case 'y':
|
|
7859
|
+
// Get the Y stores for the current X coordinate of the current store pointer
|
|
7860
|
+
stores = this.getYStores(currentStorePointer.x);
|
|
7802
7861
|
stores = this.getYStores(currentStorePointer.x);
|
|
7803
7862
|
break;
|
|
7804
7863
|
}
|
|
@@ -7814,16 +7873,10 @@ class SelectionStoreConnector {
|
|
|
7814
7873
|
}
|
|
7815
7874
|
}
|
|
7816
7875
|
}
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
return null;
|
|
7822
|
-
}
|
|
7823
|
-
focus = cropCellToMax(focus, lastCell);
|
|
7824
|
-
end = cropCellToMax(end, lastCell);
|
|
7825
|
-
store.setFocus(focus, end);
|
|
7826
|
-
return focus;
|
|
7876
|
+
return {
|
|
7877
|
+
store: nextStore,
|
|
7878
|
+
item: nextItem,
|
|
7879
|
+
};
|
|
7827
7880
|
}
|
|
7828
7881
|
clearAll() {
|
|
7829
7882
|
var _a;
|
|
@@ -9137,6 +9190,11 @@ var codesLetter;
|
|
|
9137
9190
|
codesLetter["ARROW_DOWN"] = "ArrowDown";
|
|
9138
9191
|
codesLetter["SHIFT"] = "Shift";
|
|
9139
9192
|
})(codesLetter || (codesLetter = {}));
|
|
9193
|
+
var keyValues;
|
|
9194
|
+
(function (keyValues) {
|
|
9195
|
+
keyValues["ENTER"] = "Enter";
|
|
9196
|
+
keyValues["TAB"] = "Tab";
|
|
9197
|
+
})(keyValues || (keyValues = {}));
|
|
9140
9198
|
|
|
9141
9199
|
function isTouch(e) {
|
|
9142
9200
|
return !!e.touches;
|
|
@@ -9361,24 +9419,24 @@ function isClear(code) {
|
|
|
9361
9419
|
function isTab(code) {
|
|
9362
9420
|
return codesLetter.TAB === code;
|
|
9363
9421
|
}
|
|
9364
|
-
function
|
|
9365
|
-
return
|
|
9422
|
+
function isEnterKeyValue(key) {
|
|
9423
|
+
return keyValues.ENTER === key;
|
|
9366
9424
|
}
|
|
9367
9425
|
function isCut(event) {
|
|
9368
|
-
return (event.ctrlKey && event.code === 'KeyX') || // Ctrl + X on Windows
|
|
9369
|
-
(event.metaKey && event.code === 'KeyX'); // Cmd + X on Mac
|
|
9426
|
+
return ((event.ctrlKey && event.code === 'KeyX') || // Ctrl + X on Windows
|
|
9427
|
+
(event.metaKey && event.code === 'KeyX')); // Cmd + X on Mac
|
|
9370
9428
|
}
|
|
9371
9429
|
function isCopy(event) {
|
|
9372
|
-
return (event.ctrlKey && event.code === 'KeyC') || // Ctrl + C on Windows
|
|
9373
|
-
(event.metaKey && event.code === 'KeyC'); // Cmd + C on Mac
|
|
9430
|
+
return ((event.ctrlKey && event.code === 'KeyC') || // Ctrl + C on Windows
|
|
9431
|
+
(event.metaKey && event.code === 'KeyC')); // Cmd + C on Mac
|
|
9374
9432
|
}
|
|
9375
9433
|
function isPaste(event) {
|
|
9376
|
-
return (event.ctrlKey && event.code === 'KeyV') || // Ctrl + V on Windows
|
|
9377
|
-
(event.metaKey && event.code === 'KeyV'); // Cmd + V on Mac
|
|
9434
|
+
return ((event.ctrlKey && event.code === 'KeyV') || // Ctrl + V on Windows
|
|
9435
|
+
(event.metaKey && event.code === 'KeyV')); // Cmd + V on Mac
|
|
9378
9436
|
}
|
|
9379
9437
|
function isAll(event) {
|
|
9380
|
-
return (event.ctrlKey && event.code === 'KeyA') || // Ctrl + A on Windows
|
|
9381
|
-
(event.metaKey && event.code === 'KeyA'); // Cmd + A on Mac
|
|
9438
|
+
return ((event.ctrlKey && event.code === 'KeyA') || // Ctrl + A on Windows
|
|
9439
|
+
(event.metaKey && event.code === 'KeyA')); // Cmd + A on Mac
|
|
9382
9440
|
}
|
|
9383
9441
|
|
|
9384
9442
|
/* Generate range on size
|
|
@@ -9462,11 +9520,11 @@ class KeyboardService {
|
|
|
9462
9520
|
}
|
|
9463
9521
|
// tab key means same as arrow right
|
|
9464
9522
|
if (codesLetter.TAB === e.code) {
|
|
9465
|
-
this.keyChangeSelection(e, canRange);
|
|
9523
|
+
await this.keyChangeSelection(e, canRange);
|
|
9466
9524
|
return;
|
|
9467
9525
|
}
|
|
9468
9526
|
// pressed enter
|
|
9469
|
-
if (
|
|
9527
|
+
if (isEnterKeyValue(e.key)) {
|
|
9470
9528
|
this.sv.change();
|
|
9471
9529
|
return;
|
|
9472
9530
|
}
|
|
@@ -9531,15 +9589,19 @@ class KeyboardService {
|
|
|
9531
9589
|
if (!data) {
|
|
9532
9590
|
return false;
|
|
9533
9591
|
}
|
|
9592
|
+
const eData = this.sv.getData();
|
|
9534
9593
|
if (isMulti) {
|
|
9535
|
-
const eData = this.sv.getData();
|
|
9536
9594
|
if (isAfterLast(data.end, eData.lastCell) || isBeforeFirst(data.start)) {
|
|
9537
9595
|
return false;
|
|
9538
9596
|
}
|
|
9539
9597
|
const range = getRange(data.start, data.end);
|
|
9540
9598
|
return this.sv.range(range);
|
|
9541
9599
|
}
|
|
9542
|
-
return this.sv.
|
|
9600
|
+
return this.sv.focus(data.start, changes, isAfterLast(data.start, eData.lastCell)
|
|
9601
|
+
? 1
|
|
9602
|
+
: isBeforeFirst(data.start)
|
|
9603
|
+
? -1
|
|
9604
|
+
: 0);
|
|
9543
9605
|
}
|
|
9544
9606
|
/** Monitor key direction changes */
|
|
9545
9607
|
changeDirectionKey(e, canRange) {
|
|
@@ -9547,6 +9609,12 @@ class KeyboardService {
|
|
|
9547
9609
|
if (DIRECTION_CODES.includes(e.code)) {
|
|
9548
9610
|
e.preventDefault();
|
|
9549
9611
|
}
|
|
9612
|
+
if (e.shiftKey) {
|
|
9613
|
+
switch (e.code) {
|
|
9614
|
+
case codesLetter.TAB:
|
|
9615
|
+
return { changes: { x: -1 }, isMulti: false };
|
|
9616
|
+
}
|
|
9617
|
+
}
|
|
9550
9618
|
switch (e.code) {
|
|
9551
9619
|
case codesLetter.ARROW_UP:
|
|
9552
9620
|
return { changes: { y: -1 }, isMulti };
|
|
@@ -9785,6 +9853,7 @@ class OverlaySelection {
|
|
|
9785
9853
|
this.beforeRegionPaste = createEvent(this, "beforepasteregion", 7);
|
|
9786
9854
|
this.cellEditApply = createEvent(this, "celleditapply", 7);
|
|
9787
9855
|
this.beforeFocusCell = createEvent(this, "beforecellfocusinit", 7);
|
|
9856
|
+
this.beforeNextViewportFocus = createEvent(this, "beforenextvpfocus", 7);
|
|
9788
9857
|
this.setEdit = createEvent(this, "setedit", 7);
|
|
9789
9858
|
this.beforeApplyRange = createEvent(this, "beforeapplyrange", 7);
|
|
9790
9859
|
this.beforeSetRange = createEvent(this, "beforesetrange", 7);
|
|
@@ -9807,6 +9876,7 @@ class OverlaySelection {
|
|
|
9807
9876
|
this.keyboardService = null;
|
|
9808
9877
|
this.autoFillService = null;
|
|
9809
9878
|
this.revogrEdit = null;
|
|
9879
|
+
this.unsubscribeSelectionStore = [];
|
|
9810
9880
|
this.readonly = undefined;
|
|
9811
9881
|
this.range = undefined;
|
|
9812
9882
|
this.canDrag = undefined;
|
|
@@ -9874,12 +9944,26 @@ class OverlaySelection {
|
|
|
9874
9944
|
});
|
|
9875
9945
|
}
|
|
9876
9946
|
// #endregion
|
|
9877
|
-
/**
|
|
9947
|
+
/**
|
|
9948
|
+
* Selection & Keyboard
|
|
9949
|
+
*/
|
|
9878
9950
|
selectionServiceSet(s) {
|
|
9951
|
+
// clear subscriptions
|
|
9952
|
+
this.unsubscribeSelectionStore.forEach(v => v());
|
|
9953
|
+
this.unsubscribeSelectionStore.length = 0;
|
|
9954
|
+
this.unsubscribeSelectionStore.push(s.onChange('nextFocus', (v) => this.doFocus(v, v)));
|
|
9879
9955
|
this.keyboardService = new KeyboardService({
|
|
9880
9956
|
selectionStore: s,
|
|
9881
9957
|
range: r => this.triggerRangeEvent(r),
|
|
9882
|
-
|
|
9958
|
+
focus: (f, changes, focusNextViewport) => {
|
|
9959
|
+
if (focusNextViewport) {
|
|
9960
|
+
this.beforeNextViewportFocus.emit(f);
|
|
9961
|
+
return false;
|
|
9962
|
+
}
|
|
9963
|
+
else {
|
|
9964
|
+
return this.doFocus(f, f, changes);
|
|
9965
|
+
}
|
|
9966
|
+
},
|
|
9883
9967
|
change: val => {
|
|
9884
9968
|
if (this.readonly) {
|
|
9885
9969
|
return;
|
|
@@ -9926,6 +10010,9 @@ class OverlaySelection {
|
|
|
9926
10010
|
}
|
|
9927
10011
|
disconnectedCallback() {
|
|
9928
10012
|
var _a;
|
|
10013
|
+
// clear subscriptions
|
|
10014
|
+
this.unsubscribeSelectionStore.forEach(v => v());
|
|
10015
|
+
this.unsubscribeSelectionStore.length = 0;
|
|
9929
10016
|
(_a = this.columnService) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
9930
10017
|
}
|
|
9931
10018
|
async componentWillRender() {
|
|
@@ -9994,17 +10081,17 @@ class OverlaySelection {
|
|
|
9994
10081
|
nodes.push(hAsync("revogr-order-editor", { ref: e => (this.orderEditor = e), dataStore: this.dataStore, dimensionRow: this.dimensionRow, dimensionCol: this.dimensionCol, parent: this.element, onRowdragstartinit: e => this.rowDragStart(e) }));
|
|
9995
10082
|
}
|
|
9996
10083
|
}
|
|
9997
|
-
return (hAsync(Host, { key: '
|
|
10084
|
+
return (hAsync(Host, { key: '81dee4cfcce410cefb2bd9ff2661261472fc3a75', class: { mobile: this.isMobileDevice }, onDblClick: (e) => this.onElementDblClick(e), onMouseDown: (e) => this.onElementMouseDown(e), onTouchStart: (e) => this.onElementMouseDown(e, true) }, nodes, hAsync("slot", { key: '6ac75c388ae3fbc5539a27c3acd58178dd53d1af', name: "data" })));
|
|
9998
10085
|
}
|
|
9999
10086
|
/**
|
|
10000
10087
|
* Executes the focus operation on the specified range of cells.
|
|
10001
10088
|
*/
|
|
10002
|
-
doFocus(focus, end,
|
|
10089
|
+
doFocus(focus, end, changes) {
|
|
10003
10090
|
const { defaultPrevented } = this.beforeFocusCell.emit(this.columnService.getSaveData(focus.y, focus.x));
|
|
10004
10091
|
if (defaultPrevented) {
|
|
10005
10092
|
return false;
|
|
10006
10093
|
}
|
|
10007
|
-
const evData = Object.assign({ range: Object.assign(Object.assign({}, focus), { x1: end.x, y1: end.y }), next }, this.types);
|
|
10094
|
+
const evData = Object.assign({ range: Object.assign(Object.assign({}, focus), { x1: end.x, y1: end.y }), next: changes }, this.types);
|
|
10008
10095
|
const applyEvent = this.applyFocus.emit(evData);
|
|
10009
10096
|
if (applyEvent.defaultPrevented) {
|
|
10010
10097
|
return false;
|
|
@@ -10274,8 +10361,8 @@ class TextEditor {
|
|
|
10274
10361
|
}
|
|
10275
10362
|
}
|
|
10276
10363
|
onKeyDown(e) {
|
|
10277
|
-
const isEnter =
|
|
10278
|
-
const isKeyTab = isTab(e.
|
|
10364
|
+
const isEnter = isEnterKeyValue(e.key);
|
|
10365
|
+
const isKeyTab = isTab(e.key);
|
|
10279
10366
|
if ((isKeyTab || isEnter) &&
|
|
10280
10367
|
e.target &&
|
|
10281
10368
|
this.saveCallback &&
|
|
@@ -10312,6 +10399,7 @@ class TextEditor {
|
|
|
10312
10399
|
var _a;
|
|
10313
10400
|
return h('input', {
|
|
10314
10401
|
type: 'text',
|
|
10402
|
+
enterKeyHint: 'enter',
|
|
10315
10403
|
// set input value from cell data
|
|
10316
10404
|
value: ((_a = this.editCell) === null || _a === void 0 ? void 0 : _a.val) || '',
|
|
10317
10405
|
// save input element as ref for further usage
|
|
@@ -11713,7 +11801,12 @@ class FilterPlugin extends BasePlugin {
|
|
|
11713
11801
|
const buttonPos = el.getBoundingClientRect();
|
|
11714
11802
|
const prop = e.detail.prop;
|
|
11715
11803
|
this.pop.filterTypes = this.getColumnFilter(e.detail.filter);
|
|
11716
|
-
this.pop.show(Object.assign(Object.assign({}, this.filterCollection[prop]), { x:
|
|
11804
|
+
this.pop.show(Object.assign(Object.assign({}, this.filterCollection[prop]), { x: -9999, y: buttonPos.y - gridPos.y + buttonPos.height, prop }));
|
|
11805
|
+
// fix filter dialog is out of view
|
|
11806
|
+
setTimeout(async () => {
|
|
11807
|
+
const { width } = this.pop.getBoundingClientRect();
|
|
11808
|
+
this.pop.style.left = Math.min(buttonPos.x - gridPos.x, gridPos.width - width - 20) + 'px';
|
|
11809
|
+
});
|
|
11717
11810
|
}
|
|
11718
11811
|
getColumnFilter(type) {
|
|
11719
11812
|
let filterType = 'string';
|
|
@@ -11778,7 +11871,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
11778
11871
|
}
|
|
11779
11872
|
// applies the hasFilter to the columns to show filter icon
|
|
11780
11873
|
await this.revogrid.updateColumns(columnsToUpdate);
|
|
11781
|
-
this.emit('
|
|
11874
|
+
this.emit('afterfilterapply');
|
|
11782
11875
|
}
|
|
11783
11876
|
async clearFiltering() {
|
|
11784
11877
|
this.multiFilterItems = {};
|
|
@@ -14741,7 +14834,7 @@ class RevoGridComponent {
|
|
|
14741
14834
|
// Render viewport data (vertical sections)
|
|
14742
14835
|
view.dataPorts.forEach(data => {
|
|
14743
14836
|
const key = `${data.type}_${view.type}`;
|
|
14744
|
-
const dataView = (hAsync("revogr-overlay-selection", Object.assign({}, data, { isMobileDevice: isMobile, selectionStore: data.segmentSelectionStore, onSelectall: () => this.selectionStoreConnector.selectAll(), editors: this.editors, readonly: this.readonly, range: this.range, useClipboard: this.useClipboard, applyChangesOnClose: this.applyOnClose, additionalData: this.additionalData, slot: data.slot, onCanceledit: () => this.selectionStoreConnector.setEdit(false), onSetedit: ({ detail }) => {
|
|
14837
|
+
const dataView = (hAsync("revogr-overlay-selection", Object.assign({}, data, { isMobileDevice: isMobile, selectionStore: data.segmentSelectionStore, onSelectall: () => this.selectionStoreConnector.selectAll(), editors: this.editors, readonly: this.readonly, range: this.range, useClipboard: this.useClipboard, applyChangesOnClose: this.applyOnClose, additionalData: this.additionalData, slot: data.slot, onBeforenextvpfocus: (e) => this.selectionStoreConnector.beforeNextFocusCell(e.detail), onCanceledit: () => this.selectionStoreConnector.setEdit(false), onSetedit: ({ detail }) => {
|
|
14745
14838
|
const event = this.beforeeditstart.emit(detail);
|
|
14746
14839
|
if (!event.defaultPrevented) {
|
|
14747
14840
|
this.selectionStoreConnector.setEdit(detail.val);
|
|
@@ -14758,11 +14851,11 @@ class RevoGridComponent {
|
|
|
14758
14851
|
const typeCol = 'rgCol';
|
|
14759
14852
|
const viewports = this.viewportProvider.stores;
|
|
14760
14853
|
const dimensions = this.dimensionProvider.stores;
|
|
14761
|
-
return (hAsync(Host, { key: '
|
|
14854
|
+
return (hAsync(Host, { key: '9c290a3e6cff0f2e2375f98e020292646dc51ac6', [`${UUID}`]: this.uuid }, this.hideAttribution ? null : (hAsync("revogr-attribution", { class: "attribution" })), hAsync("div", { key: '48417bd11ec1eae854bcc0be942a7e4d27b630ac', class: "main-viewport", onClick: (e) => {
|
|
14762
14855
|
if (e.currentTarget === e.target) {
|
|
14763
14856
|
this.viewport.clearEdit();
|
|
14764
14857
|
}
|
|
14765
|
-
} }, hAsync("div", { key: '
|
|
14858
|
+
} }, hAsync("div", { key: '870bb866b39ecdd7af06a0a265891adf76c0a736', class: "viewports" }, hAsync("slot", { key: '6a8b432762f85064e190ead625168913cd610d09', name: "viewport" }), viewportSections, hAsync("revogr-scroll-virtual", { key: '39d6c67a2910f411131bc433441219eb5ddaafa2', class: "vertical", dimension: typeRow, viewportStore: viewports[typeRow].store, dimensionStore: dimensions[typeRow].store, ref: el => this.scrollingService.registerElement(el, 'rowScroll'), onScrollvirtual: e => this.scrollingService.proxyScroll(e.detail) }), hAsync(OrderRenderer, { key: '5b0c5d2864da2b7fab55ca0709e5b1250e22db5f', ref: e => (this.orderService = e) }))), hAsync("revogr-scroll-virtual", { key: 'fde782c69924d2a4d1ba5e538da28ca64e8ac292', class: "horizontal", dimension: typeCol, viewportStore: viewports[typeCol].store, dimensionStore: dimensions[typeCol].store, ref: el => this.scrollingService.registerElement(el, 'colScroll'), onScrollvirtual: e => this.scrollingService.proxyScroll(e.detail) }), this.extraElements));
|
|
14766
14859
|
}
|
|
14767
14860
|
disconnectedCallback() {
|
|
14768
14861
|
// Remove all plugins, to avoid memory leaks and unexpected behaviour when the component is removed
|
|
@@ -15146,7 +15239,7 @@ class RevogrData {
|
|
|
15146
15239
|
this.beforerowrender.emit({
|
|
15147
15240
|
node: row,
|
|
15148
15241
|
item: rgRow,
|
|
15149
|
-
dataItem,
|
|
15242
|
+
model: dataItem,
|
|
15150
15243
|
colType: this.columnService.type,
|
|
15151
15244
|
rowType: this.type,
|
|
15152
15245
|
});
|
|
@@ -15583,11 +15676,12 @@ var keyBy = createAggregator(function(result, value, key) {
|
|
|
15583
15676
|
var keyBy_1 = keyBy;
|
|
15584
15677
|
|
|
15585
15678
|
const SortingSign = ({ column }) => {
|
|
15586
|
-
|
|
15679
|
+
var _a;
|
|
15680
|
+
return hAsync("i", { class: (_a = column === null || column === void 0 ? void 0 : column.order) !== null && _a !== void 0 ? _a : 'sort-off' });
|
|
15587
15681
|
};
|
|
15588
15682
|
|
|
15589
15683
|
const HeaderRenderer = (p) => {
|
|
15590
|
-
var _a, _b, _c, _d, _e
|
|
15684
|
+
var _a, _b, _c, _d, _e;
|
|
15591
15685
|
const cellClass = {
|
|
15592
15686
|
[HEADER_CLASS]: true,
|
|
15593
15687
|
[HEADER_SORTABLE_CLASS]: !!((_a = p.data) === null || _a === void 0 ? void 0 : _a.sortable),
|
|
@@ -15622,8 +15716,8 @@ const HeaderRenderer = (p) => {
|
|
|
15622
15716
|
}
|
|
15623
15717
|
}
|
|
15624
15718
|
return (hAsync(HeaderCellRenderer, { data: p.data, props: dataProps, additionalData: p.additionalData },
|
|
15625
|
-
|
|
15626
|
-
p.canFilter && ((
|
|
15719
|
+
hAsync(SortingSign, { column: p.data }),
|
|
15720
|
+
p.canFilter && ((_e = p.data) === null || _e === void 0 ? void 0 : _e.filter) !== false ? hAsync(FilterButton, { column: p.data }) : ''));
|
|
15627
15721
|
};
|
|
15628
15722
|
|
|
15629
15723
|
const GroupHeaderRenderer = (p) => {
|
package/package.json
CHANGED
|
@@ -19,6 +19,7 @@ function defaultState() {
|
|
|
19
19
|
focus: null,
|
|
20
20
|
edit: null,
|
|
21
21
|
lastCell: null,
|
|
22
|
+
nextFocus: null,
|
|
22
23
|
};
|
|
23
24
|
}
|
|
24
25
|
class SelectionStore {
|
|
@@ -50,6 +51,9 @@ class SelectionStore {
|
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
53
|
}
|
|
54
|
+
setNextFocus(focus) {
|
|
55
|
+
setStore(this.store, { nextFocus: focus });
|
|
56
|
+
}
|
|
53
57
|
setTempArea(range) {
|
|
54
58
|
setStore(this.store, { tempRange: range === null || range === void 0 ? void 0 : range.area, tempRangeType: range === null || range === void 0 ? void 0 : range.type, edit: null });
|
|
55
59
|
}
|
|
@@ -235,42 +239,91 @@ class SelectionStoreConnector {
|
|
|
235
239
|
this.focusByCell(storePos, editCell, editCell);
|
|
236
240
|
this.setEdit('');
|
|
237
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* Sets the next focus cell before the current one.
|
|
244
|
+
*
|
|
245
|
+
* @param focus - The cell to set as the next focus.
|
|
246
|
+
*/
|
|
247
|
+
beforeNextFocusCell(focus) {
|
|
248
|
+
var _a;
|
|
249
|
+
// If there is no focused store, return early.
|
|
250
|
+
if (!this.focusedStore) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
// Get the next store based on the current focus and the last cell.
|
|
254
|
+
const next = this.getNextStore(focus, this.focusedStore.position, this.focusedStore.entity.store.get('lastCell'));
|
|
255
|
+
// Set the next focus cell in the store.
|
|
256
|
+
(_a = next.store) === null || _a === void 0 ? void 0 : _a.setNextFocus(Object.assign(Object.assign({}, focus), next.item));
|
|
257
|
+
}
|
|
238
258
|
focusByCell(storePos, start, end) {
|
|
239
259
|
const store = this.stores[storePos.y][storePos.x];
|
|
240
260
|
this.focus(store, { focus: start, end });
|
|
241
261
|
}
|
|
242
262
|
focus(store, { focus, end }) {
|
|
263
|
+
const currentStorePointer = this.getCurrentStorePointer(store);
|
|
264
|
+
if (!currentStorePointer) {
|
|
265
|
+
return null;
|
|
266
|
+
}
|
|
267
|
+
// check for the focus in nearby store/viewport
|
|
268
|
+
const lastCell = store.store.get('lastCell');
|
|
269
|
+
const next = this.getNextStore(focus, currentStorePointer, lastCell);
|
|
270
|
+
// if next store present - update
|
|
271
|
+
if (next === null || next === void 0 ? void 0 : next.store) {
|
|
272
|
+
const item = Object.assign(Object.assign({}, focus), next.item);
|
|
273
|
+
this.focus(next.store, { focus: item, end: item });
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
focus = cropCellToMax(focus, lastCell);
|
|
277
|
+
end = cropCellToMax(end, lastCell);
|
|
278
|
+
store.setFocus(focus, end);
|
|
279
|
+
return focus;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Retrieves the current store pointer based on the active store.
|
|
283
|
+
* Clears focus from all stores except the active one.
|
|
284
|
+
*/
|
|
285
|
+
getCurrentStorePointer(store) {
|
|
243
286
|
let currentStorePointer;
|
|
244
|
-
//
|
|
287
|
+
// Iterate through all stores
|
|
245
288
|
for (let y in this.stores) {
|
|
246
289
|
for (let x in this.stores[y]) {
|
|
247
290
|
const s = this.stores[y][x];
|
|
248
|
-
//
|
|
291
|
+
// Clear focus from stores other than the active one
|
|
249
292
|
if (s !== store) {
|
|
250
293
|
s.clearFocus();
|
|
251
294
|
}
|
|
252
295
|
else {
|
|
253
|
-
|
|
296
|
+
// Update the current store pointer with the active store coordinates
|
|
297
|
+
currentStorePointer = {
|
|
298
|
+
x: parseInt(x, 10),
|
|
299
|
+
y: parseInt(y, 10)
|
|
300
|
+
};
|
|
254
301
|
}
|
|
255
302
|
}
|
|
256
303
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
304
|
+
return currentStorePointer;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Retrieves the next store based on the focus cell and current store pointer.
|
|
308
|
+
* If the next store exists, returns an object with the next store and the item in the new store.
|
|
309
|
+
* If the next store does not exist, returns null.
|
|
310
|
+
*/
|
|
311
|
+
getNextStore(focus, currentStorePointer, lastCell) {
|
|
262
312
|
// item in new store
|
|
263
313
|
const nextItem = nextCell(focus, lastCell);
|
|
264
|
-
let nextStore;
|
|
314
|
+
let nextStore = null;
|
|
265
315
|
if (nextItem) {
|
|
266
316
|
for (let i in nextItem) {
|
|
267
317
|
let type = i;
|
|
268
318
|
let stores;
|
|
269
319
|
switch (type) {
|
|
270
320
|
case 'x':
|
|
321
|
+
// Get the X stores for the current Y coordinate of the current store pointer
|
|
271
322
|
stores = this.getXStores(currentStorePointer.y);
|
|
272
323
|
break;
|
|
273
324
|
case 'y':
|
|
325
|
+
// Get the Y stores for the current X coordinate of the current store pointer
|
|
326
|
+
stores = this.getYStores(currentStorePointer.x);
|
|
274
327
|
stores = this.getYStores(currentStorePointer.x);
|
|
275
328
|
break;
|
|
276
329
|
}
|
|
@@ -286,16 +339,10 @@ class SelectionStoreConnector {
|
|
|
286
339
|
}
|
|
287
340
|
}
|
|
288
341
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
return null;
|
|
294
|
-
}
|
|
295
|
-
focus = cropCellToMax(focus, lastCell);
|
|
296
|
-
end = cropCellToMax(end, lastCell);
|
|
297
|
-
store.setFocus(focus, end);
|
|
298
|
-
return focus;
|
|
342
|
+
return {
|
|
343
|
+
store: nextStore,
|
|
344
|
+
item: nextItem,
|
|
345
|
+
};
|
|
299
346
|
}
|
|
300
347
|
clearAll() {
|
|
301
348
|
var _a;
|