import { computed as e } from "vue";
import { asConst as t, sliceBy as n, uniqueId as r } from "@milaboratories/helpers";
function i(i) {
	return e(() => {
		let { data: e, settings: a } = i, { bodyWidth: o, scrollLeft: s } = e, c = [...e.columns], l = r();
		a.value.controlColumn && c.unshift(t({
			id: l,
			label: "#",
			width: 60,
			frozen: !0
		}));
		let u = 0, d = c.map((e) => {
			let t = {
				...e,
				offset: u
			};
			return u += e.width + 1, t;
		}), f = d.filter((e) => e.frozen);
		return n(d, (e) => e.frozen ? !1 : s < e.offset + e.width && e.offset < o + s).concat(f).map((t) => ({
			...t,
			style: {
				left: t.frozen ? `${t.offset}px` : `${t.offset - e.scrollLeft}px`,
				width: `${t.width}px`
			},
			control: t.id === l
		}));
	});
}
export { i as useTableColumns };

//# sourceMappingURL=useTableColumns.js.map