UNPKG

el-plus-powerful-form

Version:

## [DOCS](https://peng-xiao-shuai.github.io/vite-vue-admin-docs/zh-CN/component_directive/component/powerful-form-doc.html)

87 lines (86 loc) 3.38 kB
import { defineComponent as I, getCurrentInstance as S, toRefs as B, useSlots as D, useAttrs as E, openBlock as t, createElementBlock as c, createVNode as N, unref as e, mergeProps as m, withCtx as f, Fragment as P, renderList as T, createBlock as n, normalizeStyle as A, renderSlot as F, resolveDynamicComponent as L, createCommentVNode as U } from "vue"; import { ElForm as j, ElFormItem as b } from "element-plus"; import { formViewProps as q, useFormViewState as x, useFunction as z } from "./form-view-data.mjs"; import { componentRegister as H } from "../../index.mjs"; import { clearSymbol as J, matchComponents as W } from "../../utils/index.mjs"; import { FRenderJsx as G } from "../../components/f-render-jsx.mjs"; import { FormTypeEnum as K } from "../index.mjs"; const M = { style: { transition: "all 0.3s", overflow: "hidden" } }, O = { name: "PowerfulForm" }, se = /* @__PURE__ */ I({ ...O, props: q, setup(w, { expose: k }) { const { appContext: _ } = S(); H(_.app); const l = w, { formViewData: u, formRenderItems: d, elFormRef: a, transformHeader: h } = x(l), { formData: s, rules: C } = B(u), { bindAttr: i, submitForm: v, resetForm: R, refreshRender: V, visibleFormTrigger: g } = z(l, s, a, h); return k({ $slots: D(), $attrs: E(), $refs: { elFormRef: a }, props: l, powerfulFormData: u, formItems: d.value, visibleFormTrigger: g, submitForm: v, resetForm: R, refreshRender: V }), (o, Q) => { var y; return t(), c("div", M, [ N(e(j), m(o.property, { ref_key: "elFormRef", ref: a, model: e(s), rules: l.showType === "query" ? {} : e(C), disabled: o.disabled, style: (y = o.property) != null && y.inline ? {} : { display: "flex", flexWrap: "wrap", justifyContent: "space-between" } }), { default: f(() => [ (t(!0), c(P, null, T(e(d), (r, p) => (t(), n(e(b), { key: r.prop, prop: r.prop, label: o.showLabel ? e(J)(r.text) : "", style: A({ flexBasis: (r == null ? void 0 : r.basis) || "100%" }) }, { default: f(() => [ r.type == "slot" ? F(o.$slots, r.slotName || "default", { key: 0, index: p }, void 0, !0) : typeof r.render == "function" ? (t(), n(e(G), m({ key: 1, ref_for: !0 }, e(i)(r, e(s), p)), null, 16)) : (t(), n(L(e(W)(r.type || e(K).Input)), m({ key: 2, ref_for: !0 }, e(i)(r, e(s), p), { "onUpdate:modelValue": ($) => e(s)[r.prop] = $ }), null, 16, ["onUpdate:modelValue"])) ]), _: 2 }, 1032, ["prop", "label", "style"]))), 128)), o.$slots["last-item"] ? (t(), n(e(b), { key: 0 }, { default: f(() => [ F(o.$slots, "last-item", {}, void 0, !0) ]), _: 3 })) : U("", !0) ]), _: 3 }, 16, ["model", "rules", "disabled", "style"]) ]); }; } }); export { se as default }; //# sourceMappingURL=form-view.vue2.mjs.map