-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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]> 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
1 parent
57ecedf
commit 3918a1f
Showing
46 changed files
with
634 additions
and
282 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
/** | ||
* @description spec for issue #2359 | ||
* https://github.com/antvis/S2/issues/2359 | ||
* 明细表: 自定义列头误用 dataCell 样式 | ||
*/ | ||
import { pick } from 'lodash'; | ||
import { createTableSheet } from 'tests/util/helpers'; | ||
import { TableColCell, drawObjectText } from '../../src'; | ||
import type { S2CellType, S2Options } from '@/common/interface'; | ||
|
||
class TestColCell extends TableColCell { | ||
drawTextShape() { | ||
drawObjectText(this, { | ||
values: [['A', 'B', 'C']], | ||
}); | ||
} | ||
} | ||
|
||
const s2Options: S2Options = { | ||
width: 300, | ||
height: 480, | ||
showSeriesNumber: true, | ||
colCell: (...args) => new TestColCell(...args), | ||
}; | ||
|
||
describe('Table Sheet Custom Multiple Values Tests', () => { | ||
test('should use current cell text theme', () => { | ||
const s2 = createTableSheet(s2Options); | ||
|
||
s2.setTheme({ | ||
colCell: { | ||
measureText: { | ||
fontSize: 12, | ||
}, | ||
bolderText: { | ||
fontSize: 14, | ||
}, | ||
text: { | ||
fontSize: 20, | ||
fill: 'red', | ||
}, | ||
}, | ||
dataCell: { | ||
text: { | ||
fontSize: 30, | ||
fill: 'green', | ||
}, | ||
}, | ||
}); | ||
s2.render(); | ||
|
||
const mapTheme = (cell: S2CellType) => { | ||
return cell | ||
.getTextShapes() | ||
.map((shape) => pick(shape.attr(), ['fill', 'fontSize'])); | ||
}; | ||
|
||
const colCellTexts = s2 | ||
.getColumnNodes() | ||
.map((node) => mapTheme(node.belongsCell)); | ||
|
||
const dataCellTexts = s2.interaction | ||
.getPanelGroupAllDataCells() | ||
.map(mapTheme); | ||
|
||
expect(colCellTexts).toMatchInlineSnapshot(` | ||
Array [ | ||
Array [ | ||
Object { | ||
"fill": "red", | ||
"fontSize": 20, | ||
}, | ||
Object { | ||
"fill": "red", | ||
"fontSize": 20, | ||
}, | ||
Object { | ||
"fill": "red", | ||
"fontSize": 20, | ||
}, | ||
], | ||
Array [ | ||
Object { | ||
"fill": "red", | ||
"fontSize": 20, | ||
}, | ||
Object { | ||
"fill": "red", | ||
"fontSize": 20, | ||
}, | ||
Object { | ||
"fill": "red", | ||
"fontSize": 20, | ||
}, | ||
], | ||
] | ||
`); | ||
|
||
expect(dataCellTexts).toMatchInlineSnapshot(` | ||
Array [ | ||
Array [ | ||
Object { | ||
"fill": "#000000", | ||
"fontSize": 12, | ||
}, | ||
], | ||
Array [ | ||
Object { | ||
"fill": "#000000", | ||
"fontSize": 12, | ||
}, | ||
], | ||
Array [ | ||
Object { | ||
"fill": "#000000", | ||
"fontSize": 12, | ||
}, | ||
], | ||
Array [ | ||
Object { | ||
"fill": "green", | ||
"fontSize": 30, | ||
}, | ||
], | ||
Array [ | ||
Object { | ||
"fill": "green", | ||
"fontSize": 30, | ||
}, | ||
], | ||
Array [ | ||
Object { | ||
"fill": "green", | ||
"fontSize": 30, | ||
}, | ||
], | ||
] | ||
`); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/s2-core/__tests__/unit/utils/__snapshots__/sort-action-spec.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`GetSortByMeasureValues Total Fallback Tests should sort by col total whit group 1`] = ` | ||
Array [ | ||
Object { | ||
"$$extra$$": "price", | ||
"$$value$$": "666", | ||
"city": "杭州", | ||
"price": "666", | ||
"type": "笔", | ||
}, | ||
Object { | ||
"$$extra$$": "price", | ||
"$$value$$": "999", | ||
"city": "杭州", | ||
"price": "999", | ||
"type": "纸张", | ||
}, | ||
] | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.