@visactor/vtable-calendar 1.23.3-alpha.0 → 1.24.0-alpha.0

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.
@@ -627,28 +627,59 @@
627
627
  }
628
628
  addEventListener(type, listener, options) {
629
629
  if (!listener) return;
630
+ const capture = this._resolveCapture(options),
631
+ once = this._resolveOnce(options),
632
+ listenerTypeMap = this._getOrCreateListenerTypeMap(type),
633
+ wrappedMap = this._getOrCreateWrappedMap(listenerTypeMap, listener);
634
+ if (wrappedMap.has(capture)) return;
630
635
  const wrappedListener = event => {
631
636
  const transformedEvent = this._eventListenerTransformer(event);
632
- "function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent);
637
+ "function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent), once && this._deleteListenerRecord(type, listener, capture);
633
638
  };
634
- this._listenerMap.has(type) || this._listenerMap.set(type, new Map()), this._listenerMap.get(type).set(listener, wrappedListener), this._nativeAddEventListener(type, wrappedListener, options);
639
+ wrappedMap.set(capture, {
640
+ wrappedListener: wrappedListener,
641
+ options: options
642
+ }), this._nativeAddEventListener(type, wrappedListener, options);
635
643
  }
636
644
  removeEventListener(type, listener, options) {
637
- var _a;
645
+ var _a, _b;
638
646
  if (!listener) return;
639
- const wrappedListener = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener);
640
- wrappedListener && (this._nativeRemoveEventListener(type, wrappedListener, options), this._listenerMap.get(type).delete(listener), 0 === this._listenerMap.get(type).size && this._listenerMap.delete(type));
647
+ const capture = this._resolveCapture(options),
648
+ wrappedRecord = null === (_b = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener)) || void 0 === _b ? void 0 : _b.get(capture);
649
+ wrappedRecord && (this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture), this._deleteListenerRecord(type, listener, capture));
641
650
  }
642
651
  dispatchEvent(event) {
643
652
  return this._nativeDispatchEvent(event);
644
653
  }
645
654
  clearAllEventListeners() {
646
- this._listenerMap.forEach((listenersMap, type) => {
647
- listenersMap.forEach((wrappedListener, originalListener) => {
648
- this._nativeRemoveEventListener(type, wrappedListener, void 0);
655
+ this._listenerMap.forEach((listenerMap, type) => {
656
+ listenerMap.forEach(wrappedMap => {
657
+ wrappedMap.forEach((wrappedRecord, capture) => {
658
+ this._nativeRemoveEventListener(type, wrappedRecord.wrappedListener, capture);
659
+ });
649
660
  });
650
661
  }), this._listenerMap.clear();
651
662
  }
663
+ _resolveCapture(options) {
664
+ return "boolean" == typeof options ? options : !!(null == options ? void 0 : options.capture);
665
+ }
666
+ _resolveOnce(options) {
667
+ return "object" == typeof options && !!(null == options ? void 0 : options.once);
668
+ }
669
+ _getOrCreateListenerTypeMap(type) {
670
+ let listenerTypeMap = this._listenerMap.get(type);
671
+ return listenerTypeMap || (listenerTypeMap = new Map(), this._listenerMap.set(type, listenerTypeMap)), listenerTypeMap;
672
+ }
673
+ _getOrCreateWrappedMap(listenerTypeMap, listener) {
674
+ let wrappedMap = listenerTypeMap.get(listener);
675
+ return wrappedMap || (wrappedMap = new Map(), listenerTypeMap.set(listener, wrappedMap)), wrappedMap;
676
+ }
677
+ _deleteListenerRecord(type, listener, capture) {
678
+ const listenerTypeMap = this._listenerMap.get(type);
679
+ if (!listenerTypeMap) return;
680
+ const wrappedMap = listenerTypeMap.get(listener);
681
+ wrappedMap && (wrappedMap.delete(capture), 0 === wrappedMap.size && listenerTypeMap.delete(listener), 0 === listenerTypeMap.size && this._listenerMap.delete(type));
682
+ }
652
683
  _nativeAddEventListener(type, listener, options) {
653
684
  throw new Error("_nativeAddEventListener must be implemented by derived classes");
654
685
  }
@@ -7162,7 +7193,9 @@
7162
7193
  var _a;
7163
7194
  if (event.manager !== this) throw new Error("It is illegal to free an event not managed by this EventManager!");
7164
7195
  const constructor = event.constructor;
7165
- this.eventPool.has(constructor) || this.eventPool.set(constructor, []), null === (_a = this.eventPool.get(constructor)) || void 0 === _a || _a.push(event);
7196
+ this.eventPool.has(constructor) || (this.eventPool.get(constructor).forEach(e => {
7197
+ e.eventPhase = event.NONE, e.currentTarget = null, e.path = [], e.detailPath = [], e.target = null;
7198
+ }), this.eventPool.set(constructor, [])), null === (_a = this.eventPool.get(constructor)) || void 0 === _a || _a.push(event);
7166
7199
  }
7167
7200
  notifyListeners(e, type) {
7168
7201
  const listeners = e.currentTarget._events[type];
@@ -9766,7 +9799,7 @@
9766
9799
  });
9767
9800
  }
9768
9801
  release() {
9769
- this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this);
9802
+ this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this), super.release();
9770
9803
  }
9771
9804
  _emitCustomEvent(type, context) {
9772
9805
  var _a, _b;
@@ -17173,12 +17206,12 @@
17173
17206
  throw new Error("暂不支持");
17174
17207
  }
17175
17208
  release() {
17176
- var _a, _b;
17209
+ var _a, _b, _d;
17177
17210
  super.release(), this.hooks.beforeRender.unTap("constructor", this.beforeRender), this.hooks.afterRender.unTap("constructor", this.afterRender), this.eventSystem && this.eventSystem.release(), this.layerService.releaseStage(this), this.pluginService.release(), this.forEach(layer => {
17178
17211
  layer.release();
17179
17212
  }), this.interactiveLayer && (this.interactiveLayer.forEachChildren(item => {
17180
17213
  item.setStage && item.setStage(null, null), this.interactiveLayer.removeChild(item);
17181
- }), this.interactiveLayer.release()), this.window.release(), null === (_a = this._ticker) || void 0 === _a || _a.remTimeline(null == this ? void 0 : this.timeline), null === (_b = this._ticker) || void 0 === _b || _b.removeListener("tick", this.afterTickCb), this.renderService.renderTreeRoots = [];
17214
+ }), this.interactiveLayer.release()), this.window.release(), null === (_a = this._ticker) || void 0 === _a || _a.remTimeline(null == this ? void 0 : this.timeline), null === (_b = this._ticker) || void 0 === _b || _b.removeListener("tick", this.afterTickCb), this.params.ticker || null === (_d = this._ticker) || void 0 === _d || _d.release(), this.renderService.renderTreeRoots = [];
17182
17215
  }
17183
17216
  setStage(stage) {}
17184
17217
  dirty(b, matrix) {
@@ -32593,7 +32626,7 @@
32593
32626
  };
32594
32627
  }
32595
32628
  release(all) {
32596
- super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
32629
+ super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).removeEventListener("touchmove", this._handleTouchMove, {
32597
32630
  passive: !1
32598
32631
  }), this._clearAllDragEvents();
32599
32632
  }
@@ -33875,6 +33908,7 @@
33875
33908
  };
33876
33909
  }
33877
33910
  on(type, listener) {
33911
+ if (!this.listenersData) return;
33878
33912
  const list = this.listenersData.listeners[type] || (this.listenersData.listeners[type] = []);
33879
33913
  list.push(listener);
33880
33914
  const id = idCount$1++;
@@ -33882,9 +33916,10 @@
33882
33916
  type: type,
33883
33917
  listener: listener,
33884
33918
  remove: () => {
33919
+ if (!this.listenersData) return;
33885
33920
  delete this.listenersData.listenerData[id];
33886
33921
  const index = list.indexOf(listener);
33887
- list.splice(index, 1), this.listenersData.listeners[type].length || delete this.listenersData.listeners[type];
33922
+ list.splice(index, 1), this.listenersData.listeners[type] && !this.listenersData.listeners[type].length && delete this.listenersData.listeners[type];
33888
33923
  }
33889
33924
  }, id;
33890
33925
  }
@@ -34886,6 +34921,8 @@
34886
34921
  RESIZE_COLUMN_END: "resize_column_end",
34887
34922
  RESIZE_ROW: "resize_row",
34888
34923
  RESIZE_ROW_END: "resize_row_end",
34924
+ MERGE_CELLS: "merge_cells",
34925
+ UNMERGE_CELLS: "unmerge_cells",
34889
34926
  CHANGE_HEADER_POSITION_START: "change_header_position_start",
34890
34927
  CHANGE_HEADER_POSITION: "change_header_position",
34891
34928
  CHANGING_HEADER_POSITION: "changing_header_position",
@@ -37338,7 +37375,7 @@
37338
37375
  }
