@revolist/revogrid 4.22.0 → 4.22.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 (66) hide show
  1. package/dist/cjs/{cell-renderer-uZmDBXz7.js → cell-renderer-BQdEGQXP.js} +2 -2
  2. package/dist/cjs/{column.drag.plugin-CM_5mKV3.js → column.drag.plugin-RDjQhKCH.js} +22 -15
  3. package/dist/cjs/{column.service-DvQDqxxx.js → column.service-DXYMehqK.js} +1 -1
  4. package/dist/cjs/{dimension.helpers-CaIsYC99.js → dimension.helpers-CiiNnlLa.js} +0 -1
  5. package/dist/cjs/{edit.utils-CwMzSIVF.js → edit.utils-CecCfA4E.js} +22 -1
  6. package/dist/cjs/{header-cell-renderer-B1dJwgTO.js → header-cell-renderer-DGyBrK8I.js} +1 -1
  7. package/dist/cjs/index.cjs.js +17 -8
  8. package/dist/cjs/revo-grid.cjs.entry.js +5 -5
  9. package/dist/cjs/revogr-attribution_7.cjs.entry.js +6 -6
  10. package/dist/cjs/revogr-clipboard_3.cjs.entry.js +4 -4
  11. package/dist/cjs/revogr-data_4.cjs.entry.js +111 -166
  12. package/dist/cjs/{text-editor-BTnGaIl3.js → text-editor-DnLZW1a-.js} +2 -2
  13. package/dist/cjs/{throttle-CI4MsAqs.js → throttle-CfgQFkfR.js} +1 -1
  14. package/dist/cjs/{viewport.store-Dcjud-a-.js → viewport.store-q6YdR9mg.js} +1 -1
  15. package/dist/collection/components/clipboard/revogr-clipboard.js +1 -1
  16. package/dist/collection/components/header/header-group-renderer.js +1 -0
  17. package/dist/collection/components/header/header-renderer.js +5 -4
  18. package/dist/collection/components/header/revogr-header.js +100 -40
  19. package/dist/collection/components/overlay/keyboard.service.js +2 -2
  20. package/dist/collection/plugins/moveColumn/column.drag.plugin.js +14 -11
  21. package/dist/collection/types/events.js +4 -0
  22. package/dist/collection/utils/key.utils.js +20 -0
  23. package/dist/{revo-grid/cell-renderer-K_BKH7Kx.js → esm/cell-renderer-CALsEsnh.js} +2 -2
  24. package/dist/esm/{column.drag.plugin-DEqZ2qXJ.js → column.drag.plugin-Dy5ztusn.js} +19 -16
  25. package/dist/esm/{column.service-Cdz3dYqZ.js → column.service-CCvAi5l4.js} +1 -1
  26. package/dist/{revo-grid/dimension.helpers-DzxqJQqN.js → esm/dimension.helpers-DmIvjIa7.js} +1 -1
  27. package/dist/esm/{edit.utils-CzfeG98N.js → edit.utils-DYN6XZh8.js} +22 -2
  28. package/dist/{revo-grid/header-cell-renderer-DXhxZMly.js → esm/header-cell-renderer-DU8wKAbg.js} +1 -1
  29. package/dist/esm/index.js +13 -9
  30. package/dist/esm/revo-grid.entry.js +5 -5
  31. package/dist/esm/revogr-attribution_7.entry.js +6 -6
  32. package/dist/esm/revogr-clipboard_3.entry.js +4 -4
  33. package/dist/esm/revogr-data_4.entry.js +111 -166
  34. package/dist/{revo-grid/text-editor-C1ks5eQ4.js → esm/text-editor-DpCnd6Fq.js} +2 -2
  35. package/dist/esm/{throttle-BEjFQa2l.js → throttle-ERvyruXb.js} +1 -1
  36. package/dist/{revo-grid/viewport.store-saAZJHRo.js → esm/viewport.store-CFjDW-3l.js} +1 -1
  37. package/dist/{esm/cell-renderer-K_BKH7Kx.js → revo-grid/cell-renderer-CALsEsnh.js} +2 -2
  38. package/dist/revo-grid/{column.drag.plugin-DEqZ2qXJ.js → column.drag.plugin-Dy5ztusn.js} +19 -16
  39. package/dist/revo-grid/{column.service-Cdz3dYqZ.js → column.service-CCvAi5l4.js} +1 -1
  40. package/dist/{esm/dimension.helpers-DzxqJQqN.js → revo-grid/dimension.helpers-DmIvjIa7.js} +1 -1
  41. package/dist/revo-grid/{edit.utils-CzfeG98N.js → edit.utils-DYN6XZh8.js} +22 -2
  42. package/dist/{esm/header-cell-renderer-DXhxZMly.js → revo-grid/header-cell-renderer-DU8wKAbg.js} +1 -1
  43. package/dist/revo-grid/index.esm.js +13 -9
  44. package/dist/revo-grid/revo-grid.entry.js +5 -5
  45. package/dist/revo-grid/revogr-attribution_7.entry.js +6 -6
  46. package/dist/revo-grid/revogr-clipboard_3.entry.js +4 -4
  47. package/dist/revo-grid/revogr-data_4.entry.js +111 -166
  48. package/dist/{esm/text-editor-C1ks5eQ4.js → revo-grid/text-editor-DpCnd6Fq.js} +2 -2
  49. package/dist/revo-grid/{throttle-BEjFQa2l.js → throttle-ERvyruXb.js} +1 -1
  50. package/dist/{esm/viewport.store-saAZJHRo.js → revo-grid/viewport.store-CFjDW-3l.js} +1 -1
  51. package/dist/types/components/header/revogr-header.d.ts +6 -0
  52. package/dist/types/plugins/moveColumn/column.drag.plugin.d.ts +29 -3
  53. package/dist/types/types/events.d.ts +1 -1
  54. package/dist/types/utils/key.utils.d.ts +8 -0
  55. package/hydrate/index.js +142 -174
  56. package/hydrate/index.mjs +142 -174
  57. package/package.json +1 -1
  58. package/standalone/column.service.js +1 -1
  59. package/standalone/data.store.js +1 -1
  60. package/standalone/index.js +1 -1
  61. package/standalone/revo-grid.js +1 -1
  62. package/standalone/revogr-clipboard2.js +1 -1
  63. package/standalone/revogr-edit.js +1 -1
  64. package/standalone/revogr-edit2.js +1 -1
  65. package/standalone/revogr-header2.js +1 -1
  66. package/standalone/revogr-overlay-selection2.js +1 -1
