1.x明细表拖拽行高受rowCell的padding影响
🏷 Version
| Package | Version |
|---|---|
| @antv/s2 | 1.55.8 |
| @antv/s2-react | - |
| @antv/s2-vue | - |
Sheet Type
- [ ] PivotSheet
- [x] TableSheet
- [ ] GridAnalysisSheet
- [ ] StrategySheet
- [ ] EditableSheet
🖋 Description
明细表当theme设置了rowCell的padding样式之后,每次拖拽行高,都会自动减去padding中top和bottom的高度,具体表现如下:
https://github.com/user-attachments/assets/0053c738-7e32-4f8b-99fe-d7f98ba63dca
⌨️ Code Snapshots
在链接中使用以下代码即可复现:https://s2-v1.antv.antgroup.com/examples/basic/table/#table
import { TableSheet } from '@antv/s2';
fetch('https://assets.antv.antgroup.com/s2/basic-table-mode.json')
.then((res) => res.json())
.then((data) => {
const container = document.getElementById('container');
const s2DataConfig = {
fields: {
columns: ['province', 'city', 'type', 'price', 'cost'],
},
meta: [
{
field: 'province',
name: '省份',
},
{
field: 'city',
name: '城市',
},
{
field: 'type',
name: '商品类别',
},
{
field: 'price',
name: '价格',
},
{
field: 'cost',
name: '成本',
},
],
data,
};
const s2Options = {
width: 600,
height: 480,
showSeriesNumber: true,
};
const s2 = new TableSheet(container, s2DataConfig, s2Options);
// 设置了rowCell.cell.padding.top或rowCell.cell.padding.bottom即可复现
s2.setThemeCfg({
theme: {
rowCell: {
cell: {
padding: {
top: 8,
right: 8,
bottom: 8,
left: 8
}
}
}
}
})
s2.render();
});
感觉是这里的问题,在拖拽结束后,没有区分明细表还是透视表,直接将cell高度减去了padding。 https://github.com/antvis/S2/blob/11bb92c1a3625d8e99bc74c9d3e9f6f768b828ec/packages/s2-core/src/interaction/row-column-resize.ts#L296-L299 然后在明细表示使用时,获取cell高度,使用的就是拖拽更新后的高度,导致每次都会减去paddingTop和paddingBottom的高度 https://github.com/antvis/S2/blob/11bb92c1a3625d8e99bc74c9d3e9f6f768b828ec/packages/s2-core/src/facet/frozen-facet.ts#L708-L712
可以尝试来个 PR.
:tada: This issue has been resolved in version @antv/s2-v1.56.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket: