@revolist/revogrid 4.21.0 → 4.21.3

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 (90) hide show
  1. package/dist/cjs/{cell-renderer-iLXu-jlp.js → cell-renderer-BLcxDHzP.js} +2 -2
  2. package/dist/cjs/{column.drag.plugin-eaYWjuoZ.js → column.drag.plugin-DfTAC5Qc.js} +15 -9
  3. package/dist/cjs/{column.service-fHfnFgbR.js → column.service-BmT2HOnj.js} +6 -2
  4. package/dist/cjs/{dimension.helpers-DLLC6uO6.js → dimension.helpers-BOxHtX5T.js} +13 -3
  5. package/dist/cjs/{edit.utils-BWpSdGmj.js → edit.utils-DnvQVP4H.js} +1 -1
  6. package/dist/cjs/{header-cell-renderer-CRT8nEvk.js → header-cell-renderer-7DgGThjq.js} +1 -1
  7. package/dist/cjs/index.cjs.js +9 -8
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/revo-grid.cjs.entry.js +45 -13
  10. package/dist/cjs/revo-grid.cjs.js +1 -1
  11. package/dist/cjs/revogr-attribution_7.cjs.entry.js +5 -5
  12. package/dist/cjs/revogr-clipboard_3.cjs.entry.js +5 -3
  13. package/dist/cjs/revogr-data_4.cjs.entry.js +8 -7
  14. package/dist/cjs/revogr-filter-panel.cjs.entry.js +1 -1
  15. package/dist/cjs/{text-editor-tI8PMl7r.js → text-editor-B9ibcdrl.js} +2 -2
  16. package/dist/cjs/{throttle-Rub9czPz.js → throttle-DkuCcmB0.js} +1 -1
  17. package/dist/cjs/{viewport.store-BkVhhu7P.js → viewport.store-DG-4bWqg.js} +2 -2
  18. package/dist/collection/components/clipboard/revogr-clipboard.js +6 -4
  19. package/dist/collection/components/revoGrid/grid.helpers.js +2 -2
  20. package/dist/collection/components/revoGrid/revo-grid.js +63 -2
  21. package/dist/collection/components/revoGrid/viewport.scrolling.service.js +2 -2
  22. package/dist/collection/components/revoGrid/viewport.service.js +2 -0
  23. package/dist/collection/components/scroll/revogr-viewport-scroll.js +23 -2
  24. package/dist/collection/plugins/base.plugin.js +3 -0
  25. package/dist/collection/plugins/filter/filter.style.css +0 -1
  26. package/dist/collection/plugins/sorting/sorting.plugin.js +1 -1
  27. package/dist/collection/serve/controller.js +59 -0
  28. package/dist/collection/services/data.provider.js +18 -2
  29. package/dist/collection/store/dataSource/data.store.js +14 -4
  30. package/dist/collection/store/dimension/dimension.recalculate.plugin.js +4 -3
  31. package/dist/collection/store/dimension/dimension.store.js +3 -1
  32. package/dist/collection/store/vp/viewport.helpers.js +1 -1
  33. package/dist/collection/types/events.js +1 -0
  34. package/dist/collection/utils/column.utils.js +5 -1
  35. package/dist/{revo-grid/cell-renderer-Dbkws2Qx.js → esm/cell-renderer-BNeaYjy6.js} +2 -2
  36. package/dist/esm/{column.drag.plugin-DQ2k24n7.js → column.drag.plugin-C9lvlTfl.js} +15 -9
  37. package/dist/esm/{column.service-BsgaP7Ww.js → column.service-8pPNyrKn.js} +6 -2
  38. package/dist/{revo-grid/dimension.helpers-C2F2Cuh8.js → esm/dimension.helpers-B-5OBYes.js} +13 -3
  39. package/dist/esm/{edit.utils-Cdhf8P7e.js → edit.utils-CQjRmx5n.js} +1 -1
  40. package/dist/{revo-grid/header-cell-renderer-HSFeeOeL.js → esm/header-cell-renderer-WkTbrmr7.js} +1 -1
  41. package/dist/esm/index.js +10 -9
  42. package/dist/esm/loader.js +1 -1
  43. package/dist/esm/revo-grid.entry.js +45 -13
  44. package/dist/esm/revo-grid.js +1 -1
  45. package/dist/esm/revogr-attribution_7.entry.js +5 -5
  46. package/dist/esm/revogr-clipboard_3.entry.js +5 -3
  47. package/dist/esm/revogr-data_4.entry.js +8 -7
  48. package/dist/esm/revogr-filter-panel.entry.js +1 -1
  49. package/dist/{revo-grid/text-editor-BylR9oxh.js → esm/text-editor-DZSx2pWr.js} +2 -2
  50. package/dist/esm/{throttle-BEccmfmt.js → throttle-CYM0qC3v.js} +1 -1
  51. package/dist/{revo-grid/viewport.store-CJZ-1j6C.js → esm/viewport.store-BGWR3XfI.js} +2 -2
  52. package/dist/{esm/cell-renderer-Dbkws2Qx.js → revo-grid/cell-renderer-BNeaYjy6.js} +2 -2
  53. package/dist/revo-grid/{column.drag.plugin-DQ2k24n7.js → column.drag.plugin-C9lvlTfl.js} +15 -9
  54. package/dist/revo-grid/{column.service-BsgaP7Ww.js → column.service-8pPNyrKn.js} +6 -2
  55. package/dist/{esm/dimension.helpers-C2F2Cuh8.js → revo-grid/dimension.helpers-B-5OBYes.js} +13 -3
  56. package/dist/revo-grid/{edit.utils-Cdhf8P7e.js → edit.utils-CQjRmx5n.js} +1 -1
  57. package/dist/{esm/header-cell-renderer-HSFeeOeL.js → revo-grid/header-cell-renderer-WkTbrmr7.js} +1 -1
  58. package/dist/revo-grid/index.esm.js +10 -9
  59. package/dist/revo-grid/revo-grid.entry.js +45 -13
  60. package/dist/revo-grid/revo-grid.esm.js +1 -1
  61. package/dist/revo-grid/revogr-attribution_7.entry.js +5 -5
  62. package/dist/revo-grid/revogr-clipboard_3.entry.js +5 -3
  63. package/dist/revo-grid/revogr-data_4.entry.js +8 -7
  64. package/dist/revo-grid/revogr-filter-panel.entry.js +1 -1
  65. package/dist/{esm/text-editor-BylR9oxh.js → revo-grid/text-editor-DZSx2pWr.js} +2 -2
  66. package/dist/revo-grid/{throttle-BEccmfmt.js → throttle-CYM0qC3v.js} +1 -1
  67. package/dist/{esm/viewport.store-CJZ-1j6C.js → revo-grid/viewport.store-BGWR3XfI.js} +2 -2
  68. package/dist/types/components/clipboard/revogr-clipboard.d.ts +2 -0
  69. package/dist/types/components/revoGrid/revo-grid.d.ts +11 -0
  70. package/dist/types/components/revoGrid/viewport.scrolling.service.d.ts +1 -1
  71. package/dist/types/components/revoGrid/viewport.service.d.ts +1 -0
  72. package/dist/types/components/scroll/revogr-viewport-scroll.d.ts +1 -0
  73. package/dist/types/components.d.ts +33 -0
  74. package/dist/types/plugins/sorting/sorting.plugin.d.ts +1 -1
  75. package/dist/types/services/data.provider.d.ts +15 -1
  76. package/dist/types/store/dataSource/data.store.d.ts +3 -1
  77. package/dist/types/types/events.d.ts +1 -1
  78. package/dist/types/types/viewport.interfaces.d.ts +7 -2
  79. package/hydrate/index.js +78 -21
  80. package/hydrate/index.mjs +78 -21
  81. package/package.json +5 -2
  82. package/readme.md +34 -0
  83. package/standalone/column.service.js +1 -1
  84. package/standalone/data.store.js +1 -1
  85. package/standalone/index.js +1 -1
  86. package/standalone/revo-grid.js +1 -1
  87. package/standalone/revogr-clipboard2.js +1 -1
  88. package/standalone/revogr-filter-panel.js +1 -1
  89. package/standalone/revogr-row-headers2.js +1 -1
  90. package/standalone/revogr-viewport-scroll2.js +1 -1
