From 3006ab3f966f132553405ca43f27b3317f946361 Mon Sep 17 00:00:00 2001 From: lijinke666 Date: Tue, 5 Dec 2023 17:49:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=A1=8C=E5=A4=B4?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E5=88=B7=E9=80=89=E8=8E=B7=E5=8F=96=E5=88=B0?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E5=AE=9E=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/s2-core/src/facet/header/pivot-row.ts | 2 +- packages/s2-core/src/facet/header/row.ts | 6 +++--- packages/s2-core/src/facet/header/series-number.ts | 9 ++++----- .../interaction/brush-selection/row-brush-selection.ts | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/s2-core/src/facet/header/pivot-row.ts b/packages/s2-core/src/facet/header/pivot-row.ts index 8277320fd3..917f321678 100644 --- a/packages/s2-core/src/facet/header/pivot-row.ts +++ b/packages/s2-core/src/facet/header/pivot-row.ts @@ -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); diff --git a/packages/s2-core/src/facet/header/row.ts b/packages/s2-core/src/facet/header/row.ts index 4e6d2b2523..7c4e2b172a 100644 --- a/packages/s2-core/src/facet/header/row.ts +++ b/packages/s2-core/src/facet/header/row.ts @@ -46,11 +46,11 @@ export class RowHeader extends BaseHeader { ); // 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); } - protected getCellGroup(item: Node): IGroup { + protected getCellGroup(node: Node): IGroup { return this; } diff --git a/packages/s2-core/src/facet/header/series-number.ts b/packages/s2-core/src/facet/header/series-number.ts index b46410ca96..09f541735b 100644 --- a/packages/s2-core/src/facet/header/series-number.ts +++ b/packages/s2-core/src/facet/header/series-number.ts @@ -72,10 +72,10 @@ 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, @@ -83,6 +83,5 @@ export class SeriesNumberHeader extends BaseFrozenRowHeader { }, frozenRow, ); - return cell; } } diff --git a/packages/s2-core/src/interaction/brush-selection/row-brush-selection.ts b/packages/s2-core/src/interaction/brush-selection/row-brush-selection.ts index 57e842c95d..91df80b66a 100644 --- a/packages/s2-core/src/interaction/brush-selection/row-brush-selection.ts +++ b/packages/s2-core/src/interaction/brush-selection/row-brush-selection.ts @@ -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, @@ -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); }); }