@visactor/vtable 1.23.3 → 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.
Files changed (79) hide show
  1. package/cjs/ListTable.d.ts +1 -0
  2. package/cjs/ListTable.js +182 -24
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/PivotTable.d.ts +1 -0
  5. package/cjs/PivotTable.js +10 -2
  6. package/cjs/PivotTable.js.map +1 -1
  7. package/cjs/core/BaseTable.d.ts +9 -0
  8. package/cjs/core/BaseTable.js +64 -15
  9. package/cjs/core/BaseTable.js.map +1 -1
  10. package/cjs/core/TABLE_EVENT_TYPE.d.ts +2 -0
  11. package/cjs/core/TABLE_EVENT_TYPE.js +2 -0
  12. package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
  13. package/cjs/core/animation.js +5 -3
  14. package/cjs/core/animation.js.map +1 -1
  15. package/cjs/core/record-helper.js +83 -13
  16. package/cjs/core/record-helper.js.map +1 -1
  17. package/cjs/data/DataSource.js +3 -2
  18. package/cjs/data/DataSource.js.map +1 -1
  19. package/cjs/dataset/DataStatistics.js +1 -2
  20. package/cjs/edit/edit-manager.js +21 -15
  21. package/cjs/edit/edit-manager.js.map +1 -1
  22. package/cjs/index.d.ts +3 -3
  23. package/cjs/index.js +51 -12
  24. package/cjs/index.js.map +1 -1
  25. package/cjs/layout/cell-range/simple-cell-range.js +14 -4
  26. package/cjs/layout/cell-range/simple-cell-range.js.map +1 -1
  27. package/cjs/scenegraph/group-creater/cell-helper.js +1 -1
  28. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  29. package/cjs/scenegraph/group-creater/init-scenegraph.js +1 -1
  30. package/cjs/scenegraph/group-creater/init-scenegraph.js.map +1 -1
  31. package/cjs/state/state.js +14 -11
  32. package/cjs/state/state.js.map +1 -1
  33. package/cjs/ts-types/base-table.d.ts +5 -0
  34. package/cjs/ts-types/base-table.js.map +1 -1
  35. package/cjs/ts-types/events.d.ts +16 -0
  36. package/cjs/ts-types/events.js.map +1 -1
  37. package/cjs/ts-types/table-engine.js.map +1 -1
  38. package/cjs/vrender.js.map +1 -1
  39. package/dist/vtable.js +906 -218
  40. package/dist/vtable.min.js +2 -2
  41. package/es/ListTable.d.ts +1 -0
  42. package/es/ListTable.js +177 -24
  43. package/es/ListTable.js.map +1 -1
  44. package/es/PivotTable.d.ts +1 -0
  45. package/es/PivotTable.js +8 -2
  46. package/es/PivotTable.js.map +1 -1
  47. package/es/core/BaseTable.d.ts +9 -0
  48. package/es/core/BaseTable.js +64 -15
  49. package/es/core/BaseTable.js.map +1 -1
  50. package/es/core/TABLE_EVENT_TYPE.d.ts +2 -0
  51. package/es/core/TABLE_EVENT_TYPE.js +2 -0
  52. package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
  53. package/es/core/animation.js +5 -3
  54. package/es/core/animation.js.map +1 -1
  55. package/es/core/record-helper.js +83 -12
  56. package/es/core/record-helper.js.map +1 -1
  57. package/es/data/DataSource.js +3 -2
  58. package/es/data/DataSource.js.map +1 -1
  59. package/es/dataset/DataStatistics.js +1 -2
  60. package/es/edit/edit-manager.js +20 -16
  61. package/es/edit/edit-manager.js.map +1 -1
  62. package/es/index.d.ts +3 -3
  63. package/es/index.js +5 -3
  64. package/es/index.js.map +1 -1
  65. package/es/layout/cell-range/simple-cell-range.js +14 -4
  66. package/es/layout/cell-range/simple-cell-range.js.map +1 -1
  67. package/es/scenegraph/group-creater/cell-helper.js +1 -1
  68. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  69. package/es/scenegraph/group-creater/init-scenegraph.js +1 -1
  70. package/es/scenegraph/group-creater/init-scenegraph.js.map +1 -1
  71. package/es/state/state.js +14 -11
  72. package/es/state/state.js.map +1 -1
  73. package/es/ts-types/base-table.d.ts +5 -0
  74. package/es/ts-types/base-table.js.map +1 -1
  75. package/es/ts-types/events.d.ts +16 -0
  76. package/es/ts-types/events.js.map +1 -1
  77. package/es/ts-types/table-engine.js.map +1 -1
  78. package/es/vrender.js.map +1 -1
  79. package/package.json +5 -5
