Skip to content

Commit 9a1e2aa

Browse files
committed
fix: temporarily fix scroll position
1 parent 7ec7432 commit 9a1e2aa

2 files changed

Lines changed: 20 additions & 21 deletions

File tree

packages/vtable/src/core/BaseTable.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -503,16 +503,16 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI {
503503
? typeof limitMinWidth === 'number'
504504
? limitMinWidth
505505
: limitMinWidth
506-
? 10
507-
: 0
506+
? 10
507+
: 0
508508
: 10;
509509
internalProps.limitMinHeight =
510510
limitMinHeight !== null && limitMinHeight !== undefined
511511
? typeof limitMinHeight === 'number'
512512
? limitMinHeight
513513
: limitMinHeight
514-
? 10
515-
: 0
514+
? 10
515+
: 0
516516
: 10;
517517
// 生成scenegraph
518518
// this._vDataSet = new DataSet();
@@ -1488,12 +1488,12 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI {
14881488
// : this.defaultColWidth;
14891489
if (this.isRowHeader(col, 0) || this.isCornerHeader(col, 0)) {
14901490
return Array.isArray(this.defaultHeaderColWidth)
1491-
? (this.defaultHeaderColWidth[col] ?? this.defaultColWidth)
1491+
? this.defaultHeaderColWidth[col] ?? this.defaultColWidth
14921492
: this.defaultHeaderColWidth;
14931493
} else if (this.isRightFrozenColumn(col, this.columnHeaderLevelCount)) {
14941494
if (this.isPivotTable()) {
14951495
return Array.isArray(this.defaultHeaderColWidth)
1496-
? (this.defaultHeaderColWidth[this.rowHeaderLevelCount - this.rightFrozenColCount] ?? this.defaultColWidth)
1496+
? this.defaultHeaderColWidth[this.rowHeaderLevelCount - this.rightFrozenColCount] ?? this.defaultColWidth
14971497
: this.defaultHeaderColWidth;
14981498
}
14991499
return this.defaultColWidth;
@@ -1504,15 +1504,15 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI {
15041504
getDefaultRowHeight(row: number) {
15051505
if (this.isColumnHeader(0, row) || this.isCornerHeader(0, row) || this.isSeriesNumberInHeader(0, row)) {
15061506
return Array.isArray(this.defaultHeaderRowHeight)
1507-
? (this.defaultHeaderRowHeight[row] ?? this.internalProps.defaultRowHeight)
1507+
? this.defaultHeaderRowHeight[row] ?? this.internalProps.defaultRowHeight
15081508
: this.defaultHeaderRowHeight;
15091509
}
15101510
if (this.isBottomFrozenRow(row)) {
15111511
//底部冻结行默认取用了表头的行高 但针对非表头数据冻结的情况这里可能不妥
15121512
return Array.isArray(this.defaultHeaderRowHeight)
1513-
? (this.defaultHeaderRowHeight[
1513+
? this.defaultHeaderRowHeight[
15141514
this.columnHeaderLevelCount > 0 ? this.columnHeaderLevelCount - this.bottomFrozenRowCount : 0
1515-
] ?? this.internalProps.defaultRowHeight)
1515+
] ?? this.internalProps.defaultRowHeight
15161516
: this.defaultHeaderRowHeight;
15171517
}
15181518
return this.internalProps.defaultRowHeight;
@@ -2814,16 +2814,16 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI {
28142814
? typeof limitMinWidth === 'number'
28152815
? limitMinWidth
28162816
: limitMinWidth
2817-
? 10
2818-
: 0
2817+
? 10
2818+
: 0
28192819
: 10;
28202820
internalProps.limitMinHeight =
28212821
limitMinHeight !== null && limitMinHeight !== undefined
28222822
? typeof limitMinHeight === 'number'
28232823
? limitMinHeight
28242824
: limitMinHeight
2825-
? 10
2826-
: 0
2825+
? 10
2826+
: 0
28272827
: 10;
28282828
// 生成scenegraph
28292829
// this._vDataSet = new DataSet();
@@ -4991,7 +4991,8 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI {
49914991
}
49924992
if (isValid(cellAddr.row) && cellAddr.row >= this.frozenRowCount) {
49934993
const frozenHeight = this.getFrozenRowsHeight();
4994-
const top = this.getRowsHeight(0, cellAddr.row - 1);
4994+
// const top = this.getRowsHeight(0, cellAddr.row - 1);
4995+
const top = this.internalProps._rowHeightsMap.getSumInRange(0, cellAddr.row - 1);
49954996
this.scrollTop = Math.min(top - frozenHeight, this.getAllRowsHeight() - drawRange.height);
49964997
}
49974998
this.render();

packages/vtable/src/core/animation.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,12 @@ export class TableAnimationManager {
7878

7979
const to = {
8080
x: isNumber(col) ? left - this.table.getFrozenColsWidth() : this.table.scrollLeft,
81-
y: isNumber(row) ? top - this.table.getFrozenRowsHeight() : this.table.scrollTop
81+
y: isNumber(row) ? top - this.table.getFrozenRowsHeight() : this.table.scrollTop,
82+
targetCol: colInt ?? -1,
83+
targetRow: rowInt ?? -1
8284
};
83-
const duration = !isBoolean(animationOption) ? (animationOption?.duration ?? 3000) : animationOption ? 3000 : 0;
84-
const easing = !isBoolean(animationOption)
85-
? (animationOption?.easing ?? 'linear')
86-
: animationOption
87-
? 'linear'
88-
: '';
85+
const duration = !isBoolean(animationOption) ? animationOption?.duration ?? 3000 : animationOption ? 3000 : 0;
86+
const easing = !isBoolean(animationOption) ? animationOption?.easing ?? 'linear' : animationOption ? 'linear' : '';
8987

9088
const animation = new Animate(Generator.GenAutoIncrementId(), this.timeline).bind(this.tempGraphic).play(
9189
new Animateaaa(from, to, duration, easing, {

0 commit comments

Comments
 (0)