/*! * @form-create/element-ui v3.1.15 * (c) 2018-2022 xaboy * Github https://github.com/xaboy/form-create * Released under the MIT License. */ ! function(e, t) { "object" == typeof exports && "undefined" != typeof module ? t(exports, require("vue")) : "function" == typeof define && define.amd ? define(["exports", "vue"], t) : t((e = "undefined" != typeof globalThis ? globalThis : e || self).formCreate = {}, e.Vue) }(this, (function(exports, vue) { "use strict"; function ownKeys(e, t) { var n = Object.keys(e); if (Object.getOwnPropertySymbols) { var r = Object.getOwnPropertySymbols(e); t && (r = r.filter((function(t) { return Object.getOwnPropertyDescriptor(e, t).enumerable }))), n.push.apply(n, r) } return n } function _objectSpread2(e) { for (var t = 1; t < arguments.length; t++) { var n = null != arguments[t] ? arguments[t] : {}; t % 2 ? ownKeys(Object(n), !0).forEach((function(t) { _defineProperty(e, t, n[t]) })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object .getOwnPropertyDescriptors(n)) : ownKeys(Object(n)).forEach((function(t) { Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t)) })) } return e } function _typeof(e) { return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e }, _typeof(e) } function _classCallCheck(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") } function _defineProperty(e, t, n) { return t in e ? Object.defineProperty(e, t, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = n, e } function _inherits(e, t) { if ("function" != typeof t && null !== t) throw new TypeError( "Super expression must either be null or a function"); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), t && _setPrototypeOf(e, t) } function _getPrototypeOf(e) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) { return e.__proto__ || Object.getPrototypeOf(e) }, _getPrototypeOf(e) } function _setPrototypeOf(e, t) { return _setPrototypeOf = Object.setPrototypeOf || function(e, t) { return e.__proto__ = t, e }, _setPrototypeOf(e, t) } function _isNativeReflectConstruct() { if ("undefined" == typeof Reflect || !Reflect.construct) return !1; if (Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {}))), !0 } catch (e) { return !1 } } function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e } function _possibleConstructorReturn(e, t) { if (t && ("object" == typeof t || "function" == typeof t)) return t; if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(e) } function _createSuper(e) { var t = _isNativeReflectConstruct(); return function() { var n, r = _getPrototypeOf(e); if (t) { var i = _getPrototypeOf(this).constructor; n = Reflect.construct(r, arguments, i) } else n = r.apply(this, arguments); return _possibleConstructorReturn(this, n) } } function _toConsumableArray(e) { return _arrayWithoutHoles(e) || _iterableToArray(e) || _unsupportedIterableToArray(e) || _nonIterableSpread() } function _arrayWithoutHoles(e) { if (Array.isArray(e)) return _arrayLikeToArray(e) } function _iterableToArray(e) { if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array .from(e) } function _unsupportedIterableToArray(e, t) { if (e) { if ("string" == typeof e) return _arrayLikeToArray(e, t); var n = Object.prototype.toString.call(e).slice(8, -1); return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? _arrayLikeToArray(e, t) : void 0 } } function _arrayLikeToArray(e, t) { (null == t || t > e.length) && (t = e.length); for (var n = 0, r = new Array(t); n < t; n++) r[n] = e[n]; return r } function _nonIterableSpread() { throw new TypeError( "Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ) } function getSlot(e, t) { return Object.keys(e).reduce((function(n, r) { return t && -1 !== t.indexOf(r) || n.push(e[r]), n }), []) } var NAME$9 = "fcCheckbox", Checkbox = vue.defineComponent({ name: NAME$9, inheritAttrs: !1, props: { formCreateInject: Object, modelValue: { type: Array, default: function() { return [] } }, type: String }, emits: ["update:modelValue"], setup: function(e, t) { var n = vue.toRef(e.formCreateInject, "options", []); return { options: function() { return Array.isArray(n.value) ? n.value : [] }, value: vue.toRef(e, "modelValue"), onInput: function(e) { t.emit("update:modelValue", e) } } }, render: function() { var e, t, n = this, r = "button" === this.type ? "ElCheckboxButton" : "ElCheckbox", i = vue.resolveComponent(r); return vue.createVNode(vue.resolveComponent("ElCheckboxGroup"), vue.mergeProps(this .$attrs, { modelValue: this.value, "onUpdate:modelValue": this.onInput }), _objectSpread2({ default: function() { return [n.options().map((function(e, t) { var n = _objectSpread2({}, e), o = n.value; return delete n.value, vue.createVNode(i, vue.mergeProps(n, { label: o, key: r + t + "-" + e.value }), { default: function() { return [n.label || n .value || "" ] } }) })), null === (e = (t = n.$slots).default) || void 0 === e ? void 0 : e.call(t) ] } }, getSlot(this.$slots, ["default"]))) } }); function toArray(e) { return Array.isArray(e) ? e : [null, void 0, ""].indexOf(e) > -1 ? [] : [e] } function Mitt(e) { e = e || new Map; var t = { $on: function(t, n) { var r = e.get(t); r && r.push(n) || e.set(t, [n]) }, $once: function(e, n) { n._once = !0, t.$on(e, n) }, $off: function(t, n) { var r = e.get(t); r && r.splice(r.indexOf(n) >>> 0, 1) }, $emit: function(n) { for (var r = arguments.length, i = new Array(r > 1 ? r - 1 : 0), o = 1; o < r; o++) i[ o - 1] = arguments[o]; (e.get(n) || []).slice().map((function(e) { e._once && (t.$off(n, e), delete e._once), e.apply(void 0, i) })), (e.get("*") || []).slice().map((function(e) { e(n, i) })) } }; return t } function styleInject(e, t) { void 0 === t && (t = {}); var n = t.insertAt; if (e && "undefined" != typeof document) { var r = document.head || document.getElementsByTagName("head")[0], i = document.createElement("style"); i.type = "text/css", "top" === n && r.firstChild ? r.insertBefore(i, r.firstChild) : r.appendChild( i), i.styleSheet ? i.styleSheet.cssText = e : i.appendChild(document.createTextNode(e)) } } var css_248z$2 = "._fc-frame ._fc-files img{display:inline-block;height:100%;vertical-align:top;width:100%}._fc-frame ._fc-upload-btn{border:1px dashed #c0ccda;cursor:pointer}._fc-frame ._fc-upload-cover{background:rgba(0,0,0,.6);bottom:0;left:0;opacity:0;position:absolute;right:0;top:0;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}._fc-frame ._fc-upload-cover i{color:#fff;cursor:pointer;font-size:20px;margin:0 2px}._fc-frame ._fc-files:hover ._fc-upload-cover{opacity:1}._fc-frame .el-upload{display:block}._fc-frame ._fc-upload-icon{cursor:pointer}._fc-files,._fc-frame ._fc-upload-btn{background:#fff;border:1px solid #c0ccda;border-radius:4px;-webkit-box-shadow:2px 2px 5px rgba(0,0,0,.1);box-shadow:2px 2px 5px rgba(0,0,0,.1);-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;height:58px;line-height:58px;margin-right:4px;overflow:hidden;position:relative;text-align:center;width:58px}"; styleInject(css_248z$2); var script$8 = { name: "IconCircleClose" }, _hoisted_1$8 = { class: "icon", viewBox: "0 0 1024 1024", xmlns: "http://www.w3.org/2000/svg" }, _hoisted_2$8 = vue.createElementVNode("path", { fill: "currentColor", d: "M466.752 512l-90.496-90.496a32 32 0 0145.248-45.248L512 466.752l90.496-90.496a32 32 0 1145.248 45.248L557.248 512l90.496 90.496a32 32 0 11-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 01-45.248-45.248L466.752 512z" }, null, -1), _hoisted_3$8 = vue.createElementVNode("path", { fill: "currentColor", d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z" }, null, -1), _hoisted_4$2 = [_hoisted_2$8, _hoisted_3$8]; function render$8(e, t, n, r, i, o) { return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$8, _hoisted_4$2) } script$8.render = render$8; var script$7 = { name: "IconDocument" }, _hoisted_1$7 = { class: "icon", viewBox: "0 0 1024 1024", xmlns: "http://www.w3.org/2000/svg" }, _hoisted_2$7 = vue.createElementVNode("path", { fill: "currentColor", d: "M832 384H576V128H192v768h640V384zm-26.496-64L640 154.496V320h165.504zM160 64h480l256 256v608a32 32 0 01-32 32H160a32 32 0 01-32-32V96a32 32 0 0132-32zm160 448h384v64H320v-64zm0-192h160v64H320v-64zm0 384h384v64H320v-64z" }, null, -1), _hoisted_3$7 = [_hoisted_2$7]; function render$7(e, t, n, r, i, o) { return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$7, _hoisted_3$7) } script$7.render = render$7; var script$6 = { name: "IconDelete" }, _hoisted_1$6 = { class: "icon", viewBox: "0 0 1024 1024", xmlns: "http://www.w3.org/2000/svg" }, _hoisted_2$6 = vue.createElementVNode("path", { fill: "currentColor", d: "M160 256H96a32 32 0 010-64h256V95.936a32 32 0 0132-32h256a32 32 0 0132 32V192h256a32 32 0 110 64h-64v672a32 32 0 01-32 32H192a32 32 0 01-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 01-32-32V416a32 32 0 0164 0v320a32 32 0 01-32 32zm192 0a32 32 0 01-32-32V416a32 32 0 0164 0v320a32 32 0 01-32 32z" }, null, -1), _hoisted_3$6 = [_hoisted_2$6]; function render$6(e, t, n, r, i, o) { return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$6, _hoisted_3$6) } script$6.render = render$6; var script$5 = { name: "IconView" }, _hoisted_1$5 = { class: "icon", viewBox: "0 0 1024 1024", xmlns: "http://www.w3.org/2000/svg" }, _hoisted_2$5 = vue.createElementVNode("path", { fill: "currentColor", d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 110 448 224 224 0 010-448zm0 64a160.192 160.192 0 00-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z" }, null, -1), _hoisted_3$5 = [_hoisted_2$5]; function render$5(e, t, n, r, i, o) { return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$5, _hoisted_3$5) } script$5.render = render$5; var script$4 = { name: "IconFolderOpened" }, _hoisted_1$4 = { class: "icon", viewBox: "0 0 1024 1024", xmlns: "http://www.w3.org/2000/svg" }, _hoisted_2$4 = vue.createElementVNode("path", { fill: "currentColor", d: "M878.08 448H241.92l-96 384h636.16l96-384zM832 384v-64H485.76L357.504 192H128v448l57.92-231.744A32 32 0 01216.96 384H832zm-24.96 512H96a32 32 0 01-32-32V160a32 32 0 0132-32h287.872l128.384 128H864a32 32 0 0132 32v96h23.04a32 32 0 0131.04 39.744l-112 448A32 32 0 01807.04 896z" }, null, -1), _hoisted_3$4 = [_hoisted_2$4]; function render$4(e, t, n, r, i, o) { return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$4, _hoisted_3$4) } function _isSlot$1(e) { return "function" == typeof e || "[object Object]" === Object.prototype.toString.call(e) && !vue .isVNode(e) } script$4.render = render$4; var NAME$8 = "fcFrame", Frame = vue.defineComponent({ name: NAME$8, props: { type: { type: String, default: "input" }, field: String, helper: { type: Boolean, default: !0 }, disabled: { type: Boolean, default: !1 }, src: { type: String, required: !0 }, icon: { type: String, default: "IconFolderOpened" }, width: { type: String, default: "500px" }, height: { type: String, default: "370px" }, maxLength: { type: Number, default: 0 }, okBtnText: { type: String, default: "确定" }, closeBtnText: { type: String, default: "关闭" }, modalTitle: String, handleIcon: { type: [String, Boolean], default: void 0 }, title: String, allowRemove: { type: Boolean, default: !0 }, onOpen: { type: Function, default: function() {} }, onOk: { type: Function, default: function() {} }, onCancel: { type: Function, default: function() {} }, onLoad: { type: Function, default: function() {} }, onBeforeRemove: { type: Function, default: function() {} }, onRemove: { type: Function, default: function() {} }, onHandle: Function, modal: { type: Object, default: function() { return {} } }, srcKey: [String, Number], modelValue: [Array, String, Number, Object], previewMask: void 0, footer: { type: Boolean, default: !0 }, reload: { type: Boolean, default: !0 }, closeBtn: { type: Boolean, default: !0 }, okBtn: { type: Boolean, default: !0 }, formCreateInject: Object }, emits: ["update:modelValue", "change"], components: { IconFolderOpened: script$4, IconView: script$5 }, data: function() { return { fileList: toArray(this.modelValue), previewVisible: !1, frameVisible: !1, previewImage: "", bus: new Mitt } }, watch: { modelValue: function(e) { this.fileList = toArray(e) } }, methods: { close: function() { this.closeModel(!0) }, closeModel: function(e) { this.bus.$emit(e ? "$close" : "$ok"), this.reload && (this.bus.$off("$ok"), this.bus .$off("$close")), this.frameVisible = !1 }, handleCancel: function() { this.previewVisible = !1 }, showModel: function() { this.disabled || !1 === this.onOpen() || (this.frameVisible = !0) }, input: function() { var e = this.fileList, t = 1 === this.maxLength ? e[0] || "" : e; this.$emit("update:modelValue", t), this.$emit("change", t) }, makeInput: function() { var e = this; return vue.createVNode(vue.resolveComponent("ElInput"), vue.mergeProps({ type: "text", modelValue: this.fileList.map((function(t) { return e.getSrc(t) })).toString(), readonly: !0 }, { key: 1 }), { append: function() { return vue.createVNode(vue.resolveComponent("ElButton"), { icon: vue.resolveComponent(e.icon), onClick: function() { return e.showModel() } }, null) }, suffix: function() { return e.fileList.length ? vue.createVNode(vue.resolveComponent( "ElIcon"), { class: "el-input__icon _fc-upload-icon", onClick: function() { e.fileList = [], e.input() } }, { default: function() { return [vue.createVNode(script$8, null, null)] } }) : null } }) }, makeGroup: function(e) { return (!this.maxLength || this.fileList.length < this.maxLength) && e.push(this .makeBtn()), vue.createVNode("div", { key: 2 }, [e]) }, makeItem: function(e, t) { return vue.createVNode("div", { class: "_fc-files", key: "3" + e }, [t]) }, valid: function(e) { var t = this.formCreateInject.field || this.field; if (t && e !== t) throw new Error("[frame]无效的字段值") }, makeIcons: function(e, t) { if (!1 !== this.handleIcon || !0 === this.allowRemove) { var n = []; return ("file" !== this.type && !1 !== this.handleIcon || "file" === this .type && this.handleIcon) && n.push(this.makeHandleIcon(e, t)), this .allowRemove && n.push(this.makeRemoveIcon(e, t)), vue.createVNode("div", { class: "_fc-upload-cover", key: 4 }, [n]) } }, makeHandleIcon: function(e, t) { var n = this, r = vue.resolveComponent(!0 === this.handleIcon || void 0 === this.handleIcon ? "icon-view" : this.handleIcon); return vue.createVNode(vue.resolveComponent("ElIcon"), { onClick: function() { return n.handleClick(e) }, key: "5" + t }, { default: function() { return [vue.createVNode(r, null, null)] } }) }, makeRemoveIcon: function(e, t) { var n = this; return vue.createVNode(vue.resolveComponent("ElIcon"), { onClick: function() { return n.handleRemove(e) }, key: "6" + t }, { default: function() { return [vue.createVNode(script$6, null, null)] } }) }, makeFiles: function() { var e = this; return this.makeGroup(this.fileList.map((function(t, n) { return e.makeItem(n, [vue.createVNode(vue.resolveComponent( "ElIcon"), { onClick: function() { return e.handleClick(t) } }, { default: function() { return [vue.createVNode(script$7, null, null)] } }), e.makeIcons(t, n)]) }))) }, makeImages: function() { var e = this; return this.makeGroup(this.fileList.map((function(t, n) { return e.makeItem(n, [vue.createVNode("img", { src: e.getSrc(t) }, null), e.makeIcons(t, n)]) }))) }, makeBtn: function() { var e = this, t = vue.resolveComponent(this.icon); return vue.createVNode("div", { class: "_fc-upload-btn", onClick: function() { return e.showModel() }, key: 7 }, [vue.createVNode(vue.resolveComponent("ElIcon"), null, { default: function() { return [vue.createVNode(t, null, null)] } })]) }, handleClick: function(e) { if (this.onHandle) return this.onHandle(e); this.previewImage = this.getSrc(e), this.previewVisible = !0 }, handleRemove: function(e) { this.disabled || !1 !== this.onBeforeRemove(e) && (this.fileList.splice(this .fileList.indexOf(e), 1), this.input(), this.onRemove(e)) }, getSrc: function(e) { return this.srcKey ? e[this.srcKey] : e }, frameLoad: function(e) { var t = this; this.onLoad(e); try { !0 === this.helper && (e.form_create_helper = { api: this.formCreateInject.api, close: function(e) { t.valid(e), t.closeModel() }, set: function(e, n) { t.valid(e), !t.disabled && t.$emit("update:modelValue", n) }, get: function(e) { return t.valid(e), t.modelValue }, onOk: function(e) { return t.bus.$on("$ok", e) }, onClose: function(e) { return t.bus.$on("$close", e) } }) } catch (e) { console.error(e) } }, makeFooter: function() { var e = this, t = this.$props, n = t.okBtnText, r = t.closeBtnText, i = t.closeBtn, o = t.okBtn; if (t.footer) return vue.createVNode("div", null, [i ? vue.createVNode(vue .resolveComponent("ElButton"), { onClick: function() { return !1 !== e.onCancel() && (e.frameVisible = !1) } }, _isSlot$1(r) ? r : { default: function() { return [r] } }) : null, o ? vue.createVNode(vue.resolveComponent( "ElButton"), { type: "primary", onClick: function() { return !1 !== e.onOk() && e.closeModel() } }, _isSlot$1(n) ? n : { default: function() { return [n] } }) : null]) } }, render: function() { var e, t = this, n = this.type; e = "input" === n ? this.makeInput() : "image" === n ? this.makeImages() : this .makeFiles(); var r = this.$props, i = r.width, o = void 0 === i ? "30%" : i, a = r.height, u = r.src, s = r.title, c = r.modalTitle; return vue.nextTick((function() { t.$refs.frame && t.frameLoad(t.$refs.frame.contentWindow || {}) })), vue.createVNode("div", { class: "_fc-frame" }, [e, vue.createVNode(vue.resolveComponent("ElDialog"), { appendToBody: !0, modal: this.previewMask, title: c, modelValue: this.previewVisible, onClose: this.handleCancel }, { default: function() { return [vue.createVNode("img", { style: "width: 100%", src: t.previewImage }, null)] } }), vue.createVNode(vue.resolveComponent("ElDialog"), vue.mergeProps({ appendToBody: !0 }, _objectSpread2({ width: o, title: s }, this.modal), { modelValue: this.frameVisible, onClose: function() { return t.closeModel(!0) } }), { default: function() { return [t.frameVisible || !t.reload ? vue.createVNode( "iframe", { ref: "frame", src: u, frameBorder: "0", style: { height: a, border: "0 none", width: "100%" } }, null) : null] }, footer: function() { return t.makeFooter() } })]) }, beforeMount: function() { var e = this.formCreateInject, t = e.name, n = e.field, r = e.api; t && r.on("fc:closeModal:" + t, this.close), n && r.on("fc:closeModal:" + n, this.close) }, beforeUnmount: function() { var e = this.formCreateInject, t = e.name, n = e.field, r = e.api; t && r.off("fc:closeModal:" + t, this.close), n && r.off("fc:closeModal:" + n, this .close) } }), NAME$7 = "fcRadio", Radio = vue.defineComponent({ name: NAME$7, inheritAttrs: !1, props: { formCreateInject: Object, modelValue: { type: [String, Number, Boolean], default: "" }, type: String }, emits: ["update:modelValue"], setup: function(e, t) { var n = vue.toRef(e.formCreateInject, "options", []); return { options: function() { return Array.isArray(n.value) ? n.value : [] }, value: vue.toRef(e, "modelValue"), onInput: function(e) { t.emit("update:modelValue", e) } } }, render: function() { var e, t, n = this, r = "button" === this.type ? "ElRadioButton" : "ElRadio", i = vue.resolveComponent(r); return vue.createVNode(vue.resolveComponent("ElRadioGroup"), vue.mergeProps(this .$attrs, { modelValue: this.value, "onUpdate:modelValue": this.onInput }), _objectSpread2({ default: function() { return [n.options().map((function(e, t) { var n = _objectSpread2({}, e), o = n.value; return delete n.value, vue.createVNode(i, vue.mergeProps(n, { label: o, key: r + t + "-" + e.value }), { default: function() { return [n.label || n .value || "" ] } }) })), null === (e = (t = n.$slots).default) || void 0 === e ? void 0 : e.call(t) ] } }, getSlot(this.$slots, ["default"]))) } }), NAME$6 = "fcSelect", Select = vue.defineComponent({ name: NAME$6, inheritAttrs: !1, props: { formCreateInject: Object, modelValue: { type: [Array, String, Number, Boolean, Object], default: void 0 }, type: String }, emits: ["update:modelValue"], setup: function(e) { var t = vue.toRef(e.formCreateInject, "options", []); return { options: function() { return Array.isArray(t.value) ? t.value : [] }, value: vue.toRef(e, "modelValue") } }, render: function() { var e, t, n = this; return vue.createVNode(vue.resolveComponent("ElSelect"), vue.mergeProps(this.$attrs, { modelValue: this.value, "onUpdate:modelValue": function(e) { return n.$emit("update:modelValue", e) } }), _objectSpread2({ default: function() { return [n.options().map((function(e, t) { return vue.createVNode(vue.resolveComponent( "ElOption"), vue.mergeProps(e, { key: t + "-" + e.value }), null) })), null === (e = (t = n.$slots).default) || void 0 === e ? void 0 : e.call(t) ] } }, getSlot(this.$slots, ["default"]))) } }), NAME$5 = "fcTree", Tree = vue.defineComponent({ name: NAME$5, inheritAttrs: !1, formCreateParser: { mergeProp: function(e) { var t = e.prop.props; t.nodeKey || (t.nodeKey = "id"), t.props || (t.props = { label: "title" }) } }, props: { type: String, modelValue: { type: [Array, String, Number], default: function() { return [] } } }, emits: ["update:modelValue"], watch: { modelValue: function() { this.setValue() } }, methods: { updateValue: function() { var e; this.$refs.tree && (e = "selected" === this.type ? this.$refs.tree.getCurrentKey() : this.$refs.tree.getCheckedKeys(), this.$emit("update:modelValue", e)) }, setValue: function() { this.$refs.tree && ("selected" === this.type ? this.$refs.tree.setCurrentKey(this .modelValue) : this.$refs.tree.setCheckedKeys(toArray(this.modelValue))) } }, render: function() { return vue.createVNode(vue.resolveComponent("ElTree"), vue.mergeProps(this.$attrs, { ref: "tree", onCheck: this.updateValue, "onNode-click": this.updateValue }), this.$slots) }, mounted: function() { this.setValue() } }), css_248z$1 = "._fc-exceed .el-upload{display:none}"; styleInject(css_248z$1); var script$3 = { name: "IconUpload" }, _hoisted_1$3 = { class: "icon", viewBox: "0 0 1024 1024", xmlns: "http://www.w3.org/2000/svg" }, _hoisted_2$3 = vue.createElementVNode("path", { fill: "currentColor", d: "M160 832h704a32 32 0 110 64H160a32 32 0 110-64zm384-578.304V704h-64V247.296L237.248 490.048 192 444.8 508.8 128l316.8 316.8-45.312 45.248L544 253.696z" }, null, -1), _hoisted_3$3 = [_hoisted_2$3]; function render$3(e, t, n, r, i, o) { return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$3, _hoisted_3$3) } function parseFile(e, t) { return { url: e, name: getFileName(e), uid: t } } function getFileName(e) { return ("" + e).split("/").pop() } script$3.render = render$3; var NAME$4 = "fcUpload", Upload = vue.defineComponent({ name: NAME$4, inheritAttrs: !1, props: { previewMask: void 0, modalTitle: String, modelValue: [Array, String] }, emits: ["update:modelValue", "change", "remove"], data: function() { return { previewVisible: !1, previewImage: "", fileList: [] } }, created: function() { this.fileList = toArray(this.modelValue).map(parseFile) }, watch: { modelValue: function(e) { this.fileList = toArray(e).map(parseFile) }, limit: function(e, t) { 1 !== t && 1 !== e || this.update() } }, methods: { handlePreview: function(e) { this.onPreview ? this.onPreview.apply(this, arguments) : (this.previewImage = e.url, this.previewVisible = !0) }, update: function(e) { var t = e.map((function(e) { return e.url })).filter((function(e) { return void 0 !== e })); this.$emit("update:modelValue", 1 === this.limit ? t[0] || "" : t) }, handleCancel: function() { this.previewVisible = !1 }, handleChange: function(e, t) { this.$emit.apply(this, ["change"].concat(Array.prototype.slice.call(arguments))), "success" === e.status && this.update(t) }, handleRemove: function(e, t) { this.$emit.apply(this, ["remove"].concat(Array.prototype.slice.call(arguments))), this.update(t) } }, render: function() { var e, t, n = this; return vue.createVNode(vue.Fragment, null, [vue.createVNode(vue.resolveComponent( "ElUpload"), vue.mergeProps({ key: this.modelValue.length, "list-type": "picture-card" }, this.$attrs, { class: { "_fc-exceed": !!this.$attrs.limit && this.$attrs.limit <= this.modelValue.length }, onPreview: this.handlePreview, onChange: this.handleChange, onRemove: this.handleRemove, fileList: this.fileList }), _objectSpread2({ default: function() { return [(null === (e = (t = n.$slots).default) || void 0 === e ? void 0 : e.call(t)) || vue .createVNode(vue.resolveComponent("ElIcon"), null, { default: function() { return [vue.createVNode( script$3, null, null )] } }) ] } }, getSlot(this.$slots, ["default"]))), vue.createVNode(vue .resolveComponent("ElDialog"), { appendToBody: !0, modal: this.previewMask, title: this.modalTitle, modelValue: this.previewVisible, onClose: this.handleCancel }, { default: function() { return [vue.createVNode("img", { style: "width: 100%", src: n.previewImage }, null)] } })]) } }), is = { type: function(e, t) { return Object.prototype.toString.call(e) === "[object " + t + "]" }, Undef: function(e) { return null == e }, Element: function(e) { return "object" === _typeof(e) && null !== e && 1 === e.nodeType && !is.Object(e) }, trueArray: function(e) { return Array.isArray(e) && e.length > 0 }, Function: function(e) { var t = this.getType(e); return "Function" === t || "AsyncFunction" === t }, getType: function(e) { var t = Object.prototype.toString.call(e); return /^\[object (.*)\]$/.exec(t)[1] }, empty: function(e) { return null == e || (!(!Array.isArray(e) || !Array.isArray(e) || e.length) || "string" == typeof e && !e) } }; function hasProperty(e, t) { return {}.hasOwnProperty.call(e, t) } ["Date", "Object", "String", "Boolean", "Array", "Number"].forEach((function(e) { is[e] = function(t) { return is.type(t, e) } })); var script$2 = { name: "IconCirclePlus" }, _hoisted_1$2 = { class: "icon", viewBox: "0 0 1024 1024", xmlns: "http://www.w3.org/2000/svg" }, _hoisted_2$2 = vue.createElementVNode("path", { fill: "currentColor", d: "M352 480h320a32 32 0 110 64H352a32 32 0 010-64z" }, null, -1), _hoisted_3$2 = vue.createElementVNode("path", { fill: "currentColor", d: "M480 672V352a32 32 0 1164 0v320a32 32 0 01-64 0z" }, null, -1), _hoisted_4$1 = vue.createElementVNode("path", { fill: "currentColor", d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z" }, null, -1), _hoisted_5 = [_hoisted_2$2, _hoisted_3$2, _hoisted_4$1]; function render$2(e, t, n, r, i, o) { return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$2, _hoisted_5) } script$2.render = render$2; var script$1 = { name: "IconRemove" }, _hoisted_1$1 = { class: "icon", viewBox: "0 0 1024 1024", xmlns: "http://www.w3.org/2000/svg" }, _hoisted_2$1 = vue.createElementVNode("path", { fill: "currentColor", d: "M352 480h320a32 32 0 110 64H352a32 32 0 010-64z" }, null, -1), _hoisted_3$1 = vue.createElementVNode("path", { fill: "currentColor", d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z" }, null, -1), _hoisted_4 = [_hoisted_2$1, _hoisted_3$1]; function render$1(e, t, n, r, i, o) { return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$1, _hoisted_4) } function $set(e, t, n) { e[t] = n } function $del(e, t) { delete e[t] } function deepExtend(e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, n = arguments.length > 2 ? arguments[2] : void 0, r = !1; for (var i in t) if (Object.prototype.hasOwnProperty.call(t, i)) { var o = t[i]; if ((r = Array.isArray(o)) || is.Object(o)) { var a = void 0 === e[i]; if (r) r = !1, a && $set(e, i, []); else if (o._clone && void 0 !== n) { if (!n) { $set(e, i, o._clone()); continue } o = o.getRule(), a && $set(e, i, {}) } else a && $set(e, i, {}); e[i] = deepExtend(e[i], o, n) } else $set(e, i, o), is.Undef(o) || (is.Undef(o.__json) || (e[i].__json = o.__json), is.Undef(o .__origin) || (e[i].__origin = o.__origin)) } return void 0 !== n && Array.isArray(e) ? e.filter((function(e) { return !e || !e.__ctrl })) : e } function deepCopy(e) { return deepExtend({}, { value: e }).value } script$1.render = render$1; var _extends = Object.assign || function(e) { for (var t, n = 1; n < arguments.length; n++) for (var r in t = arguments[n]) Object.prototype.hasOwnProperty.call(t, r) && $set(e, r, t[r]); return e }; function extend() { return _extends.apply(this, arguments) } function _isSlot(e) { return "function" == typeof e || "[object Object]" === Object.prototype.toString.call(e) && !vue .isVNode(e) } var NAME$3 = "fcGroup", Group = vue.defineComponent({ name: NAME$3, props: { field: String, rule: Array, expand: Number, options: Object, button: { type: Boolean, default: !0 }, max: { type: Number, default: 0 }, min: { type: Number, default: 0 }, modelValue: { type: Array, default: function() { return [] } }, defaultValue: Object, disabled: { type: Boolean, default: !1 }, syncDisabled: { type: Boolean, default: !0 }, fontSize: { type: Number, default: 28 }, onBeforeRemove: { type: Function, default: function() {} }, onBeforeAdd: { type: Function, default: function() {} }, formCreateInject: Object }, data: function() { return { len: 0, cacheRule: {}, cacheValue: {}, form: vue.markRaw(this.formCreateInject.form.$form()) } }, emits: ["update:modelValue", "change", "itemMounted", "remove", "add"], watch: { rule: { handler: function(e, t) { var n = this; Object.keys(this.cacheRule).forEach((function(r) { var i = n.cacheRule[r]; if (i.$f) { var o = i.$f.formData(); if (e === t) i.$f.deferSyncValue((function() { deepExtend(i.rule, e), i.$f.setValue(o) }), !0); else { var a = i.$f.formData(); i.$f.once("reloading", (function() { i.$f.setValue(a) })), i.rule = deepCopy(e) } } })) }, deep: !0 }, disabled: function(e) { if (this.syncDisabled) { var t = this.cacheRule; Object.keys(t).forEach((function(n) { t[n].$f.disabled(e) })) } }, expand: function(e) { var t = e - this.modelValue.length; t > 0 && this.expandRule(t) }, modelValue: { handler: function(e) { var t = this; e = e || []; var n = Object.keys(this.cacheRule), r = n.length, i = r - e.length; if (i < 0) { for (var o = i; o < 0; o++) this.addRule(e.length + o, !0); for (var a = 0; a < r; a++) this.setValue(n[a], e[a]) } else { if (i > 0) for (var u = 0; u < i; u++) this.removeRule(n[r - u - 1]); e.forEach((function(r, i) { t.setValue(n[i], e[i]) })) } }, deep: !0 } }, methods: { _value: function(e) { return e && hasProperty(e, this.field) ? e[this.field] : e }, cache: function(e, t) { this.cacheValue[e] = JSON.stringify(t) }, input: function(e) { this.$emit("update:modelValue", e), this.$emit("change", e) }, formData: function(e, t) { var n = this, r = this.cacheRule, i = Object.keys(r); if (i.filter((function(e) { return r[e].$f })).length === i.length) { var o = i.map((function(r) { var i = e === r ? t : _objectSpread2({}, n.cacheRule[r].$f .form), o = n.field ? i[n.field] || null : i; return n.cache(r, o), o })); this.input(o) } }, setValue: function(e, t) { var n = this.field; n && (t = _defineProperty({}, n, this._value(t))), this.cacheValue[e] !== JSON .stringify(n ? t[n] : t) && this.cache(e, t) }, addRule: function(e, t) { var n = this, r = this.formCreateInject.form.copyRules(this.rule || []), i = this.options ? _objectSpread2({}, this.options) : { submitBtn: !1, resetBtn: !1 }; if (this.defaultValue) { i.formData || (i.formData = {}); var o = deepCopy(this.defaultValue); extend(i.formData, this.field ? _defineProperty({}, this.field, o) : o) } this.cacheRule[++this.len] = { rule: r, options: i }, t && vue.nextTick((function() { return n.$emit("add", r, Object.keys(n.cacheRule).length - 1) })) }, add$f: function(e, t, n) { var r = this; this.cacheRule[t].$f = n, this.formData(t, n.formData()), vue.nextTick((function() { r.syncDisabled && n.disabled(r.disabled), r.$emit("itemMounted", n, Object.keys(r.cacheRule).indexOf(t)) })) }, removeRule: function(e, t) { var n = this, r = Object.keys(this.cacheRule).indexOf(e); delete this.cacheRule[e], delete this.cacheValue[e], t && vue.nextTick((function() { return n.$emit("remove", r) })) }, add: function() { this.disabled || !1 === this.onBeforeAdd(this.modelValue) || (this.modelValue.push( this.field ? null : {}), this.$emit("update:modelValue", this .modelValue)) }, del: function(e, t) { this.disabled || !1 === this.onBeforeRemove(this.modelValue, e) || (this.removeRule( t, !0), this.modelValue.splice(e, 1), this.input(this.modelValue)) }, addIcon: function(e) { return vue.createVNode(vue.resolveComponent("ElIcon"), { key: "a".concat(e), style: "font-size:".concat(this.fontSize, "px;cursor:").concat(this .disabled ? "not-allowed;color:#c9cdd4" : "pointer", ";"), onClick: this.add }, { default: function() { return [vue.createVNode(script$2, null, null)] } }) }, delIcon: function(e, t) { var n = this; return vue.createVNode(vue.resolveComponent("ElIcon"), { key: "d".concat(t), class: "el-icon-remove-outline", style: "font-size:".concat(this.fontSize, "px;cursor:").concat(this .disabled ? "not-allowed;color:#c9cdd4" : "pointer;color:#606266", ";"), onClick: function() { return n.del(e, t) } }, { default: function() { return [vue.createVNode(script$1, null, null)] } }) }, makeIcon: function(e, t, n) { var r = this; return this.$slots.button ? this.$slots.button({ total: e, index: t, vm: this, key: n, del: function() { return r.del(t, n) }, add: this.add }) : 0 === t ? [0 !== this.max && e >= this.max ? null : this.addIcon(n), 0 === this.min || e > this.min ? this.delIcon(t, n) : null ] : t >= this.min ? this.delIcon(t, n) : void 0 }, emitEvent: function(e, t, n, r) { this.$emit.apply(this, [e].concat(_toConsumableArray(t), [this.cacheRule[r].$f, n])) }, expandRule: function(e) { for (var t = 0; t < e; t++) this.modelValue.push(this.field ? null : {}) } }, created: function() { for (var e = (this.expand || 0) - this.modelValue.length, t = 0; t < this.modelValue .length; t++) this.addRule(t); e > 0 && this.expandRule(e) }, render: function() { var e = this, t = Object.keys(this.cacheRule), n = this.button, r = this.form; return 0 === t.length ? this.$slots.default ? this.$slots.default({ vm: this, add: this.add }) : vue.createVNode(vue.resolveComponent("ElIcon"), { key: 1, style: "font-size:".concat(this.fontSize, "px;vertical-align:middle;color:") .concat(this.disabled ? "#c9cdd4;cursor: not-allowed" : "#606266;cursor:pointer", ";"), onClick: this.add }, { default: function() { return [vue.createVNode(script$2, null, null)] } }) : vue.createVNode("div", { key: 2 }, [t.map((function(i, o) { var a, u = e.cacheRule[i], s = u.rule, c = u.options; return vue.createVNode(vue.resolveComponent("ElRow"), { align: "middle", type: "flex", key: i, style: "border-bottom:1px dashed #DCDFE6;margin-bottom:10px;" }, { default: function() { return [vue.createVNode(vue .resolveComponent("ElCol"), { span: n ? 20 : 24 }, { default: function() { return [vue .createVNode( r, { key: i, inFor: ! 0, "onUpdate:modelValue": function( t ) { return e .formData( i, t ) }, modelValue: e .field ? _defineProperty({}, e .field, e ._value( e .modelValue[ o ] ) ) : e .modelValue[ o ], "onEmit-event": function( t ) { for ( var n = arguments .length, r = new Array( n > 1 ? n - 1 : 0 ), a = 1; a < n; a++ ) r[a - 1 ] = arguments[ a ]; return e .emitEvent( t, r, o, i ) }, "onUpdate:api": function( t ) { return e .add$f( o, i, t ) }, rule: s, option: c, extendOption: ! 0 }, null) ] } }), n ? vue.createVNode(vue .resolveComponent("ElCol"), { span: 2, pull: 1, push: 1 }, _isSlot(a = e.makeIcon(t .length, o, i)) ? a : { default: function() { return [a] } }) : null] } }) }))]) } }), NAME$2 = "fcSubForm", Sub = vue.defineComponent({ name: NAME$2, props: { rule: Array, options: { type: Object, default: function() { return vue.reactive({ submitBtn: !1, resetBtn: !1 }) } }, modelValue: { type: Object, default: function() { return {} } }, disabled: { type: Boolean, default: !1 }, syncDisabled: { type: Boolean, default: !0 }, formCreateInject: Object }, data: function() { return { cacheValue: {}, subApi: {}, form: vue.markRaw(this.formCreateInject.form.$form()) } }, emits: ["fc:subform", "update:modelValue", "change", "itemMounted"], watch: { disabled: function(e) { this.syncDisabled && this.subApi.disabled(e) }, modelValue: function(e) { this.setValue(e) } }, methods: { formData: function(e) { this.cacheValue = JSON.stringify(e), this.$emit("update:modelValue", e), this.$emit( "change", e) }, setValue: function(e) { var t = JSON.stringify(e); this.cacheValue !== t && (this.cacheValue = t, this.subApi.coverValue(e || {})) }, add$f: function(e) { var t = this; this.subApi = e, vue.nextTick((function() { t.syncDisabled && e.disabled(t.disabled), t.$emit("itemMounted", e) })) } }, render: function() { var e = this.form; return vue.createVNode(e, { "onUpdate:modelValue": this.formData, modelValue: this.modelValue, "onEmit-event": this.$emit, "onUpdate:api": this.add$f, rule: this.rule, option: this.options, extendOption: !0 }, null) } }), script = { name: "IconWarning" }, _hoisted_1 = { class: "icon", viewBox: "0 0 1024 1024", xmlns: "http://www.w3.org/2000/svg" }, _hoisted_2 = vue.createElementVNode("path", { fill: "currentColor", d: "M512 64a448 448 0 110 896 448 448 0 010-896zm0 832a384 384 0 000-768 384 384 0 000 768zm48-176a48 48 0 11-96 0 48 48 0 0196 0zm-48-464a32 32 0 0132 32v288a32 32 0 01-64 0V288a32 32 0 0132-32z" }, null, -1), _hoisted_3 = [_hoisted_2]; function render(e, t, n, r, i, o) { return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1, _hoisted_3) } script.render = render; var components = [Checkbox, Frame, Radio, Select, Tree, Upload, Group, Sub, script], NAME$1 = "FormCreate", getRuleInject = function e(t, n) { if (t && t !== n) return t.ctx.formCreateInject ? t.ctx.formCreateInject : t.parent ? e(t.parent, n) : void 0 }; function $FormCreate(e) { return vue.defineComponent({ name: NAME$1, props: { rule: { type: Array, required: !0, default: function() { return [] } }, option: { type: Object, default: function() { return {} } }, extendOption: Boolean, modelValue: Object, api: Object, name: String, subForm: { type: Boolean, default: !0 }, inFor: Boolean }, emits: ["update:api", "update:modelValue", "mounted", "submit", "change", "emit-event", "control", "remove-rule", "remove-field", "sync", "reload", "repeat-field", "update" ], render: function() { return this.fc.render() }, setup: function(t) { var n = vue.getCurrentInstance(); vue.provide("parentFC", n); var r = vue.inject("parentFC", null), i = vue.toRefs(t), o = i.rule, a = i.modelValue, u = i.subForm, s = i.inFor, c = vue.reactive({ ctxInject: {}, destroyed: !1, isShow: !0, unique: 1, renderRule: _toConsumableArray(o.value || []), updateValue: JSON.stringify(a || {}) }), l = new e(n), f = l.api(), d = s.value, p = function() { var e = getRuleInject(n, r); if (e) if (d) { var t = toArray(e.getSubForm()), i = t.indexOf(f); i > -1 && t.splice(i, 1) } else e.subForm() }; return vue.onMounted((function() { l.mounted() })), vue.onBeforeUnmount((function() { p(), c.destroyed = !0, l.unmount() })), vue.onUpdated((function() { l.updated() })), vue.watch(u, (function(e) { e ? function() { if (r) { var e, t = getRuleInject(n, r); t && (d ? (e = toArray(t.getSubForm())).push(f) : e = f, t.subForm(e)) } }() : p() }), { immediate: !0 }), vue.watch((function() { return _toConsumableArray(o.value) }), (function(e) { l.$handle.isBreakWatch() || e.length === c.renderRule.length && e .every((function(e) { return c.renderRule.indexOf(e) > -1 })) || (l.$handle.reloadRule(o.value), n.setupState .renderRule()) })), vue.watch((function() { return t.option }), (function(e) { l.initOptions(e), f.refresh() }), { deep: !0 }), vue.watch(a, (function(e) { JSON.stringify(e || {}) !== c.updateValue && (f.config .forceCoverValue ? f.coverValue(e || {}) : f.setValue(e || {})) }), { deep: !0 }), _objectSpread2(_objectSpread2({ fc: vue.markRaw(l), parent: r ? vue.markRaw(r) : r, fapi: vue.markRaw(f) }, vue.toRefs(c)), {}, { refresh: function() { ++c.unique }, renderRule: function() { c.renderRule = _toConsumableArray(o.value || []) }, updateValue: function(e) { c.destroyed || (c.updateValue = JSON.stringify(e), n.emit( "update:modelValue", e)) } }) }, created: function() { var e = vue.getCurrentInstance(); e.setupState.fc.init(), e.emit("update:api", e.setupState.fapi) } }) } var normalMerge = ["props"], toArrayMerge = ["class", "style", "directives"], functionalMerge = ["on"], mergeProps = function e(t) { var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, i = [].concat(normalMerge, _toConsumableArray(r.normal || [])), o = [].concat(toArrayMerge, _toConsumableArray(r.array || [])), a = [].concat(functionalMerge, _toConsumableArray(r.functional || [])), u = r.props || []; return t.reduce((function(t, n) { for (var r in n) if (t[r]) if (u.indexOf(r) > -1) t[r] = e([n[r]], t[r]); else if (i.indexOf(r) > -1) t[r] = _objectSpread2(_objectSpread2({}, t[r]), n[r]); else if (o.indexOf(r) > -1) { var s = t[r] instanceof Array ? t[r] : [t[r]], c = n[r] instanceof Array ? n[r] : [n[r]]; t[r] = [].concat(_toConsumableArray(s), _toConsumableArray(c)) } else if (a.indexOf(r) > -1) for (var l in n[r]) if (t[r][l]) { var f = t[r][l] instanceof Array ? t[r][l] : [t[r][l]], d = n[r][l] instanceof Array ? n[r][l] : [n[r][l]]; t[r][l] = [].concat(_toConsumableArray(f), _toConsumableArray(d)) } else t[r][l] = n[r][l]; else if ("hook" === r) for (var p in n[r]) t[r][p] ? t[r][p] = mergeFn(t[r][p], n[r][p]) : t[r][p] = n[ r][p]; else t[r] = n[r]; else i.indexOf(r) > -1 || a.indexOf(r) > -1 || u.indexOf(r) > -1 ? t[r] = _objectSpread2({}, n[r]) : o.indexOf(r) > -1 ? t[r] = n[r] instanceof Array ? _toConsumableArray(n[r]) : "object" === _typeof(n[r]) ? _objectSpread2({}, n[ r]) : n[r] : t[r] = n[r]; return t }), n) }, mergeFn = function(e, t) { return function() { e && e.apply(this, arguments), t && t.apply(this, arguments) } }, keyAttrs = ["type", "slot", "emitPrefix", "value", "name", "native", "hidden", "display", "inject", "options", "emit", "link", "prefix", "suffix", "update", "sync", "optionsTo", "key", "slotUpdate", "computed", "preview", "component", "cache" ], arrayAttrs = ["validate", "children", "control"], normalAttrs = ["effect"]; function attrs() { return [].concat(keyAttrs, _toConsumableArray(normalMerge), _toConsumableArray(toArrayMerge), _toConsumableArray(functionalMerge), arrayAttrs, normalAttrs) } function format(e, t, n) { return "[form-create ".concat(e, "]: ").concat(t) + (n ? "\n\nrule: " + JSON.stringify(n.getRule ? n .getRule() : n) : "") } function err(e, t) { console.error(format("err", e, t)) } function logError(e) { err(e.toString()), console.error(e) } function toLine(e) { var t = e.replace(/([A-Z])/g, "-$1").toLocaleLowerCase(); return 0 === t.indexOf("-") && (t = t.substr(1)), t } function upper(e) { return e.replace(e[0], e[0].toLocaleUpperCase()) } var PREFIX = "[[FORM-CREATE-PREFIX-", SUFFIX = "-FORM-CREATE-SUFFIX]]", $T = "$FN:", $TX = "$FNX:", FUNCTION = "function"; function toJson(e, t) { return JSON.stringify(deepExtend([], e, !0), (function(e, t) { if (!t || !0 !== t._isVue) { if (_typeof(t) !== FUNCTION) return t; if (t.__json) return t.__json; if (t.__origin && (t = t.__origin), !t.__emit) return PREFIX + t + SUFFIX } }), t) } function makeFn(fn) { return eval("(" + FUNCTION + "(){return " + fn + " })()") } function parseFn(e, t) { if (e && is.String(e) && e.length > 4) { var n = e.trim(), r = !1; try { if (n.indexOf(SUFFIX) > 0 && 0 === n.indexOf(PREFIX)) n = n.replace(SUFFIX, "").replace(PREFIX, ""), r = !0; else if (0 === n.indexOf($T)) n = n.replace($T, ""), r = !0; else { if (0 === n.indexOf($TX)) return (n = makeFn("function($inject){" + n.replace($TX, "") + "}")).__json = e, n.__inject = !0, n; t || 0 !== n.indexOf(FUNCTION) || n === FUNCTION || (r = !0) } if (!r) return e; var i = makeFn(-1 === n.indexOf(FUNCTION) && 0 !== n.indexOf("(") ? FUNCTION + " " + n : n); return i.__json = e, i } catch (e) { return void err("解析失败:".concat(n, "\n\nerr: ").concat(e)) } } return e } function parseJson(e, t) { return JSON.parse(e, (function(e, n) { return is.Undef(n) || !n.indexOf ? n : parseFn(n, t) })) } function enumerable(e, t) { return { value: e, enumerable: !1, configurable: !1, writable: !!t } } function copyRule(e, t) { return copyRules([e], t || !1)[0] } function copyRules(e, t) { return deepExtend([], _toConsumableArray(e), t || !1) } function mergeRule(e, t) { return mergeProps(Array.isArray(t) ? t : [t], e, { array: arrayAttrs, normal: normalAttrs }), e } function getRule(e) { var t = is.Function(e.getRule) ? e.getRule() : e; return t.type || (t.type = "input"), t } function mergeGlobal(e, t) { return e ? (Object.keys(t || {}).forEach((function(n) { t[n] && (e[n] = mergeRule(e[n] || {}, t[n])) })), e) : t } function funcProxy(e, t) { Object.defineProperties(e, Object.keys(t).reduce((function(e, n) { return e[n] = { get: function() { return t[n]() } }, e }), {})) } function byCtx(e) { return e.__fc__ || (e.__origin__ ? e.__origin__.__fc__ : null) } function invoke(e, t) { try { t = e() } catch (e) { logError(e) } return t } function makeSlotBag() { var e = {}, t = function(e) { return e || "default" }; return { setSlot: function(n, r) { n = t(n), !r || Array.isArray(r) && r.length || (e[n] || (e[n] = []), e[n].push(r)) }, getSlot: function(n, r) { n = t(n); var i = []; return (e[n] || []).forEach((function(e) { if (Array.isArray(e)) i.push.apply(i, _toConsumableArray(e)); else if (is.Function(e)) { var t = e.apply(void 0, _toConsumableArray(r || [])); Array.isArray(t) ? i.push.apply(i, _toConsumableArray(t)) : i.push(t) } else is.Undef(e) || i.push(e) })), i }, getSlots: function() { var t = this, n = {}; return Object.keys(e).forEach((function(e) { n[e] = function() { for (var n = arguments.length, r = new Array(n), i = 0; i < n; i++) r[i] = arguments[i]; return t.getSlot(e, r) } })), n }, slotLen: function(n) { return n = t(n), e[n] ? e[n].length : 0 }, mergeBag: function(e) { var t = this; if (!e) return this; var n = is.Function(e.getSlots) ? e.getSlots() : e; return Array.isArray(e) || vue.isVNode(e) ? this.setSlot(void 0, (function() { return e })) : Object.keys(n).forEach((function(e) { t.setSlot(e, n[e]) })), this } } } function toProps(e) { var t = _objectSpread2({}, e.props || {}); return Object.keys(e.on || {}).forEach((function(n) { var r = "on".concat(upper(n)); Array.isArray(t[r]) ? t[r] = [].concat(_toConsumableArray(t[r]), [e.on[n]]) : t[r] ? t[ r] = [t[r], e.on[n]] : t[r] = e.on[n] })), t.key = e.key, t.ref = e.ref, t.class = e.class, t.style = e.style, t.slot && delete t.slot, t } function baseRule() { return { props: {}, on: {}, options: [], children: [], hidden: !1, display: !0, value: void 0 } } function creatorFactory(e, t) { return function(n, r, i) { var o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {}, a = new Creator(e, n, r, i, o); return t && (is.Function(t) ? t(a) : a.props(t)), a } } function Creator(e, t, n, r, i) { this._data = extend(baseRule(), { type: e, title: t, field: n, value: r, props: i || {} }), this.event = this.on } function appendProto(e) { e.forEach((function(e) { Creator.prototype[e] = function(t) { return mergeRule(this._data, _defineProperty({}, e, arguments.length < 2 ? t : _defineProperty({}, t, arguments[1]))), this } })) } extend(Creator.prototype, { getRule: function() { return this._data }, setProp: function(e, t) { return $set(this._data, e, t), this }, modelField: function(e) { return this._data.modelField = e, this }, _clone: function() { var e = new this.constructor; return e._data = copyRule(this._data), e } }), appendProto(attrs()); var commonMaker = creatorFactory(""); function create(e, t, n) { var r = commonMaker("", t); return r._data.type = e, r._data.title = n, r } function makerFactory() { return { create: create, factory: creatorFactory } } function copy(e) { return deepCopy(e) } function Api(e) { function t(t) { return is.Undef(t) ? t = e.fields() : Array.isArray(t) || (t = [t]), t } function n(n, r, i) { t(n).forEach((function(t) { e.getCtxs(t).forEach((function(t) { $set(t.rule, r, i), e.$render.clearCache(t) })) })) } function r() { var t = e.subForm; return Object.keys(t).reduce((function(e, n) { var r = t[n]; return r ? (Array.isArray(r) ? e.push.apply(e, _toConsumableArray(r)) : e.push(r), e) : e }), []) } var i = { get config() { return e.options }, set config(t) { e.fc.options.value = t }, get options() { return e.options }, set options(t) { e.fc.options.value = t }, get form() { return e.form }, get rule() { return e.rules }, get parent() { return e.vm.parent && e.vm.parent.setupState.fapi }, get children() { return r() }, formData: function(n) { return t(n).reduce((function(t, n) { var r = e.getFieldCtx(n); return r ? (t[r.field] = copy(r.rule.value), t) : t }), {}) }, getValue: function(t) { var n = e.getFieldCtx(t); if (n) return copy(n.rule.value) }, coverValue: function(t) { var n = _objectSpread2({}, t || {}); e.deferSyncValue((function() { i.fields().forEach((function(r) { var i = e.fieldCtx[r]; if (i) { var o = hasProperty(t, r); i.forEach((function(e) { e.rule.value = o ? t[r] : void 0 })), delete n[r] } })), extend(e.appendData, n) })) }, setValue: function(t) { var n = t; arguments.length >= 2 && (n = _defineProperty({}, t, arguments[1])), e.deferSyncValue(( function() { Object.keys(n).forEach((function(t) { var r = e.fieldCtx[t]; if (!r) return e.appendData[t] = n[t]; r.forEach((function(e) { e.rule.value = n[t] })) })) })) }, removeField: function(t) { var n = e.getCtx(t); return e.deferSyncValue((function() { e.getCtxs(t).forEach((function(e) { e.rm() })) }), !0), n ? n.origin : void 0 }, removeRule: function(e) { var t = e && byCtx(e); if (t) return t.rm(), t.origin }, fields: function() { return e.fields() }, append: function(t, n, r) { var i, o = e.sort.length - 1, a = e.getCtx(n); if (a) if (r) { if (i = a.getPending("children", a.rule.children), !Array.isArray(i)) return; o = a.rule.children.length - 1 } else o = a.root.indexOf(a.origin), i = a.root; else i = e.rules; i.splice(o + 1, 0, t) }, prepend: function(t, n, r) { var i, o = 0, a = e.getCtx(n); if (a) if (r) { if (i = a.getPending("children", a.rule.children), !Array.isArray(i)) return } else o = a.root.indexOf(a.origin), i = a.root; else i = e.rules; i.splice(o, 0, t) }, hidden: function(t, r) { n(r, "hidden", !!t), e.refresh() }, hiddenStatus: function(t) { var n = e.getCtx(t); if (n) return !!n.rule.hidden }, display: function(t, r) { n(r, "display", !!t), e.refresh() }, displayStatus: function(t) { var n = e.getCtx(t); if (n) return !!n.rule.display }, disabled: function(n, r) { t(r).forEach((function(t) { e.getCtxs(t).forEach((function(e) { $set(e.rule.props, "disabled", !!n) })) })), e.refresh() }, all: function(t) { return Object.keys(e.ctxs).map((function(n) { var r = e.ctxs[n]; return t ? r.origin : r.rule })) }, model: function(t) { return e.fields().reduce((function(n, r) { var i = e.fieldCtx[r][0]; return n[r] = t ? i.origin : i.rule, n }), {}) }, component: function(t) { return Object.keys(e.nameCtx).reduce((function(n, r) { var i = e.nameCtx[r].map((function(e) { return t ? e.origin : e.rule })); return n[r] = 1 === i.length ? i[0] : i, n }), {}) }, bind: function() { return i.form }, reload: function(t) { e.reloadRule(t) }, updateOptions: function(t) { e.fc.updateOptions(t), i.refresh() }, onSubmit: function(e) { i.updateOptions({ onSubmit: e }) }, sync: function(t) { if (Array.isArray(t)) t.forEach((function(e) { return i.sync(e) })); else { var n = is.Object(t) ? byCtx(t) : e.getCtxs(t); n && ((n = Array.isArray(n) ? n : [n]).forEach((function(t) { if (!t.deleted) { var n = e.subForm[t.id]; n && (Array.isArray(n) ? n.forEach((function(e) { e.refresh() })) : n && n.refresh()), e.$render.clearCache(t) } })), e.refresh()) } }, refresh: function() { r().forEach((function(e) { e.refresh() })), e.$render.clearCacheAll(), e.refresh() }, refreshOptions: function() { e.$manager.updateOptions(e.options), i.refresh() }, hideForm: function(t) { e.vm.setupState.isShow = !t }, changeStatus: function() { return e.changeStatus }, clearChangeStatus: function() { e.changeStatus = !1 }, updateRule: function(t, n) { e.getCtxs(t).forEach((function(e) { extend(e.rule, n) })) }, updateRules: function(e) { Object.keys(e).forEach((function(t) { i.updateRule(t, e[t]) })) }, mergeRule: function(t, n) { e.getCtxs(t).forEach((function(e) { mergeRule(e.rule, n) })) }, mergeRules: function(e) { Object.keys(e).forEach((function(t) { i.mergeRule(t, e[t]) })) }, getRule: function(t, n) { var r = e.getCtx(t); if (r) return n ? r.origin : r.rule }, setEffect: function(t, n, r) { var i = e.getCtx(t); i && n && ("$" === n[0] && (n = n.substr(1)), hasProperty(i.rule, "$" + n) && $set(i .rule, "$" + n, r), hasProperty(i.rule, "effect") || (i.rule.effect = {}), $set(i.rule.effect, n, r)) }, clearEffectData: function(t, n) { var r = e.getCtx(t); r && (n && "$" === n[0] && (n = n.substr(1)), r.clearEffectData(n), i.sync(t)) }, updateValidate: function(e, t, r) { r ? i.mergeRule(e, { validate: t }) : n(e, "validate", t) }, updateValidates: function(e, t) { Object.keys(e).forEach((function(n) { i.updateValidate(n, e[n], t) })) }, refreshValidate: function() { i.refresh() }, resetFields: function(n) { t(n).forEach((function(t) { e.getCtxs(t).forEach((function(t) { e.$render.clearCache(t), t.rule.value = copy(t .defaultValue) })) })) }, method: function(e, t) { var n = i.el(e); if (!n || !n[t]) throw new Error(format("err", "".concat(t, "方法不存在"))); return function() { return n[t].apply(n, arguments) } }, exec: function(e, t) { for (var n = arguments.length, r = new Array(n > 2 ? n - 2 : 0), o = 2; o < n; o++) r[ o - 2] = arguments[o]; return invoke((function() { return i.method(e, t).apply(void 0, r) })) }, toJson: function(e) { return toJson(i.rule, e) }, trigger: function(e, t) { for (var n = i.el(e), r = arguments.length, o = new Array(r > 2 ? r - 2 : 0), a = 2; a < r; a++) o[a - 2] = arguments[a]; n && n.$emit.apply(n, [t].concat(o)) }, el: function(t) { var n = e.getCtx(t); if (n) return n.el || e.vm.refs[n.ref] }, closeModal: function(t) { e.bus.$emit("fc:closeModal:" + t) }, getSubForm: function(t) { var n = e.getCtx(t); return n ? e.subForm[n.id] : void 0 }, nextTick: function(t) { e.bus.$once("next-tick", t), e.refresh() }, nextRefresh: function(t) { e.nextRefresh(), t && invoke(t) }, deferSyncValue: function(t, n) { e.deferSyncValue(t, n) }, emit: function(t) { for (var n, r = arguments.length, i = new Array(r > 1 ? r - 1 : 0), o = 1; o < r; o++) i[o - 1] = arguments[o]; (n = e.vm).emit.apply(n, [t].concat(i)) }, helper: { tidyFields: t, props: n } }; return ["on", "once", "off", "set"].forEach((function(t) { i[t] = function() { var n; (n = e.bus)["$".concat(t)].apply(n, arguments) } })), i.changeValue = i.changeField = i.setValue, i } function useCache(e) { extend(e.prototype, { initCache: function() { this.clearCacheAll() }, clearCache: function(e) { if (this.cache[e.id]) { (!0 === this.cache[e.id].use || this.cache[e.id].parent) && this.$handle .refresh(); var t = this.cache[e.id].parent; this.cache[e.id] = null, t && this.clearCache(t) } else e.parent && this.clearCache(e.parent) }, clearCacheAll: function() { this.cache = {} }, setCache: function(e, t, n) { this.cache[e.id] = { vnode: t, use: !1, parent: n, slot: e.rule.slot } }, getCache: function(e) { var t = this.cache[e.id]; if (t) return t.use = !0, t.vnode } }) } function toCase(e) { return lower(e.replace(/(-[a-z])/g, (function(e) { return e.replace("-", "").toLocaleUpperCase() }))) } function lower(e) { return e.replace(e[0], e[0].toLowerCase()) } function toString(e) { return null == e ? "" : "object" === _typeof(e) ? JSON.stringify(e, null, 2) : String(e) } var id$2 = 0; function uniqueId() { return "F" + Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now()).concat(++id$2)) .toString(36) } function deepSet(e, t, n) { var r, i = e; return (t || "").split(".").forEach((function(e) { r && (i[r] && "object" == _typeof(i[r]) || (i[r] = {}), i = i[r]), r = e })), i[r] = n, i } function useRender$1(e) { extend(e.prototype, { initRender: function() { this.cacheConfig = {} }, getTypeSlot: function(e) { var t = "type-" + toLine(e); return function n(r) { if (r) { var i = r.slots[t] || r.slots["type-" + e]; return i || n(r.setupState.parent) } }(this.vm) }, render: function() { var e = this; if (this.vm.setupState.isShow) { this.$manager.beforeRender(); var t = makeSlotBag(); return this.sort.forEach((function(n) { e.renderSlot(t, e.$handle.ctxs[n]) })), this.$manager.render(t) } }, renderSlot: function(e, t, n) { if (this.isFragment(t)) { t.initProp(), this.mergeGlobal(t), t.initNone(); var r = this.renderChildren(t.loadChildrenPending(), t), i = r.default; i && e.setSlot(t.rule.slot, (function() { return i() })), delete r.default, e.mergeBag(r) } else e.setSlot(t.rule.slot, this.renderCtx(t, n)) }, mergeGlobal: function(e) { var t = this; this.$handle.options.global && (this.cacheConfig[e.trueType] || (this.cacheConfig[e .trueType] = vue.computed((function() { var n = t.$handle.options.global; return mergeRule({}, [n["*"], n[e.originType] || n[e .type] || n[e.type] || {} ]) }))), e.prop = mergeRule({}, [this.cacheConfig[e.trueType].value, e.prop])) }, setOptions: function(e) { var t = e.loadPending({ key: "options", origin: e.prop.options, def: [] }); e.prop.options = t, e.prop.optionsTo && t && deepSet(e.prop, e.prop.optionsTo, t) }, deepSet: function(e) { var t = e.rule.deep; t && Object.keys(t).sort((function(e, t) { return e.length < t.length ? -1 : 1 })).forEach((function(n) { deepSet(e.prop, n, t[n]) })) }, parseSide: function(e) { return is.Object(e) ? mergeRule({}, e) : e }, renderSides: function(e, t, n) { var r = t[n ? "rule" : "prop"]; return [this.renderRule(this.parseSide(r.prefix)), e, this.renderRule(this .parseSide(r.suffix))] }, renderId: function(e, t) { var n = this, r = this.$handle["field" === t ? "fieldCtx" : "nameCtx"][e]; return r ? r.map((function(e) { return n.renderCtx(e, e.parent) })) : void 0 }, renderCtx: function(e, t) { var n = this; try { if ("hidden" === e.type) return; var r = e.rule; if (!this.cache[e.id] || this.cache[e.id].slot !== r.slot) { var i; e.initProp(), this.mergeGlobal(e), e.initNone(), this.$manager.tidyRule(e), this.deepSet(e), this.setOptions(e), this.ctxProp(e); var o = e.prop; o.preview = !!(hasProperty(o, "preview") ? o.preview : this.options .preview), o.props.formCreateInject = this.injectProp(e); var a = !1 !== o.cache, u = o.preview; if (o.hidden) return void this.setCache(e, void 0, t); i = function() { for (var i = arguments.length, s = new Array(i), c = 0; c < i; c++) s[c] = arguments[c]; var l = { rule: r, prop: o, preview: u, api: n.$handle.api, model: o.model || {}, slotValue: s }; s.length && r.slotUpdate && invoke((function() { return r.slotUpdate(l) })); var f = {}, d = e.loadChildrenPending(); e.parser.renderChildren ? f = e.parser.renderChildren(d, e) : !1 !== e.parser.loadChildren && (f = n.renderChildren(d, e)); var p, h = n.getTypeSlot(e.type); return h ? (l.children = f, p = h(l)) : p = u ? e.parser.preview(f, e) : e.parser.render(f, e), p = n.renderSides(p, e), !e .input && is.Undef(o.native) || !0 === o.native || (p = n .$manager.makeWrap(e, p)), e.none && (p = n.display(p)), a && n.setCache(e, (function() { return p }), t), p }, this.setCache(e, i, t) } return function() { var t = n.getCache(e); return t && t.apply(void 0, arguments) } } catch (e) { return void console.error(e) } }, getModelField: function(e) { return e.rule.modelField || e.parser.modelField || this.fc.modelFields[this.vNode .aliasMap[e.type]] || this.fc.modelFields[e.type] || this.fc.modelFields[e .originType] || "modelValue" }, display: function(e) { var t = this; if (Array.isArray(e)) { var n = []; return e.forEach((function(e) { if (Array.isArray(e)) return t.display(e); t.none(e) && n.push(e) })), n } return this.none(e) }, none: function(e) { if (e) return Array.isArray(e.props.style) ? e.props.style.push({ display: "none" }) : e.props.style = [e.props.style, { display: "none" }], e }, isFragment: function(e) { return "fragment" === e.type || "template" === e.type }, injectProp: function(e) { var t = this, n = this.vm.setupState; n.ctxInject[e.id] || (n.ctxInject[e.id] = { api: this.$handle.api, form: this.fc.create, subForm: function(n) { t.$handle.addSubForm(e, n) }, getSubForm: function() { return t.$handle.subForm[e.id] }, options: [], children: [], preview: !1, field: e.field, rule: e.rule, input: e.input }); var r = n.ctxInject[e.id]; return extend(r, { preview: e.prop.preview, options: e.prop.options, children: e.loadChildrenPending() }), r }, ctxProp: function(e, t) { var n = this, r = e.ref, i = e.key, o = e.rule; this.$manager.mergeProp(e, t), e.parser.mergeProp(e, t); var a = [{ ref: r, key: o.key || "".concat(i, "fc"), slot: void 0, on: { vnodeMounted: function(t) { t.el.__rule__ = e.rule, n.onMounted(e, t.el) } } }]; if (!t && e.input) { var u = this.getModelField(e), s = { callback: function(t) { n.onInput(e, t) }, value: this.$handle.getFormData(e) }; a.push({ on: _defineProperty({}, "update:".concat(u), s.callback), props: _defineProperty({}, u, s.value) }), e.prop.model = s } return mergeProps(a, e.prop), e.prop }, onMounted: function(e, t) { e.el = this.vm.refs[e.ref] || t, e.parser.mounted(e), this.$handle.effect(e, "mounted") }, onInput: function(e, t) { this.$handle.onInput(e, t) }, renderChildren: function(e, t) { var n = this; if (!is.trueArray(e)) return {}; var r = makeSlotBag(); return e.map((function(i) { if (i) return is.String(i) ? r.setSlot(null, i) : i.__fc__ ? n .renderSlot(r, i.__fc__, t) : void(i.type && vue.nextTick(( function() { n.$handle.loadChildren(e, t), n.$handle .refresh() }))) })), r.getSlots() }, defaultRender: function(e, t) { var n = e.prop; return n.component ? this.vNode.makeComponent(n.component, n, t) : this.vNode[e .type] ? this.vNode[e.type](n, t) : this.vNode[e.originType] ? this.vNode[e .originType](n, t) : this.vNode.make(lower(e.originType), n, t) }, renderRule: function(e, t, n) { var r = this; if (e) { if (is.String(e)) return e; var i; if (n) i = e.type; else if (i = e.is, e.type) { i = toCase(e.type); var o = this.vNode.aliasMap[i]; o && (i = toCase(o)) } if (i) { var a = makeSlotBag(); is.trueArray(e.children) && e.children.forEach((function(e) { e && a.setSlot(null == e ? void 0 : e.slot, (function() { return r.renderRule(e) })) })); var u = _objectSpread2({}, e); return delete u.type, delete u.is, this.vNode.make(i, u, a.mergeBag(t) .getSlots()) } } } }) } var id$1 = 1; function Render(e) { extend(this, { $handle: e, fc: e.fc, vm: e.vm, $manager: e.$manager, vNode: new e.fc.CreateNode(e.vm), id: id$1++ }), funcProxy(this, { options: function() { return e.options }, sort: function() { return e.sort } }), this.initCache(), this.initRender() } function useInject(e) { extend(e.prototype, { parseInjectEvent: function(e, t) { var n = e.inject || this.options.injectEvent; return this.parseEventLst(e, t, n) }, parseEventLst: function(e, t, n, r) { var i = this; return Object.keys(t).forEach((function(o) { var a = i.parseEvent(e, t[o], n, r); a && (t[o] = a) })), t }, parseEvent: function(e, t, n, r) { if (is.Function(t) && (!1 !== n && !is.Undef(n) || t.__inject)) return this.inject( e, t, n); if (!r && Array.isArray(t) && t[0] && (is.String(t[0]) || is.Function(t[0]))) return this.parseEventLst(e, t, n, !0); if (is.String(t)) { var i = parseFn(t); if (i && t !== i) return i.__inject ? this.parseEvent(e, i, n, !0) : i } }, parseEmit: function(e) { var t = this, n = {}, r = e.rule, i = r.emitPrefix, o = r.field, a = r.name, u = r.inject, s = r.emit || []; if (is.trueArray(s)) { var c = i || o || a; c && s.forEach((function(e) { if (e) { var i; is.Object(e) && (i = e.inject, e = e.name); var o = toLine("".concat(c, "-").concat(e)), a = function() { for (var e, n, r, i = arguments.length, a = new Array(i), u = 0; u < i; u++) a[u] = arguments[u]; (e = t.vm).emit.apply(e, [o].concat(a)), (n = t.vm) .emit.apply(n, ["emit-event", o].concat(a)), ( r = t.bus).$emit.apply(r, [o].concat(a)) }; if (a.__emit = !0, i || !1 !== u) { var s = i || u || t.options.injectEvent; n[e] = is.Undef(s) ? a : t.inject(r, a, s) } else n[e] = a } })) } return e.computed.on = n, n }, getInjectData: function(e, t) { var n = this.vm, r = n.option, i = n.rule; return { $f: this.api, api: this.api, rule: i, self: e.__origin__, option: r, inject: t } }, inject: function(e, t, n) { if (t.__origin) { if (this.watching && !this.loading) return t; t = t.__origin } var r = this, i = function() { for (var i = r.getInjectData(e, n), o = arguments.length, a = new Array(o), u = 0; u < o; u++) a[u] = arguments[u]; return i.args = [].concat(a), a.unshift(i), t.apply(this, a) }; return i.__origin = t, i.__json = t.__json, i } }) } useCache(Render), useRender$1(Render); var EVENT = ["hook:updated", "hook:mounted"]; function usePage(e) { extend(e.prototype, { usePage: function() { var e = this, t = this.options.page; if (t) { var n = 25, r = getLimit(this.rules); is.Object(t) && (t.first && (n = parseInt(t.first, 10) || n), t.limit && (r = parseInt(t.limit, 10) || r)), extend(this, { first: n, limit: r, pageEnd: this.rules.length <= n }), this.bus.$on("page-end", (function() { return e.vm.emit("page-end", e.api) })), this.pageLoad() } }, pageLoad: function() { var e = this; this.bus.$on(EVENT, (function t() { e.pageEnd ? (e.bus.$off(EVENT, t), e.bus.$emit("page-end")) : (e .first += e.limit, e.pageEnd = e.rules.length <= e.first, e .loadRule(), e.refresh()) })) } }) } function getLimit(e) { return e.length < 31 ? 31 : Math.ceil(e.length / 3) } function useRender(e) { extend(e.prototype, { clearNextTick: function() { this.nextTick && clearTimeout(this.nextTick), this.nextTick = null }, bindNextTick: function(e) { var t = this; this.clearNextTick(), this.nextTick = setTimeout((function() { e(), t.nextTick = null }), 10) }, render: function() { return ++this.loadedId, this.vm.setupState.unique > 0 ? this.$render.render() : ( this.vm.setupState.unique = 1, []) } }) } function isNone(e) { var t = !(is.Undef(e.prop.display) || e.prop.display); return e.parent && e.parent.none || t } function bind(e) { Object.defineProperties(e.origin, { __fc__: enumerable(vue.markRaw(e), !0) }) } function RuleContext(e, t, n) { var r = uniqueId(), i = !!t.field; extend(this, { id: r, ref: r, wrapRef: r + "fi", rule: t, origin: t.__origin__ || t, name: t.name, pending: {}, none: !1, watch: [], linkOn: [], root: [], ctrlRule: [], parent: null, cacheConfig: null, prop: _objectSpread2({}, t), computed: {}, payload: {}, refRule: {}, input: i, el: void 0, defaultValue: i ? deepCopy(n) : void 0, field: t.field || void 0 }), this.updateType(), this.updateKey(), bind(this), this.update(e, !0) } function useLoader(e) { extend(e.prototype, { nextRefresh: function(e) { var t = this, n = this.loadedId; vue.nextTick((function() { n === t.loadedId && (e ? e() : t.refresh()) })) }, parseRule: function(e) { var t = this, n = getRule(e); return Object.defineProperties(n, { __origin__: enumerable(e, !0) }), fullRule(n), this.appendValue(n), [n, n.prefix, n.suffix].forEach((function( e) { e && t.loadFn(e, n) })), this.loadCtrl(n), n.update && (n.update = parseFn(n.update)), n }, loadFn: function(e, t) { var n = this; ["on", "props", "deep"].forEach((function(r) { e[r] && n.parseInjectEvent(t, e[r]) })) }, loadCtrl: function(e) { e.control && e.control.forEach((function(e) { e.handle && (e.handle = parseFn(e.handle)) })) }, syncProp: function(e) { var t = this, n = e.rule; is.trueArray(n.sync) && mergeProps([{ on: n.sync.reduce((function(e, r) { return e["update:".concat(r)] = function(e) { n.props[r] = e, t.vm.emit("sync", r, e, n, t .fapi) }, e }), {}) }], e.computed) }, loadRule: function() { var e = this; this.cycleLoad = !1, this.loading = !0, this.pageEnd && this.bus.$emit( "load-start"), this.deferSyncValue((function() { if (e._loadRule(e.rules), e.loading = !1, e.cycleLoad && e.pageEnd) return e.loadRule(); e.syncForm(), e.pageEnd && e.bus.$emit("load-end"), e.vm.setupState .renderRule() })) }, loadChildren: function(e, t) { if (this.cycleLoad = !1, this.loading = !0, this.bus.$emit("load-start"), this ._loadRule(e, t), this.loading = !1, this.cycleLoad) return this.loadRule(); this.syncForm(), this.bus.$emit("load-end"), this.$render.clearCache(t) }, _loadRule: function(e, t) { var n = this, r = function t(r) { var i = e[r - 1]; if (!i || !i.__fc__) return r > 0 ? t(r - 1) : -1; var o = n.sort.indexOf(i.__fc__.id); return o > -1 ? o : t(r - 1) }, i = function(e, t) { is.trueArray(e) && n._loadRule(e, t) }; e.map((function(o, a) { if ((!t || !is.String(o) && !is.Undef(o)) && (n.pageEnd || t || !( a >= n.first))) { if (o.__fc__ && o.__fc__.root === e && n.ctxs[o.__fc__.id]) return i(o.__fc__.loadChildrenPending(), o.__fc__), o .__fc__; var u, s = getRule(o), c = function() { return !(!s.field || !n.fieldCtx[s.field] || n.fieldCtx[ s.field][0] === o.__fc__) }; n.ruleEffect(s, "init", { repeat: c() }), c() && n.vm.emit("repeat-field", o, n.api); var l = !1, f = !!o.__fc__, d = s.value; if (f) { d = (u = o.__fc__).defaultValue; var p = !u.check(n); if (u.deleted) { if (p) { if (isCtrl(u)) return; u.update(n) } } else if (p) { if (isCtrl(u)) return; e[a] = o = o._clone ? o._clone() : copyRule(o), u = null, l = !0 } } if (u) u.originType !== u.rule.type && (u.updateType(), n .bindParser(u)), n.appendValue(u.rule); else { var h = n.parseRule(o); u = new RuleContext(n, h, f ? d : h.value), n.bindParser(u) } n.parseEmit(u), n.syncProp(u), u.parent = t || null, u.root = e, n.setCtx(u), !l && !f && n.effect(u, "load"); var m = u.loadChildrenPending(); if (!1 === u.parser.loadChildren || i(m, u), !t) { var v = r(a); v > -1 || !a ? n.sort.splice(v + 1, 0, u.id) : n.sort.push(u .id) } var y = u.rule; return u.updated || (u.updated = !0, is.Function(y.update) && n .bus.$once("load-end", (function() { n.refreshUpdate(u, y.value) })), n.effect(u, "loaded")), n.refreshControl(u) && (n .cycleLoad = !0), u } })) }, refreshControl: function(e) { return e.input && e.rule.control && this.useCtrl(e) }, useCtrl: function(e) { var t = this, n = getCtrl(e), r = [], i = this.api; if (!n.length) return !1; for (var o = function(t) { var o = n[t], a = o.handle || function(e) { return e === o.value }; if (!is.trueArray(o.rule)) return "continue"; var u = _objectSpread2(_objectSpread2({}, o), {}, { valid: invoke((function() { return a(e.rule.value, i) })), ctrl: findCtrl(e, o.rule), isHidden: is.String(o.rule[0]) }); if (u.valid && u.ctrl || !u.valid && !u.ctrl && !u.isHidden) return "continue"; r.push(u) }, a = 0; a < n.length; a++) o(a); if (!r.length) return !1; var u = [], s = !1; return this.deferSyncValue((function() { r.reverse().forEach((function(n) { var r = n.isHidden, o = n.valid, a = n.rule, c = n.prepend, l = n.append, f = n.child, d = n.ctrl; if (r) return o ? e.ctrlRule.push({ __ctrl: !0, children: a, valid: o }) : e.ctrlRule.splice(e.ctrlRule.indexOf( d), 1), void u[o ? "push" : "unshift"](( function() { t.api.hidden(!o, a) })); if (o) { s = !0; var p = { type: "fragment", native: !0, __ctrl: !0, children: a }; e.ctrlRule.push(p), t.bus.$once("load-start", ( function() { c ? i.prepend(p, c, f) : l || f ? i.append(p, l || e.id, f) : e.root.splice(e .root.indexOf(e .origin) + 1, 0, p) })) } else { e.ctrlRule.splice(e.ctrlRule.indexOf(d), 1); var h = byCtx(d); h && h.rm() } })) })), u.length && vue.nextTick((function() { u.forEach((function(e) { return e() })) })), this.vm.emit("control", e.origin, this.api), this.effect(e, "control"), s }, reloadRule: function(e) { return this._reloadRule(e) }, _reloadRule: function(e) { var t = this; e || (e = this.rules); var n = _objectSpread2({}, this.ctxs); this.clearNextTick(), this.initData(e), this.fc.rules = e, this.deferSyncValue(( function() { t.bus.$once("load-end", (function() { Object.keys(n).filter((function(e) { return void 0 === t.ctxs[e] })).forEach((function(e) { return t.rmCtx(n[e]) })), t.$render.clearCacheAll() })), t.reloading = !0, t.loadRule(), t.reloading = !1, t .refresh(), t.bus.$emit("reloading", t.api) })), this.bus.$off("next-tick", this.nextReload), this.bus.$once( "next-tick", this.nextReload), this.bus.$emit("update", this.api) }, refresh: function() { this.vm.setupState.refresh() } }) } function fullRule(e) { var t = baseRule(); return Object.keys(t).forEach((function(n) { hasProperty(e, n) || (e[n] = t[n]) })), e } function getCtrl(e) { var t = e.rule.control || []; return is.Object(t) ? [t] : t } function findCtrl(e, t) { for (var n = 0; n < e.ctrlRule.length; n++) { var r = e.ctrlRule[n]; if (r.children === t) return r } } function isCtrl(e) { return !!e.rule.__ctrl } function useInput(e) { extend(e.prototype, { setValue: function(e, t, n, r) { e.deleted || (e.rule.value = t, this.changeStatus = !0, this.nextRefresh(), this .$render.clearCache(e), this.setFormData(e, n), this.syncValue(), this .valueChange(e, t), this.vm.emit("change", e.field, t, e.origin, this.api, r || !1), this.effect(e, "value")) }, onInput: function(e, t) { var n; e.input && (this.isQuote(e, n = e.parser.toValue(t, e)) || this.isChange(e, t)) && this.setValue(e, n, t) }, setFormData: function(e, t) { $set(this.formData, e.id, t) }, getFormData: function(e) { return this.formData[e.id] }, syncForm: function() { var e = this, t = vue.reactive({}); this.fields().reduce((function(t, n) { var r = e.getCtx(n); return t[n] = vue.toRef(r.rule, "value"), t }), t), this.form = t, this.syncValue() }, appendValue: function(e) { e.field && hasProperty(this.appendData, e.field) && (e.value = this.appendData[e .field], delete this.appendData[e.field]) }, addSubForm: function(e, t) { this.subForm[e.id] = t }, deferSyncValue: function(e, t) { this.deferSyncFn || (this.deferSyncFn = e), this.deferSyncFn.sync || (this .deferSyncFn.sync = t), invoke(e), this.deferSyncFn === e && (this .deferSyncFn = null, e.sync && this.syncValue()) }, syncValue: function() { if (this.deferSyncFn) return this.deferSyncFn.sync = !0; this.vm.setupState.updateValue(_objectSpread2({}, this.form)) }, isChange: function(e, t) { return JSON.stringify(this.getFormData(e), strFn) !== JSON.stringify(t, strFn) }, isQuote: function(e, t) { return (is.Object(t) || Array.isArray(t)) && t === e.rule.value }, refreshUpdate: function(e, t) { var n = this; if (is.Function(e.rule.update)) { var r = invoke((function() { return e.rule.update(t, e.origin, n.api) })); if (void 0 === r) return; e.rule.hidden = !0 === r } }, valueChange: function(e, t) { this.refreshRule(e, t), this.bus.$emit("change-" + e.field, t) }, refreshRule: function(e, t) { this.refreshControl(e) && (this.$render.clearCacheAll(), this.loadRule(), this.bus .$emit("update", this.api), this.refresh()), this.refreshUpdate(e, t) }, appendLink: function(e) { var t = this, n = e.rule.link; is.trueArray(n) && n.forEach((function(n) { var r = function() { return t.refreshRule(e, e.rule.value) }; t.bus.$on("change-" + n, r), e.linkOn.push((function() { return t.bus.$off("change-" + n, r) })) })) }, fields: function() { return Object.keys(this.fieldCtx) } }) } function strFn(e, t) { return "function" == typeof t ? "" + t : t } extend(RuleContext.prototype, { loadChildrenPending: function() { var e = this, t = this.rule.children || []; return Array.isArray(t) ? t : this.loadPending({ key: "children", origin: t, def: [], onLoad: function(t) { e.$handle && e.$handle.loadChildren(t, e) }, onUpdate: function(t, n) { e.$handle && (t === n ? e.$handle.loadChildren(t, e) : e.$handle .updateChildren(e, t, n)) }, onReload: function(t) { e.$handle ? e.$handle.updateChildren(e, [], t) : delete e.pending .children } }) }, loadPending: function(e) { var t = this, n = e.key, r = e.origin, i = e.def, o = e.onLoad, a = e.onReload, u = e.onUpdate; if (this.pending[n] && this.pending[n].origin === r) return this.getPending(n, i); delete this.pending[n]; var s = r; if (is.Function(r)) { var c = invoke((function() { return r({ rule: t.rule, api: t.$api, update: function(e) { var o = e || i, a = t.getPending(n, i); t.setPending(n, r, o), u && u(o, a) }, reload: function() { var e = t.getPending(n, i); delete t.pending[n], a && a(e), t.$api && t.$api .sync(t.rule) } }) })); c && is.Function(c.then) ? (c.then((function(e) { var a = e || i; t.setPending(n, r, a), o && o(a), t.$api && t.$api.sync(t.rule) })), s = i, this.setPending(n, r, s)) : (s = c || i, this.setPending(n, r, s), o && o(s)) } return s }, getPending: function(e, t) { return this.pending[e] && this.pending[e].value || t }, setPending: function(e, t, n) { this.pending[e] = { origin: t, value: vue.reactive(n) } }, effectData: function(e) { return this.payload[e] || (this.payload[e] = {}), this.payload[e] }, clearEffectData: function(e) { void 0 === e ? this.payload = {} : delete this.payload[e] }, updateKey: function(e) { this.key = uniqueId(), e && this.parent && this.parent.updateKey(e) }, updateType: function() { this.originType = this.rule.type, this.type = toCase(this.rule.type) }, setParser: function(e) { this.parser = e, e.init(this) }, initProp: function() { var e = this, t = _objectSpread2({}, this.rule); delete t.children, this.prop = mergeProps([t].concat(_toConsumableArray(Object.keys(this .payload).map((function(t) { return e.payload[t] }))), [this.computed])) }, initNone: function() { this.none = isNone(this) }, check: function(e) { return this.vm === e.vm }, unwatch: function() { this.watch.forEach((function(e) { return e() })), this.watch = [], this.refRule = {} }, unlink: function() { this.linkOn.forEach((function(e) { return e() })), this.linkOn = [] }, link: function() { this.unlink(), this.$handle.appendLink(this) }, watchTo: function() { this.$handle.watchCtx(this) }, delete: function() { var e = void 0; this.unwatch(), this.unlink(), this.rmCtrl(), extend(this, { deleted: !0, prop: _objectSpread2({}, this.rule), computed: {}, el: e, $handle: e, $render: e, $api: e, vm: e, vNode: e, parent: null, cacheConfig: null, none: !1 }) }, rmCtrl: function() { this.ctrlRule.forEach((function(e) { return e.__fc__ && e.__fc__.rm() })), this.ctrlRule = [] }, rm: function() { var e = this, t = function() { var t = e.root.indexOf(e.origin); t > -1 && (e.root.splice(t, 1), e.$handle && e.$handle.refresh()) }; this.deleted ? t() : this.$handle.noWatch((function() { e.$handle.deferSyncValue((function() { e.rmCtrl(), t(), e.$handle.rmCtx(e), extend(e, { root: [] }) }), e.input) })) }, update: function(e, t) { extend(this, { deleted: !1, $handle: e, $render: e.$render, $api: e.api, vm: e.vm, trueType: e.getType(this.originType), vNode: e.$render.vNode, updated: !1 }), !t && this.unwatch(), this.watchTo(), this.link() } }); var BaseParser = { init: function(e) {}, toFormValue: function(e, t) { return e }, toValue: function(e, t) { return e }, mounted: function(e) {}, render: function(e, t) { return t.$render.defaultRender(t, e) }, preview: function(e, t) { return this.render(e, t) }, mergeProp: function(e) {} }, _ = { sum: function(e) { if (Array.isArray(e)) { var t = 0; return e.map((function(e) { return t += e || 0 })), t } }, column: function(e, t) { return Array.isArray(e) ? e.map((function(e) { return e[t] })) : [] }, get: function(e, t, n) { for (var r = t.split("."), i = e, o = 0; o < r.length; o++) { if (!hasProperty(i, r[o])) return void 0 === n ? 0 : n; i = i[r[o]] } return i } }, noneKey = ["field", "value", "vm", "template", "name", "config", "control", "inject", "sync", "payload", "optionsTo", "update", "slotUpdate", "computed", "component", "cache" ]; function useContext(e) { extend(e.prototype, { getCtx: function(e) { return this.getFieldCtx(e) || this.getNameCtx(e)[0] || this.ctxs[e] }, getCtxs: function(e) { return this.fieldCtx[e] || this.nameCtx[e] || (this.ctxs[e] ? [this.ctxs[e]] : []) }, setIdCtx: function(e, t, n) { var r = "".concat(n, "Ctx"); this[r][t] ? this[r][t].push(e) : this[r][t] = [e] }, rmIdCtx: function(e, t, n) { var r = "".concat(n, "Ctx"), i = this[r][t]; if (!i) return !1; var o = i.splice(i.indexOf(e) >>> 0, 1).length > 0; return i.length || delete this[r][t], o }, getFieldCtx: function(e) { return (this.fieldCtx[e] || [])[0] }, getNameCtx: function(e) { return this.nameCtx[e] || [] }, setCtx: function(e) { var t = e.id, n = e.field, r = e.name, i = e.rule; this.ctxs[t] = e, r && this.setIdCtx(e, r, "name"), e.input && (this.setIdCtx(e, n, "field"), this.setFormData(e, e.parser.toFormValue(i.value, e)), this .isMounted && !this.reloading && this.vm.emit("change", e.field, i.value, e .origin, this.api)) }, getParser: function(e) { var t = this.fc.parsers; return t[e.originType] || t[toCase(e.type)] || t[e.trueType] || BaseParser }, bindParser: function(e) { e.setParser(this.getParser(e)) }, getType: function(e) { var t = this.fc.CreateNode.aliasMap, n = t[e] || t[toCase(e)] || e; return toCase(n) }, noWatch: function(e) { this.noWatchFn || (this.noWatchFn = e), invoke(e), this.noWatchFn === e && (this .noWatchFn = null) }, watchCtx: function(e) { var t = this; if (attrs().filter((function(e) { return "_" !== e[0] && "$" !== e[0] && -1 === noneKey.indexOf(e) })).forEach((function(n) { var r = vue.toRef(e.rule, n), i = "children" === n; e.refRule[n] = r, e.watch.push(vue.watch(i ? function() { return is.Function(r.value) ? r.value : _toConsumableArray(r.value || []) } : function() { return r.value }, (function(o, a) { var u = r.value; if (!t.isBreakWatch()) { if (i && !1 === e.parser.loadChildren) return t.$render.clearCache(e), void t .nextRefresh(); t.watching = !0, "link" !== n ? (["props", "on", "deep" ].indexOf(n) > -1 ? (t .parseInjectEvent(e.rule, u || {}), "props" === n && e .input && t.setFormData(e, e .parser.toFormValue(e.rule .value, e))) : "emit" === n ? t.parseEmit(e) : [ "prefix", "suffix" ].indexOf(n) > -1 ? u && t.loadFn(u, e.rule) : "type" === n ? (e .updateType(), t.bindParser(e) ) : i && (is.Function(a) && (a = e.getPending("children", []) ), is.Function(u) && (u = e .loadChildrenPending()), t .updateChildren(e, u, a)), t .$render.clearCache(e), t.refresh(), t.watching = !1) : e.link() } }), { deep: !i, sync: i })) })), e.input) { var n = vue.toRef(e.rule, "value"); e.watch.push(vue.watch((function() { return n.value }), (function() { var r = e.parser.toFormValue(n.value, e); t.isChange(e, r) && t.setValue(e, n.value, r, !0) }))), this.bus.$once("load-end", (function() { var r = vue.toRef(e.rule, "computed"); e.watch.push(vue.watch((function() { var e = r.value; if (e) return invoke(is.Function(e) ? function() { return e(t.api.form, t.api) } : function() { return new Function("_", "with(this){ return " .concat(e, " }")) .call(t.api.form, _) }, void 0) }), (function(e) { n.value = e }), { immediate: !!r.value })) })) } this.watchEffect(e) }, updateChildren: function(e, t, n) { var r = this; this.deferSyncValue((function() { n && n.forEach((function(n) { -1 === (t || []).indexOf(n) && n && !is.String(n) && n.__fc__ && n.__fc__.parent === e && r.rmCtx(n .__fc__) })), is.trueArray(t) && (r.loadChildren(t, e), r.bus.$emit( "update", r.api)) })) }, rmSub: function(e) { var t = this; is.trueArray(e) && e.forEach((function(e) { e && e.__fc__ && t.rmCtx(e.__fc__) })) }, rmCtx: function(e) { var t = this; if (!e.deleted) { var n = e.id, r = e.field, i = e.input, o = e.name; $del(this.ctxs, n), $del(this.formData, n), $del(this.subForm, n), $del(this.vm .setupState.ctxInject, n), i && this.rmIdCtx(e, r, "field"), o && this .rmIdCtx(e, o, "name"), i && !hasProperty(this.fieldCtx, r) && $del(this .form, r), this.deferSyncValue((function() { if (!t.reloading) { if (!1 !== e.parser.loadChildren) { var n = e.getPending("children", e.rule.children); is.trueArray(n) && n.forEach((function(e) { return e.__fc__ && t.rmCtx(e.__fc__) })) } e.root === t.rules && t.vm.setupState.renderRule() } }), i); var a = this.sort.indexOf(n); return a > -1 && this.sort.splice(a, 1), this.$render.clearCache(e), e.delete(), this.effect(e, "deleted"), i && !this.fieldCtx[r] && this.vm.emit( "remove-field", r, e.rule, this.api), e.rule.__ctrl || this.vm.emit( "remove-rule", e.rule, this.api), e } } }) } function useLifecycle(e) { extend(e.prototype, { mounted: function() { var e = this, t = function() { e.isMounted = !0, e.lifecycle("mounted") }; this.pageEnd ? t() : this.bus.$once("page-end", t) }, lifecycle: function(e) { var t = this, n = this.options[e]; is.Function(n) && invoke((function() { return n(t.api) })), this.vm.emit(e, this.api) } }) } function useEffect(e) { extend(e.prototype, { useProvider: function() { var e = this, t = this.fc.providers; Object.keys(t).forEach((function(n) { var r = t[n]; is.Function(r) && (r = r(e.fc)), r._c = getComponent(r), e.onEffect( r), e.providers[n] = r })) }, onEffect: function(e) { var t = this, n = []; (e._c || ["*"]).forEach((function(r) { var i = "*" === r ? "*" : t.getType(r); n.indexOf(i) > -1 || (n.push(i), t.bus.$on("p:".concat(e.name, ":") .concat(i, ":").concat(e.input ? 1 : 0), (function(t, n) { e[t] && e[t].apply(e, _toConsumableArray(n)) }))) })), e._used = n }, watchEffect: function(e) { var t = this, n = {}; Object.keys(e.rule.effect || {}).forEach((function(t) { n[t] = function() { return e.rule.effect[t] } })), Object.keys(e.rule).forEach((function(t) { "$" === t[0] && (n[t.substr(1)] = function() { return e.rule[t] }) })), Object.keys(n).forEach((function(r) { e.watch.push(vue.watch(n[r], (function(n) { t.effect(e, "watch", _defineProperty({}, r, n)) }), { deep: !0 })) })) }, ruleEffect: function(e, t, n) { this.emitEffect({ rule: e, input: !!e.field, type: this.getType(e.type) }, t, n) }, effect: function(e, t, n) { this.emitEffect({ rule: e.rule, input: e.input, type: e.trueType, ctx: e, custom: n }, t) }, getEffect: function(e, t) { return hasProperty(e, "$" + t) ? e["$" + t] : hasProperty(e, "effect") && hasProperty(e.effect, t) ? e.effect[t] : void 0 }, emitEffect: function(e, t, n) { var r = this, i = e.ctx, o = e.rule, a = e.input, u = e.type, s = e.custom; if (u && !(["fcFragment", "fragment"].indexOf(u) > -1)) { var c = s || Object.keys(o).reduce((function(e, t) { return "$" === t[0] && (e[t.substr(1)] = o[t]), e }), _objectSpread2({}, o.effect || {})); Object.keys(c).forEach((function(e) { var s = r.providers[e]; if (s && (!s.input || a)) { var l; if (s._c) { if (!(s._used.indexOf(u) > -1)) return; l = u } else l = "*"; var f = _objectSpread2({ value: c[e], getValue: function() { return r.getEffect(o, e) } }, n || {}); i && (f.getProp = function() { return i.effectData(e) }, f.clearProp = function() { return i.clearEffectData(e) }, f.mergeProp = function(e) { return mergeProps([e], f.getProp()) }), r.bus.$emit("p:".concat(e, ":").concat(l, ":") .concat(s.input ? 1 : 0), t, [f, o, r.api]) } })) } } }) } function unique(e) { return e.filter((function(e, t, n) { return n.indexOf(e, 0) === t })) } function getComponent(e) { var t = e.components; return Array.isArray(t) ? unique(t.filter((function(e) { return "*" !== e }))) : !!is.String(t) && [t] } function Handler(e) { var t = this; funcProxy(this, { options: function() { return e.options.value || {} }, bus: function() { return e.bus } }), extend(this, { fc: e, vm: e.vm, watching: !1, loading: !1, reloading: !1, noWatchFn: null, deferSyncFn: null, isMounted: !1, formData: vue.reactive({}), subForm: {}, form: vue.reactive({}), appendData: {}, providers: {}, cycleLoad: null, loadedId: 1, nextTick: null, changeStatus: !1, pageEnd: !0, nextReload: function() { t.lifecycle("reload") } }), this.initData(e.rules), this.$manager = new e.manager(this), this.$render = new Render(this), this.api = e.extendApi(Api(this), this) } function getError(e, t, n) { var r = "fail to ".concat(e, " ").concat(n.status, "'"), i = new Error(r); return i.status = n.status, i.url = e, i } function getBody(e) { var t = e.responseText || e.response; if (!t) return t; try { return JSON.parse(t) } catch (e) { return t } } function fetch$1(e) { if ("undefined" != typeof XMLHttpRequest) { var t, n = new XMLHttpRequest, r = e.action; n.onerror = function(t) { e.onError(t) }, n.onload = function() { if (n.status < 200 || n.status >= 300) return e.onError(getError(r, e, n), getBody(n)); e.onSuccess(getBody(n)) }, n.open(e.method || "get", r, !0), e.data && ("json" !== (e.dataType || "").toLowerCase() ? ( t = new FormData, Object.keys(e.data).map((function(n) { t.append(n, e.data[n]) }))) : (t = JSON.stringify(e.data), n.setRequestHeader("content-type", "application/json"))), e.withCredentials && "withCredentials" in n && (n.withCredentials = ! 0); var i = e.headers || {}; Object.keys(i).forEach((function(e) { null !== i[e] && n.setRequestHeader(e, i[e]) })), n.send(t) } } extend(Handler.prototype, { initData: function(e) { extend(this, { ctxs: {}, fieldCtx: {}, nameCtx: {}, sort: [], rules: e }) }, init: function() { this.appendData = _objectSpread2(_objectSpread2(_objectSpread2({}, this.options .formData || {}), this.fc.vm.props.modelValue || {}), this.appendData), this .useProvider(), this.usePage(), this.loadRule(), this.$manager.__init() }, isBreakWatch: function() { return this.loading || this.noWatchFn || this.reloading } }), useInject(Handler), usePage(Handler), useRender(Handler), useLoader(Handler), useInput(Handler), useContext(Handler), useLifecycle(Handler), useEffect(Handler); var NAME = "fcFragment", fragment = vue.defineComponent({ name: NAME, inheritAttrs: !1, props: ["vnode"], render: function() { return this.vnode } }); function tidyDirectives(e) { return Object.keys(e).map((function(t) { var n = e[t], r = vue.resolveDirective(t); if (r) return [r, n.value, n.arg, n.modifiers] })).filter((function(e) { return !!e })) } function makeDirective(e, t) { var n = e.directives; return n ? (Array.isArray(n) || (n = [n]), vue.withDirectives(t, n.reduce((function(e, t) { return e.concat(tidyDirectives(t)) }), []))) : t } function CreateNodeFactory() { var e = {}; function t() {} return extend(t.prototype, { make: function(e, t, n) { return makeDirective(t, this.h(e, toProps(t), n)) }, makeComponent: function(e, t, n) { try { return makeDirective(t, vue.createVNode(e, toProps(t), n)) } catch (e) { return console.error(e), vue.createVNode("") } }, h: function(e, t, n) { var r = vue.getCurrentInstance().appContext.config.isNativeTag(e); r && delete t.formCreateInject; try { return vue.createVNode(r ? e : vue.resolveComponent(e), t, n) } catch (e) { return console.error(e), vue.createVNode("") } }, aliasMap: e }), extend(t, { aliasMap: e, alias: function(t, n) { e[t] = n }, use: function(e) { Object.keys(e).forEach((function(n) { var r = toLine(n), i = toString(n).toLocaleLowerCase(), o = e[n]; [n, r, i].forEach((function(e) { t.alias(n, o), t.prototype[e] = function(e, t) { return this.make(o, e, t) } })) })) } }), t } function createManager(e) { var t = function(e) { _inherits(n, e); var t = _createSuper(n); function n() { return _classCallCheck(this, n), t.apply(this, arguments) } return n }(Manager); return Object.assign(t.prototype, e), t } function Manager(e) { extend(this, { $handle: e, vm: e.vm, options: {}, ref: "fcForm", mergeOptionsRule: { normal: ["form", "row", "info", "submitBtn", "resetBtn"] } }), this.updateKey(), this.init() } extend(Manager.prototype, { __init: function() { var e = this; this.$render = this.$handle.$render, this.$r = function() { var t; return (t = e.$render).renderRule.apply(t, arguments) } }, updateKey: function() { this.key = uniqueId() }, init: function() {}, update: function() {}, beforeRender: function() {}, form: function() { return this.vm.refs[this.ref] }, mergeOptions: function(e, t) { var n = this; return mergeProps(e.map((function(e) { return n.tidyOptions(e) })), t, this.mergeOptionsRule) }, updateOptions: function(e) { this.options = this.mergeOptions([e], this.getDefaultOptions()), this.update() }, tidyOptions: function(e) { return e }, tidyRule: function(e) {}, mergeProp: function(e) {}, getDefaultOptions: function() { return {} }, render: function(e) {} }); var fetch = function(e) { function t(t, n, r) { var i = t.value; if (is.Function(i) && (i = i(n, r)), !(i = function(e) { return is.String(e) && (e = { action: e, to: "options" }), e }(i)) || !i.action) return !1; i.to || (i.to = "options"); var o = i.onError, a = function() { if (!t.getValue()) return t.clearProp(), r.sync(n), !0 }, u = function(e) { void 0 === e ? (t.clearProp(), r.sync(n)) : deepSet(t.getProp(), i.to, e) }; return invoke((function() { return e.create.fetch(_objectSpread2(_objectSpread2({}, i), {}, { onSuccess: function(e) { if (!a()) { var t = function(e) { return e.data }; is.Function(i.parse) && (t = i.parse), u(t(e, n, r)), r.sync(n) } }, onError: function(e) { u(void 0), a() || (o || function(e) { return err(e.message || "fetch fail " + i .action) })(e, n, r) } }), { inject: t, rule: n, api: r }) })), !0 } return { name: "fetch", loaded: function() { t.apply(void 0, arguments) }, watch: function(e, n, r) { t(e, n, r) || (e.clearProp(), r.sync(n)) } } }, $provider = { fetch: fetch }, name$6 = "html", html = { name: name$6, loadChildren: !1, render: function(e, t) { return t.prop.props.innerHTML = e.default(), t.vNode.make(t.prop.props.tag || "div", t.prop) }, renderChildren: function(e) { return { default: function() { return e.filter((function(e) { return is.String(e) })).join("") } } } }; function parseProp(e, t) { var n; return 2 === arguments.length ? t = (n = arguments[1])[e] : n = arguments[2], { id: t, prop: n } } function nameProp() { return parseProp.apply(void 0, ["name"].concat(Array.prototype.slice.call(arguments))) } function exportAttrs(e) { var t = e.key || [], n = e.array || [], r = e.normal || []; keyAttrs.push.apply(keyAttrs, _toConsumableArray(t)), arrayAttrs.push.apply(arrayAttrs, _toConsumableArray(n)), normalAttrs.push.apply(normalAttrs, _toConsumableArray(r)), appendProto( [].concat(_toConsumableArray(t), _toConsumableArray(n), _toConsumableArray(r))) } var id = 1, instance = {}; function FormCreateFactory(e) { var t, n = _defineProperty({}, fragment.name, fragment), r = {}, i = {}, o = {}, a = [], u = _objectSpread2({}, $provider), s = makerFactory(), c = { global: {} }, l = {}, f = CreateNodeFactory(); function d(e) { var t = instance[e]; return Array.isArray(t) ? _toConsumableArray(t) : t } function p(e) { a.push(e) } function h() { var e = nameProp.apply(void 0, arguments); e.id && e.prop && (i[e.id] = e.prop) } function m() { var e = nameProp.apply(void 0, arguments); e.id && e.prop && (u[e.id] = _objectSpread2(_objectSpread2({}, e.prop), {}, { name: e.id })) } function v(e) { f.use(e) } function y() { var e = nameProp.apply(void 0, arguments); if (e.id && e.prop) { var t = toCase(e.id), n = e.prop, i = !0 === n.merge ? r[t] : void 0; r[t] = _objectSpread2(_objectSpread2({}, i || BaseParser), n), s[t] = creatorFactory(t), n .maker && extend(s, n.maker) } } function g(e, t) { var r; if (is.String(e)) { if (r = toCase(e), void 0 === t) return n[r] } else r = toCase(e.displayName || e.name), t = e; r && t && (n[r] = t, t.formCreateParser && y(r, t.formCreateParser)) } function _() { return $FormCreate(w) } function b() { return fragment } function $(e, t) { return is.Function(e.install) ? e.install(C, t) : is.Function(e) && e(C, t), this } function C(e, t) { var n = function(e, t) { var n = _(); return vue.createApp({ data: function() { return vue.reactive({ rule: e, option: t }) }, render: function() { return vue.h(n, _objectSpread2({ ref: "fc" }, this.$data)) } }) }(e, t || {}); a.forEach((function(e) { invoke((function() { return e(C, n) })) })); var r = document.createElement("div"); return ((null == t ? void 0 : t.el) || document.body).appendChild(r), n.mount(r).$refs.fc.fapi } function x(t) { var c = _objectSpread2({}, e); return t ? c.inherit = { components: n, parsers: r, directives: i, modelFields: o, providers: u, useApps: a, maker: s, data: l } : delete c.inherit, FormCreateFactory(c) } function k(e, t) { o[e] = t } function w(t) { var a = this; extend(this, { id: id++, create: C, vm: t, manager: createManager(e.manager), parsers: r, providers: u, modelFields: o, rules: t.props.rule, name: t.props.name, inFor: t.props.inFor, prop: { components: n, directives: i }, CreateNode: f, bus: new Mitt, unwatch: null, options: vue.ref(t.props.option || {}), extendApi: e.extendApi || function(e) { return e } }), vue.nextTick((function() { vue.watch(a.options, (function() { a.$handle.$manager.updateOptions(a.options.value), a.api().refresh() }), { deep: !0 }) })), extend(t.appContext.components, n), extend(t.appContext.directives, i), this.$handle = new Handler(this), this.name && (this.inFor ? (instance[this.name] || (instance[this .name] = []), instance[this.name].push(this.api())) : instance[this.name] = this.api()) } function S(t) { extend(t, { version: e.version, ui: e.ui, data: l, maker: s, component: g, directive: h, setModelField: k, register: m, $vnode: b, parser: y, use: $, factory: x, componentAlias: v, copyRule: copyRule, copyRules: copyRules, fetch: fetch$1, $form: _, parseFn: parseFn, parseJson: parseJson, toJson: toJson, useApp: p, getApi: d }) } if (exportAttrs(e.attrs || {}), extend(w.prototype, { init: function() { var e = this; this.isSub() && (this.unwatch = vue.watch((function() { return e.vm.parent.option }), (function() { e.initOptions(e.options.value), e.$handle.api.refresh() }), { deep: !0 })), this.initOptions(this.options.value), this.$handle.init() }, isSub: function() { return this.vm.setupState.parent && this.vm.setupState.extendOption }, initOptions: function(e) { this.options.value = _objectSpread2({ formData: {}, submitBtn: {}, resetBtn: {} }, deepCopy(c)), this.isSub() && (this.options.value = this.mergeOptions(this .options.value, this.vm.setupState.parent.setupState.fapi.config || {}, !0)), this.updateOptions(e) }, mergeOptions: function(e, t, n) { return t = deepCopy(t), n && ["page", "onSubmit", "mounted", "reload", "formData", "el" ].forEach((function(e) { delete t[e] })), t.global && (e.global = mergeGlobal(e.global, t.global), delete t.global), this.$handle.$manager.mergeOptions([t], e), e }, updateOptions: function(e) { this.options.value = this.mergeOptions(this.options.value, e), this.$handle.$manager .updateOptions(this.options.value) }, api: function() { return this.$handle.api }, render: function() { return this.$handle.render() }, mounted: function() { this.$handle.mounted() }, unmount: function() { if (this.name) if (this.inFor) { var e = instance[this.name].indexOf(this.api()); instance[this.name].splice(e, 1) } else delete instance[this.name]; this.unwatch && this.unwatch(), this.$handle.reloadRule([]) }, updated: function() { var e = this; this.$handle.bindNextTick((function() { return e.bus.$emit("next-tick", e.$handle.api) })) } }), S(C), extend(t = C, { create: C, install: function(e, n) { if (c = _objectSpread2(_objectSpread2({}, c), n || {}), !0 !== e ._installedFormCreate) { e._installedFormCreate = !0; var r = function(e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; return C(e, t) }; S(r), e.config.globalProperties.$formCreate = r, e.component("FormCreate", _()), a.forEach((function(n) { invoke((function() { return n(t, e) })) })) } } }), f.use({ fragment: "fcFragment" }), e.install && C.use(e), p((function(e, t) { t.mixin({ props: ["formCreateInject"] }) })), y(html), e.inherit) { var F = e.inherit; F.components && extend(n, F.components), F.parsers && extend(r, F.parsers), F.directives && extend( i, F.directives), F.modelFields && extend(o, F.modelFields), F.providers && extend(u, F .providers), F.useApps && extend(a, F.useApps), F.maker && extend(s, F.maker), F.data && extend(l, F.data) } return C } var DEFAULT_FORMATS = { date: "YYYY-MM-DD", month: "YYYY-MM", datetime: "YYYY-MM-DD HH:mm:ss", timerange: "HH:mm:ss", daterange: "YYYY-MM-DD", monthrange: "YYYY-MM", datetimerange: "YYYY-MM-DD HH:mm:ss", year: "YYYY" }, name$5 = "datePicker", datePicker = { name: name$5, maker: ["year", "month", "date", "dates", "week", "datetime", "datetimeRange", "dateRange", "monthRange" ].reduce((function(e, t) { return e[t] = creatorFactory(name$5, { type: t.toLowerCase() }), e }), {}), mergeProp: function(e) { var t = e.prop.props; t.valueFormat || (t.valueFormat = DEFAULT_FORMATS[t.type] || DEFAULT_FORMATS.date) } }, name$4 = "hidden", hidden = { name: name$4, maker: _defineProperty({}, name$4, (function(e, t) { return creatorFactory(name$4)("", e, t) })), render: function() { return [] } }, name$3 = "input", input = { name: name$3, maker: function() { var e = ["password", "url", "email", "text", "textarea"].reduce((function(e, t) { return e[t] = creatorFactory(name$3, { type: t }), e }), {}); return e.idate = creatorFactory(name$3, { type: "date" }), e }(), mergeProp: function(e) { var t = e.prop.props; t && t.autosize && t.autosize.minRows && (t.rows = t.autosize.minRows || 2) } }, name$2 = "slider", slider = { name: name$2, maker: { sliderRange: creatorFactory(name$2, { range: !0 }) }, toFormValue: function(e, t) { var n = Array.isArray(e), r = t.prop.props, i = r.min || 0; return !0 === r.range ? n ? e : [i, parseFloat(e) || i] : n ? parseFloat(e[0]) || i : parseFloat(e) } }, name$1 = "timePicker", timePicker = { name: name$1, maker: { time: creatorFactory(name$1, (function(e) { return e.props.isRange = !1 })), timeRange: creatorFactory(name$1, (function(e) { return e.props.isRange = !0 })) }, mergeProp: function(e) { var t = e.prop.props; t.valueFormat || (t.valueFormat = "HH:mm:ss") } }, row = { name: "FcRow", render: function(e, t) { return t.vNode.col({ props: { span: 24 } }, { default: function() { return [t.vNode.row(t.prop, e)] } }) } }, name = "select", select = { name: name, toFormValue: function(e, t) { return t.prop.props.multiple && !Array.isArray(e) ? toArray(e) : e } }, parsers = [datePicker, hidden, input, slider, timePicker, row, select], PRE = "el", alias = { button: PRE + "-button", icon: PRE + "-icon", slider: PRE + "-slider", rate: PRE + "-rate", upload: "fc-upload", cascader: PRE + "-cascader", popover: PRE + "-popover", tooltip: PRE + "-tooltip", colorPicker: PRE + "-colorPicker", timePicker: PRE + "-time-picker", timeSelect: PRE + "-time-select", datePicker: PRE + "-date-picker", switch: PRE + "-switch", select: "fc-select", checkbox: "fc-checkbox", radio: "fc-radio", inputNumber: PRE + "-input-number", number: PRE + "-input-number", input: PRE + "-input", formItem: PRE + "-form-item", form: PRE + "-form", frame: "fc-frame", col: PRE + "-col", row: PRE + "-row", tree: "fc-tree", autoComplete: PRE + "-autocomplete", auto: PRE + "-autocomplete", group: "fc-group", object: "fc-sub-form", subForm: "fc-sub-form" }; function getConfig() { return { form: { inline: !1, labelPosition: "right", labelWidth: "125px", disabled: !1, size: void 0 }, row: { show: !0, gutter: 0 }, submitBtn: { type: "primary", loading: !1, disabled: !1, innerText: "提交", show: !0, col: void 0, click: void 0 }, resetBtn: { type: "default", loading: !1, disabled: !1, innerText: "重置", show: !1, col: void 0, click: void 0 } } } function isTooltip(e) { return "tooltip" === e.type } function tidy(e, t) { var n; hasProperty(e, t) && (is.String(e[t]) && (e[t] = (_defineProperty(n = {}, t, e[t]), _defineProperty(n, "show", !0), n))) } function isFalse(e) { return !1 === e } function tidyBool(e, t) { hasProperty(e, t) && !is.Object(e[t]) && (e[t] = { show: !!e[t] }) } function tidyRule(e) { var t = _objectSpread2({}, e); return delete t.children, t } var manager = { validate: function() { var e = this.form(); return e ? e.validate() : new Promise((function(e) { return e() })) }, validateField: function(e) { var t = this; return new Promise((function(n, r) { var i = t.form(); i ? i.validateField(e, (function(e) { e ? r(e) : n(null) })) : n() })) }, clearValidateState: function(e) { var t = this.vm.refs[e.wrapRef]; t && t.clearValidate() }, tidyOptions: function(e) { return ["submitBtn", "resetBtn", "row", "info", "wrap", "col"].forEach((function(t) { tidyBool(e, t) })), e }, tidyRule: function(e) { var t = e.prop; return tidy(t, "title"), tidy(t, "info"), t }, mergeProp: function(e) { e.prop = mergeProps([{ info: this.options.info || {}, wrap: this.options.wrap || {}, col: this.options.col || {} }, e.prop], { info: { trigger: "hover", placement: "top-start", icon: !0 }, title: {}, col: { span: 24 }, wrap: {} }, { normal: ["title", "info", "col", "wrap"] }) }, getDefaultOptions: function() { return getConfig() }, update: function() { var e = this.options.form; this.rule = { props: _objectSpread2({}, e), on: { submit: function(e) { e.preventDefault() } }, class: [e.className, e.class, "form-create"], style: e.style, type: "form" } }, beforeRender: function() { var e = this.key, t = this.ref, n = this.$handle; extend(this.rule, { key: e, ref: t }), extend(this.rule.props, { model: n.formData }) }, render: function(e) { var t = this; return e.slotLen() && e.setSlot(void 0, (function() { return t.makeFormBtn() })), this.$r(this.rule, isFalse(this.options.row.show) ? e.getSlots() : [this.makeRow( e)]) }, makeWrap: function(e, t) { var n = this, r = e.prop, i = "".concat(this.key).concat(e.key), o = r.col, a = this.isTitle(r), u = o.labelWidth || a ? o.labelWidth : 0, s = this.rule.props, c = s.inline, l = s.col, f = isFalse(r.wrap.show) ? t : this.$r(mergeProps([r.wrap, { props: _objectSpread2(_objectSpread2({ labelWidth: void 0 === u ? u : toString(u), label: a ? r.title.title : void 0 }, tidyRule(r.wrap || {})), {}, { prop: e.id, rules: r.validate }), class: r.className, key: "".concat(i, "fi"), ref: e.wrapRef, type: "formItem" }]), _objectSpread2({ default: function() { return t } }, a ? { label: function() { return n.makeInfo(r, i) } } : {})); return !0 === c || isFalse(l) || isFalse(o.show) ? f : this.makeCol(r, i, [f]) }, isTitle: function(e) { if (!1 === this.options.form.title) return !1; var t = e.title; return !(!t.title && !t.native || isFalse(t.show)) }, makeInfo: function(e, t) { var n = this, r = _objectSpread2({}, e.title), i = _objectSpread2({}, e.info), o = isTooltip(i), a = this.options.form, u = [(r.title || "") + (a.labelSuffix || a["label-suffix"] || "")]; if (!isFalse(i.show) && (i.info || i.native) && !isFalse(i.icon)) { var s = { type: i.type || "popover", props: tidyRule(i), key: "".concat(t, "pop") }; delete s.props.icon, delete s.props.show, delete s.props.info, delete s.props.align, delete s.props.native; var c = "content"; i.info && !hasProperty(s.props, c) && (s.props[c] = i.info), u["left" !== i.align ? "unshift" : "push"](this.$r(mergeProps([i, s]), _defineProperty({}, r.slot || ( o ? "default" : "reference"), (function() { return n.$r({ type: "ElIcon", style: "top:2px", key: "".concat(t, "i") }, { default: function() { return n.$r({ type: !0 === i.icon ? "icon-warning" : i.icon }) } }, !0) })))) } var l = mergeProps([r, { props: tidyRule(r), key: "".concat(t, "tit"), type: r.type || "span" }]); return delete l.props.show, delete l.props.title, delete l.props.native, this.$r(l, u) }, makeCol: function(e, t, n) { var r = e.col; return this.$r({ class: r.class, type: "col", props: r || { span: 24 }, key: "".concat(t, "col") }, n) }, makeRow: function(e) { var t = this.options.row || {}; return this.$r({ type: "row", props: t, class: t.class, key: "".concat(this.key, "row") }, e) }, makeFormBtn: function() { var e = []; if (isFalse(this.options.submitBtn.show) || e.push(this.makeSubmitBtn()), isFalse(this .options.resetBtn.show) || e.push(this.makeResetBtn()), e.length) { var t = this.$r({ type: "formItem", key: "".concat(this.key, "fb") }, e); return !0 === this.rule.props.inline ? t : this.$r({ type: "col", props: { span: 24 }, key: "".concat(this.key, "fc") }, [t]) } }, makeResetBtn: function() { var e = this, t = _objectSpread2({}, this.options.resetBtn), n = t.innerText; return delete t.innerText, delete t.click, delete t.col, delete t.show, this.$r({ type: "button", props: t, style: { width: t.width }, on: { click: function() { var t = e.$handle.api; e.options.resetBtn.click ? e.options.resetBtn.click(t) : t .resetFields() } }, key: "".concat(this.key, "b2") }, [n]) }, makeSubmitBtn: function() { var e = this, t = _objectSpread2({}, this.options.submitBtn), n = t.innerText; return delete t.innerText, delete t.click, delete t.col, delete t.show, this.$r({ type: "button", props: t, style: { width: t.width }, on: { click: function() { var t = e.$handle.api; e.options.submitBtn.click ? e.options.submitBtn.click(t) : t .submit() } }, key: "".concat(this.key, "b1") }, [n]) } }, maker$1 = {}; function useAlias(e) { ["group", "tree", "switch", "upload", "autoComplete", "checkbox", "cascader", "colorPicker", "datePicker", "frame", "inputNumber", "radio", "rate" ].forEach((function(t) { e[t] = creatorFactory(t) })), e.auto = e.autoComplete, e.number = e.inputNumber, e.color = e.colorPicker } function useSelect(e) { var t = "select", n = "multiple"; e.selectMultiple = creatorFactory(t, _defineProperty({}, n, !0)), e.selectOne = creatorFactory(t, _defineProperty({}, n, !1)) } function useTree(e) { var t = { treeSelected: "selected", treeChecked: "checked" }; Object.keys(t).reduce((function(e, n) { return e[n] = creatorFactory("tree", { type: t[n] }), e }), e) } function useUpload(e) { var t = { image: ["image", 0], file: ["file", 0], uploadFileOne: ["file", 1], uploadImageOne: ["image", 1] }; Object.keys(t).reduce((function(e, n) { return e[n] = creatorFactory("upload", (function(e) { return e.props({ uploadType: t[n][0], maxLength: t[n][1] }) })), e }), e), e.uploadImage = e.image, e.uploadFile = e.file } function useFrame(e) { var t = { frameInputs: ["input", 0], frameFiles: ["file", 0], frameImages: ["image", 0], frameInputOne: ["input", 1], frameFileOne: ["file", 1], frameImageOne: ["image", 1] }; return Object.keys(t).reduce((function(e, n) { return e[n] = creatorFactory("frame", (function(e) { return e.props({ type: t[n][0], maxLength: t[n][1] }) })), e }), e), e.frameInput = e.frameInputs, e.frameFile = e.frameFiles, e.frameImage = e.frameImages, e } useAlias(maker$1), useSelect(maker$1), useTree(maker$1), useUpload(maker$1), useFrame(maker$1); var css_248z = ".form-create .form-create .el-form-item{margin-bottom:22px}.form-create .form-create .el-form-item .el-form-item{margin-bottom:0}.form-create{width:100%}"; function tidyBtnProp(e, t) { return is.Boolean(e) ? e = { show: e } : is.Undef(e) || is.Object(e) || (e = { show: t }), e } function extendApi(e, t) { return extend(e, { validate: function(n) { return new Promise((function(r, i) { var o = e.children, a = [t.$manager.validate()]; o.forEach((function(e) { a.push(e.validate()) })), Promise.all(a).then((function() { r(!0), n && n(!0) })).catch((function(e) { i(e), n && n(e) })) })) }, validateField: function(e, n) { return new Promise((function(r, i) { var o = t.getFieldCtx(e); if (o) { var a = t.subForm[o.id], u = [t.$manager.validateField(o.id)]; toArray(a).forEach((function(e) { u.push(e.validate()) })), Promise.all(u).then((function() { r(null), n && n(null) })).catch((function(e) { i(e), n && n(e) })) } })) }, clearValidateState: function(n) { var r = this, i = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1]; e.helper.tidyFields(n).forEach((function(e) { i && r.clearSubValidateState(e), t.getCtxs(e).forEach((function(e) { t.$manager.clearValidateState(e) })) })) }, clearSubValidateState: function(n) { e.helper.tidyFields(n).forEach((function(e) { t.getCtxs(e).forEach((function(e) { var n = t.subForm[e.id]; n && (Array.isArray(n) ? n.forEach((function(e) { e.clearValidateState() })) : n && n.clearValidateState()) })) })) }, btn: { loading: function() { var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0]; e.submitBtnProps({ loading: !!t }) }, disabled: function() { var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0]; e.submitBtnProps({ disabled: !!t }) }, show: function() { var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0]; e.submitBtnProps({ show: !!t }) } }, resetBtn: { loading: function() { var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0]; e.resetBtnProps({ loading: !!t }) }, disabled: function() { var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0]; e.resetBtnProps({ disabled: !!t }) }, show: function() { var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0]; e.resetBtnProps({ show: !!t }) } }, submitBtnProps: function() { var n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, r = tidyBtnProp(t.options.submitBtn, !0); extend(r, n), t.options.submitBtn = r, e.refreshOptions() }, resetBtnProps: function() { var n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, r = tidyBtnProp(t.options.resetBtn, !1); extend(r, n), t.options.resetBtn = r, e.refreshOptions() }, submit: function(n, r) { return new Promise((function(i, o) { e.validate().then((function() { var r = e.formData(); is.Function(n) && invoke((function() { return n(r, e) })), is.Function(t.options.onSubmit) && invoke(( function() { return t.options.onSubmit(r, e) })), t.vm.emit("submit", r, e), i(r) })).catch((function() { for (var t = arguments.length, n = new Array(t), i = 0; i < t; i++) n[i] = arguments[i]; is.Function(r) && invoke((function() { return r.apply(void 0, [e].concat( n)) })), o.apply(void 0, n) })) })) } }), e } styleInject(css_248z); var required = { name: "required", load: function(e, t, n) { var r = parseVal(e.getValue()); if (!1 === r.required) e.clearProp(); else { var i = _objectSpread2({ required: !0, validator: function(e, t, n) { is.empty(t) ? n(i.message) : n() } }, r); if (!i.message) { var o = t.title || ""; i.message = (("object" === _typeof(o) ? o.title : o) || "") + "不能为空" } e.getProp().validate = [i] } n.sync(t) }, watch: function() { required.load.apply(required, arguments) } }; function parseVal(e) { return is.Boolean(e) ? { required: e } : is.String(e) ? { message: e } : is.Function(e) ? { validator: e } : is.Object(e) ? e : {} } function install(e) { e.componentAlias(alias), components.forEach((function(t) { e.component(t.name, t) })), e.register(required), parsers.forEach((function(t) { e.parser(t) })), Object.keys(maker$1).forEach((function(t) { e.maker[t] = maker$1[t] })), "undefined" != typeof window && window.ElementPlus && e.useApp((function(e, t) { t.use(window.ElementPlus) })) } function elmFormCreate() { return FormCreateFactory({ ui: "element-ui", version: "3.1.15", manager: manager, extendApi: extendApi, install: install, attrs: { normal: ["col", "wrap"], array: ["className"], key: ["title", "info"] } }) } var FormCreate = elmFormCreate(); "undefined" != typeof window && (window.formCreate = FormCreate); var maker = FormCreate.maker; exports.default = FormCreate, exports.maker = maker, Object.defineProperty(exports, "__esModule", { value: !0 }) }));