import type { Ref } from "vue"; import { unref } from "vue"; import { utils } from "@milaboratories/helpers"; type MaybeRef = T | Ref; export function getColumnPositions(tableRef: MaybeRef) { const ths = utils.tapIf(unref(tableRef)?.querySelectorAll(".th-cell"), (l) => [...l]) ?? []; return ths .map((th, index) => { const { width, x } = th.getBoundingClientRect(); return { index, width, x, right: x + width, }; }) .slice(0, ths.length - 1); }