package/es/ListTable.d.ts CHANGED
@@ -71,6 +71,7 @@ export declare class ListTable extends BaseTable implements ListTableAPI {
71
71
  updateSortState(sortState: SortState[] | SortState | null, executeSort?: boolean): void;
72
72
  updateFilterRules(filterRules: FilterRules, options?: {
73
73
  clearRowHeightCache?: boolean;
74
+ clearForceVisibleRecords?: boolean;
74
75
  onFilterRecordsEnd?: (records: any[]) => any[];
75
76
  }): void;
76
77
  getFilteredRecords(): any[];
package/es/ListTable.js CHANGED
@@ -129,10 +129,32 @@ export class ListTable extends BaseTable {
129
129
  this.renderAsync(), this.eventManager.updateEventBinder();
130
130
  }
131
131
  addColumns(toAddColumns, colIndex, isMaintainArrayData = !0) {
132
- var _a;
132
+ var _a, _b;
133
133
  const columns = this.options.columns;
134
+ if (Array.isArray(this.options.customMergeCell) && (null == toAddColumns ? void 0 : toAddColumns.length)) {
135
+ const axis = this.transpose ? "row" : "col";
136
+ let insertIndex = colIndex;
137
+ void 0 === insertIndex ? insertIndex = columns.length : insertIndex < 0 ? insertIndex = 0 : insertIndex > columns.length && (insertIndex = columns.length);
138
+ const toAddCount = toAddColumns.length, merges = this.options.customMergeCell.map((m => Object.assign(Object.assign({}, m), {
139
+ range: {
140
+ start: Object.assign({}, m.range.start),
141
+ end: Object.assign({}, m.range.end)
142
+ }
143
+ })));
144
+ for (let i = 0; i < merges.length; i++) {
145
+ const r = null === (_a = merges[i]) || void 0 === _a ? void 0 : _a.range;
146
+ if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
147
+ const start = r.start[axis], end = r.end[axis];
148
+ end < insertIndex || (start > insertIndex ? (r.start[axis] = start + toAddCount,
149
+ r.end[axis] = end + toAddCount) : r.end[axis] = end + toAddCount);
150
+ }
151
+ this.options.customMergeCell = merges.filter((m => {
152
+ const r = null == m ? void 0 : m.range;
153
+ 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));
154
+ })), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
155
+ }
134
156
  void 0 === colIndex ? (colIndex = columns.length, columns.push(...toAddColumns)) : columns.splice(colIndex, 0, ...toAddColumns);
135
- 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);
157
+ 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);
136
158
  this.internalProps._colRangeWidthsMap.clear();
137
159
  const resizedColIndexs = Array.from(this.internalProps._widthResizedColMap.keys());
138
160
  for (let i = 0; i < resizedColIndexs.length; i++) resizedColIndexs[i] >= colIndex && (this.internalProps._widthResizedColMap.delete(resizedColIndexs[i]),
@@ -146,15 +168,45 @@ export class ListTable extends BaseTable {
146
168
  }
147
169
  this.updateColumns(columns, {
148
170
  clearRowHeightCache: !1
149
- }), this.fireListeners(TABLE_EVENT_TYPE.ADD_COLUMN, {
171
+ }), Array.isArray(this.options.customMergeCell) && (this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell),
172
+ this.options.customMergeCell.forEach((m => {
173
+ const r = null == m ? void 0 : m.range;
174
+ 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);
175
+ })), this.scenegraph.updateNextFrame()), this.fireListeners(TABLE_EVENT_TYPE.ADD_COLUMN, {
150
176
  columnIndex: colIndex,
151
177
  columnCount: toAddColumns.length,
152
178
  columns: columns
153
179
  });
