@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.
Files changed (91) hide show
  1. package/dist/cjs/{cell-renderer-DHSqT1hc.js → cell-renderer-ChTDsUI9.js} +3 -3
  2. package/dist/cjs/{cell-renderer-DHSqT1hc.js.map → cell-renderer-ChTDsUI9.js.map} +1 -1
  3. package/dist/cjs/{column.drag.plugin-Bz_MVClL.js → column.drag.plugin-C79X0yTw.js} +84 -4
  4. package/dist/cjs/column.drag.plugin-C79X0yTw.js.map +1 -0
  5. package/dist/cjs/{column.service-Cq2d9W4R.js → column.service-D9RDDMpb.js} +2 -391
  6. package/dist/cjs/column.service-D9RDDMpb.js.map +1 -0
  7. package/dist/cjs/{header-cell-renderer-BbmGu-fy.js → header-cell-renderer-CbdtxSW8.js} +3 -3
  8. package/dist/cjs/{header-cell-renderer-BbmGu-fy.js.map → header-cell-renderer-CbdtxSW8.js.map} +1 -1
  9. package/dist/cjs/index.cjs.js +5 -6
  10. package/dist/cjs/index.cjs.js.map +1 -1
  11. package/dist/cjs/revo-grid.cjs.entry.js +286 -20
  12. package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
  13. package/dist/cjs/revo-grid.entry.cjs.js.map +1 -1
  14. package/dist/cjs/revogr-attribution_7.cjs.entry.js +2 -2
  15. package/dist/cjs/revogr-data.revogr-header.revogr-viewport-scroll.vnode-html.entry.cjs.js.map +1 -1
  16. package/dist/cjs/revogr-data_4.cjs.entry.js +5 -5
  17. package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
  18. package/dist/cjs/{viewport.helpers-DWmWzj7C.js → viewport.helpers-BAovztDd.js} +5 -3
  19. package/dist/cjs/viewport.helpers-BAovztDd.js.map +1 -0
  20. package/dist/collection/components/header/revogr-header-style.css +15 -17
  21. package/dist/collection/components/revoGrid/viewport.helpers.js +3 -1
  22. package/dist/collection/components/revoGrid/viewport.helpers.js.map +1 -1
  23. package/dist/collection/components/revoGrid/viewport.service.js +11 -16
  24. package/dist/collection/components/revoGrid/viewport.service.js.map +1 -1
  25. package/dist/collection/services/selection.store.connector.js +13 -46
  26. package/dist/collection/services/selection.store.connector.js.map +1 -1
  27. package/dist/collection/store/selection/selection.helpers.js +0 -4
  28. package/dist/collection/store/selection/selection.helpers.js.map +1 -1
  29. package/dist/collection/types/selection.js.map +1 -1
  30. package/dist/esm/{cell-renderer-BjdtMiBM.js → cell-renderer-ePazz-Zt.js} +3 -3
  31. package/dist/esm/{cell-renderer-BjdtMiBM.js.map → cell-renderer-ePazz-Zt.js.map} +1 -1
  32. package/dist/{revo-grid/column.drag.plugin-CIivVS-c.js → esm/column.drag.plugin-CS8ilBtr.js} +84 -5
  33. package/dist/esm/column.drag.plugin-CS8ilBtr.js.map +1 -0
  34. package/dist/esm/{column.service-CspjVf-q.js → column.service-DT_CqxqZ.js} +4 -389
  35. package/dist/esm/column.service-DT_CqxqZ.js.map +1 -0
  36. package/dist/esm/{header-cell-renderer-bvKLyRcy.js → header-cell-renderer-DNIoql0s.js} +3 -3
  37. package/dist/{revo-grid/header-cell-renderer-bvKLyRcy.js.map → esm/header-cell-renderer-DNIoql0s.js.map} +1 -1
  38. package/dist/esm/index.js +5 -5
  39. package/dist/esm/revo-grid.entry.js +285 -19
  40. package/dist/esm/revo-grid.entry.js.map +1 -1
  41. package/dist/esm/revogr-attribution_7.entry.js +2 -2
  42. package/dist/esm/revogr-data.revogr-header.revogr-viewport-scroll.vnode-html.entry.js.map +1 -1
  43. package/dist/esm/revogr-data_4.entry.js +5 -5
  44. package/dist/esm/revogr-data_4.entry.js.map +1 -1
  45. package/dist/esm/{viewport.helpers-B3EYGhqf.js → viewport.helpers-VXhsJZtn.js} +5 -3
  46. package/dist/esm/viewport.helpers-VXhsJZtn.js.map +1 -0
  47. package/dist/revo-grid/{cell-renderer-BjdtMiBM.js → cell-renderer-ePazz-Zt.js} +3 -3
  48. package/dist/revo-grid/{cell-renderer-BjdtMiBM.js.map → cell-renderer-ePazz-Zt.js.map} +1 -1
  49. package/dist/{esm/column.drag.plugin-CIivVS-c.js → revo-grid/column.drag.plugin-CS8ilBtr.js} +84 -5
  50. package/dist/revo-grid/column.drag.plugin-CS8ilBtr.js.map +1 -0
  51. package/dist/revo-grid/{column.service-CspjVf-q.js → column.service-DT_CqxqZ.js} +4 -389
  52. package/dist/revo-grid/column.service-DT_CqxqZ.js.map +1 -0
  53. package/dist/revo-grid/{header-cell-renderer-bvKLyRcy.js → header-cell-renderer-DNIoql0s.js} +3 -3
  54. package/dist/{esm/header-cell-renderer-bvKLyRcy.js.map → revo-grid/header-cell-renderer-DNIoql0s.js.map} +1 -1
  55. package/dist/revo-grid/index.esm.js +5 -5
  56. package/dist/revo-grid/revo-grid.entry.esm.js.map +1 -1
  57. package/dist/revo-grid/revo-grid.entry.js +285 -19
  58. package/dist/revo-grid/revo-grid.entry.js.map +1 -1
  59. package/dist/revo-grid/revogr-attribution_7.entry.js +2 -2
  60. package/dist/revo-grid/revogr-data.revogr-header.revogr-viewport-scroll.vnode-html.entry.esm.js.map +1 -1
  61. package/dist/revo-grid/revogr-data_4.entry.js +5 -5
  62. package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
  63. package/dist/revo-grid/{viewport.helpers-B3EYGhqf.js → viewport.helpers-VXhsJZtn.js} +5 -3
  64. package/dist/revo-grid/viewport.helpers-VXhsJZtn.js.map +1 -0
  65. package/dist/types/components/revoGrid/viewport.helpers.d.ts +3 -0
  66. package/dist/types/services/selection.store.connector.d.ts +0 -5
  67. package/dist/types/store/selection/selection.helpers.d.ts +0 -1
  68. package/dist/types/types/selection.d.ts +1 -0
  69. package/hydrate/index.js +638 -676
  70. package/hydrate/index.mjs +638 -676
  71. package/package.json +6 -6
  72. package/standalone/column.service.js +2 -387
  73. package/standalone/column.service.js.map +1 -1
  74. package/standalone/index.js +2 -2
  75. package/standalone/revo-grid.js +362 -17
  76. package/standalone/revo-grid.js.map +1 -1
  77. package/standalone/revogr-data2.js +1 -1
  78. package/standalone/revogr-header2.js +2 -2
  79. package/standalone/revogr-header2.js.map +1 -1
  80. package/standalone/revogr-overlay-selection2.js +1 -1
  81. package/standalone/revogr-viewport-scroll2.js +3 -1
  82. package/standalone/revogr-viewport-scroll2.js.map +1 -1
  83. package/dist/cjs/column.drag.plugin-Bz_MVClL.js.map +0 -1
  84. package/dist/cjs/column.service-Cq2d9W4R.js.map +0 -1
  85. package/dist/cjs/viewport.helpers-DWmWzj7C.js.map +0 -1
  86. package/dist/esm/column.drag.plugin-CIivVS-c.js.map +0 -1
  87. package/dist/esm/column.service-CspjVf-q.js.map +0 -1
  88. package/dist/esm/viewport.helpers-B3EYGhqf.js.map +0 -1
  89. package/dist/revo-grid/column.drag.plugin-CIivVS-c.js.map +0 -1
  90. package/dist/revo-grid/column.service-CspjVf-q.js.map +0 -1
  91. package/dist/revo-grid/viewport.helpers-B3EYGhqf.js.map +0 -1