37339
37376
  clearFilteredChildren(record) {
37340
37377
  var _a, _b;
37341
- record.filteredChildren = void 0;
37378
+ record.filteredChildren = void 0, delete record.filteredChildren;
37342
37379
  for (let i = 0; i < (null !== (_b = null === (_a = record.children) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0); i++) this.clearFilteredChildren(record.children[i]);
37343
37380
  }
37344
37381
  filterRecord(record) {
@@ -37441,8 +37478,9 @@
37441
37478
  fieldPromiseCallBack(_index, _field, _value) {}
37442
37479
  recordPromiseCallBack(_index, _record) {}
37443
37480
  canChangeOrder(sourceIndex, targetIndex) {
37444
- var _a;
37481
+ var _a, _b;
37445
37482
  if (null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.canChangeOrder) return this.dataSourceObj.canChangeOrder(sourceIndex, targetIndex);
37483
+ if (null === (_b = this.lastSortStates) || void 0 === _b ? void 0 : _b.some(state => "asc" === state.order || "desc" === state.order)) return !1;
37446
37484
  if (this.hasHierarchyStateExpand) {
37447
37485
  let sourceIndexs = this.currentPagerIndexedData[sourceIndex],
37448
37486
  targetIndexs = this.currentPagerIndexedData[targetIndex];
@@ -41445,7 +41483,7 @@
41445
41483
  function updateCell$1(col, row, table, addNew, isShadow, forceFastUpdate) {
41446
41484
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
41447
41485
  const oldCellGroup = table.scenegraph.highPerformanceGetCell(col, row, !0);
41448
- if ("cell" !== oldCellGroup.role && !addNew) return;
41486
+ if ("cell" !== oldCellGroup.role && "shadow-cell" !== oldCellGroup.role && !addNew) return;
41449
41487
  const cellLocation = table.getCellLocation(col, row);
41450
41488
  let isMerge,
41451
41489
  range,
@@ -48895,7 +48933,7 @@
48895
48933
  }), scene.tableGroup.role = "table";
48896
48934
  const colHeaderGroup = createContainerGroup(0, 0, !scene.table.internalProps.enableTreeStickCell);
48897
48935
  colHeaderGroup.role = "col-header", scene.colHeaderGroup = colHeaderGroup;
48898
- const cornerHeaderGroup = createContainerGroup(0, 0, !scene.table.options.enableTreeStickCell);
48936
+ const cornerHeaderGroup = createContainerGroup(0, 0, !scene.table.internalProps.enableTreeStickCell);
48899
48937
  cornerHeaderGroup.role = "corner-header", scene.cornerHeaderGroup = cornerHeaderGroup;
48900
48938
  const rowHeaderGroup = createContainerGroup(0, 0, !0);
48901
48939
  rowHeaderGroup.role = "row-header", scene.rowHeaderGroup = rowHeaderGroup;
@@ -51693,13 +51731,13 @@
51693
51731
  setSortState(sortState) {
51694
51732
  const state = this;
51695
51733
  const sort = (sortState = !sortState || Array.isArray(sortState) ? sortState : [sortState]) && sortState.reduce((prev, item) => {
51696
- var _a, _b, _c;
51734
+ var _a, _b, _c, _d, _e;
51697
51735
  const column = null === (_a = function (columns) {
51698
51736
  const result = [];
51699
51737
  return function flatten(cols, parentStartIndex = 0) {
51700
51738
  cols.forEach(col => {
51701
51739
  var _a;
51702
- const startIndex = col.startInTotal ? null !== (_a = col.startInTotal + state.table.internalProps.layoutMap.leftRowSeriesNumberColumnCount) && void 0 !== _a ? _a : 0 : parentStartIndex;
51740
+ const startIndex = col.startInTotal ? col.startInTotal + (null !== (_a = state.table.internalProps.layoutMap.leftRowSeriesNumberColumnCount) && void 0 !== _a ? _a : 0) : parentStartIndex;
51703
51741
  col.columns ? flatten(col.columns, startIndex) : result.push(Object.assign(Object.assign({}, col), {
51704
51742
  startIndex: startIndex
51705
51743
  }));
@@ -51709,12 +51747,12 @@
51709
51747
  return this.table.internalProps.transpose ? prev.push({
51710
51748
  field: item.field,
51711
51749
  order: item.order,
51712
- row: null !== (_b = (null == column ? void 0 : column.startInTotal) + this.table.internalProps.layoutMap.leftRowSeriesNumberColumnCount) && void 0 !== _b ? _b : 0,
51750
+ row: (null !== (_b = null == column ? void 0 : column.startInTotal) && void 0 !== _b ? _b : 0) + (null !== (_c = this.table.internalProps.layoutMap.leftRowSeriesNumberColumnCount) && void 0 !== _c ? _c : 0),
51713
51751
  col: null == column ? void 0 : column.level
51714
51752
  }) : prev.push({
51715
51753
  field: item.field,
51716
51754
  order: item.order,
51717
- col: null !== (_c = (null == column ? void 0 : column.startInTotal) + this.table.internalProps.layoutMap.leftRowSeriesNumberColumnCount) && void 0 !== _c ? _c : 0,
51755
+ col: (null !== (_d = null == column ? void 0 : column.startInTotal) && void 0 !== _d ? _d : 0) + (null !== (_e = this.table.internalProps.layoutMap.leftRowSeriesNumberColumnCount) && void 0 !== _e ? _e : 0),
51718
51756
  row: null == column ? void 0 : column.level
51719
51757
  }), prev;
51720
51758
  }, []);
@@ -52226,13 +52264,16 @@
52226
52264
  this.select.selectInline = selectInline;
52227
52265
  }
52228
52266
  updateSortState(sortState) {
52229
- var _a, _b, _c, _d, _e, _f, _g, _h;
52230
- sortState = Array.isArray(sortState) ? sortState : [sortState];
52267
+ var _a, _b, _c, _d, _e, _f, _g;
52268
+ const isSame = (sortState = Array.isArray(sortState) ? sortState : [sortState]).length === this.sort.length && sortState.every((item, index) => {
52269
+ var _a, _b;
52270
+ return (null == item ? void 0 : item.field) === (null === (_a = this.sort[index]) || void 0 === _a ? void 0 : _a.field) && (null == item ? void 0 : item.order) === (null === (_b = this.sort[index]) || void 0 === _b ? void 0 : _b.order);
52271
+ });
52272
+ if (isSame) return;
52231
52273
  for (let index = 0; index < sortState.length; index++) {
52232
- if (sortState[index].field === (null === (_a = this.sort[index]) || void 0 === _a ? void 0 : _a.field) && sortState[sortState.length - 1].order === (null === (_b = this.sort[index]) || void 0 === _b ? void 0 : _b.order)) return;
52233
- const oldSortCol = this.table.internalProps.multipleSort ? null : (null === (_c = this.sort[index]) || void 0 === _c ? void 0 : _c.col) || null,
52234
- oldSortRow = this.table.internalProps.multipleSort ? null : (null === (_d = this.sort[index]) || void 0 === _d ? void 0 : _d.row) || null;
52235
- "asc" === (null === (_e = this.sort[index]) || void 0 === _e ? void 0 : _e.order) || null === (_f = this.sort[index]) || void 0 === _f || _f.order;
52274
+ const oldSortCol = this.table.internalProps.multipleSort ? null : (null === (_a = this.sort[index]) || void 0 === _a ? void 0 : _a.col) || null,
52275
+ oldSortRow = this.table.internalProps.multipleSort ? null : (null === (_b = this.sort[index]) || void 0 === _b ? void 0 : _b.row) || null;
52276
+ "asc" === (null === (_c = this.sort[index]) || void 0 === _c ? void 0 : _c.order) || null === (_d = this.sort[index]) || void 0 === _d || _d.order;
52236
52277
  this.setSortState(sortState.slice(0, index + 1));
52237
52278
  const cellAddress = this.table.internalProps.layoutMap.getHeaderCellAddressByField(sortState[index].field);
52238
52279
  this.sort[index].col = cellAddress.col, this.sort[index].row = cellAddress.row;
@@ -52245,7 +52286,7 @@
52245
52286
  order: this.sort[index].order,
52246
52287
  oldSortCol: oldSortCol,
52247
52288
  oldSortRow: oldSortRow,
52248
- oldIconMark: null === (_g = this.sort[index]) || void 0 === _g ? void 0 : _g.icon
52289
+ oldIconMark: null === (_e = this.sort[index]) || void 0 === _e ? void 0 : _e.icon
52249
52290
  });
52250
52291
  }
52251
52292
  const normalHeaders = [];
@@ -52259,7 +52300,7 @@
52259
52300
  row: null,
52260
52301
  iconMark: null,
52261
52302
  order: null,
52262
- oldSortCol: null !== (_h = column.startInTotal + this.table.internalProps.layoutMap.leftRowSeriesNumberColumnCount) && void 0 !== _h ? _h : 0,
52303
+ oldSortCol: (null !== (_f = column.startInTotal) && void 0 !== _f ? _f : 0) + (null !== (_g = this.table.internalProps.layoutMap.leftRowSeriesNumberColumnCount) && void 0 !== _g ? _g : 0),
52263
52304
  oldSortRow: column.level,
52264
52305
  oldIconMark: null
52265
52306
  });
@@ -56389,11 +56430,11 @@
56389
56430
  onUpdate(end, ratio, out) {
56390
56431
  if (this.from.x !== this.to.x) {
56391
56432
  const x = end ? this.to.x : this.from.x + Math.floor((this.to.x - this.from.x) * ratio);
56392
- this.params.table.scrollLeft = x;
56433
+ this.params.table.scrollLeft = x, 1 === ratio && -1 !== this.to.targetCol && this.params.table.scrollToCol(this.to.targetCol, !1);
56393
56434
  }
56394
56435
  if (this.from.y !== this.to.y) {
56395
56436
  const y = end ? this.to.y : this.from.y + Math.floor((this.to.y - this.from.y) * ratio);
56396
- this.params.table.scrollTop = y;
56437
+ this.params.table.scrollTop = y, 1 === ratio && -1 !== this.to.targetRow && this.params.table.scrollToRow(this.to.targetRow, !1);
56397
56438
  }
56398
56439
  }
56399
56440
  }
@@ -56425,7 +56466,9 @@
56425
56466
  colDecimal && (left += colDecimal * cellRect.width), rowDecimal && (top += rowDecimal * cellRect.height);
56426
56467
  const to = {
56427
56468
  x: isNumber$2(col) ? left - this.table.getFrozenColsWidth() : this.table.scrollLeft,
56428
- y: isNumber$2(row) ? top - this.table.getFrozenRowsHeight() : this.table.scrollTop
56469
+ y: isNumber$2(row) ? top - this.table.getFrozenRowsHeight() : this.table.scrollTop,
56470
+ targetRow: null != rowInt ? rowInt : -1,
56471
+ targetCol: null != colInt ? colInt : -1
56429
56472
  },
56430
56473
  duration = isBoolean$2(animationOption) ? animationOption ? 3e3 : 0 : null !== (_a = null == animationOption ? void 0 : animationOption.duration) && void 0 !== _a ? _a : 3e3,
56431
56474
  easing = isBoolean$2(animationOption) ? animationOption ? "linear" : "" : null !== (_b = null == animationOption ? void 0 : animationOption.easing) && void 0 !== _b ? _b : "linear";
@@ -56512,7 +56555,7 @@
56512
56555
  }
56513
56556
  constructor(container, options = {}) {
56514
56557
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
56515
- if (super(), this.showFrozenIcon = !0, this._tableBorderWidth_left = 0, this._tableBorderWidth_right = 0, this._tableBorderWidth_top = 0, this._tableBorderWidth_bottom = 0, this.version = "1.23.3-alpha.0", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
56558
+ if (super(), this.showFrozenIcon = !0, this._scrollToRowCorrectTimer = null, this._tableBorderWidth_left = 0, this._tableBorderWidth_right = 0, this._tableBorderWidth_top = 0, this._tableBorderWidth_bottom = 0, this.version = "1.24.0-alpha.0", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
56516
56559
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
56517
56560
  options: options,
56518
56561
  container: container
@@ -57450,12 +57493,15 @@
57450
57493
  dispose() {
57451
57494
  this.release();
57452
57495
  }
57496
+ clearCorrectTimer() {
57497
+ this._scrollToRowCorrectTimer && (clearTimeout(this._scrollToRowCorrectTimer), this._scrollToRowCorrectTimer = null);
57498
+ }
57453
57499
  release() {
57454
57500
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
57455
57501
  null === (_c = null === (_b = null === (_a = this.scenegraph) || void 0 === _a ? void 0 : _a.component) || void 0 === _b ? void 0 : _b.vScrollBar) || void 0 === _c || _c.release(), null === (_f = null === (_e = null === (_d = this.scenegraph) || void 0 === _d ? void 0 : _d.component) || void 0 === _e ? void 0 : _e.hScrollBar) || void 0 === _f || _f.release(), this.animationManager.clear(), this.animationManager.ticker.release(), null === (_j = null === (_h = null === (_g = this.scenegraph) || void 0 === _g ? void 0 : _g.stage) || void 0 === _h ? void 0 : _h.ticker) || void 0 === _j || _j.release();
57456
57502
  const internalProps = this.internalProps;
57457
57503
  if (this.isReleased) return;
57458
- null === (_l = null === (_k = internalProps.tooltipHandler) || void 0 === _k ? void 0 : _k.release) || void 0 === _l || _l.call(_k), null === (_o = null === (_m = internalProps.menuHandler) || void 0 === _m ? void 0 : _m.release) || void 0 === _o || _o.call(_m), null === (_p = super.release) || void 0 === _p || _p.call(this), this.pluginManager.release(), null === (_r = null === (_q = internalProps.handler) || void 0 === _q ? void 0 : _q.release) || void 0 === _r || _r.call(_q), this.eventManager.release(), null === (_t = null === (_s = internalProps.focusControl) || void 0 === _s ? void 0 : _s.release) || void 0 === _t || _t.call(_s), null === (_u = internalProps.legends) || void 0 === _u || _u.forEach(legend => {
57504
+ this.clearCorrectTimer(), null === (_l = null === (_k = internalProps.tooltipHandler) || void 0 === _k ? void 0 : _k.release) || void 0 === _l || _l.call(_k), null === (_o = null === (_m = internalProps.menuHandler) || void 0 === _m ? void 0 : _m.release) || void 0 === _o || _o.call(_m), null === (_p = super.release) || void 0 === _p || _p.call(this), this.pluginManager.release(), null === (_r = null === (_q = internalProps.handler) || void 0 === _q ? void 0 : _q.release) || void 0 === _r || _r.call(_q), this.eventManager.release(), null === (_t = null === (_s = internalProps.focusControl) || void 0 === _s ? void 0 : _s.release) || void 0 === _t || _t.call(_s), null === (_u = internalProps.legends) || void 0 === _u || _u.forEach(legend => {
57459
57505
  null == legend || legend.release();
57460
57506
  }), null === (_v = internalProps.title) || void 0 === _v || _v.release(), internalProps.title = null, null === (_w = internalProps.emptyTip) || void 0 === _w || _w.release(), internalProps.emptyTip = null, internalProps.layoutMap.release(), internalProps.releaseList && (internalProps.releaseList.forEach(releaseObj => {
57461
57507
  var _a;
@@ -57760,6 +57806,30 @@
57760
57806
  lastSelectRange = currentSelectRanges[currentSelectRanges.length - 1];
57761
57807
  lastSelectRange && (lastSelectRange.end.row = rowIndex), this.stateManager.updateSelectPos(this.colCount - 1, rowIndex, !1, isCtrl, !1, makeSelectCellVisible, !0), this.stateManager.select.selecting = !1;
57762
57808
  }
57809
+ changeHeaderPosition(args) {
57810
+ var _a, _b, _c, _d, _e;
57811
+ if (!("canMoveHeaderPosition" in this.internalProps.layoutMap) || !0 === (null === (_a = this.options.customConfig) || void 0 === _a ? void 0 : _a.notUpdateInColumnRowMove)) return !1;
57812
+ const prevMoving = this.stateManager.columnMove.movingColumnOrRow;
57813
+ this.stateManager.columnMove.movingColumnOrRow = args.movingColumnOrRow;
57814
+ try {
57815
+ if (!1 === (null === (_c = (_b = this.internalProps.layoutMap).canMoveHeaderPosition) || void 0 === _c ? void 0 : _c.call(_b, args.source, args.target))) return !1;
57816
+ const oldSourceMergeInfo = this.getCellRange(args.source.col, args.source.row),
57817
+ oldTargetMergeInfo = this.getCellRange(args.target.col, args.target.row),
57818
+ moveContext = this._moveHeaderPosition(args.source, args.target);
57819
+ if (!moveContext || moveContext.targetIndex === moveContext.sourceIndex) return !1;
57820
+ this.internalProps.useOneRowHeightFillAll = !1, this.internalProps.layoutMap.clearCellRangeMap();
57821
+ const sourceMergeInfo = this.getCellRange(args.source.col, args.source.row),
57822
+ targetMergeInfo = this.getCellRange(args.target.col, args.target.row),
57823
+ colMin = Math.min(sourceMergeInfo.start.col, targetMergeInfo.start.col, oldSourceMergeInfo.start.col, oldTargetMergeInfo.start.col),
57824
+ colMax = Math.max(sourceMergeInfo.end.col, targetMergeInfo.end.col, oldSourceMergeInfo.end.col, oldTargetMergeInfo.end.col),
57825
+ rowMin = Math.min(sourceMergeInfo.start.row, targetMergeInfo.start.row, oldSourceMergeInfo.start.row, oldTargetMergeInfo.start.row);
57826
+ let rowMax = Math.max(sourceMergeInfo.end.row, targetMergeInfo.end.row, oldSourceMergeInfo.end.row, oldTargetMergeInfo.end.row);
57827
+ if ("row" === moveContext.moveType && "tree" === this.internalProps.layoutMap.rowHierarchyType && (rowMax = moveContext.targetIndex > moveContext.sourceIndex ? rowMax + moveContext.targetSize - 1 : rowMax + moveContext.sourceSize - 1), this.transpose || !this.isSeriesNumberInBody(args.source.col, args.source.row) && "row" !== args.movingColumnOrRow || (this.changeRecordOrder(moveContext.sourceIndex, moveContext.targetIndex), this.stateManager.changeCheckboxAndRadioOrder(moveContext.sourceIndex, moveContext.targetIndex)), "column" === moveContext.moveType) for (let col = colMin; col <= colMax; col++) this._clearColRangeWidthsMap(col);else for (let row = rowMin; row <= rowMax; row++) this._clearRowRangeHeightsMap(row);
57828
+ return this.clearCellStyleCache(), this.isSeriesNumberInBody(args.source.col, args.source.row) || "row" === args.movingColumnOrRow ? this.scenegraph.updateHeaderPosition(this.scenegraph.proxy.colStart, this.scenegraph.proxy.colEnd, this.scenegraph.proxy.rowStart, this.scenegraph.proxy.rowEnd, moveContext.moveType) : "column" === moveContext.moveType ? this.scenegraph.updateHeaderPosition(colMin, colMax, 0, -1, moveContext.moveType) : this.scenegraph.updateHeaderPosition(0, -1, rowMin, rowMax, moveContext.moveType), "adjustFrozenCount" === this.internalProps.frozenColDragHeaderMode && this.isListTable() && (this.isLeftFrozenColumn(args.target.col) && !this.isLeftFrozenColumn(args.source.col) ? this.frozenColCount += sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1 : this.isLeftFrozenColumn(args.source.col) && !this.isLeftFrozenColumn(args.target.col) && (this.frozenColCount -= sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1), this.isRightFrozenColumn(args.target.col) && !this.isRightFrozenColumn(args.source.col) ? this.rightFrozenColCount += sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1 : this.isRightFrozenColumn(args.source.col) && !this.isRightFrozenColumn(args.target.col) && (this.rightFrozenColCount -= sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1)), null === (_e = (_d = this.scenegraph).updateNextFrame) || void 0 === _e || _e.call(_d), !0;
57829
+ } finally {
57830
+ this.stateManager.columnMove.movingColumnOrRow = prevMoving;
57831
+ }
57832
+ }
57763
57833
  get recordsCount() {
57764
57834
  var _a;
57765
57835
  return null === (_a = this.records) || void 0 === _a ? void 0 : _a.length;
@@ -57905,7 +57975,7 @@
57905
57975
  getCustomMerge(col, row) {
57906
57976
  if (this.internalProps.customMergeCell) {
57907
57977
  const customMerge = this.internalProps.customMergeCell(col, row, this);
57908
- if (customMerge && customMerge.range && (isValid$1(customMerge.text) || customMerge.customLayout || this.customRender)) {
57978
+ if (customMerge && customMerge.range) {
57909
57979
  if (customMerge.style) {
57910
57980
  const styleClass = this.internalProps.bodyHelper.getStyleClass("text"),
57911
57981
  style = customMerge.style,
@@ -58616,12 +58686,36 @@
58616
58686
  this.eventManager.enableScroll();
58617
58687
  }
58618
58688
  getGroupTitleLevel(col, row) {}
58689
+ getTargetScrollTop(row) {
58690
+ const drawRange = this.getDrawRange(),
58691
+ frozenHeight = this.getFrozenRowsHeight(),
58692
+ rowsHeight = Math.ceil(this.rowHeightsMap.getSumInRange(0, row - 1)),
58693
+ allRowsHeight = this.getAllRowsHeight();
58694
+ return Math.max(0, Math.min(rowsHeight - frozenHeight, allRowsHeight - drawRange.height));
58695
+ }
58696
+ _scheduleScrollToRowCorrect(row, delay = 0) {
58697
+ this._scrollToRowCorrectTimer = setTimeout(() => {
58698
+ this.clearCorrectTimer();
58699
+ const targetScrollTop = this.getTargetScrollTop(row);
58700
+ if (targetScrollTop !== this.scrollTop) {
58701
+ this.scrollTop = targetScrollTop;
58702
+ const correctedTargetScrollTop = this.getTargetScrollTop(row);
58703
+ correctedTargetScrollTop !== this.scrollTop && (this.scrollTop = correctedTargetScrollTop);
58704
+ }
58705
+ }, delay);
58706
+ }
58619
58707
  scrollToRow(row, animationOption) {
58620
- animationOption ? this.animationManager.scrollTo({
58621
- row: row
58622
- }, animationOption) : this.scrollToCell({
58623
- row: row
58624
- });
58708
+ var _a;
58709
+ const targetRow = Math.min(Math.max(Math.floor(row), 0), this.rowCount - 1);
58710
+ if (this.clearCorrectTimer(), !animationOption) return this.scrollToCell({
58711
+ row: targetRow
58712
+ }), void this._scheduleScrollToRowCorrect(targetRow);
58713
+ const duration = isBoolean$2(animationOption) ? 3e3 : null !== (_a = null == animationOption ? void 0 : animationOption.duration) && void 0 !== _a ? _a : 3e3;
58714
+ this.animationManager.scrollTo({
58715
+ row: targetRow
58716
+ }, animationOption), this._scrollToRowCorrectTimer = setTimeout(() => {
58717
+ this.scrollToRow(targetRow, !1);
58718
+ }, duration);
58625
58719
  }
58626
58720
  scrollToCol(col, animationOption) {
58627
58721
  animationOption ? this.animationManager.scrollTo({
@@ -58640,8 +58734,8 @@
58640
58734
  }
58641
58735
  if (isValid$1(cellAddr.row) && cellAddr.row >= this.frozenRowCount) {
58642
58736
  const frozenHeight = this.getFrozenRowsHeight(),
58643
- top = this.getRowsHeight(0, cellAddr.row - 1);
58644
- this.scrollTop = Math.min(top - frozenHeight, this.getAllRowsHeight() - drawRange.height);
58737
+ top = this.rowHeightsMap.getSumInRange(0, cellAddr.row - 1);
58738
+ this.scrollTop = Math.min(top - frozenHeight, this.rowHeightsMap.getSumInRange(0, this.rowCount - 1) - drawRange.height);
58645
58739
  }
58646
58740
  this.render();
58647
58741
  }
@@ -59253,9 +59347,24 @@
59253
59347
  return layout._cellRangeMap.set(`$${col}$${row}`, cellRange), cellRange;
59254
59348
  }
59255
59349
  function getTreeTitleMerge(col, row, cellRange, layout) {
59350
+ var _a;
59256
59351
  if ("tree" !== layout.rowHierarchyType) return;
59257
- const cellRecord = layout._table.getCellRawRecord(col, row);
59258
- layout._table.internalProps.groupTitleCheckbox && layout._table.internalProps.rowSeriesNumber ? (null == cellRecord ? void 0 : cellRecord.vtableMerge) && col >= layout.leftRowSeriesNumberColumnCount && (cellRange.start.col = layout.rowHeaderLevelCount + layout.leftRowSeriesNumberColumnCount, cellRange.end.col = layout.colCount - 1, cellRange.start.row = cellRange.end.row = row) : (null == cellRecord ? void 0 : cellRecord.vtableMerge) && (cellRange.start.col = layout.rowHeaderLevelCount, cellRange.end.col = layout.colCount - 1, cellRange.start.row = cellRange.end.row = row);
59352
+ const table = layout._table,
59353
+ internalProps = table.internalProps || {},
59354
+ isGroupMode = !!internalProps.groupBy,
59355
+ cellRecord = table.getCellRawRecord(col, row);
59356
+ if (!(null == cellRecord ? void 0 : cellRecord.vtableMerge)) return;
59357
+ const treeTitleStartCol = internalProps.groupTitleCheckbox && internalProps.rowSeriesNumber ? layout.rowHeaderLevelCount + layout.leftRowSeriesNumberColumnCount : layout.rowHeaderLevelCount;
59358
+ if (!(col < treeTitleStartCol) && (cellRange.start.col = treeTitleStartCol, cellRange.end.col = layout.colCount - 1, cellRange.start.row = cellRange.end.row = row, isGroupMode && 1 === (null === (_a = layout.columnObjects) || void 0 === _a ? void 0 : _a.length))) {
59359
+ const onlyColumn = layout.columnObjects[0],
59360
+ field = null == onlyColumn ? void 0 : onlyColumn.field;
59361
+ if (null != field) {
59362
+ let text = cellRecord.vtableMergeName;
59363
+ const groupTitleFieldFormat = internalProps.groupTitleFieldFormat;
59364
+ "function" == typeof groupTitleFieldFormat && (text = groupTitleFieldFormat(cellRecord, col, row, table));
59365
+ null == cellRecord[field] && null != text && (cellRecord[field] = text);
59366
+ }
59367
+ }
59259
59368
  }
59260
59369
  function getCellRangeTranspose(col, row, layout) {
59261
59370
  var _a, _b, _c, _d;
@@ -60172,7 +60281,7 @@
60172
60281
  this.listenersId.push(doubleClickEventId, clickEventId, selectedChangedEventId);
60173
60282
  }
60174
60283
  startEditCell(col, row, value, editElement) {
60175
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
60284
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
60176
60285
  if (this.editingEditor) return;
60177
60286
  const editor = this.table.getEditor(col, row);
60178
60287
  if (editor) {
@@ -60188,7 +60297,8 @@
60188
60297
  col: col,
60189
60298
  row: row
60190
60299
  }), this.table._makeVisibleCell(col, row), this.editingEditor = editor;
60191
- const dataValue = isValid$1(value) ? value : this.table.getCellOriginValue(col, row),
60300
+ const customMergeText = null === (_j = this.table.getCustomMerge(col, row)) || void 0 === _j ? void 0 : _j.text,
60301
+ dataValue = isValid$1(value) ? value : isValid$1(customMergeText) ? customMergeText : this.table.getCellOriginValue(col, row),
60192
60302
  rect = this.table.getCellRangeRelativeRect(this.table.getCellRange(col, row)),
60193
60303
  referencePosition = {
60194
60304
  rect: {
@@ -60198,9 +60308,9 @@
60198
60308
  height: rect.height
60199
60309
  }
60200
60310
  };
60201
- col === this.table.colCount - 1 ? referencePosition.rect.width = rect.width - 1 : referencePosition.rect.width = rect.width + 1, row === this.table.rowCount - 1 ? referencePosition.rect.height = rect.height - 1 : referencePosition.rect.height = rect.height + 1, editor.beginEditing, null === (_j = editor.beginEditing) || void 0 === _j || _j.call(editor, this.table.getElement(), referencePosition, dataValue), editor.bindSuccessCallback, null === (_k = editor.bindSuccessCallback) || void 0 === _k || _k.call(editor, () => {
60311
+ col === this.table.colCount - 1 ? referencePosition.rect.width = rect.width - 1 : referencePosition.rect.width = rect.width + 1, row === this.table.rowCount - 1 ? referencePosition.rect.height = rect.height - 1 : referencePosition.rect.height = rect.height + 1, editor.beginEditing, null === (_k = editor.beginEditing) || void 0 === _k || _k.call(editor, this.table.getElement(), referencePosition, dataValue), editor.bindSuccessCallback, null === (_l = editor.bindSuccessCallback) || void 0 === _l || _l.call(editor, () => {
60202
60312
  this.completeEdit();
60203
- }), null === (_l = editor.onStart) || void 0 === _l || _l.call(editor, {
60313
+ }), null === (_m = editor.onStart) || void 0 === _m || _m.call(editor, {
60204
60314
  value: dataValue,
60205
60315
  endEdit: () => {
60206
60316
  this.completeEdit();
@@ -60214,7 +60324,7 @@
60214
60324
  }
60215
60325
  }
60216
60326
  completeEdit(e) {
60217
- var _a, _b;
60327
+ var _a, _b, _c;
60218
60328
  if (!this.editingEditor) return !0;
60219
60329
  if (this.isValidatingValue) return !1;
60220
60330
  this.cacheLastSelectedCellEditor = {};
@@ -60228,9 +60338,10 @@
60228
60338
  if (this.editingEditor.getValue, this.editingEditor.validateValue) {
60229
60339
  this.isValidatingValue = !0;
60230
60340
  const newValue = this.editingEditor.getValue(),
60231
- oldValue = this.table.getCellOriginValue(this.editCell.col, this.editCell.row),
60341
+ customMergeText = null === (_a = this.table.getCustomMerge(this.editCell.col, this.editCell.row)) || void 0 === _a ? void 0 : _a.text,
60342
+ oldValue = isValid$1(customMergeText) ? customMergeText : this.table.getCellOriginValue(this.editCell.col, this.editCell.row),
60232
60343
  target = null == e ? void 0 : e.target,
60233
- maybePromiseOrValue = null === (_b = (_a = this.editingEditor).validateValue) || void 0 === _b ? void 0 : _b.call(_a, newValue, oldValue, this.editCell, this.table, !!this.table.getElement().contains(target));
60344
+ maybePromiseOrValue = null === (_c = (_b = this.editingEditor).validateValue) || void 0 === _c ? void 0 : _c.call(_b, newValue, oldValue, this.editCell, this.table, !!this.table.getElement().contains(target));
60234
60345
  return isPromise(maybePromiseOrValue) ? (this.isValidatingValue = !0, new Promise((resolve, reject) => {
60235
60346
  maybePromiseOrValue.then(result => {
60236
60347
  dealWithValidateValue(result, this, oldValue, resolve);
@@ -60244,18 +60355,24 @@
60244
60355
  doExit() {
60245
60356
  var _a, _b, _c, _d, _e, _f, _g, _h;
60246
60357
  const changedValue = null === (_b = (_a = this.editingEditor).getValue) || void 0 === _b ? void 0 : _b.call(_a),
60247
- range = this.table.getCellRange(this.editCell.col, this.editCell.row),
60248
- changedValues = [];
60249
- for (let row = range.start.row; row <= range.end.row; row++) {
60250
- const rowChangedValues = [];
60251
- for (let col = range.start.col; col <= range.end.col; col++) rowChangedValues.push(changedValue);
60252
- changedValues.push(rowChangedValues);
60358
+ range = this.table.getCellRange(this.editCell.col, this.editCell.row);
60359
+ if (null === (_d = (_c = this.editingEditor).beforeEnd) || void 0 === _d || _d.call(_c), range.isCustom) this.table.changeCellValue(range.start.col, range.start.row, changedValue);else {
60360
+ const changedValues = [];
60361
+ for (let row = range.start.row; row <= range.end.row; row++) {
60362
+ const rowChangedValues = [];
60363
+ for (let col = range.start.col; col <= range.end.col; col++) rowChangedValues.push(changedValue);
60364
+ changedValues.push(rowChangedValues);
60365
+ }
60366
+ this.table.changeCellValues(range.start.col, range.start.row, changedValues);
60253
60367
  }
60254
- null === (_d = (_c = this.editingEditor).beforeEnd) || void 0 === _d || _d.call(_c), this.table.changeCellValues(range.start.col, range.start.row, changedValues), this.editingEditor.exit, null === (_f = (_e = this.editingEditor).exit) || void 0 === _f || _f.call(_e), null === (_h = (_g = this.editingEditor).onEnd) || void 0 === _h || _h.call(_g), this.editingEditor = null, this.isValidatingValue = !1, this.beginTriggerEditCellMode = null;
60368
+ this.editingEditor.exit, null === (_f = (_e = this.editingEditor).exit) || void 0 === _f || _f.call(_e), null === (_h = (_g = this.editingEditor).onEnd) || void 0 === _h || _h.call(_g), this.editingEditor = null, this.isValidatingValue = !1, this.beginTriggerEditCellMode = null;
60255
60369
  }
60256
60370
  cancelEdit() {
60257
60371
  var _a, _b, _c, _d;
60258
- this.editingEditor && (null === (_b = (_a = this.editingEditor).exit) || void 0 === _b || _b.call(_a), null === (_d = (_c = this.editingEditor).onEnd) || void 0 === _d || _d.call(_c), this.editingEditor = null);
60372
+ this.editingEditor && (null === (_b = (_a = this.editingEditor).exit) || void 0 === _b || _b.call(_a), null === (_d = (_c = this.editingEditor).onEnd) || void 0 === _d || _d.call(_c), this.editingEditor = null), Object.values(this.cacheLastSelectedCellEditor).forEach(editor => {
60373
+ var _a;
60374
+ return null === (_a = null == editor ? void 0 : editor.onEnd) || void 0 === _a ? void 0 : _a.call(editor);
60375
+ }), this.cacheLastSelectedCellEditor = {};
60259
60376
  }
60260
60377
  release() {
60261
60378
  this.listenersId.forEach(id => {
@@ -60308,7 +60425,18 @@
60308
60425
  step((generator = generator.apply(thisArg, _arguments || [])).next());
60309
60426
  });
60310
60427
  };
60428
+ function refreshCustomMergeCellGroups(table) {
60429
+ var _a;
60430
+ if (!Array.isArray(table.options.customMergeCell)) return;
60431
+ table.internalProps.customMergeCell = getCustomMergeCellFunc(table.options.customMergeCell);
60432
+ const merges = table.options.customMergeCell;
60433
+ for (let i = 0; i < merges.length; i++) {
60434
+ const r = null === (_a = merges[i]) || void 0 === _a ? void 0 : _a.range;
60435
+ if (null == r ? void 0 : r.start) for (let col = r.start.col; col <= r.end.col; col++) for (let row = r.start.row; row <= r.end.row; row++) table.scenegraph.updateCellContent(col, row);
60436
+ }
60437
+ }
60311
60438
  function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table, noTriggerChangeCellValuesEvent) {
60439
+ var _a, _b;
60312
60440
  if (workOnEditableCell && table.isHasEditorDefine(col, row) || !1 === workOnEditableCell) {
60313
60441
  const recordShowIndex = table.getRecordShowIndexByCell(col, row),
60314
60442
  recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
@@ -60318,8 +60446,12 @@
60318
60446
  beforeChangeValue = table.getCellRawValue(col, row),
60319
60447
  oldValue = table.getCellOriginValue(col, row);
60320
60448
  table.isHeader(col, row) ? table.internalProps.layoutMap.updateColumnTitle(col, row, value) : table.dataSource.changeFieldValue(value, recordShowIndex, field, col, row, table);
60321
- const range = table.getCellRange(col, row),
60322
- aggregators = table.internalProps.layoutMap.getAggregatorsByCell(col, row);
60449
+ const range = table.getCellRange(col, row);
60450
+ if (range.isCustom && range.start.col === col && range.start.row === row && Array.isArray(table.options.customMergeCell) && "function" == typeof table.getCellValue) {
60451
+ const customMerge = null === (_b = null === (_a = table.internalProps) || void 0 === _a ? void 0 : _a.customMergeCell) || void 0 === _b ? void 0 : _b.call(_a, col, row, table);
60452
+ customMerge && (customMerge.text = value);
60453
+ }
60454
+ const aggregators = table.internalProps.layoutMap.getAggregatorsByCell(col, row);
60323
60455
  if (aggregators) {
60324
60456
  if (Array.isArray(aggregators)) for (let i = 0; i < (null == aggregators ? void 0 : aggregators.length); i++) aggregators[i].recalculate();else aggregators.recalculate();
60325
60457
  const aggregatorCells = table.internalProps.layoutMap.getAggregatorCellAddress(range.start.col, range.start.row, range.end.col, range.end.row);
@@ -60542,7 +60674,13 @@
60542
60674
  (void 0 === recordIndex || recordIndex > table.dataSource.sourceLength) && (recordIndex = table.dataSource.sourceLength);
60543
60675
  const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount,
60544
60676
  syncToOriginalRecords = !!(null === (_f = table.options) || void 0 === _f ? void 0 : _f.syncRecordOperationsToSourceRecords);
60545
- if (table.dataSource.addRecord(record, recordIndex, syncToOriginalRecords), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1), syncToOriginalRecords) return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
60677
+ if (table.dataSource.addRecord(record, recordIndex, syncToOriginalRecords), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1), syncToOriginalRecords) {
60678
+ if (!table.transpose) {
60679
+ const insertRowIndex = recordIndex + headerCount + table.internalProps.layoutMap.hasAggregationOnTopCount;
60680
+ table.rowHeightsMap.insert(insertRowIndex);
60681
+ }
60682
+ return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(!0), !0;
60683
+ }
60546
60684
  const oldRowCount = table.rowCount;
60547
60685
  if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
60548
60686
  const newRowCount = table.transpose ? table.colCount : table.rowCount;
@@ -60620,7 +60758,13 @@
60620
60758
  void 0 === recordIndex || recordIndex > table.dataSource.sourceLength ? recordIndex = table.dataSource.sourceLength : recordIndex < 0 && (recordIndex = 0);
60621
60759
  const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount,
60622
60760
  syncToOriginalRecords = !!(null === (_f = table.options) || void 0 === _f ? void 0 : _f.syncRecordOperationsToSourceRecords);
60623
- if (table.dataSource.addRecords(records, recordIndex, syncToOriginalRecords), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length), syncToOriginalRecords) return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
60761
+ if (table.dataSource.addRecords(records, recordIndex, syncToOriginalRecords), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length), syncToOriginalRecords) {
60762
+ if (!table.transpose) {
60763
+ const insertRowIndex = recordIndex + headerCount + table.internalProps.layoutMap.hasAggregationOnTopCount;
60764
+ for (let i = 0; i < records.length; i++) table.rowHeightsMap.insert(insertRowIndex);
60765
+ }
60766
+ return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(!0), !0;
60767
+ }
60624
60768
  const oldRowCount = table.transpose ? table.colCount : table.rowCount;
60625
60769
  if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
60626
60770
  const newRowCount = table.transpose ? table.colCount : table.rowCount;
@@ -60689,7 +60833,7 @@
60689
60833
  }
60690
60834
  }
60691
60835
  function listTableDeleteRecords(recordIndexs, table) {
60692
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
60836
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
60693
60837
  if ((null == recordIndexs ? void 0 : recordIndexs.length) > 0) if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).deleteRecordsForGroup) || void 0 === _b || _b.call(_a, recordIndexs), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) {
60694
60838
  const deletedRecordIndexs = null === (_d = (_c = table.dataSource).deleteRecordsForTree) || void 0 === _d ? void 0 : _d.call(_c, recordIndexs);
60695
60839
  if (0 === deletedRecordIndexs.length) return;
@@ -60701,8 +60845,17 @@
60701
60845
  const syncToOriginalRecords = !!(null === (_f = table.options) || void 0 === _f ? void 0 : _f.syncRecordOperationsToSourceRecords),
60702
60846
  deletedRecordIndexs = table.dataSource.deleteRecords(recordIndexs, syncToOriginalRecords);
60703
60847
  if (0 === deletedRecordIndexs.length) return;
60848
+ Array.isArray(table.options.customMergeCell) && (table.internalProps.customMergeCell = getCustomMergeCellFunc(table.options.customMergeCell));
60704
60849
  for (let index = 0; index < deletedRecordIndexs.length; index++) adjustCheckBoxStateMapWithDeleteRecordIndex(table, deletedRecordIndexs[index], 1);
60705
- if (syncToOriginalRecords) return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), void table.scenegraph.createSceneGraph();
60850
+ if (syncToOriginalRecords) {
60851
+ if (!table.transpose) {
60852
+ const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount,
60853
+ topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount,
60854
+ sorted = [...deletedRecordIndexs].sort((a, b) => b - a);
60855
+ for (let i = 0; i < sorted.length; i++) table.rowHeightsMap.delete(sorted[i] + headerCount + topAggregationCount);
60856
+ }
60857
+ return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), void table.scenegraph.createSceneGraph(!0);
60858
+ }
60706
60859
  const oldRowCount = table.transpose ? table.colCount : table.rowCount;
60707
60860
  table.refreshRowColCount();
60708
60861
  const newRowCount = table.transpose ? table.colCount : table.rowCount,
@@ -60740,7 +60893,7 @@
60740
60893
  col: 0,
60741
60894
  row: row
60742
60895
  });
60743
- null === (_g = table.reactCustomLayout) || void 0 === _g || _g.clearCache(), table.transpose ? table.scenegraph.updateCol(delRows, [], updateRows) : table.scenegraph.updateRow(delRows, [], updateRows), null === (_h = table.reactCustomLayout) || void 0 === _h || _h.updateAllCustomCell();
60896
+ null === (_g = table.reactCustomLayout) || void 0 === _g || _g.clearCache(), table.transpose ? table.scenegraph.updateCol(delRows, [], updateRows) : table.scenegraph.updateRow(delRows, [], updateRows), null === (_h = table.reactCustomLayout) || void 0 === _h || _h.updateAllCustomCell(), refreshCustomMergeCellGroups(table);
60744
60897
  }
60745
60898
  } else {
60746
60899
  const delRows = [],
@@ -60758,6 +60911,42 @@
60758
60911
  });
60759
60912
  }
60760
60913
  const updateRows = [];
60914
+ if (table.internalProps.customMergeCell) {
60915
+ const proxy = table.scenegraph.proxy,
60916
+ deletedIndexNums = (recordIndexsMinToMax[0], recordIndexsMinToMax.map(recordIndex => recordIndex + headerCount + topAggregationCount)),
60917
+ minIndexNum = deletedIndexNums[0];
60918
+ let updateMin = minIndexNum,
60919
+ updateMax = minIndexNum;
60920
+ if (Array.isArray(table.options.customMergeCell)) {
60921
+ const merges = table.options.customMergeCell,
60922
+ axis = table.transpose ? "col" : "row";
60923
+ merges.forEach(m => {
60924
+ const r = null == m ? void 0 : m.range;
60925
+ if ((null == r ? void 0 : r.start) && (null == r ? void 0 : r.end)) for (let i = 0; i < deletedIndexNums.length; i++) {
60926
+ const deleteIndex = deletedIndexNums[i];
60927
+ if (r.end[axis] >= deleteIndex - 1) {
60928
+ updateMin = Math.min(updateMin, r.start[axis]), updateMax = Math.max(updateMax, r.end[axis]);
60929
+ break;
60930
+ }
60931
+ }
60932
+ });
60933
+ }
60934
+ if (table.transpose) {
60935
+ const start = Math.max(updateMin, null !== (_j = null == proxy ? void 0 : proxy.colStart) && void 0 !== _j ? _j : updateMin),
60936
+ end = Math.min(updateMax, null !== (_k = null == proxy ? void 0 : proxy.colEnd) && void 0 !== _k ? _k : updateMax);
60937
+ for (let col = start; col <= end; col++) updateRows.push({
60938
+ col: col,
60939
+ row: 0
60940
+ });
60941
+ } else {
60942
+ const start = Math.max(updateMin, null !== (_l = null == proxy ? void 0 : proxy.rowStart) && void 0 !== _l ? _l : updateMin),
60943
+ end = Math.min(updateMax, null !== (_m = null == proxy ? void 0 : proxy.rowEnd) && void 0 !== _m ? _m : updateMax);
60944
+ for (let row = start; row <= end; row++) updateRows.push({
60945
+ col: 0,
60946
+ row: row
60947
+ });
60948
+ }
60949
+ }
60761
60950
  for (let row = headerCount; row < headerCount + topAggregationCount; row++) table.transpose ? updateRows.push({
60762
60951
  col: row,
60763
60952
  row: 0
@@ -60772,7 +60961,7 @@
60772
60961
  col: 0,
60773
60962
  row: row
60774
60963
  });
60775
- null === (_j = table.reactCustomLayout) || void 0 === _j || _j.clearCache(), table.transpose ? table.scenegraph.updateCol(delRows, [], updateRows) : table.scenegraph.updateRow(delRows, [], updateRows), null === (_k = table.reactCustomLayout) || void 0 === _k || _k.updateAllCustomCell();
60964
+ null === (_o = table.reactCustomLayout) || void 0 === _o || _o.clearCache(), table.transpose ? table.scenegraph.updateCol(delRows, [], updateRows) : table.scenegraph.updateRow(delRows, [], updateRows), null === (_p = table.reactCustomLayout) || void 0 === _p || _p.updateAllCustomCell(), refreshCustomMergeCellGroups(table);
60776
60965
  }
60777
60966
  }
60778
60967
  }
@@ -60784,7 +60973,7 @@
60784
60973
  const syncToOriginalRecords = !!(null === (_f = table.options) || void 0 === _f ? void 0 : _f.syncRecordOperationsToSourceRecords),
60785
60974
  updateRecordIndexs = table.dataSource.updateRecords(records, recordIndexs, syncToOriginalRecords);
60786
60975
  if (0 === updateRecordIndexs.length) return;
60787
- if (syncToOriginalRecords) return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), void table.scenegraph.createSceneGraph();
60976
+ if (syncToOriginalRecords) return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), void table.scenegraph.createSceneGraph(!0);
60788
60977
  const recordIndexsMinToMax = updateRecordIndexs.map(index => table.getBodyRowIndexByRecordIndex(index)).sort((a, b) => a - b);
60789
60978
  if (table.pagination) {
60790
60979
  const {
@@ -61107,10 +61296,33 @@
61107
61296
  this._hasAutoImageColumn = void 0, this.refreshHeader(), this.records && checkHasAggregationOnColumnDefine(this.internalProps.columns) && this.dataSource.processRecords(null !== (_b = null === (_a = this.dataSource.dataSourceObj) || void 0 === _a ? void 0 : _a.records) && void 0 !== _b ? _b : this.dataSource.dataSourceObj), this.internalProps.useOneRowHeightFillAll = !1, this.headerStyleCache = new Map(), this.bodyStyleCache = new Map(), this.bodyBottomStyleCache = new Map(), this._updateSize(), this.scenegraph.createSceneGraph(), this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row), this.renderAsync(), this.eventManager.updateEventBinder();
61108
61297
  }
61109
61298
  addColumns(toAddColumns, colIndex, isMaintainArrayData = !0) {
61110
- var _a;
61299
+ var _a, _b;
61111
61300
  const columns = this.options.columns;
61301
+ if (Array.isArray(this.options.customMergeCell) && (null == toAddColumns ? void 0 : toAddColumns.length)) {
61302
+ const axis = this.transpose ? "row" : "col";
61303
+ let insertIndex = colIndex;
61304
+ void 0 === insertIndex ? insertIndex = columns.length : insertIndex < 0 ? insertIndex = 0 : insertIndex > columns.length && (insertIndex = columns.length);
61305
+ const toAddCount = toAddColumns.length,
61306
+ merges = this.options.customMergeCell.map(m => Object.assign(Object.assign({}, m), {
61307
+ range: {
61308
+ start: Object.assign({}, m.range.start),
61309
+ end: Object.assign({}, m.range.end)
61310
+ }
61311
+ }));
61312
+ for (let i = 0; i < merges.length; i++) {
61313
+ const r = null === (_a = merges[i]) || void 0 === _a ? void 0 : _a.range;
61314
+ if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
61315
+ const start = r.start[axis],
61316
+ end = r.end[axis];
61317
+ end < insertIndex || (start > insertIndex ? (r.start[axis] = start + toAddCount, r.end[axis] = end + toAddCount) : r.end[axis] = end + toAddCount);
61318
+ }
61319
+ this.options.customMergeCell = merges.filter(m => {
61320
+ const r = null == m ? void 0 : m.range;
61321
+ return !(!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) && !(r.end.row < r.start.row || r.end.col < r.start.col) && !(r.start.row === r.end.row && r.start.col === r.end.col);
61322
+ }), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
61323
+ }
61112
61324
  void 0 === colIndex ? (colIndex = columns.length, columns.push(...toAddColumns)) : columns.splice(colIndex, 0, ...toAddColumns);
61113
- for (let i = 0; i < toAddColumns.length; i++) this.colWidthsMap.addAndReorder(colIndex + i, null !== (_a = toAddColumns[i].width) && void 0 !== _a ? _a : this.internalProps.defaultColWidth);
61325
+ for (let i = 0; i < toAddColumns.length; i++) this.colWidthsMap.addAndReorder(colIndex + i, null !== (_b = toAddColumns[i].width) && void 0 !== _b ? _b : this.internalProps.defaultColWidth);
61114
61326
  this.internalProps._colRangeWidthsMap.clear();
61115
61327
  const resizedColIndexs = Array.from(this.internalProps._widthResizedColMap.keys());
61116
61328
  for (let i = 0; i < resizedColIndexs.length; i++) resizedColIndexs[i] >= colIndex && (this.internalProps._widthResizedColMap.delete(resizedColIndexs[i]), this.internalProps._widthResizedColMap.add(resizedColIndexs[i] + toAddColumns.length));
@@ -61123,15 +61335,46 @@
61123
61335
  }
61124
61336
  this.updateColumns(columns, {
61125
61337
  clearRowHeightCache: !1
61126
- }), this.fireListeners(TABLE_EVENT_TYPE.ADD_COLUMN, {
61338
+ }), Array.isArray(this.options.customMergeCell) && (this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell), this.options.customMergeCell.forEach(m => {
61339
+ const r = null == m ? void 0 : m.range;
61340
+ if (null == r ? void 0 : r.start) for (let col = r.start.col; col <= r.end.col; col++) for (let row = r.start.row; row <= r.end.row; row++) this.scenegraph.updateCellContent(col, row);
61341
+ }), this.scenegraph.updateNextFrame()), this.fireListeners(TABLE_EVENT_TYPE.ADD_COLUMN, {
61127
61342
  columnIndex: colIndex,
61128
61343
  columnCount: toAddColumns.length,
61129
61344
  columns: columns
61130
61345
  });
61131
61346
  }
61132
61347
  deleteColumns(deleteColIndexs, isMaintainArrayData = !0) {
61348
+ var _a;
61133
61349
  const columns = this.options.columns;
61134
61350
  deleteColIndexs.sort((a, b) => b - a);
61351
+ const deletedColumns = deleteColIndexs.map(idx => cloneDeepSpec(columns[idx], ["children"]));
61352
+ let deletedRecordValues;
61353
+ if (Array.isArray(this.options.customMergeCell) && (null == deleteColIndexs ? void 0 : deleteColIndexs.length)) {
61354
+ const axis = this.transpose ? "row" : "col",
61355
+ deleteIndexNums = deleteColIndexs.slice().sort((a, b) => a - b).map((idx, i) => idx - i),
61356
+ merges = this.options.customMergeCell.map(m => Object.assign(Object.assign({}, m), {
61357
+ range: {
61358
+ start: Object.assign({}, m.range.start),
61359
+ end: Object.assign({}, m.range.end)
61360
+ }
61361
+ }));
61362
+ for (let i = 0; i < deleteIndexNums.length; i++) {
61363
+ const deleteIndex = deleteIndexNums[i];
61364
+ for (let j = 0; j < merges.length; j++) {
61365
+ const r = null === (_a = merges[j]) || void 0 === _a ? void 0 : _a.range;
61366
+ if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
61367
+ const start = r.start[axis],
61368
+ end = r.end[axis];
61369
+ end < deleteIndex || (start > deleteIndex ? (r.start[axis] = start - 1, r.end[axis] = end - 1) : r.end[axis] = end - 1);
61370
+ }
61371
+ }
61372
+ this.options.customMergeCell = merges.filter(m => {
61373
+ const r = null == m ? void 0 : m.range;
61374
+ return !(!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) && !(r.end.row < r.start.row || r.end.col < r.start.col) && !(r.start.row === r.end.row && r.start.col === r.end.col);
61375
+ }), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
61376
+ }
61377
+ isMaintainArrayData && Array.isArray(this.records) && this.records.length && (deletedRecordValues = this.records.map(record => Array.isArray(record) ? deleteColIndexs.map(idx => record[idx]) : []), deletedRecordValues.every(v => 0 === v.length) && (deletedRecordValues = void 0));
61135
61378
  for (let i = 0; i < deleteColIndexs.length; i++) if (columns.splice(deleteColIndexs[i], 1), this.colWidthsMap.delAndReorder(deleteColIndexs[i]), this.internalProps._widthResizedColMap.delete(deleteColIndexs[i]), isMaintainArrayData) for (let j = 0; j < this.records.length; j++) {
61136
61379
  const record = this.records[j];
61137
61380
  Array.isArray(record) && record.splice(deleteColIndexs[i], 1);
@@ -61147,7 +61390,9 @@
61147
61390
  clearRowHeightCache: !1
61148
61391
  }), this.fireListeners(TABLE_EVENT_TYPE.DELETE_COLUMN, {
61149
61392
  deleteColIndexs: deleteColIndexs,
61150
- columns: columns
61393
+ columns: columns,
61394
+ deletedColumns: deletedColumns,
61395
+ deletedRecordValues: deletedRecordValues
61151
61396
  });
61152
61397
  }
61153
61398
  get columns() {
@@ -61535,9 +61780,9 @@
61535
61780
  }
61536
61781
  }
61537
61782
  updateSortState(sortState, executeSort = !0) {
61538
- var _a;
61539
- if (sortState) this.internalProps.sortState = sortState;else if (this.internalProps.sortState) if (Array.isArray(this.internalProps.sortState)) for (let i = 0; i < this.internalProps.sortState.length; i++) (sortState = null === (_a = this.internalProps.sortState) || void 0 === _a ? void 0 : _a[i]) && (sortState.order = "normal");else this.internalProps.sortState.order = "normal", sortState = this.internalProps.sortState;
61540
- (sortState = Array.isArray(sortState) ? sortState : [sortState]).some(item => item.field) && executeSort && this.internalProps.layoutMap.headerObjects.some(item => !1 !== item.define.sort) && (this.dataSource.sort(sortState.map(item => {
61783
+ var _a, _b, _c, _d, _e;
61784
+ const normalizedSortState = (Array.isArray(sortState) ? sortState : sortState ? [sortState] : []).filter(Boolean);
61785
+ if (normalizedSortState.length ? this.internalProps.sortState = sortState : this.internalProps.sortState = null, executeSort) if (normalizedSortState.length) this.internalProps.layoutMap.headerObjects.some(item => !1 !== item.define.sort) && (this.dataSource.sort(normalizedSortState.map(item => {
61541
61786
  const sortFunc = this._getSortFuncFromHeaderOption(this.internalProps.columns, item.field);
61542
61787
  this.internalProps.layoutMap.headerObjects.find(col => col && col.field === item.field);
61543
61788
  return {
@@ -61545,13 +61790,20 @@
61545
61790
  order: item.order,
61546
61791
  orderFn: null != sortFunc ? sortFunc : defaultOrderFn
61547
61792
  };
61548
- })), this.internalProps.layoutMap.clearCellRangeMap(), this.internalProps.useOneRowHeightFillAll = !1, this.scenegraph.sortCell()), sortState.length && this.stateManager.updateSortState(sortState);
61793
+ })), this.internalProps.layoutMap.clearCellRangeMap(), this.internalProps.useOneRowHeightFillAll = !1, this.scenegraph.sortCell());else {
61794
+ const ds = this.dataSource,
61795
+ sourceLength = null !== (_c = null !== (_b = null !== (_a = null == ds ? void 0 : ds.sourceLength) && void 0 !== _a ? _a : null == ds ? void 0 : ds._sourceLength) && void 0 !== _b ? _b : null == ds ? void 0 : ds.length) && void 0 !== _c ? _c : 0;
61796
+ (null === (_d = null == ds ? void 0 : ds.sortedIndexMap) || void 0 === _d ? void 0 : _d.clear) && ds.sortedIndexMap.clear(), void 0 !== ds.currentIndexedData && (ds.currentIndexedData = Array.from({
61797
+ length: sourceLength
61798
+ }, (_, i) => i)), ds.lastSortStates = [], null === (_e = ds.updatePagination) || void 0 === _e || _e.call(ds, ds.pagination), this.internalProps.layoutMap.clearCellRangeMap(), this.internalProps.useOneRowHeightFillAll = !1, this.scenegraph.sortCell();
61799
+ }
61800
+ this.stateManager.updateSortState(normalizedSortState);
61549
61801
  }
61550
61802
  updateFilterRules(filterRules, options = {
61551
61803
  clearRowHeightCache: !0
61552
61804
  }) {
61553
61805
  var _a, _b, _c;
61554
- this.scenegraph.clearCells(), null === (_b = (_a = this.dataSource).clearForceVisibleRecords) || void 0 === _b || _b.call(_a), this.sortState ? (this.dataSource.updateFilterRulesForSorted(filterRules), sortRecords(this)) : this.dataSource.updateFilterRules(filterRules, null == options ? void 0 : options.onFilterRecordsEnd), this.refreshRowColCount(), this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(!(null == options ? void 0 : options.clearRowHeightCache)), null === (_c = this.internalProps.emptyTip) || void 0 === _c || _c.resetVisible(), this.resize();
61806
+ this.scenegraph.clearCells(), !1 !== (null == options ? void 0 : options.clearForceVisibleRecords) && (null === (_b = (_a = this.dataSource).clearForceVisibleRecords) || void 0 === _b || _b.call(_a)), this.sortState ? (this.dataSource.updateFilterRulesForSorted(filterRules), sortRecords(this)) : this.dataSource.updateFilterRules(filterRules, null == options ? void 0 : options.onFilterRecordsEnd), this.refreshRowColCount(), this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(!(null == options ? void 0 : options.clearRowHeightCache)), null === (_c = this.internalProps.emptyTip) || void 0 === _c || _c.resetVisible(), this.resize();
61555
61807
  }
61556
61808
  getFilteredRecords() {
61557
61809
  return this.dataSource.records;
@@ -61826,30 +62078,112 @@
61826
62078
  traverseColumns(this.internalProps.columns), this.refreshRowColCount(), this.internalProps.layoutMap.clearCellRangeMap(), this.internalProps.useOneRowHeightFillAll = !1, this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(!clearRowHeightCache), null === (_k = this.internalProps.emptyTip) || void 0 === _k || _k.resetVisible(), this.resize();
61827
62079
  }
61828
62080
  addRecord(record, recordIndex, triggerEvent = !0) {
61829
- var _a;
62081
+ var _a, _b;
62082
+ if (Array.isArray(this.options.customMergeCell) && "number" == typeof recordIndex) {
62083
+ const axis = this.transpose ? "col" : "row",
62084
+ headerCount = this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount,
62085
+ topAggregationCount = this.internalProps.layoutMap.hasAggregationOnTopCount;
62086
+ let insertIndex = recordIndex;
62087
+ void 0 === insertIndex || insertIndex > this.dataSource.sourceLength ? insertIndex = this.dataSource.sourceLength : insertIndex < 0 && (insertIndex = 0);
62088
+ const insertIndexNum = insertIndex + headerCount + topAggregationCount,
62089
+ merges = this.options.customMergeCell.map(m => Object.assign(Object.assign({}, m), {
62090
+ range: {
62091
+ start: Object.assign({}, m.range.start),
62092
+ end: Object.assign({}, m.range.end)
62093
+ }
62094
+ }));
62095
+ for (let i = 0; i < merges.length; i++) {
62096
+ const r = null === (_a = merges[i]) || void 0 === _a ? void 0 : _a.range;
62097
+ if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
62098
+ const start = r.start[axis],
62099
+ end = r.end[axis];
62100
+ end < insertIndexNum || (start > insertIndexNum ? (r.start[axis] = start + 1, r.end[axis] = end + 1) : r.end[axis] = end + 1);
62101
+ }
62102
+ this.options.customMergeCell = merges.filter(m => {
62103
+ const r = null == m ? void 0 : m.range;
62104
+ return !(!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) && !(r.end.row < r.start.row || r.end.col < r.start.col) && !(r.start.row === r.end.row && r.start.col === r.end.col);
62105
+ }), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
62106
+ }
61830
62107
  const success = listTableAddRecord(record, recordIndex, this);
61831
- adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
62108
+ adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]), null === (_b = this.internalProps.emptyTip) || void 0 === _b || _b.resetVisible(), success && Array.isArray(this.options.customMergeCell) && (this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell), this.options.customMergeCell.forEach(m => {
62109
+ const r = null == m ? void 0 : m.range;
62110
+ if (null == r ? void 0 : r.start) for (let col = r.start.col; col <= r.end.col; col++) for (let row = r.start.row; row <= r.end.row; row++) this.scenegraph.updateCellContent(col, row);
62111
+ }), this.scenegraph.updateNextFrame()), triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
61832
62112
  records: [record],
61833
62113
  recordIndex: recordIndex,
61834
62114
  recordCount: 1
61835
62115
  });
61836
62116
  }
