@visactor/vtable-calendar 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.
- package/dist/vtable-calendar.js +389 -74
- package/dist/vtable-calendar.min.js +1 -1
- package/package.json +5 -5
package/dist/vtable-calendar.js
CHANGED
|
@@ -34921,6 +34921,8 @@
|
|
|
34921
34921
|
RESIZE_COLUMN_END: "resize_column_end",
|
|
34922
34922
|
RESIZE_ROW: "resize_row",
|
|
34923
34923
|
RESIZE_ROW_END: "resize_row_end",
|
|
34924
|
+
MERGE_CELLS: "merge_cells",
|
|
34925
|
+
UNMERGE_CELLS: "unmerge_cells",
|
|
34924
34926
|
CHANGE_HEADER_POSITION_START: "change_header_position_start",
|
|
34925
34927
|
CHANGE_HEADER_POSITION: "change_header_position",
|
|
34926
34928
|
CHANGING_HEADER_POSITION: "changing_header_position",
|
|
@@ -37373,7 +37375,7 @@
|
|
|
37373
37375
|
}
|
|
37374
37376
|
clearFilteredChildren(record) {
|
|
37375
37377
|
var _a, _b;
|
|
37376
|
-
record.filteredChildren = void 0;
|
|
37378
|
+
record.filteredChildren = void 0, delete record.filteredChildren;
|
|
37377
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]);
|
|
37378
37380
|
}
|
|
37379
37381
|
filterRecord(record) {
|
|
@@ -37476,8 +37478,9 @@
|
|
|
37476
37478
|
fieldPromiseCallBack(_index, _field, _value) {}
|
|
37477
37479
|
recordPromiseCallBack(_index, _record) {}
|
|
37478
37480
|
canChangeOrder(sourceIndex, targetIndex) {
|
|
37479
|
-
var _a;
|
|
37481
|
+
var _a, _b;
|
|
37480
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;
|
|
37481
37484
|
if (this.hasHierarchyStateExpand) {
|
|
37482
37485
|
let sourceIndexs = this.currentPagerIndexedData[sourceIndex],
|
|
37483
37486
|
targetIndexs = this.currentPagerIndexedData[targetIndex];
|
|
@@ -41480,7 +41483,7 @@
|
|
|
41480
41483
|
function updateCell$1(col, row, table, addNew, isShadow, forceFastUpdate) {
|
|
41481
41484
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
41482
41485
|
const oldCellGroup = table.scenegraph.highPerformanceGetCell(col, row, !0);
|
|
41483
|
-
if ("cell" !== oldCellGroup.role && !addNew) return;
|
|
41486
|
+
if ("cell" !== oldCellGroup.role && "shadow-cell" !== oldCellGroup.role && !addNew) return;
|
|
41484
41487
|
const cellLocation = table.getCellLocation(col, row);
|
|
41485
41488
|
let isMerge,
|
|
41486
41489
|
range,
|
|
@@ -48930,7 +48933,7 @@
|
|
|
48930
48933
|
}), scene.tableGroup.role = "table";
|
|
48931
48934
|
const colHeaderGroup = createContainerGroup(0, 0, !scene.table.internalProps.enableTreeStickCell);
|
|
48932
48935
|
colHeaderGroup.role = "col-header", scene.colHeaderGroup = colHeaderGroup;
|
|
48933
|
-
const cornerHeaderGroup = createContainerGroup(0, 0, !scene.table.
|
|
48936
|
+
const cornerHeaderGroup = createContainerGroup(0, 0, !scene.table.internalProps.enableTreeStickCell);
|
|
48934
48937
|
cornerHeaderGroup.role = "corner-header", scene.cornerHeaderGroup = cornerHeaderGroup;
|
|
48935
48938
|
const rowHeaderGroup = createContainerGroup(0, 0, !0);
|
|
48936
48939
|
rowHeaderGroup.role = "row-header", scene.rowHeaderGroup = rowHeaderGroup;
|
|
@@ -51728,13 +51731,13 @@
|
|
|
51728
51731
|
setSortState(sortState) {
|
|
51729
51732
|
const state = this;
|
|
51730
51733
|
const sort = (sortState = !sortState || Array.isArray(sortState) ? sortState : [sortState]) && sortState.reduce((prev, item) => {
|
|
51731
|
-
var _a, _b, _c;
|
|
51734
|
+
var _a, _b, _c, _d, _e;
|
|
51732
51735
|
const column = null === (_a = function (columns) {
|
|
51733
51736
|
const result = [];
|
|
51734
51737
|
return function flatten(cols, parentStartIndex = 0) {
|
|
51735
51738
|
cols.forEach(col => {
|
|
51736
51739
|
var _a;
|
|
51737
|
-
const startIndex = col.startInTotal ? null !== (_a =
|
|
51740
|
+
const startIndex = col.startInTotal ? col.startInTotal + (null !== (_a = state.table.internalProps.layoutMap.leftRowSeriesNumberColumnCount) && void 0 !== _a ? _a : 0) : parentStartIndex;
|
|
51738
51741
|
col.columns ? flatten(col.columns, startIndex) : result.push(Object.assign(Object.assign({}, col), {
|
|
51739
51742
|
startIndex: startIndex
|
|
51740
51743
|
}));
|
|
@@ -51744,12 +51747,12 @@
|
|
|
51744
51747
|
return this.table.internalProps.transpose ? prev.push({
|
|
51745
51748
|
field: item.field,
|
|
51746
51749
|
order: item.order,
|
|
51747
|
-
row: null !== (_b =
|
|
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),
|
|
51748
51751
|
col: null == column ? void 0 : column.level
|
|
51749
51752
|
}) : prev.push({
|
|
51750
51753
|
field: item.field,
|
|
51751
51754
|
order: item.order,
|
|
51752
|
-
col: null !== (
|
|
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),
|
|
51753
51756
|
row: null == column ? void 0 : column.level
|
|
51754
51757
|
}), prev;
|
|
51755
51758
|
}, []);
|
|
@@ -52261,13 +52264,16 @@
|
|
|
52261
52264
|
this.select.selectInline = selectInline;
|
|
52262
52265
|
}
|
|
52263
52266
|
updateSortState(sortState) {
|
|
52264
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
52265
|
-
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;
|
|
52266
52273
|
for (let index = 0; index < sortState.length; index++) {
|
|
52267
|
-
|
|
52268
|
-
|
|
52269
|
-
|
|
52270
|
-
"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;
|
|
52271
52277
|
this.setSortState(sortState.slice(0, index + 1));
|
|
52272
52278
|
const cellAddress = this.table.internalProps.layoutMap.getHeaderCellAddressByField(sortState[index].field);
|
|
52273
52279
|
this.sort[index].col = cellAddress.col, this.sort[index].row = cellAddress.row;
|
|
@@ -52280,7 +52286,7 @@
|
|
|
52280
52286
|
order: this.sort[index].order,
|
|
52281
52287
|
oldSortCol: oldSortCol,
|
|
52282
52288
|
oldSortRow: oldSortRow,
|
|
52283
|
-
oldIconMark: null === (
|
|
52289
|
+
oldIconMark: null === (_e = this.sort[index]) || void 0 === _e ? void 0 : _e.icon
|
|
52284
52290
|
});
|
|
52285
52291
|
}
|
|
52286
52292
|
const normalHeaders = [];
|
|
@@ -52294,7 +52300,7 @@
|
|
|
52294
52300
|
row: null,
|
|
52295
52301
|
iconMark: null,
|
|
52296
52302
|
order: null,
|
|
52297
|
-
oldSortCol: null !== (
|
|
52303
|
+
oldSortCol: (null !== (_f = column.startInTotal) && void 0 !== _f ? _f : 0) + (null !== (_g = this.table.internalProps.layoutMap.leftRowSeriesNumberColumnCount) && void 0 !== _g ? _g : 0),
|
|
52298
52304
|
oldSortRow: column.level,
|
|
52299
52305
|
oldIconMark: null
|
|
52300
52306
|
});
|
|
@@ -56424,11 +56430,11 @@
|
|
|
56424
56430
|
onUpdate(end, ratio, out) {
|
|
56425
56431
|
if (this.from.x !== this.to.x) {
|
|
56426
56432
|
const x = end ? this.to.x : this.from.x + Math.floor((this.to.x - this.from.x) * ratio);
|
|
56427
|
-
this.params.table.scrollLeft = x;
|
|
56433
|
+
this.params.table.scrollLeft = x, 1 === ratio && -1 !== this.to.targetCol && this.params.table.scrollToCol(this.to.targetCol, !1);
|
|
56428
56434
|
}
|
|
56429
56435
|
if (this.from.y !== this.to.y) {
|
|
56430
56436
|
const y = end ? this.to.y : this.from.y + Math.floor((this.to.y - this.from.y) * ratio);
|
|
56431
|
-
this.params.table.scrollTop = y;
|
|
56437
|
+
this.params.table.scrollTop = y, 1 === ratio && -1 !== this.to.targetRow && this.params.table.scrollToRow(this.to.targetRow, !1);
|
|
56432
56438
|
}
|
|
56433
56439
|
}
|
|
56434
56440
|
}
|
|
@@ -56460,7 +56466,9 @@
|
|
|
56460
56466
|
colDecimal && (left += colDecimal * cellRect.width), rowDecimal && (top += rowDecimal * cellRect.height);
|
|
56461
56467
|
const to = {
|
|
56462
56468
|
x: isNumber$2(col) ? left - this.table.getFrozenColsWidth() : this.table.scrollLeft,
|
|
56463
|
-
y: isNumber$2(row) ? top - this.table.getFrozenRowsHeight() : this.table.scrollTop
|
|
56469
|
+
y: isNumber$2(row) ? top - this.table.getFrozenRowsHeight() : this.table.scrollTop,
|
|
56470
|
+
targetRow: null != rowInt ? rowInt : -1,
|
|
56471
|
+
targetCol: null != colInt ? colInt : -1
|
|
56464
56472
|
},
|
|
56465
56473
|
duration = isBoolean$2(animationOption) ? animationOption ? 3e3 : 0 : null !== (_a = null == animationOption ? void 0 : animationOption.duration) && void 0 !== _a ? _a : 3e3,
|
|
56466
56474
|
easing = isBoolean$2(animationOption) ? animationOption ? "linear" : "" : null !== (_b = null == animationOption ? void 0 : animationOption.easing) && void 0 !== _b ? _b : "linear";
|
|
@@ -56547,7 +56555,7 @@
|
|
|
56547
56555
|
}
|
|
56548
56556
|
constructor(container, options = {}) {
|
|
56549
56557
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
56550
|
-
if (super(), this.showFrozenIcon = !0, this._tableBorderWidth_left = 0, this._tableBorderWidth_right = 0, this._tableBorderWidth_top = 0, this._tableBorderWidth_bottom = 0, this.version = "1.
|
|
56558
|
+
if (super(), this.showFrozenIcon = !0, this._scrollToRowCorrectTimer = null, this._tableBorderWidth_left = 0, this._tableBorderWidth_right = 0, this._tableBorderWidth_top = 0, this._tableBorderWidth_bottom = 0, this.version = "1.24.0-alpha.0", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
|
|
56551
56559
|
this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
|
|
56552
56560
|
options: options,
|
|
56553
56561
|
container: container
|
|
@@ -57485,12 +57493,15 @@
|
|
|
57485
57493
|
dispose() {
|
|
57486
57494
|
this.release();
|
|
57487
57495
|
}
|
|
57496
|
+
clearCorrectTimer() {
|
|
57497
|
+
this._scrollToRowCorrectTimer && (clearTimeout(this._scrollToRowCorrectTimer), this._scrollToRowCorrectTimer = null);
|
|
57498
|
+
}
|
|
57488
57499
|
release() {
|
|
57489
57500
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
57490
57501
|
null === (_c = null === (_b = null === (_a = this.scenegraph) || void 0 === _a ? void 0 : _a.component) || void 0 === _b ? void 0 : _b.vScrollBar) || void 0 === _c || _c.release(), null === (_f = null === (_e = null === (_d = this.scenegraph) || void 0 === _d ? void 0 : _d.component) || void 0 === _e ? void 0 : _e.hScrollBar) || void 0 === _f || _f.release(), this.animationManager.clear(), this.animationManager.ticker.release(), null === (_j = null === (_h = null === (_g = this.scenegraph) || void 0 === _g ? void 0 : _g.stage) || void 0 === _h ? void 0 : _h.ticker) || void 0 === _j || _j.release();
|
|
57491
57502
|
const internalProps = this.internalProps;
|
|
57492
57503
|
if (this.isReleased) return;
|
|
57493
|
-
null === (_l = null === (_k = internalProps.tooltipHandler) || void 0 === _k ? void 0 : _k.release) || void 0 === _l || _l.call(_k), null === (_o = null === (_m = internalProps.menuHandler) || void 0 === _m ? void 0 : _m.release) || void 0 === _o || _o.call(_m), null === (_p = super.release) || void 0 === _p || _p.call(this), this.pluginManager.release(), null === (_r = null === (_q = internalProps.handler) || void 0 === _q ? void 0 : _q.release) || void 0 === _r || _r.call(_q), this.eventManager.release(), null === (_t = null === (_s = internalProps.focusControl) || void 0 === _s ? void 0 : _s.release) || void 0 === _t || _t.call(_s), null === (_u = internalProps.legends) || void 0 === _u || _u.forEach(legend => {
|
|
57504
|
+
this.clearCorrectTimer(), null === (_l = null === (_k = internalProps.tooltipHandler) || void 0 === _k ? void 0 : _k.release) || void 0 === _l || _l.call(_k), null === (_o = null === (_m = internalProps.menuHandler) || void 0 === _m ? void 0 : _m.release) || void 0 === _o || _o.call(_m), null === (_p = super.release) || void 0 === _p || _p.call(this), this.pluginManager.release(), null === (_r = null === (_q = internalProps.handler) || void 0 === _q ? void 0 : _q.release) || void 0 === _r || _r.call(_q), this.eventManager.release(), null === (_t = null === (_s = internalProps.focusControl) || void 0 === _s ? void 0 : _s.release) || void 0 === _t || _t.call(_s), null === (_u = internalProps.legends) || void 0 === _u || _u.forEach(legend => {
|
|
57494
57505
|
null == legend || legend.release();
|
|
57495
57506
|
}), null === (_v = internalProps.title) || void 0 === _v || _v.release(), internalProps.title = null, null === (_w = internalProps.emptyTip) || void 0 === _w || _w.release(), internalProps.emptyTip = null, internalProps.layoutMap.release(), internalProps.releaseList && (internalProps.releaseList.forEach(releaseObj => {
|
|
57496
57507
|
var _a;
|
|
@@ -57795,6 +57806,30 @@
|
|
|
57795
57806
|
lastSelectRange = currentSelectRanges[currentSelectRanges.length - 1];
|
|
57796
57807
|
lastSelectRange && (lastSelectRange.end.row = rowIndex), this.stateManager.updateSelectPos(this.colCount - 1, rowIndex, !1, isCtrl, !1, makeSelectCellVisible, !0), this.stateManager.select.selecting = !1;
|
|
57797
57808
|
}
|
|
57809
|
+
changeHeaderPosition(args) {
|
|
57810
|
+
var _a, _b, _c, _d, _e;
|
|
57811
|
+
if (!("canMoveHeaderPosition" in this.internalProps.layoutMap) || !0 === (null === (_a = this.options.customConfig) || void 0 === _a ? void 0 : _a.notUpdateInColumnRowMove)) return !1;
|
|
57812
|
+
const prevMoving = this.stateManager.columnMove.movingColumnOrRow;
|
|
57813
|
+
this.stateManager.columnMove.movingColumnOrRow = args.movingColumnOrRow;
|
|
57814
|
+
try {
|
|
57815
|
+
if (!1 === (null === (_c = (_b = this.internalProps.layoutMap).canMoveHeaderPosition) || void 0 === _c ? void 0 : _c.call(_b, args.source, args.target))) return !1;
|
|
57816
|
+
const oldSourceMergeInfo = this.getCellRange(args.source.col, args.source.row),
|
|
57817
|
+
oldTargetMergeInfo = this.getCellRange(args.target.col, args.target.row),
|
|
57818
|
+
moveContext = this._moveHeaderPosition(args.source, args.target);
|
|
57819
|
+
if (!moveContext || moveContext.targetIndex === moveContext.sourceIndex) return !1;
|
|
57820
|
+
this.internalProps.useOneRowHeightFillAll = !1, this.internalProps.layoutMap.clearCellRangeMap();
|
|
57821
|
+
const sourceMergeInfo = this.getCellRange(args.source.col, args.source.row),
|
|
57822
|
+
targetMergeInfo = this.getCellRange(args.target.col, args.target.row),
|
|
57823
|
+
colMin = Math.min(sourceMergeInfo.start.col, targetMergeInfo.start.col, oldSourceMergeInfo.start.col, oldTargetMergeInfo.start.col),
|
|
57824
|
+
colMax = Math.max(sourceMergeInfo.end.col, targetMergeInfo.end.col, oldSourceMergeInfo.end.col, oldTargetMergeInfo.end.col),
|
|
57825
|
+
rowMin = Math.min(sourceMergeInfo.start.row, targetMergeInfo.start.row, oldSourceMergeInfo.start.row, oldTargetMergeInfo.start.row);
|
|
57826
|
+
let rowMax = Math.max(sourceMergeInfo.end.row, targetMergeInfo.end.row, oldSourceMergeInfo.end.row, oldTargetMergeInfo.end.row);
|
|
57827
|
+
if ("row" === moveContext.moveType && "tree" === this.internalProps.layoutMap.rowHierarchyType && (rowMax = moveContext.targetIndex > moveContext.sourceIndex ? rowMax + moveContext.targetSize - 1 : rowMax + moveContext.sourceSize - 1), this.transpose || !this.isSeriesNumberInBody(args.source.col, args.source.row) && "row" !== args.movingColumnOrRow || (this.changeRecordOrder(moveContext.sourceIndex, moveContext.targetIndex), this.stateManager.changeCheckboxAndRadioOrder(moveContext.sourceIndex, moveContext.targetIndex)), "column" === moveContext.moveType) for (let col = colMin; col <= colMax; col++) this._clearColRangeWidthsMap(col);else for (let row = rowMin; row <= rowMax; row++) this._clearRowRangeHeightsMap(row);
|
|
57828
|
+
return this.clearCellStyleCache(), this.isSeriesNumberInBody(args.source.col, args.source.row) || "row" === args.movingColumnOrRow ? this.scenegraph.updateHeaderPosition(this.scenegraph.proxy.colStart, this.scenegraph.proxy.colEnd, this.scenegraph.proxy.rowStart, this.scenegraph.proxy.rowEnd, moveContext.moveType) : "column" === moveContext.moveType ? this.scenegraph.updateHeaderPosition(colMin, colMax, 0, -1, moveContext.moveType) : this.scenegraph.updateHeaderPosition(0, -1, rowMin, rowMax, moveContext.moveType), "adjustFrozenCount" === this.internalProps.frozenColDragHeaderMode && this.isListTable() && (this.isLeftFrozenColumn(args.target.col) && !this.isLeftFrozenColumn(args.source.col) ? this.frozenColCount += sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1 : this.isLeftFrozenColumn(args.source.col) && !this.isLeftFrozenColumn(args.target.col) && (this.frozenColCount -= sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1), this.isRightFrozenColumn(args.target.col) && !this.isRightFrozenColumn(args.source.col) ? this.rightFrozenColCount += sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1 : this.isRightFrozenColumn(args.source.col) && !this.isRightFrozenColumn(args.target.col) && (this.rightFrozenColCount -= sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1)), null === (_e = (_d = this.scenegraph).updateNextFrame) || void 0 === _e || _e.call(_d), !0;
|
|
57829
|
+
} finally {
|
|
57830
|
+
this.stateManager.columnMove.movingColumnOrRow = prevMoving;
|
|
57831
|
+
}
|
|
57832
|
+
}
|
|
57798
57833
|
get recordsCount() {
|
|
57799
57834
|
var _a;
|
|
57800
57835
|
return null === (_a = this.records) || void 0 === _a ? void 0 : _a.length;
|
|
@@ -57940,7 +57975,7 @@
|
|
|
57940
57975
|
getCustomMerge(col, row) {
|
|
57941
57976
|
if (this.internalProps.customMergeCell) {
|
|
57942
57977
|
const customMerge = this.internalProps.customMergeCell(col, row, this);
|
|
57943
|
-
if (customMerge && customMerge.range
|
|
57978
|
+
if (customMerge && customMerge.range) {
|
|
57944
57979
|
if (customMerge.style) {
|
|
57945
57980
|
const styleClass = this.internalProps.bodyHelper.getStyleClass("text"),
|
|
57946
57981
|
style = customMerge.style,
|
|
@@ -58651,12 +58686,36 @@
|
|
|
58651
58686
|
this.eventManager.enableScroll();
|
|
58652
58687
|
}
|
|
58653
58688
|
getGroupTitleLevel(col, row) {}
|
|
58689
|
+
getTargetScrollTop(row) {
|
|
58690
|
+
const drawRange = this.getDrawRange(),
|
|
58691
|
+
frozenHeight = this.getFrozenRowsHeight(),
|
|
58692
|
+
rowsHeight = Math.ceil(this.rowHeightsMap.getSumInRange(0, row - 1)),
|
|
58693
|
+
allRowsHeight = this.getAllRowsHeight();
|
|
58694
|
+
return Math.max(0, Math.min(rowsHeight - frozenHeight, allRowsHeight - drawRange.height));
|
|
58695
|
+
}
|
|
58696
|
+
_scheduleScrollToRowCorrect(row, delay = 0) {
|
|
58697
|
+
this._scrollToRowCorrectTimer = setTimeout(() => {
|
|
58698
|
+
this.clearCorrectTimer();
|
|
58699
|
+
const targetScrollTop = this.getTargetScrollTop(row);
|
|
58700
|
+
if (targetScrollTop !== this.scrollTop) {
|
|
58701
|
+
this.scrollTop = targetScrollTop;
|
|
58702
|
+
const correctedTargetScrollTop = this.getTargetScrollTop(row);
|
|
58703
|
+
correctedTargetScrollTop !== this.scrollTop && (this.scrollTop = correctedTargetScrollTop);
|
|
58704
|
+
}
|
|
58705
|
+
}, delay);
|
|
58706
|
+
}
|
|
58654
58707
|
scrollToRow(row, animationOption) {
|
|
58655
|
-
|
|
58656
|
-
|
|
58657
|
-
|
|
58658
|
-
row:
|
|
58659
|
-
});
|
|
58708
|
+
var _a;
|
|
58709
|
+
const targetRow = Math.min(Math.max(Math.floor(row), 0), this.rowCount - 1);
|
|
58710
|
+
if (this.clearCorrectTimer(), !animationOption) return this.scrollToCell({
|
|
58711
|
+
row: targetRow
|
|
58712
|
+
}), void this._scheduleScrollToRowCorrect(targetRow);
|
|
58713
|
+
const duration = isBoolean$2(animationOption) ? 3e3 : null !== (_a = null == animationOption ? void 0 : animationOption.duration) && void 0 !== _a ? _a : 3e3;
|
|
58714
|
+
this.animationManager.scrollTo({
|
|
58715
|
+
row: targetRow
|
|
58716
|
+
}, animationOption), this._scrollToRowCorrectTimer = setTimeout(() => {
|
|
58717
|
+
this.scrollToRow(targetRow, !1);
|
|
58718
|
+
}, duration);
|
|
58660
58719
|
}
|
|
58661
58720
|
scrollToCol(col, animationOption) {
|
|
58662
58721
|
animationOption ? this.animationManager.scrollTo({
|
|
@@ -58675,8 +58734,8 @@
|
|
|
58675
58734
|
}
|
|
58676
58735
|
if (isValid$1(cellAddr.row) && cellAddr.row >= this.frozenRowCount) {
|
|
58677
58736
|
const frozenHeight = this.getFrozenRowsHeight(),
|
|
58678
|
-
top = this.
|
|
58679
|
-
this.scrollTop = Math.min(top - frozenHeight, this.
|
|
58737
|
+
top = this.rowHeightsMap.getSumInRange(0, cellAddr.row - 1);
|
|
58738
|
+
this.scrollTop = Math.min(top - frozenHeight, this.rowHeightsMap.getSumInRange(0, this.rowCount - 1) - drawRange.height);
|
|
58680
58739
|
}
|
|
58681
58740
|
this.render();
|
|
58682
58741
|
}
|
|
@@ -59288,9 +59347,24 @@
|
|
|
59288
59347
|
return layout._cellRangeMap.set(`$${col}$${row}`, cellRange), cellRange;
|
|
59289
59348
|
}
|
|
59290
59349
|
function getTreeTitleMerge(col, row, cellRange, layout) {
|
|
59350
|
+
var _a;
|
|
59291
59351
|
if ("tree" !== layout.rowHierarchyType) return;
|
|
59292
|
-
const
|
|
59293
|
-
|
|
59352
|
+
const table = layout._table,
|
|
59353
|
+
internalProps = table.internalProps || {},
|
|
59354
|
+
isGroupMode = !!internalProps.groupBy,
|
|
59355
|
+
cellRecord = table.getCellRawRecord(col, row);
|
|
59356
|
+
if (!(null == cellRecord ? void 0 : cellRecord.vtableMerge)) return;
|
|
59357
|
+
const treeTitleStartCol = internalProps.groupTitleCheckbox && internalProps.rowSeriesNumber ? layout.rowHeaderLevelCount + layout.leftRowSeriesNumberColumnCount : layout.rowHeaderLevelCount;
|
|
59358
|
+
if (!(col < treeTitleStartCol) && (cellRange.start.col = treeTitleStartCol, cellRange.end.col = layout.colCount - 1, cellRange.start.row = cellRange.end.row = row, isGroupMode && 1 === (null === (_a = layout.columnObjects) || void 0 === _a ? void 0 : _a.length))) {
|
|
59359
|
+
const onlyColumn = layout.columnObjects[0],
|
|
59360
|
+
field = null == onlyColumn ? void 0 : onlyColumn.field;
|
|
59361
|
+
if (null != field) {
|
|
59362
|
+
let text = cellRecord.vtableMergeName;
|
|
59363
|
+
const groupTitleFieldFormat = internalProps.groupTitleFieldFormat;
|
|
59364
|
+
"function" == typeof groupTitleFieldFormat && (text = groupTitleFieldFormat(cellRecord, col, row, table));
|
|
59365
|
+
null == cellRecord[field] && null != text && (cellRecord[field] = text);
|
|
59366
|
+
}
|
|
59367
|
+
}
|
|
59294
59368
|
}
|
|
59295
59369
|
function getCellRangeTranspose(col, row, layout) {
|
|
59296
59370
|
var _a, _b, _c, _d;
|
|
@@ -60207,7 +60281,7 @@
|
|
|
60207
60281
|
this.listenersId.push(doubleClickEventId, clickEventId, selectedChangedEventId);
|
|
60208
60282
|
}
|
|
60209
60283
|
startEditCell(col, row, value, editElement) {
|
|
60210
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
60284
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
60211
60285
|
if (this.editingEditor) return;
|
|
60212
60286
|
const editor = this.table.getEditor(col, row);
|
|
60213
60287
|
if (editor) {
|
|
@@ -60223,7 +60297,8 @@
|
|
|
60223
60297
|
col: col,
|
|
60224
60298
|
row: row
|
|
60225
60299
|
}), this.table._makeVisibleCell(col, row), this.editingEditor = editor;
|
|
60226
|
-
const
|
|
60300
|
+
const customMergeText = null === (_j = this.table.getCustomMerge(col, row)) || void 0 === _j ? void 0 : _j.text,
|
|
60301
|
+
dataValue = isValid$1(value) ? value : isValid$1(customMergeText) ? customMergeText : this.table.getCellOriginValue(col, row),
|
|
60227
60302
|
rect = this.table.getCellRangeRelativeRect(this.table.getCellRange(col, row)),
|
|
60228
60303
|
referencePosition = {
|
|
60229
60304
|
rect: {
|
|
@@ -60233,9 +60308,9 @@
|
|
|
60233
60308
|
height: rect.height
|
|
60234
60309
|
}
|
|
60235
60310
|
};
|
|
60236
|
-
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 === (
|
|
60311
|
+
col === this.table.colCount - 1 ? referencePosition.rect.width = rect.width - 1 : referencePosition.rect.width = rect.width + 1, row === this.table.rowCount - 1 ? referencePosition.rect.height = rect.height - 1 : referencePosition.rect.height = rect.height + 1, editor.beginEditing, null === (_k = editor.beginEditing) || void 0 === _k || _k.call(editor, this.table.getElement(), referencePosition, dataValue), editor.bindSuccessCallback, null === (_l = editor.bindSuccessCallback) || void 0 === _l || _l.call(editor, () => {
|
|
60237
60312
|
this.completeEdit();
|
|
60238
|
-
}), null === (
|
|
60313
|
+
}), null === (_m = editor.onStart) || void 0 === _m || _m.call(editor, {
|
|
60239
60314
|
value: dataValue,
|
|
60240
60315
|
endEdit: () => {
|
|
60241
60316
|
this.completeEdit();
|
|
@@ -60249,7 +60324,7 @@
|
|
|
60249
60324
|
}
|
|
60250
60325
|
}
|
|
60251
60326
|
completeEdit(e) {
|
|
60252
|
-
var _a, _b;
|
|
60327
|
+
var _a, _b, _c;
|
|
60253
60328
|
if (!this.editingEditor) return !0;
|
|
60254
60329
|
if (this.isValidatingValue) return !1;
|
|
60255
60330
|
this.cacheLastSelectedCellEditor = {};
|
|
@@ -60263,9 +60338,10 @@
|
|
|
60263
60338
|
if (this.editingEditor.getValue, this.editingEditor.validateValue) {
|
|
60264
60339
|
this.isValidatingValue = !0;
|
|
60265
60340
|
const newValue = this.editingEditor.getValue(),
|
|
60266
|
-
|
|
60341
|
+
customMergeText = null === (_a = this.table.getCustomMerge(this.editCell.col, this.editCell.row)) || void 0 === _a ? void 0 : _a.text,
|
|
60342
|
+
oldValue = isValid$1(customMergeText) ? customMergeText : this.table.getCellOriginValue(this.editCell.col, this.editCell.row),
|
|
60267
60343
|
target = null == e ? void 0 : e.target,
|
|
60268
|
-
maybePromiseOrValue = null === (
|
|
60344
|
+
maybePromiseOrValue = null === (_c = (_b = this.editingEditor).validateValue) || void 0 === _c ? void 0 : _c.call(_b, newValue, oldValue, this.editCell, this.table, !!this.table.getElement().contains(target));
|
|
60269
60345
|
return isPromise(maybePromiseOrValue) ? (this.isValidatingValue = !0, new Promise((resolve, reject) => {
|
|
60270
60346
|
maybePromiseOrValue.then(result => {
|
|
60271
60347
|
dealWithValidateValue(result, this, oldValue, resolve);
|
|
@@ -60279,14 +60355,17 @@
|
|
|
60279
60355
|
doExit() {
|
|
60280
60356
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
60281
60357
|
const changedValue = null === (_b = (_a = this.editingEditor).getValue) || void 0 === _b ? void 0 : _b.call(_a),
|
|
60282
|
-
range = this.table.getCellRange(this.editCell.col, this.editCell.row)
|
|
60283
|
-
|
|
60284
|
-
|
|
60285
|
-
|
|
60286
|
-
|
|
60287
|
-
|
|
60358
|
+
range = this.table.getCellRange(this.editCell.col, this.editCell.row);
|
|
60359
|
+
if (null === (_d = (_c = this.editingEditor).beforeEnd) || void 0 === _d || _d.call(_c), range.isCustom) this.table.changeCellValue(range.start.col, range.start.row, changedValue);else {
|
|
60360
|
+
const changedValues = [];
|
|
60361
|
+
for (let row = range.start.row; row <= range.end.row; row++) {
|
|
60362
|
+
const rowChangedValues = [];
|
|
60363
|
+
for (let col = range.start.col; col <= range.end.col; col++) rowChangedValues.push(changedValue);
|
|
60364
|
+
changedValues.push(rowChangedValues);
|
|
60365
|
+
}
|
|
60366
|
+
this.table.changeCellValues(range.start.col, range.start.row, changedValues);
|
|
60288
60367
|
}
|
|
60289
|
-
|
|
60368
|
+
this.editingEditor.exit, null === (_f = (_e = this.editingEditor).exit) || void 0 === _f || _f.call(_e), null === (_h = (_g = this.editingEditor).onEnd) || void 0 === _h || _h.call(_g), this.editingEditor = null, this.isValidatingValue = !1, this.beginTriggerEditCellMode = null;
|
|
60290
60369
|
}
|
|
60291
60370
|
cancelEdit() {
|
|
60292
60371
|
var _a, _b, _c, _d;
|
|
@@ -60346,7 +60425,18 @@
|
|
|
60346
60425
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
60347
60426
|
});
|
|
60348
60427
|
};
|
|
60428
|
+
function refreshCustomMergeCellGroups(table) {
|
|
60429
|
+
var _a;
|
|
60430
|
+
if (!Array.isArray(table.options.customMergeCell)) return;
|
|
60431
|
+
table.internalProps.customMergeCell = getCustomMergeCellFunc(table.options.customMergeCell);
|
|
60432
|
+
const merges = table.options.customMergeCell;
|
|
60433
|
+
for (let i = 0; i < merges.length; i++) {
|
|
60434
|
+
const r = null === (_a = merges[i]) || void 0 === _a ? void 0 : _a.range;
|
|
60435
|
+
if (null == r ? void 0 : r.start) for (let col = r.start.col; col <= r.end.col; col++) for (let row = r.start.row; row <= r.end.row; row++) table.scenegraph.updateCellContent(col, row);
|
|
60436
|
+
}
|
|
60437
|
+
}
|
|
60349
60438
|
function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table, noTriggerChangeCellValuesEvent) {
|
|
60439
|
+
var _a, _b;
|
|
60350
60440
|
if (workOnEditableCell && table.isHasEditorDefine(col, row) || !1 === workOnEditableCell) {
|
|
60351
60441
|
const recordShowIndex = table.getRecordShowIndexByCell(col, row),
|
|
60352
60442
|
recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
|
|
@@ -60356,8 +60446,12 @@
|
|
|
60356
60446
|
beforeChangeValue = table.getCellRawValue(col, row),
|
|
60357
60447
|
oldValue = table.getCellOriginValue(col, row);
|
|
60358
60448
|
table.isHeader(col, row) ? table.internalProps.layoutMap.updateColumnTitle(col, row, value) : table.dataSource.changeFieldValue(value, recordShowIndex, field, col, row, table);
|
|
60359
|
-
const range = table.getCellRange(col, row)
|
|
60360
|
-
|
|
60449
|
+
const range = table.getCellRange(col, row);
|
|
60450
|
+
if (range.isCustom && range.start.col === col && range.start.row === row && Array.isArray(table.options.customMergeCell) && "function" == typeof table.getCellValue) {
|
|
60451
|
+
const customMerge = null === (_b = null === (_a = table.internalProps) || void 0 === _a ? void 0 : _a.customMergeCell) || void 0 === _b ? void 0 : _b.call(_a, col, row, table);
|
|
60452
|
+
customMerge && (customMerge.text = value);
|
|
60453
|
+
}
|
|
60454
|
+
const aggregators = table.internalProps.layoutMap.getAggregatorsByCell(col, row);
|
|
60361
60455
|
if (aggregators) {
|
|
60362
60456
|
if (Array.isArray(aggregators)) for (let i = 0; i < (null == aggregators ? void 0 : aggregators.length); i++) aggregators[i].recalculate();else aggregators.recalculate();
|
|
60363
60457
|
const aggregatorCells = table.internalProps.layoutMap.getAggregatorCellAddress(range.start.col, range.start.row, range.end.col, range.end.row);
|
|
@@ -60580,7 +60674,13 @@
|
|
|
60580
60674
|
(void 0 === recordIndex || recordIndex > table.dataSource.sourceLength) && (recordIndex = table.dataSource.sourceLength);
|
|
60581
60675
|
const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount,
|
|
60582
60676
|
syncToOriginalRecords = !!(null === (_f = table.options) || void 0 === _f ? void 0 : _f.syncRecordOperationsToSourceRecords);
|
|
60583
|
-
if (table.dataSource.addRecord(record, recordIndex, syncToOriginalRecords), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1), syncToOriginalRecords)
|
|
60677
|
+
if (table.dataSource.addRecord(record, recordIndex, syncToOriginalRecords), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1), syncToOriginalRecords) {
|
|
60678
|
+
if (!table.transpose) {
|
|
60679
|
+
const insertRowIndex = recordIndex + headerCount + table.internalProps.layoutMap.hasAggregationOnTopCount;
|
|
60680
|
+
table.rowHeightsMap.insert(insertRowIndex);
|
|
60681
|
+
}
|
|
60682
|
+
return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(!0), !0;
|
|
60683
|
+
}
|
|
60584
60684
|
const oldRowCount = table.rowCount;
|
|
60585
60685
|
if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
|
|
60586
60686
|
const newRowCount = table.transpose ? table.colCount : table.rowCount;
|
|
@@ -60658,7 +60758,13 @@
|
|
|
60658
60758
|
void 0 === recordIndex || recordIndex > table.dataSource.sourceLength ? recordIndex = table.dataSource.sourceLength : recordIndex < 0 && (recordIndex = 0);
|
|
60659
60759
|
const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount,
|
|
60660
60760
|
syncToOriginalRecords = !!(null === (_f = table.options) || void 0 === _f ? void 0 : _f.syncRecordOperationsToSourceRecords);
|
|
60661
|
-
if (table.dataSource.addRecords(records, recordIndex, syncToOriginalRecords), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length), syncToOriginalRecords)
|
|
60761
|
+
if (table.dataSource.addRecords(records, recordIndex, syncToOriginalRecords), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length), syncToOriginalRecords) {
|
|
60762
|
+
if (!table.transpose) {
|
|
60763
|
+
const insertRowIndex = recordIndex + headerCount + table.internalProps.layoutMap.hasAggregationOnTopCount;
|
|
60764
|
+
for (let i = 0; i < records.length; i++) table.rowHeightsMap.insert(insertRowIndex);
|
|
60765
|
+
}
|
|
60766
|
+
return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(!0), !0;
|
|
60767
|
+
}
|
|
60662
60768
|
const oldRowCount = table.transpose ? table.colCount : table.rowCount;
|
|
60663
60769
|
if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
|
|
60664
60770
|
const newRowCount = table.transpose ? table.colCount : table.rowCount;
|
|
@@ -60727,7 +60833,7 @@
|
|
|
60727
60833
|
}
|
|
60728
60834
|
}
|
|
60729
60835
|
function listTableDeleteRecords(recordIndexs, table) {
|
|
60730
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
60836
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
60731
60837
|
if ((null == recordIndexs ? void 0 : recordIndexs.length) > 0) if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).deleteRecordsForGroup) || void 0 === _b || _b.call(_a, recordIndexs), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) {
|
|
60732
60838
|
const deletedRecordIndexs = null === (_d = (_c = table.dataSource).deleteRecordsForTree) || void 0 === _d ? void 0 : _d.call(_c, recordIndexs);
|
|
60733
60839
|
if (0 === deletedRecordIndexs.length) return;
|
|
@@ -60739,8 +60845,17 @@
|
|
|
60739
60845
|
const syncToOriginalRecords = !!(null === (_f = table.options) || void 0 === _f ? void 0 : _f.syncRecordOperationsToSourceRecords),
|
|
60740
60846
|
deletedRecordIndexs = table.dataSource.deleteRecords(recordIndexs, syncToOriginalRecords);
|
|
60741
60847
|
if (0 === deletedRecordIndexs.length) return;
|
|
60848
|
+
Array.isArray(table.options.customMergeCell) && (table.internalProps.customMergeCell = getCustomMergeCellFunc(table.options.customMergeCell));
|
|
60742
60849
|
for (let index = 0; index < deletedRecordIndexs.length; index++) adjustCheckBoxStateMapWithDeleteRecordIndex(table, deletedRecordIndexs[index], 1);
|
|
60743
|
-
if (syncToOriginalRecords)
|
|
60850
|
+
if (syncToOriginalRecords) {
|
|
60851
|
+
if (!table.transpose) {
|
|
60852
|
+
const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount,
|
|
60853
|
+
topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount,
|
|
60854
|
+
sorted = [...deletedRecordIndexs].sort((a, b) => b - a);
|
|
60855
|
+
for (let i = 0; i < sorted.length; i++) table.rowHeightsMap.delete(sorted[i] + headerCount + topAggregationCount);
|
|
60856
|
+
}
|
|
60857
|
+
return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), void table.scenegraph.createSceneGraph(!0);
|
|
60858
|
+
}
|
|
60744
60859
|
const oldRowCount = table.transpose ? table.colCount : table.rowCount;
|
|
60745
60860
|
table.refreshRowColCount();
|
|
60746
60861
|
const newRowCount = table.transpose ? table.colCount : table.rowCount,
|
|
@@ -60778,7 +60893,7 @@
|
|
|
60778
60893
|
col: 0,
|
|
60779
60894
|
row: row
|
|
60780
60895
|
});
|
|
60781
|
-
null === (_g = table.reactCustomLayout) || void 0 === _g || _g.clearCache(), table.transpose ? table.scenegraph.updateCol(delRows, [], updateRows) : table.scenegraph.updateRow(delRows, [], updateRows), null === (_h = table.reactCustomLayout) || void 0 === _h || _h.updateAllCustomCell();
|
|
60896
|
+
null === (_g = table.reactCustomLayout) || void 0 === _g || _g.clearCache(), table.transpose ? table.scenegraph.updateCol(delRows, [], updateRows) : table.scenegraph.updateRow(delRows, [], updateRows), null === (_h = table.reactCustomLayout) || void 0 === _h || _h.updateAllCustomCell(), refreshCustomMergeCellGroups(table);
|
|
60782
60897
|
}
|
|
60783
60898
|
} else {
|
|
60784
60899
|
const delRows = [],
|
|
@@ -60796,6 +60911,42 @@
|
|
|
60796
60911
|
});
|
|
60797
60912
|
}
|
|
60798
60913
|
const updateRows = [];
|
|
60914
|
+
if (table.internalProps.customMergeCell) {
|
|
60915
|
+
const proxy = table.scenegraph.proxy,
|
|
60916
|
+
deletedIndexNums = (recordIndexsMinToMax[0], recordIndexsMinToMax.map(recordIndex => recordIndex + headerCount + topAggregationCount)),
|
|
60917
|
+
minIndexNum = deletedIndexNums[0];
|
|
60918
|
+
let updateMin = minIndexNum,
|
|
60919
|
+
updateMax = minIndexNum;
|
|
60920
|
+
if (Array.isArray(table.options.customMergeCell)) {
|
|
60921
|
+
const merges = table.options.customMergeCell,
|
|
60922
|
+
axis = table.transpose ? "col" : "row";
|
|
60923
|
+
merges.forEach(m => {
|
|
60924
|
+
const r = null == m ? void 0 : m.range;
|
|
60925
|
+
if ((null == r ? void 0 : r.start) && (null == r ? void 0 : r.end)) for (let i = 0; i < deletedIndexNums.length; i++) {
|
|
60926
|
+
const deleteIndex = deletedIndexNums[i];
|
|
60927
|
+
if (r.end[axis] >= deleteIndex - 1) {
|
|
60928
|
+
updateMin = Math.min(updateMin, r.start[axis]), updateMax = Math.max(updateMax, r.end[axis]);
|
|
60929
|
+
break;
|
|
60930
|
+
}
|
|
60931
|
+
}
|
|
60932
|
+
});
|
|
60933
|
+
}
|
|
60934
|
+
if (table.transpose) {
|
|
60935
|
+
const start = Math.max(updateMin, null !== (_j = null == proxy ? void 0 : proxy.colStart) && void 0 !== _j ? _j : updateMin),
|
|
60936
|
+
end = Math.min(updateMax, null !== (_k = null == proxy ? void 0 : proxy.colEnd) && void 0 !== _k ? _k : updateMax);
|
|
60937
|
+
for (let col = start; col <= end; col++) updateRows.push({
|
|
60938
|
+
col: col,
|
|
60939
|
+
row: 0
|
|
60940
|
+
});
|
|
60941
|
+
} else {
|
|
60942
|
+
const start = Math.max(updateMin, null !== (_l = null == proxy ? void 0 : proxy.rowStart) && void 0 !== _l ? _l : updateMin),
|
|
60943
|
+
end = Math.min(updateMax, null !== (_m = null == proxy ? void 0 : proxy.rowEnd) && void 0 !== _m ? _m : updateMax);
|
|
60944
|
+
for (let row = start; row <= end; row++) updateRows.push({
|
|
60945
|
+
col: 0,
|
|
60946
|
+
row: row
|
|
60947
|
+
});
|
|
60948
|
+
}
|
|
60949
|
+
}
|
|
60799
60950
|
for (let row = headerCount; row < headerCount + topAggregationCount; row++) table.transpose ? updateRows.push({
|
|
60800
60951
|
col: row,
|
|
60801
60952
|
row: 0
|
|
@@ -60810,7 +60961,7 @@
|
|
|
60810
60961
|
col: 0,
|
|
60811
60962
|
row: row
|
|
60812
60963
|
});
|
|
60813
|
-
null === (
|
|
60964
|
+
null === (_o = table.reactCustomLayout) || void 0 === _o || _o.clearCache(), table.transpose ? table.scenegraph.updateCol(delRows, [], updateRows) : table.scenegraph.updateRow(delRows, [], updateRows), null === (_p = table.reactCustomLayout) || void 0 === _p || _p.updateAllCustomCell(), refreshCustomMergeCellGroups(table);
|
|
60814
60965
|
}
|
|
60815
60966
|
}
|
|
60816
60967
|
}
|
|
@@ -60822,7 +60973,7 @@
|
|
|
60822
60973
|
const syncToOriginalRecords = !!(null === (_f = table.options) || void 0 === _f ? void 0 : _f.syncRecordOperationsToSourceRecords),
|
|
60823
60974
|
updateRecordIndexs = table.dataSource.updateRecords(records, recordIndexs, syncToOriginalRecords);
|
|
60824
60975
|
if (0 === updateRecordIndexs.length) return;
|
|
60825
|
-
if (syncToOriginalRecords) return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), void table.scenegraph.createSceneGraph();
|
|
60976
|
+
if (syncToOriginalRecords) return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), void table.scenegraph.createSceneGraph(!0);
|
|
60826
60977
|
const recordIndexsMinToMax = updateRecordIndexs.map(index => table.getBodyRowIndexByRecordIndex(index)).sort((a, b) => a - b);
|
|
60827
60978
|
if (table.pagination) {
|
|
60828
60979
|
const {
|
|
@@ -61145,10 +61296,33 @@
|
|
|
61145
61296
|
this._hasAutoImageColumn = void 0, this.refreshHeader(), this.records && checkHasAggregationOnColumnDefine(this.internalProps.columns) && this.dataSource.processRecords(null !== (_b = null === (_a = this.dataSource.dataSourceObj) || void 0 === _a ? void 0 : _a.records) && void 0 !== _b ? _b : this.dataSource.dataSourceObj), this.internalProps.useOneRowHeightFillAll = !1, this.headerStyleCache = new Map(), this.bodyStyleCache = new Map(), this.bodyBottomStyleCache = new Map(), this._updateSize(), this.scenegraph.createSceneGraph(), this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row), this.renderAsync(), this.eventManager.updateEventBinder();
|
|
61146
61297
|
}
|
|
61147
61298
|
addColumns(toAddColumns, colIndex, isMaintainArrayData = !0) {
|
|
61148
|
-
var _a;
|
|
61299
|
+
var _a, _b;
|
|
61149
61300
|
const columns = this.options.columns;
|
|
61301
|
+
if (Array.isArray(this.options.customMergeCell) && (null == toAddColumns ? void 0 : toAddColumns.length)) {
|
|
61302
|
+
const axis = this.transpose ? "row" : "col";
|
|
61303
|
+
let insertIndex = colIndex;
|
|
61304
|
+
void 0 === insertIndex ? insertIndex = columns.length : insertIndex < 0 ? insertIndex = 0 : insertIndex > columns.length && (insertIndex = columns.length);
|
|
61305
|
+
const toAddCount = toAddColumns.length,
|
|
61306
|
+
merges = this.options.customMergeCell.map(m => Object.assign(Object.assign({}, m), {
|
|
61307
|
+
range: {
|
|
61308
|
+
start: Object.assign({}, m.range.start),
|
|
61309
|
+
end: Object.assign({}, m.range.end)
|
|
61310
|
+
}
|
|
61311
|
+
}));
|
|
61312
|
+
for (let i = 0; i < merges.length; i++) {
|
|
61313
|
+
const r = null === (_a = merges[i]) || void 0 === _a ? void 0 : _a.range;
|
|
61314
|
+
if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
|
|
61315
|
+
const start = r.start[axis],
|
|
61316
|
+
end = r.end[axis];
|
|
61317
|
+
end < insertIndex || (start > insertIndex ? (r.start[axis] = start + toAddCount, r.end[axis] = end + toAddCount) : r.end[axis] = end + toAddCount);
|
|
61318
|
+
}
|
|
61319
|
+
this.options.customMergeCell = merges.filter(m => {
|
|
61320
|
+
const r = null == m ? void 0 : m.range;
|
|
61321
|
+
return !(!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) && !(r.end.row < r.start.row || r.end.col < r.start.col) && !(r.start.row === r.end.row && r.start.col === r.end.col);
|
|
61322
|
+
}), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
|
|
61323
|
+
}
|
|
61150
61324
|
void 0 === colIndex ? (colIndex = columns.length, columns.push(...toAddColumns)) : columns.splice(colIndex, 0, ...toAddColumns);
|
|
61151
|
-
for (let i = 0; i < toAddColumns.length; i++) this.colWidthsMap.addAndReorder(colIndex + i, null !== (
|
|
61325
|
+
for (let i = 0; i < toAddColumns.length; i++) this.colWidthsMap.addAndReorder(colIndex + i, null !== (_b = toAddColumns[i].width) && void 0 !== _b ? _b : this.internalProps.defaultColWidth);
|
|
61152
61326
|
this.internalProps._colRangeWidthsMap.clear();
|
|
61153
61327
|
const resizedColIndexs = Array.from(this.internalProps._widthResizedColMap.keys());
|
|
61154
61328
|
for (let i = 0; i < resizedColIndexs.length; i++) resizedColIndexs[i] >= colIndex && (this.internalProps._widthResizedColMap.delete(resizedColIndexs[i]), this.internalProps._widthResizedColMap.add(resizedColIndexs[i] + toAddColumns.length));
|
|
@@ -61161,15 +61335,46 @@
|
|
|
61161
61335
|
}
|
|
61162
61336
|
this.updateColumns(columns, {
|
|
61163
61337
|
clearRowHeightCache: !1
|
|
61164
|
-
}), this.
|
|
61338
|
+
}), Array.isArray(this.options.customMergeCell) && (this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell), this.options.customMergeCell.forEach(m => {
|
|
61339
|
+
const r = null == m ? void 0 : m.range;
|
|
61340
|
+
if (null == r ? void 0 : r.start) for (let col = r.start.col; col <= r.end.col; col++) for (let row = r.start.row; row <= r.end.row; row++) this.scenegraph.updateCellContent(col, row);
|
|
61341
|
+
}), this.scenegraph.updateNextFrame()), this.fireListeners(TABLE_EVENT_TYPE.ADD_COLUMN, {
|
|
61165
61342
|
columnIndex: colIndex,
|
|
61166
61343
|
columnCount: toAddColumns.length,
|
|
61167
61344
|
columns: columns
|
|
61168
61345
|
});
|
|
61169
61346
|
}
|
|
61170
61347
|
deleteColumns(deleteColIndexs, isMaintainArrayData = !0) {
|
|
61348
|
+
var _a;
|
|
61171
61349
|
const columns = this.options.columns;
|
|
61172
61350
|
deleteColIndexs.sort((a, b) => b - a);
|
|
61351
|
+
const deletedColumns = deleteColIndexs.map(idx => cloneDeepSpec(columns[idx], ["children"]));
|
|
61352
|
+
let deletedRecordValues;
|
|
61353
|
+
if (Array.isArray(this.options.customMergeCell) && (null == deleteColIndexs ? void 0 : deleteColIndexs.length)) {
|
|
61354
|
+
const axis = this.transpose ? "row" : "col",
|
|
61355
|
+
deleteIndexNums = deleteColIndexs.slice().sort((a, b) => a - b).map((idx, i) => idx - i),
|
|
61356
|
+
merges = this.options.customMergeCell.map(m => Object.assign(Object.assign({}, m), {
|
|
61357
|
+
range: {
|
|
61358
|
+
start: Object.assign({}, m.range.start),
|
|
61359
|
+
end: Object.assign({}, m.range.end)
|
|
61360
|
+
}
|
|
61361
|
+
}));
|
|
61362
|
+
for (let i = 0; i < deleteIndexNums.length; i++) {
|
|
61363
|
+
const deleteIndex = deleteIndexNums[i];
|
|
61364
|
+
for (let j = 0; j < merges.length; j++) {
|
|
61365
|
+
const r = null === (_a = merges[j]) || void 0 === _a ? void 0 : _a.range;
|
|
61366
|
+
if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
|
|
61367
|
+
const start = r.start[axis],
|
|
61368
|
+
end = r.end[axis];
|
|
61369
|
+
end < deleteIndex || (start > deleteIndex ? (r.start[axis] = start - 1, r.end[axis] = end - 1) : r.end[axis] = end - 1);
|
|
61370
|
+
}
|
|
61371
|
+
}
|
|
61372
|
+
this.options.customMergeCell = merges.filter(m => {
|
|
61373
|
+
const r = null == m ? void 0 : m.range;
|
|
61374
|
+
return !(!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) && !(r.end.row < r.start.row || r.end.col < r.start.col) && !(r.start.row === r.end.row && r.start.col === r.end.col);
|
|
61375
|
+
}), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
|
|
61376
|
+
}
|
|
61377
|
+
isMaintainArrayData && Array.isArray(this.records) && this.records.length && (deletedRecordValues = this.records.map(record => Array.isArray(record) ? deleteColIndexs.map(idx => record[idx]) : []), deletedRecordValues.every(v => 0 === v.length) && (deletedRecordValues = void 0));
|
|
61173
61378
|
for (let i = 0; i < deleteColIndexs.length; i++) if (columns.splice(deleteColIndexs[i], 1), this.colWidthsMap.delAndReorder(deleteColIndexs[i]), this.internalProps._widthResizedColMap.delete(deleteColIndexs[i]), isMaintainArrayData) for (let j = 0; j < this.records.length; j++) {
|
|
61174
61379
|
const record = this.records[j];
|
|
61175
61380
|
Array.isArray(record) && record.splice(deleteColIndexs[i], 1);
|
|
@@ -61185,7 +61390,9 @@
|
|
|
61185
61390
|
clearRowHeightCache: !1
|
|
61186
61391
|
}), this.fireListeners(TABLE_EVENT_TYPE.DELETE_COLUMN, {
|
|
61187
61392
|
deleteColIndexs: deleteColIndexs,
|
|
61188
|
-
columns: columns
|
|
61393
|
+
columns: columns,
|
|
61394
|
+
deletedColumns: deletedColumns,
|
|
61395
|
+
deletedRecordValues: deletedRecordValues
|
|
61189
61396
|
});
|
|
61190
61397
|
}
|
|
61191
61398
|
get columns() {
|
|
@@ -61573,9 +61780,9 @@
|
|
|
61573
61780
|
}
|
|
61574
61781
|
}
|
|
61575
61782
|
updateSortState(sortState, executeSort = !0) {
|
|
61576
|
-
var _a;
|
|
61577
|
-
|
|
61578
|
-
(
|
|
61783
|
+
var _a, _b, _c, _d, _e;
|
|
61784
|
+
const normalizedSortState = (Array.isArray(sortState) ? sortState : sortState ? [sortState] : []).filter(Boolean);
|
|
61785
|
+
if (normalizedSortState.length ? this.internalProps.sortState = sortState : this.internalProps.sortState = null, executeSort) if (normalizedSortState.length) this.internalProps.layoutMap.headerObjects.some(item => !1 !== item.define.sort) && (this.dataSource.sort(normalizedSortState.map(item => {
|
|
61579
61786
|
const sortFunc = this._getSortFuncFromHeaderOption(this.internalProps.columns, item.field);
|
|
61580
61787
|
this.internalProps.layoutMap.headerObjects.find(col => col && col.field === item.field);
|
|
61581
61788
|
return {
|
|
@@ -61583,13 +61790,20 @@
|
|
|
61583
61790
|
order: item.order,
|
|
61584
61791
|
orderFn: null != sortFunc ? sortFunc : defaultOrderFn
|
|
61585
61792
|
};
|
|
61586
|
-
})), this.internalProps.layoutMap.clearCellRangeMap(), this.internalProps.useOneRowHeightFillAll = !1, this.scenegraph.sortCell())
|
|
61793
|
+
})), this.internalProps.layoutMap.clearCellRangeMap(), this.internalProps.useOneRowHeightFillAll = !1, this.scenegraph.sortCell());else {
|
|
61794
|
+
const ds = this.dataSource,
|
|
61795
|
+
sourceLength = null !== (_c = null !== (_b = null !== (_a = null == ds ? void 0 : ds.sourceLength) && void 0 !== _a ? _a : null == ds ? void 0 : ds._sourceLength) && void 0 !== _b ? _b : null == ds ? void 0 : ds.length) && void 0 !== _c ? _c : 0;
|
|
61796
|
+
(null === (_d = null == ds ? void 0 : ds.sortedIndexMap) || void 0 === _d ? void 0 : _d.clear) && ds.sortedIndexMap.clear(), void 0 !== ds.currentIndexedData && (ds.currentIndexedData = Array.from({
|
|
61797
|
+
length: sourceLength
|
|
61798
|
+
}, (_, i) => i)), ds.lastSortStates = [], null === (_e = ds.updatePagination) || void 0 === _e || _e.call(ds, ds.pagination), this.internalProps.layoutMap.clearCellRangeMap(), this.internalProps.useOneRowHeightFillAll = !1, this.scenegraph.sortCell();
|
|
61799
|
+
}
|
|
61800
|
+
this.stateManager.updateSortState(normalizedSortState);
|
|
61587
61801
|
}
|
|
61588
61802
|
updateFilterRules(filterRules, options = {
|
|
61589
61803
|
clearRowHeightCache: !0
|
|
61590
61804
|
}) {
|
|
61591
61805
|
var _a, _b, _c;
|
|
61592
|
-
this.scenegraph.clearCells(), null === (_b = (_a = this.dataSource).clearForceVisibleRecords) || void 0 === _b || _b.call(_a), this.sortState ? (this.dataSource.updateFilterRulesForSorted(filterRules), sortRecords(this)) : this.dataSource.updateFilterRules(filterRules, null == options ? void 0 : options.onFilterRecordsEnd), this.refreshRowColCount(), this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(!(null == options ? void 0 : options.clearRowHeightCache)), null === (_c = this.internalProps.emptyTip) || void 0 === _c || _c.resetVisible(), this.resize();
|
|
61806
|
+
this.scenegraph.clearCells(), !1 !== (null == options ? void 0 : options.clearForceVisibleRecords) && (null === (_b = (_a = this.dataSource).clearForceVisibleRecords) || void 0 === _b || _b.call(_a)), this.sortState ? (this.dataSource.updateFilterRulesForSorted(filterRules), sortRecords(this)) : this.dataSource.updateFilterRules(filterRules, null == options ? void 0 : options.onFilterRecordsEnd), this.refreshRowColCount(), this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(!(null == options ? void 0 : options.clearRowHeightCache)), null === (_c = this.internalProps.emptyTip) || void 0 === _c || _c.resetVisible(), this.resize();
|
|
61593
61807
|
}
|
|
61594
61808
|
getFilteredRecords() {
|
|
61595
61809
|
return this.dataSource.records;
|
|
@@ -61864,30 +62078,112 @@
|
|
|
61864
62078
|
traverseColumns(this.internalProps.columns), this.refreshRowColCount(), this.internalProps.layoutMap.clearCellRangeMap(), this.internalProps.useOneRowHeightFillAll = !1, this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(!clearRowHeightCache), null === (_k = this.internalProps.emptyTip) || void 0 === _k || _k.resetVisible(), this.resize();
|
|
61865
62079
|
}
|
|
61866
62080
|
addRecord(record, recordIndex, triggerEvent = !0) {
|
|
61867
|
-
var _a;
|
|
62081
|
+
var _a, _b;
|
|
62082
|
+
if (Array.isArray(this.options.customMergeCell) && "number" == typeof recordIndex) {
|
|
62083
|
+
const axis = this.transpose ? "col" : "row",
|
|
62084
|
+
headerCount = this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount,
|
|
62085
|
+
topAggregationCount = this.internalProps.layoutMap.hasAggregationOnTopCount;
|
|
62086
|
+
let insertIndex = recordIndex;
|
|
62087
|
+
void 0 === insertIndex || insertIndex > this.dataSource.sourceLength ? insertIndex = this.dataSource.sourceLength : insertIndex < 0 && (insertIndex = 0);
|
|
62088
|
+
const insertIndexNum = insertIndex + headerCount + topAggregationCount,
|
|
62089
|
+
merges = this.options.customMergeCell.map(m => Object.assign(Object.assign({}, m), {
|
|
62090
|
+
range: {
|
|
62091
|
+
start: Object.assign({}, m.range.start),
|
|
62092
|
+
end: Object.assign({}, m.range.end)
|
|
62093
|
+
}
|
|
62094
|
+
}));
|
|
62095
|
+
for (let i = 0; i < merges.length; i++) {
|
|
62096
|
+
const r = null === (_a = merges[i]) || void 0 === _a ? void 0 : _a.range;
|
|
62097
|
+
if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
|
|
62098
|
+
const start = r.start[axis],
|
|
62099
|
+
end = r.end[axis];
|
|
62100
|
+
end < insertIndexNum || (start > insertIndexNum ? (r.start[axis] = start + 1, r.end[axis] = end + 1) : r.end[axis] = end + 1);
|
|
62101
|
+
}
|
|
62102
|
+
this.options.customMergeCell = merges.filter(m => {
|
|
62103
|
+
const r = null == m ? void 0 : m.range;
|
|
62104
|
+
return !(!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) && !(r.end.row < r.start.row || r.end.col < r.start.col) && !(r.start.row === r.end.row && r.start.col === r.end.col);
|
|
62105
|
+
}), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
|
|
62106
|
+
}
|
|
61868
62107
|
const success = listTableAddRecord(record, recordIndex, this);
|
|
61869
|
-
adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]), null === (
|
|
62108
|
+
adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]), null === (_b = this.internalProps.emptyTip) || void 0 === _b || _b.resetVisible(), success && Array.isArray(this.options.customMergeCell) && (this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell), this.options.customMergeCell.forEach(m => {
|
|
62109
|
+
const r = null == m ? void 0 : m.range;
|
|
62110
|
+
if (null == r ? void 0 : r.start) for (let col = r.start.col; col <= r.end.col; col++) for (let row = r.start.row; row <= r.end.row; row++) this.scenegraph.updateCellContent(col, row);
|
|
62111
|
+
}), this.scenegraph.updateNextFrame()), triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
|
|
61870
62112
|
records: [record],
|
|
61871
62113
|
recordIndex: recordIndex,
|
|
61872
62114
|
recordCount: 1
|
|
61873
62115
|
});
|
|
61874
62116
|
}
|
|
61875
62117
|
addRecords(records, recordIndex, triggerEvent = !0) {
|
|
61876
|
-
var _a;
|
|
62118
|
+
var _a, _b;
|
|
62119
|
+
if (Array.isArray(this.options.customMergeCell) && "number" == typeof recordIndex && (null == records ? void 0 : records.length)) {
|
|
62120
|
+
const axis = this.transpose ? "col" : "row",
|
|
62121
|
+
headerCount = this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount,
|
|
62122
|
+
topAggregationCount = this.internalProps.layoutMap.hasAggregationOnTopCount;
|
|
62123
|
+
let insertIndex = recordIndex;
|
|
62124
|
+
void 0 === insertIndex || insertIndex > this.dataSource.sourceLength ? insertIndex = this.dataSource.sourceLength : insertIndex < 0 && (insertIndex = 0);
|
|
62125
|
+
const insertIndexNum = insertIndex + headerCount + topAggregationCount,
|
|
62126
|
+
toAddCount = records.length,
|
|
62127
|
+
merges = this.options.customMergeCell.map(m => Object.assign(Object.assign({}, m), {
|
|
62128
|
+
range: {
|
|
62129
|
+
start: Object.assign({}, m.range.start),
|
|
62130
|
+
end: Object.assign({}, m.range.end)
|
|
62131
|
+
}
|
|
62132
|
+
}));
|
|
62133
|
+
for (let i = 0; i < merges.length; i++) {
|
|
62134
|
+
const r = null === (_a = merges[i]) || void 0 === _a ? void 0 : _a.range;
|
|
62135
|
+
if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
|
|
62136
|
+
const start = r.start[axis],
|
|
62137
|
+
end = r.end[axis];
|
|
62138
|
+
end < insertIndexNum || (start > insertIndexNum ? (r.start[axis] = start + toAddCount, r.end[axis] = end + toAddCount) : r.end[axis] = end + toAddCount);
|
|
62139
|
+
}
|
|
62140
|
+
this.options.customMergeCell = merges.filter(m => {
|
|
62141
|
+
const r = null == m ? void 0 : m.range;
|
|
62142
|
+
return !(!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) && !(r.end.row < r.start.row || r.end.col < r.start.col) && !(r.start.row === r.end.row && r.start.col === r.end.col);
|
|
62143
|
+
}), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
|
|
62144
|
+
}
|
|
61877
62145
|
const success = listTableAddRecords(records, recordIndex, this);
|
|
61878
|
-
"number" == typeof recordIndex && adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, records), null === (
|
|
62146
|
+
"number" == typeof recordIndex && adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, records), null === (_b = this.internalProps.emptyTip) || void 0 === _b || _b.resetVisible(), success && Array.isArray(this.options.customMergeCell) && (this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell), this.options.customMergeCell.forEach(m => {
|
|
62147
|
+
const r = null == m ? void 0 : m.range;
|
|
62148
|
+
if (null == r ? void 0 : r.start) for (let col = r.start.col; col <= r.end.col; col++) for (let row = r.start.row; row <= r.end.row; row++) this.scenegraph.updateCellContent(col, row);
|
|
62149
|
+
}), this.scenegraph.updateNextFrame()), triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
|
|
61879
62150
|
records: records,
|
|
61880
62151
|
recordIndex: recordIndex,
|
|
61881
62152
|
recordCount: records.length
|
|
61882
62153
|
});
|
|
61883
62154
|
}
|
|
61884
62155
|
deleteRecords(recordIndexs, triggerEvent = !0) {
|
|
61885
|
-
var _a;
|
|
61886
|
-
const
|
|
61887
|
-
|
|
62156
|
+
var _a, _b;
|
|
62157
|
+
const prevMergeRanges = Array.isArray(this.options.customMergeCell) ? this.options.customMergeCell.map(m => null == m ? void 0 : m.range).filter(Boolean).map(r => ({
|
|
62158
|
+
start: Object.assign({}, r.start),
|
|
62159
|
+
end: Object.assign({}, r.end)
|
|
62160
|
+
})) : [],
|
|
62161
|
+
deletedRecords = [];
|
|
62162
|
+
if ((null == recordIndexs ? void 0 : recordIndexs.length) > 0 && recordIndexs.forEach(index => {
|
|
61888
62163
|
let record = null;
|
|
61889
62164
|
record = "number" == typeof index ? this.dataSource.get(index) : [], deletedRecords.push(record);
|
|
61890
|
-
}),
|
|
62165
|
+
}), Array.isArray(this.options.customMergeCell) && (null == recordIndexs ? void 0 : recordIndexs.length) && "number" == typeof recordIndexs[0]) {
|
|
62166
|
+
const axis = this.transpose ? "col" : "row",
|
|
62167
|
+
headerCount = this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount,
|
|
62168
|
+
topAggregationCount = this.internalProps.layoutMap.hasAggregationOnTopCount,
|
|
62169
|
+
deleteIndexNums = recordIndexs.slice().sort((a, b) => a - b).map((index, i) => index + headerCount + topAggregationCount - i),
|
|
62170
|
+
merges = this.options.customMergeCell;
|
|
62171
|
+
for (let i = 0; i < deleteIndexNums.length; i++) {
|
|
62172
|
+
const deleteIndex = deleteIndexNums[i];
|
|
62173
|
+
for (let j = 0; j < merges.length; j++) {
|
|
62174
|
+
const r = null === (_a = merges[j]) || void 0 === _a ? void 0 : _a.range;
|
|
62175
|
+
if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
|
|
62176
|
+
const start = r.start[axis],
|
|
62177
|
+
end = r.end[axis];
|
|
62178
|
+
end < deleteIndex || (start > deleteIndex ? (r.start[axis] = start - 1, r.end[axis] = end - 1) : r.end[axis] = end - 1);
|
|
62179
|
+
}
|
|
62180
|
+
}
|
|
62181
|
+
this.options.customMergeCell = merges.filter(m => {
|
|
62182
|
+
const r = null == m ? void 0 : m.range;
|
|
62183
|
+
return !(!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) && !(r.end.row < r.start.row || r.end.col < r.start.col) && !(r.start.row === r.end.row && r.start.col === r.end.col);
|
|
62184
|
+
});
|
|
62185
|
+
}
|
|
62186
|
+
listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_b = this.internalProps.emptyTip) || void 0 === _b || _b.resetVisible();
|
|
61891
62187
|
const rowIndexs = [];
|
|
61892
62188
|
for (let i = 0; i < recordIndexs.length; i++) rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
|
|
61893
62189
|
triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
|
|
@@ -61895,7 +62191,16 @@
|
|
|
61895
62191
|
records: deletedRecords,
|
|
61896
62192
|
rowIndexs: rowIndexs,
|
|
61897
62193
|
deletedCount: (Array.isArray(recordIndexs[0]), recordIndexs.length)
|
|
61898
|
-
})
|
|
62194
|
+
}), Array.isArray(this.options.customMergeCell) && (this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell), this.options.customMergeCell.forEach(m => {
|
|
62195
|
+
const r = null == m ? void 0 : m.range;
|
|
62196
|
+
if (null == r ? void 0 : r.start) for (let col = r.start.col; col <= r.end.col; col++) for (let row = r.start.row; row <= r.end.row; row++) this.scenegraph.updateCellContent(col, row);
|
|
62197
|
+
}), this.scenegraph.updateNextFrame(), setTimeout(() => {
|
|
62198
|
+
if (!this.internalProps || !this.options || !this.scenegraph) return;
|
|
62199
|
+
Array.isArray(this.options.customMergeCell) && (this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell));
|
|
62200
|
+
[...prevMergeRanges, ...(Array.isArray(this.options.customMergeCell) ? this.options.customMergeCell.map(m => null == m ? void 0 : m.range) : [])].filter(Boolean).forEach(r => {
|
|
62201
|
+
if (null == r ? void 0 : r.start) for (let col = r.start.col; col <= r.end.col; col++) for (let row = r.start.row; row <= r.end.row; row++) this.scenegraph.updateCellContent(col, row);
|
|
62202
|
+
}), this.scenegraph.updateNextFrame();
|
|
62203
|
+
}, 0));
|
|
61899
62204
|
}
|
|
61900
62205
|
updateRecords(records, recordIndexs, triggerEvent = !0) {
|
|
61901
62206
|
listTableUpdateRecords(records, recordIndexs, this), triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
|
|
@@ -61999,7 +62304,12 @@
|
|
|
61999
62304
|
}
|
|
62000
62305
|
}), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
|
|
62001
62306
|
for (let i = startCol; i <= endCol; i++) for (let j = startRow; j <= endRow; j++) this.scenegraph.updateCellContent(i, j);
|
|
62002
|
-
this.scenegraph.updateNextFrame()
|
|
62307
|
+
this.scenegraph.updateNextFrame(), this.fireListeners(TABLE_EVENT_TYPE.MERGE_CELLS, {
|
|
62308
|
+
startCol: startCol,
|
|
62309
|
+
startRow: startRow,
|
|
62310
|
+
endCol: endCol,
|
|
62311
|
+
endRow: endRow
|
|
62312
|
+
});
|
|
62003
62313
|
}
|
|
62004
62314
|
unmergeCells(startCol, startRow, endCol, endRow) {
|
|
62005
62315
|
this.options.customMergeCell ? "function" == typeof this.options.customMergeCell && (this.options.customMergeCell = []) : this.options.customMergeCell = [], this.options.customMergeCell = this.options.customMergeCell.filter(item => {
|
|
@@ -62010,7 +62320,12 @@
|
|
|
62010
62320
|
return !(start.col === startCol && start.row === startRow && end.col === endCol && end.row === endRow);
|
|
62011
62321
|
}), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
|
|
62012
62322
|
for (let i = startCol; i <= endCol; i++) for (let j = startRow; j <= endRow; j++) this.scenegraph.updateCellContent(i, j);
|
|
62013
|
-
this.scenegraph.updateNextFrame()
|
|
62323
|
+
this.scenegraph.updateNextFrame(), this.fireListeners(TABLE_EVENT_TYPE.UNMERGE_CELLS, {
|
|
62324
|
+
startCol: startCol,
|
|
62325
|
+
startRow: startRow,
|
|
62326
|
+
endCol: endCol,
|
|
62327
|
+
endRow: endRow
|
|
62328
|
+
});
|
|
62014
62329
|
}
|
|
62015
62330
|
}
|
|
62016
62331
|
|