@@ -2,7 +2,7 @@
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
4
  import { h, proxyCustomElement, HTMLElement as HTMLElement$1, createEvent, Host } from '@stencil/core/internal/client';
5
- import { K as reduce, L as baseEach, D as getColumnType, c as columnTypes, M as toInteger, v as isGrouping, u as getGroupingName, r as rowTypes, C as getCellDataParsed, B as getCellRaw, J as getColumnByProp, j as GROUP_EXPANDED, y as getParsedGroup, z as isSameGroup, G as GROUP_DEPTH, f as PSEUDO_GROUP_ITEM_VALUE, e as PSEUDO_GROUP_ITEM_ID, p as GROUPING_ROW_TYPE, q as getSource, h as PSEUDO_GROUP_COLUMN, t as gatherGrouping, o as GROUP_EXPAND_EVENT, w as isGroupingColumn, s as getExpanded, F as isColGrouping, i as isRowType, E as getColumnSizes, N as EMPTY_INDEX, H as getColumns, O as SelectionStoreConnector } from './column.service.js';
5
+ import { J as reduce, g as getRange, K as baseEach, C as getColumnType, c as columnTypes, L as toInteger, u as isGrouping, t as getGroupingName, r as rowTypes, B as getCellDataParsed, A as getCellRaw, I as getColumnByProp, h as GROUP_EXPANDED, x as getParsedGroup, y as isSameGroup, G as GROUP_DEPTH, e as PSEUDO_GROUP_ITEM_VALUE, d as PSEUDO_GROUP_ITEM_ID, o as GROUPING_ROW_TYPE, p as getSource, f as PSEUDO_GROUP_COLUMN, s as gatherGrouping, m as GROUP_EXPAND_EVENT, v as isGroupingColumn, q as getExpanded, E as isColGrouping, i as isRowType, D as getColumnSizes, a as cropCellToMax, n as nextCell, F as getColumns } from './column.service.js';
6
6
  import { j as createStore, i as setStore, k as identity, l as isArray, b as getSourceItem, m as baseProperty, n as isArrayLike, o as getTag, q as baseKeys, g as getPhysical, e as setItems, D as DataStore, f as getSourceItemVirtualIndexByProp, d as setSourceByPhysicalIndex, s as setSourceByVirtualIndex, a as getVisibleSourceItem, h as gatherTrimmedItems } from './data.store.js';