61837
62117
  addRecords(records, recordIndex, triggerEvent = !0) {
61838
- var _a;
62118
+ var _a, _b;
62119
+ if (Array.isArray(this.options.customMergeCell) && "number" == typeof recordIndex && (null == records ? void 0 : records.length)) {
62120
+ const axis = this.transpose ? "col" : "row",
62121
+ headerCount = this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount,
62122
+ topAggregationCount = this.internalProps.layoutMap.hasAggregationOnTopCount;
62123
+ let insertIndex = recordIndex;
62124
+ void 0 === insertIndex || insertIndex > this.dataSource.sourceLength ? insertIndex = this.dataSource.sourceLength : insertIndex < 0 && (insertIndex = 0);
62125
+ const insertIndexNum = insertIndex + headerCount + topAggregationCount,
62126
+ toAddCount = records.length,
62127
+ merges = this.options.customMergeCell.map(m => Object.assign(Object.assign({}, m), {
62128
+ range: {
62129
+ start: Object.assign({}, m.range.start),
62130
+ end: Object.assign({}, m.range.end)
62131
+ }
62132
+ }));
62133
+ for (let i = 0; i < merges.length; i++) {
62134
+ const r = null === (_a = merges[i]) || void 0 === _a ? void 0 : _a.range;
62135
+ if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
62136
+ const start = r.start[axis],
62137
+ end = r.end[axis];
62138
+ end < insertIndexNum || (start > insertIndexNum ? (r.start[axis] = start + toAddCount, r.end[axis] = end + toAddCount) : r.end[axis] = end + toAddCount);
62139
+ }
62140
+ this.options.customMergeCell = merges.filter(m => {
62141
+ const r = null == m ? void 0 : m.range;
62142
+ return !(!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) && !(r.end.row < r.start.row || r.end.col < r.start.col) && !(r.start.row === r.end.row && r.start.col === r.end.col);
62143
+ }), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
62144
+ }
61839
62145
  const success = listTableAddRecords(records, recordIndex, this);
61840
- "number" == typeof recordIndex && adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, records), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(), triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
62146
+ "number" == typeof recordIndex && adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, records), null === (_b = this.internalProps.emptyTip) || void 0 === _b || _b.resetVisible(), success && Array.isArray(this.options.customMergeCell) && (this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell), this.options.customMergeCell.forEach(m => {
62147
+ const r = null == m ? void 0 : m.range;
62148
+ if (null == r ? void 0 : r.start) for (let col = r.start.col; col <= r.end.col; col++) for (let row = r.start.row; row <= r.end.row; row++) this.scenegraph.updateCellContent(col, row);
62149
+ }), this.scenegraph.updateNextFrame()), triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
61841
62150
  records: records,
