Skip to content

Commit

Permalink
fix(sheets-ui): dynamically adjust row header width (#1475)
Browse files Browse the repository at this point in the history
close #1471
  • Loading branch information
wzhudev committed Mar 5, 2024
1 parent 5781a63 commit 371b4f1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/engine-render/src/components/sheets/sheet-skeleton.ts
Expand Up @@ -524,7 +524,7 @@ export class SpreadsheetSkeleton extends Skeleton {
defaultColumnWidth
);

this._rowHeaderWidth = rowHeader.hidden !== BooleanNumber.TRUE ? rowHeader.width : 0;
this._rowHeaderWidth = rowHeader.hidden !== BooleanNumber.TRUE ? this._dynamicallyUpdateRowHeaderWidth(rowHeader) : 0;
this._columnHeaderHeight = columnHeader.hidden !== BooleanNumber.TRUE ? columnHeader.height : 0;

this._rowTotalHeight = rowTotalHeight;
Expand All @@ -538,10 +538,11 @@ export class SpreadsheetSkeleton extends Skeleton {
return this;
}

// updateDataMerge() {
// const { mergeData } = this._config;
// this._dataMergeCacheAll = mergeData && this._getMergeCells(mergeData);
// }
private _dynamicallyUpdateRowHeaderWidth(rowHeader: { width: number }): number {
const SIZE_BY_EACH_CHARACTER = 8;
const widthByComputation = (`${this._worksheet?.getRowCount()}`.length * SIZE_BY_EACH_CHARACTER);
return Math.max(rowHeader.width, widthByComputation);
}

getRowColumnSegment(bounds?: IViewportBound) {
return this._getBounding(this._rowHeightAccumulation, this._columnWidthAccumulation, bounds?.viewBound);
Expand Down

0 comments on commit 371b4f1

Please sign in to comment.