@visactor/vtable-calendar 1.23.3-alpha.0 → 1.24.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
  });
@@ -56512,7 +56553,7 @@
56512
56553
  }
56513
56554
  constructor(container, options = {}) {
56514
56555
  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");
56556
+ 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", 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
56557
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
56517
56558
  options: options,
56518
56559
  container: container
@@ -57450,12 +57491,15 @@
57450
57491
  dispose() {
57451
57492
  this.release();
57452
57493
  }
57494
+ clearCorrectTimer() {
57495
+ this._scrollToRowCorrectTimer && (clearTimeout(this._scrollToRowCorrectTimer), this._scrollToRowCorrectTimer = null);
57496
+ }
57453
57497
  release() {
57454
57498
  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
57499
  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
57500
  const internalProps = this.internalProps;
57457
57501
  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 => {
57502
+ 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
57503
  null == legend || legend.release();
57460
57504
  }), 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
57505
  var _a;
@@ -57760,6 +57804,30 @@
57760
57804
  lastSelectRange = currentSelectRanges[currentSelectRanges.length - 1];
57761
57805
  lastSelectRange && (lastSelectRange.end.row = rowIndex), this.stateManager.updateSelectPos(this.colCount - 1, rowIndex, !1, isCtrl, !1, makeSelectCellVisible, !0), this.stateManager.select.selecting = !1;
57762
57806
  }