154
180
  }
155
181
  deleteColumns(deleteColIndexs, isMaintainArrayData = !0) {
182
+ var _a;
156
183
  const columns = this.options.columns;
157
184
  deleteColIndexs.sort(((a, b) => b - a));
185
+ const deletedColumns = deleteColIndexs.map((idx => cloneDeepSpec(columns[idx], [ "children" ])));
186
+ let deletedRecordValues;
187
+ if (Array.isArray(this.options.customMergeCell) && (null == deleteColIndexs ? void 0 : deleteColIndexs.length)) {
188
+ const axis = this.transpose ? "row" : "col", deleteIndexNums = deleteColIndexs.slice().sort(((a, b) => a - b)).map(((idx, i) => idx - i)), merges = this.options.customMergeCell.map((m => Object.assign(Object.assign({}, m), {
189
+ range: {
190
+ start: Object.assign({}, m.range.start),
191
+ end: Object.assign({}, m.range.end)
192
+ }
193
+ })));
194
+ for (let i = 0; i < deleteIndexNums.length; i++) {
195
+ const deleteIndex = deleteIndexNums[i];
196
+ for (let j = 0; j < merges.length; j++) {
197
+ const r = null === (_a = merges[j]) || void 0 === _a ? void 0 : _a.range;
198
+ if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
199
+ const start = r.start[axis], end = r.end[axis];
200
+ end < deleteIndex || (start > deleteIndex ? (r.start[axis] = start - 1, r.end[axis] = end - 1) : r.end[axis] = end - 1);
201
+ }
202
+ }
203
+ this.options.customMergeCell = merges.filter((m => {
204
+ const r = null == m ? void 0 : m.range;
205
+ 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));
206
+ })), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
207
+ }
208
+ isMaintainArrayData && Array.isArray(this.records) && this.records.length && (deletedRecordValues = this.records.map((record => Array.isArray(record) ? deleteColIndexs.map((idx => record[idx])) : [])),
209
+ deletedRecordValues.every((v => 0 === v.length)) && (deletedRecordValues = void 0));
158
210
  for (let i = 0; i < deleteColIndexs.length; i++) if (columns.splice(deleteColIndexs[i], 1),
159
211
  this.colWidthsMap.delAndReorder(deleteColIndexs[i]), this.internalProps._widthResizedColMap.delete(deleteColIndexs[i]),
160
212
  isMaintainArrayData) for (let j = 0; j < this.records.length; j++) {
@@ -172,7 +224,9 @@ export class ListTable extends BaseTable {
172
224
  clearRowHeightCache: !1
173
225
  }), this.fireListeners(TABLE_EVENT_TYPE.DELETE_COLUMN, {
174
226
  deleteColIndexs: deleteColIndexs,
175
- columns: columns
227
+ columns: columns,
228
+ deletedColumns: deletedColumns,
229
+ deletedRecordValues: deletedRecordValues
176
230
  });
177
231
  }
178
232
  get columns() {
@@ -554,10 +608,10 @@ export class ListTable extends BaseTable {
554
608
  }
555
609
  }
