fix(grid): [grid] fix tableWidth error when all column has min-width (#1595)

This commit is contained in:
gimmyhehe 2024-04-26 16:03:10 +08:00 committed by GitHub
parent e0b595af1a
commit 55e65a4464
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 1 deletions

View File

@ -110,7 +110,19 @@ export const calcTableWidth = ({ bodyWidth, columnStore, fit, minCellWidth, rema
}
// 自适应修补一些列的宽度
return adaptive({ autoArr, meanWidth, minCellWidth, tableWidth, fit, bodyWidth })
tableWidth = adaptive({ autoArr, meanWidth, minCellWidth, tableWidth, fit, bodyWidth })
const remainingSpace = bodyWidth - tableWidth
// 如果还有空间剩余
if (fit && remainingSpace > 0) {
scaleMinArr
.concat(pxMinArr)
.slice(0, remainingSpace)
.forEach((column) => {
tableWidth += 1
column.renderWidth += 1
})
}
return tableWidth
}
const setLeftOrRightPosition = ({ columnList, direction, headerEl, bodyEl, scrollbarWidth }) => {