UNPKG

@visactor/vtable

Version:

canvas table width high performance

27 lines (23 loc) 1.44 kB
import { isNumber } from "@visactor/vutils"; import { Group } from "../graphic/group"; import { createComplexColumn } from "./column-helper"; export function createColGroup(containerGroup, xOrigin, yOrigin, colStart, colEnd, rowStart, rowEnd, cellLocation, table, rowLimit) { if (colStart > colEnd || rowStart > rowEnd) return; const {layoutMap: layoutMap, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth} = table.internalProps, defaultRowHeight = table.defaultRowHeight; let x = 0, heightMax = 0; for (let i = colStart; i <= colEnd; i++) { const col = i, colWidth = table.getColWidth(col), columnGroup = new Group({ x: xOrigin + x, y: yOrigin, width: colWidth, height: 0, clip: !1, pickable: !1 }); columnGroup.role = "column", columnGroup.col = i, containerGroup.addChild(columnGroup); const {width: default2Width, height: default2Height} = createComplexColumn(columnGroup, col, colWidth, rowStart, rowEnd, table.scenegraph.mergeMap, "columnHeader" === cellLocation && isNumber(defaultHeaderRowHeight) ? defaultHeaderRowHeight : defaultRowHeight, table, rowLimit); x += default2Width, heightMax = Math.max(heightMax, default2Height); } containerGroup.setAttribute("width", x), containerGroup.setAttribute("height", heightMax); } //# sourceMappingURL=column.js.map