57807
+ changeHeaderPosition(args) {
57808
+ var _a, _b, _c, _d, _e;
57809
+ if (!("canMoveHeaderPosition" in this.internalProps.layoutMap) || !0 === (null === (_a = this.options.customConfig) || void 0 === _a ? void 0 : _a.notUpdateInColumnRowMove)) return !1;
57810
+ const prevMoving = this.stateManager.columnMove.movingColumnOrRow;
57811
+ this.stateManager.columnMove.movingColumnOrRow = args.movingColumnOrRow;
57812
+ try {
57813
+ if (!1 === (null === (_c = (_b = this.internalProps.layoutMap).canMoveHeaderPosition) || void 0 === _c ? void 0 : _c.call(_b, args.source, args.target))) return !1;
57814
+ const oldSourceMergeInfo = this.getCellRange(args.source.col, args.source.row),
57815
+ oldTargetMergeInfo = this.getCellRange(args.target.col, args.target.row),
57816
+ moveContext = this._moveHeaderPosition(args.source, args.target);
57817
+ if (!moveContext || moveContext.targetIndex === moveContext.sourceIndex) return !1;
57818
+ this.internalProps.useOneRowHeightFillAll = !1, this.internalProps.layoutMap.clearCellRangeMap();
57819
+ const sourceMergeInfo = this.getCellRange(args.source.col, args.source.row),
57820
+ targetMergeInfo = this.getCellRange(args.target.col, args.target.row),
57821
+ colMin = Math.min(sourceMergeInfo.start.col, targetMergeInfo.start.col, oldSourceMergeInfo.start.col, oldTargetMergeInfo.start.col),
57822
+ colMax = Math.max(sourceMergeInfo.end.col, targetMergeInfo.end.col, oldSourceMergeInfo.end.col, oldTargetMergeInfo.end.col),
57823
+ rowMin = Math.min(sourceMergeInfo.start.row, targetMergeInfo.start.row, oldSourceMergeInfo.start.row, oldTargetMergeInfo.start.row);
57824
+ let rowMax = Math.max(sourceMergeInfo.end.row, targetMergeInfo.end.row, oldSourceMergeInfo.end.row, oldTargetMergeInfo.end.row);
57825
+ 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);
57826
+ 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;
57827
+ } finally {
57828
+ this.stateManager.columnMove.movingColumnOrRow = prevMoving;
57829
+ }
57830
+ }
57763
57831
  get recordsCount() {
57764
57832
  var _a;
57765
57833
  return null === (_a = this.records) || void 0 === _a ? void 0 : _a.length;
@@ -57905,7 +57973,7 @@
57905
57973
  getCustomMerge(col, row) {
57906
57974
  if (this.internalProps.customMergeCell) {
57907
57975
  const customMerge = this.internalProps.customMergeCell(col, row, this);
57908
- if (customMerge && customMerge.range && (isValid$1(customMerge.text) || customMerge.customLayout || this.customRender)) {
57976
+ if (customMerge && customMerge.range) {
57909
57977
  if (customMerge.style) {
57910
57978
  const styleClass = this.internalProps.bodyHelper.getStyleClass("text"),
57911
57979
  style = customMerge.style,
@@ -58616,12 +58684,34 @@
58616
58684
  this.eventManager.enableScroll();
58617
58685
  }
58618
58686
  getGroupTitleLevel(col, row) {}
58687
+ getTargetScrollTop(row) {
58688
+ const drawRange = this.getDrawRange(),
58689
+ frozenHeight = this.getFrozenRowsHeight();
58690
+ return Math.max(0, Math.min(this.getRowsHeight(0, row - 1) - frozenHeight, this.getAllRowsHeight() - drawRange.height));
58691
+ }
58692
+ _scheduleScrollToRowCorrect(row, delay = 0) {
58693
+ this._scrollToRowCorrectTimer = setTimeout(() => {
58694
+ this.clearCorrectTimer();
58695
+ const targetScrollTop = this.getTargetScrollTop(row);
58696
+ if (targetScrollTop !== this.scrollTop) {
58697
+ this.scrollTop = targetScrollTop;
58698
+ const correctedTargetScrollTop = this.getTargetScrollTop(row);
58699
+ correctedTargetScrollTop !== this.scrollTop && (this.scrollTop = correctedTargetScrollTop);
58700
+ }
58701
+ }, delay);
58702
+ }
58619
58703
  scrollToRow(row, animationOption) {
58620
- animationOption ? this.animationManager.scrollTo({
58621
- row: row
58622
- }, animationOption) : this.scrollToCell({
58623
- row: row
58624
- });
58704
+ var _a;
58705
+ const targetRow = Math.min(Math.max(Math.floor(row), 0), this.rowCount - 1);
58706
+ if (this.clearCorrectTimer(), !animationOption) return this.scrollToCell({
58707
+ row: targetRow
58708
+ }), void this._scheduleScrollToRowCorrect(targetRow);
58709
+ const duration = isBoolean$2(animationOption) ? 3e3 : null !== (_a = null == animationOption ? void 0 : animationOption.duration) && void 0 !== _a ? _a : 3e3;
58710
+ this.animationManager.scrollTo({
58711
+ row: targetRow
58712
+ }, animationOption), this._scrollToRowCorrectTimer = setTimeout(() => {
58713
+ this.scrollToRow(targetRow, !1);
58714
+ }, duration);
58625
58715
  }
58626
58716
  scrollToCol(col, animationOption) {
58627
58717
  animationOption ? this.animationManager.scrollTo({
@@ -58640,8 +58730,8 @@
58640
58730
  }
58641
58731
  if (isValid$1(cellAddr.row) && cellAddr.row >= this.frozenRowCount) {
58642
58732
  const frozenHeight = this.getFrozenRowsHeight(),
58643
- top = this.getRowsHeight(0, cellAddr.row - 1);
58644
- this.scrollTop = Math.min(top - frozenHeight, this.getAllRowsHeight() - drawRange.height);
58733
+ top = this.rowHeightsMap.getSumInRange(0, cellAddr.row - 1);
58734
+ this.scrollTop = Math.min(top - frozenHeight, this.rowHeightsMap.getSumInRange(0, this.rowCount - 1) - drawRange.height);
58645
58735
  }
58646
58736
  this.render();
58647
58737
  }
@@ -59253,9 +59343,24 @@
59253
59343
  return layout._cellRangeMap.set(`$${col}$${row}`, cellRange), cellRange;
59254
59344
  }
59255
59345
  function getTreeTitleMerge(col, row, cellRange, layout) {
59346
+ var _a;
59256
59347
  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);
59348
+ const table = layout._table,
59349
+ internalProps = table.internalProps || {},
59350
+ isGroupMode = !!internalProps.groupBy,
59351
+ cellRecord = table.getCellRawRecord(col, row);
59352
+ if (!(null == cellRecord ? void 0 : cellRecord.vtableMerge)) return;
59353
+ const treeTitleStartCol = internalProps.groupTitleCheckbox && internalProps.rowSeriesNumber ? layout.rowHeaderLevelCount + layout.leftRowSeriesNumberColumnCount : layout.rowHeaderLevelCount;
59354
+ 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))) {
59355
+ const onlyColumn = layout.columnObjects[0],
59356
+ field = null == onlyColumn ? void 0 : onlyColumn.field;
59357
+ if (null != field) {
59358
+ let text = cellRecord.vtableMergeName;
59359
+ const groupTitleFieldFormat = internalProps.groupTitleFieldFormat;
59360
+ "function" == typeof groupTitleFieldFormat && (text = groupTitleFieldFormat(cellRecord, col, row, table));
59361
+ null == cellRecord[field] && null != text && (cellRecord[field] = text);
59362
+ }
59363
+ }
59259
59364
  }
59260
59365
  function getCellRangeTranspose(col, row, layout) {
59261
59366
  var _a, _b, _c, _d;
@@ -60172,7 +60277,7 @@
60172
60277
  this.listenersId.push(doubleClickEventId, clickEventId, selectedChangedEventId);
60173
60278
  }
60174
60279
  startEditCell(col, row, value, editElement) {
60175
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
60280
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
60176
60281
  if (this.editingEditor) return;
60177
60282
  const editor = this.table.getEditor(col, row);
60178
60283
  if (editor) {
@@ -60188,7 +60293,8 @@
60188
60293
  col: col,
60189
60294
  row: row
60190
60295
  }), this.table._makeVisibleCell(col, row), this.editingEditor = editor;
60191
- const dataValue = isValid$1(value) ? value : this.table.getCellOriginValue(col, row),
60296
+ const customMergeText = null === (_j = this.table.getCustomMerge(col, row)) || void 0 === _j ? void 0 : _j.text,
60297
+ dataValue = isValid$1(value) ? value : isValid$1(customMergeText) ? customMergeText : this.table.getCellOriginValue(col, row),
60192
60298
  rect = this.table.getCellRangeRelativeRect(this.table.getCellRange(col, row)),
60193
60299
  referencePosition = {
60194
60300
  rect: {
@@ -60198,9 +60304,9 @@
60198
60304
  height: rect.height
60199
60305
  }
60200
60306
  };
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, () => {
60307
+ 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
60308
  this.completeEdit();
60203
- }), null === (_l = editor.onStart) || void 0 === _l || _l.call(editor, {
60309
+ }), null === (_m = editor.onStart) || void 0 === _m || _m.call(editor, {
60204
60310
  value: dataValue,
60205
60311
  endEdit: () => {
60206
60312
  this.completeEdit();
@@ -60214,7 +60320,7 @@
60214
60320
  }
60215
60321
  }
60216
60322
  completeEdit(e) {
60217
- var _a, _b;
60323
+ var _a, _b, _c;
60218
60324
  if (!this.editingEditor) return !0;
60219
60325
  if (this.isValidatingValue) return !1;
60220
60326
  this.cacheLastSelectedCellEditor = {};
@@ -60228,9 +60334,10 @@
60228
60334
  if (this.editingEditor.getValue, this.editingEditor.validateValue) {
60229
60335
  this.isValidatingValue = !0;
60230
60336
  const newValue = this.editingEditor.getValue(),
60231
- oldValue = this.table.getCellOriginValue(this.editCell.col, this.editCell.row),
60337
+ customMergeText = null === (_a = this.table.getCustomMerge(this.editCell.col, this.editCell.row)) || void 0 === _a ? void 0 : _a.text,
60338
+ oldValue = isValid$1(customMergeText) ? customMergeText : this.table.getCellOriginValue(this.editCell.col, this.editCell.row),
60232
60339
  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));
60340
+ 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
60341
  return isPromise(maybePromiseOrValue) ? (this.isValidatingValue = !0, new Promise((resolve, reject) => {
60235
60342
  maybePromiseOrValue.then(result => {
60236
60343
  dealWithValidateValue(result, this, oldValue, resolve);
@@ -60244,18 +60351,24 @@
60244
60351
  doExit() {
60245
60352
  var _a, _b, _c, _d, _e, _f, _g, _h;
60246
60353
  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);
60354
+ range = this.table.getCellRange(this.editCell.col, this.editCell.row);
60355
+ 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 {
60356
+ const changedValues = [];
60357
+ for (let row = range.start.row; row <= range.end.row; row++) {
60358
+ const rowChangedValues = [];
60359
+ for (let col = range.start.col; col <= range.end.col; col++) rowChangedValues.push(changedValue);
60360
+ changedValues.push(rowChangedValues);
60361
+ }
60362
+ this.table.changeCellValues(range.start.col, range.start.row, changedValues);
60253
60363
  }
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;
60364
+ 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
60365
  }
60256
60366
  cancelEdit() {
60257
60367
  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);
60368
+ 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 => {
60369
+ var _a;
60370
+ return null === (_a = null == editor ? void 0 : editor.onEnd) || void 0 === _a ? void 0 : _a.call(editor);
60371
+ }), this.cacheLastSelectedCellEditor = {};
60259
60372
  }
60260
60373
  release() {
60261
60374
  this.listenersId.forEach(id => {
@@ -60308,7 +60421,18 @@
60308
60421
  step((generator = generator.apply(thisArg, _arguments || [])).next());
60309
60422
  });
60310
60423
  };
60424
+ function refreshCustomMergeCellGroups(table) {
60425
+ var _a;
60426
+ if (!Array.isArray(table.options.customMergeCell)) return;
60427
+ table.internalProps.customMergeCell = getCustomMergeCellFunc(table.options.customMergeCell);
60428
+ const merges = table.options.customMergeCell;
60429
+ for (let i = 0; i < merges.length; i++) {
60430
+ const r = null === (_a = merges[i]) || void 0 === _a ? void 0 : _a.range;
60431
+ 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);
60432
+ }
60433
+ }
60311
60434
  function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table, noTriggerChangeCellValuesEvent) {
60435
+ var _a, _b;
60312
60436
  if (workOnEditableCell && table.isHasEditorDefine(col, row) || !1 === workOnEditableCell) {
60313
60437
  const recordShowIndex = table.getRecordShowIndexByCell(col, row),
60314
60438
  recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
@@ -60318,8 +60442,12 @@
60318
60442
  beforeChangeValue = table.getCellRawValue(col, row),
60319
60443
  oldValue = table.getCellOriginValue(col, row);
60320
60444
  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);
60445
+ const range = table.getCellRange(col, row);
60446
+ if (range.isCustom && range.start.col === col && range.start.row === row && Array.isArray(table.options.customMergeCell) && "function" == typeof table.getCellValue) {
60447
+ 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);
60448
+ customMerge && (customMerge.text = value);
60449
+ }
60450
+ const aggregators = table.internalProps.layoutMap.getAggregatorsByCell(col, row);
60323
60451
  if (aggregators) {
60324
60452
  if (Array.isArray(aggregators)) for (let i = 0; i < (null == aggregators ? void 0 : aggregators.length); i++) aggregators[i].recalculate();else aggregators.recalculate();
60325
60453
  const aggregatorCells = table.internalProps.layoutMap.getAggregatorCellAddress(range.start.col, range.start.row, range.end.col, range.end.row);
@@ -60542,7 +60670,13 @@
60542
60670
  (void 0 === recordIndex || recordIndex > table.dataSource.sourceLength) && (recordIndex = table.dataSource.sourceLength);
60543
60671
  const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount,
60544
60672
  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;
60673
+ if (table.dataSource.addRecord(record, recordIndex, syncToOriginalRecords), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1), syncToOriginalRecords) {
60674
+ if (!table.transpose) {
60675
+ const insertRowIndex = recordIndex + headerCount + table.internalProps.layoutMap.hasAggregationOnTopCount;
60676
+ table.rowHeightsMap.insert(insertRowIndex);
60677
+ }
60678
+ return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(!0), !0;
60679
+ }
60546
60680
  const oldRowCount = table.rowCount;
60547
60681
  if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
60548
60682
  const newRowCount = table.transpose ? table.colCount : table.rowCount;
@@ -60620,7 +60754,13 @@
60620
60754
  void 0 === recordIndex || recordIndex > table.dataSource.sourceLength ? recordIndex = table.dataSource.sourceLength : recordIndex < 0 && (recordIndex = 0);
60621
60755
  const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount,
60622
60756
  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;
60757
+ if (table.dataSource.addRecords(records, recordIndex, syncToOriginalRecords), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length), syncToOriginalRecords) {
60758
+ if (!table.transpose) {
60759
+ const insertRowIndex = recordIndex + headerCount + table.internalProps.layoutMap.hasAggregationOnTopCount;
60760
+ for (let i = 0; i < records.length; i++) table.rowHeightsMap.insert(insertRowIndex);
60761
+ }
60762
+ return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(!0), !0;
60763
+ }
60624
60764
  const oldRowCount = table.transpose ? table.colCount : table.rowCount;
