@visactor/vtable 0.15.5-alpha.4 → 0.16.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 +5 -2
- package/cjs/ListTable.js +163 -17
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.d.ts +1 -1
- package/cjs/PivotChart.js +8 -8
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.d.ts +1 -1
- package/cjs/PivotTable.js +8 -8
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/components/axis/axis.d.ts +1 -1
- package/cjs/components/axis/axis.js +16 -7
- package/cjs/components/axis/axis.js.map +1 -1
- package/cjs/components/axis/get-axis-attributes.d.ts +1 -0
- package/cjs/components/axis/get-axis-attributes.js +29 -2
- package/cjs/components/axis/get-axis-attributes.js.map +1 -1
- package/cjs/components/menu/dom/logic/MenuElement.js +3 -3
- package/cjs/components/menu/dom/logic/MenuElement.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +1 -1
- package/cjs/core/BaseTable.js +6 -6
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/tableHelper.d.ts +2 -0
- package/cjs/core/tableHelper.js +18 -3
- package/cjs/core/tableHelper.js.map +1 -1
- package/cjs/data/DataSource.d.ts +8 -1
- package/cjs/data/DataSource.js +59 -2
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/event/event.d.ts +2 -0
- package/cjs/event/event.js +10 -2
- package/cjs/event/event.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/scenegraph/graphic/contributions/group-contribution-render.js +6 -2
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/index.js +9 -9
- package/cjs/scenegraph/graphic/contributions/index.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/column.d.ts +0 -4
- package/cjs/scenegraph/group-creater/column.js +1 -19
- package/cjs/scenegraph/group-creater/column.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.d.ts +2 -0
- package/cjs/scenegraph/group-creater/progress/proxy.js +15 -1
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +4 -0
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
- package/cjs/scenegraph/layout/auto-height.d.ts +1 -2
- package/cjs/scenegraph/layout/auto-height.js +1 -36
- package/cjs/scenegraph/layout/auto-height.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/update-col.d.ts +3 -0
- package/cjs/scenegraph/layout/update-col.js +203 -0
- package/cjs/scenegraph/layout/update-col.js.map +1 -0
- package/cjs/scenegraph/layout/update-height.js +1 -1
- package/cjs/scenegraph/layout/update-height.js.map +1 -1
- package/cjs/scenegraph/layout/update-row.js +94 -49
- package/cjs/scenegraph/layout/update-row.js.map +1 -1
- package/cjs/scenegraph/layout/update-width.js +1 -1
- package/cjs/scenegraph/layout/update-width.js.map +1 -1
- package/cjs/scenegraph/refresh-node/update-chart.js +1 -1
- package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +5 -0
- package/cjs/scenegraph/scenegraph.js +24 -3
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/utils/get-hierarchy-offset.js +1 -1
- package/cjs/scenegraph/utils/get-hierarchy-offset.js.map +1 -1
- package/cjs/state/resize/update-resize-column.js +1 -1
- package/cjs/state/resize/update-resize-column.js.map +1 -1
- package/cjs/state/state.d.ts +2 -0
- package/cjs/state/state.js +47 -2
- package/cjs/state/state.js.map +1 -1
- package/cjs/themes/DARK.js.map +1 -1
- package/cjs/tools/diff-cell.js +1 -1
- package/cjs/tools/diff-cell.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +1 -1
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +3 -0
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/dist/vtable.js +20208 -3499
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +5 -2
- package/es/ListTable.js +163 -18
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.d.ts +1 -1
- package/es/PivotChart.js +8 -8
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.d.ts +1 -1
- package/es/PivotTable.js +8 -8
- package/es/PivotTable.js.map +1 -1
- package/es/components/axis/axis.d.ts +1 -1
- package/es/components/axis/axis.js +16 -8
- package/es/components/axis/axis.js.map +1 -1
- package/es/components/axis/get-axis-attributes.d.ts +1 -0
- package/es/components/axis/get-axis-attributes.js +26 -0
- package/es/components/axis/get-axis-attributes.js.map +1 -1
- package/es/components/menu/dom/logic/MenuElement.js +3 -3
- package/es/components/menu/dom/logic/MenuElement.js.map +1 -1
- package/es/core/BaseTable.d.ts +1 -1
- package/es/core/BaseTable.js +5 -5
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/tableHelper.d.ts +2 -0
- package/es/core/tableHelper.js +16 -0
- package/es/core/tableHelper.js.map +1 -1
- package/es/data/DataSource.d.ts +8 -1
- package/es/data/DataSource.js +59 -2
- package/es/data/DataSource.js.map +1 -1
- package/es/event/event.d.ts +2 -0
- package/es/event/event.js +10 -2
- package/es/event/event.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/scenegraph/graphic/contributions/group-contribution-render.js +6 -2
- package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/es/scenegraph/graphic/contributions/index.js +9 -9
- package/es/scenegraph/graphic/contributions/index.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +1 -1
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/column.d.ts +0 -4
- package/es/scenegraph/group-creater/column.js +0 -16
- package/es/scenegraph/group-creater/column.js.map +1 -1
- package/es/scenegraph/group-creater/progress/proxy.d.ts +2 -0
- package/es/scenegraph/group-creater/progress/proxy.js +14 -0
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +4 -0
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
- package/es/scenegraph/layout/auto-height.d.ts +1 -2
- package/es/scenegraph/layout/auto-height.js +0 -33
- package/es/scenegraph/layout/auto-height.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.js +1 -1
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/update-col.d.ts +3 -0
- package/es/scenegraph/layout/update-col.js +200 -0
- package/es/scenegraph/layout/update-col.js.map +1 -0
- package/es/scenegraph/layout/update-height.js +1 -1
- package/es/scenegraph/layout/update-height.js.map +1 -1
- package/es/scenegraph/layout/update-row.js +94 -49
- package/es/scenegraph/layout/update-row.js.map +1 -1
- package/es/scenegraph/layout/update-width.js +1 -1
- package/es/scenegraph/layout/update-width.js.map +1 -1
- package/es/scenegraph/refresh-node/update-chart.js +1 -1
- package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +5 -0
- package/es/scenegraph/scenegraph.js +25 -2
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/utils/get-hierarchy-offset.js +1 -1
- package/es/scenegraph/utils/get-hierarchy-offset.js.map +1 -1
- package/es/state/resize/update-resize-column.js +1 -1
- package/es/state/resize/update-resize-column.js.map +1 -1
- package/es/state/state.d.ts +2 -0
- package/es/state/state.js +47 -2
- package/es/state/state.js.map +1 -1
- package/es/themes/DARK.js.map +1 -1
- package/es/tools/diff-cell.js +1 -1
- package/es/tools/diff-cell.js.map +1 -1
- package/es/ts-types/base-table.d.ts +1 -1
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +3 -0
- package/es/ts-types/table-engine.js.map +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.updateCol = void 0;
|
|
6
|
+
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), group_1 = require("../graphic/group"), cell_helper_1 = require("../group-creater/cell-helper"), get_cell_merge_1 = require("../utils/get-cell-merge");
|
|
8
|
+
|
|
9
|
+
function updateCol(removeCells, addCells, updateCells, table) {
|
|
10
|
+
const scene = table.scenegraph, removeCols = deduplication(removeCells.map((cell => cell.col))).sort(((a, b) => b - a)), addCols = deduplication(addCells.map((cell => cell.col))).sort(((a, b) => a - b)), updateCols = deduplication(updateCells.map((cell => cell.col))).sort(((a, b) => a - b));
|
|
11
|
+
let updateAfter;
|
|
12
|
+
if (removeCols.forEach((col => {
|
|
13
|
+
removeCol(col, scene);
|
|
14
|
+
})), removeCols.forEach((col => {
|
|
15
|
+
scene.table.colWidthsMap.adjustOrder(col + 1, col, scene.table.colWidthsMap.count() - col - 1),
|
|
16
|
+
scene.table.colWidthsMap.del(scene.table.colWidthsMap.count() - 1);
|
|
17
|
+
})), removeCols.length && resetColNumber(scene), scene.table._clearColRangeWidthsMap(),
|
|
18
|
+
addCols.forEach((col => {
|
|
19
|
+
const needUpdateAfter = addCol(col, scene);
|
|
20
|
+
resetColNumber(scene), updateAfter = null != updateAfter ? updateAfter : needUpdateAfter,
|
|
21
|
+
scene.table.colWidthsMap.adjustOrder(col, col + 1, scene.table.colWidthsMap.count() - col);
|
|
22
|
+
})), resetColNumberAndX(scene), updateCols.forEach((col => {
|
|
23
|
+
for (let row = 0; row < table.rowCount; row++) {
|
|
24
|
+
const mergeInfo = (0, get_cell_merge_1.getCellMergeInfo)(scene.table, col, row);
|
|
25
|
+
if (mergeInfo) for (let col = mergeInfo.start.col; col <= mergeInfo.end.col; col++) for (let col = mergeInfo.start.col; col <= mergeInfo.end.col; col++) (0,
|
|
26
|
+
cell_helper_1.updateCell)(col, row, scene.table, !1); else (0, cell_helper_1.updateCell)(col, row, scene.table, !1);
|
|
27
|
+
}
|
|
28
|
+
})), (0, vutils_1.isNumber)(updateAfter)) {
|
|
29
|
+
for (let col = updateAfter; col < table.colCount; col++) for (let row = 0; row < table.rowCount; row++) {
|
|
30
|
+
const cellGroup = scene.highPerformanceGetCell(col, row, !0);
|
|
31
|
+
cellGroup && (cellGroup.needUpdate = !0);
|
|
32
|
+
}
|
|
33
|
+
scene.proxy.colUpdatePos = updateAfter;
|
|
34
|
+
}
|
|
35
|
+
if (addCols.length) {
|
|
36
|
+
if (!(0, vutils_1.isNumber)(updateAfter)) {
|
|
37
|
+
const minCol = Math.min(...addCols);
|
|
38
|
+
scene.proxy.colUpdatePos = minCol;
|
|
39
|
+
}
|
|
40
|
+
scene.proxy.colUpdateDirection = "left", scene.proxy.updateColGroups(2 * scene.proxy.screenColCount),
|
|
41
|
+
updateRightFrozeCellGroups(), scene.proxy.progress();
|
|
42
|
+
} else removeCols.length && (scene.proxy.updateColGroups(2 * scene.proxy.screenColCount),
|
|
43
|
+
updateRightFrozeCellGroups(), scene.proxy.progress());
|
|
44
|
+
const newTotalWidth = table.getColsWidth(table.frozenColCount, table.colCount - 1);
|
|
45
|
+
function updateRightFrozeCellGroups() {
|
|
46
|
+
if ((null == addCols ? void 0 : addCols[(null == addCols ? void 0 : addCols.length) - 1]) >= table.colCount - table.rightFrozenColCount || (null == updateCols ? void 0 : updateCols[(null == updateCols ? void 0 : updateCols.length) - 1]) >= table.colCount - table.rightFrozenColCount || (null == removeCols ? void 0 : removeCols[0]) >= table.colCount - table.rightFrozenColCount) {
|
|
47
|
+
for (let col = table.colCount - table.rightFrozenColCount; col < table.colCount; col++) for (let row = 0; row < table.rowCount; row++) {
|
|
48
|
+
const cellGroup = scene.highPerformanceGetCell(col, row, !0);
|
|
49
|
+
cellGroup && (cellGroup.needUpdate = !0);
|
|
50
|
+
}
|
|
51
|
+
scene.proxy.updateRightFrozenCellGroups();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
scene.updateContainerWidth(scene.table.frozenColCount, newTotalWidth - scene.bodyGroup.attribute.width);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function removeCol(col, scene) {
|
|
58
|
+
const proxy = scene.proxy;
|
|
59
|
+
if (col >= scene.table.rowHeaderLevelCount) if (col >= scene.table.colCount - scene.table.rightFrozenColCount) ; else {
|
|
60
|
+
const colGroup = scene.getColGroup(col, !1);
|
|
61
|
+
colGroup && colGroup.parent === scene.bodyGroup && scene.bodyGroup.removeChild(colGroup);
|
|
62
|
+
const bottomColGroup = scene.getColGroupInBottom(col);
|
|
63
|
+
bottomColGroup && bottomColGroup.parent === scene.bottomFrozenGroup && scene.bottomFrozenGroup.removeChild(bottomColGroup);
|
|
64
|
+
}
|
|
65
|
+
col >= proxy.colStart && col <= proxy.colEnd && (proxy.colEnd--, proxy.currentCol--),
|
|
66
|
+
proxy.bodyRightCol--;
|
|
67
|
+
const totalActualBodyColCount = Math.min(proxy.colLimit, proxy.bodyRightCol - proxy.bodyLeftCol + 1);
|
|
68
|
+
proxy.totalActualBodyColCount = totalActualBodyColCount, proxy.totalCol = proxy.colStart + totalActualBodyColCount - 1;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function addCol(col, scene) {
|
|
72
|
+
const proxy = scene.proxy;
|
|
73
|
+
proxy.bodyRightCol++;
|
|
74
|
+
const totalActualBodyColCount = Math.min(proxy.colLimit, proxy.bodyRightCol - proxy.bodyLeftCol + 1);
|
|
75
|
+
if (proxy.totalActualBodyColCount = totalActualBodyColCount, proxy.totalCol = proxy.colStart + totalActualBodyColCount - 1,
|
|
76
|
+
!(col < proxy.colStart)) return col > proxy.colEnd ? proxy.colEnd - proxy.colStart + 1 < proxy.colLimit ? (proxy.colEnd++,
|
|
77
|
+
proxy.currentCol++, addColGroup(col, scene), col) : void 0 : proxy.colEnd - proxy.colStart + 1 < proxy.colLimit ? (proxy.colEnd++,
|
|
78
|
+
proxy.currentCol++, addColGroup(col, scene), col) : col;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function deduplication(array) {
|
|
82
|
+
const result = [];
|
|
83
|
+
for (let i = 0; i < array.length; i++) -1 === result.indexOf(array[i]) && result.push(array[i]);
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function resetColNumber(scene) {
|
|
88
|
+
let colIndex = scene.bodyColStart;
|
|
89
|
+
function processCell(cellGroup) {
|
|
90
|
+
cellGroup.col = colIndex;
|
|
91
|
+
const merge = (0, get_cell_merge_1.getCellMergeInfo)(scene.table, cellGroup.col, cellGroup.row);
|
|
92
|
+
merge && (cellGroup.mergeStartCol = merge.start.col, cellGroup.mergeStartCol = merge.start.col,
|
|
93
|
+
cellGroup.mergeEndCol = merge.end.col, cellGroup.mergeEndCol = merge.end.col), cellGroup.role;
|
|
94
|
+
}
|
|
95
|
+
scene.bodyGroup.forEachChildren((colGroup => {
|
|
96
|
+
colGroup.col = colIndex, null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
97
|
+
processCell(cellGroup);
|
|
98
|
+
})), colIndex++;
|
|
99
|
+
})), colIndex = scene.bodyColStart, scene.colHeaderGroup.forEachChildren((colGroup => {
|
|
100
|
+
colGroup.col = colIndex, null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
101
|
+
processCell(cellGroup);
|
|
102
|
+
})), colIndex++;
|
|
103
|
+
})), colIndex = scene.bodyColStart, scene.bottomFrozenGroup.forEachChildren((colGroup => {
|
|
104
|
+
colGroup.col = colIndex, null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
105
|
+
processCell(cellGroup);
|
|
106
|
+
})), colIndex++;
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function resetColNumberAndX(scene) {
|
|
111
|
+
let colIndex = scene.bodyColStart, x = scene.getCellGroupX(colIndex);
|
|
112
|
+
function processCell(cellGroup) {
|
|
113
|
+
cellGroup.col = colIndex;
|
|
114
|
+
const merge = (0, get_cell_merge_1.getCellMergeInfo)(scene.table, cellGroup.col, cellGroup.row);
|
|
115
|
+
merge && (cellGroup.mergeStartCol = merge.start.col, cellGroup.mergeStartCol = merge.start.col,
|
|
116
|
+
cellGroup.mergeEndCol = merge.end.col, cellGroup.mergeEndCol = merge.end.col), cellGroup.role;
|
|
117
|
+
}
|
|
118
|
+
scene.bodyGroup.forEachChildren((colGroup => {
|
|
119
|
+
colGroup.col = colIndex, null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
120
|
+
processCell(cellGroup);
|
|
121
|
+
})), colGroup.setAttribute("x", x), x += colGroup.attribute.width, colIndex++;
|
|
122
|
+
})), colIndex = scene.bodyColStart, x = scene.getCellGroupX(colIndex), scene.colHeaderGroup.forEachChildren((colGroup => {
|
|
123
|
+
colGroup.col = colIndex, null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
124
|
+
processCell(cellGroup);
|
|
125
|
+
})), colGroup.setAttribute("x", x), x += colGroup.attribute.width, colIndex++;
|
|
126
|
+
})), colIndex = scene.bodyColStart, x = scene.getCellGroupX(colIndex), scene.bottomFrozenGroup.forEachChildren((colGroup => {
|
|
127
|
+
colGroup.col = colIndex, null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
128
|
+
processCell(cellGroup);
|
|
129
|
+
})), colGroup.setAttribute("x", x), x += colGroup.attribute.width, colIndex++;
|
|
130
|
+
})), colIndex = scene.table.colCount - scene.table.rightFrozenColCount, x = 0, scene.rightFrozenGroup.forEachChildren((colGroup => {
|
|
131
|
+
colGroup.col = colIndex, null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
132
|
+
processCell(cellGroup);
|
|
133
|
+
})), colGroup.setAttribute("x", x), x += colGroup.attribute.width, colIndex++;
|
|
134
|
+
})), colIndex = scene.table.colCount - scene.table.rightFrozenColCount, x = 0, scene.rightTopCornerGroup.forEachChildren((colGroup => {
|
|
135
|
+
colGroup.col = colIndex, null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
136
|
+
processCell(cellGroup);
|
|
137
|
+
})), colGroup.setAttribute("x", x), x += colGroup.attribute.width, colIndex++;
|
|
138
|
+
})), colIndex = scene.table.colCount - scene.table.rightFrozenColCount, x = 0, scene.rightBottomCornerGroup.forEachChildren((colGroup => {
|
|
139
|
+
colGroup.col = colIndex, null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
140
|
+
processCell(cellGroup);
|
|
141
|
+
})), colGroup.setAttribute("x", x), x += colGroup.attribute.width, colIndex++;
|
|
142
|
+
}));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function addColGroup(col, scene) {
|
|
146
|
+
if (scene.colHeaderGroup && scene.table.columnHeaderLevelCount > 0) {
|
|
147
|
+
const columnGroup = new group_1.Group({
|
|
148
|
+
x: 0,
|
|
149
|
+
y: 0,
|
|
150
|
+
width: scene.table.getColWidth(col),
|
|
151
|
+
height: 0,
|
|
152
|
+
clip: !1,
|
|
153
|
+
pickable: !1
|
|
154
|
+
});
|
|
155
|
+
columnGroup.role = "column", columnGroup.col = col;
|
|
156
|
+
const colAfter = scene.getColGroup(col, !0);
|
|
157
|
+
colAfter ? scene.colHeaderGroup.insertBefore(columnGroup, colAfter) : scene.colHeaderGroup.appendChild(columnGroup),
|
|
158
|
+
generateCellGroup(columnGroup, col, 0, scene.table.columnHeaderLevelCount - 1);
|
|
159
|
+
}
|
|
160
|
+
if (scene.bodyGroup) {
|
|
161
|
+
const columnGroup = new group_1.Group({
|
|
162
|
+
x: 0,
|
|
163
|
+
y: 0,
|
|
164
|
+
width: scene.table.getColWidth(col),
|
|
165
|
+
height: 0,
|
|
166
|
+
clip: !1,
|
|
167
|
+
pickable: !1
|
|
168
|
+
});
|
|
169
|
+
columnGroup.role = "column", columnGroup.col = col;
|
|
170
|
+
const colAfter = scene.getColGroup(col, !1);
|
|
171
|
+
colAfter ? scene.bodyGroup.insertBefore(columnGroup, colAfter) : scene.bodyGroup.appendChild(columnGroup),
|
|
172
|
+
generateCellGroup(columnGroup, col, scene.bodyRowStart, scene.bodyRowEnd);
|
|
173
|
+
}
|
|
174
|
+
if (scene.bottomFrozenGroup && scene.table.bottomFrozenRowCount > 0) {
|
|
175
|
+
const columnGroup = new group_1.Group({
|
|
176
|
+
x: 0,
|
|
177
|
+
y: 0,
|
|
178
|
+
width: scene.table.getColWidth(col),
|
|
179
|
+
height: 0,
|
|
180
|
+
clip: !1,
|
|
181
|
+
pickable: !1
|
|
182
|
+
});
|
|
183
|
+
columnGroup.role = "column", columnGroup.col = col;
|
|
184
|
+
const colAfter = scene.getColGroupInBottom(col);
|
|
185
|
+
colAfter ? scene.bottomFrozenGroup.insertBefore(columnGroup, colAfter) : scene.bottomFrozenGroup.appendChild(columnGroup),
|
|
186
|
+
generateCellGroup(columnGroup, col, scene.table.rowCount - scene.table.bottomFrozenRowCount, scene.table.rowCount - 1);
|
|
187
|
+
}
|
|
188
|
+
function generateCellGroup(group, col, rowStart, rowEnd) {
|
|
189
|
+
for (let row = rowStart; row <= rowEnd; row++) {
|
|
190
|
+
const cellGroup = new group_1.Group({
|
|
191
|
+
x: 0,
|
|
192
|
+
y: 0,
|
|
193
|
+
width: scene.table.getColWidth(col),
|
|
194
|
+
height: scene.table.getRowHeight(row)
|
|
195
|
+
});
|
|
196
|
+
cellGroup.role = "cell", cellGroup.col = col, cellGroup.row = row, cellGroup.needUpdate = !0,
|
|
197
|
+
group.appendChild(cellGroup);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
exports.updateCol = updateCol;
|
|
203
|
+
//# sourceMappingURL=update-col.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources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AG,CAAC;gBACnC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC;aACtC,CAAC,CAAC;YACH,SAAS,CAAC,IAAI,GAAG,MAAM,CAAC;YACxB,SAAS,CAAC,GAAG,GAAG,GAAG,CAAC;YACpB,SAAS,CAAC,GAAG,GAAG,GAAG,CAAC;YACpB,SAAS,CAAC,UAAU,GAAG,IAAI,CAAC;YAC5B,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;SAC9B;IACH,CAAC;AACH,CAAC","file":"update-col.js","sourcesContent":["import { isNumber } from '@visactor/vutils';\nimport type { CellAddress } from '../../ts-types';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport { Group } from '../graphic/group';\nimport { updateCell } from '../group-creater/cell-helper';\nimport type { Scenegraph } from '../scenegraph';\nimport { getCellMergeInfo } from '../utils/get-cell-merge';\nimport type { IGroup } from '@visactor/vrender';\n\n/**\n * add and remove rows in scenegraph\n */\nexport function updateCol(\n removeCells: CellAddress[],\n addCells: CellAddress[],\n updateCells: CellAddress[],\n table: BaseTableAPI\n) {\n const scene = table.scenegraph;\n // deduplication\n const removeCols = deduplication(removeCells.map(cell => cell.col)).sort((a, b) => b - a);\n const addCols = deduplication(addCells.map(cell => cell.col)).sort((a, b) => a - b);\n const updateCols = deduplication(updateCells.map(cell => cell.col)).sort((a, b) => a - b);\n\n // remove cells\n removeCols.forEach(col => {\n removeCol(col, scene);\n });\n\n removeCols.forEach(col => {\n scene.table.colWidthsMap.adjustOrder(col + 1, col, scene.table.colWidthsMap.count() - col - 1);\n scene.table.colWidthsMap.del(scene.table.colWidthsMap.count() - 1);\n });\n\n if (removeCols.length) {\n resetColNumber(scene);\n }\n\n scene.table._clearColRangeWidthsMap();\n\n // add cells\n let updateAfter: number;\n addCols.forEach(col => {\n const needUpdateAfter = addCol(col, scene);\n resetColNumber(scene);\n updateAfter = updateAfter ?? needUpdateAfter;\n scene.table.colWidthsMap.adjustOrder(col, col + 1, scene.table.colWidthsMap.count() - col);\n });\n\n // reset attribute y and col number in CellGroup\n // const newTotalHeight = resetColNumberAndY(scene);\n resetColNumberAndX(scene);\n // add cells\n updateCols.forEach(col => {\n for (let row = 0; row < table.rowCount; row++) {\n // updateColAttr(col, scene);\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n if (mergeInfo) {\n for (let col = mergeInfo.start.col; col <= mergeInfo.end.col; col++) {\n for (let col = mergeInfo.start.col; col <= mergeInfo.end.col; col++) {\n updateCell(col, row, scene.table, false);\n }\n }\n } else {\n updateCell(col, row, scene.table, false);\n }\n }\n });\n\n if (isNumber(updateAfter)) {\n for (let col = updateAfter; col < table.colCount; col++) {\n for (let row = 0; row < table.rowCount; row++) {\n const cellGroup = scene.highPerformanceGetCell(col, row, true);\n cellGroup && (cellGroup.needUpdate = true);\n }\n }\n scene.proxy.colUpdatePos = updateAfter;\n }\n if (addCols.length) {\n if (!isNumber(updateAfter)) {\n const minCol = Math.min(...addCols);\n scene.proxy.colUpdatePos = minCol;\n }\n scene.proxy.colUpdateDirection = 'left';\n scene.proxy.updateColGroups(scene.proxy.screenColCount * 2);\n updateRightFrozeCellGroups();\n scene.proxy.progress();\n } else if (removeCols.length) {\n scene.proxy.updateColGroups(scene.proxy.screenColCount * 2);\n updateRightFrozeCellGroups();\n scene.proxy.progress();\n }\n\n // update table size\n const newTotalWidth = table.getColsWidth(table.frozenColCount, table.colCount - 1);\n scene.updateContainerWidth(scene.table.frozenColCount, newTotalWidth - scene.bodyGroup.attribute.width);\n\n function updateRightFrozeCellGroups() {\n if (\n addCols?.[addCols?.length - 1] >= table.colCount - table.rightFrozenColCount ||\n updateCols?.[updateCols?.length - 1] >= table.colCount - table.rightFrozenColCount ||\n removeCols?.[0] >= table.colCount - table.rightFrozenColCount\n ) {\n for (let col = table.colCount - table.rightFrozenColCount; col < table.colCount; col++) {\n for (let row = 0; row < table.rowCount; row++) {\n const cellGroup = scene.highPerformanceGetCell(col, row, true);\n cellGroup && (cellGroup.needUpdate = true);\n }\n }\n scene.proxy.updateRightFrozenCellGroups();\n }\n }\n}\n\nfunction removeCol(col: number, scene: Scenegraph) {\n const proxy = scene.proxy;\n // removeCellGroup(col, scene);\n //先考虑非表头部分删除情况\n if (col >= scene.table.rowHeaderLevelCount) {\n if (col >= scene.table.colCount - scene.table.rightFrozenColCount) {\n // 如果是删除的右侧固定列 这里不做真正的删除,只需要后面将相应列做更新\n // scene.bodyGroup.removeChild(scene.bodyGroup.lastChild as any);\n // scene.bottomFrozenGroup.removeChild(scene.bottomFrozenGroup.lastChild as any);\n } else {\n const colGroup = scene.getColGroup(col, false);\n if (colGroup && colGroup.parent === scene.bodyGroup) {\n scene.bodyGroup.removeChild(colGroup);\n }\n const bottomColGroup = scene.getColGroupInBottom(col);\n if (bottomColGroup && bottomColGroup.parent === scene.bottomFrozenGroup) {\n scene.bottomFrozenGroup.removeChild(bottomColGroup);\n }\n }\n }\n\n // TODO 需要整体更新proxy的状态\n if (col >= proxy.colStart && col <= proxy.colEnd) {\n proxy.colEnd--;\n proxy.currentCol--;\n }\n proxy.bodyRightCol--;\n // proxy.totalCol--;\n const totalActualBodyColCount = Math.min(proxy.colLimit, proxy.bodyRightCol - proxy.bodyLeftCol + 1); // 渐进加载总col数量\n proxy.totalActualBodyColCount = totalActualBodyColCount;\n proxy.totalCol = proxy.colStart + totalActualBodyColCount - 1; // 目标渐进完成的col\n}\n\nfunction addCol(col: number, scene: Scenegraph) {\n const proxy = scene.proxy;\n proxy.bodyRightCol++;\n // proxy.totalCol++;\n const totalActualBodyColCount = Math.min(proxy.colLimit, proxy.bodyRightCol - proxy.bodyLeftCol + 1); // 渐进加载总col数量\n proxy.totalActualBodyColCount = totalActualBodyColCount;\n proxy.totalCol = proxy.colStart + totalActualBodyColCount - 1; // 目标渐进完成的col\n\n if (col < proxy.colStart) {\n return undefined;\n } else if (col > proxy.colEnd) {\n if (proxy.colEnd - proxy.colStart + 1 < proxy.colLimit) {\n // can add col\n proxy.colEnd++;\n proxy.currentCol++;\n\n addColGroup(col, scene);\n return col;\n }\n return undefined;\n }\n if (proxy.colEnd - proxy.colStart + 1 < proxy.colLimit) {\n // can add col\n proxy.colEnd++;\n proxy.currentCol++;\n\n addColGroup(col, scene);\n return col;\n }\n return col;\n}\n\n// array deduplication\nfunction deduplication(array: number[]) {\n const result = [];\n for (let i = 0; i < array.length; i++) {\n if (result.indexOf(array[i]) === -1) {\n result.push(array[i]);\n }\n }\n return result;\n}\n\nfunction resetColNumber(scene: Scenegraph) {\n let colIndex = scene.bodyColStart;\n scene.bodyGroup.forEachChildren((colGroup: Group) => {\n colGroup.col = colIndex;\n colGroup?.forEachChildren((cellGroup: Group) => {\n processCell(cellGroup);\n });\n colIndex++;\n });\n\n colIndex = scene.bodyColStart;\n scene.colHeaderGroup.forEachChildren((colGroup: Group) => {\n colGroup.col = colIndex;\n colGroup?.forEachChildren((cellGroup: Group) => {\n processCell(cellGroup);\n });\n colIndex++;\n });\n\n colIndex = scene.bodyColStart;\n scene.bottomFrozenGroup.forEachChildren((colGroup: Group) => {\n colGroup.col = colIndex;\n colGroup?.forEachChildren((cellGroup: Group) => {\n processCell(cellGroup);\n });\n colIndex++;\n });\n function processCell(cellGroup: Group) {\n cellGroup.col = colIndex;\n const merge = getCellMergeInfo(scene.table, cellGroup.col, cellGroup.row);\n if (merge) {\n cellGroup.mergeStartCol = merge.start.col;\n cellGroup.mergeStartCol = merge.start.col;\n cellGroup.mergeEndCol = merge.end.col;\n cellGroup.mergeEndCol = merge.end.col;\n }\n\n if (cellGroup.role !== 'cell') {\n return;\n }\n }\n}\n\nfunction resetColNumberAndX(scene: Scenegraph) {\n let colIndex = scene.bodyColStart;\n let x = scene.getCellGroupX(colIndex);\n scene.bodyGroup.forEachChildren((colGroup: Group) => {\n colGroup.col = colIndex;\n colGroup?.forEachChildren((cellGroup: Group) => {\n processCell(cellGroup);\n });\n colGroup.setAttribute('x', x);\n x += colGroup.attribute.width;\n colIndex++;\n });\n\n colIndex = scene.bodyColStart;\n x = scene.getCellGroupX(colIndex);\n scene.colHeaderGroup.forEachChildren((colGroup: Group) => {\n colGroup.col = colIndex;\n colGroup?.forEachChildren((cellGroup: Group) => {\n processCell(cellGroup);\n });\n colGroup.setAttribute('x', x);\n x += colGroup.attribute.width;\n colIndex++;\n });\n\n colIndex = scene.bodyColStart;\n x = scene.getCellGroupX(colIndex);\n scene.bottomFrozenGroup.forEachChildren((colGroup: Group) => {\n colGroup.col = colIndex;\n colGroup?.forEachChildren((cellGroup: Group) => {\n processCell(cellGroup);\n });\n colGroup.setAttribute('x', x);\n x += colGroup.attribute.width;\n colIndex++;\n });\n colIndex = scene.table.colCount - scene.table.rightFrozenColCount;\n x = 0;\n scene.rightFrozenGroup.forEachChildren((colGroup: Group) => {\n colGroup.col = colIndex;\n colGroup?.forEachChildren((cellGroup: Group) => {\n processCell(cellGroup);\n });\n colGroup.setAttribute('x', x);\n x += colGroup.attribute.width;\n colIndex++;\n });\n\n colIndex = scene.table.colCount - scene.table.rightFrozenColCount;\n x = 0;\n scene.rightTopCornerGroup.forEachChildren((colGroup: Group) => {\n colGroup.col = colIndex;\n colGroup?.forEachChildren((cellGroup: Group) => {\n processCell(cellGroup);\n });\n colGroup.setAttribute('x', x);\n x += colGroup.attribute.width;\n colIndex++;\n });\n\n colIndex = scene.table.colCount - scene.table.rightFrozenColCount;\n x = 0;\n scene.rightBottomCornerGroup.forEachChildren((colGroup: Group) => {\n colGroup.col = colIndex;\n colGroup?.forEachChildren((cellGroup: Group) => {\n processCell(cellGroup);\n });\n colGroup.setAttribute('x', x);\n x += colGroup.attribute.width;\n colIndex++;\n });\n function processCell(cellGroup: Group) {\n cellGroup.col = colIndex;\n const merge = getCellMergeInfo(scene.table, cellGroup.col, cellGroup.row);\n if (merge) {\n cellGroup.mergeStartCol = merge.start.col;\n cellGroup.mergeStartCol = merge.start.col;\n cellGroup.mergeEndCol = merge.end.col;\n cellGroup.mergeEndCol = merge.end.col;\n }\n\n if (cellGroup.role !== 'cell') {\n return;\n }\n }\n}\n\nfunction addColGroup(col: number, scene: Scenegraph) {\n if (scene.colHeaderGroup && scene.table.columnHeaderLevelCount > 0) {\n const columnGroup = new Group({\n x: 0,\n y: 0,\n width: scene.table.getColWidth(col),\n height: 0,\n clip: false,\n pickable: false\n });\n columnGroup.role = 'column';\n columnGroup.col = col;\n\n const colAfter = scene.getColGroup(col, true);\n if (colAfter) {\n scene.colHeaderGroup.insertBefore(columnGroup, colAfter);\n } else {\n scene.colHeaderGroup.appendChild(columnGroup);\n }\n generateCellGroup(columnGroup, col, 0, scene.table.columnHeaderLevelCount - 1);\n }\n\n if (scene.bodyGroup) {\n const columnGroup = new Group({\n x: 0,\n y: 0,\n width: scene.table.getColWidth(col),\n height: 0,\n clip: false,\n pickable: false\n });\n columnGroup.role = 'column';\n columnGroup.col = col;\n\n const colAfter = scene.getColGroup(col, false);\n if (colAfter) {\n scene.bodyGroup.insertBefore(columnGroup, colAfter);\n } else {\n scene.bodyGroup.appendChild(columnGroup);\n }\n generateCellGroup(columnGroup, col, scene.bodyRowStart, scene.bodyRowEnd);\n }\n if (scene.bottomFrozenGroup && scene.table.bottomFrozenRowCount > 0) {\n const columnGroup = new Group({\n x: 0,\n y: 0,\n width: scene.table.getColWidth(col),\n height: 0,\n clip: false,\n pickable: false\n });\n columnGroup.role = 'column';\n columnGroup.col = col;\n\n const colAfter = scene.getColGroupInBottom(col);\n if (colAfter) {\n scene.bottomFrozenGroup.insertBefore(columnGroup, colAfter);\n } else {\n scene.bottomFrozenGroup.appendChild(columnGroup);\n }\n\n generateCellGroup(\n columnGroup,\n col,\n scene.table.rowCount - scene.table.bottomFrozenRowCount,\n scene.table.rowCount - 1\n );\n }\n\n function generateCellGroup(group: IGroup, col: number, rowStart: number, rowEnd: number) {\n for (let row = rowStart; row <= rowEnd; row++) {\n // create cellGroup\n // const cellGroup = updateCell(col, row, scene.table, true);\n const cellGroup = new Group({\n x: 0,\n y: 0,\n width: scene.table.getColWidth(col),\n height: scene.table.getRowHeight(row)\n });\n cellGroup.role = 'cell';\n cellGroup.col = col;\n cellGroup.row = row;\n cellGroup.needUpdate = true;\n group.appendChild(cellGroup);\n }\n }\n}\n"]}
|
|
@@ -16,7 +16,7 @@ function updateRowHeight(scene, row, detaY) {
|
|
|
16
16
|
}
|
|
17
17
|
let rowStart = 0, rowEnd = 0;
|
|
18
18
|
row < scene.table.columnHeaderLevelCount ? (rowStart = row + 1, rowEnd = scene.table.columnHeaderLevelCount - 1) : (rowStart = row + 1,
|
|
19
|
-
rowEnd = scene.bodyRowEnd
|
|
19
|
+
rowEnd = scene.bodyRowEnd);
|
|
20
20
|
for (let rowIndex = rowStart; rowIndex <= rowEnd; rowIndex++) for (let colIndex = 0; colIndex < scene.table.colCount; colIndex++) {
|
|
21
21
|
const cellGroup = scene.getCell(colIndex, rowIndex);
|
|
22
22
|
"cell" === cellGroup.role && cellGroup.setAttribute("y", cellGroup.attribute.y + detaY);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scenegraph/layout/update-height.ts"],"names":[],"mappings":";;;AAEA,oFAAqF;AACrF,gFAAsF;AAEtF,4DAA2D;AAC3D,gDAA4C;AAC5C,8CAAgD;AAChD,gEAAoE;AAEpE,gDAAqD;AACrD,sEAA0F;AAC1F,wDAAuD;AACvD,sEAAgE;AAEhE,kEAAiE;AAGjE,SAAgB,eAAe,CAAC,KAAiB,EAAE,GAAW,EAAE,KAAa;IAE3E,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC,CAAC;IAE5E,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE;QACnD,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC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AE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;gBAC7G,MAAM,WAAW,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;gBAC5C,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;gBAG1C,eAAe,CAAC,aAAa,GAAG,UAAU,CAAC;gBAE3C,IAAA,+BAAe,EACb,eAAe,EACf,UAAU,EACV,WAAW,EACX;oBACE,KAAK,EAAE;wBACL,GAAG,EAAE,SAAS,CAAC,aAAa;wBAC5B,GAAG,EAAE,SAAS,CAAC,aAAa;qBAC7B;oBACD,GAAG,EAAE;wBACH,GAAG,EAAE,SAAS,CAAC,WAAW;wBAC1B,GAAG,EAAE,SAAS,CAAC,WAAW;qBAC3B;iBACF,EACD,KAAK,CACN,CAAC;aACH;SACF;KACF;SAAM;QACL,IAAA,0CAAuB,EAAC,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;KACxG;AACH,CAAC","file":"update-height.js","sourcesContent":["import type { ProgressBarStyle } from '../../body-helper/style/ProgressBarStyle';\nimport type { Group } from '../graphic/group';\nimport { createProgressBarCell } from '../group-creater/cell-type/progress-bar-cell';\nimport { createSparkLineCellGroup } from '../group-creater/cell-type/spark-line-cell';\nimport type { Scenegraph } from '../scenegraph';\nimport { getCellMergeInfo } from '../utils/get-cell-merge';\nimport { getProp } from '../utils/get-prop';\nimport { getQuadProps } from '../utils/padding';\nimport { updateCellContentHeight } from '../utils/text-icon-layout';\nimport type { IProgressbarColumnBodyDefine } from '../../ts-types/list-table/define/progressbar-define';\nimport { dealWithCustom } from '../component/custom';\nimport { updateImageCellContentWhileResize } from '../group-creater/cell-type/image-cell';\nimport { getStyleTheme } from '../../core/tableHelper';\nimport { isMergeCellGroup } from '../utils/is-merge-cell-group';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport { resizeCellGroup } from '../group-creater/column-helper';\nimport type { IGraphic } from '@visactor/vrender';\n\nexport function updateRowHeight(scene: Scenegraph, row: number, detaY: number) {\n // 更新table行高存储\n scene.table._setRowHeight(row, scene.table.getRowHeight(row) + detaY, true);\n\n for (let col = 0; col < scene.table.colCount; col++) {\n const cell = scene.getCell(col, row);\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n if (mergeInfo && mergeInfo.start.col !== col) {\n continue;\n }\n const height = cell.attribute.height;\n // cell.setAttribute('height', height);\n // (cell.firstChild as Rect).setAttribute('height', cell.attribute.height);\n updateCellHeightForRow(scene, cell, col, row, height + detaY, detaY, scene.table.isHeader(col, row));\n\n scene.updateCellContentWhileResize(col, row);\n }\n\n let rowStart = 0;\n let rowEnd = 0;\n // 更新header 高度\n if (row < scene.table.columnHeaderLevelCount) {\n // scene.colHeaderGroup.setAttribute('height', scene.colHeaderGroup.attribute.height + detaY);\n // scene.rowHeaderGroup.setAttribute('y', scene.rowHeaderGroup.attribute.y + detaY);\n // scene.bodyGroup.setAttribute('y', scene.bodyGroup.attribute.y + detaY);\n\n rowStart = row + 1;\n rowEnd = scene.table.columnHeaderLevelCount - 1;\n } else {\n rowStart = row + 1;\n // rowEnd = scene.table.rowCount - 1;\n rowEnd = scene.bodyRowEnd - scene.table.bottomFrozenRowCount;\n }\n\n // 更新以下行位置\n for (let rowIndex = rowStart; rowIndex <= rowEnd; rowIndex++) {\n for (let colIndex = 0; colIndex < scene.table.colCount; colIndex++) {\n const cellGroup = scene.getCell(colIndex, rowIndex);\n if (cellGroup.role === 'cell') {\n cellGroup.setAttribute('y', cellGroup.attribute.y + detaY);\n }\n }\n }\n}\n\n/**\n * @description: 更新单个单元格高度\n * @return {*}\n */\nexport function updateCellHeightForRow(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n height: number,\n detaY: number,\n isHeader: boolean\n // autoRowHeight: boolean\n) {\n cell.setAttribute('height', height);\n const cellGroup = cell;\n const distHeight = height;\n\n if (!cellGroup) {\n // 合并单元格非主单元格,不处理\n return;\n }\n\n updateCellHeight(scene, cellGroup, col, row, distHeight, detaY, isHeader);\n}\n\nexport function updateCellHeightForColumn(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n height: number,\n detaY: number,\n isHeader: boolean\n) {\n cell.setAttribute('height', height);\n const cellGroup = cell;\n updateCellHeight(scene, cellGroup, col, row, height, 0, isHeader);\n}\n\nexport function updateCellHeight(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n distHeight: number,\n detaY: number,\n isHeader: boolean\n) {\n // 更新单元格布局\n const type = scene.table.isHeader(col, row)\n ? scene.table._getHeaderLayoutMap(col, row).headerType\n : scene.table.getBodyColumnType(col, row);\n if (type === 'progressbar') {\n // 目前先采用重新生成节点的方案\n const columnDefine = scene.table.getBodyColumnDefine(col, row) as IProgressbarColumnBodyDefine;\n const style = scene.table._getCellStyle(col, row) as ProgressBarStyle;\n const value = scene.table.getCellValue(col, row);\n const dataValue = scene.table.getCellOriginValue(col, row);\n const padding = getQuadProps(getProp('padding', style, col, row, scene.table));\n\n const newBarCell = createProgressBarCell(\n columnDefine,\n style,\n cell.attribute.width,\n // cell.attribute.height,\n value,\n dataValue,\n col,\n row,\n padding,\n scene.table\n );\n\n const oldBarCell = cell.getChildByName('progress-bar') as Group;\n // cell.replaceChild(newBarCell, oldBarCell);\n cell.insertBefore(newBarCell, oldBarCell);\n cell.removeChild(oldBarCell);\n oldBarCell.removeAllChild();\n oldBarCell.release();\n } else if (type === 'sparkline') {\n // 目前先采用重新生成节点的方案\n cell.removeAllChild();\n const headerStyle = scene.table._getCellStyle(col, row);\n const padding = getQuadProps(getProp('padding', headerStyle, col, row, scene.table));\n createSparkLineCellGroup(\n cell,\n cell.parent,\n cell.attribute.x,\n cell.attribute.y,\n col,\n row,\n cell.attribute.width,\n cell.attribute.height,\n padding,\n scene.table,\n getStyleTheme(headerStyle, scene.table, col, row, getProp).theme\n );\n } else if (type === 'image' || type === 'video') {\n updateImageCellContentWhileResize(cell, col, row, scene.table);\n } else if (cell.firstChild?.name === 'axis') {\n (cell.firstChild as any)?.originAxis.resize(cell.attribute.width, cell.attribute.height);\n } else {\n let renderDefault = true;\n const customContainer = cell.getChildByName('custom-container') as Group;\n if (customContainer) {\n let customElementsGroup;\n customContainer.removeAllChild();\n cell.removeChild(customContainer);\n\n let customRender;\n let customLayout;\n const cellLocation = scene.table.getCellLocation(col, row);\n if (cellLocation !== 'body') {\n const define = scene.table.getHeaderDefine(col, row);\n customRender = define?.headerCustomRender;\n customLayout = define?.headerCustomLayout;\n } else {\n const define = scene.table.getBodyColumnDefine(col, row);\n customRender = define?.customRender || scene.table.customRender;\n customLayout = define?.customLayout;\n }\n\n if (customLayout || customRender) {\n // const { autoRowHeight } = table.internalProps;\n const customResult = dealWithCustom(\n customLayout,\n customRender,\n col,\n row,\n cell.attribute.width,\n cell.attribute.height,\n false,\n scene.table.heightMode === 'autoHeight',\n scene.table\n );\n customElementsGroup = customResult.elementsGroup;\n renderDefault = customResult.renderDefault;\n }\n\n if (cell.childrenCount > 0) {\n cell.insertBefore(customElementsGroup, cell.firstChild);\n } else {\n cell.appendChild(customElementsGroup);\n }\n }\n\n if (renderDefault) {\n // 处理文字\n const style = scene.table._getCellStyle(col, row);\n updateMergeCellContentHeight(\n cell,\n distHeight,\n detaY,\n // scene.table.internalProps.autoRowHeight,\n scene.table.heightMode === 'autoHeight',\n getQuadProps(style.padding as number),\n style.textAlign,\n style.textBaseline,\n scene.table\n );\n }\n }\n}\n\nfunction updateMergeCellContentHeight(\n cellGroup: Group,\n distHeight: number,\n detaY: number,\n autoRowHeight: boolean,\n padding: [number, number, number, number],\n textAlign: CanvasTextAlign,\n textBaseline: CanvasTextBaseline,\n table: BaseTableAPI\n) {\n if (isMergeCellGroup(cellGroup)) {\n distHeight = 0;\n for (let row = cellGroup.mergeStartRow; row <= cellGroup.mergeEndRow; row++) {\n distHeight += table.getRowHeight(row);\n }\n for (let col = cellGroup.mergeStartCol; col <= cellGroup.mergeEndCol; col++) {\n for (let row = cellGroup.mergeStartRow; row <= cellGroup.mergeEndRow; row++) {\n const singleCellGroup = table.scenegraph.getCell(col, row);\n singleCellGroup.forEachChildren((child: IGraphic) => {\n child.setAttributes({\n dx: 0,\n dy: 0\n });\n });\n updateCellContentHeight(singleCellGroup, distHeight, detaY, autoRowHeight, padding, textAlign, textBaseline);\n const rangeHeight = table.getRowHeight(row);\n const rangeWidth = table.getColWidth(col);\n\n // const { height: contentHeight } = cellGroup.attribute;\n singleCellGroup.contentHeight = distHeight;\n\n resizeCellGroup(\n singleCellGroup,\n rangeWidth,\n rangeHeight,\n {\n start: {\n col: cellGroup.mergeStartCol,\n row: cellGroup.mergeStartRow\n },\n end: {\n col: cellGroup.mergeEndCol,\n row: cellGroup.mergeEndRow\n }\n },\n table\n );\n }\n }\n } else {\n updateCellContentHeight(cellGroup, distHeight, detaY, autoRowHeight, padding, textAlign, textBaseline);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/scenegraph/layout/update-height.ts"],"names":[],"mappings":";;;AAEA,oFAAqF;AACrF,gFAAsF;AAEtF,4DAA2D;AAC3D,gDAA4C;AAC5C,8CAAgD;AAChD,gEAAoE;AAEpE,gDAAqD;AACrD,sEAA0F;AAC1F,wDAAuD;AACvD,sEAAgE;AAEhE,kEAAiE;AAGjE,SAAgB,eAAe,CAAC,KAAiB,EAAE,GAAW,EAAE,KAAa;IAE3E,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC,CAAC;IAE5E,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE;QACnD,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,C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AAa,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;gBAC7G,MAAM,WAAW,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;gBAC5C,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;gBAG1C,eAAe,CAAC,aAAa,GAAG,UAAU,CAAC;gBAE3C,IAAA,+BAAe,EACb,eAAe,EACf,UAAU,EACV,WAAW,EACX;oBACE,KAAK,EAAE;wBACL,GAAG,EAAE,SAAS,CAAC,aAAa;wBAC5B,GAAG,EAAE,SAAS,CAAC,aAAa;qBAC7B;oBACD,GAAG,EAAE;wBACH,GAAG,EAAE,SAAS,CAAC,WAAW;wBAC1B,GAAG,EAAE,SAAS,CAAC,WAAW;qBAC3B;iBACF,EACD,KAAK,CACN,CAAC;aACH;SACF;KACF;SAAM;QACL,IAAA,0CAAuB,EAAC,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;KACxG;AACH,CAAC","file":"update-height.js","sourcesContent":["import type { ProgressBarStyle } from '../../body-helper/style/ProgressBarStyle';\nimport type { Group } from '../graphic/group';\nimport { createProgressBarCell } from '../group-creater/cell-type/progress-bar-cell';\nimport { createSparkLineCellGroup } from '../group-creater/cell-type/spark-line-cell';\nimport type { Scenegraph } from '../scenegraph';\nimport { getCellMergeInfo } from '../utils/get-cell-merge';\nimport { getProp } from '../utils/get-prop';\nimport { getQuadProps } from '../utils/padding';\nimport { updateCellContentHeight } from '../utils/text-icon-layout';\nimport type { IProgressbarColumnBodyDefine } from '../../ts-types/list-table/define/progressbar-define';\nimport { dealWithCustom } from '../component/custom';\nimport { updateImageCellContentWhileResize } from '../group-creater/cell-type/image-cell';\nimport { getStyleTheme } from '../../core/tableHelper';\nimport { isMergeCellGroup } from '../utils/is-merge-cell-group';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport { resizeCellGroup } from '../group-creater/column-helper';\nimport type { IGraphic } from '@visactor/vrender';\n\nexport function updateRowHeight(scene: Scenegraph, row: number, detaY: number) {\n // 更新table行高存储\n scene.table._setRowHeight(row, scene.table.getRowHeight(row) + detaY, true);\n\n for (let col = 0; col < scene.table.colCount; col++) {\n const cell = scene.getCell(col, row);\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n if (mergeInfo && mergeInfo.start.col !== col) {\n continue;\n }\n const height = cell.attribute.height;\n // cell.setAttribute('height', height);\n // (cell.firstChild as Rect).setAttribute('height', cell.attribute.height);\n updateCellHeightForRow(scene, cell, col, row, height + detaY, detaY, scene.table.isHeader(col, row));\n\n scene.updateCellContentWhileResize(col, row);\n }\n\n let rowStart = 0;\n let rowEnd = 0;\n // 更新header 高度\n if (row < scene.table.columnHeaderLevelCount) {\n // scene.colHeaderGroup.setAttribute('height', scene.colHeaderGroup.attribute.height + detaY);\n // scene.rowHeaderGroup.setAttribute('y', scene.rowHeaderGroup.attribute.y + detaY);\n // scene.bodyGroup.setAttribute('y', scene.bodyGroup.attribute.y + detaY);\n\n rowStart = row + 1;\n rowEnd = scene.table.columnHeaderLevelCount - 1;\n } else {\n rowStart = row + 1;\n // rowEnd = scene.table.rowCount - 1;\n rowEnd = scene.bodyRowEnd; //- scene.table.bottomFrozenRowCount;\n }\n\n // 更新以下行位置\n for (let rowIndex = rowStart; rowIndex <= rowEnd; rowIndex++) {\n for (let colIndex = 0; colIndex < scene.table.colCount; colIndex++) {\n const cellGroup = scene.getCell(colIndex, rowIndex);\n if (cellGroup.role === 'cell') {\n cellGroup.setAttribute('y', cellGroup.attribute.y + detaY);\n }\n }\n }\n}\n\n/**\n * @description: 更新单个单元格高度\n * @return {*}\n */\nexport function updateCellHeightForRow(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n height: number,\n detaY: number,\n isHeader: boolean\n // autoRowHeight: boolean\n) {\n cell.setAttribute('height', height);\n const cellGroup = cell;\n const distHeight = height;\n\n if (!cellGroup) {\n // 合并单元格非主单元格,不处理\n return;\n }\n\n updateCellHeight(scene, cellGroup, col, row, distHeight, detaY, isHeader);\n}\n\nexport function updateCellHeightForColumn(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n height: number,\n detaY: number,\n isHeader: boolean\n) {\n cell.setAttribute('height', height);\n const cellGroup = cell;\n updateCellHeight(scene, cellGroup, col, row, height, 0, isHeader);\n}\n\nexport function updateCellHeight(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n distHeight: number,\n detaY: number,\n isHeader: boolean\n) {\n // 更新单元格布局\n const type = scene.table.isHeader(col, row)\n ? scene.table._getHeaderLayoutMap(col, row).headerType\n : scene.table.getBodyColumnType(col, row);\n if (type === 'progressbar') {\n // 目前先采用重新生成节点的方案\n const columnDefine = scene.table.getBodyColumnDefine(col, row) as IProgressbarColumnBodyDefine;\n const style = scene.table._getCellStyle(col, row) as ProgressBarStyle;\n const value = scene.table.getCellValue(col, row);\n const dataValue = scene.table.getCellOriginValue(col, row);\n const padding = getQuadProps(getProp('padding', style, col, row, scene.table));\n\n const newBarCell = createProgressBarCell(\n columnDefine,\n style,\n cell.attribute.width,\n // cell.attribute.height,\n value,\n dataValue,\n col,\n row,\n padding,\n scene.table\n );\n\n const oldBarCell = cell.getChildByName('progress-bar') as Group;\n // cell.replaceChild(newBarCell, oldBarCell);\n cell.insertBefore(newBarCell, oldBarCell);\n cell.removeChild(oldBarCell);\n oldBarCell.removeAllChild();\n oldBarCell.release();\n } else if (type === 'sparkline') {\n // 目前先采用重新生成节点的方案\n cell.removeAllChild();\n const headerStyle = scene.table._getCellStyle(col, row);\n const padding = getQuadProps(getProp('padding', headerStyle, col, row, scene.table));\n createSparkLineCellGroup(\n cell,\n cell.parent,\n cell.attribute.x,\n cell.attribute.y,\n col,\n row,\n cell.attribute.width,\n cell.attribute.height,\n padding,\n scene.table,\n getStyleTheme(headerStyle, scene.table, col, row, getProp).theme\n );\n } else if (type === 'image' || type === 'video') {\n updateImageCellContentWhileResize(cell, col, row, scene.table);\n } else if (cell.firstChild?.name === 'axis') {\n (cell.firstChild as any)?.originAxis.resize(cell.attribute.width, cell.attribute.height);\n } else {\n let renderDefault = true;\n const customContainer = cell.getChildByName('custom-container') as Group;\n if (customContainer) {\n let customElementsGroup;\n customContainer.removeAllChild();\n cell.removeChild(customContainer);\n\n let customRender;\n let customLayout;\n const cellLocation = scene.table.getCellLocation(col, row);\n if (cellLocation !== 'body') {\n const define = scene.table.getHeaderDefine(col, row);\n customRender = define?.headerCustomRender;\n customLayout = define?.headerCustomLayout;\n } else {\n const define = scene.table.getBodyColumnDefine(col, row);\n customRender = define?.customRender || scene.table.customRender;\n customLayout = define?.customLayout;\n }\n\n if (customLayout || customRender) {\n // const { autoRowHeight } = table.internalProps;\n const customResult = dealWithCustom(\n customLayout,\n customRender,\n col,\n row,\n cell.attribute.width,\n cell.attribute.height,\n false,\n scene.table.heightMode === 'autoHeight',\n scene.table\n );\n customElementsGroup = customResult.elementsGroup;\n renderDefault = customResult.renderDefault;\n }\n\n if (cell.childrenCount > 0) {\n cell.insertBefore(customElementsGroup, cell.firstChild);\n } else {\n cell.appendChild(customElementsGroup);\n }\n }\n\n if (renderDefault) {\n // 处理文字\n const style = scene.table._getCellStyle(col, row);\n updateMergeCellContentHeight(\n cell,\n distHeight,\n detaY,\n // scene.table.internalProps.autoRowHeight,\n scene.table.heightMode === 'autoHeight',\n getQuadProps(style.padding as number),\n style.textAlign,\n style.textBaseline,\n scene.table\n );\n }\n }\n}\n\nfunction updateMergeCellContentHeight(\n cellGroup: Group,\n distHeight: number,\n detaY: number,\n autoRowHeight: boolean,\n padding: [number, number, number, number],\n textAlign: CanvasTextAlign,\n textBaseline: CanvasTextBaseline,\n table: BaseTableAPI\n) {\n if (isMergeCellGroup(cellGroup)) {\n distHeight = 0;\n for (let row = cellGroup.mergeStartRow; row <= cellGroup.mergeEndRow; row++) {\n distHeight += table.getRowHeight(row);\n }\n for (let col = cellGroup.mergeStartCol; col <= cellGroup.mergeEndCol; col++) {\n for (let row = cellGroup.mergeStartRow; row <= cellGroup.mergeEndRow; row++) {\n const singleCellGroup = table.scenegraph.getCell(col, row);\n singleCellGroup.forEachChildren((child: IGraphic) => {\n child.setAttributes({\n dx: 0,\n dy: 0\n });\n });\n updateCellContentHeight(singleCellGroup, distHeight, detaY, autoRowHeight, padding, textAlign, textBaseline);\n const rangeHeight = table.getRowHeight(row);\n const rangeWidth = table.getColWidth(col);\n\n // const { height: contentHeight } = cellGroup.attribute;\n singleCellGroup.contentHeight = distHeight;\n\n resizeCellGroup(\n singleCellGroup,\n rangeWidth,\n rangeHeight,\n {\n start: {\n col: cellGroup.mergeStartCol,\n row: cellGroup.mergeStartRow\n },\n end: {\n col: cellGroup.mergeEndCol,\n row: cellGroup.mergeEndRow\n }\n },\n table\n );\n }\n }\n } else {\n updateCellContentHeight(cellGroup, distHeight, detaY, autoRowHeight, padding, textAlign, textBaseline);\n }\n}\n"]}
|
|
@@ -7,9 +7,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
const vutils_1 = require("@visactor/vutils"), group_1 = require("../graphic/group"), cell_helper_1 = require("../group-creater/cell-helper"), get_cell_merge_1 = require("../utils/get-cell-merge");
|
|
8
8
|
|
|
9
9
|
function updateRow(removeCells, addCells, updateCells, table) {
|
|
10
|
-
const scene = table.scenegraph, removeRows = deduplication(removeCells.map((cell => cell.row))).sort(((a, b) => b - a)), addRows = deduplication(addCells.map((cell => cell.row))).sort(((a, b) => a - b));
|
|
10
|
+
const scene = table.scenegraph, removeRows = deduplication(removeCells.map((cell => cell.row))).sort(((a, b) => b - a)), addRows = deduplication(addCells.map((cell => cell.row))).sort(((a, b) => a - b)), updateRows = deduplication(updateCells.map((cell => cell.row))).sort(((a, b) => a - b));
|
|
11
11
|
let updateAfter;
|
|
12
|
-
|
|
12
|
+
removeRows.forEach((row => {
|
|
13
13
|
removeRow(row, scene);
|
|
14
14
|
})), removeRows.forEach((row => {
|
|
15
15
|
scene.table.rowHeightsMap.adjustOrder(row + 1, row, scene.table.rowHeightsMap.count() - row - 1),
|
|
@@ -17,15 +17,17 @@ function updateRow(removeCells, addCells, updateCells, table) {
|
|
|
17
17
|
})), removeRows.length && resetRowNumber(scene), scene.table._clearRowRangeHeightsMap(),
|
|
18
18
|
addRows.forEach((row => {
|
|
19
19
|
const needUpdateAfter = addRow(row, scene);
|
|
20
|
-
updateAfter = updateAfter
|
|
21
|
-
})), resetRowNumberAndY(scene)
|
|
22
|
-
|
|
23
|
-
const mergeInfo = (0, get_cell_merge_1.getCellMergeInfo)(scene.table,
|
|
20
|
+
updateAfter = null != updateAfter ? updateAfter : needUpdateAfter, scene.table.rowHeightsMap.adjustOrder(row, row + 1, scene.table.rowHeightsMap.count() - row);
|
|
21
|
+
})), resetRowNumberAndY(scene);
|
|
22
|
+
for (let col = 0; col < table.colCount; col++) updateRows.forEach((r => {
|
|
23
|
+
const mergeInfo = (0, get_cell_merge_1.getCellMergeInfo)(scene.table, col, r);
|
|
24
24
|
if (mergeInfo) for (let col = mergeInfo.start.col; col <= mergeInfo.end.col; col++) for (let row = mergeInfo.start.row; row <= mergeInfo.end.row; row++) (0,
|
|
25
|
-
cell_helper_1.updateCell)(col, row, scene.table, !1); else (0, cell_helper_1.updateCell)(
|
|
26
|
-
}))
|
|
25
|
+
cell_helper_1.updateCell)(col, row, scene.table, !1); else (0, cell_helper_1.updateCell)(col, r, scene.table, !1);
|
|
26
|
+
}));
|
|
27
|
+
if ((0, vutils_1.isNumber)(updateAfter)) {
|
|
27
28
|
for (let col = 0; col < table.colCount; col++) for (let row = updateAfter; row < table.rowCount; row++) {
|
|
28
|
-
scene.highPerformanceGetCell(col, row, !0)
|
|
29
|
+
const cellGroup = scene.highPerformanceGetCell(col, row, !0);
|
|
30
|
+
cellGroup && (cellGroup.needUpdate = !0);
|
|
29
31
|
}
|
|
30
32
|
scene.proxy.rowUpdatePos = updateAfter;
|
|
31
33
|
}
|
|
@@ -35,10 +37,19 @@ function updateRow(removeCells, addCells, updateCells, table) {
|
|
|
35
37
|
scene.proxy.rowUpdatePos = minRow;
|
|
36
38
|
}
|
|
37
39
|
scene.proxy.rowUpdateDirection = "up", scene.proxy.updateCellGroups(2 * scene.proxy.screenRowCount),
|
|
38
|
-
scene.proxy.progress();
|
|
40
|
+
updateBottomFrozeCellGroups(), scene.proxy.progress();
|
|
39
41
|
} else removeRows.length && (scene.proxy.updateCellGroups(2 * scene.proxy.screenRowCount),
|
|
40
|
-
scene.proxy.progress());
|
|
42
|
+
updateBottomFrozeCellGroups(), scene.proxy.progress());
|
|
41
43
|
const newTotalHeight = table.getRowsHeight(table.frozenRowCount, table.rowCount - 1 - table.bottomFrozenRowCount);
|
|
44
|
+
function updateBottomFrozeCellGroups() {
|
|
45
|
+
if ((null == addRows ? void 0 : addRows[(null == addRows ? void 0 : addRows.length) - 1]) >= table.rowCount - table.bottomFrozenRowCount || (null == updateRows ? void 0 : updateRows[(null == updateRows ? void 0 : updateRows.length) - 1]) >= table.rowCount - table.bottomFrozenRowCount || (null == removeRows ? void 0 : removeRows[0]) >= table.rowCount - table.bottomFrozenRowCount) {
|
|
46
|
+
for (let col = 0; col < table.colCount; col++) for (let row = table.rowCount - table.bottomFrozenRowCount; row < table.rowCount; row++) {
|
|
47
|
+
const cellGroup = scene.highPerformanceGetCell(col, row, !0);
|
|
48
|
+
cellGroup && (cellGroup.needUpdate = !0);
|
|
49
|
+
}
|
|
50
|
+
scene.proxy.updateBottomFrozenCellGroups();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
42
53
|
scene.updateContainerHeight(scene.table.frozenRowCount, newTotalHeight - scene.bodyGroup.attribute.height);
|
|
43
54
|
}
|
|
44
55
|
|
|
@@ -68,49 +79,83 @@ function deduplication(array) {
|
|
|
68
79
|
}
|
|
69
80
|
|
|
70
81
|
function resetRowNumber(scene) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
headerColGroup.forEachChildren((cellGroup => {
|
|
77
|
-
cellGroup.row = rowIndex;
|
|
78
|
-
const merge = (0, get_cell_merge_1.getCellMergeInfo)(scene.table, cellGroup.col, cellGroup.row);
|
|
79
|
-
merge && (cellGroup.mergeStartCol = merge.start.col, cellGroup.mergeStartRow = merge.start.row,
|
|
80
|
-
cellGroup.mergeEndCol = merge.end.col, cellGroup.mergeEndRow = merge.end.row), rowIndex++;
|
|
81
|
-
})), rowIndex = null === (_b = colGroup.firstChild) || void 0 === _b ? void 0 : _b.row,
|
|
82
|
-
colGroup.forEachChildren((cellGroup => {
|
|
83
|
-
cellGroup.row = rowIndex;
|
|
84
|
-
const merge = (0, get_cell_merge_1.getCellMergeInfo)(scene.table, cellGroup.col, cellGroup.row);
|
|
85
|
-
merge && (cellGroup.mergeStartCol = merge.start.col, cellGroup.mergeStartRow = merge.start.row,
|
|
86
|
-
cellGroup.mergeEndCol = merge.end.col, cellGroup.mergeEndRow = merge.end.row), rowIndex++;
|
|
87
|
-
}));
|
|
82
|
+
function processCell(cellGroup, rowIndex) {
|
|
83
|
+
cellGroup.row = rowIndex;
|
|
84
|
+
const merge = (0, get_cell_merge_1.getCellMergeInfo)(scene.table, cellGroup.col, cellGroup.row);
|
|
85
|
+
merge && (cellGroup.mergeStartCol = merge.start.col, cellGroup.mergeStartCol = merge.start.col,
|
|
86
|
+
cellGroup.mergeEndCol = merge.end.col, cellGroup.mergeEndCol = merge.end.col);
|
|
88
87
|
}
|
|
88
|
+
scene.bodyGroup.forEachChildren((colGroup => {
|
|
89
|
+
let rowIndex = scene.bodyRowStart;
|
|
90
|
+
null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
91
|
+
processCell(cellGroup, rowIndex), rowIndex++;
|
|
92
|
+
}));
|
|
93
|
+
})), scene.rowHeaderGroup.forEachChildren((colGroup => {
|
|
94
|
+
let rowIndex = scene.bodyRowStart;
|
|
95
|
+
null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
96
|
+
processCell(cellGroup, rowIndex), rowIndex++;
|
|
97
|
+
}));
|
|
98
|
+
})), scene.rightFrozenGroup.forEachChildren((colGroup => {
|
|
99
|
+
let rowIndex = scene.bodyRowStart;
|
|
100
|
+
null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
101
|
+
processCell(cellGroup, rowIndex), rowIndex++;
|
|
102
|
+
}));
|
|
103
|
+
})), scene.bottomFrozenGroup.forEachChildren((colGroup => {
|
|
104
|
+
let rowIndex = scene.table.rowCount - scene.table.bottomFrozenRowCount;
|
|
105
|
+
null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
106
|
+
processCell(cellGroup, rowIndex), rowIndex++;
|
|
107
|
+
}));
|
|
108
|
+
})), scene.leftBottomCornerGroup.forEachChildren((colGroup => {
|
|
109
|
+
let rowIndex = scene.table.rowCount - scene.table.bottomFrozenRowCount;
|
|
110
|
+
null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
111
|
+
processCell(cellGroup, rowIndex), rowIndex++;
|
|
112
|
+
}));
|
|
113
|
+
})), scene.rightBottomCornerGroup.forEachChildren((colGroup => {
|
|
114
|
+
let rowIndex = scene.table.rowCount - scene.table.bottomFrozenRowCount;
|
|
115
|
+
null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
116
|
+
processCell(cellGroup, rowIndex), rowIndex++;
|
|
117
|
+
}));
|
|
118
|
+
}));
|
|
89
119
|
}
|
|
90
120
|
|
|
91
121
|
function resetRowNumberAndY(scene) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (!headerColGroup || !colGroup) continue;
|
|
98
|
-
let rowIndex = null === (_a = headerColGroup.firstChild) || void 0 === _a ? void 0 : _a.row, y = 0;
|
|
99
|
-
rowIndex = null === (_b = colGroup.firstChild) || void 0 === _b ? void 0 : _b.row;
|
|
100
|
-
y = scene.getCellGroupY(rowIndex), colGroup.forEachChildren((cellGroup => {
|
|
101
|
-
cellGroup.row = rowIndex;
|
|
102
|
-
const merge = (0, get_cell_merge_1.getCellMergeInfo)(scene.table, cellGroup.col, cellGroup.row);
|
|
103
|
-
merge && (cellGroup.mergeStartCol = merge.start.col, cellGroup.mergeStartRow = merge.start.row,
|
|
104
|
-
cellGroup.mergeEndCol = merge.end.col, cellGroup.mergeEndRow = merge.end.row), rowIndex++,
|
|
105
|
-
"cell" === cellGroup.role && (cellGroup.setAttribute("y", y), y += cellGroup.attribute.height);
|
|
106
|
-
})), newTotalHeight = y, null == bottomGroup || bottomGroup.forEachChildren((cellGroup => {
|
|
107
|
-
cellGroup.row = rowIndex;
|
|
108
|
-
const merge = (0, get_cell_merge_1.getCellMergeInfo)(scene.table, cellGroup.col, cellGroup.row);
|
|
109
|
-
merge && (cellGroup.mergeStartCol = merge.start.col, cellGroup.mergeStartRow = merge.start.row,
|
|
110
|
-
cellGroup.mergeEndCol = merge.end.col, cellGroup.mergeEndRow = merge.end.row), rowIndex++;
|
|
111
|
-
}));
|
|
122
|
+
function processCell(cellGroup, rowIndex, y) {
|
|
123
|
+
cellGroup.row = rowIndex, cellGroup.setAttribute("y", y);
|
|
124
|
+
const merge = (0, get_cell_merge_1.getCellMergeInfo)(scene.table, cellGroup.col, cellGroup.row);
|
|
125
|
+
merge && (cellGroup.mergeStartCol = merge.start.col, cellGroup.mergeStartCol = merge.start.col,
|
|
126
|
+
cellGroup.mergeEndCol = merge.end.col, cellGroup.mergeEndCol = merge.end.col);
|
|
112
127
|
}
|
|
113
|
-
|
|
128
|
+
scene.bodyGroup.forEachChildren((colGroup => {
|
|
129
|
+
let rowIndex = scene.bodyRowStart, y = scene.getCellGroupY(rowIndex);
|
|
130
|
+
null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
131
|
+
processCell(cellGroup, rowIndex, y), rowIndex++, y += cellGroup.attribute.height;
|
|
132
|
+
}));
|
|
133
|
+
})), scene.rowHeaderGroup.forEachChildren((colGroup => {
|
|
134
|
+
let rowIndex = scene.bodyRowStart, y = scene.getCellGroupY(rowIndex);
|
|
135
|
+
null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
136
|
+
processCell(cellGroup, rowIndex, y), rowIndex++, y += cellGroup.attribute.height;
|
|
137
|
+
}));
|
|
138
|
+
})), scene.rightFrozenGroup.forEachChildren((colGroup => {
|
|
139
|
+
let rowIndex = scene.bodyRowStart, y = scene.getCellGroupY(rowIndex);
|
|
140
|
+
null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
141
|
+
processCell(cellGroup, rowIndex, y), rowIndex++, y += cellGroup.attribute.height;
|
|
142
|
+
}));
|
|
143
|
+
})), scene.bottomFrozenGroup.forEachChildren((colGroup => {
|
|
144
|
+
let rowIndex = scene.table.rowCount - scene.table.bottomFrozenRowCount, y = 0;
|
|
145
|
+
null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
146
|
+
processCell(cellGroup, rowIndex, y), rowIndex++, y += cellGroup.attribute.height;
|
|
147
|
+
}));
|
|
148
|
+
})), scene.leftBottomCornerGroup.forEachChildren((colGroup => {
|
|
149
|
+
let rowIndex = scene.table.rowCount - scene.table.bottomFrozenRowCount, y = 0;
|
|
150
|
+
null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
151
|
+
processCell(cellGroup, rowIndex, y), rowIndex++, y += cellGroup.attribute.height;
|
|
152
|
+
}));
|
|
153
|
+
})), scene.rightBottomCornerGroup.forEachChildren((colGroup => {
|
|
154
|
+
let rowIndex = scene.table.rowCount - scene.table.bottomFrozenRowCount, y = 0;
|
|
155
|
+
null == colGroup || colGroup.forEachChildren((cellGroup => {
|
|
156
|
+
processCell(cellGroup, rowIndex, y), rowIndex++, y += cellGroup.attribute.height;
|
|
157
|
+
}));
|
|
158
|
+
}));
|
|
114
159
|
}
|
|
115
160
|
|
|
116
161
|
function addRowCellGroup(row, scene) {
|