package/hydrate/index.js CHANGED
@@ -6800,8 +6800,8 @@ class Clipboard {
6800
6800
  return;
6801
6801
  }
6802
6802
  const data = this.getData(beforeCopy.detail.event);
6803
- this.copyRegion.emit(data || undefined);
6804
6803
  e.preventDefault();
6804
+ this.copyRegion.emit(data || undefined);
6805
6805
  }
6806
6806
  /**
6807
6807
  * Listen to copy event and emit copy region event
@@ -11289,6 +11289,26 @@ function isAll(event) {
11289
11289
  return ((event.ctrlKey && event.code === 'KeyA') || // Ctrl + A on Windows
11290
11290
  (event.metaKey && event.code === 'KeyA')); // Cmd + A on Mac
11291
11291
  }
11292
+ /**
11293
+ * Returns true when a keyboard event represents a shortcut modifier that
11294
+ * should not start cell editing from printable `event.key` input.
11295
+ *
11296
+ * AltGr is intentionally excluded because many Windows/Linux layouts expose
11297
+ * printable AltGr characters as Ctrl+Alt key events.
11298
+ */
11299
+ function isShortcutModifier(event) {
11300
+ var _a;
11301
+ if ((_a = event.getModifierState) === null || _a === void 0 ? void 0 : _a.call(event, 'AltGraph')) {
11302
+ return false;
11303
+ }
11304
+ if (event.ctrlKey &&
11305
+ event.altKey &&
11306
+ !event.metaKey &&
11307
+ event.key.length === 1) {
11308
+ return false;
11309
+ }
11310
+ return event.ctrlKey || event.metaKey;
11311
+ }
11292
11312
 
