cloud-web-corejs 1.0.54-dev.495 → 1.0.54-dev.497
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/package.json
CHANGED
|
@@ -593,12 +593,39 @@ function getGrid(that, tableRef) {
|
|
|
593
593
|
});
|
|
594
594
|
return [titles];
|
|
595
595
|
},*/
|
|
596
|
+
computeRealColSpan(columns) {
|
|
597
|
+
// 深拷贝避免修改原数据(可选)
|
|
598
|
+
// const result = JSON.parse(JSON.stringify(columns));
|
|
599
|
+
|
|
600
|
+
function traverse(node) {
|
|
601
|
+
if (!node.children || node.children.length === 0) {
|
|
602
|
+
// 叶子节点:realColSpan = 原始 colSpan
|
|
603
|
+
node.realColSpan = node.colSpan || 1;
|
|
604
|
+
} else {
|
|
605
|
+
// 非叶子节点:递归处理子节点,然后求和
|
|
606
|
+
let sum = 0;
|
|
607
|
+
for (const child of node.children) {
|
|
608
|
+
traverse(child);
|
|
609
|
+
sum += child.realColSpan;
|
|
610
|
+
}
|
|
611
|
+
node.realColSpan = sum;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
for (const col of columns) {
|
|
616
|
+
traverse(col);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
return columns;
|
|
620
|
+
},
|
|
596
621
|
getHeadTitleJson() {
|
|
597
622
|
let that = this;
|
|
598
623
|
let target = this.tableTarget;
|
|
599
624
|
// let columns = target.getTableColumn().collectColumn;
|
|
600
625
|
let columns = this.columns
|
|
601
626
|
|
|
627
|
+
this.computeRealColSpan(columns);
|
|
628
|
+
|
|
602
629
|
let maxRowNum = 0;
|
|
603
630
|
let loop = function (column, n) {
|
|
604
631
|
if (column.children && column.children.length > 0) {
|
|
@@ -634,7 +661,7 @@ function getGrid(that, tableRef) {
|
|
|
634
661
|
}
|
|
635
662
|
|
|
636
663
|
contents.push({
|
|
637
|
-
colspan: column.
|
|
664
|
+
colspan: column.realColSpan,
|
|
638
665
|
rowspan: column.rowSpan,
|
|
639
666
|
title: column.title != null ? column.title : ''
|
|
640
667
|
});
|