Skip to content

Commit

Permalink
fix(sheets-ui): dynamically adjust row header width
Browse files Browse the repository at this point in the history
close #1471
  • Loading branch information
wzhudev committed Mar 5, 2024
1 parent 885ba4b commit 06ebbbe
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
Original file line number Diff line number Diff line change
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 06ebbbe

Please sign in to comment.