import { useAttrs as m, ref as n, computed as f, watchEffect as i, createElementBlock as p, openBlock as y, createVNode as h, mergeProps as _, unref as b, withCtx as v, renderSlot as g } from "vue"; import { k as x } from "./index2.js"; import { F as S } from "./index5.js"; const w = { class: "s-form" }, C = { __name: "SForm", props: { model: { type: Object, default() { return {}; } }, rules: { type: Object, default() { return {}; } }, layout: { type: String, default() { return "horizontal"; } }, column: { type: [Number, String], default() { return 1; } }, labelWidth: { type: [Number, String], default() { return 80; } } }, setup(r, { expose: u }) { const c = m(), e = r, a = n(), s = n(e.column >= 5 ? 4 : e.column), d = f(() => { const o = e.layout, t = (e == null ? void 0 : e.labelWidth) + ""; return o === "horizontal" ? { style: { width: t.includes("px") ? t : t + "px" } } : {}; }); return i(() => { e.column > 4 && console.warn(`当前设置表单列column【${e.column}】最多显示为4列,已默认为最多4列`); }), u({ validate: () => new Promise((o, t) => { a.value.validate().then((l) => { o(l); }).catch((l) => { t(l); }); }) }), (o, t) => { const l = S; return y(), p("div", w, [ h(l, _({ labelCol: d.value.labelCol, model: r.model, rules: r.rules, layout: r.layout }, b(c), { ref_key: "form", ref: a, style: { display: "grid", gridTemplateColumns: `repeat(${s.value}, 1fr)`, gap: "20px" } }), { default: v(() => [ g(o.$slots, "default", {}, void 0, !0) ]), _: 3 }, 16, ["labelCol", "model", "rules", "layout", "style"]) ]); }; } }, j = /* @__PURE__ */ x(C, [["__scopeId", "data-v-cad3adca"]]); export { j as default };