Skip to content

Commit

Permalink
feat(perf): 优化 dataset 数据结构转化性能 (#2379)
Browse files Browse the repository at this point in the history
Co-authored-by: JuZe <[email protected]>
Co-authored-by: Wenjun Xu <[email protected]>
Co-authored-by: Jinke Li <[email protected]>
Co-authored-by: NoobNot <[email protected]>
Co-authored-by: lijinke666 <[email protected]>
Co-authored-by: semantic-release-bot <[email protected]>
Co-authored-by: zishang <[email protected]>
fix: 修复树状模式下总计节点的指标节点没有被格式化数据 (#2353)
fix(layout): 修复隐藏结点时对父节点的布局计算错误 close #2355 (#2360)
fix(layout): 修复隐藏结点时对父节点的布局计算错误 close #2355
close #2362 (#2363)
fix(table-sheet): 明细表数据为空时错误的展示一行空数据 close #2255 (#2357)
fix(table-sheet): 明细表数据为空时错误的展示一行空数据 close #2255
fix: 列头绘制多列文本时错误的使用了数值单元格的样式 close #2359 (#2364)
fix: 修复分组汇总时,按汇总排序获取排序数据为空 (#2370)
  • Loading branch information
6 people authored Nov 29, 2023
1 parent 0fcc8fd commit 924da53
Show file tree
Hide file tree
Showing 109 changed files with 4,688 additions and 4,260 deletions.
2,485 changes: 1,162 additions & 1,323 deletions packages/s2-core/CHANGELOG.md

Large diffs are not rendered by default.

50 changes: 15 additions & 35 deletions packages/s2-core/__tests__/bugs/issue-725-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,11 @@ import { assembleDataCfg } from '../util';
import type { S2DataConfig } from '@/common/interface';
import { PivotSheet } from '@/sheet-type';
import { PivotDataSet } from '@/data-set';
import { EXTRA_FIELD } from '@/common/constant';
import { getDimensionsWithoutPathPre } from '@/utils/dataset/pivot-data-set';

jest.mock('@/sheet-type');

const MockPivotSheet = PivotSheet as unknown as jest.Mock<PivotSheet>;
let dataSet: PivotDataSet;

describe('Multi Measure Correct Render Tests1', () => {
const dataCfg: S2DataConfig = assembleDataCfg({
...mockDataConfig,
});

beforeEach(() => {
MockPivotSheet.mockClear();
const mockSheet = new MockPivotSheet();
dataSet = new PivotDataSet(mockSheet);
dataSet.setDataCfg(dataCfg);
});

test('should get correct values', () => {
expect(
getDimensionsWithoutPathPre(dataSet.getDimensionValues(EXTRA_FIELD)),
).toEqual(['price', 'cost']);
});
});

describe('Group Sort When Have Same Child Measure', () => {
const dataCfg: S2DataConfig = assembleDataCfg({
...mockDataConfig,
Expand All @@ -51,22 +29,24 @@ describe('Group Sort When Have Same Child Measure', () => {
});

beforeEach(() => {
MockPivotSheet.mockClear();
const mockSheet = new MockPivotSheet();
dataSet = new PivotDataSet(mockSheet);
dataSet.setDataCfg(dataCfg);
});

test('should get correct group sort', () => {
expect(
getDimensionsWithoutPathPre(dataSet.getDimensionValues('type')),
).toEqual(['办公用品', '家具产品', '家具产品', '办公用品']);
expect(
getDimensionsWithoutPathPre(
dataSet.getDimensionValues('type', { city: '白山' }),
),
).toEqual(['办公用品', '家具产品']);
expect(
getDimensionsWithoutPathPre(
dataSet.getDimensionValues('type', { city: '抚顺' }),
),
).toEqual(['家具产品', '办公用品']);
expect(dataSet.getDimensionValues('type')).toEqual([
'办公用品',
'家具产品',
]);
expect(dataSet.getDimensionValues('type', { city: '白山' })).toEqual([
'办公用品',
'家具产品',
]);
expect(dataSet.getDimensionValues('type', { city: '抚顺' })).toEqual([
'家具产品',
'办公用品',
]);
});
});
44 changes: 2 additions & 42 deletions packages/s2-core/__tests__/data/data-custom-trees.ts
Original file line number Diff line number Diff line change
@@ -1,62 +1,22 @@
export const dataCustomTrees = [
{
'measure-a': 1,
type: '家具',
sub_type: '桌子',
},
{
'measure-a': 1,
'measure-b': 2,
type: '家具',
sub_type: '桌子',
},
{
'measure-c': 3,
type: '家具',
sub_type: '桌子',
},
{
'measure-d': 4,
type: '家具',
sub_type: '桌子',
},
{
'measure-e': 5,
type: '家具',
sub_type: '桌子',
},
{
'measure-f': 6,
type: '家具',
sub_type: '桌子',
},
{
'measure-a': 11,
type: '家具',
sub_type: '椅子',
},
{
'measure-a': 11,
'measure-b': 22,
type: '家具',
sub_type: '椅子',
},
{
'measure-c': 33,
type: '家具',
sub_type: '椅子',
},
{
'measure-d': 44,
type: '家具',
sub_type: '椅子',
},
{
'measure-e': 55,
type: '家具',
sub_type: '椅子',
},
{
'measure-f': 66,
type: '家具',
sub_type: '椅子',
},
];
Loading

0 comments on commit 924da53

Please sign in to comment.