Skip to content

Commit

Permalink
fix: 修复行头滚动刷选获取到错误的实例
Browse files Browse the repository at this point in the history
  • Loading branch information
lijinke666 committed Dec 5, 2023
1 parent 2c40b87 commit 3006ab3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/s2-core/src/facet/header/pivot-row.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { RowCell } from '../../cell/row-cell';
import { BaseFrozenRowHeader } from './base-frozen-row';

export class PivotRowHeader extends BaseFrozenRowHeader {
protected createCellInstance(node: Node): RowCell {
public createCellInstance(node: Node): RowCell {
const { spreadsheet, scrollY } = this.headerConfig;
const frozenRow = this.isFrozenRow(node);

Expand Down
6 changes: 3 additions & 3 deletions packages/s2-core/src/facet/header/row.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ export class RowHeader extends BaseHeader<RowHeaderConfig> {
); // right
}

protected createCellInstance(item: Node) {
return new RowCell(item, this.headerConfig.spreadsheet, this.headerConfig);
public createCellInstance(node: Node) {
return new RowCell(node, this.headerConfig.spreadsheet, this.headerConfig);
}

Check warning on line 51 in packages/s2-core/src/facet/header/row.ts

View check run for this annotation

Codecov / codecov/patch

packages/s2-core/src/facet/header/row.ts#L51

Added line #L51 was not covered by tests

protected getCellGroup(item: Node): IGroup {
protected getCellGroup(node: Node): IGroup {

Check warning on line 53 in packages/s2-core/src/facet/header/row.ts

View check run for this annotation

Codecov / codecov/patch

packages/s2-core/src/facet/header/row.ts#L53

Added line #L53 was not covered by tests
return this;
}

Expand Down
9 changes: 4 additions & 5 deletions packages/s2-core/src/facet/header/series-number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,16 @@ export class SeriesNumberHeader extends BaseFrozenRowHeader {
});
}

protected createCellInstance(item: Node): RowCell {
const frozenRow = this.isFrozenRow(item);
const cell = new SeriesNumberCell(
item,
public createCellInstance(node: Node): RowCell {
const frozenRow = this.isFrozenRow(node);
return new SeriesNumberCell(
node,
this.headerConfig.spreadsheet,
{
...this.headerConfig,
scrollY: frozenRow ? 0 : this.headerConfig.scrollY,
},
frozenRow,
);
return cell;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Point } from '@antv/g-canvas';
import { isNil, last, map } from 'lodash';
import { RowCell } from '../../cell';
import { BaseRowCell, RowCell } from '../../cell';
import { InterceptType, S2Event } from '../../common/constant';
import {
InteractionBrushSelectionStage,
Expand Down Expand Up @@ -129,7 +129,7 @@ export class RowBrushSelection extends BaseBrushSelection {
}

// TODO: 先暂时不考虑自定义单元格的情况, next 分支把这些单元格 (包括自定义单元格) 都放在了 s2.options.rowCell 里
return new RowCell(node, this.spreadsheet);
return this.spreadsheet.facet.rowHeader.createCellInstance(node);
});
}

Expand Down

0 comments on commit 3006ab3

Please sign in to comment.