Skip to content

Commit e10ad7f

Browse files
committed
refactor: 不需要通过 root[&] 进行分割,仍可以获取正确的展示值
1 parent e3de698 commit e10ad7f

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

packages/s2-core/src/facet/layout/build-row-tree-hierarchy.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { SpreadSheet } from '@/sheet-type';
99
import { getListBySorted, filterUndefined } from '@/utils/data-set-operate';
1010
import { getDimensionsWithoutPathPre } from '@/utils/dataset/pivot-data-set';
1111
import { PivotDataSet } from '@/data-set';
12-
import { ID_SEPARATOR, ROOT_ID } from '@/common/constant';
1312

1413
const addTotals = (
1514
spreadsheet: SpreadSheet,
@@ -41,18 +40,10 @@ export const buildRowTreeHierarchy = (params: TreeHeaderParams) => {
4140
const sortedDimensionValues =
4241
(dataSet as PivotDataSet)?.sortedDimensionValues?.[currentField] || [];
4342

44-
// 为第一个子层级时,parentNode.id === ROOT_ID 时,不需要通过分割获取当前节点的真实 value
45-
const dimensions =
46-
ROOT_ID === id
47-
? sortedDimensionValues
48-
: sortedDimensionValues?.filter((item) =>
49-
item?.includes(id?.split(`${ROOT_ID}${ID_SEPARATOR}`)[1]),
50-
);
51-
5243
const dimValues = filterUndefined(
5344
getListBySorted(
5445
[...(pivotMeta.keys() || [])],
55-
[...getDimensionsWithoutPathPre([...dimensions])],
46+
[...getDimensionsWithoutPathPre([...sortedDimensionValues])],
5647
),
5748
);
5849

0 commit comments

Comments
 (0)