UNPKG

ideaz-element

Version:

<p align="center"> <a href="" target="_blank" rel="noopener noreferrer"> <img src="./docs/public/logo.svg" alt="Ideaz Element" width="180" style="width: 180px;" /> </a> </p>

55 lines (54 loc) 1.41 kB
import "../../../../utils/index.mjs"; import { useNamespace as r } from "../../../../hooks/useNamespace.mjs"; import { ref as p, computed as u } from "vue"; import { isNumber as i, isObject as h } from "../../../../utils/is.mjs"; function j(o, a) { let n; const e = r("col", p("el")), c = u(() => o.gutter || 0); if (o.column) { const s = Math.floor(24 / o.column); n = { xs: { span: 24 }, sm: { span: s >= 12 ? s : 12 }, md: { span: s }, lg: { span: s }, xl: { span: s }, ...a }; } else n = { span: 24, ...a }; const m = u(() => { const s = {}; return c.value && (s.paddingLeft = s.paddingRight = `${c.value / 2}px`), s; }); return { colKls: u(() => { const s = []; return ["span", "offset", "pull", "push"].forEach((t) => { const l = n[t]; i(l) && (t === "span" ? s.push(e.b(`${n[t]}`)) : l > 0 && s.push(e.b(`${t}-${n[t]}`))); }), ["xs", "sm", "md", "lg", "xl"].forEach((t) => { i(n[t]) ? s.push(e.b(`${t}-${n[t]}`)) : h(n[t]) && Object.entries(n[t]).forEach(([l, f]) => { s.push( l !== "span" ? e.b(`${t}-${l}-${f}`) : e.b(`${t}-${f}`) ); }); }), c.value && s.push(e.is("guttered")), [e.b(), s]; }), colStyle: m }; } export { j as useCol }; //# sourceMappingURL=useCol.mjs.map