@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.mjs CHANGED
@@ -6798,8 +6798,8 @@ class Clipboard {
6798
6798
  return;
6799
6799
  }
6800
6800
  const data = this.getData(beforeCopy.detail.event);
6801
- this.copyRegion.emit(data || undefined);
6802
6801
  e.preventDefault();
6802
+ this.copyRegion.emit(data || undefined);
6803
6803
  }
6804
6804
  /**
6805
6805
  * Listen to copy event and emit copy region event
@@ -11287,6 +11287,26 @@ function isAll(event) {
11287
11287
  return ((event.ctrlKey && event.code === 'KeyA') || // Ctrl + A on Windows
11288
11288
  (event.metaKey && event.code === 'KeyA')); // Cmd + A on Mac
11289
11289
  }
11290
+ /**
11291
+ * Returns true when a keyboard event represents a shortcut modifier that
11292
+ * should not start cell editing from printable `event.key` input.
11293
+ *
11294
+ * AltGr is intentionally excluded because many Windows/Linux layouts expose
11295
+ * printable AltGr characters as Ctrl+Alt key events.
11296
+ */
11297
+ function isShortcutModifier(event) {
11298
+ var _a;
11299
+ if ((_a = event.getModifierState) === null || _a === void 0 ? void 0 : _a.call(event, 'AltGraph')) {
11300
+ return false;
11301
+ }
11302
+ if (event.ctrlKey &&
11303
+ event.altKey &&
11304
+ !event.metaKey &&
11305
+ event.key.length === 1) {
11306
+ return false;
11307
+ }
11308
+ return event.ctrlKey || event.metaKey;
11309
+ }
11290
11310
 
11291
11311
  const LETTER_BLOCK_SIZE$1 = 10;
11292
11312
  const calculateRowHeaderSize = (itemsLength, rowHeaderColumn, minWidth = 50) => {
@@ -13382,7 +13402,7 @@ class KeyboardService {
13382
13402
  return;
13383
13403
  }
13384
13404
  // pressed letter key
13385
- if (e.key.length === 1) {
13405
+ if (!isShortcutModifier(e) && e.key.length === 1) {
13386
13406
  this.sv.change(e.key);
13387
13407
  return;
13388
13408
  }
@@ -18158,11 +18178,11 @@ const HeaderCellRenderer = ({ data, props, additionalData }, children) => {
18158
18178
  * Plugin for column manual move
18159
18179
  */
18160
18180
  const COLUMN_CLICK = ON_COLUMN_CLICK;
18161
- const MOVE = 'columndragmousemove';
18162
- const DRAG_END = 'columndragend';
18163
- const BEFORE_DRAG_END = 'beforecolumndragend';
18181
+ const COLUMN_DRAG_MOVE_EVENT = 'columndragmousemove';
18182
+ const COLUMN_DRAG_END_EVENT = 'columndragend';
18183
+ const BEFORE_COLUMN_DRAG_END_EVENT = 'beforecolumndragend';
18164
18184
  // use this event subscription to drop D&D for particular columns
18165
- const DRAG_START = 'columndragstart';
18185
+ const COLUMN_DRAG_START_EVENT = 'columndragstart';
18166
18186
  class ColumnMovePlugin extends BasePlugin {
18167
18187
  constructor(revogrid, providers) {
18168
18188
  super(revogrid, providers);
@@ -18192,7 +18212,7 @@ class ColumnMovePlugin extends BasePlugin {
18192
18212
  if (event.defaultPrevented) {
18193
18213
  return;
18194
18214
  }
18195
- const { defaultPrevented } = dispatch(this.revogrid, DRAG_START, data);
18215
+ const { defaultPrevented } = dispatch(this.revogrid, COLUMN_DRAG_START_EVENT, data);
18196
18216
  // check if allowed to drag particulat column
18197
18217
  if (defaultPrevented) {
18198
18218
  return;
@@ -18223,7 +18243,7 @@ class ColumnMovePlugin extends BasePlugin {
18223
18243
  gridEl: this.revogrid,
18224
18244
  cols,
18225
18245
  };
18226
- this.dragData = this.getData(this.staticDragData);
18246
+ this.dragData = this.getData(this.staticDragData, []);
18227
18247
  mousemove.target.addEventListener('mousemove', mousemove.callback);
18228
18248
  this.orderUi.start(event, Object.assign(Object.assign({}, this.dragData), this.staticDragData));
18229
18249
  }
@@ -18231,7 +18251,7 @@ class ColumnMovePlugin extends BasePlugin {
18231
18251
  if (!this.staticDragData) {
18232
18252
  return;
18233
18253
  }
18234
- const dragData = (this.dragData = this.getData(this.staticDragData));
18254
+ const dragData = (this.dragData = this.getData(this.staticDragData, []));
18235
18255
  if (!dragData) {
18236
18256
  return;
18237
18257
  }
@@ -18248,7 +18268,7 @@ class ColumnMovePlugin extends BasePlugin {
18248
18268
  }
18249
18269
  }
18250
18270
  move(e) {
18251
- dispatch(this.revogrid, MOVE, e);
18271
+ dispatch(this.revogrid, COLUMN_DRAG_MOVE_EVENT, e);
18252
18272
  // then do move
18253
18273
  this.moveFunc(e);
18254
18274
  }
@@ -18264,9 +18284,10 @@ class ColumnMovePlugin extends BasePlugin {
18264
18284
  }
18265
18285
  const newPosition = getItemByPosition(this.staticDragData.cols, relativePos);
18266
18286
  const store = this.providers.column.stores[this.dragData.type].store;
18287
+ const source = store.get('source');
18267
18288
  const newItems = [...store.get('items')];
18268
18289
  // prevent position change if needed
18269
- 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]] }));
18290
+ 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]] }));
18270
18291
  if (!stopDrag) {
18271
18292
  const prevItems = [...newItems];
18272
18293
  // todo: if move item out of group remove item from group
@@ -18275,7 +18296,7 @@ class ColumnMovePlugin extends BasePlugin {
18275
18296
  store.set('items', newItems);
18276
18297
  this.providers.dimension.updateSizesPositionByNewDataIndexes(this.dragData.type, newItems, prevItems);
18277
18298
  }
18278
- dispatch(this.revogrid, DRAG_END, this.dragData);
18299
+ dispatch(this.revogrid, COLUMN_DRAG_END_EVENT, this.getData(this.staticDragData, newItems, source));
18279
18300
  }
18280
18301
  this.clearOrder();
18281
18302
  }
@@ -18295,13 +18316,15 @@ class ColumnMovePlugin extends BasePlugin {
18295
18316
  super.clearSubscriptions();
18296
18317
  this.clearLocalSubscriptions();
18297
18318
  }
18298
- getData({ gridEl, dataEl, pin, }) {
18319
+ getData({ gridEl, dataEl, pin }, order, source = []) {
18299
18320
  const gridRect = gridEl.getBoundingClientRect();
18300
18321
  const elRect = dataEl.getBoundingClientRect();
18301
18322
  const scrollOffset = elRect.left - gridRect.left;
18302
18323
  return {
18324
+ columns: order.map(index => source[index]).filter(Boolean),
18303
18325
  elRect,
18304
18326
  gridRect,
18327
+ order,
18305
18328
  type: pin || 'rgCol',
18306
18329
  scrollOffset,
18307
18330
  };
@@ -20390,126 +20413,8 @@ class RevogrFocus {
20390
20413
  }; }
20391
20414
  }
20392
20415
 
20393
- var defineProperty = (function() {
20394
- try {
20395
- var func = getNative(Object, 'defineProperty');
20396
- func({}, '', {});
20397
- return func;
20398
- } catch (e) {}
20399
- }());
20400
-
20401
- /**
20402
- * The base implementation of `assignValue` and `assignMergeValue` without
20403
- * value checks.
20404
- *
20405
- * @private
20406
- * @param {Object} object The object to modify.
20407
- * @param {string} key The key of the property to assign.
20408
- * @param {*} value The value to assign.
20409
- */
20410
- function baseAssignValue(object, key, value) {
20411
- if (key == '__proto__' && defineProperty) {
20412
- defineProperty(object, key, {
20413
- 'configurable': true,
20414
- 'enumerable': true,
20415
- 'value': value,
20416
- 'writable': true
20417
- });
20418
- } else {
20419
- object[key] = value;
20420
- }
20421
- }
20422
-
20423
- /**
20424
- * A specialized version of `baseAggregator` for arrays.
20425
- *
20426
- * @private
20427
- * @param {Array} [array] The array to iterate over.
20428
- * @param {Function} setter The function to set `accumulator` values.
20429
- * @param {Function} iteratee The iteratee to transform keys.
20430
- * @param {Object} accumulator The initial aggregated object.
20431
- * @returns {Function} Returns `accumulator`.
20432
- */
20433
- function arrayAggregator(array, setter, iteratee, accumulator) {
20434
- var index = -1,
20435
- length = array == null ? 0 : array.length;
20436
-
20437
- while (++index < length) {
20438
- var value = array[index];
20439
- setter(accumulator, value, iteratee(value), array);
20440
- }
20441
- return accumulator;
20442
- }
20443
-
20444
- /**
20445
- * Aggregates elements of `collection` on `accumulator` with keys transformed
20446
- * by `iteratee` and values set by `setter`.
20447
- *
20448
- * @private
20449
- * @param {Array|Object} collection The collection to iterate over.
20450
- * @param {Function} setter The function to set `accumulator` values.
20451
- * @param {Function} iteratee The iteratee to transform keys.
20452
- * @param {Object} accumulator The initial aggregated object.
20453
- * @returns {Function} Returns `accumulator`.
20454
- */
20455
- function baseAggregator(collection, setter, iteratee, accumulator) {
20456
- baseEach(collection, function(value, key, collection) {
20457
- setter(accumulator, value, iteratee(value), collection);
20458
- });
20459
- return accumulator;
20460
- }
20461
-
20462
- /**
20463
- * Creates a function like `_.groupBy`.
20464
- *
20465
- * @private
20466
- * @param {Function} setter The function to set accumulator values.
20467
- * @param {Function} [initializer] The accumulator object initializer.
20468
- * @returns {Function} Returns the new aggregator function.
20469
- */
20470
- function createAggregator(setter, initializer) {
20471
- return function(collection, iteratee) {
20472
- var func = isArray(collection) ? arrayAggregator : baseAggregator,
20473
- accumulator = {};
20474
-
20475
- return func(collection, setter, baseIteratee(iteratee), accumulator);
20476
- };
20477
- }
20478
-
20479
- /**
20480
- * Creates an object composed of keys generated from the results of running
20481
- * each element of `collection` thru `iteratee`. The corresponding value of
20482
- * each key is the last element responsible for generating the key. The
20483
- * iteratee is invoked with one argument: (value).
20484
- *
20485
- * @static
20486
- * @memberOf _
20487
- * @since 4.0.0
20488
- * @category Collection
20489
- * @param {Array|Object} collection The collection to iterate over.
20490
- * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
20491
- * @returns {Object} Returns the composed aggregate object.
20492
- * @example
20493
- *
20494
- * var array = [
20495
- * { 'dir': 'left', 'code': 97 },
20496
- * { 'dir': 'right', 'code': 100 }
20497
- * ];
20498
- *
20499
- * _.keyBy(array, function(o) {
20500
- * return String.fromCharCode(o.code);
20501
- * });
20502
- * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
20503
- *
20504
- * _.keyBy(array, 'dir');
20505
- * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
20506
- */
20507
- var keyBy = createAggregator(function(result, value, key) {
20508
- baseAssignValue(result, key, value);
20509
- });
20510
-
20511
20416
  const HeaderRenderer = (p) => {
20512
- var _a, _b, _c, _d, _e;
20417
+ var _a, _b, _c, _d, _e, _f, _g;
20513
20418
  const cellClass = {
20514
20419
  [HEADER_CLASS]: true,
20515
20420
  [HEADER_SORTABLE_CLASS]: !!((_a = p.data) === null || _a === void 0 ? void 0 : _a.sortable),
@@ -20518,10 +20423,11 @@ const HeaderRenderer = (p) => {
20518
20423
  cellClass[p.data.order] = true;
20519
20424
  }
20520
20425
  const dataProps = {
20426
+ key: String((_d = (_c = p.data) === null || _c === void 0 ? void 0 : _c.prop) !== null && _d !== void 0 ? _d : p.column.itemIndex),
20521
20427
  [DATA_COL]: p.column.itemIndex,
20522
20428
  canResize: p.canResize,
20523
- minWidth: ((_c = p.data) === null || _c === void 0 ? void 0 : _c.minSize) || MIN_COL_SIZE,
20524
- maxWidth: (_d = p.data) === null || _d === void 0 ? void 0 : _d.maxSize,
20429
+ minWidth: ((_e = p.data) === null || _e === void 0 ? void 0 : _e.minSize) || MIN_COL_SIZE,
20430
+ maxWidth: (_f = p.data) === null || _f === void 0 ? void 0 : _f.maxSize,
20525
20431
  active: p.active || ['r'],
20526
20432
  class: cellClass,
20527
20433
  style: {
@@ -20557,11 +20463,12 @@ const HeaderRenderer = (p) => {
20557
20463
  }
20558
20464
  }
20559
20465
  }
20560
- 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 })) : ('')));
20466
+ 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 })) : ('')));
20561
20467
  };
