@revolist/revogrid 4.22.0 → 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 (130) hide show
  1. package/dist/cjs/{cell-renderer-uZmDBXz7.js → cell-renderer-DWJ9Px9f.js} +9 -3
  2. package/dist/cjs/{column.drag.plugin-CM_5mKV3.js → column.drag.plugin-CaEBDG-Q.js} +409 -267
  3. package/dist/cjs/{column.service-DvQDqxxx.js → column.service-f612L4ql.js} +1 -1
  4. package/dist/cjs/{dimension.helpers-CaIsYC99.js → dimension.helpers-B9HgANnM.js} +14 -146
  5. package/dist/cjs/{edit.utils-CwMzSIVF.js → edit.utils-pKeiYFLJ.js} +22 -1
  6. package/dist/cjs/{header-cell-renderer-B1dJwgTO.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 +45 -31
  9. package/dist/cjs/revo-grid.cjs.entry.js +35 -15
  10. package/dist/cjs/revogr-attribution_7.cjs.entry.js +44 -26
  11. package/dist/cjs/revogr-clipboard_3.cjs.entry.js +11 -9
  12. package/dist/cjs/revogr-data_4.cjs.entry.js +132 -178
  13. package/dist/cjs/revogr-filter-panel.cjs.entry.js +2 -1
  14. package/dist/cjs/{text-editor-BTnGaIl3.js → text-editor-B4W-m-r-.js} +3 -3
  15. package/dist/cjs/{throttle-CI4MsAqs.js → throttle-BCwEuJJq.js} +59 -24
  16. package/dist/cjs/viewport.helpers-BND76K2j.js +140 -0
  17. package/dist/cjs/{viewport.store-Dcjud-a-.js → viewport.store-BlKQ4x9H.js} +16 -16
  18. package/dist/collection/components/clipboard/revogr-clipboard.js +1 -1
  19. package/dist/collection/components/data/revogr-data.js +5 -3
  20. package/dist/collection/components/header/header-group-renderer.js +2 -1
  21. package/dist/collection/components/header/header-renderer.js +6 -5
  22. package/dist/collection/components/header/revogr-header-style.css +13 -3
  23. package/dist/collection/components/header/revogr-header.js +105 -42
  24. package/dist/collection/components/order/order-row.service.js +6 -5
  25. package/dist/collection/components/overlay/keyboard.service.js +25 -3
  26. package/dist/collection/components/overlay/selection.utils.js +8 -6
  27. package/dist/collection/components/revoGrid/revo-grid.js +6 -5
  28. package/dist/collection/components/revoGrid/viewport.service.js +2 -1
  29. package/dist/collection/components/scroll/revogr-viewport-scroll.js +10 -6
  30. package/dist/collection/components/scrollable/revogr-scroll-virtual.js +4 -10
  31. package/dist/collection/plugins/filter/filter.panel.js +2 -1
  32. package/dist/collection/plugins/filter/filter.plugin.js +11 -4
  33. package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +25 -1
  34. package/dist/collection/plugins/moveColumn/column.drag.plugin.js +18 -15
  35. package/dist/collection/plugins/sorting/sorting.func.js +173 -15
  36. package/dist/collection/plugins/sorting/sorting.plugin.js +167 -84
  37. package/dist/collection/plugins/sorting/sorting.sign.js +7 -1
  38. package/dist/collection/serve/controller.js +98 -37
  39. package/dist/collection/serve/data.js +273 -144
  40. package/dist/collection/services/dimension.provider.js +16 -1
  41. package/dist/collection/services/local.scroll.service.js +59 -24
  42. package/dist/collection/services/scroll.dimension.helpers.js +83 -0
  43. package/dist/collection/services/selection.store.connector.js +4 -1
  44. package/dist/collection/store/dimension/dimension.recalculate.plugin.js +22 -9
  45. package/dist/collection/store/dimension/dimension.store.js +4 -2
  46. package/dist/collection/store/vp/viewport.helpers.js +9 -0
  47. package/dist/collection/store/vp/viewport.store.js +5 -16
  48. package/dist/collection/types/events.js +4 -0
  49. package/dist/collection/utils/key.utils.js +20 -0
  50. package/dist/collection/utils/store.utils.js +3 -3
  51. package/dist/{revo-grid/cell-renderer-K_BKH7Kx.js → esm/cell-renderer-8UiGd-s7.js} +9 -3
  52. package/dist/esm/{column.drag.plugin-DEqZ2qXJ.js → column.drag.plugin-BsfhsfmB.js} +402 -266
  53. package/dist/esm/{column.service-Cdz3dYqZ.js → column.service-DbpulTog.js} +1 -1
  54. package/dist/{revo-grid/debounce-BfO9dz9v.js → esm/debounce-PCRWZliA.js} +1 -1
  55. package/dist/{revo-grid/dimension.helpers-DzxqJQqN.js → esm/dimension.helpers-CGKwSvw6.js} +7 -128
  56. package/dist/esm/{edit.utils-CzfeG98N.js → edit.utils-Dnnbd0xG.js} +22 -2
  57. package/dist/{revo-grid/header-cell-renderer-DXhxZMly.js → esm/header-cell-renderer-DGI2FAD8.js} +1 -1
  58. package/dist/esm/index-Db3qZoW5.js +127 -0
  59. package/dist/esm/index.js +15 -10
  60. package/dist/esm/revo-grid.entry.js +34 -14
  61. package/dist/esm/revogr-attribution_7.entry.js +43 -25
  62. package/dist/esm/revogr-clipboard_3.entry.js +12 -10
  63. package/dist/esm/revogr-data_4.entry.js +133 -179
  64. package/dist/esm/revogr-filter-panel.entry.js +3 -2
  65. package/dist/esm/{text-editor-C1ks5eQ4.js → text-editor-C3RUSwH5.js} +2 -2
  66. package/dist/esm/{throttle-BEjFQa2l.js → throttle-CaUDyxyU.js} +60 -25
  67. package/dist/esm/viewport.helpers-CoCAvmZs.js +133 -0
  68. package/dist/{revo-grid/viewport.store-saAZJHRo.js → esm/viewport.store-COAfzAyu.js} +15 -17
  69. package/dist/{esm/cell-renderer-K_BKH7Kx.js → revo-grid/cell-renderer-8UiGd-s7.js} +9 -3
  70. package/dist/revo-grid/{column.drag.plugin-DEqZ2qXJ.js → column.drag.plugin-BsfhsfmB.js} +402 -266
  71. package/dist/revo-grid/{column.service-Cdz3dYqZ.js → column.service-DbpulTog.js} +1 -1
  72. package/dist/{esm/debounce-BfO9dz9v.js → revo-grid/debounce-PCRWZliA.js} +1 -1
  73. package/dist/{esm/dimension.helpers-DzxqJQqN.js → revo-grid/dimension.helpers-CGKwSvw6.js} +7 -128
  74. package/dist/revo-grid/{edit.utils-CzfeG98N.js → edit.utils-Dnnbd0xG.js} +22 -2
  75. package/dist/{esm/header-cell-renderer-DXhxZMly.js → revo-grid/header-cell-renderer-DGI2FAD8.js} +1 -1
  76. package/dist/revo-grid/index-Db3qZoW5.js +127 -0
  77. package/dist/revo-grid/index.esm.js +15 -10
  78. package/dist/revo-grid/revo-grid.entry.js +34 -14
  79. package/dist/revo-grid/revogr-attribution_7.entry.js +43 -25
  80. package/dist/revo-grid/revogr-clipboard_3.entry.js +12 -10
  81. package/dist/revo-grid/revogr-data_4.entry.js +133 -179
  82. package/dist/revo-grid/revogr-filter-panel.entry.js +3 -2
  83. package/dist/revo-grid/{text-editor-C1ks5eQ4.js → text-editor-C3RUSwH5.js} +2 -2
  84. package/dist/revo-grid/{throttle-BEjFQa2l.js → throttle-CaUDyxyU.js} +60 -25
  85. package/dist/revo-grid/viewport.helpers-CoCAvmZs.js +133 -0
  86. package/dist/{esm/viewport.store-saAZJHRo.js → revo-grid/viewport.store-COAfzAyu.js} +15 -17
  87. package/dist/types/components/header/header-group-renderer.d.ts +1 -0
  88. package/dist/types/components/header/header-renderer.d.ts +1 -0
  89. package/dist/types/components/header/revogr-header.d.ts +6 -0
  90. package/dist/types/components/overlay/keyboard.service.d.ts +5 -0
  91. package/dist/types/plugins/groupingRow/grouping.row.plugin.d.ts +8 -0
  92. package/dist/types/plugins/moveColumn/column.drag.plugin.d.ts +29 -3
  93. package/dist/types/plugins/sorting/sorting.func.d.ts +25 -2
  94. package/dist/types/plugins/sorting/sorting.plugin.d.ts +84 -9
  95. package/dist/types/plugins/sorting/sorting.sign.d.ts +5 -1
  96. package/dist/types/plugins/sorting/sorting.types.d.ts +46 -1
  97. package/dist/types/services/local.scroll.service.d.ts +10 -2
  98. package/dist/types/services/scroll.dimension.helpers.d.ts +20 -0
  99. package/dist/types/store/vp/viewport.helpers.d.ts +2 -0
  100. package/dist/types/types/events.d.ts +1 -1
  101. package/dist/types/types/interfaces.d.ts +11 -0
  102. package/dist/types/utils/key.utils.d.ts +8 -0
  103. package/hydrate/index.js +791 -539
  104. package/hydrate/index.mjs +791 -539
  105. package/package.json +1 -1
  106. package/standalone/column.service.js +1 -1
  107. package/standalone/data.store.js +1 -1
  108. package/standalone/debounce.js +1 -1
  109. package/standalone/dimension.helpers.js +1 -1
  110. package/standalone/index.js +1 -1
  111. package/standalone/local.scroll.timer.js +1 -1
  112. package/standalone/revo-grid.js +1 -1
  113. package/standalone/revogr-clipboard2.js +1 -1
  114. package/standalone/revogr-data2.js +1 -1
  115. package/standalone/revogr-edit.js +1 -1
  116. package/standalone/revogr-edit2.js +1 -1
  117. package/standalone/revogr-filter-panel.js +1 -1
  118. package/standalone/revogr-header2.js +1 -1
  119. package/standalone/revogr-order-editor2.js +1 -1
  120. package/standalone/revogr-overlay-selection2.js +1 -1
  121. package/standalone/revogr-row-headers.js +1 -1
  122. package/standalone/revogr-row-headers2.js +1 -1
  123. package/standalone/revogr-scroll-virtual2.js +1 -1
  124. package/standalone/revogr-viewport-scroll2.js +1 -1
  125. package/standalone/selection.utils.js +1 -1
  126. package/standalone/throttle.js +1 -1
  127. package/standalone/toNumber.js +1 -1
  128. package/dist/cjs/viewport.helpers-BAovztDd.js +0 -58
  129. package/dist/esm/viewport.helpers-VXhsJZtn.js +0 -52
  130. package/dist/revo-grid/viewport.helpers-VXhsJZtn.js +0 -52
@@ -1,8 +1,8 @@
1
1
  /*!
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
- import { q as scaleValue } from './dimension.helpers-DzxqJQqN.js';
5
- import { d as debounce, a as isObject } from './debounce-BfO9dz9v.js';
4
+ import { g as getScrollDimension } from './viewport.helpers-CoCAvmZs.js';
5
+ import { d as debounce, i as isObject } from './debounce-PCRWZliA.js';
6
6
 
7
7
  const initialParams = {
8
8
  contentSize: 0,
@@ -16,10 +16,11 @@ const NO_COORDINATE = -1;
16
16
  * return full size
17
17
  */
18
18
  function getContentSize(contentSize, clientSize, virtualSize = 0) {
19
- if (virtualSize > contentSize) {
20
- return 0;
21
- }
22
- return contentSize + (virtualSize ? clientSize - virtualSize : 0);
19
+ return getScrollDimension({
20
+ contentSize,
21
+ clientSize,
22
+ virtualSize,
23
+ }).physicalContentSize;
23
24
  }
24
25
  class LocalScrollService {
25
26
  constructor(cfg) {
@@ -33,14 +34,20 @@ class LocalScrollService {
33
34
  rgRow: NO_COORDINATE,
34
35
  rgCol: NO_COORDINATE,
35
36
  };
37
+ this.previousLogicalScroll = {
38
+ rgRow: 0,
39
+ rgCol: 0,
40
+ };
36
41
  this.params = {
37
42
  rgRow: Object.assign({}, initialParams),
38
43
  rgCol: Object.assign({}, initialParams),
39
44
  };
40
45
  }
41
46
  setParams(params, dimension) {
42
- const virtualContentSize = getContentSize(params.contentSize, params.clientSize, params.virtualSize);
43
- this.params[dimension] = Object.assign(Object.assign({}, params), { maxSize: virtualContentSize - params.clientSize, virtualContentSize });
47
+ const scrollDimension = getScrollDimension(params);
48
+ const virtualContentSize = scrollDimension.physicalContentSize;
49
+ this.params[dimension] = Object.assign(Object.assign({}, params), { maxSize: virtualContentSize - params.clientSize, virtualContentSize,
50
+ scrollDimension });
44
51
  }
45
52
  // apply scroll values after scroll done
46
53
  async setScroll(e) {
@@ -60,16 +67,27 @@ class LocalScrollService {
60
67
  await frameAnimation;
61
68
  const params = this.getParams(e.dimension);
62
69
  e.coordinate = Math.ceil(e.coordinate);
63
- this.previousScroll[e.dimension] = this.wrapCoordinate(e.coordinate, params);
70
+ this.previousLogicalScroll[e.dimension] = this.wrapLogicalCoordinate(e.coordinate, params);
71
+ const physicalCoordinate = this.toPhysicalCoordinate(e.coordinate, params);
72
+ this.previousScroll[e.dimension] = this.wrapPhysicalCoordinate(physicalCoordinate, params);
64
73
  this.preventArtificialScroll[e.dimension] = null;
65
- this.cfg.applyScroll(Object.assign(Object.assign({}, e), { coordinate: params.virtualSize
66
- ? this.convert(e.coordinate, params, false)
67
- : e.coordinate }));
74
+ this.cfg.applyScroll(Object.assign(Object.assign({}, e), { coordinate: physicalCoordinate }));
68
75
  }
69
76
  catch (id) {
70
77
  window.cancelAnimationFrame(id);
71
78
  }
72
79
  }
80
+ async setScrollByDelta(e, currentPhysicalCoordinate) {
81
+ var _a;
82
+ const params = this.getParams(e.dimension);
83
+ const baseCoordinate = this.previousScroll[e.dimension] === NO_COORDINATE
84
+ ? this.toLogicalCoordinate(currentPhysicalCoordinate, params)
85
+ : this.previousLogicalScroll[e.dimension];
86
+ const coordinate = this.wrapLogicalCoordinate(baseCoordinate + ((_a = e.delta) !== null && _a !== void 0 ? _a : 0), params);
87
+ const nextEvent = Object.assign(Object.assign({}, e), { coordinate });
88
+ await this.setScroll(nextEvent);
89
+ return nextEvent;
90
+ }
73
91
  /**
74
92
  * On scroll event started
75
93
  */
@@ -82,21 +100,21 @@ class LocalScrollService {
82
100
  return;
83
101
  }
84
102
  const param = this.getParams(dimension);
103
+ const logicalCoordinate = this.toLogicalScrollCoordinate(coordinate, dimension, param, delta);
85
104
  // let component know about scroll event started
86
105
  this.cfg.runScroll({
87
106
  dimension: dimension,
88
- coordinate: param.virtualSize
89
- ? this.convert(coordinate, param)
90
- : coordinate,
107
+ coordinate: logicalCoordinate,
91
108
  delta,
92
109
  outside,
93
110
  });
111
+ this.previousLogicalScroll[dimension] = logicalCoordinate;
94
112
  }
95
113
  getParams(dimension) {
96
114
  return this.params[dimension];
97
115
  }
98
116
  // check if scroll outside of region to avoid looping
99
- wrapCoordinate(c, param) {
117
+ wrapPhysicalCoordinate(c, param) {
100
118
  if (c < 0) {
101
119
  return NO_COORDINATE;
102
120
  }
@@ -105,22 +123,39 @@ class LocalScrollService {
105
123
  }
106
124
  return c;
107
125
  }
126
+ wrapLogicalCoordinate(c, param) {
127
+ var _a, _b;
128
+ if (c < 0) {
129
+ return 0;
130
+ }
131
+ return Math.min(c, (_b = (_a = param.scrollDimension) === null || _a === void 0 ? void 0 : _a.logicalScrollSize) !== null && _b !== void 0 ? _b : c);
132
+ }
108
133
  // prevent already started scroll, performance optimization
109
134
  cancelScroll(dimension) {
110
135
  var _a, _b;
111
136
  (_b = (_a = this.preventArtificialScroll)[dimension]) === null || _b === void 0 ? void 0 : _b.call(_a);
112
137
  this.preventArtificialScroll[dimension] = null;
113
138
  }
114
- /* convert virtual to real and back, scale range */
115
- convert(pos, param, toReal = true) {
116
- var _a;
117
- const minRange = param.clientSize;
118
- const from = [0, ((_a = param.virtualContentSize) !== null && _a !== void 0 ? _a : minRange) - minRange];
119
- const to = [0, param.contentSize - param.virtualSize];
120
- if (toReal) {
121
- return scaleValue(pos, from, to);
139
+ toLogicalScrollCoordinate(coordinate, dimension, param, delta) {
140
+ const scrollDimension = param.scrollDimension;
141
+ if (!scrollDimension) {
142
+ return coordinate;
143
+ }
144
+ if (typeof delta === 'number' && scrollDimension.isCompressed) {
145
+ const base = this.previousScroll[dimension] === NO_COORDINATE
146
+ ? scrollDimension.toLogicalCoordinate(coordinate - delta)
147
+ : this.previousLogicalScroll[dimension];
148
+ return scrollDimension.toLogicalCoordinate(scrollDimension.toPhysicalCoordinate(base + delta));
122
149
  }
123
- return scaleValue(pos, to, from);
150
+ return scrollDimension.toLogicalCoordinate(coordinate);
151
+ }
152
+ toPhysicalCoordinate(coordinate, param) {
153
+ var _a, _b;
154
+ return (_b = (_a = param.scrollDimension) === null || _a === void 0 ? void 0 : _a.toPhysicalCoordinate(coordinate)) !== null && _b !== void 0 ? _b : coordinate;
155
+ }
156
+ toLogicalCoordinate(coordinate, param) {
157
+ var _a, _b;
158
+ return (_b = (_a = param.scrollDimension) === null || _a === void 0 ? void 0 : _a.toLogicalCoordinate(coordinate)) !== null && _b !== void 0 ? _b : coordinate;
124
159
  }
125
160
  }
126
161
 
@@ -0,0 +1,133 @@
1
+ /*!
2
+ * Built by Revolist OU ❤️
3
+ */
4
+ const FALLBACK_MAX_SCROLL_SIZE = 16000000;
5
+ const SCROLL_SIZE_GUARD = 1000000;
6
+ let detectedMaxScrollSize;
7
+ function getMaxScrollSize(doc = typeof document === 'undefined' ? undefined : document) {
8
+ if (typeof detectedMaxScrollSize === 'number') {
9
+ return detectedMaxScrollSize;
10
+ }
11
+ const body = doc === null || doc === void 0 ? void 0 : doc.body;
12
+ if (body) {
13
+ const ownerDocument = body.ownerDocument;
14
+ const element = ownerDocument.createElement('div');
15
+ element.style.cssText = [
16
+ 'height:1px',
17
+ 'left:-10000px',
18
+ 'overflow:scroll',
19
+ 'position:absolute',
20
+ 'top:-10000px',
21
+ 'visibility:hidden',
22
+ 'width:1px',
23
+ ].join(';');
24
+ const content = ownerDocument.createElement('div');
25
+ content.style.height = `${FALLBACK_MAX_SCROLL_SIZE * 4}px`;
26
+ element.appendChild(content);
27
+ body.appendChild(element);
28
+ detectedMaxScrollSize = Math.max(0, Math.min(element.scrollHeight, FALLBACK_MAX_SCROLL_SIZE * 4) - SCROLL_SIZE_GUARD);
29
+ element.remove();
30
+ if (detectedMaxScrollSize > SCROLL_SIZE_GUARD) {
31
+ return detectedMaxScrollSize;
32
+ }
33
+ detectedMaxScrollSize = FALLBACK_MAX_SCROLL_SIZE;
34
+ return detectedMaxScrollSize;
35
+ }
36
+ return FALLBACK_MAX_SCROLL_SIZE;
37
+ }
38
+ function getScrollDimension({ contentSize, clientSize, virtualSize = 0, maxScrollSize = getMaxScrollSize(), }) {
39
+ const safeContentSize = Math.max(0, maxScrollSize - SCROLL_SIZE_GUARD);
40
+ const size = Math.max(0, contentSize);
41
+ const client = Math.max(0, clientSize);
42
+ const viewport = Math.max(0, virtualSize || client);
43
+ const logicalScrollSize = Math.max(0, size - viewport);
44
+ const maxPhysicalScrollSize = Math.max(0, safeContentSize - client);
45
+ const physicalScrollSize = Math.min(logicalScrollSize, maxPhysicalScrollSize);
46
+ const physicalContentSize = client + physicalScrollSize;
47
+ const isCompressed = logicalScrollSize > physicalScrollSize && physicalScrollSize > 0;
48
+ const clampLogical = (coordinate) => Math.min(Math.max(0, coordinate || 0), logicalScrollSize);
49
+ const clampPhysical = (coordinate) => Math.min(Math.max(0, coordinate || 0), physicalScrollSize);
50
+ const toLogicalCoordinate = (coordinate) => {
51
+ if (!logicalScrollSize || !physicalScrollSize) {
52
+ return 0;
53
+ }
54
+ if (!isCompressed) {
55
+ return clampLogical(coordinate);
56
+ }
57
+ return clampLogical((clampPhysical(coordinate) / physicalScrollSize) * logicalScrollSize);
58
+ };
59
+ const toPhysicalCoordinate = (coordinate) => {
60
+ if (!logicalScrollSize || !physicalScrollSize) {
61
+ return 0;
62
+ }
63
+ if (!isCompressed) {
64
+ return clampPhysical(coordinate);
65
+ }
66
+ return clampPhysical((clampLogical(coordinate) / logicalScrollSize) * physicalScrollSize);
67
+ };
68
+ return {
69
+ contentSize: size,
70
+ clientSize: client,
71
+ viewportSize: viewport,
72
+ physicalContentSize,
73
+ logicalScrollSize,
74
+ physicalScrollSize,
75
+ isCompressed,
76
+ toLogicalCoordinate,
77
+ toPhysicalCoordinate,
78
+ getRenderOffset(coordinate) {
79
+ const logical = clampLogical(coordinate);
80
+ return logical - toPhysicalCoordinate(logical);
81
+ },
82
+ };
83
+ }
84
+
85
+ /**
86
+ * Collects data for pinned columns in the required @ViewportProps format.
87
+ */
88
+ /**
89
+ * Represents the slot names for the viewport slots.
90
+ */
91
+ const HEADER_SLOT = 'header'; // Slot name for the header slot
92
+ const FOOTER_SLOT = 'footer'; // Slot name for the footer slot
93
+ const CONTENT_SLOT = 'content'; // Slot name for the content slot
94
+ const DATA_SLOT = 'data'; // Slot name for the data slot
95
+ /**
96
+ * Returns the last visible cell in the viewport for a given row type.
97
+ * Coordinates are not zero-based and are relative to the viewport.
98
+ * If needed to be zero-based they can be adjusted by subtracting 1.
99
+ */
100
+ function getLastCell(data, rowType) {
101
+ // Get the last visible column count from the viewport column data.
102
+ const lastVisibleColumnCount = data.viewports[data.colType].store.get('realCount');
103
+ // Get the last visible row count for the given row type from the viewport column data.
104
+ const lastVisibleRowCount = data.viewports[rowType].store.get('realCount');
105
+ // Return the last visible cell with the last visible column count and row count.
106
+ return {
107
+ x: lastVisibleColumnCount,
108
+ y: lastVisibleRowCount,
109
+ };
110
+ }
111
+ function viewportDataPartition(data, type, slot, fixed) {
112
+ return {
113
+ colData: data.colStore,
114
+ viewportCol: data.viewports[data.colType].store,
115
+ viewportRow: data.viewports[type].store,
116
+ /**
117
+ * lastCell is the last real coordinate + 1, saved to selection store
118
+ */
119
+ lastCell: getLastCell(data, type),
120
+ slot,
121
+ type,
122
+ canDrag: !fixed,
123
+ position: data.position,
124
+ dataStore: data.rowStores[type].store,
125
+ dimensionCol: data.dimensions[data.colType].store,
126
+ dimensionRow: data.dimensions[type].store,
127
+ style: fixed
128
+ ? { height: `${data.dimensions[type].store.get('realSize')}px` }
129
+ : undefined,
130
+ };
131
+ }
132
+
133
+ export { CONTENT_SLOT as C, DATA_SLOT as D, FOOTER_SLOT as F, HEADER_SLOT as H, getScrollDimension as g, viewportDataPartition as v };
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
- import { j as getItemByPosition, W as createStore, w as setStore } from './dimension.helpers-DzxqJQqN.js';
4
+ import { j as getItemByPosition, K as createStore, l as setStore } from './dimension.helpers-CGKwSvw6.js';
5
5
 
6
6
  const LETTER_BLOCK_SIZE = 10;
7
7
  const calculateRowHeaderSize = (itemsLength, rowHeaderColumn, minWidth = 50) => {
@@ -9,6 +9,15 @@ const calculateRowHeaderSize = (itemsLength, rowHeaderColumn, minWidth = 50) =>
9
9
  Math.max((itemsLength.toString().length + 1) * LETTER_BLOCK_SIZE, minWidth));
10
10
  };
11
11
 
12
+ function getViewportMaxCoordinate(dimension, viewportSize, frameOffset = 1) {
13
+ if (!viewportSize || dimension.realSize <= viewportSize) {
14
+ return 0;
15
+ }
16
+ return Math.max(0, dimension.realSize - viewportSize - dimension.originItemSize * frameOffset);
17
+ }
18
+ function clampViewportCoordinate(coordinate, dimension, viewportSize, frameOffset = 1) {
19
+ return Math.min(Math.max(0, coordinate), getViewportMaxCoordinate(dimension, viewportSize, frameOffset));
20
+ }
12
21
  /**
13
22
  * Update items based on new scroll position
14
23
  * If viewport wasn't changed fully simple recombination of positions
@@ -274,6 +283,8 @@ function initialState() {
274
283
  realCount: 0,
275
284
  // size of viewport in px
276
285
  clientSize: 0,
286
+ // logical-to-physical render offset used when scroll space is compressed
287
+ renderOffset: 0,
277
288
  };
278
289
  }
279
290
  /**
@@ -309,21 +320,8 @@ class ViewportStore {
309
320
  const outsize = singleOffsetInPx * 2;
310
321
  // math virtual size is based on visible area + 2 items outside of visible area
311
322
  const virtualSize = viewportSize + outsize;
312
- // expected no scroll if real size less than virtual size, position is 0
313
- let maxCoordinate = 0;
314
- // if there is nodes outside of viewport, max coordinate has to be adjusted
315
- if (dimension.realSize > viewportSize) {
316
- // max coordinate is real size minus virtual/rendered space
317
- maxCoordinate = dimension.realSize - viewportSize - singleOffsetInPx;
318
- }
319
- let pos = position;
320
- // limit position to max and min coordinates
321
- if (pos < 0) {
322
- pos = 0;
323
- }
324
- else if (pos > maxCoordinate) {
325
- pos = maxCoordinate;
326
- }
323
+ const maxCoordinate = getViewportMaxCoordinate(dimension, viewportSize, frameOffset);
324
+ let pos = clampViewportCoordinate(position, dimension, viewportSize, frameOffset);
327
325
  // store last coordinate for further restore on redraw
328
326
  this.lastCoordinate = pos;
329
327
  // actual position is less than first item start based on offset
@@ -401,4 +399,4 @@ class ViewportStore {
401
399
  }
402
400
  }
403
401
 
404
- export { ViewportStore as V, addMissingItems as a, getItems as b, isActiveRangeOutsideLastItem as c, getFirstItem as d, getLastItem as e, calculateRowHeaderSize as f, getUpdatedItemsByPosition as g, isActiveRange as i, recombineByOffset as r, setItemSizes as s, updateMissingAndRange as u };
402
+ export { ViewportStore as V, getUpdatedItemsByPosition as a, addMissingItems as b, clampViewportCoordinate as c, getItems as d, isActiveRangeOutsideLastItem as e, getFirstItem as f, getViewportMaxCoordinate as g, getLastItem as h, isActiveRange as i, calculateRowHeaderSize as j, recombineByOffset as r, setItemSizes as s, updateMissingAndRange as u };
@@ -9,6 +9,7 @@ export type HeaderGroupRendererProps = {
9
9
  providers: ProvidersColumns;
10
10
  additionalData: any;
11
11
  canResize?: boolean;
12
+ renderOffset?: number;
12
13
  onResize?(e: ResizeEvent): void;
13
14
  } & Partial<Pick<ResizeProps, 'active'>>;
14
15
  declare const HeaderGroupRenderer: (p: HeaderGroupRendererProps) => ReturnType<typeof h>;
@@ -8,6 +8,7 @@ export type HeaderRenderProps = {
8
8
  range?: RangeArea | null;
9
9
  canResize?: boolean;
10
10
  canFilter?: boolean;
11
+ renderOffset?: number;
11
12
  onResize?(e: ResizeEvent): void;
12
13
  onClick?(data: InitialHeaderClick): void;
13
14
  onDblClick?(data: InitialHeaderClick): void;
@@ -86,5 +86,11 @@ export declare class RevogrHeaderComponent {
86
86
  render(): any[];
87
87
  private renderHeaderColumns;
88
88
  private renderGroupingColumns;
89
+ private renderGroupRow;
90
+ private renderGroupColumn;
91
+ private getVisibleGroupRange;
92
+ private getHeaderCellKey;
93
+ private getDuplicateHeaderProps;
94
+ private getGroupHeaderCellKey;
89
95
  get providers(): ProvidersColumns<DimensionCols | 'rowHeaders'>;
90
96
  }
@@ -15,6 +15,11 @@ type Config = {
15
15
  export declare class KeyboardService {
16
16
  private sv;
17
17
  constructor(sv: Config);
18
+ /**
19
+ * Appends printable key input that arrives after edit mode was requested
20
+ * but before the editor input has mounted or received focus.
21
+ */
22
+ private appendPendingEditValue;
18
23
  keyDown(e: KeyboardEvent, canRange: boolean, isEditMode: boolean, { range, focus }: Nullable<Pick<EventData, 'range' | 'focus'>>): Promise<void>;
19
24
  private selectAll;
20
25
  keyChangeSelection(e: KeyboardEvent, canRange: boolean): Promise<boolean>;
@@ -20,6 +20,14 @@ export declare class GroupingRowPlugin extends BasePlugin {
20
20
  private beforeTrimmedApply;
21
21
  private beforeFilterTrimmed;
22
22
  private isSortingRunning;
23
+ /**
24
+ * Returns grouping options for regrouping that must preserve current UI state.
25
+ *
26
+ * `expandedAll` and config `prevExpanded` are initial/config instructions.
27
+ * Reusing them after sorting would reopen groups the user collapsed before
28
+ * sorting instead of using the current grouped source state.
29
+ */
30
+ private getCurrentExpandedOptions;
23
31
  /**
24
32
  * Starts global source update with group clearing and applying new one
25
33
  * Initiated when need to reapply grouping
@@ -1,11 +1,16 @@
1
1
  import { BasePlugin } from '../base.plugin';
2
2
  import { ColumnOrderHandler } from './order-column.handler';
3
- import type { ColumnPropProp, DimensionSettingsState, PositionItem, DimensionCols, MultiDimensionType, PluginProviders, DimensionColPin } from "../../types/index";
3
+ import type { ColumnPropProp, ColumnRegular, DimensionSettingsState, PositionItem, DimensionCols, MultiDimensionType, PluginProviders, DimensionColPin } from "../../types/index";
4
+ export declare const COLUMN_DRAG_MOVE_EVENT = "columndragmousemove";
5
+ export declare const COLUMN_DRAG_END_EVENT = "columndragend";
6
+ export declare const BEFORE_COLUMN_DRAG_END_EVENT = "beforecolumndragend";
7
+ export declare const COLUMN_DRAG_START_EVENT = "columndragstart";
4
8
  export type DragStartEventDetails = {
5
9
  event: MouseEvent;
6
10
  data: ColumnPropProp;
7
11
  };
8
- type StaticData = {
12
+ export type ColumnDragStartEventData = ColumnPropProp;
13
+ export type StaticData = {
9
14
  startPos: number;
10
15
  startItem: PositionItem;
11
16
  pin?: DimensionColPin;
@@ -20,11 +25,32 @@ type LocalSubscription = {
20
25
  callback(...params: any[]): void;
21
26
  };
22
27
  export type ColumnDragEventData = {
28
+ /**
29
+ * Reordered columns for the affected column viewport.
30
+ */
31
+ columns: ColumnRegular[];
23
32
  elRect: DOMRect;
24
33
  gridRect: DOMRect;
34
+ /**
35
+ * Physical column indexes in their current visual order.
36
+ */
37
+ order: number[];
25
38
  scrollOffset: number;
26
39
  type: DimensionCols;
27
40
  };
41
+ export type BeforeColumnDragEndEventData = StaticData & {
42
+ startPosition: PositionItem;
43
+ newPosition: PositionItem;
44
+ newItem?: ColumnRegular;
45
+ };
46
+ declare global {
47
+ interface HTMLRevoGridElementEventMap {
48
+ [COLUMN_DRAG_START_EVENT]: ColumnDragStartEventData;
49
+ [COLUMN_DRAG_MOVE_EVENT]: MouseEvent;
50
+ [BEFORE_COLUMN_DRAG_END_EVENT]: BeforeColumnDragEndEventData;
51
+ [COLUMN_DRAG_END_EVENT]: ColumnDragEventData;
52
+ }
53
+ }
28
54
  export declare class ColumnMovePlugin extends BasePlugin {
29
55
  protected moveFunc: import("lodash").DebouncedFunc<(e: MouseEvent) => void>;
30
56
  protected staticDragData: StaticData | null;
@@ -43,7 +69,7 @@ export declare class ColumnMovePlugin extends BasePlugin {
43
69
  * Clearing subscription
44
70
  */
45
71
  clearSubscriptions(): void;
46
- protected getData({ gridEl, dataEl, pin, }: StaticData): ColumnDragEventData;
72
+ protected getData({ gridEl, dataEl, pin }: StaticData, order: number[], source?: ColumnRegular[]): ColumnDragEventData;
47
73
  protected getDimension(type: MultiDimensionType): DimensionSettingsState;
48
74
  }
49
75
  export declare function getLeftRelative(absoluteX: number, gridPos: number, offset: number): number;
@@ -1,6 +1,29 @@
1
1
  import type { CellCompareFunc, ColumnProp, ColumnRegular, DataType, Order } from "../../types/index";
2
- import type { SortingOrderFunction } from './sorting.types';
3
- export declare function sortIndexByItems(indexes: number[], source: DataType[], sortingFunc?: SortingOrderFunction): number[];
2
+ import type { SortingColumnMap, SortingColumnOrder, SortingColumnRender, SortingOrder, SortingOrderFunction } from './sorting.types';
3
+ /**
4
+ * Checks whether a sorting map contains at least one active order.
5
+ *
6
+ * Empty maps and properties with `undefined` order are treated as inactive.
7
+ */
8
+ export declare function hasActiveSorting(sorting?: SortingOrder): boolean;
9
+ /**
10
+ * Returns one-based additive sorting rank for a column.
11
+ *
12
+ * A single active sort does not need a visible rank, so it returns undefined.
13
+ */
14
+ export declare function getSortingIndex(sorting: SortingOrder | undefined, prop: ColumnProp, sortingOrder?: SortingColumnOrder): SortingColumnRender['sortIndex'];
15
+ /**
16
+ * Sorts row indexes against a source collection.
17
+ *
18
+ * @param indexes - Current proxy row indexes to sort.
19
+ * @param source - Full source collection addressed by the indexes.
20
+ * @param sortingFunc - Comparator functions by column property.
21
+ * @param sorting - Active sorting order by column property.
22
+ * @param sortingColumns - Column metadata by property for default-comparer optimization.
23
+ * @param sortingOrder - Active sorting priority in click/config insertion order.
24
+ * @returns Sorted proxy indexes. With no sorting function keys, returns source-order indexes.
25
+ */
26
+ export declare function sortIndexByItems(indexes: number[], source: DataType[], sortingFunc?: SortingOrderFunction, sorting?: SortingOrder, sortingColumns?: SortingColumnMap, sortingOrder?: SortingColumnOrder): number[];
4
27
  export declare function defaultCellCompare(this: {
5
28
  column?: ColumnRegular;
6
29
  }, prop: ColumnProp, a: DataType, b: DataType): 0 | 1 | -1;
@@ -1,6 +1,6 @@
1
1
  import { BasePlugin } from '../base.plugin';
2
2
  import type { ColumnRegular, DimensionRows, PluginProviders } from "../../types/index";
3
- import type { SortingConfig, SortingOrder, SortingOrderFunction } from './sorting.types';
3
+ import type { SortingColumnMap, SortingColumnOrder, SortingConfig, SortingOrder, SortingOrderFunction } from './sorting.types';
4
4
  export * from './sorting.types';
5
5
  export * from './sorting.func';
6
6
  export * from './sorting.sign';
@@ -15,34 +15,109 @@ export * from './sorting.sign';
15
15
  */
16
16
  export declare class SortingPlugin extends BasePlugin {
17
17
  revogrid: HTMLRevoGridElement;
18
+ /**
19
+ * Current sorting order per column property.
20
+ */
18
21
  sorting?: SortingOrder;
22
+ /**
23
+ * Comparator functions indexed by column property.
24
+ *
25
+ * Multiple columns can be sorted at the same time.
26
+ */
19
27
  sortingFunc?: SortingOrderFunction;
20
28
  /**
21
- * Delayed sorting promise
29
+ * Column metadata for the current sorting state.
30
+ *
31
+ * Used internally to optimize default sorting without changing comparator
32
+ * functions or their public API contract.
33
+ */
34
+ private sortingColumns?;
35
+ /**
36
+ * Active sorting priority in click/config insertion order.
37
+ *
38
+ * Required for numeric column props because object key iteration does not
39
+ * preserve insertion order for integer-like keys.
40
+ */
41
+ private sortingOrder?;
42
+ /**
43
+ * Delayed sorting promise registered in the grid render job queue.
22
44
  */
23
45
  sortingPromise: (() => void) | null;
24
46
  /**
25
- * We need to sort only so often
47
+ * Debounced sorting entry point.
48
+ *
49
+ * Sorting can be requested by column changes, source changes, and header
50
+ * clicks in quick succession, so the actual sort is delayed and coalesced.
26
51
  */
27
- postponeSort: import("lodash").DebouncedFunc<(order?: SortingOrder, comparison?: SortingOrderFunction, ignoreViewportUpdate?: boolean) => void>;
52
+ postponeSort: import("lodash").DebouncedFunc<(order?: SortingOrder, comparison?: SortingOrderFunction, sortingColumns?: SortingColumnMap, sortingOrder?: SortingColumnOrder, ignoreViewportUpdate?: boolean) => void>;
28
53
  constructor(revogrid: HTMLRevoGridElement, providers: PluginProviders, config?: SortingConfig);
29
54
  /**
30
- * Entry point for sorting, waits for all delays, registers jobs
55
+ * Creates mutable sorting maps from current state when additive sorting is requested.
56
+ */
57
+ private createSortingState;
58
+ /**
59
+ * Stores normalized sorting state, clearing inactive empty maps.
60
+ */
61
+ private setSortingState;
62
+ /**
63
+ * Adds or replaces a column in a sorting state.
64
+ */
65
+ private setColumnSorting;
66
+ /**
67
+ * Removes a column from a sorting state.
68
+ */
69
+ private clearColumnSorting;
70
+ /**
71
+ * Normalizes external sorting configuration into internal order,
72
+ * comparator, and column metadata maps.
73
+ */
74
+ private applySortingConfig;
75
+ /**
76
+ * Schedules sorting before the next render.
77
+ *
78
+ * @param order - Active sorting order by column property.
79
+ * @param sortingFunc - Comparator functions by column property.
80
+ * @param sortingColumns - Column metadata by property.
81
+ * @param sortingOrder - Active sorting priority in click/config insertion order.
82
+ * @param ignoreViewportUpdate - Skips dimension position recalculation when true.
31
83
  */
32
84
  startSorting(order?: SortingOrder, sortingFunc?: SortingOrderFunction, ignoreViewportUpdate?: boolean): void;
85
+ startSorting(order?: SortingOrder, sortingFunc?: SortingOrderFunction, sortingColumns?: SortingColumnMap, sortingOrder?: SortingColumnOrder, ignoreViewportUpdate?: boolean): void;
33
86
  /**
34
- * Apply sorting to data on header click
35
- * If additive - add to existing sorting, multiple columns can be sorted
87
+ * Applies sorting requested by a sortable header click.
88
+ *
89
+ * @param column - Column that initiated sorting.
90
+ * @param additive - If true, add/remove this column from the current multi-sort state.
36
91
  */
37
92
  headerclick(column: ColumnRegular, additive: boolean): void;
93
+ /**
94
+ * Applies sorting state produced by a header click.
95
+ */
96
+ private applyHeaderSorting;
97
+ /**
98
+ * Runs a scheduled sort and resolves the render-blocking sorting promise.
99
+ *
100
+ * @param order - Active sorting order by column property.
101
+ * @param comparison - Comparator functions by column property.
102
+ * @param sortingColumns - Column metadata by property.
103
+ * @param sortingOrder - Active sorting priority in click/config insertion order.
104
+ * @param ignoreViewportUpdate - Skips dimension position recalculation when true.
105
+ */
38
106
  runSorting(order?: SortingOrder, comparison?: SortingOrderFunction, ignoreViewportUpdate?: boolean): void;
107
+ runSorting(order?: SortingOrder, comparison?: SortingOrderFunction, sortingColumns?: SortingColumnMap, sortingOrder?: SortingColumnOrder, ignoreViewportUpdate?: boolean): void;
39
108
  /**
40
- * Sort items by sorting function
109
+ * Sorts row proxy indexes by sorting functions.
110
+ *
41
111
  * @requires proxyItems applied to row store
42
112
  * @requires source applied to row store
43
113
  *
44
114
  * @param sorting - per column sorting
45
- * @param data - this.stores['rgRow'].store.get('source')
115
+ * @param sortingFunc - Comparator functions by column property.
116
+ * @param sortingColumns - Column metadata by property.
117
+ * @param sortingOrder - Active sorting priority in click/config insertion order.
118
+ * @param types - Row stores to sort.
119
+ * @param ignoreViewportUpdate - Skips dimension position recalculation when true.
46
120
  */
47
121
  sort(sorting?: SortingOrder, sortingFunc?: SortingOrderFunction, types?: DimensionRows[], ignoreViewportUpdate?: boolean): void;
122
+ sort(sorting?: SortingOrder, sortingFunc?: SortingOrderFunction, sortingColumns?: SortingColumnMap, sortingOrder?: SortingColumnOrder, types?: DimensionRows[], ignoreViewportUpdate?: boolean): void;
48
123
  }
@@ -1,6 +1,10 @@
1
1
  import { ColumnRegular } from "../../types/index";
2
+ import type { SortingColumnRender } from './sorting.types';
2
3
  type Props = {
3
- column: ColumnRegular;
4
+ column: ColumnRegular & SortingColumnRender;
4
5
  };
6
+ /**
7
+ * Renders sorting direction and optional additive sorting rank.
8
+ */
5
9
  export declare const SortingSign: ({ column }: Props) => any;
6
10
  export {};