7
7
  import { d as debounce } from './debounce.js';
8
8
  import { R as RESIZE_INTERVAL } from './consts.js';
@@ -281,6 +281,85 @@ class DimensionStore {
281
281
  }
282
282
  }
283
283
 
284
+ /**
285
+ * Selection store
286
+ */
287
+ function defaultState() {
288
+ return {
289
+ range: null,
290
+ tempRange: null,
291
+ tempRangeType: null,
292
+ focus: null,
293
+ edit: null,
294
+ lastCell: null,
295
+ nextFocus: null,
296
+ };
297
+ }
298
+ class SelectionStore {
299
+ constructor() {
300
+ this.unsubscribe = [];
301
+ this.store = createStore(defaultState());
302
+ this.store.on('set', (key, newVal) => {
303
+ if (key === 'tempRange' && !newVal) {
304
+ this.store.set('tempRangeType', null);
305
+ }
306
+ });
307
+ }
308
+ onChange(propName, cb) {
309
+ this.unsubscribe.push(this.store.onChange(propName, cb));
310
+ }
311
+ clearFocus() {
312
+ setStore(this.store, { focus: null, range: null, edit: null, tempRange: null });
313
+ }
314
+ setFocus(focus, end) {
315
+ if (!end) {
316
+ setStore(this.store, { focus });
317
+ }
318
+ else {
319
+ setStore(this.store, {
320
+ focus,
321
+ range: getRange(focus, end),
322
+ edit: null,
323
+ tempRange: null,
324
+ });
325
+ }
326
+ }
327
+ setNextFocus(focus) {
328
+ setStore(this.store, { nextFocus: focus });
329
+ }
330
+ setTempArea(range) {
331
+ 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 });
332
+ }
333
+ clearTemp() {
334
+ setStore(this.store, { tempRange: null });
335
+ }
336
+ /** Can be applied from selection change or from simple keyboard change clicks */
337
+ setRangeArea(range) {
338
+ setStore(this.store, { range, edit: null, tempRange: null });
339
+ }
340
+ setRange(start, end) {
341
+ const range = getRange(start, end);
342
+ this.setRangeArea(range);
343
+ }
344
+ setLastCell(lastCell) {
345
+ setStore(this.store, { lastCell });
346
+ }
347
+ setEdit(val) {
348
+ const focus = this.store.get('focus');
349
+ if (focus && typeof val === 'string') {
350
+ setStore(this.store, {
351
+ edit: { x: focus.x, y: focus.y, val },
352
+ });
353
+ return;
354
+ }
355
+ setStore(this.store, { edit: null });
356
+ }
357
+ dispose() {
358
+ this.unsubscribe.forEach(f => f());
359
+ this.store.dispose();
360
+ }
361
+ }
362
+
284
363
  /**
285
364
  * Base layer for plugins
286
365
  * Provide minimal starting core for plugins to work
@@ -3011,10 +3090,9 @@ function gatherColumnData(data) {
3011
3090
  }
3012
3091
  class ViewportService {
3013
3092
  constructor(config, contentHeight) {
3014
- var _a, _b;
3015
- this.config = config;
3016
- (_a = this.config.selectionStoreConnector) === null || _a === void 0 ? void 0 : _a.beforeUpdate();
3017
3093
  // ----------- Handle columns ----------- //
3094
+ var _a;
3095
+ this.config = config;
3018
3096
  // Transform data from stores and apply it to different components
3019
3097
  const columns = [];
3020
3098
  let x = 0; // we increase x only if column present
@@ -3055,11 +3133,10 @@ class ViewportService {
3055
3133
  // render per each column data collections vertically
3056
3134
  const dataPorts = this.dataViewPort(column).reduce((r, rgRow) => {
3057
3135
  // register selection store for Segment
3058
- const segmentSelection = this.registerSegment(rgRow.position);
3059
- segmentSelection.setLastCell(rgRow.lastCell);
3136
+ const segmentSelection = this.registerSegment(rgRow.position, rgRow.lastCell);
3060
3137
  // register selection store for Row
3061
3138
  const rowSelectionStore = this.registerRow(rgRow.position.y, rgRow.type);
3062
- const rowDef = Object.assign(Object.assign({ colType: val }, rgRow), { rowSelectionStore, selectionStore: segmentSelection.store, ref: (e) => config.selectionStoreConnector.registerSection(e), onSetrange: e => {
3139
+ const rowDef = Object.assign(Object.assign({ colType: val }, rgRow), { rowSelectionStore, selectionStore: segmentSelection.store, onSetrange: e => {
3063
3140
  segmentSelection.setRangeArea(e.detail);
3064
3141
  }, onSettemprange: e => segmentSelection.setTempArea(e.detail), onFocuscell: e => {
3065
3142
  // todo: multi focus
@@ -3075,7 +3152,7 @@ class ViewportService {
3075
3152
  });
3076
3153
  this.columns = columns;
3077
3154
  // ----------- Handle columns end ----------- //
3078
- (_b = this.config.scrollingService) === null || _b === void 0 ? void 0 : _b.unregister();
3155
+ (_a = this.config.scrollingService) === null || _a === void 0 ? void 0 : _a.unregister();
3079
3156
  }
3080
3157
  onColumnResize(type, { detail }, store) {
3081
3158
  var _a;
@@ -3093,8 +3170,10 @@ class ViewportService {
3093
3170
  this.config.resize(changedItems);
3094
3171
  }
3095
3172
  /** register selection store for Segment */