11293
11313
  const LETTER_BLOCK_SIZE$1 = 10;
11294
11314
  const calculateRowHeaderSize = (itemsLength, rowHeaderColumn, minWidth = 50) => {
@@ -13384,7 +13404,7 @@ class KeyboardService {
13384
13404
  return;
13385
13405
  }
13386
13406
  // pressed letter key
13387
- if (e.key.length === 1) {
13407
+ if (!isShortcutModifier(e) && e.key.length === 1) {
13388
13408
  this.sv.change(e.key);
13389
13409
  return;
13390
13410
  }
@@ -18160,11 +18180,11 @@ const HeaderCellRenderer = ({ data, props, additionalData }, children) => {
18160
18180
  * Plugin for column manual move
18161
18181
  */
18162
18182
  const COLUMN_CLICK = ON_COLUMN_CLICK;
18163
- const MOVE = 'columndragmousemove';
18164
- const DRAG_END = 'columndragend';
18165
- const BEFORE_DRAG_END = 'beforecolumndragend';
18183
+ const COLUMN_DRAG_MOVE_EVENT = 'columndragmousemove';
18184
+ const COLUMN_DRAG_END_EVENT = 'columndragend';
18185
+ const BEFORE_COLUMN_DRAG_END_EVENT = 'beforecolumndragend';
18166
18186
  // use this event subscription to drop D&D for particular columns
18167
- const DRAG_START = 'columndragstart';
18187
+ const COLUMN_DRAG_START_EVENT = 'columndragstart';
18168
18188
  class ColumnMovePlugin extends BasePlugin {
18169
18189
  constructor(revogrid, providers) {
18170
18190
  super(revogrid, providers);
@@ -18194,7 +18214,7 @@ class ColumnMovePlugin extends BasePlugin {
18194
18214
  if (event.defaultPrevented) {
18195
18215
  return;
18196
18216
  }
18197
- const { defaultPrevented } = dispatch(this.revogrid, DRAG_START, data);
18217
+ const { defaultPrevented } = dispatch(this.revogrid, COLUMN_DRAG_START_EVENT, data);
18198
18218
  // check if allowed to drag particulat column
18199
18219
  if (defaultPrevented) {
18200
18220
  return;
@@ -18225,7 +18245,7 @@ class ColumnMovePlugin extends BasePlugin {
18225
18245
  gridEl: this.revogrid,
18226
18246
  cols,
18227
18247
  };
18228
- this.dragData = this.getData(this.staticDragData);
18248
+ this.dragData = this.getData(this.staticDragData, []);
18229
18249
  mousemove.target.addEventListener('mousemove', mousemove.callback);
18230
18250
  this.orderUi.start(event, Object.assign(Object.assign({}, this.dragData), this.staticDragData));
18231
18251
  }
@@ -18233,7 +18253,7 @@ class ColumnMovePlugin extends BasePlugin {
18233
18253
  if (!this.staticDragData) {
18234
18254
  return;
18235
18255
  }
18236
- const dragData = (this.dragData = this.getData(this.staticDragData));
18256
+ const dragData = (this.dragData = this.getData(this.staticDragData, []));
18237
18257
  if (!dragData) {
18238
18258
  return;
18239
18259
  }
@@ -18250,7 +18270,7 @@ class ColumnMovePlugin extends BasePlugin {
18250
18270
  }
18251
18271
  }
18252
18272
  move(e) {
18253
- dispatch(this.revogrid, MOVE, e);
18273
+ dispatch(this.revogrid, COLUMN_DRAG_MOVE_EVENT, e);
18254
18274
  // then do move
18255
18275
  this.moveFunc(e);
18256
18276
  }
@@ -18266,9 +18286,10 @@ class ColumnMovePlugin extends BasePlugin {
18266
18286
  }
18267
18287
  const newPosition = getItemByPosition(this.staticDragData.cols, relativePos);
18268
18288
  const store = this.providers.column.stores[this.dragData.type].store;
18289
+ const source = store.get('source');
18269
18290
  const newItems = [...store.get('items')];
18270
18291
  // prevent position change if needed
18271
- const { defaultPrevented: stopDrag } = dispatch(this.revogrid, BEFORE_DRAG_END, Object.assign(Object.assign({}, this.staticDragData), { startPosition: this.staticDragData.startItem, newPosition, newItem: store.get('source')[newItems[this.staticDragData.startItem.itemIndex]] }));
18292
+ const { defaultPrevented: stopDrag } = dispatch(this.revogrid, BEFORE_COLUMN_DRAG_END_EVENT, Object.assign(Object.assign({}, this.staticDragData), { startPosition: this.staticDragData.startItem, newPosition, newItem: source[newItems[this.staticDragData.startItem.itemIndex]] }));
18272
18293
  if (!stopDrag) {
18273
18294
  const prevItems = [...newItems];
18274
18295
  // todo: if move item out of group remove item from group
@@ -18277,7 +18298,7 @@ class ColumnMovePlugin extends BasePlugin {
18277
18298
  store.set('items', newItems);
18278
18299
  this.providers.dimension.updateSizesPositionByNewDataIndexes(this.dragData.type, newItems, prevItems);
18279
18300
  }
18280
- dispatch(this.revogrid, DRAG_END, this.dragData);
18301
+ dispatch(this.revogrid, COLUMN_DRAG_END_EVENT, this.getData(this.staticDragData, newItems, source));
18281
18302
  }
18282
18303
  this.clearOrder();
18283
18304
  }
@@ -18297,13 +18318,15 @@ class ColumnMovePlugin extends BasePlugin {
18297
18318
  super.clearSubscriptions();
18298
18319
  this.clearLocalSubscriptions();
18299
18320
  }
18300
- getData({ gridEl, dataEl, pin, }) {
18321
+ getData({ gridEl, dataEl, pin }, order, source = []) {
18301
18322
  const gridRect = gridEl.getBoundingClientRect();
18302
18323
  const elRect = dataEl.getBoundingClientRect();
18303
18324
  const scrollOffset = elRect.left - gridRect.left;
18304
18325
  return {
18326
+ columns: order.map(index => source[index]).filter(Boolean),
18305
18327
  elRect,
18306
18328
  gridRect,
18329
+ order,
18307
18330
  type: pin || 'rgCol',
18308
18331
  scrollOffset,
18309
18332
  };
@@ -20392,126 +20415,8 @@ class RevogrFocus {
20392
20415
  }; }
20393
20416
  }
20394
20417
 
20395
- var defineProperty = (function() {
20396
- try {
20397
- var func = getNative(Object, 'defineProperty');
20398
- func({}, '', {});
20399
- return func;
20400
- } catch (e) {}
20401
- }());
20402
-
20403
- /**
20404
- * The base implementation of `assignValue` and `assignMergeValue` without
20405
- * value checks.
20406
- *
20407
- * @private
20408
- * @param {Object} object The object to modify.
20409
- * @param {string} key The key of the property to assign.
20410
- * @param {*} value The value to assign.
20411
- */
20412
- function baseAssignValue(object, key, value) {
20413
- if (key == '__proto__' && defineProperty) {
20414
- defineProperty(object, key, {
20415
- 'configurable': true,
20416
- 'enumerable': true,
20417
- 'value': value,
20418
- 'writable': true
20419
- });
20420
- } else {
20421
- object[key] = value;
20422
- }
20423
- }
20424
-
20425
- /**
20426
- * A specialized version of `baseAggregator` for arrays.
20427
- *
20428
- * @private
20429
- * @param {Array} [array] The array to iterate over.
20430
- * @param {Function} setter The function to set `accumulator` values.
20431
- * @param {Function} iteratee The iteratee to transform keys.
20432
- * @param {Object} accumulator The initial aggregated object.
20433
- * @returns {Function} Returns `accumulator`.
20434
- */
20435
- function arrayAggregator(array, setter, iteratee, accumulator) {
20436
- var index = -1,
20437
- length = array == null ? 0 : array.length;
20438
-
20439
- while (++index < length) {
20440
- var value = array[index];
20441
- setter(accumulator, value, iteratee(value), array);
20442
- }
20443
- return accumulator;
20444
- }
20445
-
20446
- /**
20447
- * Aggregates elements of `collection` on `accumulator` with keys transformed
20448
- * by `iteratee` and values set by `setter`.
20449
- *
20450
- * @private
20451
- * @param {Array|Object} collection The collection to iterate over.
20452
- * @param {Function} setter The function to set `accumulator` values.
20453
- * @param {Function} iteratee The iteratee to transform keys.
20454
- * @param {Object} accumulator The initial aggregated object.
20455
- * @returns {Function} Returns `accumulator`.
20456
- */
20457
- function baseAggregator(collection, setter, iteratee, accumulator) {
20458
- baseEach(collection, function(value, key, collection) {
20459
- setter(accumulator, value, iteratee(value), collection);
20460
- });
20461
- return accumulator;
20462
- }
20463
-
20464
- /**
20465
- * Creates a function like `_.groupBy`.
20466
- *
20467
- * @private
20468
- * @param {Function} setter The function to set accumulator values.
20469
- * @param {Function} [initializer] The accumulator object initializer.
20470
- * @returns {Function} Returns the new aggregator function.
20471
- */
20472
- function createAggregator(setter, initializer) {
20473
- return function(collection, iteratee) {
20474
- var func = isArray(collection) ? arrayAggregator : baseAggregator,
20475
- accumulator = {};
20476
-
20477
- return func(collection, setter, baseIteratee(iteratee), accumulator);
20478
- };
20479
- }
20480
-
20481
- /**
20482
- * Creates an object composed of keys generated from the results of running
20483
- * each element of `collection` thru `iteratee`. The corresponding value of
20484
- * each key is the last element responsible for generating the key. The
20485
- * iteratee is invoked with one argument: (value).
20486
- *
20487
- * @static
20488
- * @memberOf _
20489
- * @since 4.0.0
20490
- * @category Collection
20491
- * @param {Array|Object} collection The collection to iterate over.
20492
- * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
20493
- * @returns {Object} Returns the composed aggregate object.
20494
- * @example
20495
- *
20496
- * var array = [
20497
- * { 'dir': 'left', 'code': 97 },
20498
- * { 'dir': 'right', 'code': 100 }
20499
- * ];
20500
- *
20501
- * _.keyBy(array, function(o) {
20502
- * return String.fromCharCode(o.code);
20503
- * });
20504
- * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
20505
- *
20506
- * _.keyBy(array, 'dir');
20507
- * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
20508
- */
20509
- var keyBy = createAggregator(function(result, value, key) {
20510
- baseAssignValue(result, key, value);
20511
- });
20512
-
20513
20418
  const HeaderRenderer = (p) => {
20514
- var _a, _b, _c, _d, _e;
20419
+ var _a, _b, _c, _d, _e, _f, _g;
20515
20420
  const cellClass = {
20516
20421
  [HEADER_CLASS]: true,
20517
20422
  [HEADER_SORTABLE_CLASS]: !!((_a = p.data) === null || _a === void 0 ? void 0 : _a.sortable),
@@ -20520,10 +20425,11 @@ const HeaderRenderer = (p) => {
20520
20425
  cellClass[p.data.order] = true;
20521
20426
  }
20522
20427
  const dataProps = {
20428
+ key: String((_d = (_c = p.data) === null || _c === void 0 ? void 0 : _c.prop) !== null && _d !== void 0 ? _d : p.column.itemIndex),
20523
20429
  [DATA_COL]: p.column.itemIndex,
20524
20430
  canResize: p.canResize,
20525
- minWidth: ((_c = p.data) === null || _c === void 0 ? void 0 : _c.minSize) || MIN_COL_SIZE,
20526
- maxWidth: (_d = p.data) === null || _d === void 0 ? void 0 : _d.maxSize,
20431
+ minWidth: ((_e = p.data) === null || _e === void 0 ? void 0 : _e.minSize) || MIN_COL_SIZE,
20432
+ maxWidth: (_f = p.data) === null || _f === void 0 ? void 0 : _f.maxSize,
20527
20433
  active: p.active || ['r'],
20528
20434
  class: cellClass,
20529
20435
  style: {
@@ -20559,11 +20465,12 @@ const HeaderRenderer = (p) => {
20559
20465
  }
20560
20466
  }
20561
20467
  }
20562
- return (hAsync(HeaderCellRenderer, { data: p.data, props: dataProps, additionalData: p.additionalData }, hAsync(SortingSign, { column: p.data }), p.canFilter && ((_e = p.data) === null || _e === void 0 ? void 0 : _e.filter) !== false ? (hAsync(FilterButton, { column: p.data })) : ('')));
20468
+ return (hAsync(HeaderCellRenderer, { data: p.data, props: dataProps, additionalData: p.additionalData }, hAsync(SortingSign, { column: p.data }), p.canFilter && ((_g = p.data) === null || _g === void 0 ? void 0 : _g.filter) !== false ? (hAsync(FilterButton, { column: p.data })) : ('')));
20563
20469
  };
20564
20470
 
20565
20471
  const HeaderGroupRenderer = (p) => {
20566
20472
  const groupProps = {
20473
+ key: `${p.group.name}-${p.group.indexes.join('-')}`,
20567
20474
  canResize: p.canResize,
20568
20475
  minWidth: p.group.indexes.length * MIN_COL_SIZE,
20569
20476
  maxWidth: 0,
@@ -20613,13 +20520,10 @@ class RevogrHeaderComponent {
20613
20520
  }
20614
20521
  onResizeGroup(changedX, startIndex, endIndex) {
20615
20522
  const sizes = {};
20616
- const cols = keyBy(this.viewportCol.get('items'), 'itemIndex');
20617
20523
  const change = changedX / (endIndex - startIndex + 1);
20618
20524
  for (let i = startIndex; i <= endIndex; i++) {
20619
- const item = cols[i];
20620
- if (item) {
20621
- sizes[i] = item.size + change;
20622
- }
20525
+ const item = getItemByIndex(this.dimensionCol.state, i);
20526
+ sizes[i] = item.end - item.start + change;
20623
20527
  }
20624
20528
  this.headerresize.emit(sizes);
20625
20529
  }
@@ -20633,12 +20537,12 @@ class RevogrHeaderComponent {
20633
20537
  const { cells } = this.renderHeaderColumns(cols, range);
20634
20538
  const groupRow = this.renderGroupingColumns();
20635
20539
  return [
20636
- hAsync("div", { key: 'a8d57270f4758b454fb4900808453e0c4663c91c', class: "group-rgRow" }, groupRow),
20637
- hAsync("div", { key: '41a270ff6bde9943a81d9c46482f2a40312afb50', class: `${HEADER_ROW_CLASS} ${HEADER_ACTUAL_ROW_CLASS}` }, cells),
20540
+ hAsync("div", { key: '3cc466db6bc4df0cd61c47a22c3a0473318e5dd8', class: "group-rgRow" }, groupRow),
20541
+ hAsync("div", { key: '9742a3fa4d4b75073aef5544806f42386ebffdea', class: `${HEADER_ROW_CLASS} ${HEADER_ACTUAL_ROW_CLASS}` }, cells),
20638
20542
  ];
20639
20543
  }
20640
20544
  renderHeaderColumns(cols, range) {
20641
- const cells = [];
20545
+ const columnsToRender = [];
20642
20546
  for (let rgCol of cols) {
20643
20547
  const colData = this.colData[rgCol.itemIndex];
20644
20548
  const props = {
@@ -20655,45 +20559,105 @@ class RevogrHeaderComponent {
20655
20559
  };
20656
20560
  const event = this.beforeHeaderRender.emit(props);
20657
20561
  if (!event.defaultPrevented) {
20658
- cells.push(hAsync(HeaderRenderer, Object.assign({}, event.detail)));
20562
+ columnsToRender.push(event.detail);
20659
20563
  }
20660
20564
  }
20565
+ const duplicateProps = this.getDuplicateHeaderProps(columnsToRender);
20566
+ const cells = columnsToRender.map(detail => hAsync(HeaderRenderer, Object.assign({ key: this.getHeaderCellKey(detail.data, this.type, duplicateProps) }, detail)));
20661
20567
  return { cells };
20662
20568
  }
20663
20569
  renderGroupingColumns() {
20570
+ const visibleGroupRange = this.getVisibleGroupRange();
20571
+ return Array.from({ length: this.groupingDepth }, (_, level) => this.renderGroupRow(level, visibleGroupRange)).flat();
20572
+ }
20573
+ renderGroupRow(level, visibleGroupRange) {
20574
+ const groupCells = (this.groups[level] || [])
20575
+ .map(group => this.renderGroupColumn(group, level, visibleGroupRange))
20576
+ .filter((cell) => !!cell);
20577
+ return [
20578
+ ...groupCells,
20579
+ hAsync('div', {
20580
+ key: `group-row-${level}`,
20581
+ class: {
20582
+ [HEADER_ROW_CLASS]: true,
20583
+ group: true,
20584
+ },
20585
+ }),
20586
+ ];
20587
+ }
20588
+ renderGroupColumn(group, level, visibleGroupRange) {
20664
20589
  var _a;
20665
- const groupRow = [];
20666
- for (let i = 0; i < this.groupingDepth; i++) {
20667
- if (this.groups[i]) {
20668
- for (let group of this.groups[i]) {
20669
- const groupStartIndex = (_a = group.indexes[0]) !== null && _a !== void 0 ? _a : -1;
20670
- if (groupStartIndex > -1) {
20671
- const groupEndIndex = groupStartIndex + group.indexes.length - 1;
20672
- const groupStart = getItemByIndex(this.dimensionCol.state, groupStartIndex).start;
20673
- const groupEnd = getItemByIndex(this.dimensionCol.state, groupEndIndex).end;
20674
- const props = {
20675
- providers: this.providers,
20676
- start: groupStart,
20677
- end: groupEnd,
20678
- group,
20679
- active: this.resizeHandler,
20680
- canResize: this.canResize,
20681
- additionalData: this.additionalData,
20682
- onResize: e => {
20683
- var _a;
20684
- return this.onResizeGroup((_a = e.changedX) !== null && _a !== void 0 ? _a : 0, groupStartIndex, groupEndIndex);
20685
- },
20686
- };
20687
- const event = this.beforeGroupHeaderRender.emit(props);
20688
- if (!event.defaultPrevented) {
20689
- groupRow.push(hAsync(HeaderGroupRenderer, Object.assign({}, event.detail)));
20690
- }
20691
- }
20590
+ const groupStartIndex = (_a = group.indexes[0]) !== null && _a !== void 0 ? _a : -1;
20591
+ if (groupStartIndex < 0) {
20592
+ return;
20593
+ }
20594
+ const groupEndIndex = groupStartIndex + group.indexes.length - 1;
20595
+ if (!visibleGroupRange ||
20596
+ !isGroupInVisibleRange(groupStartIndex, groupEndIndex, visibleGroupRange)) {
20597
+ return;
20598
+ }
20599
+ const groupStart = getItemByIndex(this.dimensionCol.state, groupStartIndex).start;
20600
+ const groupEnd = getItemByIndex(this.dimensionCol.state, groupEndIndex).end;
20601
+ const props = {
20602
+ providers: this.providers,
20603
+ start: groupStart,
20604
+ end: groupEnd,
20605
+ group,
20606
+ active: this.resizeHandler,
20607
+ canResize: this.canResize,
20608
+ additionalData: this.additionalData,
20609
+ onResize: e => {
20610
+ var _a;
20611
+ return this.onResizeGroup((_a = e.changedX) !== null && _a !== void 0 ? _a : 0, groupStartIndex, groupEndIndex);
20612
+ },
20613
+ };
20614
+ const event = this.beforeGroupHeaderRender.emit(props);
20615
+ if (event.defaultPrevented) {
20616
+ return;
20617
+ }
20618
+ return hAsync(HeaderGroupRenderer, Object.assign({ key: this.getGroupHeaderCellKey(event.detail.group, level) }, event.detail));
20619
+ }
20620
+ getVisibleGroupRange() {
20621
+ const visibleColumns = this.viewportCol.get('items');
20622
+ if (!visibleColumns.length) {
20623
+ return;
20624
+ }
20625
+ return visibleColumns.reduce((range, column) => ({
20626
+ start: Math.min(range.start, column.itemIndex),
20627
+ end: Math.max(range.end, column.itemIndex),
20628
+ }), {
20629
+ start: visibleColumns[0].itemIndex,
20630
+ end: visibleColumns[0].itemIndex,
20631
+ });
20632
+ }
20633
+ getHeaderCellKey(column, type, duplicateProps) {
20634
+ if ((column === null || column === void 0 ? void 0 : column.prop) === undefined) {
20635
+ return `${type}-${String(column === null || column === void 0 ? void 0 : column.index)}`;
20636
+ }
20637
+ const propKey = String(column.prop);
20638
+ if (duplicateProps.has(propKey)) {
20639
+ return `${type}-${propKey}-${String(column.index)}`;
20640
+ }
20641
+ return `${type}-${propKey}`;
20642
+ }
20643
+ getDuplicateHeaderProps(columns) {
20644
+ const seenProps = new Set();
20645
+ const duplicateProps = new Set();
20646
+ columns.forEach(({ data }) => {
20647
+ if ((data === null || data === void 0 ? void 0 : data.prop) !== undefined) {
20648
+ const propKey = String(data.prop);
20649
+ if (seenProps.has(propKey)) {
20650
+ duplicateProps.add(propKey);
20651
+ }
20652
+ else {
20653
+ seenProps.add(propKey);
20692
20654
  }
20693
20655
  }
20694
- groupRow.push(hAsync("div", { class: `${HEADER_ROW_CLASS} group` }));
20695
- }
20696
- return groupRow;
20656
+ });
20657
+ return duplicateProps;
20658
+ }
20659
+ getGroupHeaderCellKey(group, level) {
20660
+ return `group-${level}-${group.name}-${group.indexes.join('-')}`;
20697
20661
  }
20698
20662
  get providers() {
20699
20663
  return {
@@ -20729,6 +20693,10 @@ class RevogrHeaderComponent {
20729
20693
  "$attrsToReflect$": []
20730
20694
  }; }
20731
20695
  }
20696
+ function isGroupInVisibleRange(groupStartIndex, groupEndIndex, visibleRange) {
20697
+ return (groupStartIndex <= visibleRange.end &&
20698
+ groupEndIndex >= visibleRange.start);
20699
+ }
20732
20700
 
20733
20701
  const RowHeaderRender = s => (__, { rowIndex: i }) => s + i;
20734
20702