fix: disable table pagination in continuous page mode

pr675
Hufe921 2 years ago
parent 3f8399de62
commit d0500ac583

@ -3,6 +3,7 @@ import { ZERO } from '../../dataset/constant/Common'
import { RowFlex } from '../../dataset/enum/Row'
import {
IAppendElementListOption,
IComputeRowListPayload,
IDrawFloatPayload,
IDrawOption,
IDrawPagePayload,
@ -1095,7 +1096,8 @@ export class Draw {
return el.actualSize || el.size || this.options.defaultSize
}
public computeRowList(innerWidth: number, elementList: IElement[]) {
public computeRowList(payload: IComputeRowListPayload) {
const { innerWidth, elementList, isPagingMode = false } = payload
const { defaultSize, defaultRowMargin, scale, tdPadding, defaultTabWidth } =
this.options
const defaultBasicRowMarginHeight = this.getDefaultBasicRowMarginHeight()
@ -1206,10 +1208,11 @@ export class Draw {
const tr = trList[t]
for (let d = 0; d < tr.tdList.length; d++) {
const td = tr.tdList[d]
const rowList = this.computeRowList(
(td.width! - tdPaddingWidth) * scale,
td.value
)
const rowList = this.computeRowList({
innerWidth: (td.width! - tdPaddingWidth) * scale,
elementList: td.value,
isPagingMode
})
const rowHeight = rowList.reduce((pre, cur) => pre + cur.height, 0)
td.rowList = rowList
// 移除缩放导致的行高变化-渲染时会进行缩放调整
@ -1279,6 +1282,7 @@ export class Draw {
metrics.boundingBoxDescent = elementHeight
metrics.boundingBoxAscent = -rowMargin
// 表格分页处理(拆分表格)
if (isPagingMode) {
const height = this.getHeight()
const marginHeight = this.getMainOuterHeight()
let curPagePreHeight = marginHeight
@ -1381,6 +1385,7 @@ export class Draw {
}
}
}
}
} else if (element.type === ElementType.SEPARATOR) {
element.width = availableWidth / scale
metrics.width = availableWidth
@ -2143,7 +2148,11 @@ export class Draw {
}
}
// 行信息
this.rowList = this.computeRowList(innerWidth, this.elementList)
this.rowList = this.computeRowList({
isPagingMode,
innerWidth,
elementList: this.elementList
})
// 页面信息
this.pageRowList = this._computePageList()
// 位置信息

@ -55,7 +55,10 @@ export class Footer {
private _computeRowList() {
const innerWidth = this.draw.getInnerWidth()
this.rowList = this.draw.computeRowList(innerWidth, this.elementList)
this.rowList = this.draw.computeRowList({
innerWidth,
elementList: this.elementList
})
}
private _computePositionList() {

@ -55,7 +55,10 @@ export class Header {
private _computeRowList() {
const innerWidth = this.draw.getInnerWidth()
this.rowList = this.draw.computeRowList(innerWidth, this.elementList)
this.rowList = this.draw.computeRowList({
innerWidth,
elementList: this.elementList
})
}
private _computePositionList() {

@ -38,7 +38,10 @@ export class Placeholder {
private _computeRowList() {
const innerWidth = this.draw.getInnerWidth()
this.rowList = this.draw.computeRowList(innerWidth, this.elementList)
this.rowList = this.draw.computeRowList({
innerWidth,
elementList: this.elementList
})
}
private _computePositionList() {

@ -61,3 +61,9 @@ export interface IGetImageOption {
pixelRatio?: number
mode?: EditorMode
}
export interface IComputeRowListPayload {
innerWidth: number
elementList: IElement[]
isPagingMode?: boolean
}

Loading…
Cancel
Save