@revolist/revogrid 4.26.2 → 4.27.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 (130) hide show
  1. package/dist/cjs/{cell-renderer-Cf2Pu4S0.js → cell-renderer-BDIx0xys.js} +3 -3
  2. package/dist/cjs/{column.service-C7p5eC5V.js → column.service-D-ENzqyb.js} +5 -3
  3. package/dist/cjs/{dimension.helpers-CgHhnN1d.js → dimension.helpers-CptesQOZ.js} +52 -8
  4. package/dist/cjs/{edit.utils-rAcGublN.js → edit.utils-CBAbQhGP.js} +1 -1
  5. package/dist/cjs/{header-cell-renderer-DHClfIto.js → header-cell-renderer-B5Y4fdZC.js} +1 -1
  6. package/dist/cjs/{index--FdNLz1Z.js → index-BVESmpqW.js} +1 -1
  7. package/dist/cjs/index.cjs.js +72 -55
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/revo-grid.cjs.entry.js +131 -86
  10. package/dist/cjs/revo-grid.cjs.js +1 -1
  11. package/dist/cjs/revogr-attribution_7.cjs.entry.js +51 -19
  12. package/dist/cjs/revogr-clipboard_3.cjs.entry.js +4 -4
  13. package/dist/cjs/revogr-data_4.cjs.entry.js +21 -15
  14. package/dist/cjs/revogr-filter-panel.cjs.entry.js +9 -9
  15. package/dist/cjs/{column.drag.plugin-CK5HADlW.js → row-resize.plugin-sK9_rcUN.js} +759 -86
  16. package/dist/cjs/{text-editor-F04kTx53.js → text-editor-CJyQaYei.js} +2 -2
  17. package/dist/cjs/{throttle-fV6BUmM7.js → throttle-BsaP4fgu.js} +3 -3
  18. package/dist/cjs/{viewport.store-B4Clk4m9.js → viewport.store-mhsdi61t.js} +1 -1
  19. package/dist/collection/components/data/revogr-data-style.css +11 -0
  20. package/dist/collection/components/data/revogr-data.js +14 -8
  21. package/dist/collection/components/header/revogr-header-style.css +1 -0
  22. package/dist/collection/components/overlay/keyboard.service.js +33 -3
  23. package/dist/collection/components/overlay/revogr-overlay-selection.js +12 -10
  24. package/dist/collection/components/revoGrid/plugin.service.js +2 -2
  25. package/dist/collection/components/revoGrid/revo-grid.js +80 -30
  26. package/dist/collection/components/revoGrid/viewport.scrolling.service.js +24 -13
  27. package/dist/collection/components/revoGrid/viewport.service.js +1 -1
  28. package/dist/collection/plugins/filter/filter.constants.js +9 -0
  29. package/dist/collection/plugins/filter/filter.panel.js +8 -8
  30. package/dist/collection/plugins/filter/filter.plugin.js +109 -10
  31. package/dist/collection/plugins/filter/filter.style.css +2 -0
  32. package/dist/collection/plugins/groupingRow/grouping.const.js +1 -0
  33. package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +93 -56
  34. package/dist/collection/plugins/groupingRow/grouping.row.renderer.js +1 -1
  35. package/dist/collection/plugins/groupingRow/grouping.service.js +1 -1
  36. package/dist/collection/plugins/groupingRow/grouping.sorting.service.js +58 -0
  37. package/dist/collection/plugins/groupingRow/grouping.trimmed.service.js +5 -3
  38. package/dist/collection/plugins/index.js +1 -0
  39. package/dist/collection/plugins/row-resize/index.js +6 -0
  40. package/dist/collection/plugins/row-resize/row-resize.plugin.js +416 -0
  41. package/dist/collection/plugins/row-resize/row-resize.types.js +1 -0
  42. package/dist/collection/plugins/row-resize/row-resize.utils.js +55 -0
  43. package/dist/collection/plugins/sorting/sorting.plugin.js +16 -13
  44. package/dist/collection/plugins/wcag/index.js +5 -4
  45. package/dist/collection/serve/controller.js +1 -1
  46. package/dist/collection/services/data.provider.js +8 -2
  47. package/dist/collection/services/dimension.provider.js +17 -1
  48. package/dist/collection/services/local.scroll.timer.js +3 -3
  49. package/dist/collection/services/selection.store.connector.js +4 -2
  50. package/dist/collection/store/dataSource/data.pending.plugin.js +21 -0
  51. package/dist/collection/store/dataSource/data.store.js +25 -3
  52. package/dist/collection/store/dataSource/trimmed.plugin.js +9 -6
  53. package/dist/collection/store/dimension/dimension.trim.plugin.js +1 -3
  54. package/dist/collection/types/events.js +4 -1
  55. package/dist/collection/utils/column.utils.js +1 -1
  56. package/dist/esm/{cell-renderer-11cf-lu3.js → cell-renderer-D9ze8OJw.js} +3 -3
  57. package/dist/esm/{column.service-Cfw3L0PN.js → column.service-pu_fdQ0S.js} +5 -4
  58. package/dist/{revo-grid/dimension.helpers-fl4HSSK9.js → esm/dimension.helpers-Cln9sALu.js} +52 -9
  59. package/dist/{revo-grid/edit.utils-4e9fsqOR.js → esm/edit.utils-3ZbhQCv_.js} +1 -1
  60. package/dist/esm/{header-cell-renderer-Cqtg1ETB.js → header-cell-renderer-YCiVIQ2E.js} +1 -1
  61. package/dist/esm/{index-D24ku9ej.js → index-BvMNbQyq.js} +1 -1
  62. package/dist/esm/index.js +14 -11
  63. package/dist/esm/loader.js +1 -1
  64. package/dist/esm/revo-grid.entry.js +113 -68
  65. package/dist/esm/revo-grid.js +1 -1
  66. package/dist/esm/revogr-attribution_7.entry.js +51 -19
  67. package/dist/esm/revogr-clipboard_3.entry.js +4 -4
  68. package/dist/esm/revogr-data_4.entry.js +21 -15
  69. package/dist/esm/revogr-filter-panel.entry.js +9 -9
  70. package/dist/esm/{column.drag.plugin-DDBKeTGI.js → row-resize.plugin-DBOgjLdE.js} +748 -87
  71. package/dist/{revo-grid/text-editor-DlMnLkRK.js → esm/text-editor-eHtrwvxH.js} +2 -2
  72. package/dist/{revo-grid/throttle-Cpk1LoGk.js → esm/throttle-3rhqdcLy.js} +3 -3
  73. package/dist/{revo-grid/viewport.store-BSXmsiZc.js → esm/viewport.store-DWMKRDSH.js} +1 -1
  74. package/dist/revo-grid/{cell-renderer-11cf-lu3.js → cell-renderer-D9ze8OJw.js} +3 -3
  75. package/dist/revo-grid/{column.service-Cfw3L0PN.js → column.service-pu_fdQ0S.js} +5 -4
  76. package/dist/{esm/dimension.helpers-fl4HSSK9.js → revo-grid/dimension.helpers-Cln9sALu.js} +52 -9
  77. package/dist/{esm/edit.utils-4e9fsqOR.js → revo-grid/edit.utils-3ZbhQCv_.js} +1 -1
  78. package/dist/revo-grid/{header-cell-renderer-Cqtg1ETB.js → header-cell-renderer-YCiVIQ2E.js} +1 -1
  79. package/dist/revo-grid/{index-D24ku9ej.js → index-BvMNbQyq.js} +1 -1
  80. package/dist/revo-grid/index.esm.js +14 -11
  81. package/dist/revo-grid/revo-grid.entry.js +113 -68
  82. package/dist/revo-grid/revo-grid.esm.js +1 -1
  83. package/dist/revo-grid/revogr-attribution_7.entry.js +51 -19
  84. package/dist/revo-grid/revogr-clipboard_3.entry.js +4 -4
  85. package/dist/revo-grid/revogr-data_4.entry.js +21 -15
  86. package/dist/revo-grid/revogr-filter-panel.entry.js +9 -9
  87. package/dist/revo-grid/{column.drag.plugin-DDBKeTGI.js → row-resize.plugin-DBOgjLdE.js} +748 -87
  88. package/dist/{esm/text-editor-DlMnLkRK.js → revo-grid/text-editor-eHtrwvxH.js} +2 -2
  89. package/dist/{esm/throttle-Cpk1LoGk.js → revo-grid/throttle-3rhqdcLy.js} +3 -3
  90. package/dist/{esm/viewport.store-BSXmsiZc.js → revo-grid/viewport.store-DWMKRDSH.js} +1 -1
  91. package/dist/types/components/data/revogr-data.d.ts +1 -0
  92. package/dist/types/components/overlay/keyboard.service.d.ts +6 -0
  93. package/dist/types/components/overlay/revogr-overlay-selection.d.ts +3 -1
  94. package/dist/types/components/revoGrid/revo-grid.d.ts +9 -1
  95. package/dist/types/components/revoGrid/viewport.scrolling.service.d.ts +3 -1
  96. package/dist/types/components.d.ts +23 -10
  97. package/dist/types/plugins/filter/filter.constants.d.ts +6 -0
  98. package/dist/types/plugins/filter/filter.plugin.d.ts +15 -0
  99. package/dist/types/plugins/groupingRow/grouping.const.d.ts +1 -0
  100. package/dist/types/plugins/groupingRow/grouping.row.plugin.d.ts +5 -7
  101. package/dist/types/plugins/groupingRow/grouping.sorting.service.d.ts +7 -0
  102. package/dist/types/plugins/groupingRow/grouping.trimmed.service.d.ts +9 -0
  103. package/dist/types/plugins/index.d.ts +1 -0
  104. package/dist/types/plugins/row-resize/index.d.ts +3 -0
  105. package/dist/types/plugins/row-resize/row-resize.plugin.d.ts +46 -0
  106. package/dist/types/plugins/row-resize/row-resize.types.d.ts +40 -0
  107. package/dist/types/plugins/row-resize/row-resize.utils.d.ts +14 -0
  108. package/dist/types/plugins/sorting/sorting.plugin.d.ts +5 -0
  109. package/dist/types/services/data.provider.d.ts +2 -0
  110. package/dist/types/services/dimension.provider.d.ts +7 -1
  111. package/dist/types/store/dataSource/data.pending.plugin.d.ts +9 -0
  112. package/dist/types/store/dataSource/data.store.d.ts +10 -0
  113. package/dist/types/store/dataSource/trimmed.plugin.d.ts +5 -0
  114. package/dist/types/types/events.d.ts +1 -1
  115. package/dist/types/types/interfaces.d.ts +3 -1
  116. package/hydrate/index.js +980 -191
  117. package/hydrate/index.mjs +980 -191
  118. package/package.json +1 -1
  119. package/readme.md +4 -1
  120. package/standalone/column.service.js +1 -1
  121. package/standalone/data.store.js +1 -1
  122. package/standalone/dimension.helpers.js +1 -1
  123. package/standalone/index.js +1 -1
  124. package/standalone/local.scroll.timer.js +1 -1
  125. package/standalone/revo-grid.js +1 -1
  126. package/standalone/revogr-data2.js +1 -1
  127. package/standalone/revogr-filter-panel.js +1 -1
  128. package/standalone/revogr-header2.js +1 -1
  129. package/standalone/revogr-overlay-selection2.js +1 -1
  130. package/standalone/revogr-row-headers2.js +1 -1
