UNPKG

@visactor/vtable

Version:

canvas table width high performance

32 lines (27 loc) 1.63 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.createColGroup = void 0; const vutils_1 = require("@visactor/vutils"), group_1 = require("../graphic/group"), column_helper_1 = require("./column-helper"); 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_1.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} = (0, column_helper_1.createComplexColumn)(columnGroup, col, colWidth, rowStart, rowEnd, table.scenegraph.mergeMap, "columnHeader" === cellLocation && (0, vutils_1.isNumber)(defaultHeaderRowHeight) ? defaultHeaderRowHeight : defaultRowHeight, table, rowLimit); x += default2Width, heightMax = Math.max(heightMax, default2Height); } containerGroup.setAttribute("width", x), containerGroup.setAttribute("height", heightMax); } exports.createColGroup = createColGroup; //# sourceMappingURL=column.js.map