UNPKG

@ezijing/vue-form

Version:

基于Vue Element-UI的表单

796 lines (795 loc) 28 kB
import C from "axios"; function o(s, e, t, n, a, r, i, f) { var l = typeof s == "function" ? s.options : s; e && (l.render = e, l.staticRenderFns = t, l._compiled = !0), n && (l.functional = !0), r && (l._scopeId = "data-v-" + r); var u; if (i ? (u = function(d) { d = d || // cached call this.$vnode && this.$vnode.ssrContext || // stateful this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !d && typeof __VUE_SSR_CONTEXT__ < "u" && (d = __VUE_SSR_CONTEXT__), a && a.call(this, d), d && d._registeredComponents && d._registeredComponents.add(i); }, l._ssrRegister = u) : a && (u = f ? function() { a.call( this, (l.functional ? this.parent : this).$root.$options.shadowRoot ); } : a), u) if (l.functional) { l._injectStyles = u; var g = l.render; l.render = function($, h) { return u.call(h), g($, h); }; } else { var _ = l.beforeCreate; l.beforeCreate = _ ? [].concat(_, u) : [u]; } return { exports: s, options: l }; } const y = { name: "VMenu", props: { menus: { type: Array, default: () => [] }, value: { type: String, default: "" } }, methods: { handleClick(s) { if (!s.href) { if (s.onClick) return s.onClick(s); this.$emit("input", s.id), this.$emit("change", s.id, s); } } } }; var k = function() { var e = this, t = e._self._c; return t("div", { staticClass: "v-menu" }, e._l(e.menus, function(n, a) { return t("div", { key: a, staticClass: "v-menu__item" }, [t("div", { staticClass: "v-menu__title" }, [e._v(e._s(n.title))]), n.children ? t("div", { staticClass: "v-submenu" }, e._l(n.children, function(r) { return t("div", { key: r.id, staticClass: "v-submenu__item", class: { "is-active": r.id === e.value }, on: { click: function(i) { return e.handleClick(r); } } }, [r.href ? t("a", { attrs: { href: r.href, target: r.target || "_blank" } }, [r.required ? t("em", [e._v("*")]) : e._e(), t("span", [e._v(e._s(r.title))])]) : [r.required ? t("em", [e._v("*")]) : e._e(), t("span", [e._v(e._s(r.title))])]], 2); }), 0) : e._e()]); }), 0); }, S = [], x = /* @__PURE__ */ o( y, k, S, !1, null, null, null, null ); const T = x.exports, c = C.create({ timeout: 6e4, withCredentials: !0 }); c.interceptors.request.use( function(s) { return s; }, function(s) { return Promise.reject(s); } ); c.interceptors.response.use( function(s) { const { data: e } = s; return e.error.toString() === "1" ? Promise.reject(e) : s.data; }, function(s) { return s.response ? Promise.reject(s.response.data) : Promise.reject(s); } ); const V = { name: "VInput", props: { options: { type: Object, default() { return {}; } }, data: { type: Object, default() { return {}; } } }, computed: { currentValue() { return this.data[this.options.model]; } }, methods: { onBlur() { this.currentValue && typeof this.currentValue == "string" && (this.data[this.options.model] = this.currentValue.trim()); } } }; var A = function() { var e = this, t = e._self._c; return t("el-input", e._b({ staticStyle: { width: "300px" }, attrs: { clearable: "" }, on: { blur: e.onBlur }, model: { value: e.data[e.options.model], callback: function(n) { e.$set(e.data, e.options.model, n); }, expression: "data[options.model]" } }, "el-input", e.$attrs, !1)); }, w = [], I = /* @__PURE__ */ o( V, A, w, !1, null, null, null, null ); const F = I.exports, O = { name: "VSelect", props: { options: { type: Object, default() { return {}; } }, data: { type: Object, default() { return {}; } } } }; var P = function() { var e = this, t = e._self._c; return t("el-select", e._b({ staticStyle: { width: "300px" }, model: { value: e.data[e.options.model], callback: function(n) { e.$set(e.data, e.options.model, n); }, expression: "data[options.model]" } }, "el-select", e.$attrs, !1), e._l(e.options.values, function(n) { return t("el-option", { key: n.value, attrs: { label: n.label, value: n.value } }); }), 1); }, R = [], j = /* @__PURE__ */ o( O, P, R, !1, null, null, null, null ); const N = j.exports, M = { name: "VRadio", props: { options: { type: Object, default() { return {}; } }, data: { type: Object, default() { return {}; } } } }; var E = function() { var e = this, t = e._self._c; return t("el-radio-group", e._b({ model: { value: e.data[e.options.model], callback: function(n) { e.$set(e.data, e.options.model, n); }, expression: "data[options.model]" } }, "el-radio-group", e.$attrs, !1), e._l(e.options.values, function(n) { return t("el-radio", { key: n.value, attrs: { label: n.value } }, [e._v(e._s(n.label))]); }), 1); }, L = [], U = /* @__PURE__ */ o( M, E, L, !1, null, null, null, null ); const q = U.exports, z = { name: "VCheckbox", props: { options: { type: Object, default() { return {}; } }, data: { type: Object, default() { return {}; } } } }; var D = function() { var e = this, t = e._self._c; return t("el-checkbox-group", e._b({ model: { value: e.data[e.options.model], callback: function(n) { e.$set(e.data, e.options.model, n); }, expression: "data[options.model]" } }, "el-checkbox-group", e.$attrs, !1), e._l(e.options.values, function(n) { return t("el-checkbox", { key: n.value, attrs: { label: n.value, value: n.value } }, [e._v(" " + e._s(n.label) + " ")]); }), 1); }, H = [], B = /* @__PURE__ */ o( z, D, H, !1, null, null, null, null ); const W = B.exports, X = { name: "VDatepicker", props: { options: { type: Object, default() { return {}; } }, data: { type: Object, default() { return {}; } } } }; var G = function() { var e = this, t = e._self._c; return t("el-date-picker", e._b({ staticStyle: { width: "300px" }, model: { value: e.data[e.options.model], callback: function(n) { e.$set(e.data, e.options.model, n); }, expression: "data[options.model]" } }, "el-date-picker", e.$attrs, !1)); }, J = [], K = /* @__PURE__ */ o( X, G, J, !1, null, null, null, null ); const Q = K.exports, Y = { name: "VUpload", inject: { elForm: { default: "" } }, props: { options: { type: Object, default() { return {}; } }, data: { type: Object, default() { return {}; } }, disabled: Boolean }, data() { return { files: [], dialogVisible: !1, dialogImageUrl: "", hasUpload: !0 }; }, watch: { data: { immediate: !0, deep: !0, handler(s) { this.files = s[this.options.model] || []; } }, files: { immediate: !0, deep: !0, handler(s) { this.hasUpload = this.limit ? s.length < this.limit : !0; } } }, computed: { fileList() { return this.files.map((s) => ({ id: s.id, url: s.url || s.oss_sign_url, disabled: s.disabled || !1 })); }, attrs() { return Object.assign({}, this.options.attrs); }, defaultImage() { return this.attrs.image; }, limit() { return this.attrs.limit; }, maxSize() { return this.attrs.maxSize || 10; }, classes() { return { "has-upload": this.hasUpload }; }, uploadDisabled() { return this.disabled || (this.elForm || {}).disabled; } }, methods: { beforeUploadFile(s) { const e = s.size / 1024 / 1024 < this.maxSize; return e || this.$message.error(`上传文件大小不能超过 ${this.maxSize}MB!`), e; }, // 上传接口请求 handleHttpRequest(s) { let { action: e, data: t = {}, headers: n = {} } = this.options.attrs; t = Object.assign({ file: s.file }, t), n = Object.assign({ "Content-Type": "multipart/form-data" }), c.post(e, t, { headers: n }).then(s.onSuccess).catch(s.onError); }, // 上传成功 handleSuccess(s) { this.files = s.data.material.attachments.filter((e) => e.file_type_id === this.options.model || this.options.model === "RECOMMENDATION_LETTER" && e.file_type_id === "RECOMMENDATION_LETTER_2" && this.limit !== 1), this.data[this.options.model] = this.files, this.$emit("uploaded", s), this.$message.success(s.message); }, handleChange(s, e) { this.hasUpload = this.limit ? e.length < this.limit : !0; }, // 上传失败 handleError(s) { this.$message.error(s.message); }, // 上传数量限制 handleExceed() { this.$message.warning(`最多上传${this.options.attrs.limit}个文件`); }, // 预览 handlePreview(s) { const e = ["jpg", "jpeg", "png", "gif"], n = (s.url.includes("?") ? s.url.split("?").shift() : s.url).split(".").pop() || ""; e.includes(n.toLocaleLowerCase()) ? (this.dialogVisible = !0, this.dialogImageUrl = s.url) : this.newWindowPreview(s.url); }, // 删除 handleRemove(s) { let { deleteAction: e, headers: t = {} } = this.options.attrs; s.id && c.post(e, { item_id: s.id }, { headers: t }).then((n) => { this.data[this.options.model] = this.data[this.options.model].filter((a) => a.id !== s.id), this.$message.success(n.message); }).catch((n) => this.$message.error(n.message)); }, // 新窗口预览 newWindowPreview(s) { const e = document.createElement("a"); e.href = s, e.target = "_blank", document.body.appendChild(e), e.click(), e.remove(); } } }; var Z = function() { var e = this, t = e._self._c; return t("div", { staticClass: "v-upload" }, [t("el-upload", e._b({ ref: "upload", class: e.classes, attrs: { action: "", "list-type": "picture-card", multiple: !1, "http-request": e.handleHttpRequest, "on-preview": e.handlePreview, "on-remove": e.handleRemove, "on-success": e.handleSuccess, "on-change": e.handleChange, "on-error": e.handleError, "on-exceed": e.handleExceed, "file-list": e.fileList, "before-upload": e.beforeUploadFile }, scopedSlots: e._u([{ key: "file", fn: function({ file: n }) { return [t("el-image", { staticClass: "el-upload-list__item-thumbnail", attrs: { src: n.url } }, [t("div", { staticClass: "image-slot", attrs: { slot: "error" }, slot: "error" }, [t("i", { staticClass: "el-icon-document" })])]), t("span", { staticClass: "el-upload-list__item-actions" }, [t("span", { staticClass: "el-upload-list__item-preview", on: { click: function(a) { return e.handlePreview(n); } } }, [t("i", { staticClass: "el-icon-zoom-in" })]), !e.uploadDisabled && !n.disabled ? t("span", { staticClass: "el-upload-list__item-delete", on: { click: function(a) { return e.handleRemove(n); } } }, [t("i", { staticClass: "el-icon-delete" })]) : e._e()])]; } }]) }, "el-upload", e.options.attrs, !1), [t("div", { staticClass: "cover" }, [e.defaultImage ? t("img", { staticClass: "default-image", attrs: { src: e.defaultImage } }) : e._e(), t("i", { staticClass: "el-icon-plus" })])]), t("el-dialog", { attrs: { visible: e.dialogVisible }, on: { "update:visible": function(n) { e.dialogVisible = n; } } }, [t("img", { attrs: { width: "100%", src: e.dialogImageUrl } })])], 1); }, ee = [], te = /* @__PURE__ */ o( Y, Z, ee, !1, null, null, null, null ); const se = te.exports, ne = { name: "VForm", components: { VInput: F, VSelect: N, VRadio: q, VCheckbox: W, VDatepicker: Q, VUpload: se }, props: { options: { type: Object, default: () => ({}) }, model: { type: Object, default: () => ({}) }, items: { type: Array, default: () => [] } }, data() { return { ruleForm: {} }; }, watch: { model: { immediate: !0, deep: !0, handler(s) { this.ruleForm = s; } } }, computed: { $form() { return this.$refs.form; }, currentItems() { return this.items.filter((s) => Object.prototype.hasOwnProperty.call(s, "isShow") ? s.isShow(this.ruleForm) : !0); } } }; var ae = function() { var e = this, t = e._self._c; return t("el-form", e._b({ ref: "form", attrs: { model: e.ruleForm }, nativeOn: { submit: function(n) { n.preventDefault(); } } }, "el-form", e.options, !1), [e._l(e.currentItems, function(n, a) { return [t("el-form-item", e._b({ key: a, attrs: { prop: n.model } }, "el-form-item", n, !1), [n.slotName ? [e._t(n.slotName, null, null, { item: n, items: e.items, model: e.ruleForm })] : [n.prepend ? t("div", { staticClass: "v-form-item__prepend", domProps: { innerHTML: e._s(n.prepend) } }) : e._e(), n.prependSlotName ? e._t(n.prependSlotName, null, null, { item: n, items: e.items, form: e.ruleForm }) : e._e(), t(n.type, e._b({ tag: "component", attrs: { options: n, data: e.ruleForm } }, "component", n.attrs, !1)), n.appendSlotName ? e._t(n.appendSlotName, null, null, { item: n, items: e.items, form: e.ruleForm }) : e._e(), n.append ? t("div", { staticClass: "v-form-item__append", domProps: { innerHTML: e._s(n.append) } }) : e._e()]], 2)]; })], 2); }, re = [], ie = /* @__PURE__ */ o( ne, ae, re, !1, null, null, null, null ); const le = ie.exports, v = { action: "", headers: {}, params: {}, data: {}, beforeRequest(s) { return s; }, callback(s) { return s; }, errorCallback(s) { return s; } }, oe = { name: "VFormPane", inject: ["options"], components: { VForm: le }, props: { page: { type: Object, default: () => ({}) } }, data() { return { model: {}, form: {} }; }, computed: { isMultiple() { return Array.isArray(this.model); }, slotNames() { var s, e; return ((e = (s = this.form) == null ? void 0 : s.items) == null ? void 0 : e.reduce((t, n) => (n.slotName && t.push(n.slotName), n.prependSlotName && t.push(n.prependSlotName), n.appendSlotName && t.push(n.appendSlotName), t), [])) || []; }, submitButtonText() { return this.form.submitText || this.options.submitText; }, get() { return Object.assign({}, v, this.page.get); }, update() { return Object.assign({}, v, this.page.update); } }, watch: { page: { immediate: !0, handler() { const { form: s } = this.page, e = Object.assign({ disabled: this.options.disabled }, s.options); this.form = Object.assign({ minlength: 1, hasSubmit: !0, hasButton: !0 }, s, { options: e }); } } }, beforeMount() { this.model = this.form.model || (this.form.hasAdd ? [Object.assign({}, this.form.defaultModel)] : {}), this.getData(); }, methods: { // 获取 async getData() { let { action: s, headers: e = {}, params: t = {}, beforeRequest: n, callback: a, errorCallback: r } = this.get; if (!s) { a && (this.model = a.call(this)); return; } n && (t = n(t)); try { const i = await c.get(s, { params: t, headers: e }); this.form.hasAdd && Array.isArray(i) && !i.length && i.push(Object.assign({}, this.form.defaultModel)), this.model = a ? a.call(this, i) : i; } catch (i) { r && r.call(this, i), this.$emit("error", i); } }, // 更新 async updateData() { let { action: s, headers: e = {}, data: t = {}, beforeRequest: n, callback: a, errorCallback: r } = this.update; if (!s) { this.$emit("update", this.update.beforeRequest(this.model)); return; } n && (t = n(this.model)); try { const i = await c.post(s, t, { headers: e }); a && a.call(this, i), this.$emit("success", i); } catch (i) { r && r.call(this, i), this.$emit("error", i); } }, // 新增表单 handleAdd() { this.form.options.disabled || this.model.push(Object.assign({}, this.form.defaultModel)); }, // 删除表单 handleRemove(s) { this.form.options.disabled || this.model.splice(s, 1); }, onSubmit() { this.handleSubmit(); }, onPrev() { this.handlePrev(); }, onNext() { this.handleNext(); }, // 提交 async handleSubmit() { if (this.form.options.disabled) return; const s = this.$refs.form, t = (Array.isArray(s) ? s : [s]).map((n) => n.$form.validate()); return await Promise.all(t).then(() => this.page.onUpdate ? this.page.onUpdate(this.update.beforeRequest(this.model)) : this.updateData()), !1; }, // 上一步 async handlePrev() { this.page.onPrev && await this.page.onPrev(this.model), this.form.triggerSubmitOnChangeStep && await this.handleSubmit(), this.$emit("prev", this.page.prev); }, // 下一步 async handleNext() { this.page.onNext && await this.page.onNext(this.model), this.form.triggerSubmitOnChangeStep && await this.handleSubmit(), this.$emit("next", this.page.next); } } }; var de = function() { var e = this, t = e._self._c; return t("div", { staticClass: "v-form-pane" }, [e.form.prepend ? t("div", { staticClass: "v-form-pane__prepend", domProps: { innerHTML: e._s(e.form.prepend) } }) : e._e(), e.isMultiple ? [e.form.prependItems ? t("v-form", { ref: "form", attrs: { options: e.form.options, items: e.form.prependItems, model: e.model[0] || e.model } }) : e._e(), e._l(e.model, function(n, a) { return [t("div", { key: a, staticClass: "v-form-group" }, [t("div", { staticClass: "v-form-group__inner" }, [t("v-form", { ref: "form", refInFor: !0, staticClass: "v-form-group__content", attrs: { options: e.form.options, items: e.form.items, model: n }, scopedSlots: e._u([e._l(e.slotNames, function(r) { return { key: r, fn: function(i) { return [e._t(r, null, null, i)]; } }; })], null, !0) }), e.form.aside ? [t("div", { staticClass: "v-form-group__aside" }, [e.form.aside.prepend.visible && e.form.aside.prepend.visible(n) ? t("div", { domProps: { innerHTML: e._s(e.form.aside.prepend.html) } }) : e._e(), t("div", e._l(e.form.aside.buttons, function(r, i) { return t("div", { key: i }, [r.visible && r.visible(n) ? t("el-button", { attrs: { type: "primary", size: "medium", plain: "" }, on: { click: function(f) { return r.onClick(n, e.$refs.form[a]); } } }, [e._v(" " + e._s(r.text))]) : e._e()], 1); }), 0)])] : e._e()], 2), a > e.form.minlength - 1 ? [t("div", { staticClass: "v-form-group__remove", on: { click: function(r) { return e.handleRemove(a); } } }, [e._v("删除")])] : e._e()], 2)]; }), e.form.hasAdd ? t("div", { staticClass: "v-form-group__add" }, [t("i", { staticClass: "el-icon-circle-plus", on: { click: e.handleAdd } })]) : e._e(), e.form.appendItems ? t("v-form", { ref: "form", attrs: { options: e.form.options, items: e.form.appendItems, model: e.model[0] || e.model } }) : e._e()] : [t("v-form", { ref: "form", attrs: { options: e.form.options, items: e.form.items, model: e.model }, scopedSlots: e._u([e._l(e.slotNames, function(n) { return { key: n, fn: function(a) { return [e._t(n, null, null, a)]; } }; })], null, !0) })], e.form.append ? t("div", { staticClass: "v-form-pane__append", domProps: { innerHTML: e._s(e.form.append) } }) : e._e(), e.form.hasButton ? t("div", { staticClass: "v-form-footer" }, [e.page.prev ? t("el-button", { attrs: { size: "medium" }, on: { click: e.onPrev } }, [e._v(e._s(e.options.prevText))]) : e._e(), e.form.hasSubmit ? t("el-button", { staticStyle: { "min-width": "120px" }, attrs: { type: "primary", size: "medium", disabled: e.form.options.disabled }, nativeOn: { click: function(n) { return e.onSubmit.apply(null, arguments); } } }, [e._v(" " + e._s(e.submitButtonText) + " ")]) : e._e(), e.page.next ? t("el-button", { attrs: { size: "medium" }, on: { click: e.onNext } }, [e._v(e._s(e.options.nextText))]) : e._e()], 1) : e._e()], 2); }, ue = [], ce = /* @__PURE__ */ o( oe, de, ue, !1, null, null, null, null ); const p = ce.exports, pe = { name: "VCardForm", components: { VFormPane: p }, inject: ["options"], props: { page: { type: Object, default: () => ({}) } } }; var me = function() { var e = this, t = e._self._c; return t("div", { staticClass: "v-card" }, [t("div", { staticClass: "v-card__hd" }, [e._t("header", function() { return [t("h1", { staticClass: "v-card__title" }, [e._v(e._s(e.page.title))]), t("div", { staticClass: "v-card__back", on: { click: function(n) { return e.$emit("back"); } } }, [t("i", { staticClass: "el-icon-arrow-left" }), t("span", [e._v(e._s(e.options.backText))])])]; })], 2), t("div", { staticClass: "v-card__bd" }, [e._t("default", function() { return [e.page.prepend ? t("div", { staticClass: "v-card-html", domProps: { innerHTML: e._s(e.page.prepend) } }) : e._e(), t("VFormPane", e._g({ key: e.page.id, attrs: { page: e.page } }, e.$listeners)), e.page.append ? t("div", { staticClass: "v-card-html", domProps: { innerHTML: e._s(e.page.append) } }) : e._e()]; })], 2)]); }, fe = [], _e = /* @__PURE__ */ o( pe, me, fe, !1, null, null, null, null ); const he = _e.exports, ve = { name: "VCardFormTabs", components: { VFormPane: p }, inject: ["options"], props: { value: { type: String }, tabs: { type: Array, default: () => [] } }, data() { return {}; }, computed: { tabSlotNames() { var e; const s = []; return (e = this.tabs) == null || e.forEach((t) => { var n, a; (a = (n = t.form) == null ? void 0 : n.items) == null || a.forEach((r) => { r.slotName && s.push(r.slotName), r.prependSlotName && s.push(r.prependSlotName), r.appendSlotName && s.push(r.appendSlotName); }); }), s; } }, methods: { handleTabClick(s) { this.$emit("change", s.name); } } }; var be = function() { var e = this, t = e._self._c; return t("div", { staticClass: "v-tabs-card" }, [t("div", { staticClass: "v-tabs-card__back", on: { click: function(n) { return e.$emit("back"); } } }, [t("i", { staticClass: "el-icon-arrow-left" }), t("span", [e._v(e._s(e.options.backText))])]), t("el-tabs", { attrs: { type: "card", value: e.value }, on: { "tab-click": e.handleTabClick } }, e._l(e.tabs, function(n) { return t("el-tab-pane", { key: n.id, attrs: { lazy: "", name: n.id }, scopedSlots: e._u([{ key: "label", fn: function() { return [e._v(" " + e._s(n.title) + " "), n.required ? t("span", { staticClass: "red" }, [e._v("*")]) : e._e()]; }, proxy: !0 }], null, !0) }, [n.prepend ? t("div", { staticClass: "v-card-html", domProps: { innerHTML: e._s(n.prepend) } }) : e._e(), t("VFormPane", e._g({ key: n.id, attrs: { page: n }, scopedSlots: e._u([e._l(e.tabSlotNames, function(a) { return { key: a, fn: function(r) { return [e._t(a, null, null, r)]; } }; })], null, !0) }, e.$listeners)), n.append ? t("div", { staticClass: "v-card-html", domProps: { innerHTML: e._s(n.append) } }) : e._e()], 1); }), 1)], 1); }, ge = [], $e = /* @__PURE__ */ o( ve, be, ge, !1, null, null, null, null ); const Ce = $e.exports, ye = { name: "VueForm", components: { VMenu: T, VCardForm: he, VCardFormTabs: Ce, VFormPane: p }, props: { menus: { type: Array, default: () => [] }, defaultActive: { type: String }, tabActive: { type: String }, disabled: { type: Boolean, default: !1 }, backText: { type: String, default: "返回报名系统" }, prevText: { type: String, default: "上一步" }, nextText: { type: String, default: "下一步" }, submitText: { type: String, default: "保存" } }, provide() { return { options: { disabled: this.disabled, backText: this.backText, prevText: this.prevText, nextText: this.nextText, submitText: this.submitText } }; }, data() { return { menuActiveId: this.defaultActive, tabActiveId: this.tabActive }; }, computed: { currentMenus() { return this.filterVisible(this.menus); }, pages() { return this.currentMenus[0].children.reduce((e, t) => t.tabs ? [...e, ...t.tabs.map((n) => ({ ...n, isTab: !0, parentId: t.id }))] : [...e, t], []).map((e, t, n) => { var a, r; return { ...e, prev: e.prev || ((a = n[t - 1]) == null ? void 0 : a.id), next: e.next || ((r = n[t + 1]) == null ? void 0 : r.id) }; }); }, tabPages() { return this.pages.filter((s) => s.parentId === this.menuActiveId); }, // 当前页的数据 page() { const s = this.tabPages.length ? this.tabActiveId : this.menuActiveId; return this.pages.find((e) => e.id === s); }, slotNames() { var s, e, t; return ((t = (e = (s = this.page) == null ? void 0 : s.form) == null ? void 0 : e.items) == null ? void 0 : t.reduce((n, a) => (a.slotName && n.push(a.slotName), a.prependSlotName && n.push(a.prependSlotName), a.appendSlotName && n.push(a.appendSlotName), n), [])) || []; } }, watch: { defaultActive(s) { this.menuActiveId = s; }, tabActive(s) { this.tabActiveId = s; } }, methods: { filterVisible(s) { return s.reduce((e, t) => { if (typeof t.visible == "function" ? t.visible.call(this) : t.visible === void 0 ? !0 : t.visible) { const a = { ...t }; t.children && (a.children = this.filterVisible(t.children)), t.tabs && (a.tabs = this.filterVisible(t.tabs)), e.push(a); } return e; }, []); }, // 上一步\下一步 handleStepChange(s) { const e = this.pages.find((t) => t.id === s); e.isTab ? (this.handleTabChange(s), this.menuActiveId !== e.parentId && this.handleMenuChange(e.parentId)) : this.handleMenuChange(s); }, handleMenuChange(s) { this.menuActiveId = s, this.$emit("page-change", this.menuActiveId); }, handleTabChange(s) { this.tabActiveId = s, this.$emit("tab-change", this.tabActiveId); } } }; var ke = function() { var e = this, t = e._self._c; return t("div", { staticClass: "v-layout" }, [t("div", { staticClass: "v-layout-aside" }, [e._t("aside", function() { return [e._t("aside-prepend"), t("v-menu", { attrs: { menus: e.currentMenus }, on: { change: e.handleMenuChange }, model: { value: e.menuActiveId, callback: function(n) { e.menuActiveId = n; }, expression: "menuActiveId" } }), e._t("aside-append")]; })], 2), t("div", { key: e.menuActiveId, staticClass: "v-layout-main" }, [e._t("default", function() { return [e.page ? [e.tabPages.length ? t("VCardFormTabs", e._g({ attrs: { tabs: e.tabPages }, on: { change: e.handleTabChange, prev: e.handleStepChange, next: e.handleStepChange }, scopedSlots: e._u([e._l(e.slotNames, function(n) { return { key: n, fn: function(a) { return [e._t(n, null, null, a)]; } }; })], null, !0), model: { value: e.tabActiveId, callback: function(n) { e.tabActiveId = n; }, expression: "tabActiveId" } }, e.$listeners)) : t("VCardForm", e._g({ attrs: { page: e.page }, on: { prev: e.handleStepChange, next: e.handleStepChange }, scopedSlots: e._u([e._l(e.slotNames, function(n) { return { key: n, fn: function(a) { return [e._t(n, null, null, a)]; } }; })], null, !0) }, e.$listeners), [e._t("content")], 2)] : e._e()]; })], 2)]); }, Se = [], xe = /* @__PURE__ */ o( ye, ke, Se, !1, null, null, null, null ); const Te = xe.exports, b = [Te], m = function(s) { m.installed || b.map((e) => s.component(e.name, e)); }; typeof window < "u" && window.Vue && m(window.Vue); const Ae = { // 导出的对象必须具有 install,才能被 Vue.use() 方法安装 install: m, // 以下是具体的组件列表 ...b }; export { Ae as default };