Skip to content

Commit

Permalink
fix: case pivot-analysis-grid-tree-cornerOnColumn
Browse files Browse the repository at this point in the history
  • Loading branch information
fangsmile committed Jan 30, 2025
1 parent e59f2b6 commit 252fa46
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
6 changes: 5 additions & 1 deletion packages/vtable/src/dataset/dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,11 @@ export class Dataset {
}
if (colKey.length < this.columns.length && this.columnHierarchyType === 'grid-tree') {
if (colKey[0] === this.colGrandTotalLabel) {
} else if (this.totals?.column?.subTotalsDimensions && this.totals?.column?.subTotalsDimensions?.length >= 1) {
} else if (
this.totals?.column?.subTotalsDimensions &&
this.totals?.column?.subTotalsDimensions?.length >= 1 &&
colKey[colKey.length - 1] !== this.colSubTotalLabel
) {
colKey.push(this.colSubTotalLabel);
}
}
Expand Down
17 changes: 10 additions & 7 deletions packages/vtable/src/layout/tree-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -739,17 +739,20 @@ export function dealHeaderForGridTreeMode(
_headerCellIds[row][layoutMap.colIndex] = id;

// 处理汇总小计跨维度层级的情况
const span = Math.min(expandedMaxLevel, (hd as any).levelSpan);
if (span > 1) {
for (let i = 1; i < span; i++) {
if (!_headerCellIds[row + i]) {
_headerCellIds[row + i] = [];
const span = Math.min(
(isRowTree ? indicatorsAsCol : !indicatorsAsCol) ? expandedMaxLevel : expandedMaxLevel - 1,
(hd as any).levelSpan ?? 1000
);
if (span > 0) {
for (let r = row + 1; r < span; r++) {
if (!_headerCellIds[r]) {
_headerCellIds[r] = [];
// 当行前几个没有赋值的id 赋值
for (let col = 0; col < layoutMap.colIndex; col++) {
_headerCellIds[row + i][col] = _headerCellIds[row][col];
_headerCellIds[r][col] = _headerCellIds[row][col];
}
}
_headerCellIds[row + i][layoutMap.colIndex] = id;
_headerCellIds[r][layoutMap.colIndex] = id;
}
}

Expand Down

0 comments on commit 252fa46

Please sign in to comment.