60625
60765
  if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
60626
60766
  const newRowCount = table.transpose ? table.colCount : table.rowCount;
@@ -60689,7 +60829,7 @@
60689
60829
  }
60690
60830
  }
60691
60831
  function listTableDeleteRecords(recordIndexs, table) {
60692
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
60832
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
60693
60833
  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
60834
  const deletedRecordIndexs = null === (_d = (_c = table.dataSource).deleteRecordsForTree) || void 0 === _d ? void 0 : _d.call(_c, recordIndexs);
60695
60835
  if (0 === deletedRecordIndexs.length) return;
@@ -60701,8 +60841,17 @@
60701
60841
  const syncToOriginalRecords = !!(null === (_f = table.options) || void 0 === _f ? void 0 : _f.syncRecordOperationsToSourceRecords),
60702
60842
  deletedRecordIndexs = table.dataSource.deleteRecords(recordIndexs, syncToOriginalRecords);
60703
60843
  if (0 === deletedRecordIndexs.length) return;
60844
+ Array.isArray(table.options.customMergeCell) && (table.internalProps.customMergeCell = getCustomMergeCellFunc(table.options.customMergeCell));
60704
60845
  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();
60846
+ if (syncToOriginalRecords) {
60847
+ if (!table.transpose) {
60848
+ const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount,
60849
+ topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount,
60850
+ sorted = [...deletedRecordIndexs].sort((a, b) => b - a);
60851
+ for (let i = 0; i < sorted.length; i++) table.rowHeightsMap.delete(sorted[i] + headerCount + topAggregationCount);
60852
+ }
60853
+ return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), void table.scenegraph.createSceneGraph(!0);
60854
+ }
60706
60855
  const oldRowCount = table.transpose ? table.colCount : table.rowCount;
