fix: collapse first row of virtual table, scrollTop should be 0 (#52447)

This commit is contained in:
SamLee 2025-01-17 11:17:04 +08:00 committed by GitHub
parent 88d81e541f
commit 39a9cd89f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -557,18 +557,18 @@ const InternalTable = <RecordType extends AnyObject = AnyObject>(
const virtualProps: { listItemHeight?: number } = {}; const virtualProps: { listItemHeight?: number } = {};
const listItemHeight = React.useMemo(() => { const listItemHeight = React.useMemo(() => {
const { fontSize, lineHeight, padding, paddingXS, paddingSM } = token; const { fontSize, lineHeight, lineWidth, padding, paddingXS, paddingSM } = token;
const fontHeight = Math.floor(fontSize * lineHeight); const fontHeight = Math.floor(fontSize * lineHeight);
switch (mergedSize) { switch (mergedSize) {
case 'large': case 'middle':
return padding * 2 + fontHeight; return paddingSM * 2 + fontHeight + lineWidth;
case 'small': case 'small':
return paddingXS * 2 + fontHeight; return paddingXS * 2 + fontHeight + lineWidth;
default: default:
return paddingSM * 2 + fontHeight; return padding * 2 + fontHeight + lineWidth;
} }
}, [token, mergedSize]); }, [token, mergedSize]);