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>
95 lines (94 loc) • 2.42 kB
JavaScript
import { defineComponent as h, withDirectives as C, createVNode as w, vShow as D } from "vue";
import "../../../utils/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 "./hooks/index.mjs";
import f from "./FormItem.mjs";
import { isFunction as u } from "../../../utils/is.mjs";
import { useFormSlots as F } from "./hooks/useFormSlots.mjs";
import { useCol as b } from "./hooks/useCol.mjs";
import g from "../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/set.mjs";
import j from "../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/cloneDeep.mjs";
function v(o, t, r) {
if (o.slot) return t[o.slot] && t[o.slot]({
formData: r
});
if (u(o.render)) return o.render({
formData: r
});
}
const U = /* @__PURE__ */ h({
name: "FormColumns",
components: {
FormItem: f
},
props: {
columns: {
type: Array,
default: () => []
},
formProps: {
type: Object,
default: () => ({})
},
options: {
type: Object,
default: () => ({})
},
formConfig: {
type: Object,
default: () => ({})
},
modelValue: {
type: Object,
default: () => ({})
}
},
emits: ["update:modelValue", "change"],
setup(o, {
slots: t,
emit: r
}) {
return () => {
const {
columns: l,
formProps: m,
options: i,
modelValue: n
} = o;
return l.map((e, d) => {
const {
scopedSlots: c
} = F(e, t, m), {
colKls: y,
colStyle: V
} = b(m, e);
return C(w(f, {
key: e.__key,
ref: `formItem${d}`,
col: e,
modelValue: n,
formConfig: m,
options: i,
class: y.value,
style: V.value,
"onUpdate:modelValue": (a, s) => {
const p = g(j(n), s, a);
r("update:modelValue", p), r("change", {
value: a,
field: s,
formData: p
});
}
}, {
default: () => [u(e.render) || e.slot ? v(e, t, o.modelValue) : null],
...t,
...c
}), [[D, u(e.show) ? e.show(n) : e.show]]);
});
};
}
});
export {
U as default
};
//# sourceMappingURL=FormColumns.mjs.map