60707
60856
  table.refreshRowColCount();
60708
60857
  const newRowCount = table.transpose ? table.colCount : table.rowCount,
@@ -60740,7 +60889,7 @@
60740
60889
  col: 0,
60741
60890
  row: row
60742
60891
  });
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();
60892
+ 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
60893
  }
60745
60894
  } else {
60746
60895
  const delRows = [],
@@ -60758,6 +60907,42 @@
60758
60907
  });
60759
60908
  }
60760
60909
  const updateRows = [];
60910
+ if (table.internalProps.customMergeCell) {
60911
+ const proxy = table.scenegraph.proxy,
60912
+ deletedIndexNums = (recordIndexsMinToMax[0], recordIndexsMinToMax.map(recordIndex => recordIndex + headerCount + topAggregationCount)),
60913
+ minIndexNum = deletedIndexNums[0];
60914
+ let updateMin = minIndexNum,
60915
+ updateMax = minIndexNum;
60916
+ if (Array.isArray(table.options.customMergeCell)) {
60917
+ const merges = table.options.customMergeCell,
60918
+ axis = table.transpose ? "col" : "row";
60919
+ merges.forEach(m => {
60920
+ const r = null == m ? void 0 : m.range;
60921
+ if ((null == r ? void 0 : r.start) && (null == r ? void 0 : r.end)) for (let i = 0; i < deletedIndexNums.length; i++) {
60922
+ const deleteIndex = deletedIndexNums[i];
60923
+ if (r.end[axis] >= deleteIndex - 1) {
60924
+ updateMin = Math.min(updateMin, r.start[axis]), updateMax = Math.max(updateMax, r.end[axis]);
60925
+ break;
60926
+ }
60927
+ }
60928
+ });
60929
+ }
60930
+ if (table.transpose) {
60931
+ const start = Math.max(updateMin, null !== (_j = null == proxy ? void 0 : proxy.colStart) && void 0 !== _j ? _j : updateMin),
60932
+ end = Math.min(updateMax, null !== (_k = null == proxy ? void 0 : proxy.colEnd) && void 0 !== _k ? _k : updateMax);
60933
+ for (let col = start; col <= end; col++) updateRows.push({
60934
+ col: col,
60935
+ row: 0
60936
+ });
60937
+ } else {
60938
+ const start = Math.max(updateMin, null !== (_l = null == proxy ? void 0 : proxy.rowStart) && void 0 !== _l ? _l : updateMin),
60939
+ end = Math.min(updateMax, null !== (_m = null == proxy ? void 0 : proxy.rowEnd) && void 0 !== _m ? _m : updateMax);
60940
+ for (let row = start; row <= end; row++) updateRows.push({
60941
+ col: 0,
60942
+ row: row
60943
+ });
60944
+ }
60945
+ }
60761
60946
  for (let row = headerCount; row < headerCount + topAggregationCount; row++) table.transpose ? updateRows.push({
60762
60947
  col: row,
60763
60948
  row: 0
@@ -60772,7 +60957,7 @@
60772
60957
  col: 0,
60773
60958
  row: row
60774
60959
  });
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();
60960
+ 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
60961
  }
