UNPKG

@visactor/vtable

Version:

canvas table width high performance

38 lines (34 loc) 1.14 kB
import { isValid } from "@visactor/vutils"; export function getCellEventArgsSet(e) { const tableEvent = { abstractPos: { x: e.viewport.x, y: e.viewport.y } }, targetCell = getTargetCell(e.target); return targetCell && (tableEvent.eventArgs = { col: targetCell.col, row: targetCell.row, event: e, targetCell: targetCell, mergeInfo: getMergeCellInfo(targetCell), target: e.target }), tableEvent; } export function getTargetCell(target) { for (;target && target.parent; ) { if ("cell" === target.role) return target; target = target.parent; } return null; } function getMergeCellInfo(cellGroup) { if (isValid(cellGroup.mergeStartCol) && isValid(cellGroup.mergeStartRow) && isValid(cellGroup.mergeEndCol) && isValid(cellGroup.mergeEndRow)) return { colStart: cellGroup.mergeStartCol, colEnd: cellGroup.mergeEndCol, rowStart: cellGroup.mergeStartRow, rowEnd: cellGroup.mergeEndRow }; } export const regIndexReg = /radio-\d+-\d+-(\d+)/; //# sourceMappingURL=util.js.map