556
610
  updateSortState(sortState, executeSort = !0) {
557
- var _a;
558
- 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",
559
- sortState = this.internalProps.sortState;
560
- (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 => {
611
+ var _a, _b, _c, _d, _e;
612
+ const normalizedSortState = (Array.isArray(sortState) ? sortState : sortState ? [ sortState ] : []).filter(Boolean);
613
+ if (normalizedSortState.length ? this.internalProps.sortState = sortState : this.internalProps.sortState = null,
614
+ executeSort) if (normalizedSortState.length) this.internalProps.layoutMap.headerObjects.some((item => !1 !== item.define.sort)) && (this.dataSource.sort(normalizedSortState.map((item => {
561
615
  const sortFunc = this._getSortFuncFromHeaderOption(this.internalProps.columns, item.field);
562
616
  this.internalProps.layoutMap.headerObjects.find((col => col && col.field === item.field));
563
617
  return {
@@ -566,13 +620,22 @@ export class ListTable extends BaseTable {
566
620
  orderFn: null != sortFunc ? sortFunc : defaultOrderFn
567
621
  };
568
622
  }))), this.internalProps.layoutMap.clearCellRangeMap(), this.internalProps.useOneRowHeightFillAll = !1,
569
- this.scenegraph.sortCell()), sortState.length && this.stateManager.updateSortState(sortState);
623
+ this.scenegraph.sortCell()); else {
624
+ const ds = this.dataSource, 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;
625
+ (null === (_d = null == ds ? void 0 : ds.sortedIndexMap) || void 0 === _d ? void 0 : _d.clear) && ds.sortedIndexMap.clear(),
626
+ void 0 !== ds.currentIndexedData && (ds.currentIndexedData = Array.from({
627
+ length: sourceLength
628
+ }, ((_, i) => i))), ds.lastSortStates = [], null === (_e = ds.updatePagination) || void 0 === _e || _e.call(ds, ds.pagination),
629
+ this.internalProps.layoutMap.clearCellRangeMap(), this.internalProps.useOneRowHeightFillAll = !1,
630
+ this.scenegraph.sortCell();
631
+ }
632
+ this.stateManager.updateSortState(normalizedSortState);
570
633
  }
571
634
  updateFilterRules(filterRules, options = {
572
635
  clearRowHeightCache: !0
573
636
  }) {
574
637
  var _a, _b, _c;
575
- this.scenegraph.clearCells(), null === (_b = (_a = this.dataSource).clearForceVisibleRecords) || void 0 === _b || _b.call(_a),
638
+ this.scenegraph.clearCells(), !1 !== (null == options ? void 0 : options.clearForceVisibleRecords) && (null === (_b = (_a = this.dataSource).clearForceVisibleRecords) || void 0 === _b || _b.call(_a)),
576
639
  this.sortState ? (this.dataSource.updateFilterRulesForSorted(filterRules), sortRecords(this)) : this.dataSource.updateFilterRules(filterRules, null == options ? void 0 : options.onFilterRecordsEnd),
577
640
  this.refreshRowColCount(), this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(!(null == options ? void 0 : options.clearRowHeightCache)),
578
641
  null === (_c = this.internalProps.emptyTip) || void 0 === _c || _c.resetVisible(),
@@ -842,34 +905,104 @@ export class ListTable extends BaseTable {
842
905
  this.resize();
843
906
  }
844
907
  addRecord(record, recordIndex, triggerEvent = !0) {
845
- var _a;
908
+ var _a, _b;
909
+ if (Array.isArray(this.options.customMergeCell) && "number" == typeof recordIndex) {
910
+ const axis = this.transpose ? "col" : "row", headerCount = this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount, topAggregationCount = this.internalProps.layoutMap.hasAggregationOnTopCount;
911
+ let insertIndex = recordIndex;
912
+ void 0 === insertIndex || insertIndex > this.dataSource.sourceLength ? insertIndex = this.dataSource.sourceLength : insertIndex < 0 && (insertIndex = 0);
913
+ const insertIndexNum = insertIndex + headerCount + topAggregationCount, merges = this.options.customMergeCell.map((m => Object.assign(Object.assign({}, m), {
914
+ range: {
915
+ start: Object.assign({}, m.range.start),
916
+ end: Object.assign({}, m.range.end)
917
+ }
918
+ })));
919
+ for (let i = 0; i < merges.length; i++) {
920
+ const r = null === (_a = merges[i]) || void 0 === _a ? void 0 : _a.range;
921
+ if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
922
+ const start = r.start[axis], end = r.end[axis];
923
+ end < insertIndexNum || (start > insertIndexNum ? (r.start[axis] = start + 1, r.end[axis] = end + 1) : r.end[axis] = end + 1);
924
+ }
925
+ this.options.customMergeCell = merges.filter((m => {
926
+ const r = null == m ? void 0 : m.range;
927
+ 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));
928
+ })), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
929
+ }
846
930
  const success = listTableAddRecord(record, recordIndex, this);
847
- adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [ record ]), null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(),
848
- triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
931
+ adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [ record ]), null === (_b = this.internalProps.emptyTip) || void 0 === _b || _b.resetVisible(),
932
+ success && Array.isArray(this.options.customMergeCell) && (this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell),
933
+ this.options.customMergeCell.forEach((m => {
934
+ const r = null == m ? void 0 : m.range;
935
+ 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);
936
+ })), this.scenegraph.updateNextFrame()), triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
849
937
  records: [ record ],