60777
60962
  }
60778
60963
  }
@@ -60784,7 +60969,7 @@
60784
60969
  const syncToOriginalRecords = !!(null === (_f = table.options) || void 0 === _f ? void 0 : _f.syncRecordOperationsToSourceRecords),
60785
60970
  updateRecordIndexs = table.dataSource.updateRecords(records, recordIndexs, syncToOriginalRecords);
60786
60971
  if (0 === updateRecordIndexs.length) return;
60787
- if (syncToOriginalRecords) return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), void table.scenegraph.createSceneGraph();
60972
+ if (syncToOriginalRecords) return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), void table.scenegraph.createSceneGraph(!0);
60788
60973
  const recordIndexsMinToMax = updateRecordIndexs.map(index => table.getBodyRowIndexByRecordIndex(index)).sort((a, b) => a - b);
60789
60974
  if (table.pagination) {
60790
60975
  const {
@@ -61107,10 +61292,33 @@
61107
61292
  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
61293
  }
61109
61294
  addColumns(toAddColumns, colIndex, isMaintainArrayData = !0) {
61110
- var _a;
61295
+ var _a, _b;
61111
61296
  const columns = this.options.columns;
61297
+ if (Array.isArray(this.options.customMergeCell) && (null == toAddColumns ? void 0 : toAddColumns.length)) {
61298
+ const axis = this.transpose ? "row" : "col";
61299
+ let insertIndex = colIndex;
61300
+ void 0 === insertIndex ? insertIndex = columns.length : insertIndex < 0 ? insertIndex = 0 : insertIndex > columns.length && (insertIndex = columns.length);
61301
+ const toAddCount = toAddColumns.length,
61302
+ merges = this.options.customMergeCell.map(m => Object.assign(Object.assign({}, m), {
61303
+ range: {
61304
+ start: Object.assign({}, m.range.start),
61305
+ end: Object.assign({}, m.range.end)
61306
+ }
61307
+ }));
61308
+ for (let i = 0; i < merges.length; i++) {
61309
+ const r = null === (_a = merges[i]) || void 0 === _a ? void 0 : _a.range;
61310
+ if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
61311
+ const start = r.start[axis],
61312
+ end = r.end[axis];
61313
+ end < insertIndex || (start > insertIndex ? (r.start[axis] = start + toAddCount, r.end[axis] = end + toAddCount) : r.end[axis] = end + toAddCount);
61314
+ }
61315
+ this.options.customMergeCell = merges.filter(m => {
61316
+ const r = null == m ? void 0 : m.range;
61317
+ 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);
61318
+ }), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
61319
+ }
61112
61320
  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);