61842
62151
  recordIndex: recordIndex,
61843
62152
  recordCount: records.length
61844
62153
  });
61845
62154
  }
61846
62155
  deleteRecords(recordIndexs, triggerEvent = !0) {
61847
- var _a;
61848
- const deletedRecords = [];
61849
- (null == recordIndexs ? void 0 : recordIndexs.length) > 0 && recordIndexs.forEach(index => {
62156
+ var _a, _b;
62157
+ const prevMergeRanges = Array.isArray(this.options.customMergeCell) ? this.options.customMergeCell.map(m => null == m ? void 0 : m.range).filter(Boolean).map(r => ({
62158
+ start: Object.assign({}, r.start),
62159
+ end: Object.assign({}, r.end)
62160
+ })) : [],
62161
+ deletedRecords = [];
62162
+ if ((null == recordIndexs ? void 0 : recordIndexs.length) > 0 && recordIndexs.forEach(index => {
61850
62163
  let record = null;
61851
62164
  record = "number" == typeof index ? this.dataSource.get(index) : [], deletedRecords.push(record);
61852
- }), listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
62165
+ }), Array.isArray(this.options.customMergeCell) && (null == recordIndexs ? void 0 : recordIndexs.length) && "number" == typeof recordIndexs[0]) {
62166
+ const axis = this.transpose ? "col" : "row",
62167
+ headerCount = this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount,
62168
+ topAggregationCount = this.internalProps.layoutMap.hasAggregationOnTopCount,
62169
+ deleteIndexNums = recordIndexs.slice().sort((a, b) => a - b).map((index, i) => index + headerCount + topAggregationCount - i),
62170
+ merges = this.options.customMergeCell;
62171
+ for (let i = 0; i < deleteIndexNums.length; i++) {
62172
+ const deleteIndex = deleteIndexNums[i];
62173
+ for (let j = 0; j < merges.length; j++) {
62174
+ const r = null === (_a = merges[j]) || void 0 === _a ? void 0 : _a.range;
62175
+ if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
62176
+ const start = r.start[axis],
62177
+ end = r.end[axis];
62178
+ end < deleteIndex || (start > deleteIndex ? (r.start[axis] = start - 1, r.end[axis] = end - 1) : r.end[axis] = end - 1);
62179
+ }
62180
+ }
62181
+ this.options.customMergeCell = merges.filter(m => {
62182
+ const r = null == m ? void 0 : m.range;
62183
+ return !(!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) && !(r.end.row < r.start.row || r.end.col < r.start.col) && !(r.start.row === r.end.row && r.start.col === r.end.col);
62184
+ });
62185
+ }
62186
+ listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_b = this.internalProps.emptyTip) || void 0 === _b || _b.resetVisible();
61853
62187
  const rowIndexs = [];
