yanzhen-design-vue
Version:
68 lines (67 loc) • 3.12 kB
JavaScript
"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const vue = require("vue");
const core = require("@yanzhen-lowcode/core");
const index = require("../../form/index.cjs");
const index$1 = require("../../row/index.cjs");
require("./form-provider-item.vue.cjs");
const useFormProvider = require("./use-form-provider.cjs");
const formProvider = require("./form-provider.cjs");
const formProviderItem_vue_vue_type_script_setup_true_lang = require("./form-provider-item.vue2.cjs");
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
...{ name: formProvider.formProviderName },
__name: "form-provider",
props: formProvider.formProviderProps,
emits: formProvider.formProviderEmits,
setup(__props, { emit: __emit }) {
const { ns } = formProvider.formProviderOptions;
const props = __props;
const emits = __emit;
const {
ctx: { pageProviderProps, schemaRef, modelRef, rulesRef, formSchema, rowSchema, bodySchema },
templates: { DefinePageProviderItem, ReusablePageProviderItem }
} = useFormProvider.useFormProvider(props, emits);
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
vue.createVNode(vue.unref(DefinePageProviderItem), null, {
default: vue.withCtx(() => [
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(bodySchema), (schema) => {
return vue.openBlock(), vue.createBlock(formProviderItem_vue_vue_type_script_setup_true_lang.default, {
key: schema.key,
schema
}, null, 8, ["schema"]);
}), 128))
]),
_: 1
}),
vue.createVNode(vue.unref(core.PageProvider), vue.mergeProps({
value: vue.unref(modelRef),
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => vue.isRef(modelRef) ? modelRef.value = $event : null),
schema: vue.unref(schemaRef)
}, vue.unref(pageProviderProps)), {
body: vue.withCtx(() => [
vue.createVNode(vue.unref(index.YzForm), vue.mergeProps({
ref: vue.unref(formSchema).ref,
model: vue.unref(modelRef),
rules: vue.unref(rulesRef)
}, vue.unref(formSchema).props, {
class: [vue.unref(ns).b()]
}), {
default: vue.withCtx(() => [
vue.unref(rowSchema) ? (vue.openBlock(), vue.createBlock(vue.unref(index$1.YzRow), vue.normalizeProps(vue.mergeProps({ key: 0 }, vue.unref(rowSchema).props)), {
default: vue.withCtx(() => [
vue.createVNode(vue.unref(ReusablePageProviderItem))
]),
_: 1
}, 16)) : (vue.openBlock(), vue.createBlock(vue.unref(ReusablePageProviderItem), { key: 1 }))
]),
_: 1
}, 16, ["model", "rules", "class"])
]),
_: 1
}, 16, ["value", "schema"])
], 64);
};
}
});
exports.default = _sfc_main;