61321
+ 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
61322
  this.internalProps._colRangeWidthsMap.clear();
61115
61323
  const resizedColIndexs = Array.from(this.internalProps._widthResizedColMap.keys());
61116
61324
  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 +61331,46 @@
61123
61331
  }
61124
61332
  this.updateColumns(columns, {
61125
61333
  clearRowHeightCache: !1
61126
- }), this.fireListeners(TABLE_EVENT_TYPE.ADD_COLUMN, {
61334
+ }), Array.isArray(this.options.customMergeCell) && (this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell), this.options.customMergeCell.forEach(m => {
61335
+ const r = null == m ? void 0 : m.range;
61336
+ 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);
61337
+ }), this.scenegraph.updateNextFrame()), this.fireListeners(TABLE_EVENT_TYPE.ADD_COLUMN, {
61127
61338
  columnIndex: colIndex,
61128
61339
  columnCount: toAddColumns.length,
61129
61340
  columns: columns
61130
61341
  });
61131
61342
  }
61132
61343
  deleteColumns(deleteColIndexs, isMaintainArrayData = !0) {
61344
+ var _a;
61133
61345
  const columns = this.options.columns;
61134
61346
  deleteColIndexs.sort((a, b) => b - a);
61347
+ const deletedColumns = deleteColIndexs.map(idx => cloneDeepSpec(columns[idx], ["children"]));
61348
+ let deletedRecordValues;
61349
+ if (Array.isArray(this.options.customMergeCell) && (null == deleteColIndexs ? void 0 : deleteColIndexs.length)) {
61350
+ const axis = this.transpose ? "row" : "col",
61351
+ deleteIndexNums = deleteColIndexs.slice().sort((a, b) => a - b).map((idx, i) => idx - i),
61352
+ merges = this.options.customMergeCell.map(m => Object.assign(Object.assign({}, m), {
61353
+ range: {
61354
+ start: Object.assign({}, m.range.start),
61355
+ end: Object.assign({}, m.range.end)
61356
+ }
61357
+ }));
61358
+ for (let i = 0; i < deleteIndexNums.length; i++) {
61359
+ const deleteIndex = deleteIndexNums[i];
61360
+ for (let j = 0; j < merges.length; j++) {
61361
+ const r = null === (_a = merges[j]) || void 0 === _a ? void 0 : _a.range;
61362
+ if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
61363
+ const start = r.start[axis],
61364
+ end = r.end[axis];
61365
+ end < deleteIndex || (start > deleteIndex ? (r.start[axis] = start - 1, r.end[axis] = end - 1) : r.end[axis] = end - 1);
61366
+ }
61367
+ }
61368
+ this.options.customMergeCell = merges.filter(m => {
61369
+ const r = null == m ? void 0 : m.range;
61370
+ 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);
61371
+ }), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
61372
+ }
61373
+ 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
61374
  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
61375
  const record = this.records[j];
61137
61376
  Array.isArray(record) && record.splice(deleteColIndexs[i], 1);
@@ -61147,7 +61386,9 @@
61147
61386
  clearRowHeightCache: !1
61148
61387
  }), this.fireListeners(TABLE_EVENT_TYPE.DELETE_COLUMN, {
61149
61388
  deleteColIndexs: deleteColIndexs,
61150
- columns: columns
61389
+ columns: columns,
61390
+ deletedColumns: deletedColumns,
61391
+ deletedRecordValues: deletedRecordValues
61151
61392
  });
61152
61393
  }
61153
61394
  get columns() {
@@ -61535,9 +61776,9 @@
61535
61776
  }
61536
61777
  }