850
938
  recordIndex: recordIndex,
851
939
  recordCount: 1
852
940
  });
853
941
  }
854
942
  addRecords(records, recordIndex, triggerEvent = !0) {
855
- var _a;
943
+ var _a, _b;
944
+ if (Array.isArray(this.options.customMergeCell) && "number" == typeof recordIndex && (null == records ? void 0 : records.length)) {
945
+ const axis = this.transpose ? "col" : "row", headerCount = this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount, topAggregationCount = this.internalProps.layoutMap.hasAggregationOnTopCount;
946
+ let insertIndex = recordIndex;
947
+ void 0 === insertIndex || insertIndex > this.dataSource.sourceLength ? insertIndex = this.dataSource.sourceLength : insertIndex < 0 && (insertIndex = 0);
948
+ const insertIndexNum = insertIndex + headerCount + topAggregationCount, toAddCount = records.length, merges = this.options.customMergeCell.map((m => Object.assign(Object.assign({}, m), {
949
+ range: {
950
+ start: Object.assign({}, m.range.start),
951
+ end: Object.assign({}, m.range.end)
952
+ }
953
+ })));
954
+ for (let i = 0; i < merges.length; i++) {
955
+ const r = null === (_a = merges[i]) || void 0 === _a ? void 0 : _a.range;
956
+ if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
957
+ const start = r.start[axis], end = r.end[axis];
958
+ end < insertIndexNum || (start > insertIndexNum ? (r.start[axis] = start + toAddCount,
959
+ r.end[axis] = end + toAddCount) : r.end[axis] = end + toAddCount);
960
+ }
961
+ this.options.customMergeCell = merges.filter((m => {
962
+ const r = null == m ? void 0 : m.range;
963
+ 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));
964
+ })), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
965
+ }
856
966
  const success = listTableAddRecords(records, recordIndex, this);
857
967
  "number" == typeof recordIndex && adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, records),
858
- null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible(),
859
- triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
968
+ null === (_b = this.internalProps.emptyTip) || void 0 === _b || _b.resetVisible(),
969
+ success && Array.isArray(this.options.customMergeCell) && (this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell),
970
+ this.options.customMergeCell.forEach((m => {
971
+ const r = null == m ? void 0 : m.range;
972
+ 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);
973
+ })), this.scenegraph.updateNextFrame()), triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
860
974
  records: records,
861
975
  recordIndex: recordIndex,
862
976
  recordCount: records.length
863
977
  });
864
978
  }
865
979
  deleteRecords(recordIndexs, triggerEvent = !0) {
866
- var _a;
867
- const deletedRecords = [];
868
- (null == recordIndexs ? void 0 : recordIndexs.length) > 0 && recordIndexs.forEach((index => {
980
+ var _a, _b;
981
+ const prevMergeRanges = Array.isArray(this.options.customMergeCell) ? this.options.customMergeCell.map((m => null == m ? void 0 : m.range)).filter(Boolean).map((r => ({
982
+ start: Object.assign({}, r.start),
983
+ end: Object.assign({}, r.end)
984
+ }))) : [], deletedRecords = [];
985
+ if ((null == recordIndexs ? void 0 : recordIndexs.length) > 0 && recordIndexs.forEach((index => {
869
986
  let record = null;
870
987
  record = "number" == typeof index ? this.dataSource.get(index) : [], deletedRecords.push(record);
871
- })), listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs),
872
- null === (_a = this.internalProps.emptyTip) || void 0 === _a || _a.resetVisible();
988
+ })), Array.isArray(this.options.customMergeCell) && (null == recordIndexs ? void 0 : recordIndexs.length) && "number" == typeof recordIndexs[0]) {
989
+ const axis = this.transpose ? "col" : "row", headerCount = this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount, topAggregationCount = this.internalProps.layoutMap.hasAggregationOnTopCount, deleteIndexNums = recordIndexs.slice().sort(((a, b) => a - b)).map(((index, i) => index + headerCount + topAggregationCount - i)), merges = this.options.customMergeCell;
990
+ for (let i = 0; i < deleteIndexNums.length; i++) {
991
+ const deleteIndex = deleteIndexNums[i];
992
+ for (let j = 0; j < merges.length; j++) {
993
+ const r = null === (_a = merges[j]) || void 0 === _a ? void 0 : _a.range;
994
+ if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
995
+ const start = r.start[axis], end = r.end[axis];
996
+ end < deleteIndex || (start > deleteIndex ? (r.start[axis] = start - 1, r.end[axis] = end - 1) : r.end[axis] = end - 1);
997
+ }
998
+ }
999
+ this.options.customMergeCell = merges.filter((m => {
1000
+ const r = null == m ? void 0 : m.range;
1001
+ 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));
1002
+ }));
1003
+ }
1004
+ listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs),
1005
+ null === (_b = this.internalProps.emptyTip) || void 0 === _b || _b.resetVisible();
873
1006
  const rowIndexs = [];