@@ -35,6 +35,7 @@ export class Clipboard {
35
35
  const beforePasteApply = this.beforePasteApply.emit({
36
36
  raw: data,
37
37
  parsed: parsedData,
38
+ dataText,
38
39
  event: e,
39
40
  });
40
41
  if (beforePasteApply.defaultPrevented) {
@@ -45,6 +46,7 @@ export class Clipboard {
45
46
  const afterPasteApply = this.afterPasteApply.emit({
46
47
  raw: data,
47
48
  parsed: parsedData,
49
+ dataText,
48
50
  event: e,
49
51
  });
50
52
  // keep default behavior if needed
@@ -180,8 +182,8 @@ export class Clipboard {
180
182
  "text": "Paste 2. Fired before paste applied to the grid and after data parsed"
181
183
  },
182
184
  "complexType": {
183
- "original": "{\n raw: string;\n parsed: string[][];\n event: ClipboardEvent;\n }",
184
- "resolved": "{ raw: string; parsed: string[][]; event: ClipboardEvent; }",
185
+ "original": "{\n raw: string;\n parsed: string[][];\n dataText: string;\n event: ClipboardEvent;\n }",
186
+ "resolved": "{ raw: string; parsed: string[][]; dataText: string; event: ClipboardEvent; }",
185
187
  "references": {
186
188
  "ClipboardEvent": {
187
189
  "location": "global",
@@ -221,8 +223,8 @@ export class Clipboard {
221
223
  "text": "Paste 4. Fired after paste applied to the grid\ndefaultPrevented - if true, paste will be canceled"
222
224
  },
223
225
  "complexType": {
224
- "original": "{\n raw: string;\n parsed: string[][];\n event: ClipboardEvent;\n }",
225
- "resolved": "{ raw: string; parsed: string[][]; event: ClipboardEvent; }",
226
+ "original": "{\n raw: string;\n parsed: string[][];\n dataText: string;\n event: ClipboardEvent;\n }",
227
+ "resolved": "{ raw: string; parsed: string[][]; dataText: string; event: ClipboardEvent; }",
226
228
  "references": {
227
229
  "ClipboardEvent": {
228
230
  "location": "global",
@@ -8,7 +8,7 @@ export const rowDefinitionByType = (newVal = []) => {
8
8
  if (!rowDefs) {
9
9
  rowDefs = result[v.type] = {};
10
10
  }
11
- if (v.size) {
11
+ if (typeof v.size === 'number') {
12
12
  if (!rowDefs.sizes) {
13
13
  rowDefs.sizes = {};
14
14
  }
@@ -24,7 +24,7 @@ export const rowDefinitionRemoveByType = (oldVal = []) => {
24
24
  if (!rowDefs) {
25
25
  rowDefs = result[v.type] = [];
26
26
  }
27
- if (v.size) {
27
+ if (typeof v.size === 'number') {
28
28
  rowDefs.push(v.index);
29
29
  }
30
30
  }
@@ -70,6 +70,10 @@ export class RevoGridComponent {
70
70
  this.readonly = false;
71
71
  /** When true, columns are resizable. */
72
72
  this.resize = false;
73
+ /**
74
+ * Prevents horizontal scroll state from being mirrored across viewport sections.
75
+ */
76
+ this.noHorizontalScrollTransfer = false;
73
77
  /** When true cell focus appear. */
74
78
  this.canFocus = true;
75
79
  /** When true enable clipboard. */
@@ -605,7 +609,13 @@ export class RevoGridComponent {
605
609
  if (!this.dimensionProvider || !this.columnProvider) {
606
610
  return;
607
611
  }
608
- const columnGather = getColumns(newVal, 0, this.columnTypes);
612
+ const beforeGatherEvent = this.beforecolumnsgather.emit({
613
+ columns: [...newVal],
614
+ });
615
+ if (beforeGatherEvent.defaultPrevented) {
616
+ return;
617
+ }
618
+ const columnGather = getColumns(beforeGatherEvent.detail.columns, 0, this.columnTypes);
609
619
  const beforeSetEvent = this.beforecolumnsset.emit(columnGather);
610
620
  if (beforeSetEvent.defaultPrevented) {
611
621
  return;
@@ -952,6 +962,7 @@ export class RevoGridComponent {
952
962
  scrollingService: this.scrollingService,
953
963
  orderService: this.orderService,
954
964
  selectionStoreConnector: this.selectionStoreConnector,
965
+ noHorizontalScrollTransfer: this.noHorizontalScrollTransfer,
955
966
  disableVirtualX: this.disableVirtualX,
956
967
  disableVirtualY: this.disableVirtualY,
957
968
  resize: c => this.aftercolumnresize.emit(c),
@@ -992,7 +1003,9 @@ export class RevoGridComponent {
992
1003
  dataViews.push(dataView);
993
1004
  });
994
1005
  // Add viewport scroll in the end
995
- viewPortHtml.push(h("revogr-viewport-scroll", Object.assign({}, view.prop, { ref: el => this.scrollingService.registerElement(el, `${view.prop.key}`), onScrollviewport: e => this.scrollingService.proxyScroll(e.detail, `${view.prop.key}`), onScrollviewportsilent: e => this.scrollingService.scrollSilentService(e.detail, `${view.prop.key}`) }), dataViews));
1006
+ viewPortHtml.push(h("revogr-viewport-scroll", Object.assign({}, view.prop, { ref: el => this.scrollingService.registerElement(el, `${view.prop.key}`), onScrollviewport: e => {
1007
+ this.scrollingService.proxyScroll(e.detail, `${view.prop.key}`, this.noHorizontalScrollTransfer && e.detail.dimension === 'rgCol');
1008
+ }, onScrollviewportsilent: e => this.scrollingService.scrollSilentService(e.detail, `${view.prop.key}`) }), dataViews));
996
1009
  }
997
1010
  viewportSections.push(viewPortHtml);
998
1011
  // #endregion
@@ -1173,6 +1186,26 @@ export class RevoGridComponent {
1173
1186
  "attribute": "resize",
1174
1187
  "defaultValue": "false"
1175
1188
  },
1189
+ "noHorizontalScrollTransfer": {
1190
+ "type": "boolean",
1191
+ "mutable": false,
1192
+ "complexType": {
1193
+ "original": "boolean",
1194
+ "resolved": "boolean",
1195
+ "references": {}
1196
+ },
1197
+ "required": false,
1198
+ "optional": false,
1199
+ "docs": {
1200
+ "tags": [],
1201
+ "text": "Prevents horizontal scroll state from being mirrored across viewport sections."
1202
+ },
1203
+ "getter": false,
1204
+ "setter": false,
1205
+ "reflect": false,
1206
+ "attribute": "no-horizontal-scroll-transfer",
1207
+ "defaultValue": "false"
1208
+ },
1176
1209
  "canFocus": {
1177
1210
  "type": "boolean",
1178
1211
  "mutable": false,
@@ -2344,6 +2377,34 @@ export class RevoGridComponent {
2344
2377
  }
2345
2378
  }
2346
2379
  }
2380
+ }, {
2381
+ "method": "beforecolumnsgather",
2382
+ "name": "beforecolumnsgather",
2383
+ "bubbles": true,
2384
+ "cancelable": true,
2385
+ "composed": true,
2386
+ "docs": {
2387
+ "tags": [],
2388
+ "text": "Emitted before user column definitions are gathered into the internal column collection.\nListeners can replace `detail.columns` to rewrite the raw column set before RevoGrid normalizes it."
2389
+ },
2390
+ "complexType": {
2391
+ "original": "{\n columns: (ColumnGrouping | ColumnRegular)[];\n }",
2392
+ "resolved": "{ columns: (ColumnRegular | ColumnGrouping<any>)[]; }",
2393
+ "references": {
2394
+ "ColumnGrouping": {
2395
+ "location": "import",
2396
+ "path": "@type",
2397
+ "id": "src/types/index.ts::ColumnGrouping",
2398
+ "referenceLocation": "ColumnGrouping"
2399
+ },
2400
+ "ColumnRegular": {
2401
+ "location": "import",
2402
+ "path": "@type",
2403
+ "id": "src/types/index.ts::ColumnRegular",
2404
+ "referenceLocation": "ColumnRegular"
2405
+ }
2406
+ }
2407
+ }
2347
2408
  }, {
2348
2409
  "method": "beforecolumnsset",
2349
2410
  "name": "beforecolumnsset",
@@ -7,11 +7,11 @@ export default class GridScrollingService {
7
7
  this.setViewport = setViewport;
8
8
  this.elements = {};
9
9
  }
10
- async proxyScroll(e, key) {
10
+ async proxyScroll(e, key, skipEvent) {
11
11
  var _a;
12
12
  let newEventPromise;
13
13
  let event = e;
14
- for (let elKey in this.elements) {
14
+ for (let elKey in (skipEvent ? {} : this.elements)) {
15
15
  // skip
16
16
  if (e.dimension === 'rgCol' && elKey === 'headerRow') {
17
17
  continue;
@@ -13,6 +13,7 @@ function gatherColumnData(data) {
13
13
  contentHeight: data.contentHeight,
14
14
  key: data.colType,
15
15
  colType: data.colType,
16
+ noHorizontalScrollTransfer: data.noHorizontalScrollTransfer,
16
17
  onResizeviewport: data.onResizeviewport,
17
18
  // set viewport size to real size
18
19
  style: data.fixWidth ? { minWidth: `${realWidth}px` } : undefined,
@@ -57,6 +58,7 @@ export default class ViewportService {
57
58
  viewports: config.viewportProvider.stores,
58
59
  dimensions: config.dimensionProvider.stores,
59
60
  rowStores: config.dataProvider.stores,
61
+ noHorizontalScrollTransfer: config.noHorizontalScrollTransfer,
60
62
  colStore,
61
63
  onHeaderresize: e => this.onColumnResize(val, e, colStore),
62
64
  };
@@ -22,6 +22,7 @@ export class RevogrViewportScroll {
22
22
  * Height of inner content
23
23
  */
24
24
  this.contentHeight = 0;
25
+ this.noHorizontalScrollTransfer = false;
25
26
  }
26
27
  async setScroll(e) {
27
28
  var _a;
@@ -206,7 +207,7 @@ export class RevogrViewportScroll {
206
207
  this.setScrollVisibility('rgCol', this.horizontalScroll.clientWidth, this.contentWidth);
207
208
  }
208
209
  render() {
209
- return (h(Host, { key: '2be96df29e23c7a681a45675567b5f168786cf92', onWheel: this.horizontalMouseWheel, onScroll: (e) => this.applyScroll('rgCol', e) }, h("div", { key: '49152054dc9c8bdbffc430aa4ee2cf8c2732e05c', class: "inner-content-table", style: { width: `${this.contentWidth}px` } }, h("div", { key: '6a2124ed6345021fbbfbd78607dc280918ef9bc5', class: "header-wrapper", ref: e => (this.header = e) }, h("slot", { key: '0a25f0620be889d87fbf81325ffb596919105f4d', name: HEADER_SLOT })), h("div", { key: '7c986664c70ebc6f6d996864e591e484d709c3a5', class: "vertical-inner", ref: el => (this.verticalScroll = el), onWheel: this.verticalMouseWheel, onScroll: (e) => this.applyScroll('rgRow', e) }, h("div", { key: 'bf810ecbb62b35334b24ab72292ae37866002cb9', class: "content-wrapper", style: { height: `${this.contentHeight}px` } }, h("slot", { key: '7d0bf53549eb60d9e6942b05fe1037131562ca2e', name: CONTENT_SLOT }))), h("div", { key: '78d8bdc545e220b324665b5331d902d887ea5e2b', class: "footer-wrapper", ref: e => (this.footer = e) }, h("slot", { key: '76d5b39a94ba27411ca0b58e49714b21e0e837bf', name: FOOTER_SLOT })))));
210
+ return (h(Host, { key: 'adc7378dba1794ca2ec263d52b09abefe50bcbfd', onWheel: this.horizontalMouseWheel, onScroll: (e) => this.applyScroll('rgCol', e) }, h("div", { key: '7b57a8a0ea44629fefcfe4d2cd77bf0f048d8e06', class: "inner-content-table", style: { width: `${this.contentWidth}px` } }, h("div", { key: 'cca3de158bc2a7f0651f578a281819be5698b257', class: "header-wrapper", ref: e => (this.header = e) }, h("slot", { key: '1d170147dabe034f2c35481a8e2fedd6de2b6aed', name: HEADER_SLOT })), h("div", { key: 'b6dd29a91bb1f380a83a035dfdb749ca669936f2', class: "vertical-inner", ref: el => (this.verticalScroll = el), onWheel: this.verticalMouseWheel, onScroll: (e) => this.applyScroll('rgRow', e) }, h("div", { key: '9bce27bf8ec4d3b679aa9a34eb6379a8c2d46cac', class: "content-wrapper", style: { height: `${this.contentHeight}px` } }, h("slot", { key: 'b44a082c9fbb948fd87bd235b4cd4356fd4a3536', name: CONTENT_SLOT }))), h("div", { key: '28c305ff6bc664f1d1bbb117e8b8565c8d4bb6b2', class: "footer-wrapper", ref: e => (this.footer = e) }, h("slot", { key: '96312fb7f18198fd1feb9dcc00c79cde74ba9c9f', name: FOOTER_SLOT })))));
210
211
  }
211
212
  /**
212
213
  * Extra layer for scroll event monitoring, where MouseWheel event is not passing
@@ -285,7 +286,7 @@ export class RevogrViewportScroll {
285
286
  const atRight = scrollLeft + clientWidth >= scrollWidth && e.deltaX > 0;
286
287
  // Detect if the user has reached the left end
287
288
  const atLeft = scrollLeft === 0 && e.deltaX < 0;
288
- if (!atRight && !atLeft) {
289
+ if (!atRight && !atLeft && !this.noHorizontalScrollTransfer) {
289
290
  (_a = e.preventDefault) === null || _a === void 0 ? void 0 : _a.call(e);
290
291
  }
291
292
  const pos = scrollLeft + e[delta];
@@ -389,6 +390,26 @@ export class RevogrViewportScroll {
389
390
  "setter": false,
390
391
  "reflect": false,
391
392
  "attribute": "col-type"
393
+ },
394
+ "noHorizontalScrollTransfer": {
395
+ "type": "boolean",
396
+ "mutable": false,
397
+ "complexType": {
398
+ "original": "boolean",
399
+ "resolved": "boolean",
400
+ "references": {}
401
+ },
402
+ "required": false,
403
+ "optional": false,
404
+ "docs": {
405
+ "tags": [],
406
+ "text": ""
407
+ },
408
+ "getter": false,
409
+ "setter": false,
410
+ "reflect": false,
411
+ "attribute": "no-horizontal-scroll-transfer",
412
+ "defaultValue": "false"
392
413
  }
393
414
  };
394
415
  }
@@ -32,10 +32,13 @@ export class BasePlugin {
32
32
  * @param immediate - trigger callback immediately with current value
33
33
  */
34
34
  watch(prop, callback, { immediate } = { immediate: false }) {
35
+ var _a;
35
36
  const nativeValueDesc = Object.getOwnPropertyDescriptor(this.revogrid, prop) ||
36
37
  Object.getOwnPropertyDescriptor(this.revogrid.constructor.prototype, prop);
37
38
  // Overwrite property descriptor for this instance
38
39
  Object.defineProperty(this.revogrid, prop, {
40
+ configurable: true,
41
+ enumerable: (_a = nativeValueDesc === null || nativeValueDesc === void 0 ? void 0 : nativeValueDesc.enumerable) !== null && _a !== void 0 ? _a : true,
39
42
  set(val) {
40
43
  var _a;
41
44
  const keepDefault = callback(val);
@@ -42,7 +42,6 @@ revogr-filter-panel {
42
42
  left: 0;
43
43
  z-index: 100;
44
44
  max-height: calc(100% - 80px);
45
- min-width: 250px;
46
45
  overflow: auto;
47
46
  opacity: 1;
48
47
  transform: none;
@@ -101,7 +101,7 @@ export class SortingPlugin extends BasePlugin {
101
101
  });
102
102
  }
103
103
  /**
104
- * Entry point for sorting, waits for all delayes, registers jobs
104
+ * Entry point for sorting, waits for all delays, registers jobs
105
105
  */
106
106
  startSorting(order, sortingFunc, ignoreViewportUpdate) {
107
107
  if (!this.sortingPromise) {
@@ -300,6 +300,65 @@ window.setFilter = () => {
300
300
  grid.filter = filterConfig;
301
301
  };
302
302
 
303
+ /**
304
+ * Deep groups should align with a1/a2/a3/b1/b2/b3.
305
+ * https://github.com/revolist/revogrid/issues/828
306
+ */
307
+ window.setColumnGroupOffsetBugDemo = () => {
308
+ const grid = document.querySelector('revo-grid');
309
+
310
+ grid.columns = [
311
+ { prop: 'q1', name: 'Q1', size: 90 },
312
+ { prop: 'q2', name: 'Q2', size: 90 },
313
+ {
314
+ name: 'Root',
315
+ children: [
316
+ {
317
+ name: 'A',
318
+ children: [
319
+ {
320
+ name: 'A1',
321
+ children: [
322
+ { prop: 'a1', name: 'A1-1', size: 90 },
323
+ { prop: 'a2', name: 'A1-2', size: 90 },
324
+ ],
325
+ },
326
+ {
327
+ name: 'A2',
328
+ children: [{ prop: 'a3', name: 'A2-1', size: 90 }],
329
+ },
330
+ ],
331
+ },
332
+ {
333
+ name: 'B',
334
+ children: [
335
+ {
336
+ name: 'B1',
337
+ children: [{ prop: 'b1', name: 'B1-1', size: 90 }],
338
+ },
339
+ {
340
+ name: 'B2',
341
+ children: [
342
+ { prop: 'b2', name: 'B2-1', size: 90 },
343
+ { prop: 'b3', name: 'B2-2', size: 90 },
344
+ ],
345
+ },
346
+ ],
347
+ },
348
+ ],
349
+ },
350
+ ];
351
+
352
+ grid.source = [
353
+ { q1: 'left-1', q2: 'left-2', a1: 'a1', a2: 'a2', a3: 'a3', b1: 'b1', b2: 'b2', b3: 'b3' },
354
+ { q1: 'left-3', q2: 'left-4', a1: 'a4', a2: 'a5', a3: 'a6', b1: 'b4', b2: 'b5', b3: 'b6' },
355
+ ];
356
+
357
+ grid.pinnedTopSource = [];
358
+ grid.pinnedBottomSource = [];
359
+ grid.rowHeaders = true;
360
+ };
361
+
303
362
  /**
304
363
  * On load function
305
364
  */
@@ -16,9 +16,25 @@ export class DataProvider {
16
16
  return sources;
17
17
  }, {});
18
18
  }
19
- setData(data, type = 'rgRow', disableVirtualRows = false, grouping, silent = false) {
19
+ /**
20
+ * Replaces the data source for a row type and synchronizes the related dimension metadata.
21
+ *
22
+ * `rgRow` updates also refresh the virtual row model unless `disableVirtualRows` is set.
23
+ * Pinned row types skip virtual row recalculation because they are rendered directly.
24
+ *
25
+ * @param data Full source data assigned to the target row store.
26
+ * @param type Row collection to update. Defaults to the main body rows.
27
+ * @param disableVirtualRows Prevents recalculating virtual rows for the main row store.
28
+ * @param grouping Optional grouping metadata applied together with the new data set.
29
+ * @param silent Preserves the current trimmed state instead of resetting it during the update.
30
+ * @param preserveTrimmed Re-applies current trimmed indexes after a silent update.
31
+ * @returns The same `data` array that was provided to the method.
32
+ */
33
+ setData(data, type = 'rgRow', disableVirtualRows = false, grouping,
34
+ // if true, store will be updated without resetting trimmed state
35
+ silent = false, preserveTrimmed = false) {
20
36
  // set rgRow data
21
- this.stores[type].updateData([...data], grouping, silent);
37
+ this.stores[type].updateData([...data], grouping, silent, preserveTrimmed);
22
38
  // for pinned row no need virtual data
23
39
  const noVirtual = type !== 'rgRow' || disableVirtualRows;
24
40
  this.dimensionProvider.setData(data.length, type, noVirtual);
@@ -4,7 +4,7 @@
4
4
  import findIndex from "lodash/findIndex";
5
5
  import range from "lodash/range";
6
6
  import { createStore } from "@stencil/store";
7
- import { trimmedPlugin } from "./trimmed.plugin";
7
+ import { gatherTrimmedItems, trimmedPlugin } from "./trimmed.plugin";
8
8
  import { setStore } from "../../utils";
9
9
  import { proxyPlugin } from "./data.proxy";
10
10
  /**
@@ -24,8 +24,16 @@ export class DataStore {
24
24
  * full data source update
25
25
  * @param source - data column/rgRow source
26
26
  * @param grouping - grouping information if present
27
+ * @param silent - if true, store will be updated without resetting trimmed state
28
+ * @param preserveTrimmed - if true, current trimmed indexes will be re-applied to the new source, use with caution because physical indexes may change across full data refreshes
27
29
  */
28
- updateData(source, grouping, silent = false) {
30
+ updateData(source, grouping,
31
+ // if true, store will be updated without resetting trimmed state
32
+ silent = false,
33
+ // if true, current trimmed indexes will be re-applied to the new source
34
+ preserveTrimmed = false) {
35
+ const trimmed = this.store.get('trimmed');
36
+ const trimmedItems = silent && preserveTrimmed ? gatherTrimmedItems(trimmed) : null;
29
37
  // during full update we do drop trim
30
38
  if (!silent) {
31
39
  this.store.set('trimmed', {});
@@ -38,12 +46,14 @@ export class DataStore {
38
46
  source,
39
47
  proxyItems: [...items],
40
48
  });
41
- // update data items
42
- this.store.set('items', items);
49
+ // Explicit trim preservation is opt-in because physical indexes may change
50
+ // across full data refreshes.
51
+ this.store.set('items', trimmedItems ? items.filter(i => !trimmedItems[i]) : items);
43
52
  // apply grouping if present
44
53
  if (grouping) {
45
54
  setStore(this.store, {
46
55
  groupingDepth: grouping.depth,
56
+ // if groups are not provided, we will consider that there is only one group with all items
47
57
  groups: grouping.groups,
48
58
  groupingCustomRenderer: grouping.customRenderer,
49
59
  });
@@ -13,6 +13,7 @@ export const recalculateRealSizePlugin = (storeService) => {
13
13
  * Reacts on changes of count, sizes and originItemSize
14
14
  */
15
15
  set(k) {
16
+ var _a;
16
17
  switch (k) {
17
18
  case 'count':
18
19
  case 'sizes':
@@ -20,10 +21,10 @@ export const recalculateRealSizePlugin = (storeService) => {
20
21
  // recalculate realSize
21
22
  let realSize = 0;
22
23
  const count = storeService.store.get('count');
24
+ const sizes = storeService.store.get('sizes');
25
+ const originItemSize = storeService.store.get('originItemSize');
23
26
  for (let i = 0; i < count; i++) {
24
- realSize +=
25
- storeService.store.get('sizes')[i] ||
26
- storeService.store.get('originItemSize');
27
+ realSize += (_a = sizes[i]) !== null && _a !== void 0 ? _a : originItemSize;
27
28
  }
28
29
  storeService.setStore({ realSize });
29
30
  break;
@@ -94,7 +94,9 @@ export class DimensionStore {
94
94
  const indices = originalIndices[physIndex]; // Get all original indices for this value
95
95
  if (indices && indices.length > 0) {
96
96
  const originalIndex = indices.shift(); // Get the first available original index
97
- if (originalIndex !== undefined && originalIndex !== virtIndex && customSizes[originalIndex]) {
97
+ if (originalIndex !== undefined &&
98
+ originalIndex !== virtIndex &&
99
+ typeof customSizes[originalIndex] === 'number') {
98
100
  newSizes[virtIndex] = customSizes[originalIndex];
99
101
  delete customSizes[originalIndex];
100
102
  }
@@ -182,7 +182,7 @@ export function recombineByOffset(offset, data) {
182
182
  return Object.assign({ items: newItems }, range);
183
183
  }
184
184
  function getItemSize(index, sizes, origSize = 0) {
185
- if (sizes && sizes[index]) {
185
+ if (typeof (sizes === null || sizes === void 0 ? void 0 : sizes[index]) === 'number') {
186
186
  return sizes[index];
187
187
  }
188
188
  return origSize;
@@ -21,6 +21,7 @@ export const REVOGRID_EVENTS = new Map([
21
21
  ['beforeanysource', 'beforeanysource'],
22
22
  ['aftersourceset', 'aftersourceset'],
23
23
  ['afteranysource', 'afteranysource'],
24
+ ['beforecolumnsgather', 'beforecolumnsgather'],
24
25
  ['beforecolumnsset', 'beforecolumnsset'],
25
26
  ['beforecolumnapplied', 'beforecolumnapplied'],
26
27
  ['aftercolumnsset', 'aftercolumnsset'],
@@ -126,7 +126,11 @@ export function gatherGroup(res, colData, collection, existingColumnsByType, lev
126
126
  for (let k in collection.columnGrouping) {
127
127
  const key = k;
128
128
  const collectionItem = collection.columnGrouping[key];
129
- res.columnGrouping[key].push(...collectionItem);
129
+ const delta = ((existingColumnsByType === null || existingColumnsByType === void 0 ? void 0 : existingColumnsByType[key]) || []).length;
130
+ const rebasedItem = delta > 0
131
+ ? collectionItem.map(group => (Object.assign(Object.assign({}, group), { indexes: group.indexes.map(i => i + delta) })))
132
+ : collectionItem;
133
+ res.columnGrouping[key].push(...rebasedItem);
130
134
  }
131
135
  res.maxLevel = Math.max(res.maxLevel, collection.maxLevel);
132
136
  res.sort = Object.assign(Object.assign({}, res.sort), collection.sort);
@@ -2,8 +2,8 @@
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
4
  import { h, f as Build } from './index-Chp_81rd.js';
5
- import { y as DATA_ROW, G as DRAG_ICON_CLASS, I as DRAGGABLE_CLASS } from './dimension.helpers-C2F2Cuh8.js';
6
- import { l as GROUP_EXPAND_BTN, m as GROUP_EXPAND_EVENT, G as GROUP_DEPTH, h as GROUP_EXPANDED, P as PSEUDO_GROUP_ITEM, O as isRowDragService, B as getCellDataParsed } from './column.service-BsgaP7Ww.js';
5
+ import { y as DATA_ROW, G as DRAG_ICON_CLASS, I as DRAGGABLE_CLASS } from './dimension.helpers-B-5OBYes.js';
6
+ import { l as GROUP_EXPAND_BTN, m as GROUP_EXPAND_EVENT, G as GROUP_DEPTH, h as GROUP_EXPANDED, P as PSEUDO_GROUP_ITEM, O as isRowDragService, B as getCellDataParsed } from './column.service-8pPNyrKn.js';
7
7
 
8
8
  const SortingSign = ({ column }) => {
9
9
  var _a;
@@ -1,13 +1,13 @@
1
1
  /*!
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
- import { J as reduce, g as getRange, K as baseEach, C as getColumnType, c as columnTypes, L as toInteger, u as isGrouping, t as getGroupingName, r as rowTypes, B as getCellDataParsed, A as getCellRaw, I as getColumnByProp, h as GROUP_EXPANDED, x as getParsedGroup, y as isSameGroup, G as GROUP_DEPTH, e as PSEUDO_GROUP_ITEM_VALUE, d as PSEUDO_GROUP_ITEM_ID, o as GROUPING_ROW_TYPE, p as getSource, f as PSEUDO_GROUP_COLUMN, s as gatherGrouping, m as GROUP_EXPAND_EVENT, v as isGroupingColumn, q as getExpanded, E as isColGrouping } from './column.service-BsgaP7Ww.js';
5
- import { W as createStore, w as setStore, i as calculateDimensionData, X as identity, Y as isArray, b as getSourceItem, o as getScrollbarSize, u as timeout, Z as baseProperty, _ as isArrayLike, $ as getTag, a0 as baseKeys, g as getPhysical, e as setItems, j as getItemByPosition } from './dimension.helpers-C2F2Cuh8.js';
6
- import { f as calculateRowHeaderSize } from './viewport.store-CJZ-1j6C.js';
4
+ import { J as reduce, g as getRange, K as baseEach, C as getColumnType, c as columnTypes, L as toInteger, u as isGrouping, t as getGroupingName, r as rowTypes, B as getCellDataParsed, A as getCellRaw, I as getColumnByProp, h as GROUP_EXPANDED, x as getParsedGroup, y as isSameGroup, G as GROUP_DEPTH, e as PSEUDO_GROUP_ITEM_VALUE, d as PSEUDO_GROUP_ITEM_ID, o as GROUPING_ROW_TYPE, p as getSource, f as PSEUDO_GROUP_COLUMN, s as gatherGrouping, m as GROUP_EXPAND_EVENT, v as isGroupingColumn, q as getExpanded, E as isColGrouping } from './column.service-8pPNyrKn.js';
5
+ import { W as createStore, w as setStore, i as calculateDimensionData, X as identity, Y as isArray, b as getSourceItem, o as getScrollbarSize, u as timeout, Z as baseProperty, _ as isArrayLike, $ as getTag, a0 as baseKeys, g as getPhysical, e as setItems, j as getItemByPosition } from './dimension.helpers-B-5OBYes.js';
6
+ import { f as calculateRowHeaderSize } from './viewport.store-BGWR3XfI.js';
7
7
  import { h } from './index-Chp_81rd.js';
8
8
  import { b as FILTER_PROP, i as isFilterBtn } from './filter.button-C8XTWPU2.js';
9
9
  import { i as isObjectLike, b as baseGetTag, d as debounce } from './debounce-BfO9dz9v.js';
10
- import { O as ON_COLUMN_CLICK, d as dispatch } from './header-cell-renderer-HSFeeOeL.js';
10
+ import { O as ON_COLUMN_CLICK, d as dispatch } from './header-cell-renderer-WkTbrmr7.js';
11
11
 
12
12
  /**
13
13
  * Plugin which recalculates realSize on changes of sizes, originItemSize and count
@@ -21,6 +21,7 @@ const recalculateRealSizePlugin = (storeService) => {
21
21
  * Reacts on changes of count, sizes and originItemSize
22
22
  */
23
23
  set(k) {
24
+ var _a;
24
25
  switch (k) {
25
26
  case 'count':
26
27
  case 'sizes':
@@ -28,10 +29,10 @@ const recalculateRealSizePlugin = (storeService) => {
28
29
  // recalculate realSize
29
30
  let realSize = 0;
30
31
  const count = storeService.store.get('count');
32
+ const sizes = storeService.store.get('sizes');
33
+ const originItemSize = storeService.store.get('originItemSize');
31
34
  for (let i = 0; i < count; i++) {
32
- realSize +=
33
- storeService.store.get('sizes')[i] ||
34
- storeService.store.get('originItemSize');
35
+ realSize += (_a = sizes[i]) !== null && _a !== void 0 ? _a : originItemSize;
35
36
  }
36
37
  storeService.setStore({ realSize });
37
38
  break;
@@ -186,7 +187,9 @@ class DimensionStore {
186
187
  const indices = originalIndices[physIndex]; // Get all original indices for this value
187
188
  if (indices && indices.length > 0) {
188
189
  const originalIndex = indices.shift(); // Get the first available original index
189
- if (originalIndex !== undefined && originalIndex !== virtIndex && customSizes[originalIndex]) {
190
+ if (originalIndex !== undefined &&
191
+ originalIndex !== virtIndex &&
192
+ typeof customSizes[originalIndex] === 'number') {
190
193
  newSizes[virtIndex] = customSizes[originalIndex];
191
194
  delete customSizes[originalIndex];
192
195
  }
@@ -308,10 +311,13 @@ class BasePlugin {
308
311
  * @param immediate - trigger callback immediately with current value
309
312
  */
310
313
  watch(prop, callback, { immediate } = { immediate: false }) {
314
+ var _a;
311
315
  const nativeValueDesc = Object.getOwnPropertyDescriptor(this.revogrid, prop) ||
312
316
  Object.getOwnPropertyDescriptor(this.revogrid.constructor.prototype, prop);
313
317
  // Overwrite property descriptor for this instance
314
318
  Object.defineProperty(this.revogrid, prop, {
319
+ configurable: true,
320
+ enumerable: (_a = nativeValueDesc === null || nativeValueDesc === void 0 ? void 0 : nativeValueDesc.enumerable) !== null && _a !== void 0 ? _a : true,
315
321
  set(val) {
316
322
  var _a;
317
323
  const keepDefault = callback(val);
@@ -1899,7 +1905,7 @@ class SortingPlugin extends BasePlugin {
1899
1905
  });
1900
1906
  }
1901
1907
  /**
1902
- * Entry point for sorting, waits for all delayes, registers jobs
1908
+ * Entry point for sorting, waits for all delays, registers jobs
1903
1909
  */
1904
1910
  startSorting(order, sortingFunc, ignoreViewportUpdate) {
1905
1911
  if (!this.sortingPromise) {
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
- import { a5 as toFinite, a6 as keys, _ as isArrayLike, a4 as baseIteratee, Y as isArray, P as GRID_INTERNALS, a7 as isIterateeCall, a as getVisibleSourceItem, z as DISABLED_CLASS, C as CELL_CLASS, b as getSourceItem } from './dimension.helpers-C2F2Cuh8.js';
4
+ import { a5 as toFinite, a6 as keys, _ as isArrayLike, a4 as baseIteratee, Y as isArray, P as GRID_INTERNALS, a7 as isIterateeCall, a as getVisibleSourceItem, z as DISABLED_CLASS, C as CELL_CLASS, b as getSourceItem } from './dimension.helpers-B-5OBYes.js';
5
5
 
6
6
  /**
7
7
  * Converts `value` to an integer.
@@ -337,7 +337,11 @@ function gatherGroup(res, colData, collection, existingColumnsByType, level = 0)
337
337
  for (let k in collection.columnGrouping) {
338
338
  const key = k;
339
339
  const collectionItem = collection.columnGrouping[key];
340
- res.columnGrouping[key].push(...collectionItem);
340
+ const delta = ((existingColumnsByType === null || existingColumnsByType === void 0 ? void 0 : existingColumnsByType[key]) || []).length;
341
+ const rebasedItem = delta > 0
342
+ ? collectionItem.map(group => (Object.assign(Object.assign({}, group), { indexes: group.indexes.map(i => i + delta) })))
343
+ : collectionItem;
344
+ res.columnGrouping[key].push(...rebasedItem);
341
345
  }
342
346
  res.maxLevel = Math.max(res.maxLevel, collection.maxLevel);
343
347
  res.sort = Object.assign(Object.assign({}, res.sort), collection.sort);
@@ -3270,8 +3270,16 @@ class DataStore {
3270
3270
  * full data source update
3271
3271
  * @param source - data column/rgRow source
3272
3272
  * @param grouping - grouping information if present
3273
+ * @param silent - if true, store will be updated without resetting trimmed state
3274
+ * @param preserveTrimmed - if true, current trimmed indexes will be re-applied to the new source, use with caution because physical indexes may change across full data refreshes
3273
3275
  */
3274
- updateData(source, grouping, silent = false) {
3276
+ updateData(source, grouping,
3277
+ // if true, store will be updated without resetting trimmed state
3278
+ silent = false,
3279
+ // if true, current trimmed indexes will be re-applied to the new source
3280
+ preserveTrimmed = false) {
3281
+ const trimmed = this.store.get('trimmed');
3282
+ const trimmedItems = silent && preserveTrimmed ? gatherTrimmedItems(trimmed) : null;
3275
3283
  // during full update we do drop trim
3276
3284
  if (!silent) {
3277
3285
  this.store.set('trimmed', {});
@@ -3284,12 +3292,14 @@ class DataStore {
3284
3292
  source,
3285
3293
  proxyItems: [...items],
3286
3294
  });
3287
- // update data items
3288
- this.store.set('items', items);
3295
+ // Explicit trim preservation is opt-in because physical indexes may change
3296
+ // across full data refreshes.
3297
+ this.store.set('items', trimmedItems ? items.filter(i => !trimmedItems[i]) : items);
3289
3298
  // apply grouping if present
3290
3299
  if (grouping) {
3291
3300
  setStore(this.store, {
3292
3301
  groupingDepth: grouping.depth,
3302
+ // if groups are not provided, we will consider that there is only one group with all items
3293
3303
  groups: grouping.groups,
3294
3304
  groupingCustomRenderer: grouping.customRenderer,
3295
3305
  });