fix: table cell merge boundary error #645
This commit is contained in:
@@ -292,8 +292,7 @@ export class TableParticle {
|
|||||||
public computeRowColInfo(element: IElement) {
|
public computeRowColInfo(element: IElement) {
|
||||||
const { colgroup, trList } = element
|
const { colgroup, trList } = element
|
||||||
if (!colgroup || !trList) return
|
if (!colgroup || !trList) return
|
||||||
let x = 0
|
let preX = 0
|
||||||
let y = 0
|
|
||||||
for (let t = 0; t < trList.length; t++) {
|
for (let t = 0; t < trList.length; t++) {
|
||||||
const tr = trList[t]
|
const tr = trList[t]
|
||||||
// 表格最后一行
|
// 表格最后一行
|
||||||
@@ -320,7 +319,7 @@ export class TableParticle {
|
|||||||
for (let preC = 0; preC < c; preC++) {
|
for (let preC = 0; preC < c; preC++) {
|
||||||
preColWidth += colgroup[preC].width
|
preColWidth += colgroup[preC].width
|
||||||
}
|
}
|
||||||
x = preColWidth
|
preX = preColWidth
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -360,18 +359,32 @@ export class TableParticle {
|
|||||||
td.isLastColTd = isLastColTd
|
td.isLastColTd = isLastColTd
|
||||||
td.isLastTd = isLastTd
|
td.isLastTd = isLastTd
|
||||||
// 修改当前格clientBox
|
// 修改当前格clientBox
|
||||||
td.x = x
|
td.x = preX
|
||||||
td.y = y
|
// 之前行相同列的高度
|
||||||
|
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.width = width
|
||||||
td.height = height
|
td.height = height
|
||||||
td.rowIndex = t
|
td.rowIndex = t
|
||||||
td.colIndex = colIndex
|
td.colIndex = colIndex
|
||||||
// 当前列x轴累加
|
// 当前列x轴累加
|
||||||
x += width
|
preX += width
|
||||||
// 一行中的最后td
|
// 一行中的最后td
|
||||||
if (isLastRowTd && !isLastTd) {
|
if (isLastRowTd && !isLastTd) {
|
||||||
x = 0
|
preX = 0
|
||||||
y += rowMinHeight
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1350,9 +1350,7 @@ export function getElementListByHTML(
|
|||||||
}
|
}
|
||||||
tr.tdList.push(td)
|
tr.tdList.push(td)
|
||||||
})
|
})
|
||||||
if (tr.tdList.length) {
|
|
||||||
element.trList!.push(tr)
|
element.trList!.push(tr)
|
||||||
}
|
|
||||||
})
|
})
|
||||||
if (element.trList!.length) {
|
if (element.trList!.length) {
|
||||||
// 列选项数据
|
// 列选项数据
|
||||||
|
|||||||
Reference in New Issue
Block a user