874
1007
  for (let i = 0; i < recordIndexs.length; i++) rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
875
1008
  triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
@@ -877,7 +1010,17 @@ export class ListTable extends BaseTable {
877
1010
  records: deletedRecords,
878
1011
  rowIndexs: rowIndexs,
879
1012
  deletedCount: (Array.isArray(recordIndexs[0]), recordIndexs.length)
880
- });
1013
+ }), Array.isArray(this.options.customMergeCell) && (this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell),
1014
+ this.options.customMergeCell.forEach((m => {
1015
+ const r = null == m ? void 0 : m.range;
1016
+ 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);
1017
+ })), this.scenegraph.updateNextFrame(), setTimeout((() => {
1018
+ if (!this.internalProps || !this.options || !this.scenegraph) return;
1019
+ Array.isArray(this.options.customMergeCell) && (this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell));
1020
+ [ ...prevMergeRanges, ...Array.isArray(this.options.customMergeCell) ? this.options.customMergeCell.map((m => null == m ? void 0 : m.range)) : [] ].filter(Boolean).forEach((r => {
1021
+ 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);
1022
+ })), this.scenegraph.updateNextFrame();
1023
+ }), 0));
881
1024
  }
882
1025
  updateRecords(records, recordIndexs, triggerEvent = !0) {
883
1026
  listTableUpdateRecords(records, recordIndexs, this), triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
@@ -981,7 +1124,12 @@ export class ListTable extends BaseTable {
981
1124
  }
982
1125
  }), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
983
1126
  for (let i = startCol; i <= endCol; i++) for (let j = startRow; j <= endRow; j++) this.scenegraph.updateCellContent(i, j);
984
- this.scenegraph.updateNextFrame();
1127
+ this.scenegraph.updateNextFrame(), this.fireListeners(TABLE_EVENT_TYPE.MERGE_CELLS, {
1128
+ startCol: startCol,
1129
+ startRow: startRow,
1130
+ endCol: endCol,
1131
+ endRow: endRow
1132
+ });
985
1133
  }
986
1134
  unmergeCells(startCol, startRow, endCol, endRow) {
987
1135
  this.options.customMergeCell ? "function" == typeof this.options.customMergeCell && (this.options.customMergeCell = []) : this.options.customMergeCell = [],
@@ -990,7 +1138,12 @@ export class ListTable extends BaseTable {
990
1138
  return !(start.col === startCol && start.row === startRow && end.col === endCol && end.row === endRow);
991
1139
  })), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
992
1140
  for (let i = startCol; i <= endCol; i++) for (let j = startRow; j <= endRow; j++) this.scenegraph.updateCellContent(i, j);
993
- this.scenegraph.updateNextFrame();
1141
+ this.scenegraph.updateNextFrame(), this.fireListeners(TABLE_EVENT_TYPE.UNMERGE_CELLS, {
1142
+ startCol: startCol,
1143
+ startRow: startRow,
1144
+ endCol: endCol,
1145
+ endRow: endRow
1146
+ });
994
1147
  }
995
1148
  }
996
1149
  //# sourceMappingURL=ListTable.js.map