Skip to content

Commit

Permalink
fix: revert
Browse files Browse the repository at this point in the history
  • Loading branch information
lijinke666 committed Nov 29, 2023
1 parent 158750a commit 6f361c8
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 42 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { getContainer } from 'tests/util/helpers';
import type { RowCell } from '../../src';
import { EMPTY_FIELD_VALUE, type S2DataConfig, type S2Options } from '@/common';
import { PivotSheet, SpreadSheet } from '@/sheet-type';

Expand Down Expand Up @@ -244,16 +243,4 @@ describe('Miss Dimension Values Tests', () => {
]
`);
});

test('should not render tree icon if only have root dimension values', () => {
s2.setOptions({
hierarchyType: 'tree',
});
s2.render(false);

const emptyDimensionValueNode = s2.getRowLeafNodes()[0];
expect(
(emptyDimensionValueNode.belongsCell as RowCell).getTreeIcon(),
).toBeFalsy();
});
});
7 changes: 2 additions & 5 deletions packages/s2-core/src/cell/row-cell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,7 @@ export class RowCell extends HeaderCell {
}

protected showTreeIcon() {
const { isLeaf, children } = this.meta;

return (
this.spreadsheet.isHierarchyTreeType() && !isLeaf && !isEmpty(children)
);
return this.spreadsheet.isHierarchyTreeType() && !this.meta.isLeaf;
}

protected showTreeLeafNodeAlignDot() {
Expand All @@ -134,6 +130,7 @@ export class RowCell extends HeaderCell {
) {
return;
}

return get(this.meta, 'parent.belongsCell.treeIcon.cfg');
}

Expand Down
83 changes: 59 additions & 24 deletions packages/s2-react/playground/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,36 +80,71 @@ export const s2Options: SheetComponentOptions = {
debug: true,
width: 600,
height: 400,
hierarchyType: 'grid',
totals: {
row: {
showGrandTotals: false,
showSubTotals: {
always: false,
},
reverseLayout: false,
reverseSubLayout: false,
subTotalsDimensions: [
'2d7feabd-76a2-4c11-8f24-79764af936b4',
'30b4b32d-d69a-4772-b7f9-84cd54cf0cec',
],
},
col: {
showGrandTotals: false,
showSubTotals: false,
reverseLayout: false,
reverseSubLayout: false,
subTotalsDimensions: [],
showSeriesNumber: false,
interaction: {
enableCopy: true,
copyWithHeader: true,
copyWithFormat: true,
// 防止 mac 触摸板横向滚动触发浏览器返回, 和移动端下拉刷新
overscrollBehavior: 'none',
brushSelection: {
data: true,
col: true,
row: true,
},
},
tooltip: {
operation: {
trend: true,
},
},
conditions: {
text: [],
interval: [
{
field: 'number',
mapping() {
return {
fill: '#80BFFF',
// 自定义柱状图范围
isCompare: true,
maxValue: 8000,
minValue: 300,
};
},
},
],
},
headerActionIcons: [
{
iconNames: ['SortDown'],
belongsCell: 'colCell',
defaultHide: true,
},
{
iconNames: ['SortDown'],
belongsCell: 'rowCell',
defaultHide: true,
},
{
iconNames: ['SortDown'],
belongsCell: 'cornerCell',
defaultHide: true,
},
],
hierarchyType: 'grid',
style: {
layoutWidthType: 'adaptive',
colCfg: {
hideMeasureColumn: false,
},
rowCfg: {
width: 100,
},
cellCfg: {
height: 30,
height: 50,
width: 200,
},
},
showDefaultHeaderActionIcon: false,
colCell: null,
};

export const s2ThemeConfig: ThemeCfg = {
Expand Down

0 comments on commit 6f361c8

Please sign in to comment.