@revolist/revogrid 4.22.1 → 4.23.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 (120) hide show
  1. package/dist/cjs/{cell-renderer-BQdEGQXP.js → cell-renderer-DWJ9Px9f.js} +9 -3
  2. package/dist/cjs/{column.drag.plugin-RDjQhKCH.js → column.drag.plugin-CaEBDG-Q.js} +391 -256
  3. package/dist/cjs/{column.service-DXYMehqK.js → column.service-f612L4ql.js} +1 -1
  4. package/dist/cjs/{dimension.helpers-CiiNnlLa.js → dimension.helpers-B9HgANnM.js} +14 -145
  5. package/dist/cjs/{edit.utils-CecCfA4E.js → edit.utils-pKeiYFLJ.js} +1 -1
  6. package/dist/cjs/{header-cell-renderer-DGyBrK8I.js → header-cell-renderer-4yq9_WbM.js} +1 -1
  7. package/dist/cjs/index-DxaSE5uZ.js +136 -0
  8. package/dist/cjs/index.cjs.js +37 -32
  9. package/dist/cjs/revo-grid.cjs.entry.js +35 -15
  10. package/dist/cjs/revogr-attribution_7.cjs.entry.js +43 -25
  11. package/dist/cjs/revogr-clipboard_3.cjs.entry.js +10 -8
  12. package/dist/cjs/revogr-data_4.cjs.entry.js +26 -17
  13. package/dist/cjs/revogr-filter-panel.cjs.entry.js +2 -1
  14. package/dist/cjs/{text-editor-DnLZW1a-.js → text-editor-B4W-m-r-.js} +3 -3
  15. package/dist/cjs/{throttle-CfgQFkfR.js → throttle-BCwEuJJq.js} +59 -24
  16. package/dist/cjs/viewport.helpers-BND76K2j.js +140 -0
  17. package/dist/cjs/{viewport.store-q6YdR9mg.js → viewport.store-BlKQ4x9H.js} +16 -16
  18. package/dist/collection/components/data/revogr-data.js +5 -3
  19. package/dist/collection/components/header/header-group-renderer.js +1 -1
  20. package/dist/collection/components/header/header-renderer.js +1 -1
  21. package/dist/collection/components/header/revogr-header-style.css +13 -3
  22. package/dist/collection/components/header/revogr-header.js +5 -2
  23. package/dist/collection/components/order/order-row.service.js +6 -5
  24. package/dist/collection/components/overlay/keyboard.service.js +23 -1
  25. package/dist/collection/components/overlay/selection.utils.js +8 -6
  26. package/dist/collection/components/revoGrid/revo-grid.js +6 -5
  27. package/dist/collection/components/revoGrid/viewport.service.js +2 -1
  28. package/dist/collection/components/scroll/revogr-viewport-scroll.js +10 -6
  29. package/dist/collection/components/scrollable/revogr-scroll-virtual.js +4 -10
  30. package/dist/collection/plugins/filter/filter.panel.js +2 -1
  31. package/dist/collection/plugins/filter/filter.plugin.js +11 -4
  32. package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +25 -1
  33. package/dist/collection/plugins/moveColumn/column.drag.plugin.js +4 -4
  34. package/dist/collection/plugins/sorting/sorting.func.js +173 -15
  35. package/dist/collection/plugins/sorting/sorting.plugin.js +167 -84
  36. package/dist/collection/plugins/sorting/sorting.sign.js +7 -1
  37. package/dist/collection/serve/controller.js +98 -37
  38. package/dist/collection/serve/data.js +273 -144
  39. package/dist/collection/services/dimension.provider.js +16 -1
  40. package/dist/collection/services/local.scroll.service.js +59 -24
  41. package/dist/collection/services/scroll.dimension.helpers.js +83 -0
  42. package/dist/collection/services/selection.store.connector.js +4 -1
  43. package/dist/collection/store/dimension/dimension.recalculate.plugin.js +22 -9
  44. package/dist/collection/store/dimension/dimension.store.js +4 -2
  45. package/dist/collection/store/vp/viewport.helpers.js +9 -0
  46. package/dist/collection/store/vp/viewport.store.js +5 -16
  47. package/dist/collection/utils/store.utils.js +3 -3
  48. package/dist/{revo-grid/cell-renderer-CALsEsnh.js → esm/cell-renderer-8UiGd-s7.js} +9 -3
  49. package/dist/esm/{column.drag.plugin-Dy5ztusn.js → column.drag.plugin-BsfhsfmB.js} +388 -255
  50. package/dist/esm/{column.service-CCvAi5l4.js → column.service-DbpulTog.js} +1 -1
  51. package/dist/{revo-grid/debounce-BfO9dz9v.js → esm/debounce-PCRWZliA.js} +1 -1
  52. package/dist/{revo-grid/dimension.helpers-DmIvjIa7.js → esm/dimension.helpers-CGKwSvw6.js} +7 -128
  53. package/dist/esm/{edit.utils-DYN6XZh8.js → edit.utils-Dnnbd0xG.js} +1 -1
  54. package/dist/{revo-grid/header-cell-renderer-DU8wKAbg.js → esm/header-cell-renderer-DGI2FAD8.js} +1 -1
  55. package/dist/esm/index-Db3qZoW5.js +127 -0
  56. package/dist/esm/index.js +11 -10
  57. package/dist/esm/revo-grid.entry.js +34 -14
  58. package/dist/esm/revogr-attribution_7.entry.js +42 -24
  59. package/dist/esm/revogr-clipboard_3.entry.js +11 -9
  60. package/dist/esm/revogr-data_4.entry.js +27 -18
  61. package/dist/esm/revogr-filter-panel.entry.js +3 -2
  62. package/dist/esm/{text-editor-DpCnd6Fq.js → text-editor-C3RUSwH5.js} +2 -2
  63. package/dist/esm/{throttle-ERvyruXb.js → throttle-CaUDyxyU.js} +60 -25
  64. package/dist/esm/viewport.helpers-CoCAvmZs.js +133 -0
  65. package/dist/{revo-grid/viewport.store-CFjDW-3l.js → esm/viewport.store-COAfzAyu.js} +15 -17
  66. package/dist/{esm/cell-renderer-CALsEsnh.js → revo-grid/cell-renderer-8UiGd-s7.js} +9 -3
  67. package/dist/revo-grid/{column.drag.plugin-Dy5ztusn.js → column.drag.plugin-BsfhsfmB.js} +388 -255
  68. package/dist/revo-grid/{column.service-CCvAi5l4.js → column.service-DbpulTog.js} +1 -1
  69. package/dist/{esm/debounce-BfO9dz9v.js → revo-grid/debounce-PCRWZliA.js} +1 -1
  70. package/dist/{esm/dimension.helpers-DmIvjIa7.js → revo-grid/dimension.helpers-CGKwSvw6.js} +7 -128
  71. package/dist/revo-grid/{edit.utils-DYN6XZh8.js → edit.utils-Dnnbd0xG.js} +1 -1
  72. package/dist/{esm/header-cell-renderer-DU8wKAbg.js → revo-grid/header-cell-renderer-DGI2FAD8.js} +1 -1
  73. package/dist/revo-grid/index-Db3qZoW5.js +127 -0
  74. package/dist/revo-grid/index.esm.js +11 -10
  75. package/dist/revo-grid/revo-grid.entry.js +34 -14
  76. package/dist/revo-grid/revogr-attribution_7.entry.js +42 -24
  77. package/dist/revo-grid/revogr-clipboard_3.entry.js +11 -9
  78. package/dist/revo-grid/revogr-data_4.entry.js +27 -18
  79. package/dist/revo-grid/revogr-filter-panel.entry.js +3 -2
  80. package/dist/revo-grid/{text-editor-DpCnd6Fq.js → text-editor-C3RUSwH5.js} +2 -2
  81. package/dist/revo-grid/{throttle-ERvyruXb.js → throttle-CaUDyxyU.js} +60 -25
  82. package/dist/revo-grid/viewport.helpers-CoCAvmZs.js +133 -0
  83. package/dist/{esm/viewport.store-CFjDW-3l.js → revo-grid/viewport.store-COAfzAyu.js} +15 -17
  84. package/dist/types/components/header/header-group-renderer.d.ts +1 -0
  85. package/dist/types/components/header/header-renderer.d.ts +1 -0
  86. package/dist/types/components/overlay/keyboard.service.d.ts +5 -0
  87. package/dist/types/plugins/groupingRow/grouping.row.plugin.d.ts +8 -0
  88. package/dist/types/plugins/sorting/sorting.func.d.ts +25 -2
  89. package/dist/types/plugins/sorting/sorting.plugin.d.ts +84 -9
  90. package/dist/types/plugins/sorting/sorting.sign.d.ts +5 -1
  91. package/dist/types/plugins/sorting/sorting.types.d.ts +46 -1
  92. package/dist/types/services/local.scroll.service.d.ts +10 -2
  93. package/dist/types/services/scroll.dimension.helpers.d.ts +20 -0
  94. package/dist/types/store/vp/viewport.helpers.d.ts +2 -0
  95. package/dist/types/types/interfaces.d.ts +11 -0
  96. package/hydrate/index.js +649 -365
  97. package/hydrate/index.mjs +649 -365
  98. package/package.json +1 -1
  99. package/standalone/column.service.js +1 -1
  100. package/standalone/data.store.js +1 -1
  101. package/standalone/debounce.js +1 -1
  102. package/standalone/dimension.helpers.js +1 -1
  103. package/standalone/index.js +1 -1
  104. package/standalone/local.scroll.timer.js +1 -1
  105. package/standalone/revo-grid.js +1 -1
  106. package/standalone/revogr-data2.js +1 -1
  107. package/standalone/revogr-filter-panel.js +1 -1
  108. package/standalone/revogr-header2.js +1 -1
  109. package/standalone/revogr-order-editor2.js +1 -1
  110. package/standalone/revogr-overlay-selection2.js +1 -1
  111. package/standalone/revogr-row-headers.js +1 -1
  112. package/standalone/revogr-row-headers2.js +1 -1
  113. package/standalone/revogr-scroll-virtual2.js +1 -1
  114. package/standalone/revogr-viewport-scroll2.js +1 -1
  115. package/standalone/selection.utils.js +1 -1
  116. package/standalone/throttle.js +1 -1
  117. package/standalone/toNumber.js +1 -1
  118. package/dist/cjs/viewport.helpers-BAovztDd.js +0 -58
  119. package/dist/esm/viewport.helpers-VXhsJZtn.js +0 -52
  120. package/dist/revo-grid/viewport.helpers-VXhsJZtn.js +0 -52
package/hydrate/index.js CHANGED
@@ -7646,7 +7646,8 @@ class FilterPanel {
7646
7646
  const options = [];
7647
7647
  const prop = this.changes.prop;
7648
7648
  const hidden = new Set();
7649
- Object.entries(this.filterItems).forEach(([_, values]) => {
7649
+ Object.keys(this.filterItems).forEach((prop) => {
7650
+ const values = this.filterItems[prop];
7650
7651
  values.forEach((filter) => {
7651
7652
  if (filter.hidden) {
7652
7653
  hidden.add(filter.type);
@@ -8729,11 +8730,11 @@ var COMPARE_PARTIAL_FLAG$4 = 1,
8729
8730
  var boolTag$1 = '[object Boolean]',
8730
8731
  dateTag$1 = '[object Date]',
8731
8732
  errorTag$1 = '[object Error]',
8732
- mapTag$3 = '[object Map]',
8733
+ mapTag$2 = '[object Map]',
8733
8734
  numberTag$1 = '[object Number]',
8734
8735
  regexpTag$1 = '[object RegExp]',
8735
- setTag$3 = '[object Set]',
8736
- stringTag$2 = '[object String]',
8736
+ setTag$2 = '[object Set]',
8737
+ stringTag$1 = '[object String]',
8737
8738
  symbolTag = '[object Symbol]';
8738
8739
 
8739
8740
  var arrayBufferTag$1 = '[object ArrayBuffer]',
@@ -8788,16 +8789,16 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
8788
8789
  return object.name == other.name && object.message == other.message;
8789
8790
 
8790
8791
  case regexpTag$1:
8791
- case stringTag$2:
8792
+ case stringTag$1:
8792
8793
  // Coerce regexes to strings and treat strings, primitives and objects,
8793
8794
  // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
8794
8795
  // for more details.
8795
8796
  return object == (other + '');
8796
8797
 
8797
- case mapTag$3:
8798
+ case mapTag$2:
8798
8799
  var convert = mapToArray;
8799
8800
 
8800
- case setTag$3:
8801
+ case setTag$2:
8801
8802
  var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
8802
8803
  convert || (convert = setToArray);
8803
8804
 
@@ -9138,12 +9139,12 @@ var argsTag$1 = '[object Arguments]',
9138
9139
  dateTag = '[object Date]',
9139
9140
  errorTag = '[object Error]',
9140
9141
  funcTag = '[object Function]',
9141
- mapTag$2 = '[object Map]',
9142
+ mapTag$1 = '[object Map]',
9142
9143
  numberTag = '[object Number]',
9143
9144
  objectTag$2 = '[object Object]',
9144
9145
  regexpTag = '[object RegExp]',
9145
- setTag$2 = '[object Set]',
9146
- stringTag$1 = '[object String]',
9146
+ setTag$1 = '[object Set]',
9147
+ stringTag = '[object String]',
9147
9148
  weakMapTag$1 = '[object WeakMap]';
9148
9149
 
9149
9150
  var arrayBufferTag = '[object ArrayBuffer]',
@@ -9169,9 +9170,9 @@ typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
9169
9170
  typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
9170
9171
  typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag] =
9171
9172
  typedArrayTags[errorTag] = typedArrayTags[funcTag] =
9172
- typedArrayTags[mapTag$2] = typedArrayTags[numberTag] =
9173
+ typedArrayTags[mapTag$1] = typedArrayTags[numberTag] =
9173
9174
  typedArrayTags[objectTag$2] = typedArrayTags[regexpTag] =
9174
- typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] =
9175
+ typedArrayTags[setTag$1] = typedArrayTags[stringTag] =
9175
9176
  typedArrayTags[weakMapTag$1] = false;
9176
9177
 
9177
9178
  /**
@@ -9521,10 +9522,10 @@ var Set$1 = getNative(root, 'Set');
9521
9522
  var WeakMap$1 = getNative(root, 'WeakMap');
9522
9523
 
9523
9524
  /** `Object#toString` result references. */
9524
- var mapTag$1 = '[object Map]',
9525
+ var mapTag = '[object Map]',
9525
9526
  objectTag$1 = '[object Object]',
9526
9527
  promiseTag = '[object Promise]',
9527
- setTag$1 = '[object Set]',
9528
+ setTag = '[object Set]',
9528
9529
  weakMapTag = '[object WeakMap]';
9529
9530
 
9530
9531
  var dataViewTag = '[object DataView]';
@@ -9547,9 +9548,9 @@ var getTag = baseGetTag;
9547
9548
 
9548
9549
  // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
9549
9550
  if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
9550
- (Map$1 && getTag(new Map$1) != mapTag$1) ||
9551
+ (Map$1 && getTag(new Map$1) != mapTag) ||
9551
9552
  (Promise$1 && getTag(Promise$1.resolve()) != promiseTag) ||
9552
- (Set$1 && getTag(new Set$1) != setTag$1) ||
9553
+ (Set$1 && getTag(new Set$1) != setTag) ||
9553
9554
  (WeakMap$1 && getTag(new WeakMap$1) != weakMapTag)) {
9554
9555
  getTag = function(value) {
9555
9556
  var result = baseGetTag(value),
@@ -9559,9 +9560,9 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
9559
9560
  if (ctorString) {
9560
9561
  switch (ctorString) {
9561
9562
  case dataViewCtorString: return dataViewTag;
9562
- case mapCtorString: return mapTag$1;
9563
+ case mapCtorString: return mapTag;
9563
9564
  case promiseCtorString: return promiseTag;
9564
- case setCtorString: return setTag$1;
9565
+ case setCtorString: return setTag;
9565
9566
  case weakMapCtorString: return weakMapTag;
9566
9567
  }
9567
9568
  }
@@ -10825,9 +10826,9 @@ function gatherTrimmedItems(trimmedItems) {
10825
10826
  * @param data - The data to set on the store.
10826
10827
  */
10827
10828
  function setStore(store, data) {
10828
- Object.entries(data).forEach(([key, value]) => {
10829
- store.set(key, value);
10830
- });
10829
+ for (const key of Object.keys(data)) {
10830
+ store.set(key, data[key]);
10831
+ }
10831
10832
  }
10832
10833
 
10833
10834
  /**
@@ -11338,21 +11339,6 @@ function getScrollbarSize(document) {
11338
11339
  // Return the calculated width of the scrollbar
11339
11340
  return scrollbarWidth;
11340
11341
  }
11341
- /* Scale a value between 2 ranges
11342
- *
11343
- * Sample:
11344
- * // 55 from a 0-100 range to a 0-1000 range (Ranges don't have to be positive)
11345
- * const n = scaleValue(55, [0,100], [0,1000]);
11346
- *
11347
- * Ranges of two values
11348
- * @from
11349
- * @to
11350
- *
11351
- * ~~ return value does the equivalent of Math.floor but faster.
11352
- */
11353
- function scaleValue(value, from, to) {
11354
- return ((to[1] - to[0]) * (value - from[0])) / (from[1] - from[0]) + to[0];
11355
- }
11356
11342
  /**
11357
11343
  * Async timeout
11358
11344
  */
@@ -11726,6 +11712,21 @@ function getItemByIndex(dimension, index) {
11726
11712
  return item;
11727
11713
  }
11728
11714
 
11715
+ function calculateRealSize({ count, originItemSize, sizes, }) {
11716
+ const safeCount = Math.max(0, count);
11717
+ let realSize = safeCount * originItemSize;
11718
+ for (let index in sizes) {
11719
+ const itemIndex = Number(index);
11720
+ if (!Number.isInteger(itemIndex) ||
11721
+ itemIndex < 0 ||
11722
+ itemIndex >= safeCount ||
11723
+ String(itemIndex) !== index) {
11724
+ continue;
11725
+ }
11726
+ realSize += sizes[index] - originItemSize;
11727
+ }
11728
+ return realSize;
11729
+ }
11729
11730
  /**
11730
11731
  * Plugin which recalculates realSize on changes of sizes, originItemSize and count
11731
11732
  */
@@ -11738,20 +11739,18 @@ const recalculateRealSizePlugin = (storeService) => {
11738
11739
  * Reacts on changes of count, sizes and originItemSize
11739
11740
  */
11740
11741
  set(k) {
11741
- var _a;
11742
11742
  switch (k) {
11743
11743
  case 'count':
11744
11744
  case 'sizes':
11745
11745
  case 'originItemSize': {
11746
11746
  // recalculate realSize
11747
- let realSize = 0;
11748
- const count = storeService.store.get('count');
11749
- const sizes = storeService.store.get('sizes');
11750
- const originItemSize = storeService.store.get('originItemSize');
11751
- for (let i = 0; i < count; i++) {
11752
- realSize += (_a = sizes[i]) !== null && _a !== void 0 ? _a : originItemSize;
11753
- }
11754
- storeService.setStore({ realSize });
11747
+ storeService.setStore({
11748
+ realSize: calculateRealSize({
11749
+ count: storeService.store.get('count'),
11750
+ sizes: storeService.store.get('sizes'),
11751
+ originItemSize: storeService.store.get('originItemSize'),
11752
+ }),
11753
+ });
11755
11754
  break;
11756
11755
  }
11757
11756
  }
@@ -11841,7 +11840,9 @@ function initialState$1() {
11841
11840
  // size which all items can take
11842
11841
  realSize: 0,
11843
11842
  // initial item size if it wasn't changed
11844
- originItemSize: 0
11843
+ originItemSize: 0,
11844
+ // logical-to-physical render offset used when scroll space is compressed
11845
+ renderOffset: 0
11845
11846
  });
11846
11847
  }
11847
11848
  class DimensionStore {
@@ -11873,7 +11874,7 @@ class DimensionStore {
11873
11874
  setStore(this.store, data);
11874
11875
  }
11875
11876
  drop() {
11876
- setStore(this.store, initialBase());
11877
+ setStore(this.store, Object.assign(Object.assign({}, initialBase()), { renderOffset: 0 }));
11877
11878
  }
11878
11879
  /**
11879
11880
  * Set custom dimension sizes and overwrite old
@@ -12044,6 +12045,15 @@ function isRangeSingleCell(a) {
12044
12045
  return a.x === a.x1 && a.y === a.y1;
12045
12046
  }
12046
12047
 
12048
+ function getViewportMaxCoordinate(dimension, viewportSize, frameOffset = 1) {
12049
+ if (!viewportSize || dimension.realSize <= viewportSize) {
12050
+ return 0;
12051
+ }
12052
+ return Math.max(0, dimension.realSize - viewportSize - dimension.originItemSize * frameOffset);
12053
+ }
12054
+ function clampViewportCoordinate(coordinate, dimension, viewportSize, frameOffset = 1) {
12055
+ return Math.min(Math.max(0, coordinate), getViewportMaxCoordinate(dimension, viewportSize, frameOffset));
12056
+ }
12047
12057
  /**
12048
12058
  * Update items based on new scroll position
12049
12059
  * If viewport wasn't changed fully simple recombination of positions
@@ -12309,6 +12319,8 @@ function initialState() {
12309
12319
  realCount: 0,
12310
12320
  // size of viewport in px
12311
12321
  clientSize: 0,
12322
+ // logical-to-physical render offset used when scroll space is compressed
12323
+ renderOffset: 0,
12312
12324
  };
12313
12325
  }
12314
12326
  /**
@@ -12344,21 +12356,8 @@ class ViewportStore {
12344
12356
  const outsize = singleOffsetInPx * 2;
12345
12357
  // math virtual size is based on visible area + 2 items outside of visible area
12346
12358
  const virtualSize = viewportSize + outsize;
12347
- // expected no scroll if real size less than virtual size, position is 0
12348
- let maxCoordinate = 0;
12349
- // if there is nodes outside of viewport, max coordinate has to be adjusted
12350
- if (dimension.realSize > viewportSize) {
12351
- // max coordinate is real size minus virtual/rendered space
12352
- maxCoordinate = dimension.realSize - viewportSize - singleOffsetInPx;
12353
- }
12354
- let pos = position;
12355
- // limit position to max and min coordinates
12356
- if (pos < 0) {
12357
- pos = 0;
12358
- }
12359
- else if (pos > maxCoordinate) {
12360
- pos = maxCoordinate;
12361
- }
12359
+ const maxCoordinate = getViewportMaxCoordinate(dimension, viewportSize, frameOffset);
12360
+ let pos = clampViewportCoordinate(position, dimension, viewportSize, frameOffset);
12362
12361
  // store last coordinate for further restore on redraw
12363
12362
  this.lastCoordinate = pos;
12364
12363
  // actual position is less than first item start based on offset
@@ -12495,11 +12494,12 @@ class RowOrderService {
12495
12494
  getRow(y, { el, rows }) {
12496
12495
  const { top } = el.getBoundingClientRect();
12497
12496
  const topRelative = y - top;
12498
- const rgRow = getItemByPosition(rows, topRelative);
12497
+ const rowOffset = rows.renderOffset || 0;
12498
+ const rgRow = getItemByPosition(rows, topRelative + rowOffset);
12499
12499
  const absolutePosition = {
12500
12500
  itemIndex: rgRow.itemIndex,
12501
- start: rgRow.start + top,
12502
- end: rgRow.end + top,
12501
+ start: rgRow.start - rowOffset + top,
12502
+ end: rgRow.end - rowOffset + top,
12503
12503
  };
12504
12504
  return absolutePosition;
12505
12505
  }
@@ -12508,8 +12508,8 @@ class RowOrderService {
12508
12508
  const { top, left } = el.getBoundingClientRect();
12509
12509
  const topRelative = y - top;
12510
12510
  const leftRelative = x - left;
12511
- const rgRow = getItemByPosition(rows, topRelative);
12512
- const rgCol = getItemByPosition(cols, leftRelative);
12511
+ const rgRow = getItemByPosition(rows, topRelative + (rows.renderOffset || 0));
12512
+ const rgCol = getItemByPosition(cols, leftRelative + (cols.renderOffset || 0));
12513
12513
  return { x: rgCol.itemIndex, y: rgRow.itemIndex };
12514
12514
  }
12515
12515
  }
@@ -13245,8 +13245,8 @@ function getCurrentCell({ x, y }, { el, rows, cols }) {
13245
13245
  cellX = width - 1;
13246
13246
  }
13247
13247
  // Get the row and column items based on the cell position
13248
- const rgRow = getItemByPosition(rows, cellY);
13249
- const rgCol = getItemByPosition(cols, cellX);
13248
+ const rgRow = getItemByPosition(rows, cellY + (rows.renderOffset || 0));
13249
+ const rgCol = getItemByPosition(cols, cellX + (cols.renderOffset || 0));
13250
13250
  // Set the row and column index to 0 if they are before the first item
13251
13251
  if (rgCol.itemIndex < 0) {
13252
13252
  rgCol.itemIndex = 0;
@@ -13316,10 +13316,12 @@ function styleByCellProps(styles) {
13316
13316
  };
13317
13317
  }
13318
13318
  function getCell({ x, y, x1, y1 }, dimensionRow, dimensionCol) {
13319
- const top = getItemByIndex(dimensionRow, y).start;
13320
- const left = getItemByIndex(dimensionCol, x).start;
13321
- const bottom = getItemByIndex(dimensionRow, y1).end;
13322
- const right = getItemByIndex(dimensionCol, x1).end;
13319
+ const rowOffset = dimensionRow.renderOffset || 0;
13320
+ const colOffset = dimensionCol.renderOffset || 0;
13321
+ const top = getItemByIndex(dimensionRow, y).start - rowOffset;
13322
+ const left = getItemByIndex(dimensionCol, x).start - colOffset;
13323
+ const bottom = getItemByIndex(dimensionRow, y1).end - rowOffset;
13324
+ const right = getItemByIndex(dimensionCol, x1).end - colOffset;
13323
13325
  return {
13324
13326
  left,
13325
13327
  right,
@@ -13350,9 +13352,29 @@ class KeyboardService {
13350
13352
  constructor(sv) {
13351
13353
  this.sv = sv;
13352
13354
  }
13355
+ /**
13356
+ * Appends printable key input that arrives after edit mode was requested
13357
+ * but before the editor input has mounted or received focus.
13358
+ */
13359
+ appendPendingEditValue(e) {
13360
+ if (isShortcutModifier(e) ||
13361
+ e.key.length !== 1 ||
13362
+ (e.target instanceof HTMLElement && isEditInput(e.target))) {
13363
+ return false;
13364
+ }
13365
+ const editCell = this.sv.selectionStore.get('edit');
13366
+ if (typeof (editCell === null || editCell === void 0 ? void 0 : editCell.val) !== 'string') {
13367
+ return false;
13368
+ }
13369
+ this.sv.selectionStore.set('edit', Object.assign(Object.assign({}, editCell), { val: `${editCell.val}${e.key}` }));
13370
+ return true;
13371
+ }
13353
13372
  async keyDown(e, canRange, isEditMode, { range, focus }) {
13354
13373
  // IF EDIT MODE
13355
13374
  if (isEditMode) {
13375
+ if (this.appendPendingEditValue(e)) {
13376
+ return;
13377
+ }
13356
13378
  switch (e.code) {
13357
13379
  case codesLetter.ESCAPE:
13358
13380
  this.sv.cancel();
@@ -13446,7 +13468,8 @@ class KeyboardService {
13446
13468
  }
13447
13469
  const eData = this.sv.getData();
13448
13470
  if (isMulti) {
13449
- if (isAfterLast(data.end, eData.lastCell) || isBeforeFirst(data.start)) {
13471
+ const isOutOfBounds = [data.start, data.end].some(cell => isAfterLast(cell, eData.lastCell) || isBeforeFirst(cell));
13472
+ if (isOutOfBounds) {
13450
13473
  return false;
13451
13474
  }
13452
13475
  const range = getRange(data.start, data.end);
@@ -14688,6 +14711,87 @@ class DataProvider {
14688
14711
  }
14689
14712
  }
14690
14713
 
14714
+ const FALLBACK_MAX_SCROLL_SIZE = 16000000;
14715
+ const SCROLL_SIZE_GUARD = 1000000;
14716
+ let detectedMaxScrollSize;
14717
+ function getMaxScrollSize(doc = typeof document === 'undefined' ? undefined : document) {
14718
+ if (typeof detectedMaxScrollSize === 'number') {
14719
+ return detectedMaxScrollSize;
14720
+ }
14721
+ const body = doc === null || doc === void 0 ? void 0 : doc.body;
14722
+ if (body) {
14723
+ const ownerDocument = body.ownerDocument;
14724
+ const element = ownerDocument.createElement('div');
14725
+ element.style.cssText = [
14726
+ 'height:1px',
14727
+ 'left:-10000px',
14728
+ 'overflow:scroll',
14729
+ 'position:absolute',
14730
+ 'top:-10000px',
14731
+ 'visibility:hidden',
14732
+ 'width:1px',
14733
+ ].join(';');
14734
+ const content = ownerDocument.createElement('div');
14735
+ content.style.height = `${FALLBACK_MAX_SCROLL_SIZE * 4}px`;
14736
+ element.appendChild(content);
14737
+ body.appendChild(element);
14738
+ detectedMaxScrollSize = Math.max(0, Math.min(element.scrollHeight, FALLBACK_MAX_SCROLL_SIZE * 4) - SCROLL_SIZE_GUARD);
14739
+ element.remove();
14740
+ if (detectedMaxScrollSize > SCROLL_SIZE_GUARD) {
14741
+ return detectedMaxScrollSize;
14742
+ }
14743
+ detectedMaxScrollSize = FALLBACK_MAX_SCROLL_SIZE;
14744
+ return detectedMaxScrollSize;
14745
+ }
14746
+ return FALLBACK_MAX_SCROLL_SIZE;
14747
+ }
14748
+ function getScrollDimension({ contentSize, clientSize, virtualSize = 0, maxScrollSize = getMaxScrollSize(), }) {
14749
+ const safeContentSize = Math.max(0, maxScrollSize - SCROLL_SIZE_GUARD);
14750
+ const size = Math.max(0, contentSize);
14751
+ const client = Math.max(0, clientSize);
14752
+ const viewport = Math.max(0, virtualSize || client);
14753
+ const logicalScrollSize = Math.max(0, size - viewport);
14754
+ const maxPhysicalScrollSize = Math.max(0, safeContentSize - client);
14755
+ const physicalScrollSize = Math.min(logicalScrollSize, maxPhysicalScrollSize);
14756
+ const physicalContentSize = client + physicalScrollSize;
14757
+ const isCompressed = logicalScrollSize > physicalScrollSize && physicalScrollSize > 0;
14758
+ const clampLogical = (coordinate) => Math.min(Math.max(0, coordinate || 0), logicalScrollSize);
14759
+ const clampPhysical = (coordinate) => Math.min(Math.max(0, coordinate || 0), physicalScrollSize);
14760
+ const toLogicalCoordinate = (coordinate) => {
14761
+ if (!logicalScrollSize || !physicalScrollSize) {
14762
+ return 0;
14763
+ }
14764
+ if (!isCompressed) {
14765
+ return clampLogical(coordinate);
14766
+ }
14767
+ return clampLogical((clampPhysical(coordinate) / physicalScrollSize) * logicalScrollSize);
14768
+ };
14769
+ const toPhysicalCoordinate = (coordinate) => {
14770
+ if (!logicalScrollSize || !physicalScrollSize) {
14771
+ return 0;
14772
+ }
14773
+ if (!isCompressed) {
14774
+ return clampPhysical(coordinate);
14775
+ }
14776
+ return clampPhysical((clampLogical(coordinate) / logicalScrollSize) * physicalScrollSize);
14777
+ };
14778
+ return {
14779
+ contentSize: size,
14780
+ clientSize: client,
14781
+ viewportSize: viewport,
14782
+ physicalContentSize,
14783
+ logicalScrollSize,
14784
+ physicalScrollSize,
14785
+ isCompressed,
14786
+ toLogicalCoordinate,
14787
+ toPhysicalCoordinate,
14788
+ getRenderOffset(coordinate) {
14789
+ const logical = clampLogical(coordinate);
14790
+ return logical - toPhysicalCoordinate(logical);
14791
+ },
14792
+ };
14793
+ }
14794
+
14691
14795
  /**
14692
14796
  * Dimension provider
14693
14797
  * Stores dimension information and custom sizes
@@ -14825,6 +14929,20 @@ class DimensionProvider {
14825
14929
  }
14826
14930
  setViewPortCoordinate({ type, coordinate = this.viewports.stores[type].lastCoordinate, force = false, }) {
14827
14931
  const dimension = this.stores[type].getCurrentState();
14932
+ const viewport = this.viewports.stores[type].store;
14933
+ const clientSize = viewport.get('clientSize');
14934
+ const viewportSize = viewport.get('virtualSize');
14935
+ const scrollDimension = getScrollDimension({
14936
+ contentSize: dimension.realSize,
14937
+ clientSize,
14938
+ virtualSize: viewportSize,
14939
+ });
14940
+ const renderCoordinate = clampViewportCoordinate(coordinate, dimension, viewportSize);
14941
+ const renderOffset = clientSize && viewportSize
14942
+ ? scrollDimension.getRenderOffset(renderCoordinate)
14943
+ : 0;
14944
+ this.stores[type].setStore({ renderOffset });
14945
+ this.viewports.stores[type].setViewport({ renderOffset });
14828
14946
  this.viewports.stores[type].setViewPortCoordinate(coordinate, dimension, force);
14829
14947
  }
14830
14948
  getViewPortPos(e) {
@@ -15521,17 +15639,24 @@ class FilterPlugin extends BasePlugin {
15521
15639
  }
15522
15640
  }
15523
15641
  if (config.collection) {
15524
- const filtersWithFilterFunctionPresent = Object.entries(config.collection).filter(([, item]) => this.filterFunctionsIndexedByType[item.type]);
15525
- this.filterCollection = Object.fromEntries(filtersWithFilterFunctionPresent);
15642
+ const filterCollection = {};
15643
+ for (const prop of Object.keys(config.collection)) {
15644
+ const item = config.collection[prop];
15645
+ if (this.filterFunctionsIndexedByType[item.type]) {
15646
+ filterCollection[prop] = item;
15647
+ }
15648
+ }
15649
+ this.filterCollection = filterCollection;
15526
15650
  }
15527
15651
  else {
15528
15652
  this.filterCollection = {};
15529
15653
  }
15530
15654
  if (config.localization) {
15531
15655
  if (config.localization.filterNames) {
15532
- Object.entries(config.localization.filterNames).forEach(([k, v]) => {
15656
+ const filterNames = config.localization.filterNames;
15657
+ Object.keys(filterNames).forEach((k) => {
15533
15658
  if (this.filterNameIndexByType[k] != void 0) {
15534
- this.filterNameIndexByType[k] = v;
15659
+ this.filterNameIndexByType[k] = filterNames[k];
15535
15660
  }
15536
15661
  });
15537
15662
  }
@@ -15761,165 +15886,174 @@ function allAndConditionsSatisfied(pendingResults) {
15761
15886
  return !pendingResults.includes(true);
15762
15887
  }
15763
15888
 
15764
- /** `Object#toString` result references. */
15765
- var stringTag = '[object String]';
15766
-
15767
15889
  /**
15768
- * Checks if `value` is classified as a `String` primitive or object.
15890
+ * Checks whether a sorting map contains at least one active order.
15769
15891
  *
15770
- * @static
15771
- * @since 0.1.0
15772
- * @memberOf _
15773
- * @category Lang
15774
- * @param {*} value The value to check.
15775
- * @returns {boolean} Returns `true` if `value` is a string, else `false`.
15776
- * @example
15777
- *
15778
- * _.isString('abc');
15779
- * // => true
15780
- *
15781
- * _.isString(1);
15782
- * // => false
15892
+ * Empty maps and properties with `undefined` order are treated as inactive.
15783
15893
  */
15784
- function isString(value) {
15785
- return typeof value == 'string' ||
15786
- (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
15894
+ function hasActiveSorting(sorting) {
15895
+ for (const prop of Object.keys(sorting || {})) {
15896
+ if (sorting === null || sorting === void 0 ? void 0 : sorting[prop]) {
15897
+ return true;
15898
+ }
15899
+ }
15900
+ return false;
15787
15901
  }
15788
-
15789
15902
  /**
15790
- * Gets the size of an ASCII `string`.
15791
- *
15792
- * @private
15793
- * @param {string} string The string inspect.
15794
- * @returns {number} Returns the string size.
15903
+ * Compares column properties after object-key coercion.
15795
15904
  */
15796
- var asciiSize = baseProperty('length');
15797
-
15798
- /** Used to compose unicode character classes. */
15799
- var rsAstralRange$1 = '\\ud800-\\udfff',
15800
- rsComboMarksRange$1 = '\\u0300-\\u036f',
15801
- reComboHalfMarksRange$1 = '\\ufe20-\\ufe2f',
15802
- rsComboSymbolsRange$1 = '\\u20d0-\\u20ff',
15803
- rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1,
15804
- rsVarRange$1 = '\\ufe0e\\ufe0f';
15805
-
15806
- /** Used to compose unicode capture groups. */
15807
- var rsZWJ$1 = '\\u200d';
15808
-
15809
- /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
15810
- var reHasUnicode = RegExp('[' + rsZWJ$1 + rsAstralRange$1 + rsComboRange$1 + rsVarRange$1 + ']');
15811
-
15905
+ function isSameColumnProp(a, b) {
15906
+ return String(a) === String(b);
15907
+ }
15812
15908
  /**
15813
- * Checks if `string` contains Unicode symbols.
15814
- *
15815
- * @private
15816
- * @param {string} string The string to inspect.
15817
- * @returns {boolean} Returns `true` if a symbol is found, else `false`.
15909
+ * Returns active sorting properties in explicit priority order.
15818
15910
  */
15819
- function hasUnicode(string) {
15820
- return reHasUnicode.test(string);
15821
- }
15822
-
15823
- /** Used to compose unicode character classes. */
15824
- var rsAstralRange = '\\ud800-\\udfff',
15825
- rsComboMarksRange = '\\u0300-\\u036f',
15826
- reComboHalfMarksRange = '\\ufe20-\\ufe2f',
15827
- rsComboSymbolsRange = '\\u20d0-\\u20ff',
15828
- rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
15829
- rsVarRange = '\\ufe0e\\ufe0f';
15830
-
15831
- /** Used to compose unicode capture groups. */
15832
- var rsAstral = '[' + rsAstralRange + ']',
15833
- rsCombo = '[' + rsComboRange + ']',
15834
- rsFitz = '\\ud83c[\\udffb-\\udfff]',
15835
- rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
15836
- rsNonAstral = '[^' + rsAstralRange + ']',
15837
- rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
15838
- rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
15839
- rsZWJ = '\\u200d';
15840
-
15841
- /** Used to compose unicode regexes. */
15842
- var reOptMod = rsModifier + '?',
15843
- rsOptVar = '[' + rsVarRange + ']?',
15844
- rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
15845
- rsSeq = rsOptVar + reOptMod + rsOptJoin,
15846
- rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
15847
-
15848
- /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
15849
- var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
15850
-
15911
+ function getActiveSortingProps(sorting, sortingOrder) {
15912
+ const activeProps = [];
15913
+ const add = (prop) => {
15914
+ if ((sorting === null || sorting === void 0 ? void 0 : sorting[prop]) && !activeProps.some(active => isSameColumnProp(active, prop))) {
15915
+ activeProps.push(prop);
15916
+ }
15917
+ };
15918
+ sortingOrder === null || sortingOrder === void 0 ? void 0 : sortingOrder.forEach(add);
15919
+ Object.keys(sorting || {}).forEach(add);
15920
+ return activeProps;
15921
+ }
15851
15922
  /**
15852
- * Gets the size of a Unicode `string`.
15923
+ * Returns one-based additive sorting rank for a column.
15853
15924
  *
15854
- * @private
15855
- * @param {string} string The string inspect.
15856
- * @returns {number} Returns the string size.
15925
+ * A single active sort does not need a visible rank, so it returns undefined.
15857
15926
  */
15858
- function unicodeSize(string) {
15859
- var result = reUnicode.lastIndex = 0;
15860
- while (reUnicode.test(string)) {
15861
- ++result;
15862
- }
15863
- return result;
15927
+ function getSortingIndex(sorting, prop, sortingOrder) {
15928
+ const activeProps = getActiveSortingProps(sorting, sortingOrder);
15929
+ if (activeProps.length <= 1) {
15930
+ return undefined;
15931
+ }
15932
+ const index = activeProps.findIndex(active => isSameColumnProp(active, prop));
15933
+ return index >= 0 ? index + 1 : undefined;
15864
15934
  }
15865
-
15866
15935
  /**
15867
- * Gets the number of symbols in `string`.
15936
+ * Collects only active comparator functions from a sorting function map.
15868
15937
  *
15869
- * @private
15870
- * @param {string} string The string to inspect.
15871
- * @returns {number} Returns the string size.
15938
+ * This keeps undefined comparator entries from triggering sorting work.
15872
15939
  */
15873
- function stringSize(string) {
15874
- return hasUnicode(string)
15875
- ? unicodeSize(string)
15876
- : asciiSize(string);
15940
+ function activeSortingEntries(sortingFunc = {}, sortingOrder) {
15941
+ const entries = [];
15942
+ const add = (prop) => {
15943
+ const cmp = sortingFunc[prop];
15944
+ if (typeof cmp === 'function' && !entries.some(([active]) => isSameColumnProp(active, prop))) {
15945
+ entries.push([prop, cmp]);
15946
+ }
15947
+ };
15948
+ sortingOrder === null || sortingOrder === void 0 ? void 0 : sortingOrder.forEach(add);
15949
+ Object.keys(sortingFunc).forEach(add);
15950
+ return entries;
15877
15951
  }
15878
-
15879
- /** `Object#toString` result references. */
15880
- var mapTag = '[object Map]',
15881
- setTag = '[object Set]';
15882
-
15883
15952
  /**
15884
- * Gets the size of `collection` by returning its length for array-like
15885
- * values or the number of own enumerable string keyed properties for objects.
15886
- *
15887
- * @static
15888
- * @memberOf _
15889
- * @since 0.1.0
15890
- * @category Collection
15891
- * @param {Array|Object|string} collection The collection to inspect.
15892
- * @returns {number} Returns the collection size.
15893
- * @example
15894
- *
15895
- * _.size([1, 2, 3]);
15896
- * // => 3
15953
+ * Reads and normalizes a value for the built-in default comparer.
15954
+ */
15955
+ function getDefaultCompareValue(item, prop, column) {
15956
+ const aRaw = column ? getCellRaw(item, column) : item === null || item === void 0 ? void 0 : item[prop];
15957
+ return typeof aRaw === 'number' ? aRaw : aRaw === null || aRaw === void 0 ? void 0 : aRaw.toString().toLowerCase();
15958
+ }
15959
+ function isEmptyCompareValue(value) {
15960
+ return value === '' || value === null || value === undefined;
15961
+ }
15962
+ /**
15963
+ * Compares two already-normalized default comparer values.
15964
+ */
15965
+ function compareValues(av, bv) {
15966
+ if (av === bv) {
15967
+ return 0;
15968
+ }
15969
+ const aEmpty = isEmptyCompareValue(av);
15970
+ const bEmpty = isEmptyCompareValue(bv);
15971
+ if (aEmpty || bEmpty) {
15972
+ if (aEmpty && bEmpty) {
15973
+ return 0;
15974
+ }
15975
+ return aEmpty ? -1 : 1;
15976
+ }
15977
+ if (av > bv) {
15978
+ return 1;
15979
+ }
15980
+ return -1;
15981
+ }
15982
+ /**
15983
+ * Sorts indexes by precomputed values for default column comparers.
15897
15984
  *
15898
- * _.size({ 'a': 1, 'b': 2 });
15899
- * // => 2
15985
+ * This avoids repeatedly parsing the same cell value during large default
15986
+ * sorts while preserving normal multi-column ordering.
15987
+ */
15988
+ function sortIndexByDefaultComparers(indexes, source, entries, sorting, sortingColumns) {
15989
+ const prepared = entries.map(([prop]) => {
15990
+ const values = [];
15991
+ const column = sortingColumns[prop];
15992
+ for (const index of indexes) {
15993
+ values[index] = getDefaultCompareValue(source[index], prop, column);
15994
+ }
15995
+ return {
15996
+ order: sorting[prop],
15997
+ values,
15998
+ };
15999
+ });
16000
+ return indexes.sort((a, b) => {
16001
+ for (const { order, values } of prepared) {
16002
+ const sorted = compareValues(values[a], values[b]);
16003
+ if (sorted) {
16004
+ return order === 'desc' ? -sorted : sorted;
16005
+ }
16006
+ }
16007
+ return 0;
16008
+ });
16009
+ }
16010
+ /**
16011
+ * Detects whether the optimized default-comparer path can be used.
15900
16012
  *
15901
- * _.size('pebbles');
15902
- * // => 7
16013
+ * Grouped rows and custom `cellCompare` functions stay on the legacy
16014
+ * comparator path to preserve their exact behavior.
15903
16015
  */
15904
- function size(collection) {
15905
- if (collection == null) {
15906
- return 0;
15907
- }
15908
- if (isArrayLike(collection)) {
15909
- return isString(collection) ? stringSize(collection) : collection.length;
15910
- }
15911
- var tag = getTag(collection);
15912
- if (tag == mapTag || tag == setTag) {
15913
- return collection.size;
15914
- }
15915
- return baseKeys(collection).length;
16016
+ function canUseDefaultCompareFastPath(entries, indexes, source, sorting, sortingColumns) {
16017
+ return !indexes.some(index => isGrouping(source[index])) && !!sorting && !!sortingColumns && entries.every(([prop]) => {
16018
+ const order = sorting[prop];
16019
+ const column = sortingColumns[prop];
16020
+ return !!order && !(column === null || column === void 0 ? void 0 : column.cellCompare);
16021
+ });
15916
16022
  }
15917
-
15918
- function sortIndexByItems(indexes, source, sortingFunc = {}) {
16023
+ /**
16024
+ * Group placeholder rows are generated for their grouping column. If sorting is
16025
+ * requested for another column, the grouped source must be unwrapped first.
16026
+ */
16027
+ function hasGroupingRowsForOtherSorting(entries, indexes, source) {
16028
+ return indexes.some(index => {
16029
+ const item = source[index];
16030
+ return isGrouping(item) && !entries.some(([prop]) => isSameColumnProp(item[GROUP_COLUMN_PROP], prop));
16031
+ });
16032
+ }
16033
+ /**
16034
+ * Sorts row indexes against a source collection.
16035
+ *
16036
+ * @param indexes - Current proxy row indexes to sort.
16037
+ * @param source - Full source collection addressed by the indexes.
16038
+ * @param sortingFunc - Comparator functions by column property.
16039
+ * @param sorting - Active sorting order by column property.
16040
+ * @param sortingColumns - Column metadata by property for default-comparer optimization.
16041
+ * @param sortingOrder - Active sorting priority in click/config insertion order.
16042
+ * @returns Sorted proxy indexes. With no sorting function keys, returns source-order indexes.
16043
+ */
16044
+ function sortIndexByItems(indexes, source, sortingFunc = {}, sorting, sortingColumns, sortingOrder) {
16045
+ const hasSortingKeys = Object.keys(sortingFunc).length > 0;
16046
+ const sortingEntries = activeSortingEntries(sortingFunc, sortingOrder);
15919
16047
  // if no sorting - return unsorted indexes
15920
- if (Object.entries(sortingFunc).length === 0) {
16048
+ if (sortingEntries.length === 0) {
15921
16049
  // Unsorted indexes
15922
- return [...Array(indexes.length).keys()];
16050
+ return hasSortingKeys ? indexes : [...new Array(indexes.length).keys()];
16051
+ }
16052
+ if (hasGroupingRowsForOtherSorting(sortingEntries, indexes, source)) {
16053
+ return indexes;
16054
+ }
16055
+ if (canUseDefaultCompareFastPath(sortingEntries, indexes, source, sorting, sortingColumns)) {
16056
+ return sortIndexByDefaultComparers(indexes, source, sortingEntries, sorting, sortingColumns);
15923
16057
  }
15924
16058
  //
15925
16059
  /**
@@ -15929,15 +16063,15 @@ function sortIndexByItems(indexes, source, sortingFunc = {}) {
15929
16063
  return indexes.sort((a, b) => {
15930
16064
  const itemA = source[a];
15931
16065
  const itemB = source[b];
15932
- for (const [prop, cmp] of Object.entries(sortingFunc)) {
16066
+ for (const [prop, cmp] of sortingEntries) {
15933
16067
  if (isGrouping(itemA)) {
15934
- if (itemA['__rvgr-prop'] !== prop) {
15935
- return 0;
16068
+ if (!isSameColumnProp(itemA[GROUP_COLUMN_PROP], prop)) {
16069
+ return a - b;
15936
16070
  }
15937
16071
  }
15938
16072
  if (isGrouping(itemB)) {
15939
- if (itemB['__rvgr-prop'] !== prop) {
15940
- return 0;
16073
+ if (!isSameColumnProp(itemB[GROUP_COLUMN_PROP], prop)) {
16074
+ return a - b;
15941
16075
  }
15942
16076
  }
15943
16077
  /**
@@ -15957,13 +16091,7 @@ function defaultCellCompare(prop, a, b) {
15957
16091
  const bRaw = this.column ? getCellRaw(b, this.column) : b === null || b === void 0 ? void 0 : b[prop];
15958
16092
  const av = typeof aRaw === 'number' ? aRaw : aRaw === null || aRaw === void 0 ? void 0 : aRaw.toString().toLowerCase();
15959
16093
  const bv = typeof bRaw === 'number' ? bRaw : bRaw === null || bRaw === void 0 ? void 0 : bRaw.toString().toLowerCase();
15960
- if (av === bv) {
15961
- return 0;
15962
- }
15963
- if (av > bv) {
15964
- return 1;
15965
- }
15966
- return -1;
16094
+ return compareValues(av, bv);
15967
16095
  }
15968
16096
  function descCellCompare(cmp) {
15969
16097
  return (prop, a, b) => {
@@ -15992,11 +16120,32 @@ function getComparer(column, order) {
15992
16120
  return undefined;
15993
16121
  }
15994
16122
 
16123
+ /**
16124
+ * Renders sorting direction and optional additive sorting rank.
16125
+ */
15995
16126
  const SortingSign = ({ column }) => {
15996
16127
  var _a;
15997
- return hAsync("i", { class: (_a = column === null || column === void 0 ? void 0 : column.order) !== null && _a !== void 0 ? _a : 'sort-off' });
16128
+ const indicatorAttrs = { class: 'sort-indicator' };
16129
+ const iconAttrs = { class: (_a = column === null || column === void 0 ? void 0 : column.order) !== null && _a !== void 0 ? _a : 'sort-off' };
16130
+ const orderIndexAttrs = { class: 'sort-order-index' };
16131
+ return (hAsync("span", Object.assign({}, indicatorAttrs), hAsync("i", Object.assign({}, iconAttrs)), (column === null || column === void 0 ? void 0 : column.sortIndex) ? (hAsync("sup", Object.assign({}, orderIndexAttrs), column.sortIndex)) : null));
15998
16132
  };
15999
16133
 
16134
+ function getSortableRowIndexes(indexes, source) {
16135
+ return indexes.filter(index => !isGrouping(source[index]));
16136
+ }
16137
+ function mergeSortedRowsWithGroups(indexes, source, sortedRows) {
16138
+ if (sortedRows.length === indexes.length) {
16139
+ return sortedRows;
16140
+ }
16141
+ let rowIndex = 0;
16142
+ return indexes.map(index => {
16143
+ if (isGrouping(source[index])) {
16144
+ return index;
16145
+ }
16146
+ return sortedRows[rowIndex++];
16147
+ });
16148
+ }
16000
16149
  /**
16001
16150
  * Lifecycle
16002
16151
  * 1. @event `beforesorting` - Triggered when sorting just starts. Nothing has happened yet. This can be triggered from a column or from the source. If the type is from rows, the column will be undefined.
@@ -16011,54 +16160,37 @@ class SortingPlugin extends BasePlugin {
16011
16160
  super(revogrid, providers);
16012
16161
  this.revogrid = revogrid;
16013
16162
  /**
16014
- * Delayed sorting promise
16163
+ * Delayed sorting promise registered in the grid render job queue.
16015
16164
  */
16016
16165
  this.sortingPromise = null;
16017
16166
  /**
16018
- * We need to sort only so often
16167
+ * Debounced sorting entry point.
16168
+ *
16169
+ * Sorting can be requested by column changes, source changes, and header
16170
+ * clicks in quick succession, so the actual sort is delayed and coalesced.
16019
16171
  */
16020
- this.postponeSort = debounce$1((order, comparison, ignoreViewportUpdate) => this.runSorting(order, comparison, ignoreViewportUpdate), 50);
16021
- const setConfig = (cfg) => {
16022
- var _a;
16023
- if (cfg) {
16024
- const sortingFunc = {};
16025
- const order = {};
16026
- (_a = cfg.columns) === null || _a === void 0 ? void 0 : _a.forEach(col => {
16027
- sortingFunc[col.prop] = getComparer(col, col.order);
16028
- order[col.prop] = col.order;
16029
- });
16030
- if (cfg.additive) {
16031
- this.sorting = Object.assign(Object.assign({}, this.sorting), order);
16032
- this.sortingFunc = Object.assign(Object.assign({}, this.sortingFunc), sortingFunc);
16033
- }
16034
- else {
16035
- // // set sorting
16036
- this.sorting = order;
16037
- this.sortingFunc = sortingFunc;
16038
- }
16039
- }
16040
- };
16041
- setConfig(config);
16172
+ this.postponeSort = debounce$1((order, comparison, sortingColumns, sortingOrder, ignoreViewportUpdate) => this.runSorting(order, comparison, sortingColumns, sortingOrder, ignoreViewportUpdate), 50);
16173
+ this.applySortingConfig(config);
16042
16174
  this.addEventListener('sortingconfigchanged', ({ detail }) => {
16043
16175
  config = detail;
16044
- setConfig(detail);
16045
- this.startSorting(this.sorting, this.sortingFunc);
16176
+ this.applySortingConfig(detail);
16177
+ this.startSorting(this.sorting, this.sortingFunc, this.sortingColumns, this.sortingOrder);
16046
16178
  });
16047
16179
  this.addEventListener('beforeheaderrender', ({ detail, }) => {
16048
16180
  var _a;
16049
16181
  const { data: column } = detail;
16050
16182
  if (column.sortable) {
16051
- detail.data = Object.assign(Object.assign({}, column), { order: (_a = this.sorting) === null || _a === void 0 ? void 0 : _a[column.prop] });
16183
+ detail.data = Object.assign(Object.assign({}, column), { order: (_a = this.sorting) === null || _a === void 0 ? void 0 : _a[column.prop], sortIndex: getSortingIndex(this.sorting, column.prop, this.sortingOrder) });
16052
16184
  }
16053
16185
  });
16054
16186
  this.addEventListener('beforeanysource', ({ detail: { type }, }) => {
16055
16187
  // if sorting was provided - sort data
16056
- if (!!this.sorting && this.sortingFunc) {
16188
+ if (hasActiveSorting(this.sorting) && this.sortingFunc) {
16057
16189
  const event = this.emit('beforesourcesortingapply', { type, sorting: this.sorting });
16058
16190
  if (event.defaultPrevented) {
16059
16191
  return;
16060
16192
  }
16061
- this.startSorting(this.sorting, this.sortingFunc);
16193
+ this.startSorting(this.sorting, this.sortingFunc, this.sortingColumns, this.sortingOrder);
16062
16194
  }
16063
16195
  });
16064
16196
  this.addEventListener('aftercolumnsset', ({ detail: { order }, }) => {
@@ -16068,13 +16200,24 @@ class SortingPlugin extends BasePlugin {
16068
16200
  }
16069
16201
  const columns = this.providers.column.getColumns();
16070
16202
  const sortingFunc = {};
16203
+ const sortingColumns = {};
16204
+ const sortingOrder = [];
16205
+ const sorting = {};
16071
16206
  for (let prop in order) {
16072
- const cmp = getComparer(getColumnByProp(columns, prop), order[prop]);
16073
- sortingFunc[prop] = cmp;
16207
+ if (order[prop]) {
16208
+ const column = getColumnByProp(columns, prop);
16209
+ const cmp = getComparer(column, order[prop]);
16210
+ sorting[prop] = order[prop];
16211
+ sortingFunc[prop] = cmp;
16212
+ sortingColumns[prop] = column;
16213
+ sortingOrder.push(prop);
16214
+ }
16074
16215
  }
16075
16216
  // set sorting
16076
- this.sorting = order;
16077
- this.sortingFunc = order && sortingFunc;
16217
+ this.sorting = hasActiveSorting(sorting) ? sorting : undefined;
16218
+ this.sortingFunc = this.sorting ? sortingFunc : undefined;
16219
+ this.sortingColumns = this.sorting ? sortingColumns : undefined;
16220
+ this.sortingOrder = this.sorting ? sortingOrder : undefined;
16078
16221
  });
16079
16222
  this.addEventListener('beforeheaderclick', (e) => {
16080
16223
  var _a, _b, _c, _d;
@@ -16088,23 +16231,89 @@ class SortingPlugin extends BasePlugin {
16088
16231
  });
16089
16232
  }
16090
16233
  /**
16091
- * Entry point for sorting, waits for all delays, registers jobs
16234
+ * Creates mutable sorting maps from current state when additive sorting is requested.
16235
+ */
16236
+ createSortingState(additive) {
16237
+ var _a;
16238
+ return {
16239
+ sorting: additive ? Object.assign({}, this.sorting) : {},
16240
+ sortingFunc: additive ? Object.assign({}, this.sortingFunc) : {},
16241
+ sortingColumns: additive ? Object.assign({}, this.sortingColumns) : {},
16242
+ sortingOrder: additive ? [...((_a = this.sortingOrder) !== null && _a !== void 0 ? _a : [])] : [],
16243
+ };
16244
+ }
16245
+ /**
16246
+ * Stores normalized sorting state, clearing inactive empty maps.
16092
16247
  */
16093
- startSorting(order, sortingFunc, ignoreViewportUpdate) {
16248
+ setSortingState({ sorting, sortingFunc, sortingColumns, sortingOrder, }) {
16249
+ this.sorting = hasActiveSorting(sorting) ? sorting : undefined;
16250
+ this.sortingFunc = this.sorting ? sortingFunc : undefined;
16251
+ this.sortingColumns = this.sorting ? sortingColumns : undefined;
16252
+ this.sortingOrder = this.sorting ? sortingOrder : undefined;
16253
+ }
16254
+ /**
16255
+ * Adds or replaces a column in a sorting state.
16256
+ */
16257
+ setColumnSorting(state, prop, order, cmp, column) {
16258
+ state.sorting[prop] = order;
16259
+ state.sortingFunc[prop] = cmp;
16260
+ state.sortingColumns[prop] = column;
16261
+ if (!state.sortingOrder.some(sortingProp => String(sortingProp) === String(prop))) {
16262
+ state.sortingOrder.push(prop);
16263
+ }
16264
+ }
16265
+ /**
16266
+ * Removes a column from a sorting state.
16267
+ */
16268
+ clearColumnSorting(state, prop) {
16269
+ delete state.sorting[prop];
16270
+ delete state.sortingFunc[prop];
16271
+ delete state.sortingColumns[prop];
16272
+ const index = state.sortingOrder.findIndex(sortingProp => String(sortingProp) === String(prop));
16273
+ if (index >= 0) {
16274
+ state.sortingOrder.splice(index, 1);
16275
+ }
16276
+ }
16277
+ /**
16278
+ * Normalizes external sorting configuration into internal order,
16279
+ * comparator, and column metadata maps.
16280
+ */
16281
+ applySortingConfig(cfg) {
16282
+ var _a;
16283
+ if (!cfg) {
16284
+ return;
16285
+ }
16286
+ const state = this.createSortingState(cfg.additive);
16287
+ (_a = cfg.columns) === null || _a === void 0 ? void 0 : _a.forEach(col => {
16288
+ if (col.order) {
16289
+ this.setColumnSorting(state, col.prop, col.order, getComparer(col, col.order), col);
16290
+ return;
16291
+ }
16292
+ this.clearColumnSorting(state, col.prop);
16293
+ });
16294
+ this.setSortingState(state);
16295
+ }
16296
+ startSorting(order, sortingFunc, sortingColumns, sortingOrder, ignoreViewportUpdate) {
16094
16297
  if (!this.sortingPromise) {
16095
16298
  // add job before render
16096
16299
  this.revogrid.jobsBeforeRender.push(new Promise(resolve => {
16097
16300
  this.sortingPromise = resolve;
16098
16301
  }));
16099
16302
  }
16100
- this.postponeSort(order, sortingFunc, ignoreViewportUpdate);
16303
+ if (typeof sortingColumns === 'boolean') {
16304
+ this.postponeSort(order, sortingFunc, undefined, undefined, sortingColumns);
16305
+ return;
16306
+ }
16307
+ this.postponeSort(order, sortingFunc, sortingColumns, sortingOrder, ignoreViewportUpdate);
16101
16308
  }
16102
16309
  /**
16103
- * Apply sorting to data on header click
16104
- * If additive - add to existing sorting, multiple columns can be sorted
16310
+ * Applies sorting requested by a sortable header click.
16311
+ *
16312
+ * @param column - Column that initiated sorting.
16313
+ * @param additive - If true, add/remove this column from the current multi-sort state.
16105
16314
  */
16106
16315
  headerclick(column, additive) {
16107
- var _a, _b, _c;
16316
+ var _a;
16108
16317
  const columnProp = column.prop;
16109
16318
  let order = getNextOrder((_a = this.sorting) === null || _a === void 0 ? void 0 : _a[columnProp]);
16110
16319
  const beforeEvent = this.emit('beforesorting', { column, order, additive });
@@ -16122,52 +16331,59 @@ class SortingPlugin extends BasePlugin {
16122
16331
  return;
16123
16332
  }
16124
16333
  const cmp = getComparer(beforeApplyEvent.detail.column, beforeApplyEvent.detail.order);
16125
- if (beforeApplyEvent.detail.additive && this.sorting) {
16126
- const sorting = {};
16127
- const sortingFunc = {};
16128
- if (columnProp in sorting && size(sorting) > 1 && order === undefined) {
16129
- delete sorting[columnProp];
16130
- delete sortingFunc[columnProp];
16131
- }
16132
- else {
16133
- sorting[columnProp] = order;
16134
- sortingFunc[columnProp] = cmp;
16135
- }
16136
- this.sorting = Object.assign(Object.assign({}, this.sorting), sorting);
16137
- // extend sorting function with new sorting for multiple columns sorting
16138
- this.sortingFunc = Object.assign(Object.assign({}, this.sortingFunc), sortingFunc);
16334
+ this.applyHeaderSorting(beforeApplyEvent.detail.column, beforeApplyEvent.detail.additive, order, cmp);
16335
+ this.startSorting(this.sorting, this.sortingFunc, this.sortingColumns, this.sortingOrder);
16336
+ }
16337
+ /**
16338
+ * Applies sorting state produced by a header click.
16339
+ */
16340
+ applyHeaderSorting(column, additive, order, cmp) {
16341
+ if (!additive) {
16342
+ this.setSortingState(order ? {
16343
+ sorting: { [column.prop]: order },
16344
+ sortingFunc: { [column.prop]: cmp },
16345
+ sortingColumns: { [column.prop]: column },
16346
+ sortingOrder: [column.prop],
16347
+ } : this.createSortingState());
16348
+ return;
16349
+ }
16350
+ const state = this.createSortingState(true);
16351
+ if (order) {
16352
+ this.setColumnSorting(state, column.prop, order, cmp, column);
16139
16353
  }
16140
16354
  else {
16141
- if (order) {
16142
- // reset sorting
16143
- this.sorting = { [columnProp]: order };
16144
- this.sortingFunc = { [columnProp]: cmp };
16145
- }
16146
- else {
16147
- (_b = this.sorting) === null || _b === void 0 ? true : delete _b[columnProp];
16148
- (_c = this.sortingFunc) === null || _c === void 0 ? true : delete _c[columnProp];
16149
- }
16355
+ this.clearColumnSorting(state, column.prop);
16150
16356
  }
16151
- this.startSorting(this.sorting, this.sortingFunc);
16357
+ this.setSortingState(state);
16152
16358
  }
16153
- runSorting(order, comparison, ignoreViewportUpdate) {
16154
- var _a;
16155
- this.sort(order, comparison, undefined, ignoreViewportUpdate);
16156
- (_a = this.sortingPromise) === null || _a === void 0 ? void 0 : _a.call(this);
16359
+ runSorting(order, comparison, sortingColumns, sortingOrder, ignoreViewportUpdate) {
16360
+ var _a, _b;
16361
+ if (typeof sortingColumns === 'boolean') {
16362
+ this.sort(order, comparison, undefined, undefined, undefined, sortingColumns);
16363
+ (_a = this.sortingPromise) === null || _a === void 0 ? void 0 : _a.call(this);
16364
+ this.sortingPromise = null;
16365
+ return;
16366
+ }
16367
+ this.sort(order, comparison, sortingColumns, sortingOrder, undefined, ignoreViewportUpdate);
16368
+ (_b = this.sortingPromise) === null || _b === void 0 ? void 0 : _b.call(this);
16157
16369
  this.sortingPromise = null;
16158
16370
  }
16159
- /**
16160
- * Sort items by sorting function
16161
- * @requires proxyItems applied to row store
16162
- * @requires source applied to row store
16163
- *
16164
- * @param sorting - per column sorting
16165
- * @param data - this.stores['rgRow'].store.get('source')
16166
- */
16167
- sort(sorting, sortingFunc, types = rowTypes, ignoreViewportUpdate = false) {
16371
+ sort(sorting, sortingFunc, sortingColumns, sortingOrder, types = rowTypes, ignoreViewportUpdate = false) {
16372
+ let activeSortingColumns;
16373
+ let activeSortingOrder;
16374
+ let activeTypes = types;
16375
+ let activeIgnoreViewportUpdate = ignoreViewportUpdate;
16376
+ if (Array.isArray(sortingColumns)) {
16377
+ activeTypes = sortingColumns;
16378
+ activeIgnoreViewportUpdate = typeof sortingOrder === 'boolean' ? sortingOrder : false;
16379
+ }
16380
+ else {
16381
+ activeSortingColumns = sortingColumns;
16382
+ activeSortingOrder = Array.isArray(sortingOrder) ? sortingOrder : undefined;
16383
+ }
16168
16384
  // if no sorting - reset
16169
16385
  if (!Object.keys(sorting || {}).length) {
16170
- for (let type of types) {
16386
+ for (let type of activeTypes) {
16171
16387
  const storeService = this.providers.data.stores[type];
16172
16388
  // row data
16173
16389
  const source = storeService.store.get('source');
@@ -16176,26 +16392,27 @@ class SortingPlugin extends BasePlugin {
16176
16392
  // row indexes
16177
16393
  const newItemsOrder = Array.from({ length: source.length }, (_, i) => i); // recover indexes range(0, source.length)
16178
16394
  this.providers.dimension.updateSizesPositionByNewDataIndexes(type, newItemsOrder, proxyItems);
16179
- storeService.setData({ proxyItems: newItemsOrder, source: [...source], });
16395
+ storeService.setData({ proxyItems: newItemsOrder });
16180
16396
  }
16181
16397
  }
16182
16398
  else {
16183
- for (let type of types) {
16399
+ for (let type of activeTypes) {
16184
16400
  const storeService = this.providers.data.stores[type];
16185
16401
  // row data
16186
16402
  const source = storeService.store.get('source');
16187
16403
  // row indexes
16188
16404
  const proxyItems = storeService.store.get('proxyItems');
16189
- const newItemsOrder = sortIndexByItems([...proxyItems], source, sortingFunc);
16405
+ const sortItems = getSortableRowIndexes(proxyItems, source);
16406
+ const sortedItems = sortIndexByItems([...sortItems], source, sortingFunc, sorting, activeSortingColumns, activeSortingOrder);
16407
+ const newItemsOrder = mergeSortedRowsWithGroups(proxyItems, source, sortedItems);
16190
16408
  // take row indexes before trim applied and proxy items
16191
16409
  const prevItems = storeService.store.get('items');
16192
16410
  storeService.setData({
16193
16411
  proxyItems: newItemsOrder,
16194
- source: [...source],
16195
16412
  });
16196
16413
  // take currently visible row indexes
16197
16414
  const newItems = storeService.store.get('items');
16198
- if (!ignoreViewportUpdate) {
16415
+ if (!activeIgnoreViewportUpdate) {
16199
16416
  this.providers.dimension
16200
16417
  .updateSizesPositionByNewDataIndexes(type, newItems, prevItems);
16201
16418
  }
@@ -16765,6 +16982,18 @@ const expandSvgIconVNode = (expanded = false) => {
16765
16982
  return (hAsync("svg", { "aria-hidden": "true", style: { transform: `rotate(${!expanded ? -90 : 0}deg)` }, focusable: "false", viewBox: "0 0 448 512" }, hAsync("path", { fill: "currentColor", d: "M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z" })));
16766
16983
  };
16767
16984
 
16985
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
16986
+ var t = {};
16987
+ for (var p in s)
16988
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16989
+ t[p] = s[p];
16990
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16991
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
16992
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
16993
+ t[p[i]] = s[p[i]];
16994
+ }
16995
+ return t;
16996
+ };
16768
16997
  class GroupingRowPlugin extends BasePlugin {
16769
16998
  getStore(type = GROUPING_ROW_TYPE) {
16770
16999
  return this.providers.data.stores[type].store;
@@ -16848,6 +17077,18 @@ class GroupingRowPlugin extends BasePlugin {
16848
17077
  const sortingPlugin = this.providers.plugins.getByClass(SortingPlugin);
16849
17078
  return !!(sortingPlugin === null || sortingPlugin === void 0 ? void 0 : sortingPlugin.sortingPromise);
16850
17079
  }
17080
+ /**
17081
+ * Returns grouping options for regrouping that must preserve current UI state.
17082
+ *
17083
+ * `expandedAll` and config `prevExpanded` are initial/config instructions.
17084
+ * Reusing them after sorting would reopen groups the user collapsed before
17085
+ * sorting instead of using the current grouped source state.
17086
+ */
17087
+ getCurrentExpandedOptions() {
17088
+ var _a;
17089
+ const _b = (_a = this.options) !== null && _a !== void 0 ? _a : {}, options = __rest(_b, ["expandedAll", "prevExpanded"]);
17090
+ return options;
17091
+ }
16851
17092
  /**
16852
17093
  * Starts global source update with group clearing and applying new one
16853
17094
  * Initiated when need to reapply grouping
@@ -16950,7 +17191,7 @@ class GroupingRowPlugin extends BasePlugin {
16950
17191
  if (!((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.length)) {
16951
17192
  return;
16952
17193
  }
16953
- this.doSourceUpdate(Object.assign({}, this.options));
17194
+ this.doSourceUpdate(this.getCurrentExpandedOptions());
16954
17195
  });
16955
17196
  /**
16956
17197
  * Apply logic for focus inside of grouping
@@ -17157,7 +17398,8 @@ class ViewportService {
17157
17398
  (_a = this.config.dimensionProvider) === null || _a === void 0 ? void 0 : _a.setCustomSizes(type, detail, true);
17158
17399
  // set resize event
17159
17400
  const changedItems = {};
17160
- for (const [i, size] of Object.entries(detail || {})) {
17401
+ for (const i of Object.keys(detail || {})) {
17402
+ const size = detail[i];
17161
17403
  const virtualIndex = parseInt(i, 10);
17162
17404
  const item = getSourceItem(store, virtualIndex);
17163
17405
  if (item) {
@@ -17560,7 +17802,10 @@ class SelectionStoreConnector {
17560
17802
  const nextItem = nextCell(focus, lastCell);
17561
17803
  let nextStore;
17562
17804
  if (nextItem) {
17563
- Object.entries(nextItem).forEach(([type, nextItemCoord]) => {
17805
+ Object.keys(nextItem).forEach((t) => {
17806
+ var _a;
17807
+ const type = t;
17808
+ const nextItemCoord = (_a = nextItem[type]) !== null && _a !== void 0 ? _a : 0;
17564
17809
  let stores;
17565
17810
  switch (type) {
17566
17811
  case 'x':
@@ -18235,7 +18480,7 @@ class ColumnMovePlugin extends BasePlugin {
18235
18480
  const cols = this.getDimension(data.pin || 'rgCol');
18236
18481
  const gridRect = this.revogrid.getBoundingClientRect();
18237
18482
  const elRect = dataEl.getBoundingClientRect();
18238
- const startItem = getItemByPosition(cols, getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left));
18483
+ const startItem = getItemByPosition(cols, getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left) + (cols.renderOffset || 0));
18239
18484
  this.staticDragData = {
18240
18485
  startPos: event.x,
18241
18486
  startItem,
@@ -18260,13 +18505,13 @@ class ColumnMovePlugin extends BasePlugin {
18260
18505
  const start = this.staticDragData.startPos;
18261
18506
  if (Math.abs(start - e.x) > 10) {
18262
18507
  const x = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);
18263
- const rgCol = getItemByPosition(this.staticDragData.cols, x);
18508
+ const rgCol = getItemByPosition(this.staticDragData.cols, x + (this.staticDragData.cols.renderOffset || 0));
18264
18509
  this.orderUi.autoscroll(x, dragData.elRect.width);
18265
18510
  // prevent position change if out of bounds
18266
18511
  if (rgCol.itemIndex >= this.staticDragData.cols.count) {
18267
18512
  return;
18268
18513
  }
18269
- this.orderUi.showHandler(rgCol.end + dragData.scrollOffset, dragData.gridRect.width);
18514
+ this.orderUi.showHandler(rgCol.end - (this.staticDragData.cols.renderOffset || 0) + dragData.scrollOffset, dragData.gridRect.width);
18270
18515
  }
18271
18516
  }
18272
18517
  move(e) {
@@ -18284,7 +18529,7 @@ class ColumnMovePlugin extends BasePlugin {
18284
18529
  if (relativePos < 0) {
18285
18530
  relativePos = 0;
18286
18531
  }
18287
- const newPosition = getItemByPosition(this.staticDragData.cols, relativePos);
18532
+ const newPosition = getItemByPosition(this.staticDragData.cols, relativePos + (this.staticDragData.cols.renderOffset || 0));
18288
18533
  const store = this.providers.column.stores[this.dragData.type].store;
18289
18534
  const source = store.get('source');
18290
18535
  const newItems = [...store.get('items')];
@@ -19249,12 +19494,13 @@ class RevoGridComponent {
19249
19494
  return;
19250
19495
  }
19251
19496
  const columns = this.columnProvider.setColumns(beforeApplyEvent.detail);
19497
+ const order = {};
19498
+ for (const prop of Object.keys(beforeApplyEvent.detail.sort)) {
19499
+ order[prop] = beforeApplyEvent.detail.sort[prop].order;
19500
+ }
19252
19501
  this.aftercolumnsset.emit({
19253
19502
  columns,
19254
- order: Object.entries(beforeApplyEvent.detail.sort).reduce((acc, [prop, column]) => {
19255
- acc[prop] = column.order;
19256
- return acc;
19257
- }, {}),
19503
+ order,
19258
19504
  });
19259
19505
  }
19260
19506
  disableVirtualXChanged(newVal = false, prevVal = false) {
@@ -19543,7 +19789,7 @@ class RevoGridComponent {
19543
19789
  if (Object.keys((_a = this.trimmedRows) !== null && _a !== void 0 ? _a : {}).length > 0) {
19544
19790
  this.trimmedRowsChanged(this.trimmedRows);
19545
19791
  }
19546
- this.rowDefChanged(this.rowDefinitions);
19792
+ this.rowDefChanged(this.rowDefinitions, undefined, undefined, false);
19547
19793
  // init grouping
19548
19794
  if (this.grouping && Object.keys(this.grouping).length > 0) {
19549
19795
  this.groupingChanged(this.grouping);
@@ -20060,11 +20306,13 @@ class RevogrData {
20060
20306
  const depth = this.dataStore.get('groupingDepth');
20061
20307
  const groupingCustomRenderer = this.dataStore.get('groupingCustomRenderer');
20062
20308
  const groupDepth = this.columnService.hasGrouping ? depth : 0;
20309
+ const rowRenderOffset = this.viewportRow.get('renderOffset') || 0;
20310
+ const colRenderOffset = this.viewportCol.get('renderOffset') || 0;
20063
20311
  for (let rgRow of rows) {
20064
20312
  const dataItem = getSourceItem(this.dataStore, rgRow.itemIndex);
20065
20313
  // #region Grouping
20066
20314
  if (isGrouping(dataItem)) {
20067
- const gmodel = Object.assign(Object.assign({}, rgRow), { index: rgRow.itemIndex, model: dataItem, groupingCustomRenderer,
20315
+ const gmodel = Object.assign(Object.assign({}, rgRow), { start: rgRow.start - rowRenderOffset, index: rgRow.itemIndex, model: dataItem, groupingCustomRenderer,
20068
20316
  // Only show expand button if grouping is enabled and not in row headers
20069
20317
  hasExpand: this.columnService.hasGrouping && this.colType !== 'rowHeaders', columnItems: cols, providers: this.providers });
20070
20318
  rowsEls.push(hAsync(GroupingRowRenderer, Object.assign({}, gmodel)));
@@ -20087,7 +20335,7 @@ class RevogrData {
20087
20335
  [DATA_ROW]: rowProps.itemIndex,
20088
20336
  style: {
20089
20337
  width: `${columnProps.size}px`,
20090
- transform: `translateX(${columnProps.start}px)`,
20338
+ transform: `translateX(${columnProps.start - colRenderOffset}px)`,
20091
20339
  height: rowProps.size ? `${rowProps.size}px` : undefined,
20092
20340
  },
20093
20341
  };
@@ -20115,7 +20363,7 @@ class RevogrData {
20115
20363
  if (this.rowHighlightPlugin.isRowFocused(rgRow.itemIndex)) {
20116
20364
  rowClass += ` ${ROW_FOCUSED_CLASS}`;
20117
20365
  }
20118
- const row = (hAsync(RowRenderer, { index: rgRow.itemIndex, rowClass: rowClass, size: rgRow.size, start: rgRow.start, groupingLevel: groupDepth || undefined }, cells));
20366
+ const row = (hAsync(RowRenderer, { index: rgRow.itemIndex, rowClass: rowClass, size: rgRow.size, start: rgRow.start - rowRenderOffset, groupingLevel: groupDepth || undefined }, cells));
20119
20367
  this.beforerowrender.emit({
20120
20368
  node: row,
20121
20369
  item: rgRow,
@@ -20434,7 +20682,7 @@ const HeaderRenderer = (p) => {
20434
20682
  class: cellClass,
20435
20683
  style: {
20436
20684
  width: `${p.column.size}px`,
20437
- transform: `translateX(${p.column.start}px)`,
20685
+ transform: `translateX(${p.column.start - (p.renderOffset || 0)}px)`,
20438
20686
  },
20439
20687
  onResize: p.onResize,
20440
20688
  onDblClick(originalEvent) {
@@ -20479,7 +20727,7 @@ const HeaderGroupRenderer = (p) => {
20479
20727
  [HEADER_CLASS]: true,
20480
20728
  },
20481
20729
  style: {
20482
- transform: `translateX(${p.start}px)`,
20730
+ transform: `translateX(${p.start - (p.renderOffset || 0)}px)`,
20483
20731
  width: `${p.end - p.start}px`,
20484
20732
  },
20485
20733
  onResize: p.onResize,
@@ -20487,7 +20735,7 @@ const HeaderGroupRenderer = (p) => {
20487
20735
  return (hAsync(HeaderCellRenderer, { data: Object.assign(Object.assign({}, p.group), { prop: '', providers: p.providers, index: p.start }), props: groupProps, additionalData: p.additionalData }));
20488
20736
  };
20489
20737
 
20490
- const revogrHeaderStyleCss = () => `@charset "UTF-8";revogr-header{position:relative;z-index:5;display:block}revogr-header .header-rgRow{display:block;position:relative}revogr-header .header-rgRow.group{z-index:0}revogr-header .group-rgRow{position:relative;overflow:hidden}revogr-header .rgHeaderCell{position:absolute;box-sizing:border-box;height:100%;z-index:1;display:flex}revogr-header .rgHeaderCell.align-center{text-align:center}revogr-header .rgHeaderCell.align-left{text-align:left}revogr-header .rgHeaderCell.align-right{text-align:right}revogr-header .rgHeaderCell.sortable{cursor:pointer}revogr-header .rgHeaderCell i.asc:after,revogr-header .rgHeaderCell i.desc:after{font-size:13px}revogr-header .rgHeaderCell i.asc:after{content:"↑"}revogr-header .rgHeaderCell i.desc:after{content:"↓"}revogr-header .rgHeaderCell.active{z-index:10}revogr-header .rgHeaderCell.active .resizable{background-color:deepskyblue}revogr-header .rgHeaderCell .header-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex-grow:1}revogr-header .rgHeaderCell .resizable{display:block;position:absolute;z-index:90;touch-action:none;user-select:none}revogr-header .rgHeaderCell .resizable:hover{background-color:deepskyblue}revogr-header .rgHeaderCell>.resizable-r{cursor:ew-resize;width:6px;right:0;top:0;height:100%}revogr-header .rgHeaderCell>.resizable-rb{cursor:se-resize;width:6px;height:6px;right:0;bottom:0}revogr-header .rgHeaderCell>.resizable-b{cursor:s-resize;height:6px;bottom:0;width:100%;left:0}revogr-header .rgHeaderCell>.resizable-lb{cursor:sw-resize;width:6px;height:6px;left:0;bottom:0}revogr-header .rgHeaderCell>.resizable-l{cursor:w-resize;width:6px;left:0;height:100%;top:0}revogr-header .rgHeaderCell>.resizable-lt{cursor:nw-resize;width:6px;height:6px;left:0;top:0}revogr-header .rgHeaderCell>.resizable-t{cursor:n-resize;height:6px;top:0;width:100%;left:0}revogr-header .rgHeaderCell>.resizable-rt{cursor:ne-resize;width:6px;height:6px;right:0;top:0}revogr-header .rv-filter{visibility:hidden}`;
20738
+ const revogrHeaderStyleCss = () => `@charset "UTF-8";revogr-header{position:relative;z-index:5;display:block}revogr-header .header-rgRow{display:block;position:relative}revogr-header .header-rgRow.group{z-index:0}revogr-header .group-rgRow{position:relative;overflow:hidden}revogr-header .rgHeaderCell{position:absolute;box-sizing:border-box;height:100%;z-index:1;display:flex}revogr-header .rgHeaderCell.align-center{text-align:center}revogr-header .rgHeaderCell.align-left{text-align:left}revogr-header .rgHeaderCell.align-right{text-align:right}revogr-header .rgHeaderCell.sortable{cursor:pointer}revogr-header .rgHeaderCell .sort-indicator{display:inline-flex;align-items:flex-start;gap:1px}revogr-header .rgHeaderCell .sort-indicator i.asc:after,revogr-header .rgHeaderCell .sort-indicator i.desc:after{font-size:13px}revogr-header .rgHeaderCell .sort-indicator i.asc:after{content:"↑"}revogr-header .rgHeaderCell .sort-indicator i.desc:after{content:"↓"}revogr-header .rgHeaderCell .sort-indicator .sort-order-index{font-size:10px;line-height:1;top:0}revogr-header .rgHeaderCell.active{z-index:10}revogr-header .rgHeaderCell.active .resizable{background-color:deepskyblue}revogr-header .rgHeaderCell .header-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex-grow:1}revogr-header .rgHeaderCell .resizable{display:block;position:absolute;z-index:90;touch-action:none;user-select:none}revogr-header .rgHeaderCell .resizable:hover{background-color:deepskyblue}revogr-header .rgHeaderCell>.resizable-r{cursor:ew-resize;width:6px;right:0;top:0;height:100%}revogr-header .rgHeaderCell>.resizable-rb{cursor:se-resize;width:6px;height:6px;right:0;bottom:0}revogr-header .rgHeaderCell>.resizable-b{cursor:s-resize;height:6px;bottom:0;width:100%;left:0}revogr-header .rgHeaderCell>.resizable-lb{cursor:sw-resize;width:6px;height:6px;left:0;bottom:0}revogr-header .rgHeaderCell>.resizable-l{cursor:w-resize;width:6px;left:0;height:100%;top:0}revogr-header .rgHeaderCell>.resizable-lt{cursor:nw-resize;width:6px;height:6px;left:0;top:0}revogr-header .rgHeaderCell>.resizable-t{cursor:n-resize;height:6px;top:0;width:100%;left:0}revogr-header .rgHeaderCell>.resizable-rt{cursor:ne-resize;width:6px;height:6px;right:0;top:0}revogr-header .rv-filter{visibility:hidden}`;
20491
20739
 
20492
20740
  class RevogrHeaderComponent {
20493
20741
  constructor(hostRef) {
@@ -20543,6 +20791,7 @@ class RevogrHeaderComponent {
20543
20791
  }
20544
20792
  renderHeaderColumns(cols, range) {
20545
20793
  const columnsToRender = [];
20794
+ const renderOffset = this.viewportCol.get('renderOffset') || 0;
20546
20795
  for (let rgCol of cols) {
20547
20796
  const colData = this.colData[rgCol.itemIndex];
20548
20797
  const props = {
@@ -20551,6 +20800,7 @@ class RevogrHeaderComponent {
20551
20800
  data: Object.assign(Object.assign({}, colData), { index: rgCol.itemIndex, providers: this.providers }),
20552
20801
  canFilter: !!this.columnFilter,
20553
20802
  canResize: this.canResize,
20803
+ renderOffset,
20554
20804
  active: this.resizeHandler,
20555
20805
  additionalData: this.additionalData,
20556
20806
  onResize: e => this.onResize(e, rgCol.itemIndex),
@@ -20603,6 +20853,7 @@ class RevogrHeaderComponent {
20603
20853
  start: groupStart,
20604
20854
  end: groupEnd,
20605
20855
  group,
20856
+ renderOffset: this.viewportCol.get('renderOffset') || 0,
20606
20857
  active: this.resizeHandler,
20607
20858
  canResize: this.canResize,
20608
20859
  additionalData: this.additionalData,
@@ -20793,10 +21044,11 @@ const NO_COORDINATE = -1;
20793
21044
  * return full size
20794
21045
  */
20795
21046
  function getContentSize(contentSize, clientSize, virtualSize = 0) {
20796
- if (virtualSize > contentSize) {
20797
- return 0;
20798
- }
20799
- return contentSize + (virtualSize ? clientSize - virtualSize : 0);
21047
+ return getScrollDimension({
21048
+ contentSize,
21049
+ clientSize,
21050
+ virtualSize,
21051
+ }).physicalContentSize;
20800
21052
  }
20801
21053
  class LocalScrollService {
20802
21054
  constructor(cfg) {
@@ -20810,14 +21062,20 @@ class LocalScrollService {
20810
21062
  rgRow: NO_COORDINATE,
20811
21063
  rgCol: NO_COORDINATE,
20812
21064
  };
21065
+ this.previousLogicalScroll = {
21066
+ rgRow: 0,
21067
+ rgCol: 0,
21068
+ };
20813
21069
  this.params = {
20814
21070
  rgRow: Object.assign({}, initialParams),
20815
21071
  rgCol: Object.assign({}, initialParams),
20816
21072
  };
20817
21073
  }
20818
21074
  setParams(params, dimension) {
20819
- const virtualContentSize = getContentSize(params.contentSize, params.clientSize, params.virtualSize);
20820
- this.params[dimension] = Object.assign(Object.assign({}, params), { maxSize: virtualContentSize - params.clientSize, virtualContentSize });
21075
+ const scrollDimension = getScrollDimension(params);
21076
+ const virtualContentSize = scrollDimension.physicalContentSize;
21077
+ this.params[dimension] = Object.assign(Object.assign({}, params), { maxSize: virtualContentSize - params.clientSize, virtualContentSize,
21078
+ scrollDimension });
20821
21079
  }
20822
21080
  // apply scroll values after scroll done
20823
21081
  async setScroll(e) {
@@ -20837,16 +21095,27 @@ class LocalScrollService {
20837
21095
  await frameAnimation;
20838
21096
  const params = this.getParams(e.dimension);
20839
21097
  e.coordinate = Math.ceil(e.coordinate);
20840
- this.previousScroll[e.dimension] = this.wrapCoordinate(e.coordinate, params);
21098
+ this.previousLogicalScroll[e.dimension] = this.wrapLogicalCoordinate(e.coordinate, params);
21099
+ const physicalCoordinate = this.toPhysicalCoordinate(e.coordinate, params);
21100
+ this.previousScroll[e.dimension] = this.wrapPhysicalCoordinate(physicalCoordinate, params);
20841
21101
  this.preventArtificialScroll[e.dimension] = null;
20842
- this.cfg.applyScroll(Object.assign(Object.assign({}, e), { coordinate: params.virtualSize
20843
- ? this.convert(e.coordinate, params, false)
20844
- : e.coordinate }));
21102
+ this.cfg.applyScroll(Object.assign(Object.assign({}, e), { coordinate: physicalCoordinate }));
20845
21103
  }
20846
21104
  catch (id) {
20847
21105
  window.cancelAnimationFrame(id);
20848
21106
  }
20849
21107
  }
21108
+ async setScrollByDelta(e, currentPhysicalCoordinate) {
21109
+ var _a;
21110
+ const params = this.getParams(e.dimension);
21111
+ const baseCoordinate = this.previousScroll[e.dimension] === NO_COORDINATE
21112
+ ? this.toLogicalCoordinate(currentPhysicalCoordinate, params)
21113
+ : this.previousLogicalScroll[e.dimension];
21114
+ const coordinate = this.wrapLogicalCoordinate(baseCoordinate + ((_a = e.delta) !== null && _a !== void 0 ? _a : 0), params);
21115
+ const nextEvent = Object.assign(Object.assign({}, e), { coordinate });
21116
+ await this.setScroll(nextEvent);
21117
+ return nextEvent;
21118
+ }
20850
21119
  /**
20851
21120
  * On scroll event started
20852
21121
  */
@@ -20859,21 +21128,21 @@ class LocalScrollService {
20859
21128
  return;
20860
21129
  }
20861
21130
  const param = this.getParams(dimension);
21131
+ const logicalCoordinate = this.toLogicalScrollCoordinate(coordinate, dimension, param, delta);
20862
21132
  // let component know about scroll event started
20863
21133
  this.cfg.runScroll({
20864
21134
  dimension: dimension,
20865
- coordinate: param.virtualSize
20866
- ? this.convert(coordinate, param)
20867
- : coordinate,
21135
+ coordinate: logicalCoordinate,
20868
21136
  delta,
20869
21137
  outside,
20870
21138
  });
21139
+ this.previousLogicalScroll[dimension] = logicalCoordinate;
20871
21140
  }
20872
21141
  getParams(dimension) {
20873
21142
  return this.params[dimension];
20874
21143
  }
20875
21144
  // check if scroll outside of region to avoid looping
20876
- wrapCoordinate(c, param) {
21145
+ wrapPhysicalCoordinate(c, param) {
20877
21146
  if (c < 0) {
20878
21147
  return NO_COORDINATE;
20879
21148
  }
@@ -20882,22 +21151,39 @@ class LocalScrollService {
20882
21151
  }
20883
21152
  return c;
20884
21153
  }
21154
+ wrapLogicalCoordinate(c, param) {
21155
+ var _a, _b;
21156
+ if (c < 0) {
21157
+ return 0;
21158
+ }
21159
+ return Math.min(c, (_b = (_a = param.scrollDimension) === null || _a === void 0 ? void 0 : _a.logicalScrollSize) !== null && _b !== void 0 ? _b : c);
21160
+ }
20885
21161
  // prevent already started scroll, performance optimization
20886
21162
  cancelScroll(dimension) {
20887
21163
  var _a, _b;
20888
21164
  (_b = (_a = this.preventArtificialScroll)[dimension]) === null || _b === void 0 ? void 0 : _b.call(_a);
20889
21165
  this.preventArtificialScroll[dimension] = null;
20890
21166
  }
20891
- /* convert virtual to real and back, scale range */
20892
- convert(pos, param, toReal = true) {
20893
- var _a;
20894
- const minRange = param.clientSize;
20895
- const from = [0, ((_a = param.virtualContentSize) !== null && _a !== void 0 ? _a : minRange) - minRange];
20896
- const to = [0, param.contentSize - param.virtualSize];
20897
- if (toReal) {
20898
- return scaleValue(pos, from, to);
21167
+ toLogicalScrollCoordinate(coordinate, dimension, param, delta) {
21168
+ const scrollDimension = param.scrollDimension;
21169
+ if (!scrollDimension) {
21170
+ return coordinate;
20899
21171
  }
20900
- return scaleValue(pos, to, from);
21172
+ if (typeof delta === 'number' && scrollDimension.isCompressed) {
21173
+ const base = this.previousScroll[dimension] === NO_COORDINATE
21174
+ ? scrollDimension.toLogicalCoordinate(coordinate - delta)
21175
+ : this.previousLogicalScroll[dimension];
21176
+ return scrollDimension.toLogicalCoordinate(scrollDimension.toPhysicalCoordinate(base + delta));
21177
+ }
21178
+ return scrollDimension.toLogicalCoordinate(coordinate);
21179
+ }
21180
+ toPhysicalCoordinate(coordinate, param) {
21181
+ var _a, _b;
21182
+ return (_b = (_a = param.scrollDimension) === null || _a === void 0 ? void 0 : _a.toPhysicalCoordinate(coordinate)) !== null && _b !== void 0 ? _b : coordinate;
21183
+ }
21184
+ toLogicalCoordinate(coordinate, param) {
21185
+ var _a, _b;
21186
+ return (_b = (_a = param.scrollDimension) === null || _a === void 0 ? void 0 : _a.toLogicalCoordinate(coordinate)) !== null && _b !== void 0 ? _b : coordinate;
20901
21187
  }
20902
21188
  }
20903
21189
 
@@ -21055,15 +21341,9 @@ class RevogrScrollVirtual {
21055
21341
  */
21056
21342
  async changeScroll(e) {
21057
21343
  if (e.delta) {
21058
- switch (e.dimension) {
21059
- case 'rgCol':
21060
- e.coordinate = this.element.scrollLeft + e.delta;
21061
- break;
21062
- case 'rgRow':
21063
- e.coordinate = this.element.scrollTop + e.delta;
21064
- break;
21065
- }
21066
- this.setScroll(e);
21344
+ const scrollProperty = e.dimension === 'rgRow' ? 'scrollTop' : 'scrollLeft';
21345
+ const currentPhysicalCoordinate = this.element[scrollProperty];
21346
+ return this.localScrollService.setScrollByDelta(e, currentPhysicalCoordinate);
21067
21347
  }
21068
21348
  return e;
21069
21349
  }
@@ -21126,7 +21406,7 @@ class RevogrScrollVirtual {
21126
21406
  }
21127
21407
  render() {
21128
21408
  const size = getContentSize(this.realSize, this.dimension === 'rgRow' ? this.element.clientHeight : this.element.clientWidth, this.clientSize);
21129
- return (hAsync(Host, { key: '57f81ec9deb2395e96b283338c03b9ad44f1e929', onScroll: (e) => this.onScroll(e) }, hAsync("div", { key: '1a8c869adab53b362c351dae8d53664f33c4212c', style: {
21409
+ return (hAsync(Host, { key: '7213817ef941eee4050b714266598ec0c2961ee9', onScroll: (e) => this.onScroll(e) }, hAsync("div", { key: '501da49c63253ab943172494b9dbf5399be56cee', style: {
21130
21410
  [this.dimension === 'rgRow' ? 'height' : 'width']: `${size}px`,
21131
21411
  } })));
21132
21412
  }
@@ -21235,7 +21515,7 @@ class RevogrViewportScroll {
21235
21515
  * @param e
21236
21516
  */
21237
21517
  async changeScroll(e, silent = false) {
21238
- var _a, _b;
21518
+ var _a, _b, _c, _d;
21239
21519
  if (silent) {
21240
21520
  if (e.coordinate && this.verticalScroll) {
21241
21521
  switch (e.dimension) {
@@ -21248,15 +21528,16 @@ class RevogrViewportScroll {
21248
21528
  return;
21249
21529
  }
21250
21530
  if (e.delta) {
21531
+ let currentPhysicalCoordinate = 0;
21251
21532
  switch (e.dimension) {
21252
21533
  case 'rgCol':
21253
- e.coordinate = this.horizontalScroll.scrollLeft + e.delta;
21534
+ currentPhysicalCoordinate = this.horizontalScroll.scrollLeft;
21254
21535
  break;
21255
21536
  case 'rgRow':
21256
- e.coordinate = ((_b = (_a = this.verticalScroll) === null || _a === void 0 ? void 0 : _a.scrollTop) !== null && _b !== void 0 ? _b : 0) + e.delta;
21537
+ currentPhysicalCoordinate = (_b = (_a = this.verticalScroll) === null || _a === void 0 ? void 0 : _a.scrollTop) !== null && _b !== void 0 ? _b : 0;
21257
21538
  break;
21258
21539
  }
21259
- this.setScroll(e);
21540
+ return (_d = (_c = this.localScrollService) === null || _c === void 0 ? void 0 : _c.setScrollByDelta(e, currentPhysicalCoordinate)) !== null && _d !== void 0 ? _d : e;
21260
21541
  }
21261
21542
  return e;
21262
21543
  }
@@ -21408,7 +21689,10 @@ class RevogrViewportScroll {
21408
21689
  this.setScrollVisibility('rgCol', this.horizontalScroll.clientWidth, this.contentWidth);
21409
21690
  }
21410
21691
  render() {
21411
- return (hAsync(Host, { key: 'adc7378dba1794ca2ec263d52b09abefe50bcbfd', onWheel: this.horizontalMouseWheel, onScroll: (e) => this.applyScroll('rgCol', e) }, hAsync("div", { key: '7b57a8a0ea44629fefcfe4d2cd77bf0f048d8e06', class: "inner-content-table", style: { width: `${this.contentWidth}px` } }, hAsync("div", { key: 'cca3de158bc2a7f0651f578a281819be5698b257', class: "header-wrapper", ref: e => (this.header = e) }, hAsync("slot", { key: '1d170147dabe034f2c35481a8e2fedd6de2b6aed', name: HEADER_SLOT })), hAsync("div", { key: 'b6dd29a91bb1f380a83a035dfdb749ca669936f2', class: "vertical-inner", ref: el => (this.verticalScroll = el), onWheel: this.verticalMouseWheel, onScroll: (e) => this.applyScroll('rgRow', e) }, hAsync("div", { key: '9bce27bf8ec4d3b679aa9a34eb6379a8c2d46cac', class: "content-wrapper", style: { height: `${this.contentHeight}px` } }, hAsync("slot", { key: 'b44a082c9fbb948fd87bd235b4cd4356fd4a3536', name: CONTENT_SLOT }))), hAsync("div", { key: '28c305ff6bc664f1d1bbb117e8b8565c8d4bb6b2', class: "footer-wrapper", ref: e => (this.footer = e) }, hAsync("slot", { key: '96312fb7f18198fd1feb9dcc00c79cde74ba9c9f', name: FOOTER_SLOT })))));
21692
+ var _a, _b, _c, _d;
21693
+ const physicalContentHeight = getContentSize(this.contentHeight, (_b = (_a = this.verticalScroll) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : 0);
21694
+ const physicalContentWidth = getContentSize(this.contentWidth, (_d = (_c = this.horizontalScroll) === null || _c === void 0 ? void 0 : _c.clientWidth) !== null && _d !== void 0 ? _d : 0);
21695
+ return (hAsync(Host, { key: 'a0c47dede9d131dea8c8ca449e8a323f24d9b113', onWheel: this.horizontalMouseWheel, onScroll: (e) => this.applyScroll('rgCol', e) }, hAsync("div", { key: '6c960e753ffe522ba4afb1c379264873b6c617f3', class: "inner-content-table", style: { width: `${physicalContentWidth}px` } }, hAsync("div", { key: '1a6cbcbd3634e84756b54c8150aebd25c824e14a', class: "header-wrapper", ref: e => (this.header = e) }, hAsync("slot", { key: 'e4202c687bc39b4f78f3ed9840e979b032f06af8', name: HEADER_SLOT })), hAsync("div", { key: '651415b5b32e72735065b183317386a34042bb85', class: "vertical-inner", ref: el => (this.verticalScroll = el), onWheel: this.verticalMouseWheel, onScroll: (e) => this.applyScroll('rgRow', e) }, hAsync("div", { key: 'e65623b78d80957d8676adb019618953ef267ec3', class: "content-wrapper", style: { height: `${physicalContentHeight}px` } }, hAsync("slot", { key: '5af47b12ef1226587cf774233447b5252d65e836', name: CONTENT_SLOT }))), hAsync("div", { key: 'cbc0fd64fbfb53d3b18e547bbe34e32b7bb9c043', class: "footer-wrapper", ref: e => (this.footer = e) }, hAsync("slot", { key: 'a8e4bfaef400973121090bac3069eb85469a95f3', name: FOOTER_SLOT })))));
21412
21696
  }
21413
21697
  /**
21414
21698
  * Extra layer for scroll event monitoring, where MouseWheel event is not passing