61854
62188
  for (let i = 0; i < recordIndexs.length; i++) rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
61855
62189
  triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
@@ -61857,7 +62191,16 @@
61857
62191
  records: deletedRecords,
61858
62192
  rowIndexs: rowIndexs,
61859
62193
  deletedCount: (Array.isArray(recordIndexs[0]), recordIndexs.length)
61860
- });
62194
+ }), Array.isArray(this.options.customMergeCell) && (this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell), this.options.customMergeCell.forEach(m => {
62195
+ const r = null == m ? void 0 : m.range;
62196
+ if (null == r ? void 0 : r.start) for (let col = r.start.col; col <= r.end.col; col++) for (let row = r.start.row; row <= r.end.row; row++) this.scenegraph.updateCellContent(col, row);
62197
+ }), this.scenegraph.updateNextFrame(), setTimeout(() => {
62198
+ if (!this.internalProps || !this.options || !this.scenegraph) return;
62199
+ Array.isArray(this.options.customMergeCell) && (this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell));
62200
+ [...prevMergeRanges, ...(Array.isArray(this.options.customMergeCell) ? this.options.customMergeCell.map(m => null == m ? void 0 : m.range) : [])].filter(Boolean).forEach(r => {
62201
+ if (null == r ? void 0 : r.start) for (let col = r.start.col; col <= r.end.col; col++) for (let row = r.start.row; row <= r.end.row; row++) this.scenegraph.updateCellContent(col, row);
62202
+ }), this.scenegraph.updateNextFrame();
62203
+ }, 0));
61861
62204
  }
