@revolist/revogrid 4.22.1 → 4.23.1

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 (125) hide show
  1. package/dist/cjs/{cell-renderer-BQdEGQXP.js → cell-renderer-Dcz022q7.js} +9 -3
  2. package/dist/cjs/{column.drag.plugin-RDjQhKCH.js → column.drag.plugin-DJueWxN_.js} +391 -256
  3. package/dist/cjs/{column.service-DXYMehqK.js → column.service-C1Qvcf5l.js} +10 -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-QrcXXSkF.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 +124 -18
  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 +74 -32
  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 +53 -17
  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 +69 -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/groupingRow/grouping.service.js +9 -0
  34. package/dist/collection/plugins/moveColumn/column.drag.plugin.js +4 -4
  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 +30 -4
  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/utils/store.utils.js +3 -3
  49. package/dist/{revo-grid/cell-renderer-CALsEsnh.js → esm/cell-renderer-BtN-NGCk.js} +9 -3
  50. package/dist/esm/{column.drag.plugin-Dy5ztusn.js → column.drag.plugin-DCZW62Uc.js} +388 -255
  51. package/dist/esm/{column.service-CCvAi5l4.js → column.service-CC_SD8W3.js} +10 -1
  52. package/dist/{revo-grid/debounce-BfO9dz9v.js → esm/debounce-PCRWZliA.js} +1 -1
  53. package/dist/{revo-grid/dimension.helpers-DmIvjIa7.js → esm/dimension.helpers-CGKwSvw6.js} +7 -128
  54. package/dist/esm/{edit.utils-DYN6XZh8.js → edit.utils-Dnnbd0xG.js} +1 -1
  55. package/dist/{revo-grid/header-cell-renderer-DU8wKAbg.js → esm/header-cell-renderer-BsvUQ8GS.js} +1 -1
  56. package/dist/esm/index-Db3qZoW5.js +127 -0
  57. package/dist/esm/index.js +11 -10
  58. package/dist/esm/revo-grid.entry.js +123 -17
  59. package/dist/esm/revogr-attribution_7.entry.js +42 -24
  60. package/dist/esm/revogr-clipboard_3.entry.js +11 -9
  61. package/dist/esm/revogr-data_4.entry.js +75 -33
  62. package/dist/esm/revogr-filter-panel.entry.js +3 -2
  63. package/dist/esm/{text-editor-DpCnd6Fq.js → text-editor-C3RUSwH5.js} +2 -2
  64. package/dist/esm/{throttle-ERvyruXb.js → throttle-CaUDyxyU.js} +60 -25
  65. package/dist/esm/viewport.helpers-CoCAvmZs.js +133 -0
  66. package/dist/{revo-grid/viewport.store-CFjDW-3l.js → esm/viewport.store-COAfzAyu.js} +15 -17
  67. package/dist/{esm/cell-renderer-CALsEsnh.js → revo-grid/cell-renderer-BtN-NGCk.js} +9 -3
  68. package/dist/revo-grid/{column.drag.plugin-Dy5ztusn.js → column.drag.plugin-DCZW62Uc.js} +388 -255
  69. package/dist/revo-grid/{column.service-CCvAi5l4.js → column.service-CC_SD8W3.js} +10 -1
  70. package/dist/{esm/debounce-BfO9dz9v.js → revo-grid/debounce-PCRWZliA.js} +1 -1
  71. package/dist/{esm/dimension.helpers-DmIvjIa7.js → revo-grid/dimension.helpers-CGKwSvw6.js} +7 -128
  72. package/dist/revo-grid/{edit.utils-DYN6XZh8.js → edit.utils-Dnnbd0xG.js} +1 -1
  73. package/dist/{esm/header-cell-renderer-DU8wKAbg.js → revo-grid/header-cell-renderer-BsvUQ8GS.js} +1 -1
  74. package/dist/revo-grid/index-Db3qZoW5.js +127 -0
  75. package/dist/revo-grid/index.esm.js +11 -10
  76. package/dist/revo-grid/revo-grid.entry.js +123 -17
  77. package/dist/revo-grid/revogr-attribution_7.entry.js +42 -24
  78. package/dist/revo-grid/revogr-clipboard_3.entry.js +11 -9
  79. package/dist/revo-grid/revogr-data_4.entry.js +75 -33
  80. package/dist/revo-grid/revogr-filter-panel.entry.js +3 -2
  81. package/dist/revo-grid/{text-editor-DpCnd6Fq.js → text-editor-C3RUSwH5.js} +2 -2
  82. package/dist/revo-grid/{throttle-ERvyruXb.js → throttle-CaUDyxyU.js} +60 -25
  83. package/dist/revo-grid/viewport.helpers-CoCAvmZs.js +133 -0
  84. package/dist/{esm/viewport.store-CFjDW-3l.js → revo-grid/viewport.store-COAfzAyu.js} +15 -17
  85. package/dist/types/components/header/header-group-renderer.d.ts +2 -0
  86. package/dist/types/components/header/header-renderer.d.ts +1 -0
  87. package/dist/types/components/header/revogr-header.d.ts +2 -0
  88. package/dist/types/components/overlay/keyboard.service.d.ts +5 -0
  89. package/dist/types/components/revoGrid/revo-grid.d.ts +12 -0
  90. package/dist/types/plugins/groupingRow/grouping.row.plugin.d.ts +8 -0
  91. package/dist/types/plugins/sorting/sorting.func.d.ts +25 -2
  92. package/dist/types/plugins/sorting/sorting.plugin.d.ts +84 -9
  93. package/dist/types/plugins/sorting/sorting.sign.d.ts +5 -1
  94. package/dist/types/plugins/sorting/sorting.types.d.ts +46 -1
  95. package/dist/types/services/local.scroll.service.d.ts +10 -2
  96. package/dist/types/services/scroll.dimension.helpers.d.ts +20 -0
  97. package/dist/types/services/selection.store.connector.d.ts +6 -0
  98. package/dist/types/store/vp/viewport.helpers.d.ts +2 -0
  99. package/dist/types/types/interfaces.d.ts +11 -0
  100. package/dist/types/types/selection.d.ts +13 -0
  101. package/hydrate/index.js +795 -383
  102. package/hydrate/index.mjs +795 -383
  103. package/package.json +1 -1
  104. package/standalone/column.service.js +1 -1
  105. package/standalone/data.store.js +1 -1
  106. package/standalone/debounce.js +1 -1
  107. package/standalone/dimension.helpers.js +1 -1
  108. package/standalone/index.js +1 -1
  109. package/standalone/local.scroll.timer.js +1 -1
  110. package/standalone/revo-grid.js +1 -1
  111. package/standalone/revogr-data2.js +1 -1
  112. package/standalone/revogr-filter-panel.js +1 -1
  113. package/standalone/revogr-header2.js +1 -1
  114. package/standalone/revogr-order-editor2.js +1 -1
  115. package/standalone/revogr-overlay-selection2.js +1 -1
  116. package/standalone/revogr-row-headers.js +1 -1
  117. package/standalone/revogr-row-headers2.js +1 -1
  118. package/standalone/revogr-scroll-virtual2.js +1 -1
  119. package/standalone/revogr-viewport-scroll2.js +1 -1
  120. package/standalone/selection.utils.js +1 -1
  121. package/standalone/throttle.js +1 -1
  122. package/standalone/toNumber.js +1 -1
  123. package/dist/cjs/viewport.helpers-BAovztDd.js +0 -58
  124. package/dist/esm/viewport.helpers-VXhsJZtn.js +0 -52
  125. package/dist/revo-grid/viewport.helpers-VXhsJZtn.js +0 -52
