fix: table cell merge boundary error #645

pr675
Hufe921 2 years ago
parent cdb0788dfc
commit f7da332354

@ -292,8 +292,7 @@ export class TableParticle {
public computeRowColInfo(element: IElement) {
const { colgroup, trList } = element
if (!colgroup || !trList) return
let x = 0
let y = 0
let preX = 0
for (let t = 0; t < trList.length; t++) {
const tr = trList[t]
// 表格最后一行
@ -320,7 +319,7 @@ export class TableParticle {
for (let preC = 0; preC < c; preC++) {
preColWidth += colgroup[preC].width
}
x = preColWidth
preX = preColWidth
break
}
}
@ -360,18 +359,32 @@ export class TableParticle {
td.isLastColTd = isLastColTd
td.isLastTd = isLastTd
// 修改当前格clientBox
td.x = x
td.y = y
td.x = preX
// 之前行相同列的高度
let preY = 0
for (let preR = 0; preR < t; preR++) {
const preTdList = trList[preR].tdList
for (let preD = 0; preD < preTdList.length; preD++) {
const td = preTdList[preD]
if (
colIndex >= td.colIndex! &&
colIndex < td.colIndex! + td.colspan
) {
preY += td.height!
break
}
}
}
td.y = preY
td.width = width
td.height = height
td.rowIndex = t
td.colIndex = colIndex
// 当前列x轴累加
x += width
preX += width
// 一行中的最后td
if (isLastRowTd && !isLastTd) {
x = 0
y += rowMinHeight
preX = 0
}
}
}

@ -1350,9 +1350,7 @@ export function getElementListByHTML(
}
tr.tdList.push(td)
})
if (tr.tdList.length) {
element.trList!.push(tr)
}
element.trList!.push(tr)
})
if (element.trList!.length) {
// 列选项数据

Loading…
Cancel
Save