-
Notifications
You must be signed in to change notification settings - Fork 219
🐛 交叉表 compact 模式下,列头宽计算有误 #969
Copy link
Copy link
Closed
Labels
Description
🏷 Version
| Package | Version |
|---|---|
| @antv/s2 | 1.4.0 |
| @antv/s2-react | 1.4.0 |
🖋 Description
compact 模式下计算列头宽,错误地使用了 field 格式化前的原始 id
⌨️ Code Snapshots
import React from 'react';
import ReactDOM from 'react-dom';
import { SheetComponent } from '@antv/s2-react';
import '@antv/s2-react/dist/style.min.css';
fetch(
'https://gw.alipayobjects.com/os/bmw-prod/2a5dbbc8-d0a7-4d02-b7c9-34f6ca63cff6.json',
)
.then((res) => res.json())
.then((dataCfg) => {
// original: fields.values = ['number']
// data = [{ ..., number: 123, ... }]
// meta = [{ field: 'number', name: '数量' }]
const newValueKey = 'a-long-field-id-that-trigger-width-calc-bug';
dataCfg.fields.values[0] = newValueKey;
dataCfg.meta[0].field = newValueKey;
dataCfg.data.forEach(item => item[newValueKey] = item.number);
const s2Options = {
width: 600.32,
height: 480,
style: {
layoutWidthType: 'compact',
frozenRowHeader: true,
colCfg: {
height: 32,
},
device: 'pc'
}
};
ReactDOM.render(
<SheetComponent dataCfg={dataCfg} options={s2Options} />,
document.getElementById('container'),
);
});
🔗 Reproduce Link
🤔 Steps to Reproduce
😊 Expected Behavior
😅 Current Behavior
💻 System information
Reactions are currently unavailable
