Skip to content

Commit

Permalink
refactor: frozenRowCell 重命名为 rowCell (#2450)
Browse files Browse the repository at this point in the history
* refactor: frozenRowCell 重命名为 rowCell

* chore: 类型修改

* fix: 修复行头滚动刷选获取到错误的实例
  • Loading branch information
lijinke666 authored Dec 5, 2023
1 parent 07f7201 commit 8a67d4b
Show file tree
Hide file tree
Showing 28 changed files with 688 additions and 607 deletions.
2 changes: 1 addition & 1 deletion packages/s2-core/__tests__/unit/cell/row-cell-spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { get } from 'lodash';
import { createPivotSheet } from 'tests/util/helpers';
import type { RowCell } from '@antv/s2';
import type { Group } from '@antv/g-canvas';
import type { RowCell } from '../../../src/cell';
import type { SpreadSheet } from '@/sheet-type';
import type { TextAlign } from '@/common';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createPivotSheet } from 'tests/util/helpers';
import { get } from 'lodash';
import { RowCell } from '../../../../src/cell/row-cell';
import { DEFAULT_OPTIONS } from '@/common';

import { FrozenRowCell, SeriesNumberCell } from '@/cell';
import { SeriesNumberCell } from '@/cell';
import { PivotRowHeader } from '@/facet/header';
import { SeriesNumberHeader } from '@/facet/header/series-number';

Expand Down Expand Up @@ -31,13 +31,13 @@ describe('Frozen Row Header Test', () => {
expect(rowHeader.frozenHeadGroup.getChildren()).toHaveLength(1);
const frozenRowCell = rowHeader.frozenHeadGroup.getChildren()[0];

expect(frozenRowCell instanceof FrozenRowCell).toBeTrue();
expect(frozenRowCell instanceof RowCell).toBeTrue();
expect(get(frozenRowCell, 'meta.height')).toEqual(30);

expect(rowHeader.scrollGroup.getChildren()).toHaveLength(10);
const scrollCell = rowHeader.scrollGroup.getChildren()[0];

expect(scrollCell instanceof FrozenRowCell).toBeTrue();
expect(scrollCell instanceof RowCell).toBeTrue();
expect(get(frozenRowCell, 'meta.height')).toEqual(30);

expect(rowHeader.getFrozenFirstRowHeight()).toBe(30);
Expand Down
11 changes: 4 additions & 7 deletions packages/s2-core/__tests__/unit/facet/pivot-facet-frozen-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
import type { IGroup } from '@antv/g-canvas';
import { get } from 'lodash';
import { createPivotSheet } from 'tests/util/helpers';

import type { PivotSheet, S2Options } from '@antv/s2';
import { FrozenRowCell, SeriesNumberCell } from '@/cell';
import { type PivotSheet, RowCell, SeriesNumberCell } from '../../../src';
import {
FrozenGroup,
KEY_GROUP_ROW_HEADER_FROZEN,
KEY_GROUP_ROW_SCROLL,
type S2Options,
} from '@/common';
import type { FrozenFacet } from '@/facet/frozen-facet';
import { getFrozenRowCfgPivot } from '@/facet/utils';
Expand Down Expand Up @@ -371,12 +370,10 @@ describe('test frozen group', () => {
scrollHeaderGroup as IGroup
).getChildren();
expect(frozenRowGroupChildren).toHaveLength(1);
expect(frozenRowGroupChildren[0] instanceof FrozenRowCell).toBe(true);
expect(frozenRowGroupChildren[0] instanceof RowCell).toBeTruthy();
expect(get(frozenRowGroupChildren[0], 'meta.value')).toBe('总计');
expect(scrollRowHeaderGroupChildren).toHaveLength(10);
expect(scrollRowHeaderGroupChildren[0] instanceof FrozenRowCell).toBe(
true,
);
expect(scrollRowHeaderGroupChildren[0] instanceof RowCell).toBeTruthy();
expect(get(scrollRowHeaderGroupChildren[0], 'meta.value')).toBe('浙江省');

// serial number header
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import {
sleep,
} from 'tests/util/helpers';
import type { Event as GEvent } from '@antv/g-canvas';
import type { InteractionCellHighlight } from '@antv/s2';
import type { S2Options } from '@/common/interface';
import type { InteractionCellHighlight, S2Options } from '@/common/interface';
import type { SpreadSheet } from '@/sheet-type';
import {
HOVER_FOCUS_DURATION,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Node } from '@antv/s2';
import type { Node } from '../../../../src';
import { CellTypes, type HeaderActionIcon } from '@/common';
import { getActionIconConfig } from '@/utils/cell/header-cell';

Expand Down
3 changes: 1 addition & 2 deletions packages/s2-core/__tests__/unit/utils/export/copy-spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import type { S2DataConfig } from '@antv/s2';
import { assembleDataCfg, assembleOptions, TOTALS_OPTIONS } from 'tests/util';
import { getContainer } from 'tests/util/helpers';
import { data as originalData, totalData } from 'tests/data/mock-dataset.json';
import { map } from 'lodash';
import type { S2DataConfig } from '../../../../src/common';
import { TableSheet, PivotSheet } from '@/sheet-type';

import {
CellTypes,
InteractionStateName,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { RowCell } from '../../../../src/cell';
import { getCellMeta } from '@/utils/interaction/select-event';
import type { RowCell } from '@/cell/row-cell';
import { CellTypes, InteractionStateName } from '@/common/constant/interaction';
import type { S2Options } from '@/common/interface';
import { Store } from '@/common/store';
Expand Down
Loading

1 comment on commit 8a67d4b

@vercel
Copy link

@vercel vercel bot commented on 8a67d4b Dec 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.