61537
61778
  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 => {
61779
+ var _a, _b, _c, _d, _e;
61780
+ const normalizedSortState = (Array.isArray(sortState) ? sortState : sortState ? [sortState] : []).filter(Boolean);
61781
+ 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
61782
  const sortFunc = this._getSortFuncFromHeaderOption(this.internalProps.columns, item.field);
61542
61783
  this.internalProps.layoutMap.headerObjects.find(col => col && col.field === item.field);
61543
61784
  return {
@@ -61545,13 +61786,20 @@
61545
61786
  order: item.order,
61546
61787
  orderFn: null != sortFunc ? sortFunc : defaultOrderFn
61547
61788
  };
61548
- })), this.internalProps.layoutMap.clearCellRangeMap(), this.internalProps.useOneRowHeightFillAll = !1, this.scenegraph.sortCell()), sortState.length && this.stateManager.updateSortState(sortState);
61789
+ })), this.internalProps.layoutMap.clearCellRangeMap(), this.internalProps.useOneRowHeightFillAll = !1, this.scenegraph.sortCell());else {
61790
+ const ds = this.dataSource,
61791
+ 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;
61792
+ (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({
61793
+ length: sourceLength
61794
+ }, (_, 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();
61795
+ }
61796
+ this.stateManager.updateSortState(normalizedSortState);
61549
61797
  }
61550
61798
  updateFilterRules(filterRules, options = {
61551
61799
  clearRowHeightCache: !0
61552
61800
  }) {
61553
61801
  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();
61802
+ 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
61803
  }
61556
61804
  getFilteredRecords() {
61557
61805
  return this.dataSource.records;
@@ -61826,30 +62074,112 @@
61826
62074
  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
62075
  }
61828
62076
  addRecord(record, recordIndex, triggerEvent = !0) {
61829
- var _a;
62077
+ var _a, _b;
62078
+ if (Array.isArray(this.options.customMergeCell) && "number" == typeof recordIndex) {
62079
+ const axis = this.transpose ? "col" : "row",
62080
+ headerCount = this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount,
62081
+ topAggregationCount = this.internalProps.layoutMap.hasAggregationOnTopCount;
62082
+ let insertIndex = recordIndex;
62083
+ void 0 === insertIndex || insertIndex > this.dataSource.sourceLength ? insertIndex = this.dataSource.sourceLength : insertIndex < 0 && (insertIndex = 0);
62084
+ const insertIndexNum = insertIndex + headerCount + topAggregationCount,
62085
+ merges = this.options.customMergeCell.map(m => Object.assign(Object.assign({}, m), {
62086
+ range: {
62087
+ start: Object.assign({}, m.range.start),
62088
+ end: Object.assign({}, m.range.end)
62089
+ }
62090
+ }));
62091
+ for (let i = 0; i < merges.length; i++) {
62092
+ const r = null === (_a = merges[i]) || void 0 === _a ? void 0 : _a.range;
62093
+ if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
62094
+ const start = r.start[axis],
62095
+ end = r.end[axis];
62096
+ end < insertIndexNum || (start > insertIndexNum ? (r.start[axis] = start + 1, r.end[axis] = end + 1) : r.end[axis] = end + 1);
62097
+ }
62098
+ this.options.customMergeCell = merges.filter(m => {
62099
+ const r = null == m ? void 0 : m.range;
62100
+ 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);
62101
+ }), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
62102
+ }
61830
62103
  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, {
62104
+ 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 => {
62105
+ const r = null == m ? void 0 : m.range;
62106
+ 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);
62107
+ }), this.scenegraph.updateNextFrame()), triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
61832
62108
  records: [record],
61833
62109
  recordIndex: recordIndex,
61834
62110
  recordCount: 1
61835
62111
  });
61836
62112
  }
61837
62113
  addRecords(records, recordIndex, triggerEvent = !0) {
61838
- var _a;
62114
+ var _a, _b;
62115
+ if (Array.isArray(this.options.customMergeCell) && "number" == typeof recordIndex && (null == records ? void 0 : records.length)) {
62116
+ const axis = this.transpose ? "col" : "row",
62117
+ headerCount = this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount,
62118
+ topAggregationCount = this.internalProps.layoutMap.hasAggregationOnTopCount;
62119
+ let insertIndex = recordIndex;
62120
+ void 0 === insertIndex || insertIndex > this.dataSource.sourceLength ? insertIndex = this.dataSource.sourceLength : insertIndex < 0 && (insertIndex = 0);
62121
+ const insertIndexNum = insertIndex + headerCount + topAggregationCount,
62122
+ toAddCount = records.length,
62123
+ merges = this.options.customMergeCell.map(m => Object.assign(Object.assign({}, m), {
62124
+ range: {
62125
+ start: Object.assign({}, m.range.start),
62126
+ end: Object.assign({}, m.range.end)
62127
+ }
62128
+ }));
62129
+ for (let i = 0; i < merges.length; i++) {
62130
+ const r = null === (_a = merges[i]) || void 0 === _a ? void 0 : _a.range;
62131
+ if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
62132
+ const start = r.start[axis],
62133
+ end = r.end[axis];
62134
+ end < insertIndexNum || (start > insertIndexNum ? (r.start[axis] = start + toAddCount, r.end[axis] = end + toAddCount) : r.end[axis] = end + toAddCount);
62135
+ }
62136
+ this.options.customMergeCell = merges.filter(m => {
62137
+ const r = null == m ? void 0 : m.range;
62138
+ 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);
62139
+ }), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
62140
+ }
61839
62141
  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, {
62142
+ "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 => {
62143
+ const r = null == m ? void 0 : m.range;
62144
+ 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);
62145
+ }), this.scenegraph.updateNextFrame()), triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
61841
62146
  records: records,
61842
62147
  recordIndex: recordIndex,
61843
62148
  recordCount: records.length
61844
62149
  });
61845
62150
  }
