-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 交叉表支持冻结首行 * feat: 调整冻结实现逻辑 & CR遗留问题 & 行头部分重构实现 * fix: 修复 CR 系列反馈的问题 * fix: 修复二轮 CR 反馈的问题 --------- Co-authored-by: wuding.why <wuding.why@alibaba-inc.com>
- Loading branch information
Showing
37 changed files
with
1,279 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
packages/s2-core/__tests__/unit/facet/header/frozen-row-spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { createPivotSheet } from 'tests/util/helpers'; | ||
import { get } from 'lodash'; | ||
import { DEFAULT_OPTIONS } from '@/common'; | ||
|
||
import { FrozenRowCell, SeriesNumberCell } from '@/cell'; | ||
import { PivotRowHeader } from '@/facet/header'; | ||
import { SeriesNumberHeader } from '@/facet/header/series-number'; | ||
|
||
const s2 = createPivotSheet( | ||
{ | ||
...DEFAULT_OPTIONS, | ||
frozenFirstRowPivot: true, | ||
totals: { row: { showGrandTotals: true, reverseLayout: true } }, | ||
showSeriesNumber: true, | ||
}, | ||
{ useSimpleData: false }, | ||
); | ||
describe('Frozen Row Header Test', () => { | ||
test.each(['grid', 'tree'])( | ||
'frozen row header group api', | ||
(hierarchyType: 'grid' | 'tree') => { | ||
s2.setOptions({ hierarchyType }); | ||
s2.render(); | ||
const rowHeader: PivotRowHeader = s2.facet.rowHeader as PivotRowHeader; | ||
|
||
expect(rowHeader instanceof PivotRowHeader).toBeTrue(); | ||
expect(rowHeader.frozenHeadGroup).toBeTruthy(); | ||
expect(rowHeader.scrollGroup).toBeTruthy(); | ||
|
||
expect(rowHeader.frozenHeadGroup.getChildren()).toHaveLength(1); | ||
const frozenRowCell = rowHeader.frozenHeadGroup.getChildren()[0]; | ||
|
||
expect(frozenRowCell instanceof FrozenRowCell).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(get(frozenRowCell, 'meta.height')).toEqual(30); | ||
|
||
expect(rowHeader.getFrozenFirstRowHeight()).toBe(30); | ||
}, | ||
); | ||
}); | ||
|
||
describe('Frozen Series Number Test', () => { | ||
test.each(['grid', 'tree'])( | ||
'series number test', | ||
(hierarchyType: 'grid' | 'tree') => { | ||
s2.setOptions({ hierarchyType }); | ||
s2.render(); | ||
const rowIndexHeader: SeriesNumberHeader = s2.facet | ||
.rowIndexHeader as SeriesNumberHeader; | ||
expect(rowIndexHeader instanceof SeriesNumberHeader).toBe(true); | ||
|
||
const seriesNumberCell = rowIndexHeader.frozenHeadGroup.getChildren(); | ||
expect(seriesNumberCell).toHaveLength(1); | ||
|
||
expect( | ||
rowIndexHeader.scrollGroup.getChildren()[0] instanceof SeriesNumberCell, | ||
).toBe(true); | ||
|
||
expect(seriesNumberCell[0] instanceof SeriesNumberCell).toBe(true); | ||
|
||
expect(get(seriesNumberCell[0], 'meta.height')).toBe(30); | ||
}, | ||
); | ||
}); |
Oops, something went wrong.
b81b795
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
antvis-s2 – ./
antvis-s2-git-master-xuexiao-family.vercel.app
antvis-s2-xuexiao-family.vercel.app
antvis-s2.vercel.app