@@ -49,8 +49,8 @@ export function getCurrentCell({ x, y }, { el, rows, cols }) {
49
49
  cellX = width - 1;
50
50
  }
51
51
  // Get the row and column items based on the cell position
52
- const rgRow = getItemByPosition(rows, cellY);
53
- const rgCol = getItemByPosition(cols, cellX);
52
+ const rgRow = getItemByPosition(rows, cellY + (rows.renderOffset || 0));
53
+ const rgCol = getItemByPosition(cols, cellX + (cols.renderOffset || 0));
54
54
  // Set the row and column index to 0 if they are before the first item
55
55
  if (rgCol.itemIndex < 0) {
56
56
  rgCol.itemIndex = 0;
@@ -120,10 +120,12 @@ export function styleByCellProps(styles) {
120
120
  };
121
121
  }
122
122
  export function getCell({ x, y, x1, y1 }, dimensionRow, dimensionCol) {
123
- const top = getItemByIndex(dimensionRow, y).start;
124
- const left = getItemByIndex(dimensionCol, x).start;
125
- const bottom = getItemByIndex(dimensionRow, y1).end;
126
- const right = getItemByIndex(dimensionCol, x1).end;
123
+ const rowOffset = dimensionRow.renderOffset || 0;
124
+ const colOffset = dimensionCol.renderOffset || 0;
125
+ const top = getItemByIndex(dimensionRow, y).start - rowOffset;
126
+ const left = getItemByIndex(dimensionCol, x).start - colOffset;
127
+ const bottom = getItemByIndex(dimensionRow, y1).end - rowOffset;
128
+ const right = getItemByIndex(dimensionCol, x1).end - colOffset;
127
129
  return {
128
130
  left,
129
131
  right,
@@ -609,6 +609,7 @@ export class RevoGridComponent {
609
609
  if (!this.dimensionProvider || !this.columnProvider) {
610
610
  return;
611
611
  }
612
+ const focusToRestore = init ? undefined : this.getColumnFocusRestore();
612
613
  const beforeGatherEvent = this.beforecolumnsgather.emit({
613
614
  columns: [...newVal],
614
615
  });
@@ -626,14 +627,76 @@ export class RevoGridComponent {
626
627
  return;
627
628
  }
628
629
  const columns = this.columnProvider.setColumns(beforeApplyEvent.detail);
630
+ if (focusToRestore) {
631
+ this.pendingColumnFocusRestore = focusToRestore;
632
+ }
633
+ const order = {};
634
+ for (const prop of Object.keys(beforeApplyEvent.detail.sort)) {
635
+ order[prop] = beforeApplyEvent.detail.sort[prop].order;
636
+ }
629
637
  this.aftercolumnsset.emit({
630
638
  columns,
631
- order: Object.entries(beforeApplyEvent.detail.sort).reduce((acc, [prop, column]) => {
632
- acc[prop] = column.order;
633
- return acc;
634
- }, {}),
639
+ order,
635
640
  });
636
641
  }
642
+ /**
643
+ * Capture logical focus before columns are repartitioned by pin state.
644
+ * Regression case: selecting a regular cell, then pinning that column left,
645
+ * used to let the new pinned viewport reuse the old rgCol selection store.
646
+ */
647
+ getColumnFocusRestore() {
648
+ var _a, _b, _c, _d;
649
+ const focused = (_a = this.viewport) === null || _a === void 0 ? void 0 : _a.getFocused();
650
+ const prevStoreX = (_c = (_b = this.selectionStoreConnector) === null || _b === void 0 ? void 0 : _b.focusedStore) === null || _c === void 0 ? void 0 : _c.position.x;
651
+ const prop = (_d = focused === null || focused === void 0 ? void 0 : focused.column) === null || _d === void 0 ? void 0 : _d.prop;
652
+ if (!focused || prop === undefined || prevStoreX === undefined) {
653
+ return;
654
+ }
655
+ return {
656
+ prop,
657
+ colType: focused.colType,
658
+ colIndex: focused.cell.x,
659
+ prevStoreX,
660
+ rowType: focused.rowType,
661
+ rowIndex: focused.cell.y,
662
+ };
663
+ }
664
+ /**
665
+ * Reapply focus by column prop after render, once pinning has moved the
666
+ * column to its new viewport and virtual index.
667
+ */
668
+ restoreColumnFocusAfterRender() {
669
+ var _a, _b, _c, _d;
670
+ const pending = this.pendingColumnFocusRestore;
671
+ if (!pending) {
672
+ return;
673
+ }
674
+ this.pendingColumnFocusRestore = undefined;
675
+ if (!this.viewport || !this.columnProvider) {
676
+ return;
677
+ }
678
+ const column = (_b = (_a = this.columnProvider.getColumnByProp(pending.prop)) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : getColumnByProp(this.columns, pending.prop);
679
+ if (!column) {
680
+ return;
681
+ }
682
+ const colType = column.pin || 'rgCol';
683
+ const columnIndex = this.columnProvider.getColumnIndexByProp(pending.prop, colType);
684
+ if (columnIndex < 0) {
685
+ return;
686
+ }
687
+ // Header-only column refreshes should not collapse an existing range.
688
+ // Replay focus only when pin/unpin or repartitioning moved the logical column.
689
+ if (colType === pending.colType &&
690
+ columnIndex === pending.colIndex &&
691
+ pending.prevStoreX === ((_d = (_c = this.selectionStoreConnector) === null || _c === void 0 ? void 0 : _c.focusedStore) === null || _d === void 0 ? void 0 : _d.position.x)) {
692
+ return;
693
+ }
694
+ const cell = {
695
+ x: columnIndex,
696
+ y: pending.rowIndex,
697
+ };
698
+ this.viewport.setFocus(colType, pending.rowType, cell, cell);
699
+ }
637
700
  disableVirtualXChanged(newVal = false, prevVal = false) {
638
701
  if (newVal === prevVal) {
639
702
  return;
@@ -920,7 +983,7 @@ export class RevoGridComponent {
920
983
  if (Object.keys((_a = this.trimmedRows) !== null && _a !== void 0 ? _a : {}).length > 0) {
921
984
  this.trimmedRowsChanged(this.trimmedRows);
922
985
  }
923
- this.rowDefChanged(this.rowDefinitions);
986
+ this.rowDefChanged(this.rowDefinitions, undefined, undefined, false);
924
987
  // init grouping
925
988
  if (this.grouping && Object.keys(this.grouping).length > 0) {
926
989
  this.groupingChanged(this.grouping);
@@ -946,6 +1009,7 @@ export class RevoGridComponent {
946
1009
  return Promise.all(this.jobsBeforeRender);
947
1010
  }
948
1011
  componentDidRender() {
1012
+ this.restoreColumnFocusAfterRender();
949
1013
  this.aftergridrender.emit();
950
1014
  }
951
1015
  render() {
@@ -108,7 +108,8 @@ export default class ViewportService {
108
108
  (_a = this.config.dimensionProvider) === null || _a === void 0 ? void 0 : _a.setCustomSizes(type, detail, true);
109
109
  // set resize event
110
110
  const changedItems = {};
111
- for (const [i, size] of Object.entries(detail || {})) {
111
+ for (const i of Object.keys(detail || {})) {
112
+ const size = detail[i];
112
113
  const virtualIndex = parseInt(i, 10);
113
114
  const item = getSourceItem(store, virtualIndex);
114
115
  if (item) {
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { h, Host, } from "@stencil/core";
5
5
  import GridResizeService from "../revoGrid/viewport.resize.service";
6
- import LocalScrollService from "../../services/local.scroll.service";
6
+ import LocalScrollService, { getContentSize } from "../../services/local.scroll.service";
7
7
  import { LocalScrollTimer } from "../../services/local.scroll.timer";
8
8
  import { CONTENT_SLOT, FOOTER_SLOT, HEADER_SLOT, } from "../revoGrid/viewport.helpers";
9
9
  /**
@@ -34,7 +34,7 @@ export class RevogrViewportScroll {
34
34
  * @param e
35
35
  */
36
36
  async changeScroll(e, silent = false) {
37
- var _a, _b;
37
+ var _a, _b, _c, _d;
38
38
  if (silent) {
39
39
  if (e.coordinate && this.verticalScroll) {
40
40
  switch (e.dimension) {
@@ -47,15 +47,16 @@ export class RevogrViewportScroll {
47
47
  return;
48
48
  }
49
49
  if (e.delta) {
50
+ let currentPhysicalCoordinate = 0;
50
51
  switch (e.dimension) {
51
52
  case 'rgCol':
52
- e.coordinate = this.horizontalScroll.scrollLeft + e.delta;
53
+ currentPhysicalCoordinate = this.horizontalScroll.scrollLeft;
53
54
  break;
54
55
  case 'rgRow':
55
- e.coordinate = ((_b = (_a = this.verticalScroll) === null || _a === void 0 ? void 0 : _a.scrollTop) !== null && _b !== void 0 ? _b : 0) + e.delta;
56
+ currentPhysicalCoordinate = (_b = (_a = this.verticalScroll) === null || _a === void 0 ? void 0 : _a.scrollTop) !== null && _b !== void 0 ? _b : 0;
56
57
  break;
57
58
  }
58
- this.setScroll(e);
59
+ return (_d = (_c = this.localScrollService) === null || _c === void 0 ? void 0 : _c.setScrollByDelta(e, currentPhysicalCoordinate)) !== null && _d !== void 0 ? _d : e;
59
60
  }
60
61
  return e;
61
62
  }
@@ -207,7 +208,10 @@ export class RevogrViewportScroll {
207
208
  this.setScrollVisibility('rgCol', this.horizontalScroll.clientWidth, this.contentWidth);
208
209
  }
209
210
  render() {
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 })))));
211
+ var _a, _b, _c, _d;
212
+ const physicalContentHeight = getContentSize(this.contentHeight, (_b = (_a = this.verticalScroll) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : 0);
213
+ const physicalContentWidth = getContentSize(this.contentWidth, (_d = (_c = this.horizontalScroll) === null || _c === void 0 ? void 0 : _c.clientWidth) !== null && _d !== void 0 ? _d : 0);
214
+ return (h(Host, { key: 'a0c47dede9d131dea8c8ca449e8a323f24d9b113', onWheel: this.horizontalMouseWheel, onScroll: (e) => this.applyScroll('rgCol', e) }, h("div", { key: '6c960e753ffe522ba4afb1c379264873b6c617f3', class: "inner-content-table", style: { width: `${physicalContentWidth}px` } }, h("div", { key: '1a6cbcbd3634e84756b54c8150aebd25c824e14a', class: "header-wrapper", ref: e => (this.header = e) }, h("slot", { key: 'e4202c687bc39b4f78f3ed9840e979b032f06af8', name: HEADER_SLOT })), h("div", { key: '651415b5b32e72735065b183317386a34042bb85', class: "vertical-inner", ref: el => (this.verticalScroll = el), onWheel: this.verticalMouseWheel, onScroll: (e) => this.applyScroll('rgRow', e) }, h("div", { key: 'e65623b78d80957d8676adb019618953ef267ec3', class: "content-wrapper", style: { height: `${physicalContentHeight}px` } }, h("slot", { key: '5af47b12ef1226587cf774233447b5252d65e836', name: CONTENT_SLOT }))), h("div", { key: 'cbc0fd64fbfb53d3b18e547bbe34e32b7bb9c043', class: "footer-wrapper", ref: e => (this.footer = e) }, h("slot", { key: 'a8e4bfaef400973121090bac3069eb85469a95f3', name: FOOTER_SLOT })))));
211
215
  }
212
216
  /**
213
217
  * Extra layer for scroll event monitoring, where MouseWheel event is not passing
@@ -37,15 +37,9 @@ export class RevogrScrollVirtual {
37
37
  */
38
38
  async changeScroll(e) {
39
39
  if (e.delta) {
40
- switch (e.dimension) {
41
- case 'rgCol':
42
- e.coordinate = this.element.scrollLeft + e.delta;
43
- break;
44
- case 'rgRow':
45
- e.coordinate = this.element.scrollTop + e.delta;
46
- break;
47
- }
48
- this.setScroll(e);
40
+ const scrollProperty = e.dimension === 'rgRow' ? 'scrollTop' : 'scrollLeft';
41
+ const currentPhysicalCoordinate = this.element[scrollProperty];
42
+ return this.localScrollService.setScrollByDelta(e, currentPhysicalCoordinate);
49
43
  }
50
44
  return e;
51
45
  }
@@ -108,7 +102,7 @@ export class RevogrScrollVirtual {
108
102
  }
109
103
  render() {
110
104
  const size = getContentSize(this.realSize, this.dimension === 'rgRow' ? this.element.clientHeight : this.element.clientWidth, this.clientSize);
111
- return (h(Host, { key: '57f81ec9deb2395e96b283338c03b9ad44f1e929', onScroll: (e) => this.onScroll(e) }, h("div", { key: '1a8c869adab53b362c351dae8d53664f33c4212c', style: {
105
+ return (h(Host, { key: '7213817ef941eee4050b714266598ec0c2961ee9', onScroll: (e) => this.onScroll(e) }, h("div", { key: '501da49c63253ab943172494b9dbf5399be56cee', style: {
112
106
  [this.dimension === 'rgRow' ? 'height' : 'width']: `${size}px`,
113
107
  } })));
114
108
  }
@@ -250,7 +250,8 @@ export class FilterPanel {
250
250
  const options = [];
251
251
  const prop = this.changes.prop;
252
252
  const hidden = new Set();
253
- Object.entries(this.filterItems).forEach(([_, values]) => {
253
+ Object.keys(this.filterItems).forEach((prop) => {
254
+ const values = this.filterItems[prop];
254
255
  values.forEach((filter) => {
255
256
  if (filter.hidden) {
256
257
  hidden.add(filter.type);
@@ -152,17 +152,24 @@ export class FilterPlugin extends BasePlugin {
152
152
  }
153
153
  }
154
154
  if (config.collection) {
155
- const filtersWithFilterFunctionPresent = Object.entries(config.collection).filter(([, item]) => this.filterFunctionsIndexedByType[item.type]);
156
- this.filterCollection = Object.fromEntries(filtersWithFilterFunctionPresent);
155
+ const filterCollection = {};
156
+ for (const prop of Object.keys(config.collection)) {
157
+ const item = config.collection[prop];
158
+ if (this.filterFunctionsIndexedByType[item.type]) {
159
+ filterCollection[prop] = item;
160
+ }
161
+ }
162
+ this.filterCollection = filterCollection;
157
163
  }
158
164
  else {
159
165
  this.filterCollection = {};
160
166
  }
161
167
  if (config.localization) {
162
168
  if (config.localization.filterNames) {
163
- Object.entries(config.localization.filterNames).forEach(([k, v]) => {
169
+ const filterNames = config.localization.filterNames;
170
+ Object.keys(filterNames).forEach((k) => {
164
171
  if (this.filterNameIndexByType[k] != void 0) {
165
- this.filterNameIndexByType[k] = v;
172
+ this.filterNameIndexByType[k] = filterNames[k];
166
173
  }
167
174
  });
168
175
  }
@@ -1,6 +1,18 @@
1
1
  /*!
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
+ var __rest = (this && this.__rest) || function (s, e) {
5
+ var t = {};
6
+ for (var p in s)
7
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
8
+ t[p] = s[p];
9
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
10
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
11
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
12
+ t[p[i]] = s[p[i]];
13
+ }
14
+ return t;
15
+ };
4
16
  import { getPhysical, setItems, columnTypes, } from "../../store/index";
5
17
  import { BasePlugin } from "../base.plugin";
6
18
  import { FILTER_TRIMMED_TYPE } from "../filter/filter.plugin";
@@ -97,6 +109,18 @@ export class GroupingRowPlugin extends BasePlugin {
97
109
  const sortingPlugin = this.providers.plugins.getByClass(SortingPlugin);
98
110
  return !!(sortingPlugin === null || sortingPlugin === void 0 ? void 0 : sortingPlugin.sortingPromise);
99
111
  }
112
+ /**
113
+ * Returns grouping options for regrouping that must preserve current UI state.
114
+ *
115
+ * `expandedAll` and config `prevExpanded` are initial/config instructions.
116
+ * Reusing them after sorting would reopen groups the user collapsed before
117
+ * sorting instead of using the current grouped source state.
118
+ */
119
+ getCurrentExpandedOptions() {
120
+ var _a;
121
+ const _b = (_a = this.options) !== null && _a !== void 0 ? _a : {}, { expandedAll: _expandedAll, prevExpanded: _prevExpanded } = _b, options = __rest(_b, ["expandedAll", "prevExpanded"]);
122
+ return options;
123
+ }
100
124
  /**
101
125
  * Starts global source update with group clearing and applying new one
102
126
  * Initiated when need to reapply grouping
@@ -199,7 +223,7 @@ export class GroupingRowPlugin extends BasePlugin {
199
223
  if (!((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.length)) {
200
224
  return;
201
225
  }
202
- this.doSourceUpdate(Object.assign({}, this.options));
226
+ this.doSourceUpdate(this.getCurrentExpandedOptions());
203
227
  });
204
228
  /**
205
229
  * Apply logic for focus inside of grouping
@@ -5,6 +5,9 @@ import { GROUP_DEPTH, GROUP_EXPANDED, PSEUDO_GROUP_COLUMN, PSEUDO_GROUP_ITEM, PS
5
5
  function getGroupValueDefault(item, prop) {
6
6
  return item[prop] || null;
7
7
  }
8
+ function isDataRow(item) {
9
+ return item != null;
10
+ }
8
11
  // get source based on proxy item collection to preserve rgRow order
9
12
  export function getSource(source, items, withoutGrouping = false) {
10
13
  let index = 0;
@@ -26,6 +29,9 @@ export function getSource(source, items, withoutGrouping = false) {
26
29
  result.prevExpanded[model[PSEUDO_GROUP_ITEM_VALUE]] = true;
27
30
  }
28
31
  }
32
+ else if (!isDataRow(model)) {
33
+ return;
34
+ }
29
35
  else {
30
36
  result.source.push(model);
31
37
  result.oldNewIndexes[i] = index;
@@ -106,6 +112,9 @@ function flattenGroupMaps({ groupedValues, parentIds, isExpanded, itemIndex, exp
106
112
  export function gatherGrouping(array, columnProps, { prevExpanded = {}, expandedAll = false, getGroupValue = getGroupValueDefault, }) {
107
113
  const groupedItems = new Map();
108
114
  array.forEach((item, originalIndex) => {
115
+ if (!isDataRow(item)) {
116
+ return;
117
+ }
109
118
  const groupLevelValues = columnProps.map(groupId => getGroupValue(item, groupId));
110
119
  const lastLevelValue = groupLevelValues.pop();
111
120
  let currentGroupLevel = groupedItems;
@@ -68,7 +68,7 @@ export class ColumnMovePlugin extends BasePlugin {
68
68
  const cols = this.getDimension(data.pin || 'rgCol');
69
69
  const gridRect = this.revogrid.getBoundingClientRect();
70
70
  const elRect = dataEl.getBoundingClientRect();
71
- const startItem = getItemByPosition(cols, getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left));
71
+ const startItem = getItemByPosition(cols, getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left) + (cols.renderOffset || 0));
72
72
  this.staticDragData = {
73
73
  startPos: event.x,
74
74
  startItem,
@@ -93,13 +93,13 @@ export class ColumnMovePlugin extends BasePlugin {
93
93
  const start = this.staticDragData.startPos;
94
94
  if (Math.abs(start - e.x) > 10) {
95
95
  const x = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);
96
- const rgCol = getItemByPosition(this.staticDragData.cols, x);
96
+ const rgCol = getItemByPosition(this.staticDragData.cols, x + (this.staticDragData.cols.renderOffset || 0));
97
97
  this.orderUi.autoscroll(x, dragData.elRect.width);
98
98
  // prevent position change if out of bounds
99
99
  if (rgCol.itemIndex >= this.staticDragData.cols.count) {
100
100
  return;
101
101
  }
102
- this.orderUi.showHandler(rgCol.end + dragData.scrollOffset, dragData.gridRect.width);
102
+ this.orderUi.showHandler(rgCol.end - (this.staticDragData.cols.renderOffset || 0) + dragData.scrollOffset, dragData.gridRect.width);
103
103
  }
104
104
  }
105
105
  move(e) {
@@ -117,7 +117,7 @@ export class ColumnMovePlugin extends BasePlugin {
117
117
  if (relativePos < 0) {
118
118
  relativePos = 0;
119
119
  }
120
- const newPosition = getItemByPosition(this.staticDragData.cols, relativePos);
120
+ const newPosition = getItemByPosition(this.staticDragData.cols, relativePos + (this.staticDragData.cols.renderOffset || 0));
121
121
  const store = this.providers.column.stores[this.dragData.type].store;
122
122
  const source = store.get('source');
123
123
  const newItems = [...store.get('items')];
@@ -1,13 +1,177 @@
1
1
  /*!
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
+ import { GROUP_COLUMN_PROP } from "../groupingRow/grouping.const";
4
5
  import { isGrouping } from "../groupingRow/grouping.service";
5
6
  import { getCellRaw } from "../../utils/column.utils";
6
- export function sortIndexByItems(indexes, source, sortingFunc = {}) {
7
+ /**
8
+ * Checks whether a sorting map contains at least one active order.
9
+ *
10
+ * Empty maps and properties with `undefined` order are treated as inactive.
11
+ */
12
+ export function hasActiveSorting(sorting) {
13
+ for (const prop of Object.keys(sorting || {})) {
14
+ if (sorting === null || sorting === void 0 ? void 0 : sorting[prop]) {
15
+ return true;
16
+ }
17
+ }
18
+ return false;
19
+ }
20
+ /**
21
+ * Compares column properties after object-key coercion.
22
+ */
23
+ function isSameColumnProp(a, b) {
24
+ return String(a) === String(b);
25
+ }
26
+ /**
27
+ * Returns active sorting properties in explicit priority order.
28
+ */
29
+ function getActiveSortingProps(sorting, sortingOrder) {
30
+ const activeProps = [];
31
+ const add = (prop) => {
32
+ if ((sorting === null || sorting === void 0 ? void 0 : sorting[prop]) && !activeProps.some(active => isSameColumnProp(active, prop))) {
33
+ activeProps.push(prop);
34
+ }
35
+ };
36
+ sortingOrder === null || sortingOrder === void 0 ? void 0 : sortingOrder.forEach(add);
37
+ Object.keys(sorting || {}).forEach(add);
38
+ return activeProps;
39
+ }
40
+ /**
41
+ * Returns one-based additive sorting rank for a column.
42
+ *
43
+ * A single active sort does not need a visible rank, so it returns undefined.
44
+ */
45
+ export function getSortingIndex(sorting, prop, sortingOrder) {
46
+ const activeProps = getActiveSortingProps(sorting, sortingOrder);
47
+ if (activeProps.length <= 1) {
48
+ return undefined;
49
+ }
50
+ const index = activeProps.findIndex(active => isSameColumnProp(active, prop));
51
+ return index >= 0 ? index + 1 : undefined;
52
+ }
53
+ /**
54
+ * Collects only active comparator functions from a sorting function map.
55
+ *
56
+ * This keeps undefined comparator entries from triggering sorting work.
57
+ */
58
+ function activeSortingEntries(sortingFunc = {}, sortingOrder) {
59
+ const entries = [];
60
+ const add = (prop) => {
61
+ const cmp = sortingFunc[prop];
62
+ if (typeof cmp === 'function' && !entries.some(([active]) => isSameColumnProp(active, prop))) {
63
+ entries.push([prop, cmp]);
64
+ }
65
+ };
66
+ sortingOrder === null || sortingOrder === void 0 ? void 0 : sortingOrder.forEach(add);
67
+ Object.keys(sortingFunc).forEach(add);
68
+ return entries;
69
+ }
70
+ /**
71
+ * Reads and normalizes a value for the built-in default comparer.
72
+ */
73
+ function getDefaultCompareValue(item, prop, column) {
74
+ const aRaw = column ? getCellRaw(item, column) : item === null || item === void 0 ? void 0 : item[prop];
75
+ return typeof aRaw === 'number' ? aRaw : aRaw === null || aRaw === void 0 ? void 0 : aRaw.toString().toLowerCase();
76
+ }
77
+ function isEmptyCompareValue(value) {
78
+ return value === '' || value === null || value === undefined;
79
+ }
80
+ /**
81
+ * Compares two already-normalized default comparer values.
82
+ */
83
+ function compareValues(av, bv) {
84
+ if (av === bv) {
85
+ return 0;
86
+ }
87
+ const aEmpty = isEmptyCompareValue(av);
88
+ const bEmpty = isEmptyCompareValue(bv);
89
+ if (aEmpty || bEmpty) {
90
+ if (aEmpty && bEmpty) {
91
+ return 0;
92
+ }
93
+ return aEmpty ? -1 : 1;
94
+ }
95
+ if (av > bv) {
96
+ return 1;
97
+ }
98
+ return -1;
99
+ }
100
+ /**
101
+ * Sorts indexes by precomputed values for default column comparers.
102
+ *
103
+ * This avoids repeatedly parsing the same cell value during large default
104
+ * sorts while preserving normal multi-column ordering.
105
+ */
106
+ function sortIndexByDefaultComparers(indexes, source, entries, sorting, sortingColumns) {
107
+ const prepared = entries.map(([prop]) => {
108
+ const values = [];
109
+ const column = sortingColumns[prop];
110
+ for (const index of indexes) {
111
+ values[index] = getDefaultCompareValue(source[index], prop, column);
112
+ }
113
+ return {
114
+ order: sorting[prop],
115
+ values,
116
+ };
117
+ });
118
+ return indexes.sort((a, b) => {
119
+ for (const { order, values } of prepared) {
120
+ const sorted = compareValues(values[a], values[b]);
121
+ if (sorted) {
122
+ return order === 'desc' ? -sorted : sorted;
123
+ }
124
+ }
125
+ return 0;
126
+ });
127
+ }
128
+ /**
129
+ * Detects whether the optimized default-comparer path can be used.
130
+ *
131
+ * Grouped rows and custom `cellCompare` functions stay on the legacy
132
+ * comparator path to preserve their exact behavior.
133
+ */
134
+ function canUseDefaultCompareFastPath(entries, indexes, source, sorting, sortingColumns) {
135
+ return !indexes.some(index => isGrouping(source[index])) && !!sorting && !!sortingColumns && entries.every(([prop]) => {
136
+ const order = sorting[prop];
137
+ const column = sortingColumns[prop];
138
+ return !!order && !(column === null || column === void 0 ? void 0 : column.cellCompare);
139
+ });
140
+ }
141
+ /**
142
+ * Group placeholder rows are generated for their grouping column. If sorting is
143
+ * requested for another column, the grouped source must be unwrapped first.
144
+ */
145
+ function hasGroupingRowsForOtherSorting(entries, indexes, source) {
146
+ return indexes.some(index => {
147
+ const item = source[index];
148
+ return isGrouping(item) && !entries.some(([prop]) => isSameColumnProp(item[GROUP_COLUMN_PROP], prop));
149
+ });
150
+ }
151
+ /**
152
+ * Sorts row indexes against a source collection.
153
+ *
154
+ * @param indexes - Current proxy row indexes to sort.
155
+ * @param source - Full source collection addressed by the indexes.
156
+ * @param sortingFunc - Comparator functions by column property.
157
+ * @param sorting - Active sorting order by column property.
158
+ * @param sortingColumns - Column metadata by property for default-comparer optimization.
159
+ * @param sortingOrder - Active sorting priority in click/config insertion order.
160
+ * @returns Sorted proxy indexes. With no sorting function keys, returns source-order indexes.
161
+ */
162
+ export function sortIndexByItems(indexes, source, sortingFunc = {}, sorting, sortingColumns, sortingOrder) {
163
+ const hasSortingKeys = Object.keys(sortingFunc).length > 0;
164
+ const sortingEntries = activeSortingEntries(sortingFunc, sortingOrder);
7
165
  // if no sorting - return unsorted indexes
8
- if (Object.entries(sortingFunc).length === 0) {
166
+ if (sortingEntries.length === 0) {
9
167
  // Unsorted indexes
10
- return [...Array(indexes.length).keys()];
168
+ return hasSortingKeys ? indexes : [...new Array(indexes.length).keys()];
169
+ }
170
+ if (hasGroupingRowsForOtherSorting(sortingEntries, indexes, source)) {
171
+ return indexes;
172
+ }
173
+ if (canUseDefaultCompareFastPath(sortingEntries, indexes, source, sorting, sortingColumns)) {
174
+ return sortIndexByDefaultComparers(indexes, source, sortingEntries, sorting, sortingColumns);
11
175
  }
12
176
  //
13
177
  /**
@@ -17,15 +181,15 @@ export function sortIndexByItems(indexes, source, sortingFunc = {}) {
17
181
  return indexes.sort((a, b) => {
18
182
  const itemA = source[a];
19
183
  const itemB = source[b];
20
- for (const [prop, cmp] of Object.entries(sortingFunc)) {
184
+ for (const [prop, cmp] of sortingEntries) {
21
185
  if (isGrouping(itemA)) {
22
- if (itemA['__rvgr-prop'] !== prop) {
23
- return 0;
186
+ if (!isSameColumnProp(itemA[GROUP_COLUMN_PROP], prop)) {
187
+ return a - b;
24
188
  }
25
189
  }
26
190
  if (isGrouping(itemB)) {
27
- if (itemB['__rvgr-prop'] !== prop) {
28
- return 0;
191
+ if (!isSameColumnProp(itemB[GROUP_COLUMN_PROP], prop)) {
192
+ return a - b;
29
193
  }
30
194
  }
31
195
  /**
@@ -45,13 +209,7 @@ export function defaultCellCompare(prop, a, b) {
45
209
  const bRaw = this.column ? getCellRaw(b, this.column) : b === null || b === void 0 ? void 0 : b[prop];
46
210
  const av = typeof aRaw === 'number' ? aRaw : aRaw === null || aRaw === void 0 ? void 0 : aRaw.toString().toLowerCase();
47
211
  const bv = typeof bRaw === 'number' ? bRaw : bRaw === null || bRaw === void 0 ? void 0 : bRaw.toString().toLowerCase();
48
- if (av === bv) {
49
- return 0;
50
- }
51
- if (av > bv) {
52
- return 1;
53
- }
54
- return -1;
212
+ return compareValues(av, bv);
55
213
  }
56
214
  export function descCellCompare(cmp) {
57
215
  return (prop, a, b) => {