Skip to content

Commit

Permalink
fix: fix frozenColCount in checkFrozen()
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui-Sun committed Jun 12, 2024
1 parent 7a43efd commit c7dd6bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 1 addition & 5 deletions packages/vtable/src/core/BaseTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,11 +524,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI {
* 注意 这个值和options.frozenColCount 不一样!options.frozenColCount是用户实际设置的; 这里获取的值是调整过:frozen的列过宽时 frozeCount为0
*/
get frozenColCount(): number {
let frozenColCount = this.internalProps.layoutMap?.frozenColCount ?? this.internalProps.frozenColCount ?? 0;
if (!this.internalProps.transpose && frozenColCount >= this.colCount) {
frozenColCount = 0;
}
return frozenColCount;
return this.internalProps.layoutMap?.frozenColCount ?? this.internalProps.frozenColCount ?? 0;
}
/**
* Set the number of frozen columns.
Expand Down
5 changes: 4 additions & 1 deletion packages/vtable/src/state/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ export class StateManager {

checkFrozen(): boolean {
// 判断固定列的总宽度 是否过大
const originalFrozenColCount =
let originalFrozenColCount =
this.table.isListTable() && !this.table.internalProps.transpose
? this.table.options.frozenColCount
: this.table.isPivotChart()
Expand All @@ -772,6 +772,9 @@ export class StateManager {
this.table.options.frozenColCount ?? 0
);
if (originalFrozenColCount) {
if (originalFrozenColCount > this.table.colCount) {
originalFrozenColCount = this.table.colCount;
}
if (this.table.tableNoFrameWidth - this.table.getColsWidth(0, originalFrozenColCount - 1) <= 120) {
this.table._setFrozenColCount(0);
this.setFrozenCol(-1);
Expand Down

0 comments on commit c7dd6bf

Please sign in to comment.