Skip to content

Commit

Permalink
Merge pull request #2961 from VisActor/2957-bug-hideIndicator-columnw…
Browse files Browse the repository at this point in the history
…idthconfig

2957 bug hide indicator columnwidthconfig
  • Loading branch information
fangsmile authored Nov 29, 2024
2 parents 6f78b9a + e08d6cc commit 3a93cba
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "fix: columnWidthConfig match problem #2957\n\n",
"type": "none",
"packageName": "@visactor/vtable"
}
],
"packageName": "@visactor/vtable",
"email": "[email protected]"
}
21 changes: 19 additions & 2 deletions packages/vtable/src/PivotTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1113,9 +1113,26 @@ export class PivotTable extends BaseTable implements PivotTableAPI {
const width = item.width;
const cell = this.getCellAddressByHeaderPaths(dimensions);
if (cell.col >= this.rowHeaderLevelCount) {
const cellPath = this.getCellHeaderPaths(cell.col, this.columnHeaderLevelCount - 1);
const cellPath = this.getCellHeaderPaths(cell.col, this.columnHeaderLevelCount); //如单指标隐藏指标情况,从body行去取headerPath才会包括指标维度
if (cellPath.colHeaderPaths.length === dimensions.length) {
if (cell && !this.internalProps._widthResizedColMap.has(cell.col)) {
let match = true;
for (let i = 0; i < dimensions.length; i++) {
const dimension = dimensions[i];
const finded = (cellPath.colHeaderPaths as IDimensionInfo[]).findIndex((colPath: IDimensionInfo, index) => {
if (colPath.indicatorKey === dimension.indicatorKey) {
return true;
}
if (colPath.dimensionKey === dimension.dimensionKey && colPath.value === dimension.value) {
return true;
}
return false;
});
if (finded < 0) {
match = false;
break;
}
}
if (match && !this.internalProps._widthResizedColMap.has(cell.col)) {
this._setColWidth(cell.col, width);
this.internalProps._widthResizedColMap.add(cell.col); // add resize tag
}
Expand Down

0 comments on commit 3a93cba

Please sign in to comment.