@revolist/revogrid 4.17.2 → 4.18.0
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/{cell-renderer-DHSqT1hc.js → cell-renderer-ChTDsUI9.js} +3 -3
- package/dist/cjs/{cell-renderer-DHSqT1hc.js.map → cell-renderer-ChTDsUI9.js.map} +1 -1
- package/dist/cjs/{column.drag.plugin-Bz_MVClL.js → column.drag.plugin-C79X0yTw.js} +84 -4
- package/dist/cjs/column.drag.plugin-C79X0yTw.js.map +1 -0
- package/dist/cjs/{column.service-Cq2d9W4R.js → column.service-D9RDDMpb.js} +2 -391
- package/dist/cjs/column.service-D9RDDMpb.js.map +1 -0
- package/dist/cjs/{header-cell-renderer-BbmGu-fy.js → header-cell-renderer-CbdtxSW8.js} +3 -3
- package/dist/cjs/{header-cell-renderer-BbmGu-fy.js.map → header-cell-renderer-CbdtxSW8.js.map} +1 -1
- package/dist/cjs/index.cjs.js +5 -6
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/revo-grid.cjs.entry.js +286 -20
- package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
- package/dist/cjs/revo-grid.entry.cjs.js.map +1 -1
- package/dist/cjs/revogr-attribution_7.cjs.entry.js +2 -2
- package/dist/cjs/revogr-data.revogr-header.revogr-viewport-scroll.vnode-html.entry.cjs.js.map +1 -1
- package/dist/cjs/revogr-data_4.cjs.entry.js +5 -5
- package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
- package/dist/cjs/{viewport.helpers-DWmWzj7C.js → viewport.helpers-BAovztDd.js} +5 -3
- package/dist/cjs/viewport.helpers-BAovztDd.js.map +1 -0
- package/dist/collection/components/header/revogr-header-style.css +15 -17
- package/dist/collection/components/revoGrid/viewport.helpers.js +3 -1
- package/dist/collection/components/revoGrid/viewport.helpers.js.map +1 -1
- package/dist/collection/components/revoGrid/viewport.service.js +11 -16
- package/dist/collection/components/revoGrid/viewport.service.js.map +1 -1
- package/dist/collection/services/selection.store.connector.js +13 -46
- package/dist/collection/services/selection.store.connector.js.map +1 -1
- package/dist/collection/store/selection/selection.helpers.js +0 -4
- package/dist/collection/store/selection/selection.helpers.js.map +1 -1
- package/dist/collection/types/selection.js.map +1 -1
- package/dist/esm/{cell-renderer-BjdtMiBM.js → cell-renderer-ePazz-Zt.js} +3 -3
- package/dist/esm/{cell-renderer-BjdtMiBM.js.map → cell-renderer-ePazz-Zt.js.map} +1 -1
- package/dist/{revo-grid/column.drag.plugin-CIivVS-c.js → esm/column.drag.plugin-CS8ilBtr.js} +84 -5
- package/dist/esm/column.drag.plugin-CS8ilBtr.js.map +1 -0
- package/dist/esm/{column.service-CspjVf-q.js → column.service-DT_CqxqZ.js} +4 -389
- package/dist/esm/column.service-DT_CqxqZ.js.map +1 -0
- package/dist/esm/{header-cell-renderer-bvKLyRcy.js → header-cell-renderer-DNIoql0s.js} +3 -3
- package/dist/{revo-grid/header-cell-renderer-bvKLyRcy.js.map → esm/header-cell-renderer-DNIoql0s.js.map} +1 -1
- package/dist/esm/index.js +5 -5
- package/dist/esm/revo-grid.entry.js +285 -19
- package/dist/esm/revo-grid.entry.js.map +1 -1
- package/dist/esm/revogr-attribution_7.entry.js +2 -2
- package/dist/esm/revogr-data.revogr-header.revogr-viewport-scroll.vnode-html.entry.js.map +1 -1
- package/dist/esm/revogr-data_4.entry.js +5 -5
- package/dist/esm/revogr-data_4.entry.js.map +1 -1
- package/dist/esm/{viewport.helpers-B3EYGhqf.js → viewport.helpers-VXhsJZtn.js} +5 -3
- package/dist/esm/viewport.helpers-VXhsJZtn.js.map +1 -0
- package/dist/revo-grid/{cell-renderer-BjdtMiBM.js → cell-renderer-ePazz-Zt.js} +3 -3
- package/dist/revo-grid/{cell-renderer-BjdtMiBM.js.map → cell-renderer-ePazz-Zt.js.map} +1 -1
- package/dist/{esm/column.drag.plugin-CIivVS-c.js → revo-grid/column.drag.plugin-CS8ilBtr.js} +84 -5
- package/dist/revo-grid/column.drag.plugin-CS8ilBtr.js.map +1 -0
- package/dist/revo-grid/{column.service-CspjVf-q.js → column.service-DT_CqxqZ.js} +4 -389
- package/dist/revo-grid/column.service-DT_CqxqZ.js.map +1 -0
- package/dist/revo-grid/{header-cell-renderer-bvKLyRcy.js → header-cell-renderer-DNIoql0s.js} +3 -3
- package/dist/{esm/header-cell-renderer-bvKLyRcy.js.map → revo-grid/header-cell-renderer-DNIoql0s.js.map} +1 -1
- package/dist/revo-grid/index.esm.js +5 -5
- package/dist/revo-grid/revo-grid.entry.esm.js.map +1 -1
- package/dist/revo-grid/revo-grid.entry.js +285 -19
- package/dist/revo-grid/revo-grid.entry.js.map +1 -1
- package/dist/revo-grid/revogr-attribution_7.entry.js +2 -2
- package/dist/revo-grid/revogr-data.revogr-header.revogr-viewport-scroll.vnode-html.entry.esm.js.map +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js +5 -5
- package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
- package/dist/revo-grid/{viewport.helpers-B3EYGhqf.js → viewport.helpers-VXhsJZtn.js} +5 -3
- package/dist/revo-grid/viewport.helpers-VXhsJZtn.js.map +1 -0
- package/dist/types/components/revoGrid/viewport.helpers.d.ts +3 -0
- package/dist/types/services/selection.store.connector.d.ts +0 -5
- package/dist/types/store/selection/selection.helpers.d.ts +0 -1
- package/dist/types/types/selection.d.ts +1 -0
- package/hydrate/index.js +638 -676
- package/hydrate/index.mjs +638 -676
- package/package.json +6 -6
- package/standalone/column.service.js +2 -387
- package/standalone/column.service.js.map +1 -1
- package/standalone/index.js +2 -2
- package/standalone/revo-grid.js +362 -17
- package/standalone/revo-grid.js.map +1 -1
- package/standalone/revogr-data2.js +1 -1
- package/standalone/revogr-header2.js +2 -2
- package/standalone/revogr-header2.js.map +1 -1
- package/standalone/revogr-overlay-selection2.js +1 -1
- package/standalone/revogr-viewport-scroll2.js +3 -1
- package/standalone/revogr-viewport-scroll2.js.map +1 -1
- package/dist/cjs/column.drag.plugin-Bz_MVClL.js.map +0 -1
- package/dist/cjs/column.service-Cq2d9W4R.js.map +0 -1
- package/dist/cjs/viewport.helpers-DWmWzj7C.js.map +0 -1
- package/dist/esm/column.drag.plugin-CIivVS-c.js.map +0 -1
- package/dist/esm/column.service-CspjVf-q.js.map +0 -1
- package/dist/esm/viewport.helpers-B3EYGhqf.js.map +0 -1
- package/dist/revo-grid/column.drag.plugin-CIivVS-c.js.map +0 -1
- package/dist/revo-grid/column.service-CspjVf-q.js.map +0 -1
- package/dist/revo-grid/viewport.helpers-B3EYGhqf.js.map +0 -1
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
4
|
import { h, r as registerInstance, c as createEvent, H as Host, g as getElement } from './index-Dyptvvxf.js';
|
|
5
|
-
import { c as columnTypes,
|
|
5
|
+
import { c as columnTypes, J as reduce, C as getColumnType, r as rowTypes, i as isRowType, D as getColumnSizes, a as cropCellToMax, n as nextCell, I as getColumnByProp, F as getColumns } from './column.service-DT_CqxqZ.js';
|
|
6
6
|
import { D as DataStore, b as getSourceItem, f as getSourceItemVirtualIndexByProp, d as setSourceByPhysicalIndex, s as setSourceByVirtualIndex, a as getVisibleSourceItem, h as gatherTrimmedItems, k as getItemByIndex, R as RESIZE_INTERVAL, u as timeout } from './dimension.helpers-D5lwLPzd.js';
|
|
7
7
|
import { d as debounce } from './debounce-BfO9dz9v.js';
|
|
8
|
-
import { D as DimensionStore, B as BasePlugin, G as GroupingRowPlugin,
|
|
8
|
+
import { D as DimensionStore, S as SelectionStore, B as BasePlugin, G as GroupingRowPlugin, a as StretchColumn, i as isStretchPlugin, A as AutoSizeColumnPlugin, e as FilterPlugin, E as ExportFilePlugin, m as SortingPlugin, C as ColumnMovePlugin } from './column.drag.plugin-CS8ilBtr.js';
|
|
9
9
|
import { V as ViewportStore } from './viewport.store-2mQugd8S.js';
|
|
10
|
-
import { v as viewportDataPartition, F as FOOTER_SLOT, C as CONTENT_SLOT, H as HEADER_SLOT, D as DATA_SLOT } from './viewport.helpers-
|
|
10
|
+
import { v as viewportDataPartition, F as FOOTER_SLOT, C as CONTENT_SLOT, H as HEADER_SLOT, D as DATA_SLOT } from './viewport.helpers-VXhsJZtn.js';
|
|
11
11
|
import { g as getPropertyFromEvent } from './events-BvSmBueA.js';
|
|
12
12
|
import './filter.button-DmOE7VCJ.js';
|
|
13
|
-
import './header-cell-renderer-
|
|
13
|
+
import './header-cell-renderer-DNIoql0s.js';
|
|
14
14
|
|
|
15
15
|
class ThemeCompact {
|
|
16
16
|
constructor() {
|
|
@@ -487,10 +487,9 @@ function gatherColumnData(data) {
|
|
|
487
487
|
}
|
|
488
488
|
class ViewportService {
|
|
489
489
|
constructor(config, contentHeight) {
|
|
490
|
-
var _a, _b;
|
|
491
|
-
this.config = config;
|
|
492
|
-
(_a = this.config.selectionStoreConnector) === null || _a === void 0 ? void 0 : _a.beforeUpdate();
|
|
493
490
|
// ----------- Handle columns ----------- //
|
|
491
|
+
var _a;
|
|
492
|
+
this.config = config;
|
|
494
493
|
// Transform data from stores and apply it to different components
|
|
495
494
|
const columns = [];
|
|
496
495
|
let x = 0; // we increase x only if column present
|
|
@@ -531,11 +530,10 @@ class ViewportService {
|
|
|
531
530
|
// render per each column data collections vertically
|
|
532
531
|
const dataPorts = this.dataViewPort(column).reduce((r, rgRow) => {
|
|
533
532
|
// register selection store for Segment
|
|
534
|
-
const segmentSelection = this.registerSegment(rgRow.position);
|
|
535
|
-
segmentSelection.setLastCell(rgRow.lastCell);
|
|
533
|
+
const segmentSelection = this.registerSegment(rgRow.position, rgRow.lastCell);
|
|
536
534
|
// register selection store for Row
|
|
537
535
|
const rowSelectionStore = this.registerRow(rgRow.position.y, rgRow.type);
|
|
538
|
-
const rowDef = Object.assign(Object.assign({ colType: val }, rgRow), { rowSelectionStore, selectionStore: segmentSelection.store,
|
|
536
|
+
const rowDef = Object.assign(Object.assign({ colType: val }, rgRow), { rowSelectionStore, selectionStore: segmentSelection.store, onSetrange: e => {
|
|
539
537
|
segmentSelection.setRangeArea(e.detail);
|
|
540
538
|
}, onSettemprange: e => segmentSelection.setTempArea(e.detail), onFocuscell: e => {
|
|
541
539
|
// todo: multi focus
|
|
@@ -551,7 +549,7 @@ class ViewportService {
|
|
|
551
549
|
});
|
|
552
550
|
this.columns = columns;
|
|
553
551
|
// ----------- Handle columns end ----------- //
|
|
554
|
-
(
|
|
552
|
+
(_a = this.config.scrollingService) === null || _a === void 0 ? void 0 : _a.unregister();
|
|
555
553
|
}
|
|
556
554
|
onColumnResize(type, { detail }, store) {
|
|
557
555
|
var _a;
|
|
@@ -569,8 +567,10 @@ class ViewportService {
|
|
|
569
567
|
this.config.resize(changedItems);
|
|
570
568
|
}
|
|
571
569
|
/** register selection store for Segment */
|
|
572
|
-
registerSegment(position) {
|
|
573
|
-
|
|
570
|
+
registerSegment(position, lastCell) {
|
|
571
|
+
const store = this.config.selectionStoreConnector.register(position);
|
|
572
|
+
store.setLastCell(lastCell);
|
|
573
|
+
return store;
|
|
574
574
|
}
|
|
575
575
|
/** register selection store for Row */
|
|
576
576
|
registerRow(y, type) {
|
|
@@ -590,14 +590,10 @@ class ViewportService {
|
|
|
590
590
|
// y position for selection
|
|
591
591
|
let y = 0;
|
|
592
592
|
return rowTypes.reduce((result, type) => {
|
|
593
|
-
|
|
594
|
-
const isPresent = data.viewports[type].store.get('realCount') || type === 'rgRow';
|
|
595
|
-
const rgCol = Object.assign(Object.assign({}, data), { position: Object.assign(Object.assign({}, data.position), { y: isPresent ? y : EMPTY_INDEX }) });
|
|
593
|
+
const rgCol = Object.assign(Object.assign({}, data), { position: Object.assign(Object.assign({}, data.position), { y }) });
|
|
596
594
|
const partition = viewportDataPartition(rgCol, type, slots[type], type !== 'rgRow');
|
|
597
595
|
result.push(partition);
|
|
598
|
-
|
|
599
|
-
y++;
|
|
600
|
-
}
|
|
596
|
+
y++;
|
|
601
597
|
return result;
|
|
602
598
|
}, []);
|
|
603
599
|
}
|
|
@@ -771,6 +767,276 @@ class GridScrollingService {
|
|
|
771
767
|
}
|
|
772
768
|
}
|
|
773
769
|
|
|
770
|
+
class SelectionStoreConnector {
|
|
771
|
+
constructor() {
|
|
772
|
+
this.stores = {};
|
|
773
|
+
this.columnStores = {};
|
|
774
|
+
this.rowStores = {};
|
|
775
|
+
/**
|
|
776
|
+
* Helpers for data conversion
|
|
777
|
+
*/
|
|
778
|
+
this.storesByType = {};
|
|
779
|
+
this.storesXToType = {};
|
|
780
|
+
this.storesYToType = {};
|
|
781
|
+
}
|
|
782
|
+
get focusedStore() {
|
|
783
|
+
var _a;
|
|
784
|
+
for (let y in this.stores) {
|
|
785
|
+
for (let x in this.stores[y]) {
|
|
786
|
+
const focused = (_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.store.get('focus');
|
|
787
|
+
if (focused) {
|
|
788
|
+
return {
|
|
789
|
+
entity: this.stores[y][x],
|
|
790
|
+
cell: focused,
|
|
791
|
+
position: {
|
|
792
|
+
x: parseInt(x, 10),
|
|
793
|
+
y: parseInt(y, 10),
|
|
794
|
+
},
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
return null;
|
|
800
|
+
}
|
|
801
|
+
get edit() {
|
|
802
|
+
var _a;
|
|
803
|
+
return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('edit');
|
|
804
|
+
}
|
|
805
|
+
get focused() {
|
|
806
|
+
var _a;
|
|
807
|
+
return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('focus');
|
|
808
|
+
}
|
|
809
|
+
get selectedRange() {
|
|
810
|
+
var _a;
|
|
811
|
+
return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('range');
|
|
812
|
+
}
|
|
813
|
+
registerColumn(x, type) {
|
|
814
|
+
if (this.columnStores[x]) {
|
|
815
|
+
return this.columnStores[x];
|
|
816
|
+
}
|
|
817
|
+
this.columnStores[x] = new SelectionStore();
|
|
818
|
+
// build cross-linking type to position
|
|
819
|
+
this.storesByType[type] = x;
|
|
820
|
+
this.storesXToType[x] = type;
|
|
821
|
+
return this.columnStores[x];
|
|
822
|
+
}
|
|
823
|
+
registerRow(y, type) {
|
|
824
|
+
if (this.rowStores[y]) {
|
|
825
|
+
return this.rowStores[y];
|
|
826
|
+
}
|
|
827
|
+
this.rowStores[y] = new SelectionStore();
|
|
828
|
+
// build cross linking type to position
|
|
829
|
+
this.storesByType[type] = y;
|
|
830
|
+
this.storesYToType[y] = type;
|
|
831
|
+
return this.rowStores[y];
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Cross store proxy, based on multiple dimensions
|
|
835
|
+
*/
|
|
836
|
+
register({ x, y }) {
|
|
837
|
+
if (!this.stores[y]) {
|
|
838
|
+
this.stores[y] = {};
|
|
839
|
+
}
|
|
840
|
+
let store = this.stores[y][x];
|
|
841
|
+
if (store) {
|
|
842
|
+
// Store already registered. Do not register twice
|
|
843
|
+
return store;
|
|
844
|
+
}
|
|
845
|
+
this.stores[y][x] = store = new SelectionStore();
|
|
846
|
+
// proxy update, column store trigger only range area
|
|
847
|
+
store.onChange('range', c => {
|
|
848
|
+
this.columnStores[x].setRangeArea(c);
|
|
849
|
+
this.rowStores[y].setRangeArea(c);
|
|
850
|
+
});
|
|
851
|
+
// clean up on remove
|
|
852
|
+
store.store.on('dispose', () => this.destroy(x, y));
|
|
853
|
+
return store;
|
|
854
|
+
}
|
|
855
|
+
destroy(x, y) {
|
|
856
|
+
var _a, _b;
|
|
857
|
+
(_a = this.columnStores[x]) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
858
|
+
(_b = this.rowStores[y]) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
859
|
+
delete this.rowStores[y];
|
|
860
|
+
delete this.columnStores[x];
|
|
861
|
+
// clear x cross-link
|
|
862
|
+
if (this.storesXToType[x]) {
|
|
863
|
+
const type = this.storesXToType[x];
|
|
864
|
+
delete this.storesXToType[x];
|
|
865
|
+
delete this.storesByType[type];
|
|
866
|
+
}
|
|
867
|
+
// clear y cross-link
|
|
868
|
+
if (this.storesYToType[y]) {
|
|
869
|
+
const type = this.storesYToType[y];
|
|
870
|
+
delete this.storesYToType[y];
|
|
871
|
+
delete this.storesByType[type];
|
|
872
|
+
}
|
|
873
|
+
if (this.stores[y]) {
|
|
874
|
+
delete this.stores[y][x];
|
|
875
|
+
}
|
|
876
|
+
// clear empty rows
|
|
877
|
+
if (!Object.keys(this.stores[y] || {}).length) {
|
|
878
|
+
delete this.stores[y];
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
setEditByCell(storePos, editCell) {
|
|
882
|
+
this.focusByCell(storePos, editCell, editCell);
|
|
883
|
+
this.setEdit('');
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* Sets the next focus cell before the current one.
|
|
887
|
+
*
|
|
888
|
+
* @param focus - The cell to set as the next focus.
|
|
889
|
+
*/
|
|
890
|
+
beforeNextFocusCell(focus) {
|
|
891
|
+
var _a;
|
|
892
|
+
// If there is no focused store, return early.
|
|
893
|
+
if (!this.focusedStore) {
|
|
894
|
+
return;
|
|
895
|
+
}
|
|
896
|
+
// Get the next store based on the current focus and the last cell.
|
|
897
|
+
const lastCell = this.focusedStore.entity.store.get('lastCell');
|
|
898
|
+
const next = lastCell && this.getNextStore(focus, this.focusedStore.position, lastCell);
|
|
899
|
+
// Set the next focus cell in the store.
|
|
900
|
+
(_a = next === null || next === void 0 ? void 0 : next.store) === null || _a === void 0 ? void 0 : _a.setNextFocus(Object.assign(Object.assign({}, focus), next.item));
|
|
901
|
+
}
|
|
902
|
+
focusByCell(storePos, start, end) {
|
|
903
|
+
const store = this.stores[storePos.y][storePos.x];
|
|
904
|
+
this.focus(store, { focus: start, end });
|
|
905
|
+
}
|
|
906
|
+
focus(store, { focus, end }) {
|
|
907
|
+
const currentStorePointer = this.getCurrentStorePointer(store);
|
|
908
|
+
if (!currentStorePointer) {
|
|
909
|
+
return null;
|
|
910
|
+
}
|
|
911
|
+
// check for the focus in nearby store/viewport
|
|
912
|
+
const lastCell = store.store.get('lastCell');
|
|
913
|
+
const next = lastCell && this.getNextStore(focus, currentStorePointer, lastCell);
|
|
914
|
+
// if next store present - update
|
|
915
|
+
if (next === null || next === void 0 ? void 0 : next.store) {
|
|
916
|
+
const item = Object.assign(Object.assign({}, focus), next.item);
|
|
917
|
+
this.focus(next.store, { focus: item, end: item });
|
|
918
|
+
return null;
|
|
919
|
+
}
|
|
920
|
+
if (lastCell) {
|
|
921
|
+
focus = cropCellToMax(focus, lastCell);
|
|
922
|
+
end = cropCellToMax(end, lastCell);
|
|
923
|
+
}
|
|
924
|
+
store.setFocus(focus, end);
|
|
925
|
+
return focus;
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* Retrieves the current store pointer based on the active store.
|
|
929
|
+
* Clears focus from all stores except the active one.
|
|
930
|
+
*/
|
|
931
|
+
getCurrentStorePointer(store) {
|
|
932
|
+
let currentStorePointer;
|
|
933
|
+
// Iterate through all stores
|
|
934
|
+
for (let y in this.stores) {
|
|
935
|
+
for (let x in this.stores[y]) {
|
|
936
|
+
const s = this.stores[y][x];
|
|
937
|
+
// Clear focus from stores other than the active one
|
|
938
|
+
if (s !== store) {
|
|
939
|
+
s.clearFocus();
|
|
940
|
+
}
|
|
941
|
+
else {
|
|
942
|
+
// Update the current store pointer with the active store coordinates
|
|
943
|
+
currentStorePointer = {
|
|
944
|
+
x: parseInt(x, 10),
|
|
945
|
+
y: parseInt(y, 10)
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
return currentStorePointer;
|
|
951
|
+
}
|
|
952
|
+
/**
|
|
953
|
+
* Retrieves the next store based on the focus cell and current store pointer.
|
|
954
|
+
* If the next store exists, returns an object with the next store and the item in the new store.
|
|
955
|
+
* If the next store does not exist, returns null.
|
|
956
|
+
*/
|
|
957
|
+
getNextStore(focus, currentStorePointer, lastCell) {
|
|
958
|
+
// item in new store
|
|
959
|
+
const nextItem = nextCell(focus, lastCell);
|
|
960
|
+
let nextStore;
|
|
961
|
+
if (nextItem) {
|
|
962
|
+
Object.entries(nextItem).forEach(([type, nextItemCoord]) => {
|
|
963
|
+
let stores;
|
|
964
|
+
switch (type) {
|
|
965
|
+
case 'x':
|
|
966
|
+
// Get the X stores for the current Y coordinate of the current store pointer
|
|
967
|
+
stores = this.getXStores(currentStorePointer.y);
|
|
968
|
+
break;
|
|
969
|
+
case 'y':
|
|
970
|
+
// Get the Y stores for the current X coordinate of the current store pointer
|
|
971
|
+
stores = this.getYStores(currentStorePointer.x);
|
|
972
|
+
break;
|
|
973
|
+
}
|
|
974
|
+
// Get the next store based on the item in the new store
|
|
975
|
+
if (nextItemCoord >= 0) {
|
|
976
|
+
nextStore = stores[++currentStorePointer[type]];
|
|
977
|
+
}
|
|
978
|
+
else {
|
|
979
|
+
nextStore = stores[--currentStorePointer[type]];
|
|
980
|
+
const nextLastCell = nextStore === null || nextStore === void 0 ? void 0 : nextStore.store.get('lastCell');
|
|
981
|
+
if (nextLastCell) {
|
|
982
|
+
nextItem[type] = nextLastCell[type] + nextItemCoord;
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
});
|
|
986
|
+
}
|
|
987
|
+
// if last cell is empty store is empty, no next store
|
|
988
|
+
const lastCellNext = nextStore === null || nextStore === void 0 ? void 0 : nextStore.store.get('lastCell');
|
|
989
|
+
if (!(lastCellNext === null || lastCellNext === void 0 ? void 0 : lastCellNext.x) || !(lastCellNext === null || lastCellNext === void 0 ? void 0 : lastCellNext.y)) {
|
|
990
|
+
nextStore = undefined;
|
|
991
|
+
}
|
|
992
|
+
return {
|
|
993
|
+
store: nextStore,
|
|
994
|
+
item: nextItem,
|
|
995
|
+
};
|
|
996
|
+
}
|
|
997
|
+
clearAll() {
|
|
998
|
+
var _a;
|
|
999
|
+
for (let y in this.stores) {
|
|
1000
|
+
for (let x in this.stores[y]) {
|
|
1001
|
+
(_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.clearFocus();
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
setEdit(val) {
|
|
1006
|
+
if (!this.focusedStore) {
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
this.focusedStore.entity.setEdit(val);
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
1012
|
+
* Select all cells across all stores
|
|
1013
|
+
*/
|
|
1014
|
+
selectAll() {
|
|
1015
|
+
for (let y in this.stores) {
|
|
1016
|
+
for (let x in this.stores[y]) {
|
|
1017
|
+
const store = this.stores[y][x];
|
|
1018
|
+
if (!store) {
|
|
1019
|
+
continue;
|
|
1020
|
+
}
|
|
1021
|
+
const lastCell = store.store.get('lastCell');
|
|
1022
|
+
if (lastCell) {
|
|
1023
|
+
store.setRange({ x: 0, y: 0 }, { x: lastCell.x - 1, y: lastCell.y - 1 });
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
getXStores(y) {
|
|
1029
|
+
return this.stores[y];
|
|
1030
|
+
}
|
|
1031
|
+
getYStores(x) {
|
|
1032
|
+
const stores = {};
|
|
1033
|
+
for (let i in this.stores) {
|
|
1034
|
+
stores[i] = this.stores[i][x];
|
|
1035
|
+
}
|
|
1036
|
+
return stores;
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
|
|
774
1040
|
/**
|
|
775
1041
|
* Draw drag
|
|
776
1042
|
*/
|