@@ -3,8 +3,8 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var edit_utils = require('./edit.utils-rAcGublN.js');
7
- var index = require('./index--FdNLz1Z.js');
6
+ var edit_utils = require('./edit.utils-CBAbQhGP.js');
7
+ var index = require('./index-BVESmpqW.js');
8
8
 
9
9
  class TextEditor {
10
10
  constructor(data, saveCallback) {
@@ -197,7 +197,7 @@ class LocalScrollTimer {
197
197
  * Remember last mw event time
198
198
  */
199
199
  latestScrollUpdate(dimension) {
200
- this.mouseWheelScrollTimestamp[dimension] = new Date().getTime();
200
+ this.mouseWheelScrollTimestamp[dimension] = Date.now();
201
201
  }
202
202
  isReady(type, coordinate) {
203
203
  // if there is a callback, clear it
@@ -208,7 +208,7 @@ class LocalScrollTimer {
208
208
  return this.verifyChange(type, coordinate);
209
209
  }
210
210
  verifyChange(type, coordinate) {
211
- const now = new Date().getTime();
211
+ const now = Date.now();
212
212
  const change = now - this.mouseWheelScrollTimestamp[type];
213
213
  return change > this.scrollThrottling &&
214
214
  coordinate !== this.lastKnownScrollCoordinate[type];
@@ -226,7 +226,7 @@ class LocalScrollTimer {
226
226
  // save lastScrollUpdate callback
227
227
  const callback = this.lastScrollUpdateCallbacks[type] = {
228
228
  callback: lastScrollUpdate,
229
- timestamp: new Date().getTime(),
229
+ timestamp: Date.now(),
230
230
  coordinate,
231
231
  timeout: 0,
232
232
  };
@@ -3,7 +3,7 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var dimension_helpers = require('./dimension.helpers-CgHhnN1d.js');
6
+ var dimension_helpers = require('./dimension.helpers-CptesQOZ.js');
7
7
 
8
8
  const LETTER_BLOCK_SIZE = 10;
9
9
  const calculateRowHeaderSize = (itemsLength, rowHeaderColumn, minWidth = 50) => {
@@ -44,6 +44,17 @@ revogr-data .rgRow {
44
44
  width: 100%;
45
45
  left: 0;
46
46
  }
47
+ revogr-data .rgRow > .row-resize-handle {
48
+ position: absolute;
49
+ z-index: 2;
50
+ right: 0;
51
+ bottom: -3px;
52
+ left: 0;
53
+ height: 7px;
54
+ cursor: row-resize;
55
+ touch-action: none;
56
+ user-select: none;
57
+ }
47
58
  revogr-data .rgRow.groupingRow {
48
59
  font-weight: 600;
49
60
  text-align: left;
@@ -113,7 +113,10 @@ export class RevogrData {
113
113
  groupingCellRenderer, additionalData: this.additionalData,
114
114
  // Only show expand button if grouping is enabled and not in row headers
115
115
  hasExpand: this.columnService.hasGrouping && this.colType !== 'rowHeaders', columnItems: cols, providers: this.providers });
116
- rowsEls.push(h(GroupingRowRenderer, Object.assign({}, gmodel)));
116
+ const row = h(GroupingRowRenderer, Object.assign({}, gmodel));
117
+ this.triggerBeforeRowRender(row, rgRow, dataItem);
118
+ rowsEls.push(row);
119
+ this.renderedRows.set(rgRow.itemIndex, row);
117
120
  continue;
118
121
  }
119
122
  // #endregion
@@ -162,19 +165,22 @@ export class RevogrData {
162
165
  rowClass += ` ${ROW_FOCUSED_CLASS}`;
163
166
  }
164
167
  const row = (h(RowRenderer, { index: rgRow.itemIndex, rowClass: rowClass, size: rgRow.size, start: rgRow.start - rowRenderOffset, groupingLevel: groupDepth || undefined }, cells));
165
- this.beforerowrender.emit({
166
- node: row,
167
- item: rgRow,
168
- model: dataItem,
169
- colType: this.columnService.type,
170
- rowType: this.type,
171
- });
168
+ this.triggerBeforeRowRender(row, rgRow, dataItem);
172
169
  rowsEls.push(row);
173
170
  this.renderedRows.set(rgRow.itemIndex, row);
174
171
  // #endregion
175
172
  }
176
173
  return (h(Host, null, h("slot", null), rowsEls));
177
174
  }
175
+ triggerBeforeRowRender(node, item, model) {
176
+ this.beforerowrender.emit({
177
+ node,
178
+ item,
179
+ model,
180
+ colType: this.colType,
181
+ rowType: this.type,
182
+ });
183
+ }
178
184
  triggerBeforeCellRender(model, row, column) {
179
185
  const detail = {
180
186
  column,
@@ -62,6 +62,7 @@ revogr-header .rgHeaderCell.active .resizable {
62
62
  }
63
63
  revogr-header .rgHeaderCell .header-content {
64
64
  position: absolute;
65
+ z-index: 0;
65
66
  inset: 0;
66
67
  box-sizing: border-box;
67
68
  padding: inherit;
@@ -15,6 +15,16 @@ const DIRECTION_CODES = [
15
15
  export class KeyboardService {
16
16
  constructor(sv) {
17
17
  this.sv = sv;
18
+ /** Keep focus transitions in keydown order so rendering can scroll each cell into view. */
19
+ this.keyChangeQueue = Promise.resolve(false);
20
+ this.keyChangeGeneration = 0;
21
+ this.applyingKeyChange = false;
22
+ }
23
+ /** Cancel delayed directional input after focus or edit context changes externally. */
24
+ invalidatePendingChanges() {
25
+ if (!this.applyingKeyChange) {
26
+ this.keyChangeGeneration += 1;
27
+ }
18
28
  }
19
29
  /**
20
30
  * Appends printable key input that arrives after edit mode was requested
@@ -117,13 +127,33 @@ export class KeyboardService {
117
127
  if (!data) {
118
128
  return false;
119
129
  }
130
+ const keyChangeGeneration = this.keyChangeGeneration;
120
131
  // this interval needed for several cases
121
132
  // grid could be resized before next click
122
133
  // at this case to avoid screen jump we use this interval
123
134
  await timeout(RESIZE_INTERVAL + 30);
124
- const range = this.sv.selectionStore.get('range');
125
- const focus = this.sv.selectionStore.get('focus');
126
- return this.keyPositionChange(data.changes, range, focus, data.isMulti);
135
+ const applyKeyChange = async () => {
136
+ if (keyChangeGeneration !== this.keyChangeGeneration) {
137
+ return false;
138
+ }
139
+ const range = this.sv.selectionStore.get('range');
140
+ const focus = this.sv.selectionStore.get('focus');
141
+ this.applyingKeyChange = true;
142
+ let changed;
143
+ try {
144
+ changed = this.keyPositionChange(data.changes, range, focus, data.isMulti);
145
+ }
146
+ finally {
147
+ this.applyingKeyChange = false;
148
+ }
149
+ await new Promise(resolve => requestAnimationFrame(() => {
150
+ requestAnimationFrame(() => resolve());
151
+ }));
152
+ return changed;
153
+ };
154
+ const queuedChange = this.keyChangeQueue.then(applyKeyChange, applyKeyChange);
155
+ this.keyChangeQueue = queuedChange.catch(() => false);
156
+ return queuedChange;
127
157
  }
128
158
  keyPositionChange(changes, range, focus, isMulti = false) {
129
159
  if (!range || !focus) {
@@ -84,6 +84,8 @@ export class OverlaySelection {
84
84
  * Selection & Keyboard
85
85
  */
86
86
  selectionServiceSet(selectionStore) {
87
+ var _a;
88
+ (_a = this.keyboardService) === null || _a === void 0 ? void 0 : _a.invalidatePendingChanges();
87
89
  // clear subscriptions
88
90
  this.unsubscribeSelectionStore.forEach(v => v());
89
91
  this.unsubscribeSelectionStore.length = 0;
@@ -111,6 +113,7 @@ export class OverlaySelection {
111
113
  getData: () => this.getData(),
112
114
  selectAll: () => this.selectAll.emit(),
113
115
  });
116
+ this.unsubscribeSelectionStore.push(selectionStore.onChange('focus', () => { var _a; return (_a = this.keyboardService) === null || _a === void 0 ? void 0 : _a.invalidatePendingChanges(); }), selectionStore.onChange('edit', () => { var _a; return (_a = this.keyboardService) === null || _a === void 0 ? void 0 : _a.invalidatePendingChanges(); }));
114
117
  this.createAutoFillService();
115
118
  }
116
119
  /** Autofill */
@@ -147,11 +150,12 @@ export class OverlaySelection {
147
150
  this.selectionServiceSet(this.selectionStore);
148
151
  }
149
152
  disconnectedCallback() {
150
- var _a;
153
+ var _a, _b;
151
154
  // clear subscriptions
155
+ (_a = this.keyboardService) === null || _a === void 0 ? void 0 : _a.invalidatePendingChanges();
152
156
  this.unsubscribeSelectionStore.forEach(v => v());
153
157
  this.unsubscribeSelectionStore.length = 0;
154
- (_a = this.columnService) === null || _a === void 0 ? void 0 : _a.destroy();
158
+ (_b = this.columnService) === null || _b === void 0 ? void 0 : _b.destroy();
155
159
  }
156
160
  async componentWillRender() {
157
161
  var _a, _b;
@@ -163,9 +167,7 @@ export class OverlaySelection {
163
167
  renderRange(range) {
164
168
  const cell = getCell(range, this.dimensionRow.state, this.dimensionCol.state);
165
169
  const styles = styleByCellProps(cell);
166
- return [
167
- h("div", { class: SELECTION_BORDER_CLASS, style: styles }, this.isMobileDevice && (h("div", { class: "range-handlers" }, h("span", { class: MOBILE_CLASS }), h("span", { class: MOBILE_CLASS })))),
168
- ];
170
+ return (h("div", { class: SELECTION_BORDER_CLASS, style: styles }, this.isMobileDevice && (h("div", { class: "range-handlers" }, h("span", { class: MOBILE_CLASS }), h("span", { class: MOBILE_CLASS })))));
169
171
  }
170
172
  renderEditor() {
171
173
  // Check if edit access
@@ -218,7 +220,7 @@ export class OverlaySelection {
218
220
  }
219
221
  // Range
220
222
  if (range) {
221
- nodes.push(...this.renderRange(range));
223
+ nodes.push(this.renderRange(range));
222
224
  }
223
225
  // Autofill
224
226
  if (focus && !this.readonly && this.range) {
@@ -229,9 +231,9 @@ export class OverlaySelection {
229
231
  nodes.push(h("revogr-order-editor", { ref: e => (this.orderEditor = e), dataStore: this.dataStore, dimensionRow: this.dimensionRow, dimensionCol: this.dimensionCol, parent: this.element, rowType: this.types.rowType, onRowdragstartinit: e => this.rowDragStart(e) }));
230
232
  }
231
233
  }
232
- return (h(Host, { key: '2d8dc4fd40a883fe59b24b2cfac1c370b9f0ac16', class: { mobile: this.isMobileDevice }, onDblClick: (e) => this.onElementDblClick(e), onMouseDown: (e) => this.onElementMouseDown(e), onTouchStart: (e) => this.onElementMouseDown(e, true), onCloseedit: (e) => this.closeEdit(e),
234
+ return (h(Host, { key: '230e2122c5c7065c072f02019d616a64949d54d0', class: { mobile: this.isMobileDevice }, onDblClick: (e) => this.onElementDblClick(e), onMouseDown: (e) => this.onElementMouseDown(e), onTouchStart: (e) => this.onElementMouseDown(e, true), onCloseedit: (e) => this.closeEdit(e),
233
235
  // it's done to be able to throw events from different levels, not just from editor
234
- onCelledit: (e) => this.onEditCell(e) }, nodes, h("slot", { key: '8ad5df55904ca6a8b2fb0e69c5f608ec7264a0f1', name: "data" })));
236
+ onCelledit: (e) => this.onEditCell(e) }, nodes, h("slot", { key: '47740a79c605258b4024384510358be927d000b7', name: "data" })));
235
237
  }
236
238
  /**
237
239
  * Executes the focus operation on the specified range of cells.
@@ -428,12 +430,12 @@ export class OverlaySelection {
428
430
  clearCell() {
429
431
  var _a;
430
432
  const range = this.selectionStore.get('range');
431
- if (range && !isRangeSingleCell(range)) {
433
+ const focused = this.selectionStore.get('focus');
434
+ if (range && (!isRangeSingleCell(range) || !focused)) {
432
435
  const data = this.columnService.getRangeStaticData(range, '');
433
436
  (_a = this.autoFillService) === null || _a === void 0 ? void 0 : _a.onRangeApply(data, range, range);
434
437
  }
435
438
  else if (this.canEdit()) {
436
- const focused = this.selectionStore.get('focus');
437
439
  if (!focused) {
438
440
  return;
439
441
  }
@@ -33,7 +33,7 @@ export class PluginService {
33
33
  return;
34
34
  }
35
35
  // Step 1: Identify plugins to remove, compare new and old plugins
36
- const pluginsToRemove = (prevPlugins === null || prevPlugins === void 0 ? void 0 : prevPlugins.filter(prevPlugin => !plugins.some(userPlugin => userPlugin === prevPlugin))) || [];
36
+ const pluginsToRemove = (prevPlugins === null || prevPlugins === void 0 ? void 0 : prevPlugins.filter(prevPlugin => !plugins.includes(prevPlugin))) || [];
37
37
  // Step 2: Remove old plugins
38
38
  pluginsToRemove.forEach(plugin => {
39
39
  var _a, _b;
@@ -46,7 +46,7 @@ export class PluginService {
46
46
  // Step 3: Register user plugins
47
47
  plugins === null || plugins === void 0 ? void 0 : plugins.forEach(userPlugin => {
48
48
  // check if plugin already exists, if so, skip
49
- const existingPlugin = this.internalPlugins.find(createdPlugin => createdPlugin instanceof userPlugin);
49
+ const existingPlugin = this.internalPlugins.some(createdPlugin => createdPlugin instanceof userPlugin);
50
50
  if (existingPlugin) {
51
51
  return;
52
52
  }
@@ -21,7 +21,7 @@ import GridScrollingService from "./viewport.scrolling.service";
21
21
  import { SelectionStoreConnector } from "../../services/selection.store.connector";
22
22
  import OrderRenderer from "../order/order-renderer";
23
23
  import { StretchColumn, isStretchPlugin, } from "../../plugins/column.stretch.plugin";
24
- import { rowDefinitionByType, rowDefinitionRemoveByType } from "./grid.helpers";
24
+ import { rowDefinitionByType } from "./grid.helpers";
25
25
  import { ColumnMovePlugin } from "../../plugins/moveColumn/column.drag.plugin";
26
26
  import { getPropertyFromEvent } from "../../utils/events";
27
27
  import { isMobileDevice } from "../../utils/mobile";
@@ -29,6 +29,7 @@ import { getColumnByProp, getColumns } from "../../utils/column.utils";
29
29
  import { WCAGPlugin } from "../../plugins/wcag";
30
30
  import { PluginService } from "./plugin.service";
31
31
  import { RTLPlugin } from "../../plugins/rtl/rtl.plugin";
32
+ import { RowResizePlugin, } from "../../plugins/row-resize";
32
33
  const DEFAULT_COLUMN_SIZE = 100;
33
34
  function getColumnSize(size) {
34
35
  return Number.isFinite(size) && size > 0 ? size : DEFAULT_COLUMN_SIZE;
@@ -74,7 +75,12 @@ export class RevoGridComponent {
74
75
  /** When true, grid in read only mode. */
75
76
  this.readonly = false;
76
77
  /** When true, columns are resizable. */
77
- this.resize = false;
78
+ this.resize = true;
79
+ /**
80
+ * Enables row resizing. Pass a configuration object to customize the
81
+ * height limits or enable resize edges across the full row.
82
+ */
83
+ this.resizeRow = false;
78
84
  /**
79
85
  * Prevents horizontal scroll state from being mirrored across viewport sections.
80
86
  */
@@ -145,15 +151,15 @@ export class RevoGridComponent {
145
151
  */
146
152
  this.autoSizeColumn = false;
147
153
  /**
148
- * Enables filter plugin.
154
+ * Enables filter plugin. Enabled by default; set to `false` to opt out.
149
155
  * Can be boolean.
150
156
  * Or can be filter collection See `FilterCollection` for more info.
151
157
  */
152
- this.filter = false;
158
+ this.filter = true;
153
159
  /**
154
160
  * Enable column move plugin.
155
161
  */
156
- this.canMoveColumns = false;
162
+ this.canMoveColumns = true;
157
163
  /**
158
164
  * Trimmed rows.
159
165
  * Functionality which allows to hide rows from main data set.
@@ -163,7 +169,7 @@ export class RevoGridComponent {
163
169
  /**
164
170
  * Enable export plugin.
165
171
  */
166
- this.exporting = false;
172
+ this.exporting = true;
167
173
  /**
168
174
  * Stretch strategy for columns by `StretchColumn` plugin.
169
175
  * For example if there are more space on the right last column size would be increased.
@@ -255,7 +261,7 @@ export class RevoGridComponent {
255
261
  var _a;
256
262
  if (this.dataProvider && this.columnProvider && !skipDataUpdate) {
257
263
  const columnProp = (_a = this.columnProvider.getColumn(col, colType)) === null || _a === void 0 ? void 0 : _a.prop;
258
- if (typeof columnProp !== 'undefined') {
264
+ if (columnProp !== undefined) {
259
265
  this.dataProvider.setCellData({
260
266
  type: rowType,
261
267
  rowIndex: row,
@@ -851,29 +857,31 @@ export class RevoGridComponent {
851
857
  vals: after,
852
858
  oldVals: before,
853
859
  });
854
- // apply new values
860
+ this.dimensionProvider.syncRowDefinitions(newVal);
855
861
  const newRows = rowDefinitionByType(newVal);
856
- // clear current defs
857
- if (oldVal) {
858
- const remove = rowDefinitionRemoveByType(oldVal);
859
- // clear all old data and drop sizes
860
- for (const t in remove) {
861
- if (remove.hasOwnProperty(t)) {
862
- const type = t;
863
- const store = this.dataProvider.stores[type];
864
- const sourceLength = store.store.get('source').length;
865
- this.dimensionProvider.clearSize(type, sourceLength);
866
- }
867
- }
868
- }
869
- // set new sizes
862
+ const oldRows = rowDefinitionByType(oldVal);
863
+ const dataProvider = this.dataProvider;
864
+ const dimensionProvider = this.dimensionProvider;
870
865
  rowTypes.forEach((t) => {
871
- var _a;
872
866
  const newSizes = newRows[t];
873
- // apply new sizes or force update
874
- if (newSizes || forceUpdate) {
875
- (_a = this.dimensionProvider) === null || _a === void 0 ? void 0 : _a.setCustomSizes(t, (newSizes === null || newSizes === void 0 ? void 0 : newSizes.sizes) || {});
867
+ const oldSizes = oldRows[t];
868
+ if (!newSizes && !oldSizes && !forceUpdate) {
869
+ return;
876
870
  }
871
+ const sizes = Object.assign({}, dimensionProvider.stores[t].store.get('sizes'));
872
+ const definitionSizes = (newSizes === null || newSizes === void 0 ? void 0 : newSizes.sizes) || {};
873
+ const previousDefinitionSizes = (oldSizes === null || oldSizes === void 0 ? void 0 : oldSizes.sizes) || {};
874
+ const items = dataProvider.stores[t].store.get('items');
875
+ items.forEach((physicalIndex, virtualIndex) => {
876
+ if (Object.hasOwn(previousDefinitionSizes, physicalIndex) &&
877
+ sizes[virtualIndex] === previousDefinitionSizes[physicalIndex]) {
878
+ delete sizes[virtualIndex];
879
+ }
880
+ if (Object.hasOwn(definitionSizes, physicalIndex)) {
881
+ sizes[virtualIndex] = definitionSizes[physicalIndex];
882
+ }
883
+ });
884
+ dimensionProvider.setCustomSizes(t, sizes);
877
885
  });
878
886
  }
879
887
  trimmedRowsChanged(newVal = {}) {
@@ -922,6 +930,9 @@ export class RevoGridComponent {
922
930
  rowHeadersChange(rowHeaders) {
923
931
  this.rowheaderschanged.emit(rowHeaders);
924
932
  }
933
+ resizeRowChanged() {
934
+ this.syncRowResizeConfig();
935
+ }
925
936
  /**
926
937
  * Register external VNodes
927
938
  */
@@ -944,6 +955,7 @@ export class RevoGridComponent {
944
955
  */
945
956
  pluginsChanged(plugins = [], prevPlugins) {
946
957
  this.pluginService.addUserPluginsAndCreate(this.element, plugins, prevPlugins, this.getPluginData());
958
+ this.syncRowResizeConfig();
947
959
  }
948
960
  // #endregion
949
961
  // #region Plugins
@@ -984,10 +996,15 @@ export class RevoGridComponent {
984
996
  this.pluginService.add(new SortingPlugin(this.element, pluginData));
985
997
  // register grouping plugin
986
998
  this.pluginService.add(new GroupingRowPlugin(this.element, pluginData));
999
+ this.pluginService.add(new RowResizePlugin(this.element, pluginData));
987
1000
  if (this.canMoveColumns) {
988
1001
  this.pluginService.add(new ColumnMovePlugin(this.element, pluginData));
989
1002
  }
990
1003
  }
1004
+ syncRowResizeConfig() {
1005
+ const plugin = this.pluginService.getByClass(RowResizePlugin);
1006
+ plugin === null || plugin === void 0 ? void 0 : plugin.syncGridConfig();
1007
+ }
991
1008
  getPluginData() {
992
1009
  if (!this.dimensionProvider || !this.dataProvider || !this.columnProvider || !this.viewportProvider || !this.selectionStoreConnector) {
993
1010
  return;
@@ -1030,6 +1047,9 @@ export class RevoGridComponent {
1030
1047
  this.themeService.setDefinitions(this.themeDefinitions);
1031
1048
  this.dimensionProvider = new DimensionProvider(this.viewportProvider, {
1032
1049
  realSizeChanged: (k) => this.contentsizechanged.emit(k),
1050
+ rowDefinitionsChanged: definitions => {
1051
+ this.rowDefinitions = definitions;
1052
+ },
1033
1053
  });
1034
1054
  this.dimensionProvider.setSettings({ originItemSize: getColumnSize(this.colSize) }, 'rgCol');
1035
1055
  this.columnProvider = new ColumnDataProvider();
@@ -1318,6 +1338,33 @@ export class RevoGridComponent {
1318
1338
  "setter": false,
1319
1339
  "reflect": false,
1320
1340
  "attribute": "resize",
1341
+ "defaultValue": "true"
1342
+ },
1343
+ "resizeRow": {
1344
+ "type": "boolean",
1345
+ "mutable": false,
1346
+ "complexType": {
1347
+ "original": "boolean | RowResizeConfig",
1348
+ "resolved": "boolean | { minHeight?: number | undefined; maxHeight?: number | undefined; fullRow?: boolean | undefined; }",
1349
+ "references": {
1350
+ "RowResizeConfig": {
1351
+ "location": "import",
1352
+ "path": "../../plugins/row-resize",
1353
+ "id": "src/plugins/row-resize/index.ts::RowResizeConfig",
1354
+ "referenceLocation": "RowResizeConfig"
1355
+ }
1356
+ }
1357
+ },
1358
+ "required": false,
1359
+ "optional": false,
1360
+ "docs": {
1361
+ "tags": [],
1362
+ "text": "Enables row resizing. Pass a configuration object to customize the\nheight limits or enable resize edges across the full row."
1363
+ },
1364
+ "getter": false,
1365
+ "setter": false,
1366
+ "reflect": false,
1367
+ "attribute": "resize-row",
1321
1368
  "defaultValue": "false"
1322
1369
  },
1323
1370
  "noHorizontalScrollTransfer": {
@@ -1724,13 +1771,13 @@ export class RevoGridComponent {
1724
1771
  "optional": false,
1725
1772
  "docs": {
1726
1773
  "tags": [],
1727
- "text": "Enables filter plugin.\nCan be boolean.\nOr can be filter collection See `FilterCollection` for more info."
1774
+ "text": "Enables filter plugin. Enabled by default; set to `false` to opt out.\nCan be boolean.\nOr can be filter collection See `FilterCollection` for more info."
1728
1775
  },
1729
1776
  "getter": false,
1730
1777
  "setter": false,
1731
1778
  "reflect": false,
1732
1779
  "attribute": "filter",
1733
- "defaultValue": "false"
1780
+ "defaultValue": "true"
1734
1781
  },
1735
1782
  "sorting": {
1736
1783
  "type": "unknown",
@@ -1798,7 +1845,7 @@ export class RevoGridComponent {
1798
1845
  "setter": false,
1799
1846
  "reflect": false,
1800
1847
  "attribute": "can-move-columns",
1801
- "defaultValue": "false"
1848
+ "defaultValue": "true"
1802
1849
  },
1803
1850
  "trimmedRows": {
1804
1851
  "type": "unknown",
@@ -1841,7 +1888,7 @@ export class RevoGridComponent {
1841
1888
  "setter": false,
1842
1889
  "reflect": false,
1843
1890
  "attribute": "exporting",
1844
- "defaultValue": "false"
1891
+ "defaultValue": "true"
1845
1892
  },
1846
1893
  "grouping": {
1847
1894
  "type": "unknown",
@@ -3839,6 +3886,9 @@ export class RevoGridComponent {
3839
3886
  }, {
3840
3887
  "propName": "rowHeaders",
3841
3888
  "methodName": "rowHeadersChange"
3889
+ }, {
3890
+ "propName": "resizeRow",
3891
+ "methodName": "resizeRowChanged"
3842
3892
  }, {
3843
3893
  "propName": "registerVNode",
3844
3894
  "methodName": "registerOutsideVNodes"
@@ -8,29 +8,25 @@ export default class GridScrollingService {
8
8
  this.elements = {};
9
9
  }
10
10
  async proxyScroll(e, key, skipEvent) {
11
- var _a;
12
11
  let newEventPromise;
13
12
  let event = e;
14
- for (let elKey in (skipEvent ? {} : this.elements)) {
13
+ for (const elKey in (skipEvent ? {} : this.elements)) {
15
14
  // skip
16
15
  if (e.dimension === 'rgCol' && elKey === 'headerRow') {
17
16
  continue;
18
17
  // pinned column only
19
18
  }
20
- else if (this.isPinnedColumn(key) && e.dimension === 'rgCol') {
19
+ if (this.isPinnedColumn(key) && e.dimension === 'rgCol') {
21
20
  if (elKey === key || !e.delta) {
22
21
  continue;
23
22
  }
24
- for (let el of this.elements[elKey]) {
25
- if (el.changeScroll) {
26
- newEventPromise = el.changeScroll(e);
27
- }
23
+ const changedEvent = this.changeScroll(this.elements[elKey], e);
24
+ if (changedEvent) {
25
+ newEventPromise = changedEvent;
28
26
  }
29
27
  }
30
28
  else {
31
- for (let el of this.elements[elKey]) {
32
- await ((_a = el.setScroll) === null || _a === void 0 ? void 0 : _a.call(el, e));
33
- }
29
+ await this.setScroll(this.elements[elKey], e);
34
30
  }
35
31
  }
36
32
  const newEvent = await newEventPromise;
@@ -40,12 +36,27 @@ export default class GridScrollingService {
40
36
  this.setViewport(skipEvent && this.isPinnedColumn(key)
41
37
  ? Object.assign(Object.assign({}, event), { dimension: key }) : event);
42
38
  }
39
+ changeScroll(elements, e) {
40
+ let changedEvent;
41
+ for (const element of elements) {
42
+ if (element.changeScroll) {
43
+ changedEvent = element.changeScroll(e);
44
+ }
45
+ }
46
+ return changedEvent;
47
+ }
48
+ async setScroll(elements, e) {
49
+ var _a;
50
+ for (const element of elements) {
51
+ await ((_a = element.setScroll) === null || _a === void 0 ? void 0 : _a.call(element, e));
52
+ }
53
+ }
43
54
  /**
44
55
  * Silent scroll update for mobile devices when we have negative scroll top
45
56
  */
46
57
  async scrollSilentService(e, key) {
47
58
  var _a;
48
- for (let elKey in this.elements) {
59
+ for (const elKey in this.elements) {
49
60
  // skip same element update
50
61
  if (elKey === key) {
51
62
  continue;
@@ -53,7 +64,7 @@ export default class GridScrollingService {
53
64
  if (columnTypes.includes(key) &&
54
65
  (elKey === 'headerRow' ||
55
66
  columnTypes.includes(elKey))) {
56
- for (let el of this.elements[elKey]) {
67
+ for (const el of this.elements[elKey]) {
57
68
  await ((_a = el.changeScroll) === null || _a === void 0 ? void 0 : _a.call(el, e, true));
58
69
  }
59
70
  continue;
@@ -61,7 +72,7 @@ export default class GridScrollingService {
61
72
  }
62
73
  }
63
74
  isPinnedColumn(key) {
64
- return !!key && ['colPinStart', 'colPinEnd'].indexOf(key) > -1;
75
+ return !!key && ['colPinStart', 'colPinEnd'].includes(key);
65
76
  }
66
77
  registerElements(els) {
67
78
  this.elements = els;
@@ -114,7 +114,7 @@ export default class ViewportService {
114
114
  const changedItems = {};
115
115
  for (const i of Object.keys(detail || {})) {
116
116
  const size = detail[i];
117
- const virtualIndex = parseInt(i, 10);
117
+ const virtualIndex = Number.parseInt(i, 10);
118
118
  const item = getSourceItem(store, virtualIndex);
119
119
  if (item) {
120
120
  changedItems[virtualIndex] = Object.assign(Object.assign({}, item), { size });
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Built by Revolist OU ❤️
3
+ */
4
+ /** Fewer rows keep the existing synchronous filtering behavior. */
5
+ export const ASYNC_FILTER_ROW_THRESHOLD = 15000;
6
+ /** Maximum rows evaluated in one filtering chunk. */
7
+ export const FILTER_CHUNK_SIZE = 1000;
8
+ /** Yield after approximately this much accumulated filtering work. */
9
+ export const FILTER_TIME_BUDGET_MS = 5;