3096
- registerSegment(position) {
3097
- return this.config.selectionStoreConnector.register(position);
3173
+ registerSegment(position, lastCell) {
3174
+ const store = this.config.selectionStoreConnector.register(position);
3175
+ store.setLastCell(lastCell);
3176
+ return store;
3098
3177
  }
3099
3178
  /** register selection store for Row */
3100
3179
  registerRow(y, type) {
@@ -3114,14 +3193,10 @@ class ViewportService {
3114
3193
  // y position for selection
3115
3194
  let y = 0;
3116
3195
  return rowTypes.reduce((result, type) => {
3117
- // filter out empty sources, we still need to return source to keep slot working
3118
- const isPresent = data.viewports[type].store.get('realCount') || type === 'rgRow';
3119
- const rgCol = Object.assign(Object.assign({}, data), { position: Object.assign(Object.assign({}, data.position), { y: isPresent ? y : EMPTY_INDEX }) });
3196
+ const rgCol = Object.assign(Object.assign({}, data), { position: Object.assign(Object.assign({}, data.position), { y }) });
3120
3197
  const partition = viewportDataPartition(rgCol, type, slots[type], type !== 'rgRow');
3121
3198
  result.push(partition);
3122
- if (isPresent) {
3123
- y++;
3124
- }
3199
+ y++;
3125
3200
  return result;
3126
3201
  }, []);
3127
3202
  }
@@ -3295,6 +3370,276 @@ class GridScrollingService {
3295
3370
  }
3296
3371
  }
3297
3372
 
3373
+ class SelectionStoreConnector {
3374
+ constructor() {
3375
+ this.stores = {};
3376
+ this.columnStores = {};
3377
+ this.rowStores = {};
3378
+ /**
3379
+ * Helpers for data conversion
3380
+ */
3381
+ this.storesByType = {};
3382
+ this.storesXToType = {};
3383
+ this.storesYToType = {};
3384
+ }
3385
+ get focusedStore() {
3386
+ var _a;
3387
+ for (let y in this.stores) {
3388
+ for (let x in this.stores[y]) {
3389
+ const focused = (_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.store.get('focus');
3390
+ if (focused) {
3391
+ return {
3392
+ entity: this.stores[y][x],
3393
+ cell: focused,
3394
+ position: {
3395
+ x: parseInt(x, 10),
3396
+ y: parseInt(y, 10),
3397
+ },
3398
+ };
3399
+ }
3400
+ }
3401
+ }
3402
+ return null;
3403
+ }
3404
+ get edit() {
3405
+ var _a;
3406
+ return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('edit');
3407
+ }
3408
+ get focused() {
3409
+ var _a;
3410
+ return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('focus');
3411
+ }
3412
+ get selectedRange() {
3413
+ var _a;
3414
+ return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('range');
3415
+ }
3416
+ registerColumn(x, type) {
3417
+ if (this.columnStores[x]) {
3418
+ return this.columnStores[x];
3419
+ }
3420
+ this.columnStores[x] = new SelectionStore();
3421
+ // build cross-linking type to position
3422
+ this.storesByType[type] = x;
3423
+ this.storesXToType[x] = type;
3424
+ return this.columnStores[x];
3425
+ }
3426
+ registerRow(y, type) {
3427
+ if (this.rowStores[y]) {
3428
+ return this.rowStores[y];
3429
+ }
3430
+ this.rowStores[y] = new SelectionStore();
3431
+ // build cross linking type to position
3432
+ this.storesByType[type] = y;
3433
+ this.storesYToType[y] = type;
3434
+ return this.rowStores[y];
3435
+ }
3436
+ /**
3437
+ * Cross store proxy, based on multiple dimensions
3438
+ */
3439
+ register({ x, y }) {
3440
+ if (!this.stores[y]) {
3441
+ this.stores[y] = {};
3442
+ }
3443
+ let store = this.stores[y][x];
3444
+ if (store) {
3445
+ // Store already registered. Do not register twice
3446
+ return store;
3447
+ }
3448
+ this.stores[y][x] = store = new SelectionStore();
3449
+ // proxy update, column store trigger only range area
3450
+ store.onChange('range', c => {
3451
+ this.columnStores[x].setRangeArea(c);
3452
+ this.rowStores[y].setRangeArea(c);
3453
+ });
3454
+ // clean up on remove
3455
+ store.store.on('dispose', () => this.destroy(x, y));
3456
+ return store;
3457
+ }
3458
+ destroy(x, y) {
3459
+ var _a, _b;
3460
+ (_a = this.columnStores[x]) === null || _a === void 0 ? void 0 : _a.dispose();
3461
+ (_b = this.rowStores[y]) === null || _b === void 0 ? void 0 : _b.dispose();
3462
+ delete this.rowStores[y];
3463
+ delete this.columnStores[x];
3464
+ // clear x cross-link
3465
+ if (this.storesXToType[x]) {
3466
+ const type = this.storesXToType[x];
3467
+ delete this.storesXToType[x];
3468
+ delete this.storesByType[type];
3469
+ }
3470
+ // clear y cross-link
3471
+ if (this.storesYToType[y]) {
3472
+ const type = this.storesYToType[y];
3473
+ delete this.storesYToType[y];
3474
+ delete this.storesByType[type];
3475
+ }
3476
+ if (this.stores[y]) {
3477
+ delete this.stores[y][x];
3478
+ }
3479
+ // clear empty rows
3480
+ if (!Object.keys(this.stores[y] || {}).length) {
3481
+ delete this.stores[y];
3482
+ }
3483
+ }
3484
+ setEditByCell(storePos, editCell) {
3485
+ this.focusByCell(storePos, editCell, editCell);
3486
+ this.setEdit('');
3487
+ }
3488
+ /**
3489
+ * Sets the next focus cell before the current one.
3490
+ *
3491
+ * @param focus - The cell to set as the next focus.
3492
+ */
3493
+ beforeNextFocusCell(focus) {
3494
+ var _a;
3495
+ // If there is no focused store, return early.
3496
+ if (!this.focusedStore) {
3497
+ return;
3498
+ }
3499
+ // Get the next store based on the current focus and the last cell.
3500
+ const lastCell = this.focusedStore.entity.store.get('lastCell');
3501
+ const next = lastCell && this.getNextStore(focus, this.focusedStore.position, lastCell);
3502
+ // Set the next focus cell in the store.
3503
+ (_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));
3504
+ }
3505
+ focusByCell(storePos, start, end) {
3506
+ const store = this.stores[storePos.y][storePos.x];
3507
+ this.focus(store, { focus: start, end });
3508
+ }
3509
+ focus(store, { focus, end }) {
3510
+ const currentStorePointer = this.getCurrentStorePointer(store);
3511
+ if (!currentStorePointer) {
3512
+ return null;
3513
+ }
3514
+ // check for the focus in nearby store/viewport
3515
+ const lastCell = store.store.get('lastCell');
3516
+ const next = lastCell && this.getNextStore(focus, currentStorePointer, lastCell);
3517
+ // if next store present - update
3518
+ if (next === null || next === void 0 ? void 0 : next.store) {
3519
+ const item = Object.assign(Object.assign({}, focus), next.item);
3520
+ this.focus(next.store, { focus: item, end: item });
3521
+ return null;
3522
+ }
3523
+ if (lastCell) {
3524
+ focus = cropCellToMax(focus, lastCell);
3525
+ end = cropCellToMax(end, lastCell);
3526
+ }
3527
+ store.setFocus(focus, end);
3528
+ return focus;
3529
+ }
3530
+ /**
3531
+ * Retrieves the current store pointer based on the active store.
3532
+ * Clears focus from all stores except the active one.
3533
+ */
3534
+ getCurrentStorePointer(store) {
3535
+ let currentStorePointer;
3536
+ // Iterate through all stores
3537
+ for (let y in this.stores) {
3538
+ for (let x in this.stores[y]) {
3539
+ const s = this.stores[y][x];
3540
+ // Clear focus from stores other than the active one
3541
+ if (s !== store) {
3542
+ s.clearFocus();
3543
+ }
3544
+ else {
3545
+ // Update the current store pointer with the active store coordinates
3546
+ currentStorePointer = {
3547
+ x: parseInt(x, 10),
3548
+ y: parseInt(y, 10)
3549
+ };
3550
+ }
3551
+ }
3552
+ }
3553
+ return currentStorePointer;
3554
+ }
3555
+ /**
3556
+ * Retrieves the next store based on the focus cell and current store pointer.
3557
+ * If the next store exists, returns an object with the next store and the item in the new store.
3558
+ * If the next store does not exist, returns null.
3559
+ */
3560
+ getNextStore(focus, currentStorePointer, lastCell) {
3561
+ // item in new store
3562
+ const nextItem = nextCell(focus, lastCell);
3563
+ let nextStore;
3564
+ if (nextItem) {
3565
+ Object.entries(nextItem).forEach(([type, nextItemCoord]) => {
3566
+ let stores;
3567
+ switch (type) {
3568
+ case 'x':
3569
+ // Get the X stores for the current Y coordinate of the current store pointer
3570
+ stores = this.getXStores(currentStorePointer.y);
3571
+ break;
3572
+ case 'y':
3573
+ // Get the Y stores for the current X coordinate of the current store pointer
3574
+ stores = this.getYStores(currentStorePointer.x);
3575
+ break;
3576
+ }
3577
+ // Get the next store based on the item in the new store
3578
+ if (nextItemCoord >= 0) {
3579
+ nextStore = stores[++currentStorePointer[type]];
3580
+ }
3581
+ else {
3582
+ nextStore = stores[--currentStorePointer[type]];
3583
+ const nextLastCell = nextStore === null || nextStore === void 0 ? void 0 : nextStore.store.get('lastCell');
3584
+ if (nextLastCell) {
3585
+ nextItem[type] = nextLastCell[type] + nextItemCoord;
3586
+ }
3587
+ }
3588
+ });
3589
+ }
3590
+ // if last cell is empty store is empty, no next store
3591
+ const lastCellNext = nextStore === null || nextStore === void 0 ? void 0 : nextStore.store.get('lastCell');
3592
+ if (!(lastCellNext === null || lastCellNext === void 0 ? void 0 : lastCellNext.x) || !(lastCellNext === null || lastCellNext === void 0 ? void 0 : lastCellNext.y)) {
3593
+ nextStore = undefined;
3594
+ }
3595
+ return {
3596
+ store: nextStore,
3597
+ item: nextItem,
3598
+ };
3599
+ }
3600
+ clearAll() {
3601
+ var _a;
3602
+ for (let y in this.stores) {
3603
+ for (let x in this.stores[y]) {
3604
+ (_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.clearFocus();
3605
+ }
3606
+ }
3607
+ }
3608
+ setEdit(val) {
3609
+ if (!this.focusedStore) {
3610
+ return;
3611
+ }
3612
+ this.focusedStore.entity.setEdit(val);
3613
+ }
3614
+ /**
3615
+ * Select all cells across all stores
3616
+ */
3617
+ selectAll() {
3618
+ for (let y in this.stores) {
3619
+ for (let x in this.stores[y]) {
3620
+ const store = this.stores[y][x];
3621
+ if (!store) {
3622
+ continue;
3623
+ }
3624
+ const lastCell = store.store.get('lastCell');
3625
+ if (lastCell) {
3626
+ store.setRange({ x: 0, y: 0 }, { x: lastCell.x - 1, y: lastCell.y - 1 });
3627
+ }
3628
+ }
3629
+ }
3630
+ }
3631
+ getXStores(y) {
3632
+ return this.stores[y];
3633
+ }
3634
+ getYStores(x) {
3635
+ const stores = {};
3636
+ for (let i in this.stores) {
3637
+ stores[i] = this.stores[i][x];
3638
+ }
3639
+ return stores;
3640
+ }
3641
+ }
3642
+
3298
3643
  /**
3299
3644
  * Draw drag
3300
3645
  */
@@ -4847,7 +5192,7 @@ function defineCustomElement$1() {
4847
5192
  const RevoGrid = RevoGridComponent;
4848
5193
  const defineCustomElement = defineCustomElement$1;
4849
5194
 
4850
- export { AutoSizeColumnPlugin as A, BasePlugin as B, ColumnMovePlugin as C, DimensionStore as D, ExportFilePlugin as E, FILTER_TRIMMED_TYPE as F, GroupingRowPlugin as G, RevoGrid, StretchColumn as S, ExportCsv as a, FILTER_CONFIG_CHANGED_EVENT as b, FILTE_PANEL as c, FilterPlugin as d, defineCustomElement, filterTypes as e, filterCoreFunctionsIndexedByType as f, getTheme as g, filterNames as h, isStretchPlugin as i, doCollapse as j, doExpand as k, getLeftRelative as l, SortingPlugin as m, defaultCellCompare as n, descCellCompare as o, getNextOrder as p, getComparer as q, sortIndexByItems as s };
5195
+ export { AutoSizeColumnPlugin as A, BasePlugin as B, ColumnMovePlugin as C, DimensionStore as D, ExportFilePlugin as E, FILTER_TRIMMED_TYPE as F, GroupingRowPlugin as G, RevoGrid, SelectionStore as S, StretchColumn as a, ExportCsv as b, FILTER_CONFIG_CHANGED_EVENT as c, FILTE_PANEL as d, defineCustomElement, FilterPlugin as e, filterCoreFunctionsIndexedByType as f, getTheme as g, filterTypes as h, isStretchPlugin as i, filterNames as j, doCollapse as k, doExpand as l, getLeftRelative as m, SortingPlugin as n, defaultCellCompare as o, descCellCompare as p, getNextOrder as q, getComparer as r, sortIndexByItems as s };
4851
5196
  //# sourceMappingURL=revo-grid.js.map
4852
5197
 
4853
5198
  //# sourceMappingURL=revo-grid.js.map