61862
62205
  updateRecords(records, recordIndexs, triggerEvent = !0) {
61863
62206
  listTableUpdateRecords(records, recordIndexs, this), triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
@@ -61961,7 +62304,12 @@
61961
62304
  }
61962
62305
  }), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
61963
62306
  for (let i = startCol; i <= endCol; i++) for (let j = startRow; j <= endRow; j++) this.scenegraph.updateCellContent(i, j);
61964
- this.scenegraph.updateNextFrame();
62307
+ this.scenegraph.updateNextFrame(), this.fireListeners(TABLE_EVENT_TYPE.MERGE_CELLS, {
62308
+ startCol: startCol,
62309
+ startRow: startRow,
62310
+ endCol: endCol,
62311
+ endRow: endRow
62312
+ });
61965
62313
  }
61966
62314
  unmergeCells(startCol, startRow, endCol, endRow) {
61967
62315
  this.options.customMergeCell ? "function" == typeof this.options.customMergeCell && (this.options.customMergeCell = []) : this.options.customMergeCell = [], this.options.customMergeCell = this.options.customMergeCell.filter(item => {
@@ -61972,7 +62320,12 @@
61972
62320
  return !(start.col === startCol && start.row === startRow && end.col === endCol && end.row === endRow);
61973
62321
  }), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
61974
62322
  for (let i = startCol; i <= endCol; i++) for (let j = startRow; j <= endRow; j++) this.scenegraph.updateCellContent(i, j);
61975
- this.scenegraph.updateNextFrame();
62323
+ this.scenegraph.updateNextFrame(), this.fireListeners(TABLE_EVENT_TYPE.UNMERGE_CELLS, {
62324
+ startCol: startCol,
62325
+ startRow: startRow,
62326
+ endCol: endCol,
62327
+ endRow: endRow
62328
+ });
61976
62329
  }
61977
62330
  }
61978
62331