61846
62151
  deleteRecords(recordIndexs, triggerEvent = !0) {
61847
- var _a;
61848
- const deletedRecords = [];
61849
- (null == recordIndexs ? void 0 : recordIndexs.length) > 0 && recordIndexs.forEach(index => {
62152
+ var _a, _b;
62153
+ const prevMergeRanges = Array.isArray(this.options.customMergeCell) ? this.options.customMergeCell.map(m => null == m ? void 0 : m.range).filter(Boolean).map(r => ({
62154
+ start: Object.assign({}, r.start),
62155
+ end: Object.assign({}, r.end)
62156
+ })) : [],
62157
+ deletedRecords = [];
62158
+ if ((null == recordIndexs ? void 0 : recordIndexs.length) > 0 && recordIndexs.forEach(index => {
61850
62159
  let record = null;
61851
62160
  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();
62161
+ }), Array.isArray(this.options.customMergeCell) && (null == recordIndexs ? void 0 : recordIndexs.length) && "number" == typeof recordIndexs[0]) {
62162
+ const axis = this.transpose ? "col" : "row",
62163
+ headerCount = this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount,
62164
+ topAggregationCount = this.internalProps.layoutMap.hasAggregationOnTopCount,
62165
+ deleteIndexNums = recordIndexs.slice().sort((a, b) => a - b).map((index, i) => index + headerCount + topAggregationCount - i),
62166
+ merges = this.options.customMergeCell;
62167
+ for (let i = 0; i < deleteIndexNums.length; i++) {
62168
+ const deleteIndex = deleteIndexNums[i];
62169
+ for (let j = 0; j < merges.length; j++) {
62170
+ const r = null === (_a = merges[j]) || void 0 === _a ? void 0 : _a.range;
62171
+ if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
62172
+ const start = r.start[axis],
62173
+ end = r.end[axis];
62174
+ end < deleteIndex || (start > deleteIndex ? (r.start[axis] = start - 1, r.end[axis] = end - 1) : r.end[axis] = end - 1);
62175
+ }
62176
+ }
62177
+ this.options.customMergeCell = merges.filter(m => {
62178
+ const r = null == m ? void 0 : m.range;
62179
+ 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);
62180
+ });
62181
+ }
62182
+ listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_b = this.internalProps.emptyTip) || void 0 === _b || _b.resetVisible();
61853
62183
  const rowIndexs = [];
61854
62184
  for (let i = 0; i < recordIndexs.length; i++) rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
61855
62185
  triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
@@ -61857,7 +62187,16 @@
61857
62187
  records: deletedRecords,
61858
62188
  rowIndexs: rowIndexs,
61859
62189
  deletedCount: (Array.isArray(recordIndexs[0]), recordIndexs.length)
61860
- });
62190
+ }), Array.isArray(this.options.customMergeCell) && (this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell), this.options.customMergeCell.forEach(m => {
62191
+ const r = null == m ? void 0 : m.range;
62192
+ 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);
62193
+ }), this.scenegraph.updateNextFrame(), setTimeout(() => {
62194
+ if (!this.internalProps || !this.options || !this.scenegraph) return;
62195
+ Array.isArray(this.options.customMergeCell) && (this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell));
62196
+ [...prevMergeRanges, ...(Array.isArray(this.options.customMergeCell) ? this.options.customMergeCell.map(m => null == m ? void 0 : m.range) : [])].filter(Boolean).forEach(r => {
62197
+ 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);
62198
+ }), this.scenegraph.updateNextFrame();
62199
+ }, 0));
61861
62200
  }
61862
62201
  updateRecords(records, recordIndexs, triggerEvent = !0) {
61863
62202
  listTableUpdateRecords(records, recordIndexs, this), triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
@@ -61961,7 +62300,12 @@
61961
62300
  }
61962
62301
  }), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
61963
62302
  for (let i = startCol; i <= endCol; i++) for (let j = startRow; j <= endRow; j++) this.scenegraph.updateCellContent(i, j);
61964
- this.scenegraph.updateNextFrame();
62303
+ this.scenegraph.updateNextFrame(), this.fireListeners(TABLE_EVENT_TYPE.MERGE_CELLS, {
62304
+ startCol: startCol,
62305
+ startRow: startRow,
62306
+ endCol: endCol,
62307
+ endRow: endRow
62308
+ });
61965
62309
  }
61966
62310
  unmergeCells(startCol, startRow, endCol, endRow) {
61967
62311
  this.options.customMergeCell ? "function" == typeof this.options.customMergeCell && (this.options.customMergeCell = []) : this.options.customMergeCell = [], this.options.customMergeCell = this.options.customMergeCell.filter(item => {
@@ -61972,7 +62316,12 @@
61972
62316
  return !(start.col === startCol && start.row === startRow && end.col === endCol && end.row === endRow);
61973
62317
  }), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
61974
62318
  for (let i = startCol; i <= endCol; i++) for (let j = startRow; j <= endRow; j++) this.scenegraph.updateCellContent(i, j);
61975
- this.scenegraph.updateNextFrame();
62319
+ this.scenegraph.updateNextFrame(), this.fireListeners(TABLE_EVENT_TYPE.UNMERGE_CELLS, {
62320
+ startCol: startCol,
62321
+ startRow: startRow,
62322
+ endCol: endCol,
62323
+ endRow: endRow
62324
+ });
61976
62325
  }
61977
62326
  }
61978
62327