diff --git a/.github/workflows/issue-labeled.yml b/.github/workflows/issue-labeled.yml index 31f9629bdf..5c3c766305 100644 --- a/.github/workflows/issue-labeled.yml +++ b/.github/workflows/issue-labeled.yml @@ -129,7 +129,7 @@ jobs: body: | 你好 @${{ github.event.issue.user.login }},该功能或缺陷已经在 `2.0 next 版本` 中支持或修复,`next` 版本目前处于内测中, 感谢你的支持与理解。 - 如有任何 `2.0 版本` 问题,请前往[讨论区](https://github.com/antvis/S2/discussions/1933),正式版预计年底发布 (文档施工中 🚧), 抢先试用: + 如有任何 `2.0 版本` 问题,请前往[讨论区](https://github.com/antvis/S2/discussions/1933) 或 [查看文档](https://s2.antv.antgroup.com), 抢先试用: ```bash yarn add @antv/s2@next @@ -139,4 +139,4 @@ jobs: Hello, @${{ github.event.issue.user.login }}, This feature or flaw has been supported or fixed in `2.0 next version`, `next` version is currently in private beta, thank you for your support and understanding. - Any `2.0` version issues, please go to [discussion](https://github.com/antvis/S2/discussions/1933), which released the official version is expected to the end (document 🚧) during construction, the first trial: + Any `2.0` version issues, please go to [discussion](https://github.com/antvis/S2/discussions/1933), or [view docs](https://s2.antv.antgroup.com), the first trial: diff --git a/.github/workflows/pr-labeled.yml b/.github/workflows/pr-labeled.yml index 1f7752edd8..5888c6a7df 100644 --- a/.github/workflows/pr-labeled.yml +++ b/.github/workflows/pr-labeled.yml @@ -16,7 +16,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ github.event.pull_request.number }} body: | - 你好 @${{ github.event.pull_request.user.login }},感谢你的贡献, 为了让代码更健壮, 请补充相应单元测试, 如果有 API 改动, 请修改 [相应的文档](https://github.com/antvis/S2/tree/master/s2-site) + 你好 @${{ github.event.pull_request.user.login }},感谢你的贡献, 为了让代码更健壮, 请根据 [贡献指南](https://s2.antv.antgroup.com/manual/contribution) 补充相应单元测试, 如果有 API 改动, 请修改 [相应的文档](https://github.com/antvis/S2/tree/master/s2-site) Hello, @${{ github.event.pull_request.user.login }}, Thanks for your contribution. In order to make the code more robust, please add the corresponding unit tests, and update the [docs](https://github.com/antvis/S2/tree/master/s2-site) if there are API changes. diff --git a/packages/s2-core/__tests__/bugs/issue-2582-spec.ts b/packages/s2-core/__tests__/bugs/issue-2582-spec.ts new file mode 100644 index 0000000000..f4755f351e --- /dev/null +++ b/packages/s2-core/__tests__/bugs/issue-2582-spec.ts @@ -0,0 +1,49 @@ +/** + * 透视表分页功能,以树状结构展示行维度,切换分页,在点击角头行图标,表格数据渲染异常 + * @description spec for issue #2582 + * https://github.com/antvis/S2/issues/2582 + */ + +import { createPivotSheet } from '../util/helpers'; +import type { S2Options, SpreadSheet } from '@/index'; + +const s2Options: S2Options = { + width: 400, + height: 400, + hierarchyType: 'tree', + pagination: { + current: 2, + pageSize: 4, + }, +}; + +describe('PivotSheet Tree Mode Pagination Layout Tests', () => { + let s2: SpreadSheet; + + beforeEach(async () => { + s2 = createPivotSheet(s2Options); + await s2.render(); + }); + + test('should render correctly when row header wider than canvas if hierarchyCollapse enable', async () => { + s2.setOptions({ + style: { + rowCell: { + collapseAll: true, + }, + }, + }); + await s2.render(false); + + expect(s2.facet.panelGroup.getBBox()).toEqual({ + bottom: 92, + height: 30, + left: 122, + right: 400, + top: 62, + width: 278, + x: 122, + y: 62, + }); + }); +}); diff --git a/packages/s2-core/src/facet/pivot-facet.ts b/packages/s2-core/src/facet/pivot-facet.ts index 68c70fa5eb..77265f815a 100644 --- a/packages/s2-core/src/facet/pivot-facet.ts +++ b/packages/s2-core/src/facet/pivot-facet.ts @@ -938,7 +938,7 @@ export class PivotFacet extends FrozenFacet { return { getTotalHeight: () => last(heights) || 0, - getCellOffsetY: (index: number) => heights[index], + getCellOffsetY: (index: number) => heights[index] || 0, // 多了一个数据 [0] getTotalLength: () => heights.length - 1, getIndexRange: (minHeight: number, maxHeight: number) =>