Skip to content

Commit

Permalink
Merge pull request #382 from VisActor/fix/noColumnsError
Browse files Browse the repository at this point in the history
fix: no columns occur error
  • Loading branch information
fangsmile authored Oct 10, 2023
2 parents c80ecfc + a1b7b5f commit 2543154
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions packages/vtable/src/layout/pivot-header-layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,34 +203,35 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI {
this.columnDimensionTree.tree.children,
[]
);
// if (typeof this.showColumnHeader !== 'boolean') {
if (this.columnHeaderTitle) {
const id = ++sharedVar.seqId;
const firstRowIds = Array(this.colCount - this.rowHeaderLevelCount).fill(id);
this._columnHeaderCellIds.unshift(firstRowIds);
const cell: HeaderData = {
id,
title:
typeof this.columnHeaderTitle.title === 'string'
? this.columnHeaderTitle.title
: (this.columnsDefine.reduce((title: string, value) => {
if (typeof value === 'string') {
return title;
}
return title + (title ? `/${value.title}` : `${value.title}`);
}, '') as string),
field: undefined,
headerType: this.columnHeaderTitle.headerType ?? 'text',
style: this.columnHeaderTitle.headerStyle,
define: <any>{
id
}
};
this.columnHeaderObjs.push(cell);
this._headerObjects[id] = cell;
}
// }
}
// if (typeof this.showColumnHeader !== 'boolean') {
if (this.columnHeaderTitle) {
const id = ++sharedVar.seqId;
const firstRowIds = Array(this.colCount - this.rowHeaderLevelCount).fill(id);
this._columnHeaderCellIds.unshift(firstRowIds);
const cell: HeaderData = {
id,
title:
typeof this.columnHeaderTitle.title === 'string'
? this.columnHeaderTitle.title
: (this.columnsDefine.reduce((title: string, value) => {
if (typeof value === 'string') {
return title;
}
return title + (title ? `/${value.title}` : `${value.title}`);
}, '') as string),
field: undefined,
headerType: this.columnHeaderTitle.headerType ?? 'text',
style: this.columnHeaderTitle.headerStyle,
define: <any>{
id
}
};
this.columnHeaderObjs.push(cell);
this._headerObjects[id] = cell;
}
// }

colIndex = 0;
//生成行表头单元格
if (this.rowDimensionTree.tree.children?.length >= 1) {
Expand Down

0 comments on commit 2543154

Please sign in to comment.