@visactor/vtable 0.18.5-alpha.0 → 0.19.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/cjs/ListTable.d.ts +1 -1
- package/cjs/ListTable.js +7 -5
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotTable.d.ts +2 -2
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +3 -2
- package/cjs/core/BaseTable.js +11 -28
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/edit/edit-manager.d.ts +1 -1
- package/cjs/edit/edit-manager.js +30 -13
- package/cjs/edit/edit-manager.js.map +1 -1
- package/cjs/event/event.js +2 -2
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/table-group.js +1 -1
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/{pivot-layout-helper.d.ts → layout-helper.d.ts} +18 -16
- package/cjs/layout/{pivot-layout-helper.js → layout-helper.js} +33 -16
- package/cjs/layout/layout-helper.js.map +1 -0
- package/cjs/layout/pivot-header-layout.d.ts +4 -4
- package/cjs/layout/pivot-header-layout.js +42 -10
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/row-height-map.d.ts +32 -0
- package/cjs/layout/row-height-map.js +144 -0
- package/cjs/layout/row-height-map.js.map +1 -0
- package/cjs/layout/simple-header-layout.d.ts +2 -0
- package/cjs/layout/simple-header-layout.js +8 -3
- package/cjs/layout/simple-header-layout.js.map +1 -1
- package/cjs/scenegraph/component/cell-mover.js +3 -5
- package/cjs/scenegraph/component/cell-mover.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.js +3 -3
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +3 -3
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.d.ts +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.js +9 -3
- package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js +13 -3
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/scenegraph/layout/move-cell.js +7 -1
- package/cjs/scenegraph/layout/move-cell.js.map +1 -1
- package/cjs/scenegraph/layout/update-height.js +2 -2
- package/cjs/scenegraph/layout/update-height.js.map +1 -1
- package/cjs/scenegraph/layout/update-row.js +6 -10
- package/cjs/scenegraph/layout/update-row.js.map +1 -1
- package/cjs/scenegraph/scenegraph.js +16 -9
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/state/cell-move/index.js +6 -4
- package/cjs/state/cell-move/index.js.map +1 -1
- package/cjs/themes/ARCO.js +2 -1
- package/cjs/tools/LimitPromiseQueue.js +1 -1
- package/cjs/tools/util.d.ts +1 -0
- package/cjs/tools/util.js +8 -2
- package/cjs/tools/util.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +4 -2
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +1 -0
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +917 -510
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +1 -1
- package/es/ListTable.js +5 -4
- package/es/ListTable.js.map +1 -1
- package/es/PivotTable.d.ts +2 -2
- package/es/PivotTable.js.map +1 -1
- package/es/core/BaseTable.d.ts +3 -2
- package/es/core/BaseTable.js +12 -25
- package/es/core/BaseTable.js.map +1 -1
- package/es/edit/edit-manager.d.ts +1 -1
- package/es/edit/edit-manager.js +30 -13
- package/es/edit/edit-manager.js.map +1 -1
- package/es/event/event.js +3 -1
- package/es/event/event.js.map +1 -1
- package/es/event/listener/table-group.js +1 -1
- package/es/event/listener/table-group.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/{pivot-layout-helper.d.ts → layout-helper.d.ts} +18 -16
- package/es/layout/{pivot-layout-helper.js → layout-helper.js} +33 -16
- package/es/layout/layout-helper.js.map +1 -0
- package/es/layout/pivot-header-layout.d.ts +4 -4
- package/es/layout/pivot-header-layout.js +34 -2
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/row-height-map.d.ts +32 -0
- package/es/layout/row-height-map.js +136 -0
- package/es/layout/row-height-map.js.map +1 -0
- package/es/layout/simple-header-layout.d.ts +2 -0
- package/es/layout/simple-header-layout.js +9 -2
- package/es/layout/simple-header-layout.js.map +1 -1
- package/es/scenegraph/component/cell-mover.js +3 -5
- package/es/scenegraph/component/cell-mover.js.map +1 -1
- package/es/scenegraph/group-creater/progress/proxy.js +3 -3
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +3 -3
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
- package/es/scenegraph/group-creater/progress/update-position/update-auto-row.d.ts +1 -1
- package/es/scenegraph/group-creater/progress/update-position/update-auto-row.js +9 -3
- package/es/scenegraph/group-creater/progress/update-position/update-auto-row.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.js +13 -3
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/scenegraph/layout/move-cell.js +7 -1
- package/es/scenegraph/layout/move-cell.js.map +1 -1
- package/es/scenegraph/layout/update-height.js +2 -2
- package/es/scenegraph/layout/update-height.js.map +1 -1
- package/es/scenegraph/layout/update-row.js +4 -8
- package/es/scenegraph/layout/update-row.js.map +1 -1
- package/es/scenegraph/scenegraph.js +16 -9
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/state/cell-move/index.js +6 -4
- package/es/state/cell-move/index.js.map +1 -1
- package/es/themes/ARCO.js +2 -1
- package/es/tools/LimitPromiseQueue.js +1 -1
- package/es/tools/util.d.ts +1 -0
- package/es/tools/util.js +6 -0
- package/es/tools/util.js.map +1 -1
- package/es/ts-types/base-table.d.ts +4 -2
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +1 -0
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +5 -5
- package/cjs/layout/pivot-layout-helper.js.map +0 -1
- package/es/layout/pivot-layout-helper.js.map +0 -1
package/dist/vtable.js
CHANGED
|
@@ -22470,6 +22470,15 @@
|
|
|
22470
22470
|
const pattern = /^-?\d+(\.\d+)?$/;
|
|
22471
22471
|
return pattern.test(str);
|
|
22472
22472
|
}
|
|
22473
|
+
function deduplication$1(array) {
|
|
22474
|
+
const result = [];
|
|
22475
|
+
for (let i = 0; i < array.length; i++) {
|
|
22476
|
+
if (result.indexOf(array[i]) === -1) {
|
|
22477
|
+
result.push(array[i]);
|
|
22478
|
+
}
|
|
22479
|
+
}
|
|
22480
|
+
return result;
|
|
22481
|
+
}
|
|
22473
22482
|
|
|
22474
22483
|
const isNode = typeof window === 'undefined' || typeof window.window === 'undefined';
|
|
22475
22484
|
let arrayFind;
|
|
@@ -23032,7 +23041,7 @@
|
|
|
23032
23041
|
}
|
|
23033
23042
|
}
|
|
23034
23043
|
|
|
23035
|
-
const indexFirst = (arr, elm) => {
|
|
23044
|
+
const indexFirst$1 = (arr, elm) => {
|
|
23036
23045
|
let low = 0;
|
|
23037
23046
|
let high = arr.length - 1;
|
|
23038
23047
|
while (low <= high) {
|
|
@@ -23078,7 +23087,7 @@
|
|
|
23078
23087
|
}
|
|
23079
23088
|
if (sourceIndex > targetIndex) {
|
|
23080
23089
|
const sourceVals = [];
|
|
23081
|
-
for (let i = indexFirst(keys, sourceIndex + moveCount - 1); i >= 0; i--) {
|
|
23090
|
+
for (let i = indexFirst$1(keys, sourceIndex + moveCount - 1); i >= 0; i--) {
|
|
23082
23091
|
const key = keys[i];
|
|
23083
23092
|
if (key >= sourceIndex) {
|
|
23084
23093
|
sourceVals.push(this.get(key));
|
|
@@ -23097,7 +23106,7 @@
|
|
|
23097
23106
|
const { length } = keys;
|
|
23098
23107
|
if (sourceIndex < targetIndex) {
|
|
23099
23108
|
const sourceVals = [];
|
|
23100
|
-
for (let i = indexFirst(keys, sourceIndex); i < length; i++) {
|
|
23109
|
+
for (let i = indexFirst$1(keys, sourceIndex); i < length; i++) {
|
|
23101
23110
|
const key = keys[i];
|
|
23102
23111
|
if (key >= sourceIndex && key < sourceIndex + moveCount) {
|
|
23103
23112
|
sourceVals.push(this.get(key));
|
|
@@ -23152,7 +23161,7 @@
|
|
|
23152
23161
|
});
|
|
23153
23162
|
this._sorted = true;
|
|
23154
23163
|
}
|
|
23155
|
-
for (let i = indexFirst(keys, keyFrom); i < length; i++) {
|
|
23164
|
+
for (let i = indexFirst$1(keys, keyFrom); i < length; i++) {
|
|
23156
23165
|
const key = keys[i];
|
|
23157
23166
|
if (keyFrom <= key && key <= keyTo) {
|
|
23158
23167
|
const callRes = fn(this.get(key), key);
|
|
@@ -36834,12 +36843,8 @@
|
|
|
36834
36843
|
}
|
|
36835
36844
|
if (isAllRowsAuto || table.getDefaultRowHeight(row) === 'auto') {
|
|
36836
36845
|
const height = computeRowHeight(row, startCol, endCol, table);
|
|
36837
|
-
|
|
36838
|
-
|
|
36839
|
-
}
|
|
36840
|
-
else {
|
|
36841
|
-
table._setRowHeight(row, height);
|
|
36842
|
-
}
|
|
36846
|
+
newHeights[row] = Math.round(height);
|
|
36847
|
+
table._setRowHeight(row, height);
|
|
36843
36848
|
}
|
|
36844
36849
|
}
|
|
36845
36850
|
for (let row = table.rowCount - table.bottomFrozenRowCount; row <= rowEnd; row++) {
|
|
@@ -36902,7 +36907,7 @@
|
|
|
36902
36907
|
}
|
|
36903
36908
|
}
|
|
36904
36909
|
else {
|
|
36905
|
-
table.
|
|
36910
|
+
table.clearRowHeightCache();
|
|
36906
36911
|
for (let row = 0; row < table.rowCount; row++) {
|
|
36907
36912
|
newHeights[row] = table.getRowHeight(row);
|
|
36908
36913
|
}
|
|
@@ -36999,7 +37004,22 @@
|
|
|
36999
37004
|
table._setRowHeight(row, newRowHeight);
|
|
37000
37005
|
}
|
|
37001
37006
|
}
|
|
37002
|
-
|
|
37007
|
+
if (table.heightMode === 'adaptive' ||
|
|
37008
|
+
(table.autoFillHeight && table.getAllRowsHeight() <= table.tableNoFrameHeight)) {
|
|
37009
|
+
for (let row = 0; row <= table.columnHeaderLevelCount - 1; row++) {
|
|
37010
|
+
const newRowHeight = table.getRowHeight(row);
|
|
37011
|
+
if (newRowHeight !== oldRowHeights[row]) {
|
|
37012
|
+
table.scenegraph.updateRowHeight(row, newRowHeight - oldRowHeights[row], true);
|
|
37013
|
+
}
|
|
37014
|
+
}
|
|
37015
|
+
for (let row = table.rowCount - table.bottomFrozenRowCount; row <= table.rowCount - 1; row++) {
|
|
37016
|
+
const newRowHeight = table.getRowHeight(row);
|
|
37017
|
+
if (newRowHeight !== oldRowHeights[row]) {
|
|
37018
|
+
table.scenegraph.updateRowHeight(row, newRowHeight - oldRowHeights[row], true);
|
|
37019
|
+
}
|
|
37020
|
+
}
|
|
37021
|
+
}
|
|
37022
|
+
for (let row = table.scenegraph.proxy.rowStart; row <= table.scenegraph.proxy.rowEnd; row++) {
|
|
37003
37023
|
const newRowHeight = table.getRowHeight(row);
|
|
37004
37024
|
if (newRowHeight !== oldRowHeights[row]) {
|
|
37005
37025
|
table.scenegraph.updateRowHeight(row, newRowHeight - oldRowHeights[row], true);
|
|
@@ -37369,9 +37389,13 @@
|
|
|
37369
37389
|
rowStart = row + 1;
|
|
37370
37390
|
rowEnd = scene.table.columnHeaderLevelCount - 1;
|
|
37371
37391
|
}
|
|
37392
|
+
else if (row >= scene.table.rowCount - scene.table.bottomFrozenRowCount) {
|
|
37393
|
+
rowStart = row + 1;
|
|
37394
|
+
rowEnd = scene.table.rowCount - 1;
|
|
37395
|
+
}
|
|
37372
37396
|
else {
|
|
37373
37397
|
rowStart = row + 1;
|
|
37374
|
-
rowEnd = scene.
|
|
37398
|
+
rowEnd = Math.min(scene.proxy.rowEnd, scene.table.rowCount - scene.table.bottomFrozenRowCount - 1);
|
|
37375
37399
|
}
|
|
37376
37400
|
for (let rowIndex = rowStart; rowIndex <= rowEnd; rowIndex++) {
|
|
37377
37401
|
for (let colIndex = 0; colIndex < scene.table.colCount; colIndex++) {
|
|
@@ -38280,13 +38304,13 @@
|
|
|
38280
38304
|
}
|
|
38281
38305
|
update(backX, lineX, backY, lineY) {
|
|
38282
38306
|
if (typeof backX === 'number' && typeof lineX === 'number') {
|
|
38283
|
-
this.columnMoverLabel.setAttribute('x', lineX
|
|
38284
|
-
this.columnMoverLine.setAttribute('x', lineX
|
|
38307
|
+
this.columnMoverLabel.setAttribute('x', lineX);
|
|
38308
|
+
this.columnMoverLine.setAttribute('x', lineX);
|
|
38285
38309
|
this.columnMoverBack.setAttribute('x', backX);
|
|
38286
38310
|
}
|
|
38287
38311
|
else if (typeof backY === 'number' && typeof lineY === 'number') {
|
|
38288
|
-
this.columnMoverLabel.setAttribute('y', lineY
|
|
38289
|
-
this.columnMoverLine.setAttribute('y', lineY
|
|
38312
|
+
this.columnMoverLabel.setAttribute('y', lineY);
|
|
38313
|
+
this.columnMoverLine.setAttribute('y', lineY);
|
|
38290
38314
|
this.columnMoverBack.setAttribute('y', backY);
|
|
38291
38315
|
}
|
|
38292
38316
|
}
|
|
@@ -40785,7 +40809,7 @@
|
|
|
40785
40809
|
});
|
|
40786
40810
|
}
|
|
40787
40811
|
|
|
40788
|
-
function updateAutoRow(colStart, colEnd, rowStart, rowEnd, table, direction = 'up') {
|
|
40812
|
+
function updateAutoRow(colStart, colEnd, rowStart, rowEnd, table, direction = 'up', part) {
|
|
40789
40813
|
if (direction === 'up') {
|
|
40790
40814
|
for (let col = colStart; col <= colEnd; col++) {
|
|
40791
40815
|
for (let row = rowStart; row <= rowEnd; row++) {
|
|
@@ -40797,6 +40821,13 @@
|
|
|
40797
40821
|
if (cellGroup._prev) {
|
|
40798
40822
|
y = cellGroup._prev?.attribute.y + table.getRowHeight(cellGroup._prev.row);
|
|
40799
40823
|
}
|
|
40824
|
+
else if (part) {
|
|
40825
|
+
const baseCellGroup = table.scenegraph.highPerformanceGetCell(col, rowEnd + 1, true);
|
|
40826
|
+
y = baseCellGroup.attribute.y;
|
|
40827
|
+
for (let r = rowStart; r <= rowEnd; r++) {
|
|
40828
|
+
y -= table.getRowHeight(r);
|
|
40829
|
+
}
|
|
40830
|
+
}
|
|
40800
40831
|
else {
|
|
40801
40832
|
y = table.getRowsHeight(table.columnHeaderLevelCount, cellGroup.row - 1);
|
|
40802
40833
|
}
|
|
@@ -40815,6 +40846,13 @@
|
|
|
40815
40846
|
if (cellGroup._next) {
|
|
40816
40847
|
y = cellGroup._next?.attribute.y - table.getRowHeight(cellGroup.row);
|
|
40817
40848
|
}
|
|
40849
|
+
else if (part) {
|
|
40850
|
+
const baseCellGroup = table.scenegraph.highPerformanceGetCell(col, rowStart - 1, true);
|
|
40851
|
+
y = baseCellGroup.attribute.y;
|
|
40852
|
+
for (let r = rowStart; r <= rowEnd; r++) {
|
|
40853
|
+
y += table.getRowHeight(r);
|
|
40854
|
+
}
|
|
40855
|
+
}
|
|
40818
40856
|
else {
|
|
40819
40857
|
y = table.getRowsHeight(table.columnHeaderLevelCount, cellGroup.row - 1);
|
|
40820
40858
|
}
|
|
@@ -40890,9 +40928,9 @@
|
|
|
40890
40928
|
proxy.rowEnd = direction === 'up' ? proxy.rowEnd + count : proxy.rowEnd - count;
|
|
40891
40929
|
updateRowContent(syncTopRow, syncBottomRow, proxy);
|
|
40892
40930
|
if (proxy.table.heightMode === 'autoHeight') {
|
|
40893
|
-
updateAutoRow(proxy.bodyLeftCol, proxy.bodyRightCol, syncTopRow, syncBottomRow, proxy.table, distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up');
|
|
40894
|
-
updateAutoRow(0, proxy.table.frozenColCount - 1, syncTopRow, syncBottomRow, proxy.table, distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up');
|
|
40895
|
-
updateAutoRow(proxy.table.colCount - proxy.table.rightFrozenColCount, proxy.table.colCount - 1, syncTopRow, syncBottomRow, proxy.table, distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up');
|
|
40931
|
+
updateAutoRow(proxy.bodyLeftCol, proxy.bodyRightCol, syncTopRow, syncBottomRow, proxy.table, distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up', true);
|
|
40932
|
+
updateAutoRow(0, proxy.table.frozenColCount - 1, syncTopRow, syncBottomRow, proxy.table, distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up', true);
|
|
40933
|
+
updateAutoRow(proxy.table.colCount - proxy.table.rightFrozenColCount, proxy.table.colCount - 1, syncTopRow, syncBottomRow, proxy.table, distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up', true);
|
|
40896
40934
|
const cellGroup = proxy.table.scenegraph.highPerformanceGetCell(proxy.colStart, screenTopRow, true);
|
|
40897
40935
|
const deltaY = screenTopY - (cellGroup.attribute.y + proxy.table.getFrozenRowsHeight() + proxy.table.scenegraph.proxy.deltaY);
|
|
40898
40936
|
proxy.table.scenegraph.proxy.deltaY += deltaY;
|
|
@@ -41444,9 +41482,9 @@
|
|
|
41444
41482
|
}
|
|
41445
41483
|
updateRowContent(this.rowUpdatePos, distRow, this);
|
|
41446
41484
|
if (this.table.heightMode === 'autoHeight') {
|
|
41447
|
-
updateAutoRow(this.bodyLeftCol, this.bodyRightCol, this.rowUpdatePos, distRow, this.table, this.rowUpdateDirection);
|
|
41448
|
-
updateAutoRow(0, this.table.frozenColCount - 1, this.rowUpdatePos, distRow, this.table, this.rowUpdateDirection);
|
|
41449
|
-
updateAutoRow(this.table.colCount - this.table.rightFrozenColCount, this.table.colCount - 1, this.rowUpdatePos, distRow, this.table, this.rowUpdateDirection);
|
|
41485
|
+
updateAutoRow(this.bodyLeftCol, this.bodyRightCol, this.rowUpdatePos, distRow, this.table, this.rowUpdateDirection, true);
|
|
41486
|
+
updateAutoRow(0, this.table.frozenColCount - 1, this.rowUpdatePos, distRow, this.table, this.rowUpdateDirection, true);
|
|
41487
|
+
updateAutoRow(this.table.colCount - this.table.rightFrozenColCount, this.table.colCount - 1, this.rowUpdatePos, distRow, this.table, this.rowUpdateDirection, true);
|
|
41450
41488
|
}
|
|
41451
41489
|
this.rowUpdatePos = distRow + 1;
|
|
41452
41490
|
}
|
|
@@ -41614,6 +41652,8 @@
|
|
|
41614
41652
|
const columnHeaderGroup = table.scenegraph.getColGroup(col, true);
|
|
41615
41653
|
const columnGroup = table.scenegraph.getColGroup(col);
|
|
41616
41654
|
const columnBottomGroup = table.scenegraph.getColGroupInBottom(col);
|
|
41655
|
+
const columnLeftBottomGroup = table.scenegraph.getColGroupInLeftBottomCorner(col);
|
|
41656
|
+
const columnRightBottomGroup = table.scenegraph.getColGroupInRightBottomCorner(col);
|
|
41617
41657
|
if (columnHeaderGroup) {
|
|
41618
41658
|
columnHeaderGroup.setAttribute('width', columnWidth);
|
|
41619
41659
|
columnHeaderGroup.forEachChildren((child) => {
|
|
@@ -41632,6 +41672,18 @@
|
|
|
41632
41672
|
child.setAttribute('width', columnWidth);
|
|
41633
41673
|
});
|
|
41634
41674
|
}
|
|
41675
|
+
if (columnRightBottomGroup) {
|
|
41676
|
+
columnRightBottomGroup.setAttribute('width', columnWidth);
|
|
41677
|
+
columnRightBottomGroup.forEachChildren((child) => {
|
|
41678
|
+
child.setAttribute('width', columnWidth);
|
|
41679
|
+
});
|
|
41680
|
+
}
|
|
41681
|
+
if (columnLeftBottomGroup) {
|
|
41682
|
+
columnLeftBottomGroup.setAttribute('width', columnWidth);
|
|
41683
|
+
columnLeftBottomGroup.forEachChildren((child) => {
|
|
41684
|
+
child.setAttribute('width', columnWidth);
|
|
41685
|
+
});
|
|
41686
|
+
}
|
|
41635
41687
|
}
|
|
41636
41688
|
scene.updateContainer();
|
|
41637
41689
|
if (direction === 'column') {
|
|
@@ -42151,7 +42203,7 @@
|
|
|
42151
42203
|
});
|
|
42152
42204
|
const rowHeightsMap = table.rowHeightsMap;
|
|
42153
42205
|
removeRows.forEach(row => {
|
|
42154
|
-
rowHeightsMap.
|
|
42206
|
+
rowHeightsMap.delete(row);
|
|
42155
42207
|
});
|
|
42156
42208
|
if (removeRows.length) {
|
|
42157
42209
|
resetRowNumber(scene);
|
|
@@ -42165,7 +42217,7 @@
|
|
|
42165
42217
|
addRows.forEach(row => {
|
|
42166
42218
|
const needUpdateAfter = addRow(row, scene);
|
|
42167
42219
|
updateAfter = updateAfter ?? needUpdateAfter;
|
|
42168
|
-
rowHeightsMap.
|
|
42220
|
+
rowHeightsMap.insert(row);
|
|
42169
42221
|
});
|
|
42170
42222
|
resetRowNumberAndY(scene);
|
|
42171
42223
|
if (addRows.length) {
|
|
@@ -42273,15 +42325,6 @@
|
|
|
42273
42325
|
}
|
|
42274
42326
|
return row;
|
|
42275
42327
|
}
|
|
42276
|
-
function deduplication$1(array) {
|
|
42277
|
-
const result = [];
|
|
42278
|
-
for (let i = 0; i < array.length; i++) {
|
|
42279
|
-
if (result.indexOf(array[i]) === -1) {
|
|
42280
|
-
result.push(array[i]);
|
|
42281
|
-
}
|
|
42282
|
-
}
|
|
42283
|
-
return result;
|
|
42284
|
-
}
|
|
42285
42328
|
function resetRowNumber(scene) {
|
|
42286
42329
|
scene.bodyGroup.forEachChildren((colGroup) => {
|
|
42287
42330
|
let rowIndex = scene.bodyRowStart;
|
|
@@ -44568,11 +44611,9 @@
|
|
|
44568
44611
|
}
|
|
44569
44612
|
}
|
|
44570
44613
|
updateRowHeight(row, detaY, skipTableHeightMap) {
|
|
44571
|
-
|
|
44572
|
-
|
|
44573
|
-
|
|
44574
|
-
this.updateContainerHeight(row, detaY);
|
|
44575
|
-
}
|
|
44614
|
+
detaY = Math.round(detaY);
|
|
44615
|
+
updateRowHeight(this, row, detaY, skipTableHeightMap);
|
|
44616
|
+
this.updateContainerHeight(row, detaY);
|
|
44576
44617
|
}
|
|
44577
44618
|
updateRowsHeight(rows, detaYs, skipTableHeightMap) {
|
|
44578
44619
|
for (let i = 0; i < rows.length; i++) {
|
|
@@ -44640,7 +44681,10 @@
|
|
|
44640
44681
|
if (oldHeight === height) {
|
|
44641
44682
|
return;
|
|
44642
44683
|
}
|
|
44643
|
-
this.
|
|
44684
|
+
if ((row >= this.proxy.rowStart && row <= this.proxy.rowEnd) ||
|
|
44685
|
+
(row >= this.table.rowCount - this.table.bottomFrozenRowCount && row <= this.table.rowCount - 1)) {
|
|
44686
|
+
this.updateRowHeight(row, height - oldHeight);
|
|
44687
|
+
}
|
|
44644
44688
|
this.table._clearRowRangeHeightsMap(row);
|
|
44645
44689
|
}
|
|
44646
44690
|
setX(x) {
|
|
@@ -44880,7 +44924,7 @@
|
|
|
44880
44924
|
this.colHeaderGroup.setDeltaWidth(colHeaderX - this.colHeaderGroup.attribute.width);
|
|
44881
44925
|
this.rowHeaderGroup.setDeltaWidth(rowHeaderX - this.rowHeaderGroup.attribute.width);
|
|
44882
44926
|
this.bottomFrozenGroup.setDeltaWidth(colHeaderX - this.bottomFrozenGroup.attribute.width);
|
|
44883
|
-
this.rightFrozenGroup.setDeltaWidth(rightX - this.
|
|
44927
|
+
this.rightFrozenGroup.setDeltaWidth(rightX - this.rightFrozenGroup.attribute.width);
|
|
44884
44928
|
this.rightTopCornerGroup.setDeltaWidth(rightX - this.rightTopCornerGroup.attribute.width);
|
|
44885
44929
|
this.rightBottomCornerGroup.setDeltaWidth(rightX - this.rightBottomCornerGroup.attribute.width);
|
|
44886
44930
|
this.bodyGroup.setDeltaWidth(bodyX - this.bodyGroup.attribute.width);
|
|
@@ -45049,9 +45093,30 @@
|
|
|
45049
45093
|
this.stage.enableDirtyBounds();
|
|
45050
45094
|
}
|
|
45051
45095
|
updateRow(removeCells, addCells, updateCells = []) {
|
|
45096
|
+
const addRows = deduplication$1(addCells.map(cell => cell.row)).sort((a, b) => a - b);
|
|
45097
|
+
const updateRows = deduplication$1(updateCells.map(cell => cell.row)).sort((a, b) => a - b);
|
|
45098
|
+
const isNotFillHeight = this.table.getAllRowsHeight() -
|
|
45099
|
+
[...addRows, ...updateRows].reduce((tolHeight, rowNumber) => {
|
|
45100
|
+
return tolHeight + this.table.getRowHeight(rowNumber);
|
|
45101
|
+
}, 0) <=
|
|
45102
|
+
this.table.tableNoFrameHeight;
|
|
45052
45103
|
updateRow(removeCells, addCells, updateCells, this.table);
|
|
45053
45104
|
this.recalculateColWidths();
|
|
45054
|
-
this.
|
|
45105
|
+
if (this.table.heightMode === 'adaptive' ||
|
|
45106
|
+
(this.table.autoFillHeight && (this.table.getAllRowsHeight() <= this.table.tableNoFrameHeight || isNotFillHeight))) {
|
|
45107
|
+
this.table.scenegraph.recalculateRowHeights();
|
|
45108
|
+
}
|
|
45109
|
+
else if (this.table.heightMode === 'autoHeight') {
|
|
45110
|
+
for (let i = 0; i < updateRows.length; i++) {
|
|
45111
|
+
const row = updateRows[i];
|
|
45112
|
+
const oldHeight = this.table.getRowHeight(row);
|
|
45113
|
+
const newHeight = computeRowHeight(row, 0, this.table.colCount - 1, this.table);
|
|
45114
|
+
if ((row >= this.proxy.rowStart && row <= this.proxy.rowEnd) ||
|
|
45115
|
+
(row >= this.table.rowCount - this.table.bottomFrozenRowCount && row <= this.table.rowCount - 1)) {
|
|
45116
|
+
this.table.scenegraph.updateRowHeight(row, newHeight - oldHeight);
|
|
45117
|
+
}
|
|
45118
|
+
}
|
|
45119
|
+
}
|
|
45055
45120
|
this.table.stateManager.checkFrozen();
|
|
45056
45121
|
if (!this.isPivot && !this.transpose) {
|
|
45057
45122
|
this.component.setFrozenColumnShadow(this.table.frozenColCount - 1);
|
|
@@ -45716,20 +45781,44 @@
|
|
|
45716
45781
|
let backX;
|
|
45717
45782
|
let lineY;
|
|
45718
45783
|
let backY;
|
|
45719
|
-
const cellLocation = state.table.getCellLocation(
|
|
45784
|
+
const cellLocation = state.table.getCellLocation(state.columnMove.colSource, state.columnMove.rowSource);
|
|
45720
45785
|
if (cellLocation === 'columnHeader') {
|
|
45721
|
-
|
|
45722
|
-
|
|
45786
|
+
backX = state.columnMove.x;
|
|
45787
|
+
if (state.table.isFrozenColumn(col)) {
|
|
45788
|
+
lineX =
|
|
45723
45789
|
state.columnMove.colTarget >= state.columnMove.colSource
|
|
45724
45790
|
? state.table.getColsWidth(0, state.columnMove.colTarget)
|
|
45725
|
-
: state.table.getColsWidth(0, state.columnMove.colTarget - 1)
|
|
45791
|
+
: state.table.getColsWidth(0, state.columnMove.colTarget - 1);
|
|
45792
|
+
}
|
|
45793
|
+
else if (state.table.isRightFrozenColumn(col)) {
|
|
45794
|
+
lineX = state.table.tableNoFrameWidth - state.table.getColsWidth(targetCell.col + 1, state.table.colCount - 1);
|
|
45795
|
+
}
|
|
45796
|
+
else {
|
|
45797
|
+
lineX =
|
|
45798
|
+
(state.columnMove.colTarget >= state.columnMove.colSource
|
|
45799
|
+
? state.table.getColsWidth(0, state.columnMove.colTarget)
|
|
45800
|
+
: state.table.getColsWidth(0, state.columnMove.colTarget - 1)) -
|
|
45801
|
+
state.table.stateManager.scroll.horizontalBarPos;
|
|
45802
|
+
}
|
|
45726
45803
|
}
|
|
45727
45804
|
else if (cellLocation === 'rowHeader') {
|
|
45728
|
-
|
|
45729
|
-
|
|
45805
|
+
backY = state.columnMove.y;
|
|
45806
|
+
if (state.table.isFrozenRow(row)) {
|
|
45807
|
+
lineY =
|
|
45730
45808
|
state.columnMove.rowTarget >= state.columnMove.rowSource
|
|
45731
45809
|
? state.table.getRowsHeight(0, state.columnMove.rowTarget)
|
|
45732
|
-
: state.table.getRowsHeight(0, state.columnMove.rowTarget - 1)
|
|
45810
|
+
: state.table.getRowsHeight(0, state.columnMove.rowTarget - 1);
|
|
45811
|
+
}
|
|
45812
|
+
else if (state.table.isBottomFrozenRow(row)) {
|
|
45813
|
+
lineY = state.table.tableNoFrameHeight - state.table.getRowsHeight(targetCell.row + 1, state.table.rowCount - 1);
|
|
45814
|
+
}
|
|
45815
|
+
else {
|
|
45816
|
+
lineY =
|
|
45817
|
+
(state.columnMove.rowTarget >= state.columnMove.rowSource
|
|
45818
|
+
? state.table.getRowsHeight(0, state.columnMove.rowTarget)
|
|
45819
|
+
: state.table.getRowsHeight(0, state.columnMove.rowTarget - 1)) -
|
|
45820
|
+
state.table.stateManager.scroll.verticalBarPos;
|
|
45821
|
+
}
|
|
45733
45822
|
}
|
|
45734
45823
|
state.table.scenegraph.component.updateMoveCol(backX, lineX, backY, lineY);
|
|
45735
45824
|
state.table.scenegraph.updateNextFrame();
|
|
@@ -45748,6 +45837,28 @@
|
|
|
45748
45837
|
clearWidthsAndHeightsCache(state.columnMove.colSource, state.columnMove.rowSource, state.columnMove.colTarget, state.columnMove.rowTarget, state.table);
|
|
45749
45838
|
state.table.clearCellStyleCache();
|
|
45750
45839
|
state.table.scenegraph.updateHeaderPosition(state.columnMove.colSource, state.columnMove.rowSource, state.columnMove.colTarget, state.columnMove.rowTarget, sourceMergeInfo, targetMergeInfo);
|
|
45840
|
+
if (state.table.internalProps.frozenColDragHeaderMode === 'adjustFrozenCount' && state.table.isListTable()) {
|
|
45841
|
+
if (state.table.isFrozenColumn(state.columnMove.colTarget) &&
|
|
45842
|
+
!state.table.isFrozenColumn(state.columnMove.colSource)) {
|
|
45843
|
+
state.table.frozenColCount +=
|
|
45844
|
+
sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1;
|
|
45845
|
+
}
|
|
45846
|
+
else if (state.table.isFrozenColumn(state.columnMove.colSource) &&
|
|
45847
|
+
!state.table.isFrozenColumn(state.columnMove.colTarget)) {
|
|
45848
|
+
state.table.frozenColCount -=
|
|
45849
|
+
sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1;
|
|
45850
|
+
}
|
|
45851
|
+
if (state.table.isRightFrozenColumn(state.columnMove.colTarget) &&
|
|
45852
|
+
!state.table.isRightFrozenColumn(state.columnMove.colSource)) {
|
|
45853
|
+
state.table.rightFrozenColCount +=
|
|
45854
|
+
sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1;
|
|
45855
|
+
}
|
|
45856
|
+
else if (state.table.isRightFrozenColumn(state.columnMove.colSource) &&
|
|
45857
|
+
!state.table.isRightFrozenColumn(state.columnMove.colTarget)) {
|
|
45858
|
+
state.table.rightFrozenColCount -=
|
|
45859
|
+
sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1;
|
|
45860
|
+
}
|
|
45861
|
+
}
|
|
45751
45862
|
}
|
|
45752
45863
|
state.updateCursor();
|
|
45753
45864
|
}
|
|
@@ -47074,14 +47185,15 @@
|
|
|
47074
47185
|
if (stateManager.interactionState === InteractionState.scrolling) {
|
|
47075
47186
|
return;
|
|
47076
47187
|
}
|
|
47077
|
-
if (stateManager.interactionState === InteractionState.grabing
|
|
47078
|
-
Math.abs(lastX - e.x) + Math.abs(lastY - e.y) >= 1) {
|
|
47079
|
-
|
|
47080
|
-
|
|
47081
|
-
|
|
47082
|
-
|
|
47083
|
-
|
|
47084
|
-
|
|
47188
|
+
if (stateManager.interactionState === InteractionState.grabing) {
|
|
47189
|
+
if (Math.abs(lastX - e.x) + Math.abs(lastY - e.y) >= 1) {
|
|
47190
|
+
if (stateManager.isResizeCol()) ;
|
|
47191
|
+
else if (stateManager.isMoveCol()) {
|
|
47192
|
+
eventManager.dealColumnMover(eventArgsSet);
|
|
47193
|
+
}
|
|
47194
|
+
else {
|
|
47195
|
+
eventManager.dealTableSelect(eventArgsSet, true);
|
|
47196
|
+
}
|
|
47085
47197
|
}
|
|
47086
47198
|
return;
|
|
47087
47199
|
}
|
|
@@ -48384,7 +48496,9 @@
|
|
|
48384
48496
|
}
|
|
48385
48497
|
dealColumnMover(eventArgsSet) {
|
|
48386
48498
|
const { eventArgs } = eventArgsSet;
|
|
48387
|
-
|
|
48499
|
+
if (isValid$1(eventArgs.col) && isValid$1(eventArgs.row)) {
|
|
48500
|
+
this.table.stateManager.updateMoveCol(eventArgs.col, eventArgs.row, eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y);
|
|
48501
|
+
}
|
|
48388
48502
|
}
|
|
48389
48503
|
startColumnResize(eventArgsSet) {
|
|
48390
48504
|
}
|
|
@@ -51250,6 +51364,238 @@
|
|
|
51250
51364
|
return new DiscreteTableLegend(option, table);
|
|
51251
51365
|
}
|
|
51252
51366
|
|
|
51367
|
+
class NumberRangeMap {
|
|
51368
|
+
data;
|
|
51369
|
+
cumulativeSum;
|
|
51370
|
+
difference;
|
|
51371
|
+
totalSum;
|
|
51372
|
+
table;
|
|
51373
|
+
isUpdate = false;
|
|
51374
|
+
_keys = [];
|
|
51375
|
+
_sorted = false;
|
|
51376
|
+
constructor(table) {
|
|
51377
|
+
this.data = new Map();
|
|
51378
|
+
this._keys.length = 0;
|
|
51379
|
+
this.cumulativeSum = new Map();
|
|
51380
|
+
this.difference = new Map();
|
|
51381
|
+
this.totalSum = 0;
|
|
51382
|
+
this.table = table;
|
|
51383
|
+
}
|
|
51384
|
+
clear() {
|
|
51385
|
+
this.data.clear();
|
|
51386
|
+
this.cumulativeSum.clear();
|
|
51387
|
+
this.difference.clear();
|
|
51388
|
+
this.totalSum = 0;
|
|
51389
|
+
}
|
|
51390
|
+
clearRange() {
|
|
51391
|
+
this.cumulativeSum.clear();
|
|
51392
|
+
this.difference.clear();
|
|
51393
|
+
}
|
|
51394
|
+
add(position, value) {
|
|
51395
|
+
const defaultValue = this.table.getRowHeight(position);
|
|
51396
|
+
if (!this.data.has(position)) {
|
|
51397
|
+
this._keys.push(position);
|
|
51398
|
+
this._sorted = false;
|
|
51399
|
+
}
|
|
51400
|
+
this.data.set(position, value);
|
|
51401
|
+
this.totalSum += value;
|
|
51402
|
+
this.updateDifference(position, value - defaultValue);
|
|
51403
|
+
}
|
|
51404
|
+
remove(position) {
|
|
51405
|
+
if (this.data.has(position)) {
|
|
51406
|
+
const value = this.data.get(position);
|
|
51407
|
+
this.data.delete(position);
|
|
51408
|
+
const index = this._keys.indexOf(position);
|
|
51409
|
+
if (index !== -1) {
|
|
51410
|
+
this._keys.splice(index, 1);
|
|
51411
|
+
}
|
|
51412
|
+
this.totalSum -= value;
|
|
51413
|
+
const defaultValue = this.table.getRowHeight(position);
|
|
51414
|
+
this.updateDifference(position, defaultValue - value);
|
|
51415
|
+
}
|
|
51416
|
+
}
|
|
51417
|
+
put(position, newValue) {
|
|
51418
|
+
if (this.data.has(position)) {
|
|
51419
|
+
const oldValue = this.data.get(position);
|
|
51420
|
+
this.data.set(position, newValue);
|
|
51421
|
+
const difference = newValue - oldValue;
|
|
51422
|
+
this.totalSum += difference;
|
|
51423
|
+
this.updateDifference(position, difference);
|
|
51424
|
+
}
|
|
51425
|
+
else {
|
|
51426
|
+
this.add(position, newValue);
|
|
51427
|
+
}
|
|
51428
|
+
}
|
|
51429
|
+
get(position) {
|
|
51430
|
+
return this.data.get(position);
|
|
51431
|
+
}
|
|
51432
|
+
has(position) {
|
|
51433
|
+
return this.data.has(position);
|
|
51434
|
+
}
|
|
51435
|
+
_sort() {
|
|
51436
|
+
const { _keys: keys } = this;
|
|
51437
|
+
if (!this._sorted) {
|
|
51438
|
+
keys.sort((a, b) => {
|
|
51439
|
+
if (a < b) {
|
|
51440
|
+
return -1;
|
|
51441
|
+
}
|
|
51442
|
+
if (a > b) {
|
|
51443
|
+
return 1;
|
|
51444
|
+
}
|
|
51445
|
+
return 0;
|
|
51446
|
+
});
|
|
51447
|
+
this._sorted = true;
|
|
51448
|
+
}
|
|
51449
|
+
}
|
|
51450
|
+
updateDifference(position, difference) {
|
|
51451
|
+
const oldDifference = this.difference.get(position) ?? 0;
|
|
51452
|
+
this.difference.set(position, oldDifference + difference);
|
|
51453
|
+
this.update();
|
|
51454
|
+
}
|
|
51455
|
+
getSumInRange(start, end) {
|
|
51456
|
+
return this.calculatePrefixSum(end) - this.calculatePrefixSum(start - 1);
|
|
51457
|
+
}
|
|
51458
|
+
updateCumulativeSum(position, difference) {
|
|
51459
|
+
for (const [pos, sum] of this.cumulativeSum) {
|
|
51460
|
+
if (pos >= position) {
|
|
51461
|
+
this.cumulativeSum.set(pos, sum + difference);
|
|
51462
|
+
}
|
|
51463
|
+
}
|
|
51464
|
+
}
|
|
51465
|
+
calculatePrefixSum(position) {
|
|
51466
|
+
if (position < 0) {
|
|
51467
|
+
return 0;
|
|
51468
|
+
}
|
|
51469
|
+
if (this.cumulativeSum.has(position)) {
|
|
51470
|
+
let cache = this.cumulativeSum.get(position);
|
|
51471
|
+
for (const [pos, difference] of this.difference) {
|
|
51472
|
+
if (pos <= position) {
|
|
51473
|
+
cache += difference;
|
|
51474
|
+
}
|
|
51475
|
+
}
|
|
51476
|
+
return cache;
|
|
51477
|
+
}
|
|
51478
|
+
this.dealDiffenence();
|
|
51479
|
+
return this.getCumulativeSum(position);
|
|
51480
|
+
}
|
|
51481
|
+
getCumulativeSum(position) {
|
|
51482
|
+
let sum = 0;
|
|
51483
|
+
for (let i = position; i >= 0; i--) {
|
|
51484
|
+
if (this.cumulativeSum.has(i)) {
|
|
51485
|
+
sum += this.cumulativeSum.get(i);
|
|
51486
|
+
break;
|
|
51487
|
+
}
|
|
51488
|
+
else {
|
|
51489
|
+
sum += this.data.get(i) ?? this.table.getRowHeight(i);
|
|
51490
|
+
}
|
|
51491
|
+
}
|
|
51492
|
+
this.cumulativeSum.set(position, sum);
|
|
51493
|
+
return sum;
|
|
51494
|
+
}
|
|
51495
|
+
update() {
|
|
51496
|
+
if (this.isUpdate) {
|
|
51497
|
+
return;
|
|
51498
|
+
}
|
|
51499
|
+
this.isUpdate = true;
|
|
51500
|
+
setTimeout(() => {
|
|
51501
|
+
this.dealDiffenence();
|
|
51502
|
+
this.isUpdate = false;
|
|
51503
|
+
}, 0);
|
|
51504
|
+
}
|
|
51505
|
+
dealDiffenence() {
|
|
51506
|
+
for (const [sumPos, sum] of this.cumulativeSum) {
|
|
51507
|
+
for (const [difPos, difference] of this.difference) {
|
|
51508
|
+
if (sumPos >= difPos) {
|
|
51509
|
+
this.cumulativeSum.set(sumPos, sum + difference);
|
|
51510
|
+
}
|
|
51511
|
+
}
|
|
51512
|
+
}
|
|
51513
|
+
this.difference.clear();
|
|
51514
|
+
}
|
|
51515
|
+
insert(position, value) {
|
|
51516
|
+
const lastIndex = this.getLastIndex() + 1;
|
|
51517
|
+
this.adjustOrder(position, position + 1, lastIndex - position);
|
|
51518
|
+
if (isValid$1(value)) {
|
|
51519
|
+
this.put(position, value);
|
|
51520
|
+
}
|
|
51521
|
+
}
|
|
51522
|
+
getLastIndex() {
|
|
51523
|
+
this._sort();
|
|
51524
|
+
return this._keys[this._keys.length - 1];
|
|
51525
|
+
}
|
|
51526
|
+
delLast() {
|
|
51527
|
+
const lastIndex = this.getLastIndex();
|
|
51528
|
+
this.remove(lastIndex);
|
|
51529
|
+
}
|
|
51530
|
+
delete(position) {
|
|
51531
|
+
if (!this.has(position)) {
|
|
51532
|
+
return;
|
|
51533
|
+
}
|
|
51534
|
+
const lastIndex = this.getLastIndex();
|
|
51535
|
+
this.adjustOrder(position + 1, position, lastIndex - position);
|
|
51536
|
+
this.delLast();
|
|
51537
|
+
}
|
|
51538
|
+
adjustOrder(sourceIndex, targetIndex, moveCount) {
|
|
51539
|
+
this.clearRange();
|
|
51540
|
+
this._sort();
|
|
51541
|
+
const { _keys: keys } = this;
|
|
51542
|
+
if (sourceIndex > targetIndex) {
|
|
51543
|
+
const sourceVals = [];
|
|
51544
|
+
for (let i = indexFirst(keys, sourceIndex + moveCount - 1); i >= 0; i--) {
|
|
51545
|
+
const key = keys[i];
|
|
51546
|
+
if (key >= sourceIndex) {
|
|
51547
|
+
sourceVals.push(this.get(key));
|
|
51548
|
+
}
|
|
51549
|
+
else if (targetIndex <= key && key < sourceIndex) {
|
|
51550
|
+
this.put(key + moveCount, this.get(key));
|
|
51551
|
+
}
|
|
51552
|
+
else if (key < targetIndex) {
|
|
51553
|
+
break;
|
|
51554
|
+
}
|
|
51555
|
+
}
|
|
51556
|
+
for (let i = 0; i < moveCount; i++) {
|
|
51557
|
+
this.put(targetIndex + i, sourceVals[moveCount - 1 - i]);
|
|
51558
|
+
}
|
|
51559
|
+
}
|
|
51560
|
+
const { length } = keys;
|
|
51561
|
+
if (sourceIndex < targetIndex) {
|
|
51562
|
+
const sourceVals = [];
|
|
51563
|
+
for (let i = indexFirst(keys, sourceIndex); i < length; i++) {
|
|
51564
|
+
const key = keys[i];
|
|
51565
|
+
if (key >= sourceIndex && key < sourceIndex + moveCount) {
|
|
51566
|
+
sourceVals.push(this.get(key));
|
|
51567
|
+
}
|
|
51568
|
+
else if (sourceIndex + moveCount <= key && key <= targetIndex) {
|
|
51569
|
+
this.put(key - moveCount, this.get(key));
|
|
51570
|
+
}
|
|
51571
|
+
else if (key > targetIndex) {
|
|
51572
|
+
break;
|
|
51573
|
+
}
|
|
51574
|
+
}
|
|
51575
|
+
for (let i = 0; i < moveCount; i++) {
|
|
51576
|
+
this.put(targetIndex + i, sourceVals[i]);
|
|
51577
|
+
}
|
|
51578
|
+
}
|
|
51579
|
+
}
|
|
51580
|
+
}
|
|
51581
|
+
function indexFirst(arr, elm) {
|
|
51582
|
+
let low = 0;
|
|
51583
|
+
let high = arr.length - 1;
|
|
51584
|
+
while (low <= high) {
|
|
51585
|
+
const i = Math.floor((low + high) / 2);
|
|
51586
|
+
if (arr[i] === elm) {
|
|
51587
|
+
return i;
|
|
51588
|
+
}
|
|
51589
|
+
else if (arr[i] > elm) {
|
|
51590
|
+
high = i - 1;
|
|
51591
|
+
}
|
|
51592
|
+
else {
|
|
51593
|
+
low = i + 1;
|
|
51594
|
+
}
|
|
51595
|
+
}
|
|
51596
|
+
return high < 0 ? 0 : high;
|
|
51597
|
+
}
|
|
51598
|
+
|
|
51253
51599
|
const { toBoxArray } = style;
|
|
51254
51600
|
const { isTouchEvent } = event;
|
|
51255
51601
|
const rangeReg = /^\$(\d+)\$(\d+)$/;
|
|
@@ -51281,7 +51627,7 @@
|
|
|
51281
51627
|
return TABLE_EVENT_TYPE;
|
|
51282
51628
|
}
|
|
51283
51629
|
options;
|
|
51284
|
-
version = "0.
|
|
51630
|
+
version = "0.19.0";
|
|
51285
51631
|
pagination;
|
|
51286
51632
|
id = `VTable${Date.now()}`;
|
|
51287
51633
|
headerStyleCache;
|
|
@@ -51352,7 +51698,7 @@
|
|
|
51352
51698
|
internalProps.renderChartAsync = renderChartAsync;
|
|
51353
51699
|
setBatchRenderChartCount(renderChartAsyncBatchCount);
|
|
51354
51700
|
internalProps.overscrollBehavior = overscrollBehavior ?? 'auto';
|
|
51355
|
-
internalProps._rowHeightsMap = new
|
|
51701
|
+
internalProps._rowHeightsMap = new NumberRangeMap(this);
|
|
51356
51702
|
internalProps._rowRangeHeightsMap = new Map();
|
|
51357
51703
|
internalProps._colRangeWidthsMap = new Map();
|
|
51358
51704
|
internalProps._widthResizedColMap = new Set();
|
|
@@ -51706,7 +52052,8 @@
|
|
|
51706
52052
|
return 'grid';
|
|
51707
52053
|
}
|
|
51708
52054
|
getColsWidth(startCol, endCol) {
|
|
51709
|
-
|
|
52055
|
+
startCol = Math.max(startCol, 0);
|
|
52056
|
+
endCol = Math.min(endCol, (this.colCount ?? Infinity) - 1);
|
|
51710
52057
|
const cachedColWidth = this._colRangeWidthsMap.get(`$${startCol}$${endCol}`);
|
|
51711
52058
|
if (cachedColWidth !== null && cachedColWidth !== undefined) {
|
|
51712
52059
|
return cachedColWidth;
|
|
@@ -51759,26 +52106,8 @@
|
|
|
51759
52106
|
}
|
|
51760
52107
|
}
|
|
51761
52108
|
getRowsHeight(startRow, endRow) {
|
|
51762
|
-
|
|
51763
|
-
|
|
51764
|
-
return cachedRowHeight;
|
|
51765
|
-
}
|
|
51766
|
-
const cachedLowerRowHeight = this._rowRangeHeightsMap.get(`$${startRow}$${endRow - 1}`);
|
|
51767
|
-
if (cachedLowerRowHeight !== null && cachedLowerRowHeight !== undefined) {
|
|
51768
|
-
const height = Math.round(cachedLowerRowHeight +
|
|
51769
|
-
(this.rowHeightsMap.get(endRow) ??
|
|
51770
|
-
(this.isColumnHeader(0, endRow) || this.isCornerHeader(0, endRow)
|
|
51771
|
-
? Array.isArray(this.defaultHeaderRowHeight) && isNumber$2(this.defaultHeaderRowHeight[endRow])
|
|
51772
|
-
? this.defaultHeaderRowHeight[endRow]
|
|
51773
|
-
: isNumber$2(this.defaultHeaderRowHeight)
|
|
51774
|
-
? this.defaultHeaderRowHeight
|
|
51775
|
-
: this.internalProps.defaultRowHeight
|
|
51776
|
-
: this.internalProps.defaultRowHeight)));
|
|
51777
|
-
if (startRow >= 0 && endRow >= 0) {
|
|
51778
|
-
this._rowRangeHeightsMap.set(`$${startRow}$${endRow}`, Math.round(height));
|
|
51779
|
-
}
|
|
51780
|
-
return height;
|
|
51781
|
-
}
|
|
52109
|
+
startRow = Math.max(startRow, 0);
|
|
52110
|
+
endRow = Math.min(endRow, (this.rowCount ?? Infinity) - 1);
|
|
51782
52111
|
let h = 0;
|
|
51783
52112
|
if (this.heightMode === 'standard' &&
|
|
51784
52113
|
!this.autoFillHeight &&
|
|
@@ -51792,12 +52121,7 @@
|
|
|
51792
52121
|
h += this.defaultRowHeight * (endRow - Math.max(this.columnHeaderLevelCount, startRow) + 1);
|
|
51793
52122
|
}
|
|
51794
52123
|
else {
|
|
51795
|
-
|
|
51796
|
-
h += this.getRowHeight(i);
|
|
51797
|
-
}
|
|
51798
|
-
}
|
|
51799
|
-
if (startRow >= 0 && endRow >= 0 && h > 0) {
|
|
51800
|
-
this._rowRangeHeightsMap.set(`$${startRow}$${endRow}`, Math.round(h));
|
|
52124
|
+
h = this.rowHeightsMap.getSumInRange(startRow, endRow);
|
|
51801
52125
|
}
|
|
51802
52126
|
return Math.round(h);
|
|
51803
52127
|
}
|
|
@@ -51873,22 +52197,7 @@
|
|
|
51873
52197
|
}
|
|
51874
52198
|
}
|
|
51875
52199
|
_clearRowRangeHeightsMap(row) {
|
|
51876
|
-
|
|
51877
|
-
this._rowRangeHeightsMap.clear();
|
|
51878
|
-
}
|
|
51879
|
-
else {
|
|
51880
|
-
const keys = this._rowRangeHeightsMap.keys();
|
|
51881
|
-
for (const key of keys) {
|
|
51882
|
-
const reg = rangeReg.exec(key);
|
|
51883
|
-
if (reg) {
|
|
51884
|
-
const start = Number(reg[1]);
|
|
51885
|
-
const end = Number(reg[2]);
|
|
51886
|
-
if (row >= start && row <= end) {
|
|
51887
|
-
this._rowRangeHeightsMap.delete(key);
|
|
51888
|
-
}
|
|
51889
|
-
}
|
|
51890
|
-
}
|
|
51891
|
-
}
|
|
52200
|
+
this.rowHeightsMap.clearRange();
|
|
51892
52201
|
}
|
|
51893
52202
|
_getColContentWidth(col) {
|
|
51894
52203
|
return Number(this.colContentWidthsMap.get(col));
|
|
@@ -52425,7 +52734,7 @@
|
|
|
52425
52734
|
setBatchRenderChartCount(renderChartAsyncBatchCount);
|
|
52426
52735
|
internalProps.overscrollBehavior = overscrollBehavior ?? 'auto';
|
|
52427
52736
|
internalProps.cellTextOverflows = {};
|
|
52428
|
-
internalProps._rowHeightsMap = new
|
|
52737
|
+
internalProps._rowHeightsMap = new NumberRangeMap(this);
|
|
52429
52738
|
internalProps._rowRangeHeightsMap = new Map();
|
|
52430
52739
|
internalProps._colRangeWidthsMap = new Map();
|
|
52431
52740
|
internalProps._widthResizedColMap = new Set();
|
|
@@ -53130,6 +53439,10 @@
|
|
|
53130
53439
|
}
|
|
53131
53440
|
_canDragHeaderPosition(col, row) {
|
|
53132
53441
|
if (this.isHeader(col, row) && this.stateManager.isSelected(col, row)) {
|
|
53442
|
+
if (this.internalProps.frozenColDragHeaderMode === 'disabled' &&
|
|
53443
|
+
(this.isFrozenColumn(col) || this.isRightFrozenColumn(col))) {
|
|
53444
|
+
return false;
|
|
53445
|
+
}
|
|
53133
53446
|
const selectRange = this.stateManager.select.ranges[0];
|
|
53134
53447
|
if (this.isColumnHeader(col, row)) {
|
|
53135
53448
|
if (selectRange.end.row !== this.rowCount - 1) {
|
|
@@ -54052,12 +54365,425 @@
|
|
|
54052
54365
|
return isHasChart;
|
|
54053
54366
|
}
|
|
54054
54367
|
|
|
54368
|
+
class DimensionTree {
|
|
54369
|
+
sharedVar;
|
|
54370
|
+
sizeIncludeParent = false;
|
|
54371
|
+
rowExpandLevel;
|
|
54372
|
+
hierarchyType;
|
|
54373
|
+
tree = {
|
|
54374
|
+
id: 0,
|
|
54375
|
+
dimensionKey: '',
|
|
54376
|
+
value: '',
|
|
54377
|
+
children: [],
|
|
54378
|
+
level: -1,
|
|
54379
|
+
levelSpan: 1,
|
|
54380
|
+
startIndex: 0,
|
|
54381
|
+
size: 0,
|
|
54382
|
+
startInTotal: 0,
|
|
54383
|
+
hierarchyState: undefined
|
|
54384
|
+
};
|
|
54385
|
+
totalLevel = 0;
|
|
54386
|
+
dimensionKeys = new NumberMap();
|
|
54387
|
+
cache = new Map();
|
|
54388
|
+
constructor(tree, sharedVar, hierarchyType = 'grid', rowExpandLevel = undefined) {
|
|
54389
|
+
this.sizeIncludeParent = rowExpandLevel !== null && rowExpandLevel !== undefined;
|
|
54390
|
+
this.rowExpandLevel = rowExpandLevel;
|
|
54391
|
+
this.hierarchyType = hierarchyType;
|
|
54392
|
+
this.sharedVar = sharedVar;
|
|
54393
|
+
this.reset(tree);
|
|
54394
|
+
}
|
|
54395
|
+
reset(tree, updateTreeNode = false) {
|
|
54396
|
+
this.cache.clear();
|
|
54397
|
+
this.dimensionKeys = new NumberMap();
|
|
54398
|
+
this.tree.children = tree;
|
|
54399
|
+
this.setTreeNode(this.tree, 0, this.tree);
|
|
54400
|
+
this.totalLevel = this.dimensionKeys.count();
|
|
54401
|
+
}
|
|
54402
|
+
setTreeNode(node, startIndex, parent) {
|
|
54403
|
+
node.startIndex = startIndex;
|
|
54404
|
+
node.startInTotal = (parent.startInTotal ?? 0) + node.startIndex;
|
|
54405
|
+
if (node.dimensionKey ?? node.indicatorKey) {
|
|
54406
|
+
!this.dimensionKeys.contain(node.indicatorKey ? IndicatorDimensionKeyPlaceholder : node.dimensionKey) &&
|
|
54407
|
+
this.dimensionKeys.put(node.level, node.indicatorKey ? IndicatorDimensionKeyPlaceholder : node.dimensionKey);
|
|
54408
|
+
if (!node.id) {
|
|
54409
|
+
node.id = ++this.sharedVar.seqId;
|
|
54410
|
+
}
|
|
54411
|
+
}
|
|
54412
|
+
let size = node.dimensionKey ? (this.sizeIncludeParent ? 1 : 0) : 0;
|
|
54413
|
+
const children = node.children || node.columns;
|
|
54414
|
+
if (this.hierarchyType === 'grid') {
|
|
54415
|
+
if (children?.length >= 1) {
|
|
54416
|
+
children.forEach((n) => {
|
|
54417
|
+
n.level = (node.level ?? 0) + 1;
|
|
54418
|
+
size += this.setTreeNode(n, size, node);
|
|
54419
|
+
});
|
|
54420
|
+
}
|
|
54421
|
+
else {
|
|
54422
|
+
size = 1;
|
|
54423
|
+
}
|
|
54424
|
+
}
|
|
54425
|
+
else if (node.hierarchyState === HierarchyState.expand && children?.length >= 1) {
|
|
54426
|
+
children.forEach((n) => {
|
|
54427
|
+
n.level = (node.level ?? 0) + 1;
|
|
54428
|
+
size += this.setTreeNode(n, size, node);
|
|
54429
|
+
});
|
|
54430
|
+
}
|
|
54431
|
+
else if (node.hierarchyState === HierarchyState.collapse && children?.length >= 1) {
|
|
54432
|
+
children.forEach((n) => {
|
|
54433
|
+
n.level = (node.level ?? 0) + 1;
|
|
54434
|
+
this.setTreeNode(n, size, node);
|
|
54435
|
+
});
|
|
54436
|
+
}
|
|
54437
|
+
else if (!node.hierarchyState && node.level + 1 < this.rowExpandLevel && children?.length >= 1) {
|
|
54438
|
+
node.hierarchyState = HierarchyState.expand;
|
|
54439
|
+
children.forEach((n) => {
|
|
54440
|
+
n.level = (node.level ?? 0) + 1;
|
|
54441
|
+
size += this.setTreeNode(n, size, node);
|
|
54442
|
+
});
|
|
54443
|
+
}
|
|
54444
|
+
else if (children?.length >= 1) {
|
|
54445
|
+
node.hierarchyState = HierarchyState.collapse;
|
|
54446
|
+
children.forEach((n) => {
|
|
54447
|
+
n.level = (node.level ?? 0) + 1;
|
|
54448
|
+
this.setTreeNode(n, size, node);
|
|
54449
|
+
});
|
|
54450
|
+
}
|
|
54451
|
+
else {
|
|
54452
|
+
node.hierarchyState = HierarchyState.none;
|
|
54453
|
+
size = 1;
|
|
54454
|
+
}
|
|
54455
|
+
node.size = size;
|
|
54456
|
+
return size;
|
|
54457
|
+
}
|
|
54458
|
+
getTreePath(index, maxDeep = 30) {
|
|
54459
|
+
const path = [];
|
|
54460
|
+
this.searchPath(index, this.tree, path, maxDeep);
|
|
54461
|
+
path.shift();
|
|
54462
|
+
return path;
|
|
54463
|
+
}
|
|
54464
|
+
getTreePathByCellIds(ids) {
|
|
54465
|
+
const path = [];
|
|
54466
|
+
let nodes = this.tree.children;
|
|
54467
|
+
for (let i = 0; i < ids.length; i++) {
|
|
54468
|
+
const id = ids[i];
|
|
54469
|
+
const pathNode = this.findNodeById(nodes, id);
|
|
54470
|
+
if (pathNode) {
|
|
54471
|
+
path.push(pathNode);
|
|
54472
|
+
nodes = pathNode.children;
|
|
54473
|
+
}
|
|
54474
|
+
else {
|
|
54475
|
+
break;
|
|
54476
|
+
}
|
|
54477
|
+
}
|
|
54478
|
+
return path;
|
|
54479
|
+
}
|
|
54480
|
+
findNodeById(nodes, id) {
|
|
54481
|
+
return nodes.find(node => {
|
|
54482
|
+
return node.id === id;
|
|
54483
|
+
});
|
|
54484
|
+
}
|
|
54485
|
+
searchPath(index, node, path, maxDeep) {
|
|
54486
|
+
if (!node) {
|
|
54487
|
+
return;
|
|
54488
|
+
}
|
|
54489
|
+
if (index < node.startIndex || index >= node.startIndex + node.size) {
|
|
54490
|
+
return;
|
|
54491
|
+
}
|
|
54492
|
+
path.push(node);
|
|
54493
|
+
if (!node.children || node.children.length === 0 || node.level >= maxDeep) {
|
|
54494
|
+
return;
|
|
54495
|
+
}
|
|
54496
|
+
const cIndex = index - node.startIndex;
|
|
54497
|
+
if (this.cache.has(node.level + 1)) {
|
|
54498
|
+
const cacheNode = this.cache.get(node.level + 1);
|
|
54499
|
+
if (cIndex >= cacheNode.startIndex && cIndex < cacheNode.startIndex + cacheNode.size) {
|
|
54500
|
+
this.searchPath(cIndex, cacheNode, path, maxDeep);
|
|
54501
|
+
return;
|
|
54502
|
+
}
|
|
54503
|
+
}
|
|
54504
|
+
let left = 0;
|
|
54505
|
+
let right = node.children.length - 1;
|
|
54506
|
+
while (left <= right) {
|
|
54507
|
+
const middle = Math.floor((left + right) / 2);
|
|
54508
|
+
const element = node.children[middle];
|
|
54509
|
+
if (cIndex >= element.startIndex && cIndex < element.startIndex + element.size) {
|
|
54510
|
+
this.cache.set(element.level, element);
|
|
54511
|
+
const deleteLevels = [];
|
|
54512
|
+
this.cache.forEach((node, key) => {
|
|
54513
|
+
if (key > element.level) {
|
|
54514
|
+
deleteLevels.push(key);
|
|
54515
|
+
}
|
|
54516
|
+
});
|
|
54517
|
+
deleteLevels.forEach(key => {
|
|
54518
|
+
this.cache.delete(key);
|
|
54519
|
+
});
|
|
54520
|
+
this.searchPath(cIndex, element, path, maxDeep);
|
|
54521
|
+
break;
|
|
54522
|
+
}
|
|
54523
|
+
else if (cIndex < element.startIndex) {
|
|
54524
|
+
right = middle - 1;
|
|
54525
|
+
}
|
|
54526
|
+
else {
|
|
54527
|
+
left = middle + 1;
|
|
54528
|
+
}
|
|
54529
|
+
}
|
|
54530
|
+
return;
|
|
54531
|
+
}
|
|
54532
|
+
movePosition(level, sourceIndex, targetIndex) {
|
|
54533
|
+
let parNode;
|
|
54534
|
+
let sourceSubIndex;
|
|
54535
|
+
let targetSubIndex;
|
|
54536
|
+
const findTargetNode = (node, subIndex) => {
|
|
54537
|
+
if (sourceSubIndex !== undefined && targetSubIndex !== undefined) {
|
|
54538
|
+
return;
|
|
54539
|
+
}
|
|
54540
|
+
if (node.level === level) {
|
|
54541
|
+
if (node.startInTotal === sourceIndex) {
|
|
54542
|
+
sourceSubIndex = subIndex;
|
|
54543
|
+
}
|
|
54544
|
+
if (node.startInTotal <= targetIndex && targetIndex <= node.startInTotal + node.size - 1) {
|
|
54545
|
+
targetSubIndex = subIndex;
|
|
54546
|
+
}
|
|
54547
|
+
}
|
|
54548
|
+
const children = node.children || node.columns;
|
|
54549
|
+
if (children && node.level < level) {
|
|
54550
|
+
parNode = node;
|
|
54551
|
+
for (let i = 0; i < children.length; i++) {
|
|
54552
|
+
if ((sourceIndex >= children[i].startInTotal && sourceIndex <= children[i].startInTotal + children[i].size) ||
|
|
54553
|
+
(targetIndex >= children[i].startInTotal && targetIndex <= children[i].startInTotal + children[i].size)) {
|
|
54554
|
+
findTargetNode(children[i], i);
|
|
54555
|
+
}
|
|
54556
|
+
}
|
|
54557
|
+
}
|
|
54558
|
+
};
|
|
54559
|
+
findTargetNode(this.tree, 0);
|
|
54560
|
+
const children = parNode.children || parNode.columns;
|
|
54561
|
+
const sourceColumns = children.splice(sourceSubIndex, 1);
|
|
54562
|
+
sourceColumns.unshift(targetSubIndex, 0);
|
|
54563
|
+
Array.prototype.splice.apply(children, sourceColumns);
|
|
54564
|
+
}
|
|
54565
|
+
getCopiedTree() {
|
|
54566
|
+
const children = cloneDeep(this.tree.children);
|
|
54567
|
+
clearNode(children);
|
|
54568
|
+
return children;
|
|
54569
|
+
}
|
|
54570
|
+
}
|
|
54571
|
+
function generateLayoutTree(tree, children) {
|
|
54572
|
+
children?.forEach((node) => {
|
|
54573
|
+
const diemnsonNode = {
|
|
54574
|
+
dimensionKey: node.dimensionKey,
|
|
54575
|
+
indicatorKey: node.indicatorKey,
|
|
54576
|
+
value: node.value,
|
|
54577
|
+
hierarchyState: node.hierarchyState,
|
|
54578
|
+
children: undefined
|
|
54579
|
+
};
|
|
54580
|
+
tree.push(diemnsonNode);
|
|
54581
|
+
if (node.children) {
|
|
54582
|
+
diemnsonNode.children = [];
|
|
54583
|
+
generateLayoutTree(diemnsonNode.children, node.children);
|
|
54584
|
+
}
|
|
54585
|
+
});
|
|
54586
|
+
}
|
|
54587
|
+
function countLayoutTree(children, countParentNode) {
|
|
54588
|
+
let count = 0;
|
|
54589
|
+
children?.forEach((node) => {
|
|
54590
|
+
if (countParentNode) {
|
|
54591
|
+
count++;
|
|
54592
|
+
}
|
|
54593
|
+
else {
|
|
54594
|
+
if (!node.children || node.children.length === 0) {
|
|
54595
|
+
count++;
|
|
54596
|
+
}
|
|
54597
|
+
}
|
|
54598
|
+
if (node.children) {
|
|
54599
|
+
count += countLayoutTree(node.children, countParentNode);
|
|
54600
|
+
}
|
|
54601
|
+
});
|
|
54602
|
+
return count;
|
|
54603
|
+
}
|
|
54604
|
+
function dealHeader(hd, _headerCellIds, results, roots, row, layoutMap) {
|
|
54605
|
+
const id = hd.id;
|
|
54606
|
+
const dimensionInfo = layoutMap.rowsDefine?.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey) ??
|
|
54607
|
+
layoutMap.columnsDefine?.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey);
|
|
54608
|
+
const indicatorInfo = layoutMap.indicatorsDefine?.find(indicator => {
|
|
54609
|
+
if (typeof indicator === 'string') {
|
|
54610
|
+
return false;
|
|
54611
|
+
}
|
|
54612
|
+
if (hd.indicatorKey) {
|
|
54613
|
+
return indicator.indicatorKey === hd.indicatorKey;
|
|
54614
|
+
}
|
|
54615
|
+
return indicator.title === hd.value;
|
|
54616
|
+
});
|
|
54617
|
+
const cell = {
|
|
54618
|
+
id,
|
|
54619
|
+
title: hd.value ?? indicatorInfo?.title,
|
|
54620
|
+
field: hd.dimensionKey,
|
|
54621
|
+
style: typeof (indicatorInfo ?? dimensionInfo)?.headerStyle === 'function'
|
|
54622
|
+
? (indicatorInfo ?? dimensionInfo)?.headerStyle
|
|
54623
|
+
: Object.assign({}, (indicatorInfo ?? dimensionInfo)?.headerStyle),
|
|
54624
|
+
headerType: indicatorInfo?.headerType ?? dimensionInfo?.headerType ?? 'text',
|
|
54625
|
+
headerIcon: indicatorInfo?.headerIcon ?? dimensionInfo?.headerIcon,
|
|
54626
|
+
define: Object.assign({}, hd, indicatorInfo ?? dimensionInfo),
|
|
54627
|
+
fieldFormat: indicatorInfo?.headerFormat ?? dimensionInfo?.headerFormat,
|
|
54628
|
+
dropDownMenu: indicatorInfo?.dropDownMenu ?? dimensionInfo?.dropDownMenu,
|
|
54629
|
+
pivotInfo: {
|
|
54630
|
+
value: hd.value,
|
|
54631
|
+
dimensionKey: hd.dimensionKey,
|
|
54632
|
+
isPivotCorner: false
|
|
54633
|
+
},
|
|
54634
|
+
width: dimensionInfo?.width,
|
|
54635
|
+
minWidth: dimensionInfo?.minWidth,
|
|
54636
|
+
maxWidth: dimensionInfo?.maxWidth,
|
|
54637
|
+
showSort: indicatorInfo?.showSort ?? dimensionInfo?.showSort,
|
|
54638
|
+
description: dimensionInfo?.description
|
|
54639
|
+
};
|
|
54640
|
+
if (indicatorInfo) {
|
|
54641
|
+
if (indicatorInfo.customRender) {
|
|
54642
|
+
hd.customRender = indicatorInfo.customRender;
|
|
54643
|
+
}
|
|
54644
|
+
if (!isValid$1(layoutMap._indicators?.find(indicator => indicator.indicatorKey === indicatorInfo.indicatorKey))) {
|
|
54645
|
+
layoutMap._indicators?.push({
|
|
54646
|
+
id: ++layoutMap.sharedVar.seqId,
|
|
54647
|
+
indicatorKey: indicatorInfo.indicatorKey,
|
|
54648
|
+
field: indicatorInfo.indicatorKey,
|
|
54649
|
+
fieldFormat: indicatorInfo?.format,
|
|
54650
|
+
cellType: indicatorInfo?.cellType ?? indicatorInfo?.columnType ?? 'text',
|
|
54651
|
+
chartModule: 'chartModule' in indicatorInfo ? indicatorInfo.chartModule : null,
|
|
54652
|
+
chartSpec: 'chartSpec' in indicatorInfo ? indicatorInfo.chartSpec : null,
|
|
54653
|
+
sparklineSpec: 'sparklineSpec' in indicatorInfo ? indicatorInfo.sparklineSpec : null,
|
|
54654
|
+
style: indicatorInfo?.style,
|
|
54655
|
+
icon: indicatorInfo?.icon,
|
|
54656
|
+
define: Object.assign({}, hd, indicatorInfo, {
|
|
54657
|
+
dragHeader: dimensionInfo?.dragHeader
|
|
54658
|
+
}),
|
|
54659
|
+
width: indicatorInfo?.width,
|
|
54660
|
+
minWidth: indicatorInfo?.minWidth,
|
|
54661
|
+
maxWidth: indicatorInfo?.maxWidth,
|
|
54662
|
+
disableColumnResize: indicatorInfo?.disableColumnResize
|
|
54663
|
+
});
|
|
54664
|
+
}
|
|
54665
|
+
}
|
|
54666
|
+
else if (hd.indicatorKey) {
|
|
54667
|
+
if (!isValid$1(layoutMap._indicators?.find(indicator => indicator.indicatorKey === hd.indicatorKey))) {
|
|
54668
|
+
layoutMap._indicators?.push({
|
|
54669
|
+
id: ++layoutMap.sharedVar.seqId,
|
|
54670
|
+
indicatorKey: hd.indicatorKey,
|
|
54671
|
+
field: hd.indicatorKey,
|
|
54672
|
+
cellType: 'text',
|
|
54673
|
+
define: Object.assign({}, hd)
|
|
54674
|
+
});
|
|
54675
|
+
}
|
|
54676
|
+
}
|
|
54677
|
+
results[id] = cell;
|
|
54678
|
+
layoutMap._headerObjects[id] = cell;
|
|
54679
|
+
_headerCellIds[row][layoutMap.colIndex] = id;
|
|
54680
|
+
for (let r = row - 1; r >= 0; r--) {
|
|
54681
|
+
_headerCellIds[r][layoutMap.colIndex] = roots[r];
|
|
54682
|
+
}
|
|
54683
|
+
if (hd.levelSpan > 1) {
|
|
54684
|
+
for (let i = 1; i < hd.levelSpan; i++) {
|
|
54685
|
+
if (!_headerCellIds[row + i]) {
|
|
54686
|
+
_headerCellIds[row + i] = [];
|
|
54687
|
+
}
|
|
54688
|
+
_headerCellIds[row + i][layoutMap.colIndex] = id;
|
|
54689
|
+
}
|
|
54690
|
+
}
|
|
54691
|
+
if (hd.children?.length >= 1) {
|
|
54692
|
+
layoutMap
|
|
54693
|
+
._addHeaders(_headerCellIds, row + (hd.levelSpan ?? 1), hd.children ?? [], [
|
|
54694
|
+
...roots,
|
|
54695
|
+
...Array(hd.levelSpan ?? 1).fill(id)
|
|
54696
|
+
])
|
|
54697
|
+
.forEach(c => results.push(c));
|
|
54698
|
+
}
|
|
54699
|
+
else {
|
|
54700
|
+
for (let r = row + 1; r < _headerCellIds.length; r++) {
|
|
54701
|
+
_headerCellIds[r][layoutMap.colIndex] = id;
|
|
54702
|
+
}
|
|
54703
|
+
layoutMap.colIndex++;
|
|
54704
|
+
}
|
|
54705
|
+
}
|
|
54706
|
+
function dealHeaderForTreeMode(hd, _headerCellIds, results, roots, row, totalLevel, show, dimensions, layoutMap) {
|
|
54707
|
+
const id = hd.id;
|
|
54708
|
+
const dimensionInfo = dimensions.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey);
|
|
54709
|
+
const cell = {
|
|
54710
|
+
id,
|
|
54711
|
+
title: hd.value,
|
|
54712
|
+
field: hd.dimensionKey,
|
|
54713
|
+
style: hd.level + 1 === totalLevel || typeof dimensionInfo?.headerStyle === 'function'
|
|
54714
|
+
? dimensionInfo?.headerStyle
|
|
54715
|
+
: Object.assign({}, dimensionInfo?.headerStyle, { textAlign: 'left' }),
|
|
54716
|
+
headerType: dimensionInfo?.headerType ?? 'text',
|
|
54717
|
+
headerIcon: dimensionInfo?.headerIcon,
|
|
54718
|
+
define: Object.assign(hd, {
|
|
54719
|
+
linkJump: dimensionInfo?.linkJump,
|
|
54720
|
+
linkDetect: dimensionInfo?.linkDetect,
|
|
54721
|
+
templateLink: dimensionInfo?.templateLink,
|
|
54722
|
+
keepAspectRatio: dimensionInfo?.keepAspectRatio ?? false,
|
|
54723
|
+
imageAutoSizing: dimensionInfo?.imageAutoSizing,
|
|
54724
|
+
headerCustomRender: dimensionInfo?.headerCustomRender,
|
|
54725
|
+
headerCustomLayout: dimensionInfo?.headerCustomLayout,
|
|
54726
|
+
dragHeader: dimensionInfo?.dragHeader,
|
|
54727
|
+
disableHeaderHover: !!dimensionInfo?.disableHeaderHover,
|
|
54728
|
+
disableHeaderSelect: !!dimensionInfo?.disableHeaderSelect
|
|
54729
|
+
}),
|
|
54730
|
+
fieldFormat: dimensionInfo?.headerFormat,
|
|
54731
|
+
dropDownMenu: dimensionInfo?.dropDownMenu,
|
|
54732
|
+
pivotInfo: {
|
|
54733
|
+
value: hd.value,
|
|
54734
|
+
dimensionKey: hd.dimensionKey,
|
|
54735
|
+
isPivotCorner: false
|
|
54736
|
+
},
|
|
54737
|
+
hierarchyLevel: hd.level,
|
|
54738
|
+
dimensionTotalLevel: totalLevel,
|
|
54739
|
+
hierarchyState: hd.level + 1 === totalLevel ? undefined : hd.hierarchyState,
|
|
54740
|
+
width: dimensionInfo?.width,
|
|
54741
|
+
minWidth: dimensionInfo?.minWidth,
|
|
54742
|
+
maxWidth: dimensionInfo?.maxWidth,
|
|
54743
|
+
parentCellId: roots[roots.length - 1]
|
|
54744
|
+
};
|
|
54745
|
+
results[id] = cell;
|
|
54746
|
+
layoutMap._headerObjects[id] = cell;
|
|
54747
|
+
_headerCellIds[row][layoutMap.colIndex] = id;
|
|
54748
|
+
for (let r = row - 1; r >= 0; r--) {
|
|
54749
|
+
_headerCellIds[r][layoutMap.colIndex] = roots[r];
|
|
54750
|
+
}
|
|
54751
|
+
if (hd.hierarchyState === HierarchyState.expand && hd.children?.length >= 1) {
|
|
54752
|
+
show && layoutMap.colIndex++;
|
|
54753
|
+
layoutMap
|
|
54754
|
+
._addHeadersForTreeMode(_headerCellIds, row, hd.children ?? [], [...roots, id], totalLevel, show && hd.hierarchyState === HierarchyState.expand, dimensions)
|
|
54755
|
+
.forEach(c => results.push(c));
|
|
54756
|
+
}
|
|
54757
|
+
else {
|
|
54758
|
+
show && layoutMap.colIndex++;
|
|
54759
|
+
for (let r = row + 1; r < _headerCellIds.length; r++) {
|
|
54760
|
+
_headerCellIds[r][layoutMap.colIndex] = id;
|
|
54761
|
+
}
|
|
54762
|
+
}
|
|
54763
|
+
}
|
|
54764
|
+
function clearNode(children) {
|
|
54765
|
+
for (let i = 0; i < children.length; i++) {
|
|
54766
|
+
const node = children[i];
|
|
54767
|
+
delete node.level;
|
|
54768
|
+
delete node.startIndex;
|
|
54769
|
+
delete node.id;
|
|
54770
|
+
delete node.levelSpan;
|
|
54771
|
+
delete node.size;
|
|
54772
|
+
delete node.startInTotal;
|
|
54773
|
+
const childrenNew = node.children || node.columns;
|
|
54774
|
+
if (childrenNew) {
|
|
54775
|
+
clearNode(childrenNew);
|
|
54776
|
+
}
|
|
54777
|
+
}
|
|
54778
|
+
}
|
|
54779
|
+
|
|
54055
54780
|
class SimpleHeaderLayoutMap {
|
|
54056
54781
|
seqId = 0;
|
|
54057
54782
|
_headerObjects;
|
|
54058
54783
|
_headerObjectMap;
|
|
54059
54784
|
_headerCellIds;
|
|
54060
54785
|
_columns;
|
|
54786
|
+
columnTree;
|
|
54061
54787
|
bodyRowSpanCount = 1;
|
|
54062
54788
|
hierarchyIndent;
|
|
54063
54789
|
_transpose = false;
|
|
@@ -54072,6 +54798,7 @@
|
|
|
54072
54798
|
this._columns = [];
|
|
54073
54799
|
this._headerCellIds = [];
|
|
54074
54800
|
this.hierarchyIndent = hierarchyIndent ?? 20;
|
|
54801
|
+
this.columnTree = new DimensionTree(columns, { seqId: 0 });
|
|
54075
54802
|
this._headerObjects = this._addHeaders(0, columns, []);
|
|
54076
54803
|
this._headerObjectMap = this._headerObjects.reduce((o, e) => {
|
|
54077
54804
|
o[e.id] = e;
|
|
@@ -54178,7 +54905,7 @@
|
|
|
54178
54905
|
}
|
|
54179
54906
|
else {
|
|
54180
54907
|
row = col;
|
|
54181
|
-
if (this.
|
|
54908
|
+
if (this.bottomFrozenRowCount > 0 && row >= this.rowCount - this.bottomFrozenRowCount) {
|
|
54182
54909
|
return true;
|
|
54183
54910
|
}
|
|
54184
54911
|
}
|
|
@@ -54715,6 +55442,11 @@
|
|
|
54715
55442
|
if (source.col < 0 || source.row < 0 || target.col < 0 || target.row < 0) {
|
|
54716
55443
|
return false;
|
|
54717
55444
|
}
|
|
55445
|
+
if (this._table.internalProps.frozenColDragHeaderMode === 'disabled') {
|
|
55446
|
+
if (this._table.isFrozenColumn(target.col) || this._table.isRightFrozenColumn(target.col)) {
|
|
55447
|
+
return false;
|
|
55448
|
+
}
|
|
55449
|
+
}
|
|
54718
55450
|
const sourceCellRange = this.getCellRange(source.col, source.row);
|
|
54719
55451
|
if (this.isColumnHeader(source.col, source.row)) {
|
|
54720
55452
|
const sourceTopId = this.getParentCellId(source.col, sourceCellRange.start.row);
|
|
@@ -54752,6 +55484,7 @@
|
|
|
54752
55484
|
const sourceColumns = this._columns.splice(sourceCellRange.start.col, moveSize);
|
|
54753
55485
|
sourceColumns.unshift(targetIndex, 0);
|
|
54754
55486
|
Array.prototype.splice.apply(this._columns, sourceColumns);
|
|
55487
|
+
this.columnTree.movePosition(sourceCellRange.start.row, sourceCellRange.start.col, targetIndex);
|
|
54755
55488
|
this._cellRangeMap = new Map();
|
|
54756
55489
|
return {
|
|
54757
55490
|
sourceIndex: sourceCellRange.start.col,
|
|
@@ -54781,6 +55514,7 @@
|
|
|
54781
55514
|
const sourceColumns = this._columns.splice(sourceCellRange.start.row, moveSize);
|
|
54782
55515
|
sourceColumns.unshift(targetIndex, 0);
|
|
54783
55516
|
Array.prototype.splice.apply(this._columns, sourceColumns);
|
|
55517
|
+
this.columnTree.movePosition(sourceCellRange.start.col, sourceCellRange.start.row, targetIndex);
|
|
54784
55518
|
this._cellRangeMap = new Map();
|
|
54785
55519
|
return {
|
|
54786
55520
|
sourceIndex: sourceCellRange.start.row,
|
|
@@ -55035,28 +55769,52 @@
|
|
|
55035
55769
|
return;
|
|
55036
55770
|
}
|
|
55037
55771
|
}
|
|
55038
|
-
editor.bindSuccessCallback?.(() => {
|
|
55039
|
-
this.completeEdit();
|
|
55040
|
-
});
|
|
55041
55772
|
this.editingEditor = editor;
|
|
55042
55773
|
this.editCell = { col, row };
|
|
55043
55774
|
const dataValue = this.table.getCellOriginValue(col, row);
|
|
55044
55775
|
const rect = this.table.getCellRangeRelativeRect(this.table.getCellRange(col, row));
|
|
55045
|
-
|
|
55776
|
+
const referencePosition = { rect: { left: rect.left, top: rect.top, width: rect.width, height: rect.height } };
|
|
55777
|
+
editor.beginEditing && (void 0);
|
|
55778
|
+
editor.beginEditing?.(this.table.getElement(), referencePosition, dataValue);
|
|
55779
|
+
if (editor.bindSuccessCallback) ;
|
|
55780
|
+
editor.bindSuccessCallback?.(() => {
|
|
55781
|
+
this.completeEdit();
|
|
55782
|
+
});
|
|
55783
|
+
editor.onStart?.({
|
|
55784
|
+
value: dataValue,
|
|
55785
|
+
endEdit: () => {
|
|
55786
|
+
this.completeEdit();
|
|
55787
|
+
},
|
|
55788
|
+
referencePosition,
|
|
55789
|
+
container: this.table.getElement()
|
|
55790
|
+
});
|
|
55046
55791
|
}
|
|
55047
55792
|
}
|
|
55048
55793
|
completeEdit(e) {
|
|
55794
|
+
if (!this.editingEditor) {
|
|
55795
|
+
return;
|
|
55796
|
+
}
|
|
55049
55797
|
const target = e?.target;
|
|
55050
|
-
if (this.editingEditor
|
|
55051
|
-
|
|
55052
|
-
|
|
55053
|
-
|
|
55054
|
-
|
|
55798
|
+
if (this.editingEditor.targetIsOnEditor) {
|
|
55799
|
+
if (target && this.editingEditor.targetIsOnEditor(target)) {
|
|
55800
|
+
return;
|
|
55801
|
+
}
|
|
55802
|
+
}
|
|
55803
|
+
else if (!this.editingEditor.isEditorElement || (target && this.editingEditor.isEditorElement?.(target))) {
|
|
55804
|
+
return;
|
|
55055
55805
|
}
|
|
55806
|
+
if (!this.editingEditor.getValue) ;
|
|
55807
|
+
const changedValue = this.editingEditor.getValue?.();
|
|
55808
|
+
this.table.changeCellValue(this.editCell.col, this.editCell.row, changedValue);
|
|
55809
|
+
this.editingEditor.exit && (void 0);
|
|
55810
|
+
this.editingEditor.exit?.();
|
|
55811
|
+
this.editingEditor.onEnd?.();
|
|
55812
|
+
this.editingEditor = null;
|
|
55056
55813
|
}
|
|
55057
55814
|
cancelEdit() {
|
|
55058
55815
|
if (this.editingEditor) {
|
|
55059
|
-
this.editingEditor.exit();
|
|
55816
|
+
this.editingEditor.exit?.();
|
|
55817
|
+
this.editingEditor.onEnd?.();
|
|
55060
55818
|
this.editingEditor = null;
|
|
55061
55819
|
}
|
|
55062
55820
|
}
|
|
@@ -55081,6 +55839,7 @@
|
|
|
55081
55839
|
}
|
|
55082
55840
|
super(container, options);
|
|
55083
55841
|
const internalProps = this.internalProps;
|
|
55842
|
+
internalProps.frozenColDragHeaderMode = options.frozenColDragHeaderMode;
|
|
55084
55843
|
this.pagination = options.pagination;
|
|
55085
55844
|
internalProps.sortState = options.sortState;
|
|
55086
55845
|
internalProps.columns = options.columns
|
|
@@ -55148,7 +55907,7 @@
|
|
|
55148
55907
|
this.eventManager.updateEventBinder();
|
|
55149
55908
|
}
|
|
55150
55909
|
get columns() {
|
|
55151
|
-
return this.internalProps.
|
|
55910
|
+
return this.internalProps.layoutMap.columnTree.getCopiedTree();
|
|
55152
55911
|
}
|
|
55153
55912
|
get header() {
|
|
55154
55913
|
return this.internalProps.columns;
|
|
@@ -55270,6 +56029,7 @@
|
|
|
55270
56029
|
updateOption(options, accelerateFirstScreen = false) {
|
|
55271
56030
|
const internalProps = this.internalProps;
|
|
55272
56031
|
super.updateOption(options);
|
|
56032
|
+
internalProps.frozenColDragHeaderMode = options.frozenColDragHeaderMode;
|
|
55273
56033
|
this.pagination = options.pagination;
|
|
55274
56034
|
this.showHeader = options.showHeader ?? true;
|
|
55275
56035
|
internalProps.columns = options.columns
|
|
@@ -56183,397 +56943,6 @@
|
|
|
56183
56943
|
}
|
|
56184
56944
|
}
|
|
56185
56945
|
|
|
56186
|
-
class DimensionTree {
|
|
56187
|
-
sharedVar;
|
|
56188
|
-
sizeIncludeParent = false;
|
|
56189
|
-
rowExpandLevel;
|
|
56190
|
-
hierarchyType;
|
|
56191
|
-
tree = {
|
|
56192
|
-
id: 0,
|
|
56193
|
-
dimensionKey: '',
|
|
56194
|
-
value: '',
|
|
56195
|
-
children: [],
|
|
56196
|
-
level: -1,
|
|
56197
|
-
levelSpan: 1,
|
|
56198
|
-
startIndex: 0,
|
|
56199
|
-
size: 0,
|
|
56200
|
-
startInTotal: 0,
|
|
56201
|
-
hierarchyState: undefined
|
|
56202
|
-
};
|
|
56203
|
-
totalLevel = 0;
|
|
56204
|
-
dimensionKeys = new NumberMap();
|
|
56205
|
-
cache = new Map();
|
|
56206
|
-
constructor(tree, sharedVar, hierarchyType = 'grid', rowExpandLevel = undefined) {
|
|
56207
|
-
this.sizeIncludeParent = rowExpandLevel !== null && rowExpandLevel !== undefined;
|
|
56208
|
-
this.rowExpandLevel = rowExpandLevel;
|
|
56209
|
-
this.hierarchyType = hierarchyType;
|
|
56210
|
-
this.sharedVar = sharedVar;
|
|
56211
|
-
this.reset(tree);
|
|
56212
|
-
}
|
|
56213
|
-
reset(tree, updateTreeNode = false) {
|
|
56214
|
-
this.cache.clear();
|
|
56215
|
-
this.dimensionKeys = new NumberMap();
|
|
56216
|
-
this.tree.children = tree;
|
|
56217
|
-
this.setTreeNode(this.tree, 0, this.tree);
|
|
56218
|
-
this.totalLevel = this.dimensionKeys.count();
|
|
56219
|
-
}
|
|
56220
|
-
setTreeNode(node, startIndex, parent) {
|
|
56221
|
-
node.startIndex = startIndex;
|
|
56222
|
-
node.startInTotal = (parent.startInTotal ?? 0) + node.startIndex;
|
|
56223
|
-
if (node.dimensionKey ?? node.indicatorKey) {
|
|
56224
|
-
!this.dimensionKeys.contain(node.indicatorKey ? IndicatorDimensionKeyPlaceholder : node.dimensionKey) &&
|
|
56225
|
-
this.dimensionKeys.put(node.level, node.indicatorKey ? IndicatorDimensionKeyPlaceholder : node.dimensionKey);
|
|
56226
|
-
if (!node.id) {
|
|
56227
|
-
node.id = ++this.sharedVar.seqId;
|
|
56228
|
-
}
|
|
56229
|
-
}
|
|
56230
|
-
let size = node.dimensionKey ? (this.sizeIncludeParent ? 1 : 0) : 0;
|
|
56231
|
-
if (this.hierarchyType === 'grid') {
|
|
56232
|
-
if (node.children?.length >= 1) {
|
|
56233
|
-
node.children.forEach(n => {
|
|
56234
|
-
n.level = (node.level ?? 0) + 1;
|
|
56235
|
-
size += this.setTreeNode(n, size, node);
|
|
56236
|
-
});
|
|
56237
|
-
}
|
|
56238
|
-
else {
|
|
56239
|
-
size = 1;
|
|
56240
|
-
}
|
|
56241
|
-
}
|
|
56242
|
-
else if (node.hierarchyState === HierarchyState.expand && node.children?.length >= 1) {
|
|
56243
|
-
node.children.forEach(n => {
|
|
56244
|
-
n.level = (node.level ?? 0) + 1;
|
|
56245
|
-
size += this.setTreeNode(n, size, node);
|
|
56246
|
-
});
|
|
56247
|
-
}
|
|
56248
|
-
else if (node.hierarchyState === HierarchyState.collapse && node.children?.length >= 1) {
|
|
56249
|
-
node.children.forEach(n => {
|
|
56250
|
-
n.level = (node.level ?? 0) + 1;
|
|
56251
|
-
this.setTreeNode(n, size, node);
|
|
56252
|
-
});
|
|
56253
|
-
}
|
|
56254
|
-
else if (!node.hierarchyState && node.level + 1 < this.rowExpandLevel && node.children?.length >= 1) {
|
|
56255
|
-
node.hierarchyState = HierarchyState.expand;
|
|
56256
|
-
node.children.forEach(n => {
|
|
56257
|
-
n.level = (node.level ?? 0) + 1;
|
|
56258
|
-
size += this.setTreeNode(n, size, node);
|
|
56259
|
-
});
|
|
56260
|
-
}
|
|
56261
|
-
else if (node.children?.length >= 1) {
|
|
56262
|
-
node.hierarchyState = HierarchyState.collapse;
|
|
56263
|
-
node.children.forEach(n => {
|
|
56264
|
-
n.level = (node.level ?? 0) + 1;
|
|
56265
|
-
this.setTreeNode(n, size, node);
|
|
56266
|
-
});
|
|
56267
|
-
}
|
|
56268
|
-
else {
|
|
56269
|
-
node.hierarchyState = HierarchyState.none;
|
|
56270
|
-
size = 1;
|
|
56271
|
-
}
|
|
56272
|
-
node.size = size;
|
|
56273
|
-
return size;
|
|
56274
|
-
}
|
|
56275
|
-
getTreePath(index, maxDeep = 30) {
|
|
56276
|
-
const path = [];
|
|
56277
|
-
this.searchPath(index, this.tree, path, maxDeep);
|
|
56278
|
-
path.shift();
|
|
56279
|
-
return path;
|
|
56280
|
-
}
|
|
56281
|
-
getTreePathByCellIds(ids) {
|
|
56282
|
-
const path = [];
|
|
56283
|
-
let nodes = this.tree.children;
|
|
56284
|
-
for (let i = 0; i < ids.length; i++) {
|
|
56285
|
-
const id = ids[i];
|
|
56286
|
-
const pathNode = this.findNodeById(nodes, id);
|
|
56287
|
-
if (pathNode) {
|
|
56288
|
-
path.push(pathNode);
|
|
56289
|
-
nodes = pathNode.children;
|
|
56290
|
-
}
|
|
56291
|
-
else {
|
|
56292
|
-
break;
|
|
56293
|
-
}
|
|
56294
|
-
}
|
|
56295
|
-
return path;
|
|
56296
|
-
}
|
|
56297
|
-
findNodeById(nodes, id) {
|
|
56298
|
-
return nodes.find(node => {
|
|
56299
|
-
return node.id === id;
|
|
56300
|
-
});
|
|
56301
|
-
}
|
|
56302
|
-
searchPath(index, node, path, maxDeep) {
|
|
56303
|
-
if (!node) {
|
|
56304
|
-
return;
|
|
56305
|
-
}
|
|
56306
|
-
if (index < node.startIndex || index >= node.startIndex + node.size) {
|
|
56307
|
-
return;
|
|
56308
|
-
}
|
|
56309
|
-
path.push(node);
|
|
56310
|
-
if (!node.children || node.children.length === 0 || node.level >= maxDeep) {
|
|
56311
|
-
return;
|
|
56312
|
-
}
|
|
56313
|
-
const cIndex = index - node.startIndex;
|
|
56314
|
-
if (this.cache.has(node.level + 1)) {
|
|
56315
|
-
const cacheNode = this.cache.get(node.level + 1);
|
|
56316
|
-
if (cIndex >= cacheNode.startIndex && cIndex < cacheNode.startIndex + cacheNode.size) {
|
|
56317
|
-
this.searchPath(cIndex, cacheNode, path, maxDeep);
|
|
56318
|
-
return;
|
|
56319
|
-
}
|
|
56320
|
-
}
|
|
56321
|
-
let left = 0;
|
|
56322
|
-
let right = node.children.length - 1;
|
|
56323
|
-
while (left <= right) {
|
|
56324
|
-
const middle = Math.floor((left + right) / 2);
|
|
56325
|
-
const element = node.children[middle];
|
|
56326
|
-
if (cIndex >= element.startIndex && cIndex < element.startIndex + element.size) {
|
|
56327
|
-
this.cache.set(element.level, element);
|
|
56328
|
-
const deleteLevels = [];
|
|
56329
|
-
this.cache.forEach((node, key) => {
|
|
56330
|
-
if (key > element.level) {
|
|
56331
|
-
deleteLevels.push(key);
|
|
56332
|
-
}
|
|
56333
|
-
});
|
|
56334
|
-
deleteLevels.forEach(key => {
|
|
56335
|
-
this.cache.delete(key);
|
|
56336
|
-
});
|
|
56337
|
-
this.searchPath(cIndex, element, path, maxDeep);
|
|
56338
|
-
break;
|
|
56339
|
-
}
|
|
56340
|
-
else if (cIndex < element.startIndex) {
|
|
56341
|
-
right = middle - 1;
|
|
56342
|
-
}
|
|
56343
|
-
else {
|
|
56344
|
-
left = middle + 1;
|
|
56345
|
-
}
|
|
56346
|
-
}
|
|
56347
|
-
return;
|
|
56348
|
-
}
|
|
56349
|
-
movePosition(level, sourceIndex, targetIndex) {
|
|
56350
|
-
let parNode;
|
|
56351
|
-
let sourceSubIndex;
|
|
56352
|
-
let targetSubIndex;
|
|
56353
|
-
const findTargetNode = (node, subIndex) => {
|
|
56354
|
-
if (sourceSubIndex !== undefined && targetSubIndex !== undefined) {
|
|
56355
|
-
return;
|
|
56356
|
-
}
|
|
56357
|
-
if (node.level === level) {
|
|
56358
|
-
if (node.startInTotal === sourceIndex) {
|
|
56359
|
-
sourceSubIndex = subIndex;
|
|
56360
|
-
}
|
|
56361
|
-
if (node.startInTotal <= targetIndex && targetIndex <= node.startInTotal + node.size - 1) {
|
|
56362
|
-
targetSubIndex = subIndex;
|
|
56363
|
-
}
|
|
56364
|
-
}
|
|
56365
|
-
if (node.children && node.level < level) {
|
|
56366
|
-
parNode = node;
|
|
56367
|
-
for (let i = 0; i < node.children.length; i++) {
|
|
56368
|
-
if ((sourceIndex >= node.children[i].startInTotal &&
|
|
56369
|
-
sourceIndex <= node.children[i].startInTotal + node.children[i].size) ||
|
|
56370
|
-
(targetIndex >= node.children[i].startInTotal &&
|
|
56371
|
-
targetIndex <= node.children[i].startInTotal + node.children[i].size)) {
|
|
56372
|
-
findTargetNode(node.children[i], i);
|
|
56373
|
-
}
|
|
56374
|
-
}
|
|
56375
|
-
}
|
|
56376
|
-
};
|
|
56377
|
-
findTargetNode(this.tree, 0);
|
|
56378
|
-
const sourceColumns = parNode.children.splice(sourceSubIndex, 1);
|
|
56379
|
-
sourceColumns.unshift(targetSubIndex, 0);
|
|
56380
|
-
Array.prototype.splice.apply(parNode.children, sourceColumns);
|
|
56381
|
-
}
|
|
56382
|
-
}
|
|
56383
|
-
function generateLayoutTree(tree, children) {
|
|
56384
|
-
children?.forEach((node) => {
|
|
56385
|
-
const diemnsonNode = {
|
|
56386
|
-
dimensionKey: node.dimensionKey,
|
|
56387
|
-
indicatorKey: node.indicatorKey,
|
|
56388
|
-
value: node.value,
|
|
56389
|
-
hierarchyState: node.hierarchyState,
|
|
56390
|
-
children: undefined
|
|
56391
|
-
};
|
|
56392
|
-
tree.push(diemnsonNode);
|
|
56393
|
-
if (node.children) {
|
|
56394
|
-
diemnsonNode.children = [];
|
|
56395
|
-
generateLayoutTree(diemnsonNode.children, node.children);
|
|
56396
|
-
}
|
|
56397
|
-
});
|
|
56398
|
-
}
|
|
56399
|
-
function countLayoutTree(children, countParentNode) {
|
|
56400
|
-
let count = 0;
|
|
56401
|
-
children?.forEach((node) => {
|
|
56402
|
-
if (countParentNode) {
|
|
56403
|
-
count++;
|
|
56404
|
-
}
|
|
56405
|
-
else {
|
|
56406
|
-
if (!node.children || node.children.length === 0) {
|
|
56407
|
-
count++;
|
|
56408
|
-
}
|
|
56409
|
-
}
|
|
56410
|
-
if (node.children) {
|
|
56411
|
-
count += countLayoutTree(node.children, countParentNode);
|
|
56412
|
-
}
|
|
56413
|
-
});
|
|
56414
|
-
return count;
|
|
56415
|
-
}
|
|
56416
|
-
function dealHeader(hd, _headerCellIds, results, roots, row, layoutMap) {
|
|
56417
|
-
const id = hd.id;
|
|
56418
|
-
const dimensionInfo = layoutMap.rowsDefine?.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey) ??
|
|
56419
|
-
layoutMap.columnsDefine?.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey);
|
|
56420
|
-
const indicatorInfo = layoutMap.indicatorsDefine?.find(indicator => {
|
|
56421
|
-
if (typeof indicator === 'string') {
|
|
56422
|
-
return false;
|
|
56423
|
-
}
|
|
56424
|
-
if (hd.indicatorKey) {
|
|
56425
|
-
return indicator.indicatorKey === hd.indicatorKey;
|
|
56426
|
-
}
|
|
56427
|
-
return indicator.title === hd.value;
|
|
56428
|
-
});
|
|
56429
|
-
const cell = {
|
|
56430
|
-
id,
|
|
56431
|
-
title: hd.value ?? indicatorInfo?.title,
|
|
56432
|
-
field: hd.dimensionKey,
|
|
56433
|
-
style: typeof (indicatorInfo ?? dimensionInfo)?.headerStyle === 'function'
|
|
56434
|
-
? (indicatorInfo ?? dimensionInfo)?.headerStyle
|
|
56435
|
-
: Object.assign({}, (indicatorInfo ?? dimensionInfo)?.headerStyle),
|
|
56436
|
-
headerType: indicatorInfo?.headerType ?? dimensionInfo?.headerType ?? 'text',
|
|
56437
|
-
headerIcon: indicatorInfo?.headerIcon ?? dimensionInfo?.headerIcon,
|
|
56438
|
-
define: Object.assign({}, hd, indicatorInfo ?? dimensionInfo),
|
|
56439
|
-
fieldFormat: indicatorInfo?.headerFormat ?? dimensionInfo?.headerFormat,
|
|
56440
|
-
dropDownMenu: indicatorInfo?.dropDownMenu ?? dimensionInfo?.dropDownMenu,
|
|
56441
|
-
pivotInfo: {
|
|
56442
|
-
value: hd.value,
|
|
56443
|
-
dimensionKey: hd.dimensionKey,
|
|
56444
|
-
isPivotCorner: false
|
|
56445
|
-
},
|
|
56446
|
-
width: dimensionInfo?.width,
|
|
56447
|
-
minWidth: dimensionInfo?.minWidth,
|
|
56448
|
-
maxWidth: dimensionInfo?.maxWidth,
|
|
56449
|
-
showSort: indicatorInfo?.showSort ?? dimensionInfo?.showSort,
|
|
56450
|
-
description: dimensionInfo?.description
|
|
56451
|
-
};
|
|
56452
|
-
if (indicatorInfo) {
|
|
56453
|
-
if (indicatorInfo.customRender) {
|
|
56454
|
-
hd.customRender = indicatorInfo.customRender;
|
|
56455
|
-
}
|
|
56456
|
-
if (!isValid$1(layoutMap._indicators?.find(indicator => indicator.indicatorKey === indicatorInfo.indicatorKey))) {
|
|
56457
|
-
layoutMap._indicators?.push({
|
|
56458
|
-
id: ++layoutMap.sharedVar.seqId,
|
|
56459
|
-
indicatorKey: indicatorInfo.indicatorKey,
|
|
56460
|
-
field: indicatorInfo.indicatorKey,
|
|
56461
|
-
fieldFormat: indicatorInfo?.format,
|
|
56462
|
-
cellType: indicatorInfo?.cellType ?? indicatorInfo?.columnType ?? 'text',
|
|
56463
|
-
chartModule: 'chartModule' in indicatorInfo ? indicatorInfo.chartModule : null,
|
|
56464
|
-
chartSpec: 'chartSpec' in indicatorInfo ? indicatorInfo.chartSpec : null,
|
|
56465
|
-
sparklineSpec: 'sparklineSpec' in indicatorInfo ? indicatorInfo.sparklineSpec : null,
|
|
56466
|
-
style: indicatorInfo?.style,
|
|
56467
|
-
icon: indicatorInfo?.icon,
|
|
56468
|
-
define: Object.assign({}, hd, indicatorInfo, {
|
|
56469
|
-
dragHeader: dimensionInfo?.dragHeader
|
|
56470
|
-
}),
|
|
56471
|
-
width: indicatorInfo?.width,
|
|
56472
|
-
minWidth: indicatorInfo?.minWidth,
|
|
56473
|
-
maxWidth: indicatorInfo?.maxWidth,
|
|
56474
|
-
disableColumnResize: indicatorInfo?.disableColumnResize
|
|
56475
|
-
});
|
|
56476
|
-
}
|
|
56477
|
-
}
|
|
56478
|
-
else if (hd.indicatorKey) {
|
|
56479
|
-
if (!isValid$1(layoutMap._indicators?.find(indicator => indicator.indicatorKey === hd.indicatorKey))) {
|
|
56480
|
-
layoutMap._indicators?.push({
|
|
56481
|
-
id: ++layoutMap.sharedVar.seqId,
|
|
56482
|
-
indicatorKey: hd.indicatorKey,
|
|
56483
|
-
field: hd.indicatorKey,
|
|
56484
|
-
cellType: 'text',
|
|
56485
|
-
define: Object.assign({}, hd)
|
|
56486
|
-
});
|
|
56487
|
-
}
|
|
56488
|
-
}
|
|
56489
|
-
results[id] = cell;
|
|
56490
|
-
layoutMap._headerObjects[id] = cell;
|
|
56491
|
-
_headerCellIds[row][layoutMap.colIndex] = id;
|
|
56492
|
-
for (let r = row - 1; r >= 0; r--) {
|
|
56493
|
-
_headerCellIds[r][layoutMap.colIndex] = roots[r];
|
|
56494
|
-
}
|
|
56495
|
-
if (hd.levelSpan > 1) {
|
|
56496
|
-
for (let i = 1; i < hd.levelSpan; i++) {
|
|
56497
|
-
if (!_headerCellIds[row + i]) {
|
|
56498
|
-
_headerCellIds[row + i] = [];
|
|
56499
|
-
}
|
|
56500
|
-
_headerCellIds[row + i][layoutMap.colIndex] = id;
|
|
56501
|
-
}
|
|
56502
|
-
}
|
|
56503
|
-
if (hd.children?.length >= 1) {
|
|
56504
|
-
layoutMap
|
|
56505
|
-
._addHeaders(_headerCellIds, row + (hd.levelSpan ?? 1), hd.children ?? [], [
|
|
56506
|
-
...roots,
|
|
56507
|
-
...Array(hd.levelSpan ?? 1).fill(id)
|
|
56508
|
-
])
|
|
56509
|
-
.forEach(c => results.push(c));
|
|
56510
|
-
}
|
|
56511
|
-
else {
|
|
56512
|
-
for (let r = row + 1; r < _headerCellIds.length; r++) {
|
|
56513
|
-
_headerCellIds[r][layoutMap.colIndex] = id;
|
|
56514
|
-
}
|
|
56515
|
-
layoutMap.colIndex++;
|
|
56516
|
-
}
|
|
56517
|
-
}
|
|
56518
|
-
function dealHeaderForTreeMode(hd, _headerCellIds, results, roots, row, totalLevel, show, dimensions, layoutMap) {
|
|
56519
|
-
const id = hd.id;
|
|
56520
|
-
const dimensionInfo = dimensions.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey);
|
|
56521
|
-
const cell = {
|
|
56522
|
-
id,
|
|
56523
|
-
title: hd.value,
|
|
56524
|
-
field: hd.dimensionKey,
|
|
56525
|
-
style: hd.level + 1 === totalLevel || typeof dimensionInfo?.headerStyle === 'function'
|
|
56526
|
-
? dimensionInfo?.headerStyle
|
|
56527
|
-
: Object.assign({}, dimensionInfo?.headerStyle, { textAlign: 'left' }),
|
|
56528
|
-
headerType: dimensionInfo?.headerType ?? 'text',
|
|
56529
|
-
headerIcon: dimensionInfo?.headerIcon,
|
|
56530
|
-
define: Object.assign(hd, {
|
|
56531
|
-
linkJump: dimensionInfo?.linkJump,
|
|
56532
|
-
linkDetect: dimensionInfo?.linkDetect,
|
|
56533
|
-
templateLink: dimensionInfo?.templateLink,
|
|
56534
|
-
keepAspectRatio: dimensionInfo?.keepAspectRatio ?? false,
|
|
56535
|
-
imageAutoSizing: dimensionInfo?.imageAutoSizing,
|
|
56536
|
-
headerCustomRender: dimensionInfo?.headerCustomRender,
|
|
56537
|
-
headerCustomLayout: dimensionInfo?.headerCustomLayout,
|
|
56538
|
-
dragHeader: dimensionInfo?.dragHeader,
|
|
56539
|
-
disableHeaderHover: !!dimensionInfo?.disableHeaderHover,
|
|
56540
|
-
disableHeaderSelect: !!dimensionInfo?.disableHeaderSelect
|
|
56541
|
-
}),
|
|
56542
|
-
fieldFormat: dimensionInfo?.headerFormat,
|
|
56543
|
-
dropDownMenu: dimensionInfo?.dropDownMenu,
|
|
56544
|
-
pivotInfo: {
|
|
56545
|
-
value: hd.value,
|
|
56546
|
-
dimensionKey: hd.dimensionKey,
|
|
56547
|
-
isPivotCorner: false
|
|
56548
|
-
},
|
|
56549
|
-
hierarchyLevel: hd.level,
|
|
56550
|
-
dimensionTotalLevel: totalLevel,
|
|
56551
|
-
hierarchyState: hd.level + 1 === totalLevel ? undefined : hd.hierarchyState,
|
|
56552
|
-
width: dimensionInfo?.width,
|
|
56553
|
-
minWidth: dimensionInfo?.minWidth,
|
|
56554
|
-
maxWidth: dimensionInfo?.maxWidth,
|
|
56555
|
-
parentCellId: roots[roots.length - 1]
|
|
56556
|
-
};
|
|
56557
|
-
results[id] = cell;
|
|
56558
|
-
layoutMap._headerObjects[id] = cell;
|
|
56559
|
-
_headerCellIds[row][layoutMap.colIndex] = id;
|
|
56560
|
-
for (let r = row - 1; r >= 0; r--) {
|
|
56561
|
-
_headerCellIds[r][layoutMap.colIndex] = roots[r];
|
|
56562
|
-
}
|
|
56563
|
-
if (hd.hierarchyState === HierarchyState.expand && hd.children?.length >= 1) {
|
|
56564
|
-
show && layoutMap.colIndex++;
|
|
56565
|
-
layoutMap
|
|
56566
|
-
._addHeadersForTreeMode(_headerCellIds, row, hd.children ?? [], [...roots, id], totalLevel, show && hd.hierarchyState === HierarchyState.expand, dimensions)
|
|
56567
|
-
.forEach(c => results.push(c));
|
|
56568
|
-
}
|
|
56569
|
-
else {
|
|
56570
|
-
show && layoutMap.colIndex++;
|
|
56571
|
-
for (let r = row + 1; r < _headerCellIds.length; r++) {
|
|
56572
|
-
_headerCellIds[r][layoutMap.colIndex] = id;
|
|
56573
|
-
}
|
|
56574
|
-
}
|
|
56575
|
-
}
|
|
56576
|
-
|
|
56577
56946
|
const defaultDimension = { startInTotal: 0, level: 0 };
|
|
56578
56947
|
class PivotHeaderLayoutMap {
|
|
56579
56948
|
sharedVar;
|
|
@@ -57563,6 +57932,44 @@
|
|
|
57563
57932
|
if (this.isRightFrozenColumn(col, row) || this.isBottomFrozenRow(col, row)) {
|
|
57564
57933
|
return result;
|
|
57565
57934
|
}
|
|
57935
|
+
if (this._table.isPivotChart()) {
|
|
57936
|
+
if (this.isLeftBottomCorner(col, row)) {
|
|
57937
|
+
return {
|
|
57938
|
+
start: {
|
|
57939
|
+
col: 0,
|
|
57940
|
+
row: this.rowCount - this.bottomFrozenRowCount
|
|
57941
|
+
},
|
|
57942
|
+
end: {
|
|
57943
|
+
col: this.frozenColCount - 1,
|
|
57944
|
+
row: this.rowCount - 1
|
|
57945
|
+
}
|
|
57946
|
+
};
|
|
57947
|
+
}
|
|
57948
|
+
else if (this.isRightTopCorner(col, row)) {
|
|
57949
|
+
return {
|
|
57950
|
+
start: {
|
|
57951
|
+
col: this.colCount - this.rightFrozenColCount,
|
|
57952
|
+
row: 0
|
|
57953
|
+
},
|
|
57954
|
+
end: {
|
|
57955
|
+
col: this.colCount - 1,
|
|
57956
|
+
row: this.frozenRowCount - 1
|
|
57957
|
+
}
|
|
57958
|
+
};
|
|
57959
|
+
}
|
|
57960
|
+
else if (this.isRightBottomCorner(col, row)) {
|
|
57961
|
+
return {
|
|
57962
|
+
start: {
|
|
57963
|
+
col: this.colCount - this.rightFrozenColCount,
|
|
57964
|
+
row: this.rowCount - this.bottomFrozenRowCount
|
|
57965
|
+
},
|
|
57966
|
+
end: {
|
|
57967
|
+
col: this.colCount - 1,
|
|
57968
|
+
row: this.rowCount - 1
|
|
57969
|
+
}
|
|
57970
|
+
};
|
|
57971
|
+
}
|
|
57972
|
+
}
|
|
57566
57973
|
for (let i = 0; i < this._largeCellRangeCache.length; i++) {
|
|
57567
57974
|
const range = this._largeCellRangeCache[i];
|
|
57568
57975
|
if (col >= range.start.col && col <= range.end.col && row >= range.start.row && row <= range.end.row) {
|
|
@@ -58047,7 +58454,7 @@
|
|
|
58047
58454
|
const sourceColumns = this._columnWidths.splice(sourceCellRange.start.col, moveSize);
|
|
58048
58455
|
sourceColumns.unshift(targetIndex, 0);
|
|
58049
58456
|
Array.prototype.splice.apply(this._columnWidths, sourceColumns);
|
|
58050
|
-
this.columnDimensionTree.movePosition(source.row, sourceCellRange.start.col - this.rowHeaderLevelCount, targetIndex - this.rowHeaderLevelCount);
|
|
58457
|
+
this.columnDimensionTree.movePosition(this.getCellHeaderPathsWidthTreeNode(source.col, source.row).colHeaderPaths.length - 1, sourceCellRange.start.col - this.rowHeaderLevelCount, targetIndex - this.rowHeaderLevelCount);
|
|
58051
58458
|
this.columnDimensionTree.reset(this.columnDimensionTree.tree.children, true);
|
|
58052
58459
|
this._CellHeaderPathMap = new Map();
|
|
58053
58460
|
this._largeCellRangeCache.length = 0;
|
|
@@ -62580,7 +62987,7 @@
|
|
|
62580
62987
|
}
|
|
62581
62988
|
|
|
62582
62989
|
registerForVrender();
|
|
62583
|
-
const version = "0.
|
|
62990
|
+
const version = "0.19.0";
|
|
62584
62991
|
function getIcons() {
|
|
62585
62992
|
return get$1();
|
|
62586
62993
|
}
|