UNPKG

epic-designer-cjh

Version:

基于vue3的设计器,可视化开发页面表单

97 lines (96 loc) 2.84 kB
import { defineComponent as y, ref as b, inject as x, reactive as C, provide as D, onMounted as F, computed as s, openBlock as c, createElementBlock as u, createVNode as P, unref as j, mergeProps as k, withCtx as w, renderSlot as d, Fragment as $, renderList as B } from "vue"; import { F as L } from "./index-e0c3e213.js"; import "./ExclamationCircleFilled-5f7de9d7.js"; import "./_baseIteratee-9edfdc6e.js"; import "./index-97ce4605.js"; import "./_baseIsEqual-2f2ed312.js"; import "./hasIn-b4ac620c.js"; import "./_overRest-dc82ce77.js"; import "./debounce-30ba20d9.js"; import "./isArrayLikeObject-e5e231b4.js"; import "./_baseSlice-4d543985.js"; import "./_flatRest-fa7c8eb8.js"; import "./defineProperty-0388aa92.js"; import "./typeof-dad84d6f.js"; import "./_commonjsHelpers-c5d32002.js"; import "./index-cd8ad455.js"; import "./vue-types.m-76c57684.js"; import "./index.esm-56aac43a.js"; import "./cloneDeep-aa0cb853.js"; import "./stylis-9146bd77.js"; import "./index-2b6651fc.js"; import "./index-c3e64a00.js"; import "./ResizeObserver.es-fc1a163b.js"; import "./isEqual-eac09a18.js"; const O = { class: "form-main", style: { height: "100%" } }, oe = /* @__PURE__ */ y({ __name: "form", props: { record: { type: Object, require: !0, default: () => ({}) } }, setup(f, { expose: v }) { const o = f, r = b(null), i = x("forms", {}), n = C({}); D("formData", n); function l() { return n; } function m() { var e; return (e = r.value) == null ? void 0 : e.validateFields(); } function p(e) { Object.assign(n, e); } F(async () => { var e; if (((e = o.record) == null ? void 0 : e.type) === "form" && i.value && r.value) { const t = o.record.name ?? "default"; return r.value.validate = m, i.value[t] = r.value, r.value.getData = l, r.value.setData = p, !1; } }); const h = s(() => { const e = o.record.componentProps; let t = e.labelCol, a = e.wrapperCol; return e.labelLayout === "fixed" && (t = { flex: `${e.labelWidth}px` }, a = { flex: 1 }), { ...e, labelCol: t, wrapperCol: a }; }); function g(e) { console.log(e); } const _ = s(() => o.record.children ?? []); return v({ form: r, getData: l, setData: p, validate: m }), (e, t) => (c(), u("div", O, [ P(j(L), k({ ref_key: "form", ref: r, model: n }, h.value, { style: { height: "100%" }, onFinish: g }), { default: w(() => [ d(e.$slots, "edit-node", {}, () => [ (c(!0), u($, null, B(_.value, (a) => d(e.$slots, "node", { record: a })), 256)) ]) ]), _: 3 }, 16, ["model"]) ])); } }); export { oe as default };