diff --git a/packages/s2-react/__tests__/spreadsheet/drill-down-spec.tsx b/packages/s2-react/__tests__/spreadsheet/drill-down-spec.tsx index 4145d28cbf..bc3f5ffe52 100644 --- a/packages/s2-react/__tests__/spreadsheet/drill-down-spec.tsx +++ b/packages/s2-react/__tests__/spreadsheet/drill-down-spec.tsx @@ -32,15 +32,13 @@ const partDrillDownParams: SheetComponentsProps['partDrillDown'] = { }), }; -const findDrillDownIcon = (instance: SpreadSheet) => { - const rowHeaderActionIcons = instance.facet +const findDrillDownIcon = (s2: SpreadSheet) => { + const rowHeaderActionIcons = s2.facet ?.getRowCells() ?.find((cell) => cell.getActualText() === '杭州') ?.getActionIcons(); - return rowHeaderActionIcons?.find( - (icon) => icon.attr('name') === 'DrillDownIcon', - ); + return rowHeaderActionIcons?.find((icon) => icon.name === 'DrillDownIcon'); }; describe('Spread Sheet Drill Down Tests', () => { diff --git a/packages/s2-react/__tests__/spreadsheet/filter-sheet-spec.tsx b/packages/s2-react/__tests__/spreadsheet/filter-sheet-spec.tsx index a935a408b7..d92a210ab7 100644 --- a/packages/s2-react/__tests__/spreadsheet/filter-sheet-spec.tsx +++ b/packages/s2-react/__tests__/spreadsheet/filter-sheet-spec.tsx @@ -2,6 +2,8 @@ import { DeviceType, S2Event, SpreadSheet, type S2DataConfig } from '@antv/s2'; import { Button, Space } from 'antd'; import React from 'react'; +import { waitFor } from '@testing-library/react'; +import type { Root } from 'react-dom/client'; import { getContainer, getMockData, @@ -120,67 +122,33 @@ function MainLayout() { describe('table sheet filter spec', () => { let container: HTMLDivElement; + let unmount: Root['unmount']; + const filterKey = 'customer_type'; const filteredValue = '消费者'; beforeEach(() => { container = getContainer(); - renderComponent(); + unmount = renderComponent(); }); afterEach(() => { container?.remove(); + unmount?.(); }); test('filter customer_type values', async () => { - await sleep(1000); - - s2.emit(S2Event.RANGE_FILTER, { - filterKey, - filteredValues: [filteredValue], - }); - - expect(s2.facet.getCellRange()).toStrictEqual({ - end: 465, - start: 0, - }); - expect(s2.dataSet.getDisplayDataSet()).toHaveLength(466); - expect( - s2.dataSet - .getDisplayDataSet() - .some((item) => item['customer_type'] === filteredValue), - ).toBeFalsy(); - }); - - test('reset filter params on customer_type', async () => { - await sleep(1000); - - s2.emit(S2Event.RANGE_FILTER, { - filterKey, - filteredValues: [filteredValue], - }); - - s2.emit(S2Event.RANGE_FILTER, { - filterKey, - filteredValues: [], - }); - - expect(s2.facet.getCellRange()).toStrictEqual({ - end: 999, - start: 0, - }); - expect(s2.dataSet.getDisplayDataSet()).toHaveLength(1000); - }); - - test('filtered event fired with new data', async () => { - let dataLength = 0; - - await sleep(1000); - - s2.on(S2Event.RANGE_FILTERED, (data) => { - dataLength = data.length; - expect(data.length).toStrictEqual(466); + await waitFor(() => { + s2.emit(S2Event.RANGE_FILTER, { + filterKey, + filteredValues: [filteredValue], + }); + + expect(s2.facet.getCellRange()).toStrictEqual({ + end: 465, + start: 0, + }); expect(s2.dataSet.getDisplayDataSet()).toHaveLength(466); expect( s2.dataSet @@ -188,35 +156,72 @@ describe('table sheet filter spec', () => { .some((item) => item['customer_type'] === filteredValue), ).toBeFalsy(); }); + }); - s2.emit(S2Event.RANGE_FILTER, { - filterKey, - filteredValues: [filteredValue], + test('reset filter params on customer_type', async () => { + await waitFor(() => { + s2.emit(S2Event.RANGE_FILTER, { + filterKey, + filteredValues: [filteredValue], + }); + + s2.emit(S2Event.RANGE_FILTER, { + filterKey, + filteredValues: [], + }); + + expect(s2.facet.getCellRange()).toStrictEqual({ + end: 999, + start: 0, + }); + expect(s2.dataSet.getDisplayDataSet()).toHaveLength(1000); }); + }); - await sleep(50); - - expect(dataLength).toStrictEqual(468); + test('filtered event fired with new data', async () => { + await waitFor(async () => { + let dataLength = 0; + + s2.on(S2Event.RANGE_FILTERED, (data) => { + dataLength = data.length; + expect(data.length).toStrictEqual(466); + expect(s2.dataSet.getDisplayDataSet()).toHaveLength(466); + expect( + s2.dataSet + .getDisplayDataSet() + .some((item) => item['customer_type'] === filteredValue), + ).toBeFalsy(); + }); + + s2.emit(S2Event.RANGE_FILTER, { + filterKey, + filteredValues: [filteredValue], + }); + + await sleep(50); + + expect(dataLength).toStrictEqual(466); + }); }); test('falsy/nullish data should not be filtered with irrelevant filter params', async () => { - let dataLength = 0; + await waitFor(async () => { + let dataLength = 0; - await sleep(1000); + s2.on(S2Event.RANGE_FILTERED, (data) => { + dataLength = data.length; + expect(data.length).toStrictEqual(1000); + expect(s2.dataSet.getDisplayDataSet()).toHaveLength(1000); + }); - s2.on(S2Event.RANGE_FILTERED, (data) => { - dataLength = data.length; - expect(data.length).toStrictEqual(1000); - expect(s2.dataSet.getDisplayDataSet()).toHaveLength(1000); - }); + s2.emit(S2Event.RANGE_FILTER, { + filterKey: 'express_type', + filteredValues: ['消费者'], + }); - s2.emit(S2Event.RANGE_FILTER, { - filterKey: 'express_type', - filteredValues: ['消费者'], - }); - - await sleep(50); + await sleep(200); - expect(dataLength).toStrictEqual(468); + expect(dataLength).toStrictEqual(1000); + }); }); }); diff --git a/packages/s2-react/__tests__/unit/components/sheets/strategy-sheet/__snapshots__/index-spec.tsx.snap b/packages/s2-react/__tests__/unit/components/sheets/strategy-sheet/__snapshots__/index-spec.tsx.snap index cb8da06994..38c5b643e0 100644 --- a/packages/s2-react/__tests__/unit/components/sheets/strategy-sheet/__snapshots__/index-spec.tsx.snap +++ b/packages/s2-react/__tests__/unit/components/sheets/strategy-sheet/__snapshots__/index-spec.tsx.snap @@ -15,6 +15,36 @@ exports[` Tests StrategySheet Export Tests should export correct 指标E 自定义节点D " `; +exports[` Tests StrategySheet Export Tests should export correct data for custom corner text 1`] = ` +" 日期 2022-09 2022-10 2022-11 2021年净增完成度 趋势 2022 + 指标 数值 环比 同比 数值 环比 数值 环比 同比 净增完成度 趋势 数值 环比 +自定义节点A - +自定义节点A 指标A 377 3877 4324 42% - - 377 +自定义节点A 指标A 指标B 377 324 377 324 -0.02 - - 377 324 +自定义节点A 指标A 自定义节点B +自定义节点A 指标A 指标C 324 377 0 - - 324 +自定义节点A 指标A 指标D 377 324 377 324 0.02 - - 377 324 +自定义节点A 自定义节点E +指标E 377 324 0.02 - - +指标E 自定义节点C +指标E 自定义节点D " +`; + +exports[` Tests StrategySheet Export Tests should export correct data for default corner text 1`] = ` +" 日期 2022-09 2022-10 2022-11 2021年净增完成度 趋势 2022 + 指标 数值 环比 同比 数值 环比 数值 环比 同比 净增完成度 趋势 数值 环比 +自定义节点A - +自定义节点A 指标A 377 3877 4324 42% - - 377 +自定义节点A 指标A 指标B 377 324 377 324 -0.02 - - 377 324 +自定义节点A 指标A 自定义节点B +自定义节点A 指标A 指标C 324 377 0 - - 324 +自定义节点A 指标A 指标D 377 324 377 324 0.02 - - 377 324 +自定义节点A 自定义节点E +指标E 377 324 0.02 - - +指标E 自定义节点C +指标E 自定义节点D " +`; + exports[` Tests StrategySheet Export Tests should export correct data for empty cell 1`] = ` " 日期 2022-09 2022-10 2022-11 2021年净增完成度 趋势 2022 指标 数值 环比 同比 数值 环比 数值 环比 同比 净增完成度 趋势 数值 环比 diff --git a/packages/s2-react/__tests__/unit/components/sheets/strategy-sheet/index-spec.tsx b/packages/s2-react/__tests__/unit/components/sheets/strategy-sheet/index-spec.tsx index cfaac2be21..b63fbc5ebf 100644 --- a/packages/s2-react/__tests__/unit/components/sheets/strategy-sheet/index-spec.tsx +++ b/packages/s2-react/__tests__/unit/components/sheets/strategy-sheet/index-spec.tsx @@ -189,15 +189,16 @@ describe(' Tests', () => { }); }); - test('should get custom corner extra field text', () => { + test('should get custom corner extra field text', async () => { const cornerExtraFieldText = '自定义'; - const s2DataCfg = { + const s2DataCfg: Partial = { fields: { ...StrategySheetDataConfig.fields, valueInCols: false, }, }; - const s2Options = { + + const s2Options: SheetComponentOptions = { cornerExtraFieldText, }; @@ -206,16 +207,17 @@ describe(' Tests', () => { ...s2DataCfg, }); - const cornerNode = s2.facet - .getCornerNodes() - .find((node) => node.cornerType === CornerNodeType.Row); + await waitFor(() => { + const cornerNode = s2.facet + .getCornerNodes() + .find((node) => node.cornerType === CornerNodeType.Row); - const textList = s2.facet - .getCornerCells() - .map((cell) => cell.getActualText()); + const textList = s2.facet.getCornerNodes().map((node) => node.value); + const cornerText = `自定义节点A/指标E/${cornerExtraFieldText}`; - expect(textList).toEqual([cornerExtraFieldText, '日期']); - expect(cornerNode!.value).toEqual(cornerExtraFieldText); + expect(textList).toEqual([cornerText, '日期']); + expect(cornerNode!.value).toEqual(cornerText); + }); }); test('should format corner date field', async () => { @@ -240,7 +242,7 @@ describe(' Tests', () => { .getCornerCells() .map((cell) => cell.getActualText()); - expect(cornerTextList).toEqual(['自定义节点A/指标E/指标', '日期']); + expect(cornerTextList).toEqual(['自定义节点A/指标E/数值', '日期']); }); }); @@ -316,6 +318,30 @@ describe(' Tests', () => { }); }); + test('should export correct data for default corner text', async () => { + await waitFor(() => { + s2.setOptions({ + cornerText: undefined, + }); + + const result = strategyCopy(s2, '\t', true); + + expect(result).toMatchSnapshot(); + }); + }); + + test('should export correct data for custom corner text', async () => { + await waitFor(() => { + s2.setOptions({ + cornerText: '自定义', + }); + + const result = strategyCopy(s2, '\t', true); + + expect(result).toMatchSnapshot(); + }); + }); + test('should export correct data for multi different cycle compare data', async () => { await waitFor(() => { /* diff --git a/packages/s2-react/__tests__/unit/components/tooltip/__snapshots__/index-spec.tsx.snap b/packages/s2-react/__tests__/unit/components/tooltip/__snapshots__/index-spec.tsx.snap index 7958b81bef..36062f9a4a 100644 --- a/packages/s2-react/__tests__/unit/components/tooltip/__snapshots__/index-spec.tsx.snap +++ b/packages/s2-react/__tests__/unit/components/tooltip/__snapshots__/index-spec.tsx.snap @@ -28,7 +28,7 @@ exports[`Tooltip Common Components Tests render TooltipHead 1`] = `
- 一二线城市,有信用卡 / 学生 / 20岁以下 + 一二线城市,有信用卡/学生/20岁以下
`; @@ -54,7 +54,7 @@ exports[`Tooltip Common Components Tests render TooltipSummary 1`] = ` - A人群 (总和) + A人群(总和) - B人群 (总和) + B人群(总和) - 差值 (总和) + 差值(总和) { }); test('render TooltipDetail', () => { - const list = [ + const list: TooltipDetailListItem[] = [ { name: '20岁以下', value: '20.5%', @@ -173,8 +175,11 @@ describe('Tooltip Common Components Tests', () => { }); test('render TooltipHead', () => { - const cols = [{ name: '所在城市', value: '一二线城市' }]; - const rows = [ + const cols: TooltipDetailListItem[] = [ + { name: '所在城市', value: '一二线城市' }, + ]; + + const rows: TooltipDetailListItem[] = [ { name: '类别', value: '有信用卡' }, { name: '职业', value: '学生' }, { name: '年龄分布', value: '20岁以下' }, @@ -185,11 +190,11 @@ describe('Tooltip Common Components Tests', () => { ); expect(asFragment()).toMatchSnapshot(); - expect(getByText('一二线城市,有信用卡 / 学生 / 20岁以下')).toBeTruthy(); + expect(getByText('一二线城市,有信用卡/学生/20岁以下')).toBeTruthy(); }); test('render TooltipSummary', () => { - const summaries = [ + const summaries: TooltipSummaryOptions[] = [ { name: 'A人群', selectedData: Array(30), value: '495.48 %' }, { name: 'B人群', selectedData: Array(30), value: '494.52%' }, { name: '差值', selectedData: Array(30), value: '+381%' }, diff --git a/packages/s2-react/__tests__/unit/utils/__snapshots__/build-table-hierarchy-spec.tsx.snap b/packages/s2-react/__tests__/unit/utils/__snapshots__/build-table-hierarchy-spec.tsx.snap deleted file mode 100644 index 36ce2b1f24..0000000000 --- a/packages/s2-react/__tests__/unit/utils/__snapshots__/build-table-hierarchy-spec.tsx.snap +++ /dev/null @@ -1,668 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`buildTableHierarchy should generate nodes and hierarchy correctly 1`] = ` -Object { - "belongsCell": undefined, - "children": Array [ - Object { - "belongsCell": undefined, - "children": Array [], - "colIndex": -1, - "extra": undefined, - "field": "$$series_number$$", - "height": 0, - "id": "root[&]序号", - "inCollapseNode": undefined, - "isCollapsed": false, - "isGrandTotals": false, - "isLeaf": true, - "isPivotMode": undefined, - "isSubTotals": false, - "isTotalMeasure": false, - "isTotalRoot": false, - "isTotals": false, - "key": "$$series_number$$", - "label": "序号", - "level": 0, - "padding": 0, - "query": Object { - "$$series_number$$": "序号", - }, - "rowIndex": 0, - "seriesNumberWidth": undefined, - "value": "序号", - "width": 0, - "x": 0, - "y": 0, - }, - Object { - "belongsCell": undefined, - "children": Array [], - "colIndex": -1, - "extra": undefined, - "field": "province", - "height": 0, - "id": "root[&]省份", - "inCollapseNode": undefined, - "isCollapsed": false, - "isGrandTotals": false, - "isLeaf": true, - "isPivotMode": undefined, - "isSubTotals": false, - "isTotalMeasure": false, - "isTotalRoot": false, - "isTotals": false, - "key": "province", - "label": "省份", - "level": 0, - "padding": 0, - "query": Object { - "province": "省份", - }, - "rowIndex": 1, - "seriesNumberWidth": undefined, - "value": "省份", - "width": 0, - "x": 0, - "y": 0, - }, - Object { - "belongsCell": undefined, - "children": Array [], - "colIndex": -1, - "extra": undefined, - "field": "city", - "height": 0, - "id": "root[&]城市", - "inCollapseNode": undefined, - "isCollapsed": false, - "isGrandTotals": false, - "isLeaf": true, - "isPivotMode": undefined, - "isSubTotals": false, - "isTotalMeasure": false, - "isTotalRoot": false, - "isTotals": false, - "key": "city", - "label": "城市", - "level": 0, - "padding": 0, - "query": Object { - "city": "城市", - }, - "rowIndex": 2, - "seriesNumberWidth": undefined, - "value": "城市", - "width": 0, - "x": 0, - "y": 0, - }, - Object { - "belongsCell": undefined, - "children": Array [], - "colIndex": -1, - "extra": undefined, - "field": "type", - "height": 0, - "id": "root[&]类别", - "inCollapseNode": undefined, - "isCollapsed": false, - "isGrandTotals": false, - "isLeaf": true, - "isPivotMode": undefined, - "isSubTotals": false, - "isTotalMeasure": false, - "isTotalRoot": false, - "isTotals": false, - "key": "type", - "label": "类别", - "level": 0, - "padding": 0, - "query": Object { - "type": "类别", - }, - "rowIndex": 3, - "seriesNumberWidth": undefined, - "value": "类别", - "width": 0, - "x": 0, - "y": 0, - }, - Object { - "belongsCell": undefined, - "children": Array [], - "colIndex": -1, - "extra": undefined, - "field": "sub_type", - "height": 0, - "id": "root[&]子类别", - "inCollapseNode": undefined, - "isCollapsed": false, - "isGrandTotals": false, - "isLeaf": true, - "isPivotMode": undefined, - "isSubTotals": false, - "isTotalMeasure": false, - "isTotalRoot": false, - "isTotals": false, - "key": "sub_type", - "label": "子类别", - "level": 0, - "padding": 0, - "query": Object { - "sub_type": "子类别", - }, - "rowIndex": 4, - "seriesNumberWidth": undefined, - "value": "子类别", - "width": 0, - "x": 0, - "y": 0, - }, - Object { - "belongsCell": undefined, - "children": Array [], - "colIndex": -1, - "extra": undefined, - "field": "number", - "height": 0, - "id": "root[&]数量", - "inCollapseNode": undefined, - "isCollapsed": false, - "isGrandTotals": false, - "isLeaf": true, - "isPivotMode": undefined, - "isSubTotals": false, - "isTotalMeasure": false, - "isTotalRoot": false, - "isTotals": false, - "key": "number", - "label": "数量", - "level": 0, - "padding": 0, - "query": Object { - "number": "数量", - }, - "rowIndex": 5, - "seriesNumberWidth": undefined, - "value": "数量", - "width": 0, - "x": 0, - "y": 0, - }, - ], - "colIndex": -1, - "extra": undefined, - "field": undefined, - "height": 0, - "id": "root", - "inCollapseNode": undefined, - "isCollapsed": undefined, - "isGrandTotals": undefined, - "isLeaf": undefined, - "isPivotMode": undefined, - "isSubTotals": undefined, - "isTotalMeasure": undefined, - "isTotalRoot": undefined, - "isTotals": undefined, - "key": "", - "label": "", - "level": undefined, - "padding": 0, - "query": undefined, - "rowIndex": undefined, - "seriesNumberWidth": undefined, - "value": "", - "width": 0, - "x": 0, - "y": 0, -} -`; - -exports[`buildTableHierarchy should generate nodes and hierarchy correctly 2`] = ` -Hierarchy { - "allNodesWithoutRoot": Array [ - Object { - "belongsCell": undefined, - "children": Array [], - "colIndex": -1, - "extra": undefined, - "field": "$$series_number$$", - "height": 0, - "id": "root[&]序号", - "inCollapseNode": undefined, - "isCollapsed": false, - "isGrandTotals": false, - "isLeaf": true, - "isPivotMode": undefined, - "isSubTotals": false, - "isTotalMeasure": false, - "isTotalRoot": false, - "isTotals": false, - "key": "$$series_number$$", - "label": "序号", - "level": 0, - "padding": 0, - "query": Object { - "$$series_number$$": "序号", - }, - "rowIndex": 0, - "seriesNumberWidth": undefined, - "value": "序号", - "width": 0, - "x": 0, - "y": 0, - }, - Object { - "belongsCell": undefined, - "children": Array [], - "colIndex": -1, - "extra": undefined, - "field": "province", - "height": 0, - "id": "root[&]省份", - "inCollapseNode": undefined, - "isCollapsed": false, - "isGrandTotals": false, - "isLeaf": true, - "isPivotMode": undefined, - "isSubTotals": false, - "isTotalMeasure": false, - "isTotalRoot": false, - "isTotals": false, - "key": "province", - "label": "省份", - "level": 0, - "padding": 0, - "query": Object { - "province": "省份", - }, - "rowIndex": 1, - "seriesNumberWidth": undefined, - "value": "省份", - "width": 0, - "x": 0, - "y": 0, - }, - Object { - "belongsCell": undefined, - "children": Array [], - "colIndex": -1, - "extra": undefined, - "field": "city", - "height": 0, - "id": "root[&]城市", - "inCollapseNode": undefined, - "isCollapsed": false, - "isGrandTotals": false, - "isLeaf": true, - "isPivotMode": undefined, - "isSubTotals": false, - "isTotalMeasure": false, - "isTotalRoot": false, - "isTotals": false, - "key": "city", - "label": "城市", - "level": 0, - "padding": 0, - "query": Object { - "city": "城市", - }, - "rowIndex": 2, - "seriesNumberWidth": undefined, - "value": "城市", - "width": 0, - "x": 0, - "y": 0, - }, - Object { - "belongsCell": undefined, - "children": Array [], - "colIndex": -1, - "extra": undefined, - "field": "type", - "height": 0, - "id": "root[&]类别", - "inCollapseNode": undefined, - "isCollapsed": false, - "isGrandTotals": false, - "isLeaf": true, - "isPivotMode": undefined, - "isSubTotals": false, - "isTotalMeasure": false, - "isTotalRoot": false, - "isTotals": false, - "key": "type", - "label": "类别", - "level": 0, - "padding": 0, - "query": Object { - "type": "类别", - }, - "rowIndex": 3, - "seriesNumberWidth": undefined, - "value": "类别", - "width": 0, - "x": 0, - "y": 0, - }, - Object { - "belongsCell": undefined, - "children": Array [], - "colIndex": -1, - "extra": undefined, - "field": "sub_type", - "height": 0, - "id": "root[&]子类别", - "inCollapseNode": undefined, - "isCollapsed": false, - "isGrandTotals": false, - "isLeaf": true, - "isPivotMode": undefined, - "isSubTotals": false, - "isTotalMeasure": false, - "isTotalRoot": false, - "isTotals": false, - "key": "sub_type", - "label": "子类别", - "level": 0, - "padding": 0, - "query": Object { - "sub_type": "子类别", - }, - "rowIndex": 4, - "seriesNumberWidth": undefined, - "value": "子类别", - "width": 0, - "x": 0, - "y": 0, - }, - Object { - "belongsCell": undefined, - "children": Array [], - "colIndex": -1, - "extra": undefined, - "field": "number", - "height": 0, - "id": "root[&]数量", - "inCollapseNode": undefined, - "isCollapsed": false, - "isGrandTotals": false, - "isLeaf": true, - "isPivotMode": undefined, - "isSubTotals": false, - "isTotalMeasure": false, - "isTotalRoot": false, - "isTotals": false, - "key": "number", - "label": "数量", - "level": 0, - "padding": 0, - "query": Object { - "number": "数量", - }, - "rowIndex": 5, - "seriesNumberWidth": undefined, - "value": "数量", - "width": 0, - "x": 0, - "y": 0, - }, - ], - "height": 0, - "indexNode": Array [ - Object { - "belongsCell": undefined, - "children": Array [], - "colIndex": -1, - "extra": undefined, - "field": "$$series_number$$", - "height": 0, - "id": "root[&]序号", - "inCollapseNode": undefined, - "isCollapsed": false, - "isGrandTotals": false, - "isLeaf": true, - "isPivotMode": undefined, - "isSubTotals": false, - "isTotalMeasure": false, - "isTotalRoot": false, - "isTotals": false, - "key": "$$series_number$$", - "label": "序号", - "level": 0, - "padding": 0, - "query": Object { - "$$series_number$$": "序号", - }, - "rowIndex": 0, - "seriesNumberWidth": undefined, - "value": "序号", - "width": 0, - "x": 0, - "y": 0, - }, - Object { - "belongsCell": undefined, - "children": Array [], - "colIndex": -1, - "extra": undefined, - "field": "province", - "height": 0, - "id": "root[&]省份", - "inCollapseNode": undefined, - "isCollapsed": false, - "isGrandTotals": false, - "isLeaf": true, - "isPivotMode": undefined, - "isSubTotals": false, - "isTotalMeasure": false, - "isTotalRoot": false, - "isTotals": false, - "key": "province", - "label": "省份", - "level": 0, - "padding": 0, - "query": Object { - "province": "省份", - }, - "rowIndex": 1, - "seriesNumberWidth": undefined, - "value": "省份", - "width": 0, - "x": 0, - "y": 0, - }, - Object { - "belongsCell": undefined, - "children": Array [], - "colIndex": -1, - "extra": undefined, - "field": "city", - "height": 0, - "id": "root[&]城市", - "inCollapseNode": undefined, - "isCollapsed": false, - "isGrandTotals": false, - "isLeaf": true, - "isPivotMode": undefined, - "isSubTotals": false, - "isTotalMeasure": false, - "isTotalRoot": false, - "isTotals": false, - "key": "city", - "label": "城市", - "level": 0, - "padding": 0, - "query": Object { - "city": "城市", - }, - "rowIndex": 2, - "seriesNumberWidth": undefined, - "value": "城市", - "width": 0, - "x": 0, - "y": 0, - }, - Object { - "belongsCell": undefined, - "children": Array [], - "colIndex": -1, - "extra": undefined, - "field": "type", - "height": 0, - "id": "root[&]类别", - "inCollapseNode": undefined, - "isCollapsed": false, - "isGrandTotals": false, - "isLeaf": true, - "isPivotMode": undefined, - "isSubTotals": false, - "isTotalMeasure": false, - "isTotalRoot": false, - "isTotals": false, - "key": "type", - "label": "类别", - "level": 0, - "padding": 0, - "query": Object { - "type": "类别", - }, - "rowIndex": 3, - "seriesNumberWidth": undefined, - "value": "类别", - "width": 0, - "x": 0, - "y": 0, - }, - Object { - "belongsCell": undefined, - "children": Array [], - "colIndex": -1, - "extra": undefined, - "field": "sub_type", - "height": 0, - "id": "root[&]子类别", - "inCollapseNode": undefined, - "isCollapsed": false, - "isGrandTotals": false, - "isLeaf": true, - "isPivotMode": undefined, - "isSubTotals": false, - "isTotalMeasure": false, - "isTotalRoot": false, - "isTotals": false, - "key": "sub_type", - "label": "子类别", - "level": 0, - "padding": 0, - "query": Object { - "sub_type": "子类别", - }, - "rowIndex": 4, - "seriesNumberWidth": undefined, - "value": "子类别", - "width": 0, - "x": 0, - "y": 0, - }, - Object { - "belongsCell": undefined, - "children": Array [], - "colIndex": -1, - "extra": undefined, - "field": "number", - "height": 0, - "id": "root[&]数量", - "inCollapseNode": undefined, - "isCollapsed": false, - "isGrandTotals": false, - "isLeaf": true, - "isPivotMode": undefined, - "isSubTotals": false, - "isTotalMeasure": false, - "isTotalRoot": false, - "isTotals": false, - "key": "number", - "label": "数量", - "level": 0, - "padding": 0, - "query": Object { - "number": "数量", - }, - "rowIndex": 5, - "seriesNumberWidth": undefined, - "value": "数量", - "width": 0, - "x": 0, - "y": 0, - }, - ], - "maxLevel": 0, - "sampleNodeForLastLevel": Object { - "belongsCell": undefined, - "children": Array [], - "colIndex": -1, - "extra": undefined, - "field": "$$series_number$$", - "height": 0, - "id": "root[&]序号", - "inCollapseNode": undefined, - "isCollapsed": false, - "isGrandTotals": false, - "isLeaf": true, - "isPivotMode": undefined, - "isSubTotals": false, - "isTotalMeasure": false, - "isTotalRoot": false, - "isTotals": false, - "key": "$$series_number$$", - "label": "序号", - "level": 0, - "padding": 0, - "query": Object { - "$$series_number$$": "序号", - }, - "rowIndex": 0, - "seriesNumberWidth": undefined, - "value": "序号", - "width": 0, - "x": 0, - "y": 0, - }, - "sampleNodesForAllLevels": Array [ - Object { - "belongsCell": undefined, - "children": Array [], - "colIndex": -1, - "extra": undefined, - "field": "$$series_number$$", - "height": 0, - "id": "root[&]序号", - "inCollapseNode": undefined, - "isCollapsed": false, - "isGrandTotals": false, - "isLeaf": true, - "isPivotMode": undefined, - "isSubTotals": false, - "isTotalMeasure": false, - "isTotalRoot": false, - "isTotals": false, - "key": "$$series_number$$", - "label": "序号", - "level": 0, - "padding": 0, - "query": Object { - "$$series_number$$": "序号", - }, - "rowIndex": 0, - "seriesNumberWidth": undefined, - "value": "序号", - "width": 0, - "x": 0, - "y": 0, - }, - ], - "width": 0, -} -`; diff --git a/packages/s2-vue/playground/App.vue b/packages/s2-vue/playground/App.vue index 1c398a65c3..dcd6ffd98f 100644 --- a/packages/s2-vue/playground/App.vue +++ b/packages/s2-vue/playground/App.vue @@ -1,6 +1,6 @@