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>

98 lines (97 loc) 3.71 kB
import { defineComponent as F, provide as x, computed as p, toRefs as b, createVNode as s, mergeProps as y, h as z } from "vue"; import "../../../utils/index.mjs"; import "../../../shared/index.mjs"; import "../../../node_modules/.pnpm/lodash-unified@1.0.3_@types_lodash-es@4.17.12_lodash-es@4.17.21_lodash@4.17.21/node_modules/lodash-unified/import.mjs"; import "../../../directives/index.mjs"; import { ElFormItem as C } from "element-plus"; import "./hooks/index.mjs"; import { formItemProps as S, formItemProvideKey as h } from "./props.mjs"; import { useNamespace as N } from "../../../hooks/useNamespace.mjs"; import { useFormSize as R } from "../../../hooks/useFormSize.mjs"; import { vueRef as D } from "../../../directives/vueRef.mjs"; import { useFormItemComponent as E } from "./hooks/useFormItemComponent.mjs"; import { useFormItemProps as j } from "./hooks/useFormItemProps.mjs"; import { useFormItemSlots as w } from "./hooks/useFormItemSlots.mjs"; import { isFunction as d, isString as A, isObject as B } from "../../../utils/is.mjs"; import { resolveDynamicComponent as K } from "../../../shared/resolveDynamicComponent.mjs"; import c from "../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/get.mjs"; import { extractEvents as O } from "../../../utils/object.mjs"; import { getContentByRenderAndSlot as U } from "../../../shared/getContentByRenderAndSlot.mjs"; const te = /* @__PURE__ */ F({ name: "ZFormItem", directives: { ref: D }, props: S, emits: ["change", "update:modelValue"], setup(r, { slots: m, emit: a }) { const t = N("form-item"), { componentName: v } = E(r), { formItemProps: i } = j(r), { vSlots: P } = w(r, m), f = R(); x(h, p(() => ({ ...b(r), size: f.value }))); const g = p(() => { var e, o, l; return d(r.col.render) || r.col.slot || ((l = (o = (e = m.default) == null ? void 0 : e.call(m)[0]) == null ? void 0 : o.children) == null ? void 0 : l.length) > 0; }), I = (e) => { const { col: o } = r; o.modifier ? (d(o.modifier) && a("update:modelValue", o.modifier(e), o.field), o.modifier === "trim" && a("update:modelValue", A(e) ? e.trim() : e, o.field)) : a("update:modelValue", e, o.field); }; return () => { const { col: e, options: o, formConfig: l } = r; return s(C, y({ ref: "formItem", prop: e.field || e.slot, class: [t.b(), l.draggable && t.b("draggable"), i.value.extra ? "z-form-item--column" : t.bm("no-extra", f.value)] }, { size: f.value, ...i.value }), { default: () => { var n, u; return [g.value ? (n = m.default) == null ? void 0 : n.call(m) : z(K({ name: v.value, attrs: { modelValue: d(e.fieldProps && e.fieldProps.format) ? (u = e.fieldProps) == null ? void 0 : u.format(c(r.modelValue, e.field)) : c(r.modelValue, e.field), prop: e.field, options: o ? o[e.field] || e.fieldProps && e.fieldProps.options : {}, size: f.value, class: e.class, style: e.style, ...e.fieldProps, directives: { ref: B(e.fieldProps) ? e.fieldProps.ref || (() => { }) : () => { } }, "onUpdate:modelValue": (V) => I(V), ...O(e) } })), i.value.extra && s("div", { class: t.e("extra") }, [U(i.value.extra, m)])]; }, ...P.value }); }; } }); export { te as default }; //# sourceMappingURL=FormItem.mjs.map