20562
20468
 
20563
20469
  const HeaderGroupRenderer = (p) => {
20564
20470
  const groupProps = {
20471
+ key: `${p.group.name}-${p.group.indexes.join('-')}`,
20565
20472
  canResize: p.canResize,
20566
20473
  minWidth: p.group.indexes.length * MIN_COL_SIZE,
20567
20474
  maxWidth: 0,
@@ -20611,13 +20518,10 @@ class RevogrHeaderComponent {
20611
20518
  }
20612
20519
  onResizeGroup(changedX, startIndex, endIndex) {
20613
20520
  const sizes = {};
20614
- const cols = keyBy(this.viewportCol.get('items'), 'itemIndex');
20615
20521
  const change = changedX / (endIndex - startIndex + 1);
20616
20522
  for (let i = startIndex; i <= endIndex; i++) {
20617
- const item = cols[i];
20618
- if (item) {
20619
- sizes[i] = item.size + change;
20620
- }
20523
+ const item = getItemByIndex(this.dimensionCol.state, i);
20524
+ sizes[i] = item.end - item.start + change;
20621
20525
  }
20622
20526
  this.headerresize.emit(sizes);
20623
20527
  }
@@ -20631,12 +20535,12 @@ class RevogrHeaderComponent {
20631
20535
  const { cells } = this.renderHeaderColumns(cols, range);
20632
20536
  const groupRow = this.renderGroupingColumns();
20633
20537
  return [
20634
- hAsync("div", { key: 'a8d57270f4758b454fb4900808453e0c4663c91c', class: "group-rgRow" }, groupRow),
20635
- hAsync("div", { key: '41a270ff6bde9943a81d9c46482f2a40312afb50', class: `${HEADER_ROW_CLASS} ${HEADER_ACTUAL_ROW_CLASS}` }, cells),
20538
+ hAsync("div", { key: '3cc466db6bc4df0cd61c47a22c3a0473318e5dd8', class: "group-rgRow" }, groupRow),
20539
+ hAsync("div", { key: '9742a3fa4d4b75073aef5544806f42386ebffdea', class: `${HEADER_ROW_CLASS} ${HEADER_ACTUAL_ROW_CLASS}` }, cells),
20636
20540
  ];
20637
20541
  }
20638
20542
  renderHeaderColumns(cols, range) {
20639
- const cells = [];
20543
+ const columnsToRender = [];
20640
20544
  for (let rgCol of cols) {
20641
20545
  const colData = this.colData[rgCol.itemIndex];
20642
20546
  const props = {
@@ -20653,45 +20557,105 @@ class RevogrHeaderComponent {
20653
20557
  };
20654
20558
  const event = this.beforeHeaderRender.emit(props);
20655
20559
  if (!event.defaultPrevented) {
20656
- cells.push(hAsync(HeaderRenderer, Object.assign({}, event.detail)));
20560
+ columnsToRender.push(event.detail);
20657
20561
  }
20658
20562
  }
20563
+ const duplicateProps = this.getDuplicateHeaderProps(columnsToRender);
20564
+ const cells = columnsToRender.map(detail => hAsync(HeaderRenderer, Object.assign({ key: this.getHeaderCellKey(detail.data, this.type, duplicateProps) }, detail)));
20659
20565
  return { cells };
20660
20566
  }
20661
20567
  renderGroupingColumns() {
20568
+ const visibleGroupRange = this.getVisibleGroupRange();
20569
+ return Array.from({ length: this.groupingDepth }, (_, level) => this.renderGroupRow(level, visibleGroupRange)).flat();
20570
+ }
20571
+ renderGroupRow(level, visibleGroupRange) {
20572
+ const groupCells = (this.groups[level] || [])
20573
+ .map(group => this.renderGroupColumn(group, level, visibleGroupRange))
20574
+ .filter((cell) => !!cell);
20575
+ return [
20576
+ ...groupCells,
20577
+ hAsync('div', {
20578
+ key: `group-row-${level}`,
20579
+ class: {
20580
+ [HEADER_ROW_CLASS]: true,
20581
+ group: true,
20582
+ },
20583
+ }),
20584
+ ];
20585
+ }
20586
+ renderGroupColumn(group, level, visibleGroupRange) {
20662
20587
  var _a;
20663
- const groupRow = [];
20664
- for (let i = 0; i < this.groupingDepth; i++) {
20665
- if (this.groups[i]) {
20666
- for (let group of this.groups[i]) {
20667
- const groupStartIndex = (_a = group.indexes[0]) !== null && _a !== void 0 ? _a : -1;
20668
- if (groupStartIndex > -1) {
20669
- const groupEndIndex = groupStartIndex + group.indexes.length - 1;
20670
- const groupStart = getItemByIndex(this.dimensionCol.state, groupStartIndex).start;
20671
- const groupEnd = getItemByIndex(this.dimensionCol.state, groupEndIndex).end;
20672
- const props = {
20673
- providers: this.providers,
20674
- start: groupStart,
20675
- end: groupEnd,
20676
- group,
20677
- active: this.resizeHandler,
20678
- canResize: this.canResize,
20679
- additionalData: this.additionalData,
20680
- onResize: e => {
20681
- var _a;
20682
- return this.onResizeGroup((_a = e.changedX) !== null && _a !== void 0 ? _a : 0, groupStartIndex, groupEndIndex);
20683
- },
20684
- };
20685
- const event = this.beforeGroupHeaderRender.emit(props);
20686
- if (!event.defaultPrevented) {
20687
- groupRow.push(hAsync(HeaderGroupRenderer, Object.assign({}, event.detail)));
20688
- }
20689
- }
20588
+ const groupStartIndex = (_a = group.indexes[0]) !== null && _a !== void 0 ? _a : -1;
20589
+ if (groupStartIndex < 0) {
20590
+ return;
20591
+ }
20592
+ const groupEndIndex = groupStartIndex + group.indexes.length - 1;
20593
+ if (!visibleGroupRange ||
20594
+ !isGroupInVisibleRange(groupStartIndex, groupEndIndex, visibleGroupRange)) {
20595
+ return;
20596
+ }
20597
+ const groupStart = getItemByIndex(this.dimensionCol.state, groupStartIndex).start;
20598
+ const groupEnd = getItemByIndex(this.dimensionCol.state, groupEndIndex).end;
20599
+ const props = {
20600
+ providers: this.providers,
20601
+ start: groupStart,
20602
+ end: groupEnd,
20603
+ group,
20604
+ active: this.resizeHandler,
20605
+ canResize: this.canResize,
20606
+ additionalData: this.additionalData,
20607
+ onResize: e => {
20608
+ var _a;
20609
+ return this.onResizeGroup((_a = e.changedX) !== null && _a !== void 0 ? _a : 0, groupStartIndex, groupEndIndex);
20610
+ },
20611
+ };
20612
+ const event = this.beforeGroupHeaderRender.emit(props);
20613
+ if (event.defaultPrevented) {
20614
+ return;
20615
+ }
20616
+ return hAsync(HeaderGroupRenderer, Object.assign({ key: this.getGroupHeaderCellKey(event.detail.group, level) }, event.detail));
20617
+ }
20618
+ getVisibleGroupRange() {
20619
+ const visibleColumns = this.viewportCol.get('items');
20620
+ if (!visibleColumns.length) {
20621
+ return;
20622
+ }
20623
+ return visibleColumns.reduce((range, column) => ({
20624
+ start: Math.min(range.start, column.itemIndex),
20625
+ end: Math.max(range.end, column.itemIndex),
20626
+ }), {
20627
+ start: visibleColumns[0].itemIndex,
20628
+ end: visibleColumns[0].itemIndex,
20629
+ });
20630
+ }
20631
+ getHeaderCellKey(column, type, duplicateProps) {
20632
+ if ((column === null || column === void 0 ? void 0 : column.prop) === undefined) {
20633
+ return `${type}-${String(column === null || column === void 0 ? void 0 : column.index)}`;
20634
+ }
20635
+ const propKey = String(column.prop);
20636
+ if (duplicateProps.has(propKey)) {
20637
+ return `${type}-${propKey}-${String(column.index)}`;
20638
+ }
20639
+ return `${type}-${propKey}`;
20640
+ }
20641
+ getDuplicateHeaderProps(columns) {
20642
+ const seenProps = new Set();
20643
+ const duplicateProps = new Set();
20644
+ columns.forEach(({ data }) => {
20645
+ if ((data === null || data === void 0 ? void 0 : data.prop) !== undefined) {
20646
+ const propKey = String(data.prop);
20647
+ if (seenProps.has(propKey)) {
20648
+ duplicateProps.add(propKey);
20649
+ }
20650
+ else {
20651
+ seenProps.add(propKey);
20690
20652
  }
20691
20653
  }
20692
- groupRow.push(hAsync("div", { class: `${HEADER_ROW_CLASS} group` }));
20693
- }
20694
- return groupRow;
20654
+ });
20655
+ return duplicateProps;
20656
+ }
20657
+ getGroupHeaderCellKey(group, level) {
20658
+ return `group-${level}-${group.name}-${group.indexes.join('-')}`;
20695
20659
  }
20696
20660
  get providers() {
20697
20661
  return {
@@ -20727,6 +20691,10 @@ class RevogrHeaderComponent {
20727
20691
  "$attrsToReflect$": []
20728
20692
  }; }
20729
20693
  }
20694
+ function isGroupInVisibleRange(groupStartIndex, groupEndIndex, visibleRange) {
20695
+ return (groupStartIndex <= visibleRange.end &&
20696
+ groupEndIndex >= visibleRange.start);
20697
+ }
20730
20698
 
20731
20699
  const RowHeaderRender = s => (__, { rowIndex: i }) => s + i;
20732
20700
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revolist/revogrid",
3
- "version": "4.22.0",
3
+ "version": "4.22.1",
4
4
  "type": "module",
5
5
  "description": "Virtual reactive data grid spreadsheet component - RevoGrid.",
6
6
  "license": "MIT",
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
- import{v as t,w as n,n as e,u as r,l as o,x as s,a as i,b as c}from"./data.store.js";import"@stencil/core/internal/client";import"./platform.js";import{G as u,b as a,C as l}from"./consts.js";function d(n){var e=t(n),r=e%1;return e==e?r?e-r:e:0}function f(t,n,e,r){var o=-1,s=null==t?0:t.length;for(r&&s&&(e=t[++o]);++o<s;)e=n(e,t[o],o,t);return e}var p,v=(p=function(t,e){return t&&function(t,n,e){for(var r=-1,o=Object(t),s=e(t),i=s.length;i--;){var c=s[++r];if(!1===n(o[c],c,o))break}return t}(t,e,n)},function(t,n){if(null==t)return t;if(!e(t))return p(t,n);for(var r=t.length,o=-1,s=Object(t);++o<r&&!1!==n(s[o],o,s););return t});function h(t,n,e,r,o){return o(t,(function(t,o,s){e=r?(r=!1,t):n(e,t,o,s)})),e}function x(t,n,e){var s=o(t)?f:h,i=arguments.length<3;return s(t,r(n),e,i,v)}function m(t){return null==t?"":t}function b(t={},n){if(n)return n.cellParser?n.cellParser(t,n):t[n.prop]}function g(t,n){return m(b(t,n))}function j(t){return t.pin?t.pin:"rgCol"}function O(t){const n={};for(const[e,r]of t.entries())r.size&&(n[e]=r.size);return n}function y(t){return!!t.children}function I(t,n=0,e,r){return x(t,((t,o)=>{var s;if(y(o))return w(t,o,I(o.children,n+1,e,t),null==r?void 0:r.columns,n);const i=Object.assign(Object.assign({},o.columnType&&(null==e?void 0:e[o.columnType])),o);return i.pin?t.columns[i.pin].push(i):t.columns.rgCol.push(i),i.order&&(t.sort[i.prop]=i),t.columnByProp[i.prop]||(t.columnByProp[i.prop]=[]),t.columnByProp[i.prop].push(i),null===(s=i.beforeSetup)||void 0===s||s.call(i,i),t}),{columns:{rgCol:[],colPinStart:[],colPinEnd:[]},columnByProp:{},columnGrouping:{rgCol:[],colPinStart:[],colPinEnd:[]},sort:{},maxLevel:n})}function w(t,n,e,r,s=0){const i=Object.assign(Object.assign({},n),{level:s,indexes:[]});C.forEach((n=>{const s=t.columns[n],c=e.columns[n];if(o(s)&&o(c)){const e=c.length;if(e){const o=[...(null==r?void 0:r[n])||[],...s].length;s.push(...c),t.columnGrouping[n].push(Object.assign(Object.assign({},i),{indexes:Array(e).fill(o).map(((t,n)=>t+n))}))}}}));for(let n in e.columnGrouping){const o=n,s=e.columnGrouping[o],i=((null==r?void 0:r[o])||[]).length,c=i>0?s.map((t=>Object.assign(Object.assign({},t),{indexes:t.indexes.map((t=>t+i))}))):s;t.columnGrouping[o].push(...c)}return t.maxLevel=Math.max(t.maxLevel,e.maxLevel),t.sort=Object.assign(Object.assign({},t.sort),e.sort),t.columnByProp=Object.assign(Object.assign({},t.columnByProp),e.columnByProp),t}function P(t,n){for(const e of t)if(y(e)){const t=P(e.children,n);if(t)return t}else if(e.prop===n)return e}function E(t,n){return P(t,n)}function M(t,n){const e={};let r=["x","y"];for(let n of r)if(t[n]<0)return e[n]=t[n],e;for(let o of r)if(t[o]>=n[o])return e[o]=t[o]-n[o],e;return null}function A(t,n){const e=Object.assign({},t),r=["x","y"];for(const o of r)t[o]<0?e[o]=0:t[o]>=n[o]&&(e[o]=n[o]-1);return e}function R(t,n){return t&&n?{x:Math.min(t.x,n.x),y:Math.min(t.y,n.y),x1:Math.max(t.x,n.x),y1:Math.max(t.y,n.y)}:null}function S(t){return t.x===t.x1&&t.y===t.y1}const $=["rowPinStart","rgRow","rowPinEnd"],C=["colPinStart","rgCol","colPinEnd"];function N(t){return $.indexOf(t)>-1}const D=`${u}-depth`,G=`${u}-name`,T=`${u}-id`,k=`${u}-value`,V=`${u}-column`,J=`${u}-expanded`,B=`${u}-prop`,L=`${u}-original-index`,q="group-expand",z="groupexpandclick",F="rgRow";function H(t,n){return t[n]||null}function K(t,n,e=!1){let r=0;const o={source:[],prevExpanded:{},oldNewIndexes:{}};return n.forEach((n=>{const s=t[n];e?Y(s)?Q(s)&&(o.prevExpanded[s[k]]=!0):(o.source.push(s),o.oldNewIndexes[n]=r,r++):o.source.push(s)})),o}function Q(t={}){return t[J]}function W({groupedValues:t,parentIds:n,isExpanded:e,itemIndex:r,expandedAll:o,prevExpanded:s,columnProps:i}){const c=n.length,u=[];let a={},l={};return t.forEach(((t,d)=>{const f=[...n,d],p=f.join(","),v=e&&(!!o||!!s[p]);if(u.push({[G]:d,[D]:c,[T]:JSON.stringify(f),[k]:p,[J]:v,[B]:i[c],[i[c]]:d}),r+=1,!e&&c&&(a[r]=!0),Array.isArray(t))t.forEach((t=>{r+=1,v||(a[r]=!0),l[t[L]]=r})),u.push(...t);else{const n=W({groupedValues:t,parentIds:f,isExpanded:v,itemIndex:r,expandedAll:o,prevExpanded:s,columnProps:i});u.push(...n.source),a=Object.assign(Object.assign({},n.trimmed),a),l=Object.assign(Object.assign({},n.oldNewIndexMap),l),r=n.itemIndex}})),{source:u,oldNewIndexMap:l,trimmed:a,itemIndex:r}}function U(t,n,{prevExpanded:e={},expandedAll:r=!1,getGroupValue:o=H}){const s=new Map;t.forEach(((t,e)=>{const r=n.map((n=>o(t,n))),i=r.pop();let c=s;r.forEach((t=>{c.has(t)||c.set(t,new Map),c=c.get(t)})),c.has(i)||c.set(i,[]),c.get(i).push(Object.assign(Object.assign({},t),{[L]:e}))}));const i=n.length,{source:c,trimmed:u,oldNewIndexMap:a}=W({groupedValues:s,parentIds:[],isExpanded:!0,itemIndex:-1,expandedAll:r,prevExpanded:e,columnProps:n});return{sourceWithGroups:c,depth:i,trimmed:u,oldNewIndexMap:a}}function X(t){return null==t?void 0:t[G]}function Y(t){return void 0!==(null==t?void 0:t[G])}function Z(t){return void 0!==(null==t?void 0:t[V])}function _(t,n){const e=t.length;let r=0;for(;r<e;r++)if(t[r]!==n[r])return r;return r}function tt(t){const n=JSON.parse(t);return Array.isArray(n)?n:null}function nt(t,n,e){const r=tt(e[T]);if(!r)return!1;const o=_(t,r);return n[D]<o}function et(t,n={}){const e=null==t?void 0:t.editor;if(e)return"string"==typeof e?n[e]:e}class rt{get columns(){return i(this.source)}constructor(t,n){this.dataStore=t,this.source=n,this.unsubscribe=[],this.hasGrouping=!1,this.unsubscribe.push(n.onChange("source",(t=>this.checkGrouping(t)))),this.checkGrouping(n.get("source")),this.type=n.get("type")}checkGrouping(t){for(let n of t){if(Z(n))return void(this.hasGrouping=!0);this.hasGrouping=!1}}isReadOnly(t,n){var e;const r=null===(e=this.columns[n])||void 0===e?void 0:e.readonly;return"function"==typeof r?r(this.rowDataModel(t,n)):!!r}mergeProperties(t,n,e,r){var o,s;const i=Object.assign({},e);i.class=Object.assign(Object.assign({},"string"==typeof i.class?{[i.class]:!0}:i.class),{[l]:!0,[a]:this.isReadOnly(t,n)});const c=null===(s=null===(o=r.column)||void 0===o?void 0:o.cellProperties)||void 0===s?void 0:s.call(o,r);return c?it(i,c):i}getRowClass(t,n){return(c(this.dataStore,t)||{})[n]||""}getSaveData(t,n,e){const r=this.rowDataModel(t,n);return void 0===e&&(e=m(r.value)),Object.assign(Object.assign({},r),{val:e})}rowDataModel(t,n){const e=this.columns[n],r=null==e?void 0:e.prop,o=c(this.dataStore,t)||{},s=this.dataStore.get("type");return{prop:r,model:o,data:this.dataStore.get("source"),column:e,rowIndex:t,colIndex:n,colType:this.type,type:s,value:b(o,e)}}getRangeData(t,n){var e;const r={},o=t.oldRange.x1-t.oldRange.x+1,s=t.oldRange.y1-t.oldRange.y+1,i={};for(let u=t.newRange.y,a=0;u<t.newRange.y1+1;u++,a++){const l=t.oldRange.y+a%s,d=c(this.dataStore,l)||{};for(let s=t.newRange.x,c=0;s<t.newRange.x1+1;s++,c++){if(u>=t.oldRange.y&&u<=t.oldRange.y1&&s>=t.oldRange.x&&s<=t.oldRange.x1)continue;if(!this.columns[s])continue;const a=null===(e=this.columns[s])||void 0===e?void 0:e.prop,f=t.oldRange.x+c%o,p=n[f].prop;this.isReadOnly(u,s)||(r[u]||(r[u]={}),r[u][a]=d[p],i[u]||(i[u]={}),i[u][a]={colIndex:f,colProp:p,rowIndex:l})}}return{changed:r,mapping:i}}getTransformedDataToApply(t,n){const e={},r=n.length,o=this.columns.length,s=this.dataStore.get("items").length;let i=t.y,c=0;for(let u=0;i<s&&u<r;i++,u++){const s=n[u%r],a=(null==s?void 0:s.length)||0;let l=t.x;for(let t=0;l<o&&t<a;l++,t++){const n=this.columns[l].prop,r=t%o;this.isReadOnly(i,l)||(e[i]||(e[i]={}),e[i][n]=s[r])}c=Math.max(c,l-1)}return{changed:e,range:R(t,{y:i-1,x:c})}}getRangeStaticData(t,n){const e={};for(let r=t.y,o=0;r<t.y1+1;r++,o++)for(let o=t.x,s=0;o<t.x1+1;o++,s++){if(!this.columns[o])continue;const t=this.columns[o].prop;this.isReadOnly(r,o)||(e[r]||(e[r]={}),e[r][t]=n)}return e}getRangeTransformedToProps(t,n){var e;const r=[],o=this.dataStore.get("type");for(let s=t.y,i=0;s<t.y1+1;s++,i++)for(let i=t.x,u=0;i<t.x1+1;i++,u++){const t=null===(e=this.columns[i])||void 0===e?void 0:e.prop;r.push({prop:t,rowIndex:s,colIndex:i,model:c(n,s),type:o,colType:this.type})}return r}copyRangeArray(t,n){const e=(i=[...this.columns],u=t.x,a=t.x1+1,l=null==i?0:i.length,l?(a&&"number"!=typeof a&&s(i,u,a)?(u=0,a=l):(u=null==u?0:d(u),a=void 0===a?l:d(a)),function(t,n,e){var r=-1,o=t.length;n<0&&(n=-n>o?0:o+n),(e=e>o?o:e)<0&&(e+=o),o=n>e?0:e-n>>>0,n>>>=0;for(var s=Array(o);++r<o;)s[r]=t[r+n];return s}(i,u,a)):[]).map((t=>t.prop)),r=[],o={};var i,u,a,l;for(let s=t.y;s<=t.y1;s++){const t=[];o[s]={};for(let r of e){const e=c(n,s);if(!e)continue;const i=e[r];t.push(i),o[s][r]=i}r.push(t)}return{data:r,mapping:o}}destroy(){this.unsubscribe.forEach((t=>t()))}}function ot(t,n){return"function"==typeof t?t(n):!!t}function st(t={},n={}){return"string"==typeof t&&(t={[t]:!0}),"string"==typeof n&&(n={[n]:!0}),Object.assign(Object.assign({},t),n)}function it(t,n){n.className&&(n.class=st(n.class,n.className),delete n.className);let e=Object.assign(Object.assign({},n),t);return n.class&&(e.class=st(e.class,n.class)),n.style&&(e.style=Object.assign(Object.assign({},n.style),e.style)),e}export{b as A,g as B,j as C,O as D,y as E,I as F,D as G,w as H,E as I,x as J,v as K,d as L,rt as M,et as N,ot as O,G as P,it as Q,A as a,S as b,C as c,T as d,k as e,V as f,R as g,J as h,N as i,B as j,L as k,q as l,z as m,M as n,F as o,K as p,Q as q,$ as r,U as s,X as t,Y as u,Z as v,_ as w,tt as x,nt as y,m as z}
4
+ import{r as t,u as n,n as e,v as r,l as o,w as s,a as i,b as c}from"./data.store.js";import"@stencil/core/internal/client";import"./platform.js";import{G as u,b as a,C as l}from"./consts.js";function d(n){var e=t(n),r=e%1;return e==e?r?e-r:e:0}function f(t,n,e,r){var o=-1,s=null==t?0:t.length;for(r&&s&&(e=t[++o]);++o<s;)e=n(e,t[o],o,t);return e}var p,v=(p=function(t,e){return t&&function(t,n,e){for(var r=-1,o=Object(t),s=e(t),i=s.length;i--;){var c=s[++r];if(!1===n(o[c],c,o))break}return t}(t,e,n)},function(t,n){if(null==t)return t;if(!e(t))return p(t,n);for(var r=t.length,o=-1,s=Object(t);++o<r&&!1!==n(s[o],o,s););return t});function h(t,n,e,r,o){return o(t,(function(t,o,s){e=r?(r=!1,t):n(e,t,o,s)})),e}function x(t,n,e){var s=o(t)?f:h,i=arguments.length<3;return s(t,r(n),e,i,v)}function m(t){return null==t?"":t}function b(t={},n){if(n)return n.cellParser?n.cellParser(t,n):t[n.prop]}function g(t,n){return m(b(t,n))}function j(t){return t.pin?t.pin:"rgCol"}function O(t){const n={};for(const[e,r]of t.entries())r.size&&(n[e]=r.size);return n}function y(t){return!!t.children}function I(t,n=0,e,r){return x(t,((t,o)=>{var s;if(y(o))return w(t,o,I(o.children,n+1,e,t),null==r?void 0:r.columns,n);const i=Object.assign(Object.assign({},o.columnType&&(null==e?void 0:e[o.columnType])),o);return i.pin?t.columns[i.pin].push(i):t.columns.rgCol.push(i),i.order&&(t.sort[i.prop]=i),t.columnByProp[i.prop]||(t.columnByProp[i.prop]=[]),t.columnByProp[i.prop].push(i),null===(s=i.beforeSetup)||void 0===s||s.call(i,i),t}),{columns:{rgCol:[],colPinStart:[],colPinEnd:[]},columnByProp:{},columnGrouping:{rgCol:[],colPinStart:[],colPinEnd:[]},sort:{},maxLevel:n})}function w(t,n,e,r,s=0){const i=Object.assign(Object.assign({},n),{level:s,indexes:[]});C.forEach((n=>{const s=t.columns[n],c=e.columns[n];if(o(s)&&o(c)){const e=c.length;if(e){const o=[...(null==r?void 0:r[n])||[],...s].length;s.push(...c),t.columnGrouping[n].push(Object.assign(Object.assign({},i),{indexes:Array(e).fill(o).map(((t,n)=>t+n))}))}}}));for(let n in e.columnGrouping){const o=n,s=e.columnGrouping[o],i=((null==r?void 0:r[o])||[]).length,c=i>0?s.map((t=>Object.assign(Object.assign({},t),{indexes:t.indexes.map((t=>t+i))}))):s;t.columnGrouping[o].push(...c)}return t.maxLevel=Math.max(t.maxLevel,e.maxLevel),t.sort=Object.assign(Object.assign({},t.sort),e.sort),t.columnByProp=Object.assign(Object.assign({},t.columnByProp),e.columnByProp),t}function P(t,n){for(const e of t)if(y(e)){const t=P(e.children,n);if(t)return t}else if(e.prop===n)return e}function E(t,n){return P(t,n)}function M(t,n){const e={};let r=["x","y"];for(let n of r)if(t[n]<0)return e[n]=t[n],e;for(let o of r)if(t[o]>=n[o])return e[o]=t[o]-n[o],e;return null}function A(t,n){const e=Object.assign({},t),r=["x","y"];for(const o of r)t[o]<0?e[o]=0:t[o]>=n[o]&&(e[o]=n[o]-1);return e}function R(t,n){return t&&n?{x:Math.min(t.x,n.x),y:Math.min(t.y,n.y),x1:Math.max(t.x,n.x),y1:Math.max(t.y,n.y)}:null}function S(t){return t.x===t.x1&&t.y===t.y1}const $=["rowPinStart","rgRow","rowPinEnd"],C=["colPinStart","rgCol","colPinEnd"];function N(t){return $.indexOf(t)>-1}const D=`${u}-depth`,G=`${u}-name`,T=`${u}-id`,k=`${u}-value`,V=`${u}-column`,J=`${u}-expanded`,B=`${u}-prop`,L=`${u}-original-index`,q="group-expand",z="groupexpandclick",F="rgRow";function H(t,n){return t[n]||null}function K(t,n,e=!1){let r=0;const o={source:[],prevExpanded:{},oldNewIndexes:{}};return n.forEach((n=>{const s=t[n];e?Y(s)?Q(s)&&(o.prevExpanded[s[k]]=!0):(o.source.push(s),o.oldNewIndexes[n]=r,r++):o.source.push(s)})),o}function Q(t={}){return t[J]}function W({groupedValues:t,parentIds:n,isExpanded:e,itemIndex:r,expandedAll:o,prevExpanded:s,columnProps:i}){const c=n.length,u=[];let a={},l={};return t.forEach(((t,d)=>{const f=[...n,d],p=f.join(","),v=e&&(!!o||!!s[p]);if(u.push({[G]:d,[D]:c,[T]:JSON.stringify(f),[k]:p,[J]:v,[B]:i[c],[i[c]]:d}),r+=1,!e&&c&&(a[r]=!0),Array.isArray(t))t.forEach((t=>{r+=1,v||(a[r]=!0),l[t[L]]=r})),u.push(...t);else{const n=W({groupedValues:t,parentIds:f,isExpanded:v,itemIndex:r,expandedAll:o,prevExpanded:s,columnProps:i});u.push(...n.source),a=Object.assign(Object.assign({},n.trimmed),a),l=Object.assign(Object.assign({},n.oldNewIndexMap),l),r=n.itemIndex}})),{source:u,oldNewIndexMap:l,trimmed:a,itemIndex:r}}function U(t,n,{prevExpanded:e={},expandedAll:r=!1,getGroupValue:o=H}){const s=new Map;t.forEach(((t,e)=>{const r=n.map((n=>o(t,n))),i=r.pop();let c=s;r.forEach((t=>{c.has(t)||c.set(t,new Map),c=c.get(t)})),c.has(i)||c.set(i,[]),c.get(i).push(Object.assign(Object.assign({},t),{[L]:e}))}));const i=n.length,{source:c,trimmed:u,oldNewIndexMap:a}=W({groupedValues:s,parentIds:[],isExpanded:!0,itemIndex:-1,expandedAll:r,prevExpanded:e,columnProps:n});return{sourceWithGroups:c,depth:i,trimmed:u,oldNewIndexMap:a}}function X(t){return null==t?void 0:t[G]}function Y(t){return void 0!==(null==t?void 0:t[G])}function Z(t){return void 0!==(null==t?void 0:t[V])}function _(t,n){const e=t.length;let r=0;for(;r<e;r++)if(t[r]!==n[r])return r;return r}function tt(t){const n=JSON.parse(t);return Array.isArray(n)?n:null}function nt(t,n,e){const r=tt(e[T]);if(!r)return!1;const o=_(t,r);return n[D]<o}function et(t,n={}){const e=null==t?void 0:t.editor;if(e)return"string"==typeof e?n[e]:e}class rt{get columns(){return i(this.source)}constructor(t,n){this.dataStore=t,this.source=n,this.unsubscribe=[],this.hasGrouping=!1,this.unsubscribe.push(n.onChange("source",(t=>this.checkGrouping(t)))),this.checkGrouping(n.get("source")),this.type=n.get("type")}checkGrouping(t){for(let n of t){if(Z(n))return void(this.hasGrouping=!0);this.hasGrouping=!1}}isReadOnly(t,n){var e;const r=null===(e=this.columns[n])||void 0===e?void 0:e.readonly;return"function"==typeof r?r(this.rowDataModel(t,n)):!!r}mergeProperties(t,n,e,r){var o,s;const i=Object.assign({},e);i.class=Object.assign(Object.assign({},"string"==typeof i.class?{[i.class]:!0}:i.class),{[l]:!0,[a]:this.isReadOnly(t,n)});const c=null===(s=null===(o=r.column)||void 0===o?void 0:o.cellProperties)||void 0===s?void 0:s.call(o,r);return c?it(i,c):i}getRowClass(t,n){return(c(this.dataStore,t)||{})[n]||""}getSaveData(t,n,e){const r=this.rowDataModel(t,n);return void 0===e&&(e=m(r.value)),Object.assign(Object.assign({},r),{val:e})}rowDataModel(t,n){const e=this.columns[n],r=null==e?void 0:e.prop,o=c(this.dataStore,t)||{},s=this.dataStore.get("type");return{prop:r,model:o,data:this.dataStore.get("source"),column:e,rowIndex:t,colIndex:n,colType:this.type,type:s,value:b(o,e)}}getRangeData(t,n){var e;const r={},o=t.oldRange.x1-t.oldRange.x+1,s=t.oldRange.y1-t.oldRange.y+1,i={};for(let u=t.newRange.y,a=0;u<t.newRange.y1+1;u++,a++){const l=t.oldRange.y+a%s,d=c(this.dataStore,l)||{};for(let s=t.newRange.x,c=0;s<t.newRange.x1+1;s++,c++){if(u>=t.oldRange.y&&u<=t.oldRange.y1&&s>=t.oldRange.x&&s<=t.oldRange.x1)continue;if(!this.columns[s])continue;const a=null===(e=this.columns[s])||void 0===e?void 0:e.prop,f=t.oldRange.x+c%o,p=n[f].prop;this.isReadOnly(u,s)||(r[u]||(r[u]={}),r[u][a]=d[p],i[u]||(i[u]={}),i[u][a]={colIndex:f,colProp:p,rowIndex:l})}}return{changed:r,mapping:i}}getTransformedDataToApply(t,n){const e={},r=n.length,o=this.columns.length,s=this.dataStore.get("items").length;let i=t.y,c=0;for(let u=0;i<s&&u<r;i++,u++){const s=n[u%r],a=(null==s?void 0:s.length)||0;let l=t.x;for(let t=0;l<o&&t<a;l++,t++){const n=this.columns[l].prop,r=t%o;this.isReadOnly(i,l)||(e[i]||(e[i]={}),e[i][n]=s[r])}c=Math.max(c,l-1)}return{changed:e,range:R(t,{y:i-1,x:c})}}getRangeStaticData(t,n){const e={};for(let r=t.y,o=0;r<t.y1+1;r++,o++)for(let o=t.x,s=0;o<t.x1+1;o++,s++){if(!this.columns[o])continue;const t=this.columns[o].prop;this.isReadOnly(r,o)||(e[r]||(e[r]={}),e[r][t]=n)}return e}getRangeTransformedToProps(t,n){var e;const r=[],o=this.dataStore.get("type");for(let s=t.y,i=0;s<t.y1+1;s++,i++)for(let i=t.x,u=0;i<t.x1+1;i++,u++){const t=null===(e=this.columns[i])||void 0===e?void 0:e.prop;r.push({prop:t,rowIndex:s,colIndex:i,model:c(n,s),type:o,colType:this.type})}return r}copyRangeArray(t,n){const e=(i=[...this.columns],u=t.x,a=t.x1+1,l=null==i?0:i.length,l?(a&&"number"!=typeof a&&s(i,u,a)?(u=0,a=l):(u=null==u?0:d(u),a=void 0===a?l:d(a)),function(t,n,e){var r=-1,o=t.length;n<0&&(n=-n>o?0:o+n),(e=e>o?o:e)<0&&(e+=o),o=n>e?0:e-n>>>0,n>>>=0;for(var s=Array(o);++r<o;)s[r]=t[r+n];return s}(i,u,a)):[]).map((t=>t.prop)),r=[],o={};var i,u,a,l;for(let s=t.y;s<=t.y1;s++){const t=[];o[s]={};for(let r of e){const e=c(n,s);if(!e)continue;const i=e[r];t.push(i),o[s][r]=i}r.push(t)}return{data:r,mapping:o}}destroy(){this.unsubscribe.forEach((t=>t()))}}function ot(t,n){return"function"==typeof t?t(n):!!t}function st(t={},n={}){return"string"==typeof t&&(t={[t]:!0}),"string"==typeof n&&(n={[n]:!0}),Object.assign(Object.assign({},t),n)}function it(t,n){n.className&&(n.class=st(n.class,n.className),delete n.className);let e=Object.assign(Object.assign({},n),t);return n.class&&(e.class=st(e.class,n.class)),n.style&&(e.style=Object.assign(Object.assign({},n.style),e.style)),e}export{b as A,g as B,j as C,O as D,y as E,I as F,D as G,w as H,E as I,x as J,v as K,d as L,rt as M,et as N,ot as O,G as P,it as Q,A as a,S as b,C as c,T as d,k as e,V as f,R as g,J as h,N as i,B as j,L as k,q as l,z as m,M as n,F as o,K as p,Q as q,$ as r,U as s,X as t,Y as u,Z as v,_ as w,tt as x,nt as y,m as z}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
- import{c as t,b as n,r,S as e,i as o,f as u,a as i,t as c}from"./toNumber.js";import*as s from"@stencil/core/internal/client";import"./platform.js";const f=t=>({set(n,r){if("proxyItems"!==n)return;const e=t.get("items").reduce(((t,n)=>(t.add(n),t)),new Set),o=r.reduce(((t,n)=>(e.has(n)&&t.push(n),t)),[]);t.set("items",o)}});function a(t,n){return t===n||t!=t&&n!=n}function v(t,n){for(var r=t.length;r--;)if(a(t[r][0],n))return r;return-1}var l=Array.prototype.splice;function h(t){var n=-1,r=null==t?0:t.length;for(this.clear();++n<r;){var e=t[n];this.set(e[0],e[1])}}function b(r){if(!t(r))return!1;var e=n(r);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}h.prototype.clear=function(){this.__data__=[],this.size=0},h.prototype.delete=function(t){var n=this.__data__,r=v(n,t);return!(r<0||(r==n.length-1?n.pop():l.call(n,r,1),--this.size,0))},h.prototype.get=function(t){var n=this.__data__,r=v(n,t);return r<0?void 0:n[r][1]},h.prototype.has=function(t){return v(this.__data__,t)>-1},h.prototype.set=function(t,n){var r=this.__data__,e=v(r,t);return e<0?(++this.size,r.push([t,n])):r[e][1]=n,this};var p,d=r["__core-js_shared__"],m=(p=/[^.]+$/.exec(d&&d.keys&&d.keys.IE_PROTO||""))?"Symbol(src)_1."+p:"",j=Function.prototype.toString;function y(t){if(null!=t){try{return j.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var w=/^\[object .+?Constructor\]$/,g=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function O(n,r){var e=function(t,n){return null==t?void 0:t[n]}(n,r);return function(n){return!(!t(n)||(r=n,m&&m in r))&&(b(n)?g:w).test(y(n));var r}(e)?e:void 0}var _=O(r,"Map"),x=O(Object,"create"),A=Object.prototype.hasOwnProperty,D=Object.prototype.hasOwnProperty;function M(t){var n=-1,r=null==t?0:t.length;for(this.clear();++n<r;){var e=t[n];this.set(e[0],e[1])}}function S(t,n){var r,e,o=t.__data__;return("string"==(e=typeof(r=n))||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==r:null===r)?o["string"==typeof n?"string":"hash"]:o.map}function k(t){var n=-1,r=null==t?0:t.length;for(this.clear();++n<r;){var e=t[n];this.set(e[0],e[1])}}function $(t){var n=this.__data__=new h(t);this.size=n.size}function P(t){var n=-1,r=null==t?0:t.length;for(this.__data__=new k;++n<r;)this.add(t[n])}function C(t,n){for(var r=-1,e=null==t?0:t.length;++r<e;)if(n(t[r],r,t))return!0;return!1}function E(t,n,r,e,o,u){var i=1&r,c=t.length,s=n.length;if(c!=s&&!(i&&s>c))return!1;var f=u.get(t),a=u.get(n);if(f&&a)return f==n&&a==t;var v=-1,l=!0,h=2&r?new P:void 0;for(u.set(t,n),u.set(n,t);++v<c;){var b=t[v],p=n[v];if(e)var d=i?e(p,b,v,n,t,u):e(b,p,v,t,n,u);if(void 0!==d){if(d)continue;l=!1;break}if(h){if(!C(n,(function(t,n){if(!h.has(n)&&(b===t||o(b,t,r,e,u)))return h.push(n)}))){l=!1;break}}else if(b!==p&&!o(b,p,r,e,u)){l=!1;break}}return u.delete(t),u.delete(n),l}M.prototype.clear=function(){this.__data__=x?x(null):{},this.size=0},M.prototype.delete=function(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n},M.prototype.get=function(t){var n=this.__data__;if(x){var r=n[t];return"__lodash_hash_undefined__"===r?void 0:r}return A.call(n,t)?n[t]:void 0},M.prototype.has=function(t){var n=this.__data__;return x?void 0!==n[t]:D.call(n,t)},M.prototype.set=function(t,n){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=x&&void 0===n?"__lodash_hash_undefined__":n,this},k.prototype.clear=function(){this.size=0,this.__data__={hash:new M,map:new(_||h),string:new M}},k.prototype.delete=function(t){var n=S(this,t).delete(t);return this.size-=n?1:0,n},k.prototype.get=function(t){return S(this,t).get(t)},k.prototype.has=function(t){return S(this,t).has(t)},k.prototype.set=function(t,n){var r=S(this,t),e=r.size;return r.set(t,n),this.size+=r.size==e?0:1,this},$.prototype.clear=function(){this.__data__=new h,this.size=0},$.prototype.delete=function(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r},$.prototype.get=function(t){return this.__data__.get(t)},$.prototype.has=function(t){return this.__data__.has(t)},$.prototype.set=function(t,n){var r=this.__data__;if(r instanceof h){var e=r.__data__;if(!_||e.length<199)return e.push([t,n]),this.size=++r.size,this;r=this.__data__=new k(e)}return r.set(t,n),this.size=r.size,this},P.prototype.add=P.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},P.prototype.has=function(t){return this.__data__.has(t)};var F=r.Uint8Array;function R(t){var n=-1,r=Array(t.size);return t.forEach((function(t,e){r[++n]=[e,t]})),r}function I(t){var n=-1,r=Array(t.size);return t.forEach((function(t){r[++n]=t})),r}var T=e?e.prototype:void 0,B=T?T.valueOf:void 0,N=Array.isArray,V=Object.prototype.propertyIsEnumerable,W=Object.getOwnPropertySymbols,H=W?function(t){return null==t?[]:(t=Object(t),function(n){for(var r=-1,e=null==n?0:n.length,o=0,u=[];++r<e;){var i=n[r];V.call(t,i)&&(u[o++]=i)}return u}(W(t)))}:function(){return[]};function L(t){return o(t)&&"[object Arguments]"==n(t)}var q=Object.prototype,G=q.hasOwnProperty,K=q.propertyIsEnumerable,U=L(function(){return arguments}())?L:function(t){return o(t)&&G.call(t,"callee")&&!K.call(t,"callee")},z="object"==typeof exports&&exports&&!exports.nodeType&&exports,J=z&&"object"==typeof module&&module&&!module.nodeType&&module,Q=J&&J.exports===z?r.Buffer:void 0,X=(Q?Q.isBuffer:void 0)||function(){return!1},Y=/^(?:0|[1-9]\d*)$/;function Z(t,n){var r=typeof t;return!!(n=null==n?9007199254740991:n)&&("number"==r||"symbol"!=r&&Y.test(t))&&t>-1&&t%1==0&&t<n}function tt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}var nt={};nt["[object Float32Array]"]=nt["[object Float64Array]"]=nt["[object Int8Array]"]=nt["[object Int16Array]"]=nt["[object Int32Array]"]=nt["[object Uint8Array]"]=nt["[object Uint8ClampedArray]"]=nt["[object Uint16Array]"]=nt["[object Uint32Array]"]=!0,nt["[object Arguments]"]=nt["[object Array]"]=nt["[object ArrayBuffer]"]=nt["[object Boolean]"]=nt["[object DataView]"]=nt["[object Date]"]=nt["[object Error]"]=nt["[object Function]"]=nt["[object Map]"]=nt["[object Number]"]=nt["[object Object]"]=nt["[object RegExp]"]=nt["[object Set]"]=nt["[object String]"]=nt["[object WeakMap]"]=!1;var rt,et="object"==typeof exports&&exports&&!exports.nodeType&&exports,ot=et&&"object"==typeof module&&module&&!module.nodeType&&module,ut=ot&&ot.exports===et&&u.process,it=function(){try{return ot&&ot.require&&ot.require("util").types||ut&&ut.binding&&ut.binding("util")}catch(t){}}(),ct=it&&it.isTypedArray,st=ct?(rt=ct,function(t){return rt(t)}):function(t){return o(t)&&tt(t.length)&&!!nt[n(t)]},ft=Object.prototype.hasOwnProperty;var at=Object.prototype,vt=function(t,n){return function(r){return t(n(r))}}(Object.keys,Object),lt=Object.prototype.hasOwnProperty;function ht(t){if((n=t)!==("function"==typeof(r=n&&n.constructor)&&r.prototype||at))return vt(t);var n,r,e=[];for(var o in Object(t))lt.call(t,o)&&"constructor"!=o&&e.push(o);return e}function bt(t){return null!=t&&tt(t.length)&&!b(t)}function pt(t){return bt(t)?function(t){var n=N(t),r=!n&&U(t),e=!n&&!r&&X(t),o=!n&&!r&&!e&&st(t),u=n||r||e||o,i=u?function(t,n){for(var r=-1,e=Array(t);++r<t;)e[r]=n(r);return e}(t.length,String):[],c=i.length;for(var s in t)!ft.call(t,s)||u&&("length"==s||e&&("offset"==s||"parent"==s)||o&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||Z(s,c))||i.push(s);return i}(t):ht(t)}function dt(t){return function(t,n,r){var e=pt(t);return N(t)?e:function(t,n){for(var r=-1,e=n.length,o=t.length;++r<e;)t[o+r]=n[r];return t}(e,r(t))}(t,0,H)}var mt=Object.prototype.hasOwnProperty,jt=O(r,"DataView"),yt=O(r,"Promise"),wt=O(r,"Set"),gt=O(r,"WeakMap"),Ot="[object Map]",_t="[object Promise]",xt="[object Set]",At="[object WeakMap]",Dt="[object DataView]",Mt=y(jt),St=y(_),kt=y(yt),$t=y(wt),Pt=y(gt),Ct=n;(jt&&Ct(new jt(new ArrayBuffer(1)))!=Dt||_&&Ct(new _)!=Ot||yt&&Ct(yt.resolve())!=_t||wt&&Ct(new wt)!=xt||gt&&Ct(new gt)!=At)&&(Ct=function(t){var r=n(t),e="[object Object]"==r?t.constructor:void 0,o=e?y(e):"";if(o)switch(o){case Mt:return Dt;case St:return Ot;case kt:return _t;case $t:return xt;case Pt:return At}return r});var Et="[object Arguments]",Ft="[object Array]",Rt="[object Object]",It=Object.prototype.hasOwnProperty;function Tt(t,n,r,e,u){return t===n||(null==t||null==n||!o(t)&&!o(n)?t!=t&&n!=n:function(t,n,r,e,o,u){var i=N(t),c=N(n),s=i?Ft:Ct(t),f=c?Ft:Ct(n),v=(s=s==Et?Rt:s)==Rt,l=(f=f==Et?Rt:f)==Rt,h=s==f;if(h&&X(t)){if(!X(n))return!1;i=!0,v=!1}if(h&&!v)return u||(u=new $),i||st(t)?E(t,n,r,e,o,u):function(t,n,r,e,o,u,i){switch(r){case"[object DataView]":if(t.byteLength!=n.byteLength||t.byteOffset!=n.byteOffset)return!1;t=t.buffer,n=n.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=n.byteLength||!u(new F(t),new F(n)));case"[object Boolean]":case"[object Date]":case"[object Number]":return a(+t,+n);case"[object Error]":return t.name==n.name&&t.message==n.message;case"[object RegExp]":case"[object String]":return t==n+"";case"[object Map]":var c=R;case"[object Set]":if(c||(c=I),t.size!=n.size&&!(1&e))return!1;var s=i.get(t);if(s)return s==n;e|=2,i.set(t,n);var f=E(c(t),c(n),e,o,u,i);return i.delete(t),f;case"[object Symbol]":if(B)return B.call(t)==B.call(n)}return!1}(t,n,s,r,e,o,u);if(!(1&r)){var b=v&&It.call(t,"__wrapped__"),p=l&&It.call(n,"__wrapped__");if(b||p){var d=b?t.value():t,m=p?n.value():n;return u||(u=new $),o(d,m,r,e,u)}}return!!h&&(u||(u=new $),function(t,n,r,e,o,u){var i=1&r,c=dt(t),s=c.length;if(s!=dt(n).length&&!i)return!1;for(var f=s;f--;){var a=c[f];if(!(i?a in n:mt.call(n,a)))return!1}var v=u.get(t),l=u.get(n);if(v&&l)return v==n&&l==t;var h=!0;u.set(t,n),u.set(n,t);for(var b=i;++f<s;){var p=t[a=c[f]],d=n[a];if(e)var m=i?e(d,p,a,n,t,u):e(p,d,a,t,n,u);if(!(void 0===m?p===d||o(p,d,r,e,u):m)){h=!1;break}b||(b="constructor"==a)}if(h&&!b){var j=t.constructor,y=n.constructor;j==y||!("constructor"in t)||!("constructor"in n)||"function"==typeof j&&j instanceof j&&"function"==typeof y&&y instanceof y||(h=!1)}return u.delete(t),u.delete(n),h}(t,n,r,e,o,u))}(t,n,r,e,Tt,u))}function Bt(n){return n==n&&!t(n)}function Nt(t,n){return function(r){return null!=r&&r[t]===n&&(void 0!==n||t in Object(r))}}var Vt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Wt=/^\w*$/;function Ht(t,n){if(N(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!i(t))||Wt.test(t)||!Vt.test(t)||null!=n&&t in Object(n)}function Lt(t,n){if("function"!=typeof t||null!=n&&"function"!=typeof n)throw new TypeError("Expected a function");var r=function(){var e=arguments,o=n?n.apply(this,e):e[0],u=r.cache;if(u.has(o))return u.get(o);var i=t.apply(this,e);return r.cache=u.set(o,i)||u,i};return r.cache=new(Lt.Cache||k),r}Lt.Cache=k;var qt,Gt,Kt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ut=/\\(\\)?/g,zt=(qt=Lt((function(t){var n=[];return 46===t.charCodeAt(0)&&n.push(""),t.replace(Kt,(function(t,r,e,o){n.push(e?o.replace(Ut,"$1"):r||t)})),n}),(function(t){return 500===Gt.size&&Gt.clear(),t})),Gt=qt.cache,qt),Jt=e?e.prototype:void 0,Qt=Jt?Jt.toString:void 0;function Xt(t){if("string"==typeof t)return t;if(N(t))return function(t,n){for(var r=-1,e=null==t?0:t.length,o=Array(e);++r<e;)o[r]=n(t[r],r,t);return o}(t,Xt)+"";if(i(t))return Qt?Qt.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}function Yt(t,n){return N(t)?t:Ht(t,n)?[t]:zt(function(t){return null==t?"":Xt(t)}(t))}function Zt(t){if("string"==typeof t||i(t))return t;var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}function tn(t,n){for(var r=0,e=(n=Yt(n,t)).length;null!=t&&r<e;)t=t[Zt(n[r++])];return r&&r==e?t:void 0}function nn(t,n){return null!=t&&n in Object(t)}function rn(t,n){return Ht(t)&&Bt(n)?Nt(Zt(t),n):function(r){var e=function(t,n){var r=null==t?void 0:tn(t,n);return void 0===r?void 0:r}(r,t);return void 0===e&&e===n?function(t,n){return null!=t&&function(t,n,r){for(var e=-1,o=(n=Yt(n,t)).length,u=!1;++e<o;){var i=Zt(n[e]);if(!(u=null!=t&&r(t,i)))break;t=t[i]}return u||++e!=o?u:!!(o=null==t?0:t.length)&&tt(o)&&Z(i,o)&&(N(t)||U(t))}(t,n,nn)}(r,t):Tt(n,e,3)}}function en(t){return t}function on(t){return function(n){return null==n?void 0:n[t]}}function un(t){return"function"==typeof t?t:null==t?en:"object"==typeof t?N(t)?rn(t[0],t[1]):(e=function(t){for(var n=pt(t),r=n.length;r--;){var e=n[r],o=t[e];n[r]=[e,o,Bt(o)]}return n}(r=t),1==e.length&&e[0][2]?Nt(e[0][0],e[0][1]):function(t){return t===r||function(t,n,r){var e=r.length,o=e;if(null==t)return!o;for(t=Object(t);e--;){var u=r[e];if(u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++e<o;){var i=(u=r[e])[0],c=t[i];if(u[2]){if(void 0===c&&!(i in t))return!1}else if(!Tt(u[1],c,3,void 0,new $))return!1}return!0}(t,0,e)}):Ht(n=t)?on(Zt(n)):function(t){return function(n){return tn(n,t)}}(n);var n,r,e}var cn=1/0;function sn(t){return t?(t=c(t))===cn||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}var fn=Math.ceil,an=Math.max;function vn(n,r,e){if(!t(e))return!1;var o=typeof r;return!!("number"==o?bt(e)&&Z(r,e.length):"string"==o&&r in e)&&a(e[r],n)}const ln=(()=>{let t;return(...n)=>{t&&clearTimeout(t),t=setTimeout((()=>{t=0,(t=>{for(let n of t.keys()){const r=t.get(n).filter((t=>{const n=t.deref();return n&&(!("isConnected"in(r=n))||r.isConnected);var r}));t.set(n,r)}})(...n)}),2e3)}})(),hn=s.forceUpdate,bn=s.getRenderingRef,pn=(t,n)=>{const r=t.indexOf(n);r>=0&&(t[r]=t[t.length-1],t.length--)},dn=(t,n)=>{const r=((t,n=(t,n)=>t!==n)=>{const r=()=>{return("function"==typeof(n=t)?n():n)??{};var n},e=r();let o=new Map(Object.entries(e));const u="undefined"!=typeof Proxy,i=u?null:{},c={dispose:[],get:[],set:[],reset:[]},s=new Map,f=()=>{o=new Map(Object.entries(r())),u||p(),c.reset.forEach((t=>t()))},a=t=>(c.get.forEach((n=>n(t))),o.get(t)),v=(t,r)=>{const e=o.get(t);n(r,e,t)&&(o.set(t,r),u||b(t),c.set.forEach((n=>n(t,r,e))))},l=u?new Proxy(e,{get:(t,n)=>a(n),ownKeys:()=>Array.from(o.keys()),getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0}),has:(t,n)=>o.has(n),set:(t,n,r)=>(v(n,r),!0)}):(p(),i),h=(t,n)=>(c[t].push(n),()=>{pn(c[t],n)});function b(t){!u&&i&&(Object.prototype.hasOwnProperty.call(i,t)||Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:()=>a(t),set(n){v(t,n)}}))}function p(){if(u||!i)return;const t=new Set(o.keys());for(const n of Object.keys(i))t.has(n)||delete i[n];for(const n of t)b(n)}return{state:l,get:a,set:v,on:h,onChange:(t,n)=>{const e=(r,e)=>{r===t&&n(e)},o=()=>{const e=r();n(e[t])},u=h("set",e),i=h("reset",o);return s.set(n,{setHandler:e,resetHandler:o,propName:t}),()=>{u(),i(),s.delete(n)}},use:(...t)=>{const n=t.reduce(((t,n)=>(n.set&&t.push(h("set",n.set)),n.get&&t.push(h("get",n.get)),n.reset&&t.push(h("reset",n.reset)),n.dispose&&t.push(h("dispose",n.dispose)),t)),[]);return()=>n.forEach((t=>t()))},dispose:()=>{c.dispose.forEach((t=>t())),f()},reset:f,forceUpdate:t=>{const n=o.get(t);c.set.forEach((r=>r(t,n,n)))},removeListener:(t,n)=>{const r=s.get(n);r&&r.propName===t&&(pn(c.set,r.setHandler),pn(c.reset,r.resetHandler),s.delete(n))}}})(t,n);return r.use((()=>{if("function"!=typeof bn||"function"!=typeof hn)return{};const t=hn,n=bn,r=new Map;return{dispose:()=>r.clear(),get:t=>{const e=n();e&&((t,n,r)=>{let e=t.get(n);e||(e=[],t.set(n,e)),e.some((t=>t.deref()===r))||e.push(new WeakRef(r))})(r,t,e)},set:n=>{const e=r.get(n);if(e){const o=e.filter((n=>{const r=n.deref();return!!r&&t(r)}));r.set(n,o)}ln(r)},reset:()=>{r.forEach((n=>{n.forEach((n=>{const r=n.deref();r&&t(r)}))})),ln(r)}}})()),r},mn=t=>({set(n,r){switch(n){case"trimmed":{const n=t.get("proxyItems"),e=jn(r),o=n.filter((t=>!e[t]));t.set("items",o);break}}}});function jn(t){const n={};for(let r in t)for(let e in t[r])n[e]=n[e]||t[r][e];return n}function yn(t,n){Object.entries(n).forEach((([n,r])=>{t.set(n,r)}))}class wn{get store(){return this.dataStore}constructor(t,n){const r=this.dataStore=dn(Object.assign({items:[],proxyItems:[],source:[],groupingDepth:0,groups:{},type:t,trimmed:{},groupingCustomRenderer:void 0},n));r.use(f(r)),r.use(mn(r))}updateData(t,n,r=!1,e=!1){const o=this.store.get("trimmed"),u=r&&e?jn(o):null;r||this.store.set("trimmed",{}),this.store.set("items",[]);const i=(c=0,s=(null==t?void 0:t.length)||0,f&&"number"!=typeof f&&vn(c,s,f)&&(s=f=void 0),c=sn(c),void 0===s?(s=c,c=0):s=sn(s),function(t,n,r){for(var e=-1,o=an(fn((n-t)/(r||1)),0),u=Array(o);o--;)u[++e]=t,t+=r;return u}(c,s,f=void 0===f?c<s?1:-1:sn(f)));var c,s,f;yn(this.store,{source:t,proxyItems:[...i]}),this.store.set("items",u?i.filter((t=>!u[t])):i),n&&yn(this.store,{groupingDepth:n.depth,groups:n.groups,groupingCustomRenderer:n.customRenderer})}addTrimmed(t){let n=this.store.get("trimmed");n=Object.assign(Object.assign({},n),t),yn(this.store,{trimmed:n})}setSourceData(t,n=!0){An(this.store,t,n)}setData(t){const n=Object.assign({},t);yn(this.store,n)}refresh(){const t=this.store.get("source");this.store.set("source",[...t])}}function gn(t,n){return t.get("items")[n]}function On(t){const n=t.get("source");return t.get("items").map((t=>n[t]))}const _n=(t,n)=>t.get("source")[xn(t,n)],xn=(t,n)=>t.get("items")[n];function An(t,n,r=!0){const e=t.get("items"),o=t.get("source");for(let t in n)o[e[t]]=n[t];r&&t.set("source",[...o])}function Dn(t,n,r=!0){const e=t.get("source");for(let t in n)e[t]=n[t];r&&t.set("source",[...e])}function Mn(t,n){t.set("items",n)}function Sn(t,n){const r=t.get("items"),e=null!=(o=t.get("source"))&&o.length?function(t,n){for(var r=t.length,e=-1;++e<r;)if(n(t[e],e,t))return e;return-1}(o,un({prop:n})):-1;var o;return r.indexOf(e)}export{wn as D,On as a,_n as b,xn as c,Dn as d,Mn as e,Sn as f,gn as g,jn as h,yn as i,dn as j,en as k,N as l,on as m,bt as n,Ct as o,f as p,ht as q,O as r,An as s,mn as t,un as u,sn as v,pt as w,vn as x}
4
+ import{c as t,b as n,r,S as e,i as o,f as u,a as i,t as c}from"./toNumber.js";import*as s from"@stencil/core/internal/client";import"./platform.js";const f=t=>({set(n,r){if("proxyItems"!==n)return;const e=t.get("items").reduce(((t,n)=>(t.add(n),t)),new Set),o=r.reduce(((t,n)=>(e.has(n)&&t.push(n),t)),[]);t.set("items",o)}});function a(t,n){return t===n||t!=t&&n!=n}function v(t,n){for(var r=t.length;r--;)if(a(t[r][0],n))return r;return-1}var l=Array.prototype.splice;function h(t){var n=-1,r=null==t?0:t.length;for(this.clear();++n<r;){var e=t[n];this.set(e[0],e[1])}}function b(r){if(!t(r))return!1;var e=n(r);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}h.prototype.clear=function(){this.__data__=[],this.size=0},h.prototype.delete=function(t){var n=this.__data__,r=v(n,t);return!(r<0||(r==n.length-1?n.pop():l.call(n,r,1),--this.size,0))},h.prototype.get=function(t){var n=this.__data__,r=v(n,t);return r<0?void 0:n[r][1]},h.prototype.has=function(t){return v(this.__data__,t)>-1},h.prototype.set=function(t,n){var r=this.__data__,e=v(r,t);return e<0?(++this.size,r.push([t,n])):r[e][1]=n,this};var p,d=r["__core-js_shared__"],m=(p=/[^.]+$/.exec(d&&d.keys&&d.keys.IE_PROTO||""))?"Symbol(src)_1."+p:"",j=Function.prototype.toString;function y(t){if(null!=t){try{return j.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var w=/^\[object .+?Constructor\]$/,g=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function O(n,r){var e=function(t,n){return null==t?void 0:t[n]}(n,r);return function(n){return!(!t(n)||(r=n,m&&m in r))&&(b(n)?g:w).test(y(n));var r}(e)?e:void 0}var _=O(r,"Map"),x=O(Object,"create"),A=Object.prototype.hasOwnProperty,D=Object.prototype.hasOwnProperty;function M(t){var n=-1,r=null==t?0:t.length;for(this.clear();++n<r;){var e=t[n];this.set(e[0],e[1])}}function S(t,n){var r,e,o=t.__data__;return("string"==(e=typeof(r=n))||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==r:null===r)?o["string"==typeof n?"string":"hash"]:o.map}function k(t){var n=-1,r=null==t?0:t.length;for(this.clear();++n<r;){var e=t[n];this.set(e[0],e[1])}}function $(t){var n=this.__data__=new h(t);this.size=n.size}function P(t){var n=-1,r=null==t?0:t.length;for(this.__data__=new k;++n<r;)this.add(t[n])}function C(t,n){for(var r=-1,e=null==t?0:t.length;++r<e;)if(n(t[r],r,t))return!0;return!1}function E(t,n,r,e,o,u){var i=1&r,c=t.length,s=n.length;if(c!=s&&!(i&&s>c))return!1;var f=u.get(t),a=u.get(n);if(f&&a)return f==n&&a==t;var v=-1,l=!0,h=2&r?new P:void 0;for(u.set(t,n),u.set(n,t);++v<c;){var b=t[v],p=n[v];if(e)var d=i?e(p,b,v,n,t,u):e(b,p,v,t,n,u);if(void 0!==d){if(d)continue;l=!1;break}if(h){if(!C(n,(function(t,n){if(!h.has(n)&&(b===t||o(b,t,r,e,u)))return h.push(n)}))){l=!1;break}}else if(b!==p&&!o(b,p,r,e,u)){l=!1;break}}return u.delete(t),u.delete(n),l}M.prototype.clear=function(){this.__data__=x?x(null):{},this.size=0},M.prototype.delete=function(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n},M.prototype.get=function(t){var n=this.__data__;if(x){var r=n[t];return"__lodash_hash_undefined__"===r?void 0:r}return A.call(n,t)?n[t]:void 0},M.prototype.has=function(t){var n=this.__data__;return x?void 0!==n[t]:D.call(n,t)},M.prototype.set=function(t,n){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=x&&void 0===n?"__lodash_hash_undefined__":n,this},k.prototype.clear=function(){this.size=0,this.__data__={hash:new M,map:new(_||h),string:new M}},k.prototype.delete=function(t){var n=S(this,t).delete(t);return this.size-=n?1:0,n},k.prototype.get=function(t){return S(this,t).get(t)},k.prototype.has=function(t){return S(this,t).has(t)},k.prototype.set=function(t,n){var r=S(this,t),e=r.size;return r.set(t,n),this.size+=r.size==e?0:1,this},$.prototype.clear=function(){this.__data__=new h,this.size=0},$.prototype.delete=function(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r},$.prototype.get=function(t){return this.__data__.get(t)},$.prototype.has=function(t){return this.__data__.has(t)},$.prototype.set=function(t,n){var r=this.__data__;if(r instanceof h){var e=r.__data__;if(!_||e.length<199)return e.push([t,n]),this.size=++r.size,this;r=this.__data__=new k(e)}return r.set(t,n),this.size=r.size,this},P.prototype.add=P.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},P.prototype.has=function(t){return this.__data__.has(t)};var F=r.Uint8Array;function R(t){var n=-1,r=Array(t.size);return t.forEach((function(t,e){r[++n]=[e,t]})),r}function I(t){var n=-1,r=Array(t.size);return t.forEach((function(t){r[++n]=t})),r}var T=e?e.prototype:void 0,B=T?T.valueOf:void 0,N=Array.isArray,V=Object.prototype.propertyIsEnumerable,W=Object.getOwnPropertySymbols,H=W?function(t){return null==t?[]:(t=Object(t),function(n){for(var r=-1,e=null==n?0:n.length,o=0,u=[];++r<e;){var i=n[r];V.call(t,i)&&(u[o++]=i)}return u}(W(t)))}:function(){return[]};function L(t){return o(t)&&"[object Arguments]"==n(t)}var q=Object.prototype,G=q.hasOwnProperty,K=q.propertyIsEnumerable,U=L(function(){return arguments}())?L:function(t){return o(t)&&G.call(t,"callee")&&!K.call(t,"callee")},z="object"==typeof exports&&exports&&!exports.nodeType&&exports,J=z&&"object"==typeof module&&module&&!module.nodeType&&module,Q=J&&J.exports===z?r.Buffer:void 0,X=(Q?Q.isBuffer:void 0)||function(){return!1},Y=/^(?:0|[1-9]\d*)$/;function Z(t,n){var r=typeof t;return!!(n=null==n?9007199254740991:n)&&("number"==r||"symbol"!=r&&Y.test(t))&&t>-1&&t%1==0&&t<n}function tt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}var nt={};nt["[object Float32Array]"]=nt["[object Float64Array]"]=nt["[object Int8Array]"]=nt["[object Int16Array]"]=nt["[object Int32Array]"]=nt["[object Uint8Array]"]=nt["[object Uint8ClampedArray]"]=nt["[object Uint16Array]"]=nt["[object Uint32Array]"]=!0,nt["[object Arguments]"]=nt["[object Array]"]=nt["[object ArrayBuffer]"]=nt["[object Boolean]"]=nt["[object DataView]"]=nt["[object Date]"]=nt["[object Error]"]=nt["[object Function]"]=nt["[object Map]"]=nt["[object Number]"]=nt["[object Object]"]=nt["[object RegExp]"]=nt["[object Set]"]=nt["[object String]"]=nt["[object WeakMap]"]=!1;var rt,et="object"==typeof exports&&exports&&!exports.nodeType&&exports,ot=et&&"object"==typeof module&&module&&!module.nodeType&&module,ut=ot&&ot.exports===et&&u.process,it=function(){try{return ot&&ot.require&&ot.require("util").types||ut&&ut.binding&&ut.binding("util")}catch(t){}}(),ct=it&&it.isTypedArray,st=ct?(rt=ct,function(t){return rt(t)}):function(t){return o(t)&&tt(t.length)&&!!nt[n(t)]},ft=Object.prototype.hasOwnProperty;var at=Object.prototype,vt=function(t,n){return function(r){return t(n(r))}}(Object.keys,Object),lt=Object.prototype.hasOwnProperty;function ht(t){if((n=t)!==("function"==typeof(r=n&&n.constructor)&&r.prototype||at))return vt(t);var n,r,e=[];for(var o in Object(t))lt.call(t,o)&&"constructor"!=o&&e.push(o);return e}function bt(t){return null!=t&&tt(t.length)&&!b(t)}function pt(t){return bt(t)?function(t){var n=N(t),r=!n&&U(t),e=!n&&!r&&X(t),o=!n&&!r&&!e&&st(t),u=n||r||e||o,i=u?function(t,n){for(var r=-1,e=Array(t);++r<t;)e[r]=n(r);return e}(t.length,String):[],c=i.length;for(var s in t)!ft.call(t,s)||u&&("length"==s||e&&("offset"==s||"parent"==s)||o&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||Z(s,c))||i.push(s);return i}(t):ht(t)}function dt(t){return function(t,n,r){var e=pt(t);return N(t)?e:function(t,n){for(var r=-1,e=n.length,o=t.length;++r<e;)t[o+r]=n[r];return t}(e,r(t))}(t,0,H)}var mt=Object.prototype.hasOwnProperty,jt=O(r,"DataView"),yt=O(r,"Promise"),wt=O(r,"Set"),gt=O(r,"WeakMap"),Ot="[object Map]",_t="[object Promise]",xt="[object Set]",At="[object WeakMap]",Dt="[object DataView]",Mt=y(jt),St=y(_),kt=y(yt),$t=y(wt),Pt=y(gt),Ct=n;(jt&&Ct(new jt(new ArrayBuffer(1)))!=Dt||_&&Ct(new _)!=Ot||yt&&Ct(yt.resolve())!=_t||wt&&Ct(new wt)!=xt||gt&&Ct(new gt)!=At)&&(Ct=function(t){var r=n(t),e="[object Object]"==r?t.constructor:void 0,o=e?y(e):"";if(o)switch(o){case Mt:return Dt;case St:return Ot;case kt:return _t;case $t:return xt;case Pt:return At}return r});var Et="[object Arguments]",Ft="[object Array]",Rt="[object Object]",It=Object.prototype.hasOwnProperty;function Tt(t,n,r,e,u){return t===n||(null==t||null==n||!o(t)&&!o(n)?t!=t&&n!=n:function(t,n,r,e,o,u){var i=N(t),c=N(n),s=i?Ft:Ct(t),f=c?Ft:Ct(n),v=(s=s==Et?Rt:s)==Rt,l=(f=f==Et?Rt:f)==Rt,h=s==f;if(h&&X(t)){if(!X(n))return!1;i=!0,v=!1}if(h&&!v)return u||(u=new $),i||st(t)?E(t,n,r,e,o,u):function(t,n,r,e,o,u,i){switch(r){case"[object DataView]":if(t.byteLength!=n.byteLength||t.byteOffset!=n.byteOffset)return!1;t=t.buffer,n=n.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=n.byteLength||!u(new F(t),new F(n)));case"[object Boolean]":case"[object Date]":case"[object Number]":return a(+t,+n);case"[object Error]":return t.name==n.name&&t.message==n.message;case"[object RegExp]":case"[object String]":return t==n+"";case"[object Map]":var c=R;case"[object Set]":if(c||(c=I),t.size!=n.size&&!(1&e))return!1;var s=i.get(t);if(s)return s==n;e|=2,i.set(t,n);var f=E(c(t),c(n),e,o,u,i);return i.delete(t),f;case"[object Symbol]":if(B)return B.call(t)==B.call(n)}return!1}(t,n,s,r,e,o,u);if(!(1&r)){var b=v&&It.call(t,"__wrapped__"),p=l&&It.call(n,"__wrapped__");if(b||p){var d=b?t.value():t,m=p?n.value():n;return u||(u=new $),o(d,m,r,e,u)}}return!!h&&(u||(u=new $),function(t,n,r,e,o,u){var i=1&r,c=dt(t),s=c.length;if(s!=dt(n).length&&!i)return!1;for(var f=s;f--;){var a=c[f];if(!(i?a in n:mt.call(n,a)))return!1}var v=u.get(t),l=u.get(n);if(v&&l)return v==n&&l==t;var h=!0;u.set(t,n),u.set(n,t);for(var b=i;++f<s;){var p=t[a=c[f]],d=n[a];if(e)var m=i?e(d,p,a,n,t,u):e(p,d,a,t,n,u);if(!(void 0===m?p===d||o(p,d,r,e,u):m)){h=!1;break}b||(b="constructor"==a)}if(h&&!b){var j=t.constructor,y=n.constructor;j==y||!("constructor"in t)||!("constructor"in n)||"function"==typeof j&&j instanceof j&&"function"==typeof y&&y instanceof y||(h=!1)}return u.delete(t),u.delete(n),h}(t,n,r,e,o,u))}(t,n,r,e,Tt,u))}function Bt(n){return n==n&&!t(n)}function Nt(t,n){return function(r){return null!=r&&r[t]===n&&(void 0!==n||t in Object(r))}}var Vt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Wt=/^\w*$/;function Ht(t,n){if(N(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!i(t))||Wt.test(t)||!Vt.test(t)||null!=n&&t in Object(n)}function Lt(t,n){if("function"!=typeof t||null!=n&&"function"!=typeof n)throw new TypeError("Expected a function");var r=function(){var e=arguments,o=n?n.apply(this,e):e[0],u=r.cache;if(u.has(o))return u.get(o);var i=t.apply(this,e);return r.cache=u.set(o,i)||u,i};return r.cache=new(Lt.Cache||k),r}Lt.Cache=k;var qt,Gt,Kt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ut=/\\(\\)?/g,zt=(qt=Lt((function(t){var n=[];return 46===t.charCodeAt(0)&&n.push(""),t.replace(Kt,(function(t,r,e,o){n.push(e?o.replace(Ut,"$1"):r||t)})),n}),(function(t){return 500===Gt.size&&Gt.clear(),t})),Gt=qt.cache,qt),Jt=e?e.prototype:void 0,Qt=Jt?Jt.toString:void 0;function Xt(t){if("string"==typeof t)return t;if(N(t))return function(t,n){for(var r=-1,e=null==t?0:t.length,o=Array(e);++r<e;)o[r]=n(t[r],r,t);return o}(t,Xt)+"";if(i(t))return Qt?Qt.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}function Yt(t,n){return N(t)?t:Ht(t,n)?[t]:zt(function(t){return null==t?"":Xt(t)}(t))}function Zt(t){if("string"==typeof t||i(t))return t;var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}function tn(t,n){for(var r=0,e=(n=Yt(n,t)).length;null!=t&&r<e;)t=t[Zt(n[r++])];return r&&r==e?t:void 0}function nn(t,n){return null!=t&&n in Object(t)}function rn(t,n){return Ht(t)&&Bt(n)?Nt(Zt(t),n):function(r){var e=function(t,n){var r=null==t?void 0:tn(t,n);return void 0===r?void 0:r}(r,t);return void 0===e&&e===n?function(t,n){return null!=t&&function(t,n,r){for(var e=-1,o=(n=Yt(n,t)).length,u=!1;++e<o;){var i=Zt(n[e]);if(!(u=null!=t&&r(t,i)))break;t=t[i]}return u||++e!=o?u:!!(o=null==t?0:t.length)&&tt(o)&&Z(i,o)&&(N(t)||U(t))}(t,n,nn)}(r,t):Tt(n,e,3)}}function en(t){return t}function on(t){return function(n){return null==n?void 0:n[t]}}function un(t){return"function"==typeof t?t:null==t?en:"object"==typeof t?N(t)?rn(t[0],t[1]):(e=function(t){for(var n=pt(t),r=n.length;r--;){var e=n[r],o=t[e];n[r]=[e,o,Bt(o)]}return n}(r=t),1==e.length&&e[0][2]?Nt(e[0][0],e[0][1]):function(t){return t===r||function(t,n,r){var e=r.length,o=e;if(null==t)return!o;for(t=Object(t);e--;){var u=r[e];if(u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++e<o;){var i=(u=r[e])[0],c=t[i];if(u[2]){if(void 0===c&&!(i in t))return!1}else if(!Tt(u[1],c,3,void 0,new $))return!1}return!0}(t,0,e)}):Ht(n=t)?on(Zt(n)):function(t){return function(n){return tn(n,t)}}(n);var n,r,e}var cn=1/0;function sn(t){return t?(t=c(t))===cn||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}var fn=Math.ceil,an=Math.max;function vn(n,r,e){if(!t(e))return!1;var o=typeof r;return!!("number"==o?bt(e)&&Z(r,e.length):"string"==o&&r in e)&&a(e[r],n)}const ln=(()=>{let t;return(...n)=>{t&&clearTimeout(t),t=setTimeout((()=>{t=0,(t=>{for(let n of t.keys()){const r=t.get(n).filter((t=>{const n=t.deref();return n&&(!("isConnected"in(r=n))||r.isConnected);var r}));t.set(n,r)}})(...n)}),2e3)}})(),hn=s.forceUpdate,bn=s.getRenderingRef,pn=(t,n)=>{const r=t.indexOf(n);r>=0&&(t[r]=t[t.length-1],t.length--)},dn=(t,n)=>{const r=((t,n=(t,n)=>t!==n)=>{const r=()=>{return("function"==typeof(n=t)?n():n)??{};var n},e=r();let o=new Map(Object.entries(e));const u="undefined"!=typeof Proxy,i=u?null:{},c={dispose:[],get:[],set:[],reset:[]},s=new Map,f=()=>{o=new Map(Object.entries(r())),u||p(),c.reset.forEach((t=>t()))},a=t=>(c.get.forEach((n=>n(t))),o.get(t)),v=(t,r)=>{const e=o.get(t);n(r,e,t)&&(o.set(t,r),u||b(t),c.set.forEach((n=>n(t,r,e))))},l=u?new Proxy(e,{get:(t,n)=>a(n),ownKeys:()=>Array.from(o.keys()),getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0}),has:(t,n)=>o.has(n),set:(t,n,r)=>(v(n,r),!0)}):(p(),i),h=(t,n)=>(c[t].push(n),()=>{pn(c[t],n)});function b(t){!u&&i&&(Object.prototype.hasOwnProperty.call(i,t)||Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:()=>a(t),set(n){v(t,n)}}))}function p(){if(u||!i)return;const t=new Set(o.keys());for(const n of Object.keys(i))t.has(n)||delete i[n];for(const n of t)b(n)}return{state:l,get:a,set:v,on:h,onChange:(t,n)=>{const e=(r,e)=>{r===t&&n(e)},o=()=>{const e=r();n(e[t])},u=h("set",e),i=h("reset",o);return s.set(n,{setHandler:e,resetHandler:o,propName:t}),()=>{u(),i(),s.delete(n)}},use:(...t)=>{const n=t.reduce(((t,n)=>(n.set&&t.push(h("set",n.set)),n.get&&t.push(h("get",n.get)),n.reset&&t.push(h("reset",n.reset)),n.dispose&&t.push(h("dispose",n.dispose)),t)),[]);return()=>n.forEach((t=>t()))},dispose:()=>{c.dispose.forEach((t=>t())),f()},reset:f,forceUpdate:t=>{const n=o.get(t);c.set.forEach((r=>r(t,n,n)))},removeListener:(t,n)=>{const r=s.get(n);r&&r.propName===t&&(pn(c.set,r.setHandler),pn(c.reset,r.resetHandler),s.delete(n))}}})(t,n);return r.use((()=>{if("function"!=typeof bn||"function"!=typeof hn)return{};const t=hn,n=bn,r=new Map;return{dispose:()=>r.clear(),get:t=>{const e=n();e&&((t,n,r)=>{let e=t.get(n);e||(e=[],t.set(n,e)),e.some((t=>t.deref()===r))||e.push(new WeakRef(r))})(r,t,e)},set:n=>{const e=r.get(n);if(e){const o=e.filter((n=>{const r=n.deref();return!!r&&t(r)}));r.set(n,o)}ln(r)},reset:()=>{r.forEach((n=>{n.forEach((n=>{const r=n.deref();r&&t(r)}))})),ln(r)}}})()),r},mn=t=>({set(n,r){switch(n){case"trimmed":{const n=t.get("proxyItems"),e=jn(r),o=n.filter((t=>!e[t]));t.set("items",o);break}}}});function jn(t){const n={};for(let r in t)for(let e in t[r])n[e]=n[e]||t[r][e];return n}function yn(t,n){Object.entries(n).forEach((([n,r])=>{t.set(n,r)}))}class wn{get store(){return this.dataStore}constructor(t,n){const r=this.dataStore=dn(Object.assign({items:[],proxyItems:[],source:[],groupingDepth:0,groups:{},type:t,trimmed:{},groupingCustomRenderer:void 0},n));r.use(f(r)),r.use(mn(r))}updateData(t,n,r=!1,e=!1){const o=this.store.get("trimmed"),u=r&&e?jn(o):null;r||this.store.set("trimmed",{}),this.store.set("items",[]);const i=(c=0,s=(null==t?void 0:t.length)||0,f&&"number"!=typeof f&&vn(c,s,f)&&(s=f=void 0),c=sn(c),void 0===s?(s=c,c=0):s=sn(s),function(t,n,r){for(var e=-1,o=an(fn((n-t)/(r||1)),0),u=Array(o);o--;)u[++e]=t,t+=r;return u}(c,s,f=void 0===f?c<s?1:-1:sn(f)));var c,s,f;yn(this.store,{source:t,proxyItems:[...i]}),this.store.set("items",u?i.filter((t=>!u[t])):i),n&&yn(this.store,{groupingDepth:n.depth,groups:n.groups,groupingCustomRenderer:n.customRenderer})}addTrimmed(t){let n=this.store.get("trimmed");n=Object.assign(Object.assign({},n),t),yn(this.store,{trimmed:n})}setSourceData(t,n=!0){An(this.store,t,n)}setData(t){const n=Object.assign({},t);yn(this.store,n)}refresh(){const t=this.store.get("source");this.store.set("source",[...t])}}function gn(t,n){return t.get("items")[n]}function On(t){const n=t.get("source");return t.get("items").map((t=>n[t]))}const _n=(t,n)=>t.get("source")[xn(t,n)],xn=(t,n)=>t.get("items")[n];function An(t,n,r=!0){const e=t.get("items"),o=t.get("source");for(let t in n)o[e[t]]=n[t];r&&t.set("source",[...o])}function Dn(t,n,r=!0){const e=t.get("source");for(let t in n)e[t]=n[t];r&&t.set("source",[...e])}function Mn(t,n){t.set("items",n)}function Sn(t,n){const r=t.get("items"),e=null!=(o=t.get("source"))&&o.length?function(t,n){for(var r=t.length,e=-1;++e<r;)if(n(t[e],e,t))return e;return-1}(o,un({prop:n})):-1;var o;return r.indexOf(e)}export{wn as D,On as a,_n as b,xn as c,Dn as d,Mn as e,Sn as f,gn as g,jn as h,yn as i,dn as j,en as k,N as l,on as m,bt as n,Ct as o,f as p,ht as q,sn as r,An as s,mn as t,pt as u,un as v,vn as w}