@form-create/element-ui 2.5.37 → 2.6.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,12 @@
1
1
  /*!
2
- * @form-create/element-ui v2.5.37
2
+ * FormCreate 低代码表单渲染器
3
+ * @form-create/element-ui v2.6.0
3
4
  * (c) 2018-2024 xaboy
4
5
  * Github https://github.com/xaboy/form-create
6
+ * Site https://form-create.com/
5
7
  * Released under the MIT License.
6
8
  */
7
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e=e||self).formCreate={},e.Vue)}(this,function(e,t){"use strict";function n(){return(n=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)&&(e[r]=t[r]);return e}).apply(this,arguments)}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;var r=["attrs","props","domProps"],i=["class","style","directives"],o=["on","nativeOn"],a=function(e,t){return function(){e&&e.apply(this,arguments),t&&t.apply(this,arguments)}},u=function(e){return e.reduce(function(e,t){for(var u in t)if(e[u])if(-1!==r.indexOf(u))e[u]=n({},e[u],t[u]);else if(-1!==i.indexOf(u)){var c=e[u]instanceof Array?e[u]:[e[u]],s=t[u]instanceof Array?t[u]:[t[u]];e[u]=c.concat(s)}else if(-1!==o.indexOf(u))for(var l in t[u])if(e[u][l]){var f=e[u][l]instanceof Array?e[u][l]:[e[u][l]],p=t[u][l]instanceof Array?t[u][l]:[t[u][l]];e[u][l]=f.concat(p)}else e[u][l]=t[u][l];else if("hook"==u)for(var d in t[u])e[u][d]=e[u][d]?a(e[u][d],t[u][d]):t[u][d];else e[u]=t[u];else e[u]=t[u];return e},{})};function c(e){return(c="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})(e)}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(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 f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function m(e){var t=function(){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}}();return function(){var n,r=p(e);if(t){var i=p(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h(this,n)}}function v(e){return function(e){if(Array.isArray(e))return y(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(e,t)}(e)||function(){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 y(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 g(e,t){return Object.keys(e).reduce(function(n,r){return t&&-1!==t.indexOf(r)||n.push(e[r]),n},[])}var b={name:"fcCheckbox",props:{formCreateInject:{type:Object,required:!0},value:{type:Array,default:function(){return[]}},type:String},watch:{"formCreateInject.options":{handler:function(){this.update()},deep:!0},value:function(){this.update()}},data:function(){return{trueValue:[]}},methods:{options:function(){var e=this.formCreateInject.options;return Array.isArray(e)?e:[]},onInput:function(e){this.$emit("input",this.options().filter(function(t){return-1!==e.indexOf(t.label)}).map(function(e){return e.value}).filter(function(e){return void 0!==e}))},update:function(){var e=Array.isArray(this.value)?this.value:[this.value];this.trueValue=this.options().filter(function(t){return-1!==e.indexOf(t.value)}).map(function(e){return e.label})}},created:function(){this.update()},render:function(){var e=this,t=arguments[0];return t("ElCheckboxGroup",u([{},this.formCreateInject.prop,{},{props:{value:this.trueValue}},{ref:"el",on:{input:this.onInput}}]),[this.options().map(function(n,r){var i=f({},n),o="button"===e.type?"ElCheckboxButton":"ElCheckbox";return delete i.value,t(o,u([{},{props:i},{key:o+r+"-"+n.value}]))}),g(this.$slots)])},mounted:function(){this.$emit("fc.el",this.$refs.el)}};function $(e){return Array.isArray(e)?e:[null,void 0,""].indexOf(e)>-1?[]:[e]}function x(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))}}x("._fc-frame .fc-files img {\n width: 100%;\n height: 100%;\n display: inline-block;\n vertical-align: top;\n}\n\n._fc-frame .fc-upload-btn {\n border: 1px dashed #c0ccda;\n cursor: pointer;\n}\n\n._fc-frame .fc-upload-cover {\n opacity: 0;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n background: rgba(0, 0, 0, .6);\n -webkit-transition: opacity .3s;\n -o-transition: opacity .3s;\n transition: opacity .3s;\n}\n\n._fc-frame .fc-upload-cover i {\n color: #fff;\n font-size: 20px;\n cursor: pointer;\n margin: 0 2px;\n}\n\n._fc-frame .fc-files:hover .fc-upload-cover {\n opacity: 1;\n}\n\n._fc-frame .el-upload {\n display: block;\n}\n\n._fc-frame .fc-upload-btn, .fc-files {\n display: inline-block;\n width: 58px;\n height: 58px;\n text-align: center;\n line-height: 58px;\n border: 1px solid #c0ccda;\n border-radius: 4px;\n overflow: hidden;\n background: #fff;\n position: relative;\n -webkit-box-shadow: 2px 2px 5px rgba(0, 0, 0, .1);\n box-shadow: 2px 2px 5px rgba(0, 0, 0, .1);\n margin-right: 4px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n}\n");var k={name:"fcFrame",props:{formCreateInject:{type:Object,required:!0},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:"el-icon-upload2"},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:{type:Function,default:function(e){this.previewImage=this.getSrc(e),this.previewVisible=!0}},modal:{type:Object,default:function(){return{}}},srcKey:{type:[String,Number]},value:[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}},data:function(){return{fileList:$(this.value),previewVisible:!1,frameVisible:!1,previewImage:""}},watch:{value:function(e){this.fileList=$(e)},fileList:function(e){var t=1===this.maxLength?e[0]||"":e;this.$emit("input",t),this.$emit("change",t)},src:function(e){this.modalVm&&(this.modalVm.src=e)}},methods:{key:function(e){return e},closeModel:function(e){this.$emit(e?"$close":"$ok"),this.reload&&(this.$off("$ok"),this.$off("$close")),this.frameVisible=!1},handleCancel:function(){this.previewVisible=!1},showModel:function(){this.disabled||!1===this.onOpen()||(this.frameVisible=!0)},makeInput:function(){var e=this,t=this.$createElement,n={type:"text",value:this.fileList.map(function(t){return e.getSrc(t)}).toString(),readonly:!0};return t("ElInput",u([{},{props:n},{key:this.key("input")}]),[this.fileList.length?t("i",{slot:"suffix",class:"el-input__icon el-icon-circle-close",on:{click:function(){return e.fileList=[]}}}):null,t("ElButton",u([{attrs:{icon:this.icon}},{on:{click:function(){return e.showModel()}}},{slot:"append"}]))])},makeGroup:function(e){var t=this.$createElement;return(!this.maxLength||this.fileList.length<this.maxLength)&&e.push(this.makeBtn()),t("div",{key:this.key("group")},v(e))},makeItem:function(e,t){return(0,this.$createElement)("div",{class:"fc-files",key:this.key("file"+e)},v(t))},valid:function(e){var t=this.formCreateInject.field||this.field;if(t&&e!==t)throw new Error("[frame]无效的字段值")},makeIcons:function(e,t){var n=this.$createElement;if(!1!==this.handleIcon||!0===this.allowRemove){var r=[];return("file"!==this.type&&!1!==this.handleIcon||"file"===this.type&&this.handleIcon)&&r.push(this.makeHandleIcon(e,t)),this.allowRemove&&r.push(this.makeRemoveIcon(e,t)),n("div",{class:"fc-upload-cover",key:this.key("uc")},[r])}},makeHandleIcon:function(e,t){var n=this;return(0,this.$createElement)("i",{class:!0===this.handleIcon||void 0===this.handleIcon?"el-icon-view":this.handleIcon,on:{click:function(){return n.handleClick(e)}},key:this.key("hi"+t)})},makeRemoveIcon:function(e,t){var n=this;return(0,this.$createElement)("i",{class:"el-icon-delete",on:{click:function(){return n.handleRemove(e)}},key:this.key("ri"+t)})},makeFiles:function(){var e=this,t=this.$createElement;return this.makeGroup(this.fileList.map(function(n,r){return e.makeItem(r,[t("i",{class:"el-icon-tickets",on:{click:function(){return e.handleClick(n)}}}),e.makeIcons(n,r)])}))},makeImages:function(){var e=this,t=this.$createElement;return this.makeGroup(this.fileList.map(function(n,r){return e.makeItem(r,[t("img",{attrs:{src:e.getSrc(n)}}),e.makeIcons(n,r)])}))},makeBtn:function(){var e=this,t=this.$createElement;return t("div",{class:"fc-upload-btn",on:{click:function(){return e.showModel()}},key:this.key("btn")},[t("i",{class:this.icon})])},handleClick:function(e){return this.onHandle(e)},handleRemove:function(e){this.disabled||!1!==this.onBeforeRemove(e)&&(this.fileList.splice(this.fileList.indexOf(e),1),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("input",n)},get:function(e){return t.valid(e),t.value},onOk:function(e){return t.$on("$ok",e)},onClose:function(e){return t.$on("$close",e)}})}catch(e){console.log(e)}},makeFooter:function(){var e=this,t=this.$createElement,n=this.$props,r=n.okBtnText,i=n.closeBtnText,o=n.closeBtn,a=n.okBtn;if(n.footer)return t("div",{slot:"footer"},[o?t("ElButton",{on:{click:function(){return!1!==e.onCancel()&&(e.frameVisible=!1)}}},[i]):null,a?t("ElButton",{attrs:{type:"primary"},on:{click:function(){return!1!==e.onOk()&&e.closeModel()}}},[r]):null])}},render:function(){var e,t=this,n=arguments[0],r=this.type;e="input"===r?this.makeInput():"image"===r?this.makeImages():this.makeFiles();var i=this.$props,o=i.width,a=void 0===o?"30%":o,c=i.height,s=i.src,l=i.title,p=i.modalTitle;return this.$nextTick(function(){t.$refs.frame&&t.frameLoad(t.$refs.frame.contentWindow||{})}),n("div",{class:"_fc-frame"},[e,n("el-dialog",u([{},{props:{appendToBody:!0,modal:this.previewMask,title:p,visible:this.previewVisible}},{on:{close:this.handleCancel}}]),[n("img",{style:"width: 100%",attrs:{src:this.previewImage}})]),n("el-dialog",u([{},{props:f(f({width:a,title:l,appendToBody:!0},this.modal),{},{visible:this.frameVisible})},{on:{close:function(){return t.closeModel(!0)}}}]),[this.frameVisible||!this.reload?n("iframe",{ref:"frame",attrs:{src:s,frameBorder:"0"},style:{height:c,border:"0 none",width:"100%"}}):null,this.makeFooter()])])},mounted:function(){this.$on("fc.closeModal",this.closeModal)}},_={name:"fcRadio",props:{formCreateInject:{type:Object,required:!0},value:{},type:String},watch:{"formCreateInject.options":{handler:function(){this.update()},deep:!0},value:function(){this.update()}},data:function(){return{trueValue:[]}},methods:{options:function(){var e=this.formCreateInject.options;return Array.isArray(e)?e:[]},onInput:function(e){this.$emit("input",this.options().filter(function(t){return t.label===e}).reduce(function(e,t){return t.value},""))},update:function(){var e=this;this.trueValue=this.options().filter(function(t){return t.value===e.value}).reduce(function(e,t){return t.label},"")}},created:function(){this.update()},render:function(){var e=this,t=arguments[0];return t("ElRadioGroup",u([{},this.formCreateInject.prop,{ref:"el"},{props:{value:this.trueValue}},{on:{input:this.onInput}}]),[this.options().map(function(n,r){var i=f({},n),o="button"===e.type?"ElRadioButton":"ElRadio";return delete i.value,t(o,u([{},{props:i},{key:o+r+"-"+n.value}]))}),g(this.$slots)])},mounted:function(){this.$emit("fc.el",this.$refs.el)}},w={type:function(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"},Undef:function(e){return null==e},Element:function(e){return"object"===c(e)&&null!==e&&1===e.nodeType&&!w.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 O(e,t){return{}.hasOwnProperty.call(e,t)}["Date","Object","String","Boolean","Array","Number"].forEach(function(e){w[e]=function(t){return w.type(t,e)}});var C={name:"fcSelect",functional:!0,props:{formCreateInject:{type:Object,required:!0}},render:function(e,t){var n=function(t,n){var r=t.slot;return e("ElOption",u([{},{props:t},{key:n+"-"+t.value}]),[r?e("template",{slot:t.slotName||"default"},[w.Function(r)?t.slot(e):r]):null])},r=t.props.formCreateInject.options;return e("ElSelect",u([{},t.data,{ref:"el"}]),[(Array.isArray(r)?r:[]).map(function(t,r){return O(t||"","options")?function(t,r){return e("ElOptionGroup",{attrs:{label:t.label},key:r+"-"+t.label},[w.trueArray(t.options)&&t.options.map(function(e,t){return n(e,t)})])}(t,r):n(t,r)}),t.children])},mounted:function(){this.$emit("fc.el",this.$refs.el)}},j={name:"fcTree",formCreateParser:{mergeProp:function(e){var t=e.prop.props;t.nodeKey||(t.nodeKey="id"),t.props||(t.props={label:"title"})}},props:{formCreateInject:{type:Object,required:!0},type:{type:String,default:"checked"},value:{type:[Array,String,Number],default:function(){return[]}}},watch:{value:function(){this.setValue()}},methods:{onChange:function(){this.updateValue()},updateValue:function(){var e;this.$refs.tree&&(e="selected"===this.type.toLocaleLowerCase()?this.$refs.tree.getCurrentKey():this.$refs.tree.getCheckedKeys(),this.$emit("input",e))},setValue:function(){"selected"===this.type.toLocaleLowerCase()?this.$refs.tree.setCurrentKey(this.value):this.$refs.tree.setCheckedKeys($(this.value))}},render:function(){var e=this;return(0,arguments[0])("ElTree",u([{},this.formCreateInject.prop,{ref:"tree",on:{check:function(){return e.updateValue()},"node-click":function(){return e.updateValue()}}}]),[g(this.$slots)])},mounted:function(){this.setValue(),this.$emit("fc.el",this.$refs.tree)}};function S(e,t){return{url:e,name:E(e),uid:t}}function E(e){return(""+e).split("/").pop()}x("._fc-upload .fc-files img {\n width: 100%;\n height: 100%;\n display: inline-block;\n vertical-align: top;\n}\n\n._fc-upload .fc-upload-btn {\n border: 1px dashed #c0ccda;\n cursor: pointer;\n}\n\n._fc-upload .fc-upload-cover {\n opacity: 0;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n background: rgba(0, 0, 0, .6);\n -webkit-transition: opacity .3s;\n -o-transition: opacity .3s;\n transition: opacity .3s;\n}\n\n._fc-upload .fc-upload-cover i {\n color: #fff;\n font-size: 20px;\n cursor: pointer;\n margin: 0 2px;\n}\n\n._fc-upload .fc-files:hover .fc-upload-cover {\n opacity: 1;\n}\n\n._fc-upload .el-upload {\n display: block;\n}\n\n._fc-upload .fc-upload-btn, ._fc-upload .fc-files {\n display: inline-block;\n width: 58px;\n height: 58px;\n text-align: center;\n line-height: 58px;\n border: 1px solid #c0ccda;\n border-radius: 4px;\n overflow: hidden;\n background: #fff;\n position: relative;\n -webkit-box-shadow: 2px 2px 5px rgba(0, 0, 0, .1);\n box-shadow: 2px 2px 5px rgba(0, 0, 0, .1);\n margin-right: 4px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n}\n");var F={name:"fcUpload",props:{formCreateInject:{type:Object,required:!0},onHandle:{type:Function,default:function(e){this.previewImage=e.url,this.previewVisible=!0}},uploadType:{type:String,default:"file"},limit:{type:Number,default:0},allowRemove:{type:Boolean,default:!0},previewMask:void 0,modalTitle:String,handleIcon:{type:[String,Boolean],default:function(){}},value:[Array,String]},data:function(){return{uploadList:[],previewVisible:!1,previewImage:"",cacheFiles:[]}},created:function(){void 0===this.formCreateInject.prop.props.showFileList&&(this.formCreateInject.prop.props.showFileList=!1),this.formCreateInject.prop.props.fileList=$(this.value).map(S)},watch:{value:function(e){this.$refs.upload.uploadFiles.every(function(e){return!e.status||"success"===e.status})&&(this.$refs.upload.uploadFiles=$(e).map(S),this.uploadList=this.$refs.upload.uploadFiles)},limit:function(e,t){1!==t&&1!==e||this.update()}},methods:{key:function(e){return e},isDisabled:function(){return!0===this.formCreateInject.prop.props.disabled},onRemove:function(e){this.isDisabled()||this.$refs.upload.handleRemove(e)},handleClick:function(e){this.onHandle(e)},makeItem:function(e,t){var n=this.$createElement;return"image"===this.uploadType?n("img",{attrs:{src:e.url},key:this.key("img"+t)}):n("i",{class:"el-icon-tickets",key:this.key("i"+t)})},makeRemoveIcon:function(e,t){var n=this;return(0,this.$createElement)("i",{class:"el-icon-delete",on:{click:function(){return n.onRemove(e)}},key:this.key("ri"+t)})},makeHandleIcon:function(e,t){var n=this;return(0,this.$createElement)("i",{class:!0===this.handleIcon||void 0===this.handleIcon?"el-icon-view":this.handleIcon,on:{click:function(){return n.handleClick(e)}},key:this.key("hi"+t)})},makeProgress:function(e,t){return(0,this.$createElement)("ElProgress",u([{},{props:{percentage:e.percentage,type:"circle",width:52}},{style:"margin-top:2px;",key:this.key("pg"+t)}]))},makeIcons:function(e,t){var n=this.$createElement,r=[];if(this.allowRemove||!1!==this.handleIcon)return("file"!==this.uploadType&&!1!==this.handleIcon||"file"===this.uploadType&&this.handleIcon)&&r.push(this.makeHandleIcon(e,t)),this.allowRemove&&r.push(this.makeRemoveIcon(e,t)),n("div",{class:"fc-upload-cover"},[r])},makeFiles:function(){var e=this,t=this.$createElement;return this.uploadList.map(function(n,r){return e.$scopedSlots.fileList?e.$scopedSlots.fileList({file:n,index:r,vm:e}):t("div",{key:e.key(r),class:"fc-files"},[void 0!==n.percentage&&"success"!==n.status?e.makeProgress(n,r):[e.makeItem(n,r),e.makeIcons(n,r)]])})},makeUpload:function(){var e=this.$createElement,t=!this.limit||this.limit>this.uploadList.length;return e("ElUpload",u([{},this.formCreateInject.prop,{},{style:{display:"inline-block"},key:this.key("upload"),ref:"upload"}]),[t?e("template",{slot:"default"},[this.$slots.default||e("div",{class:"fc-upload-btn"},[e("i",{class:"el-icon-upload2"})])]):null,g(this.$slots,["default"])])},update:function(){var e=this.$refs.upload.uploadFiles.map(function(e){return e.url}).filter(function(e){return void 0!==e});this.cacheFiles.length===e.length&&e.length||(this.cacheFiles=v(e),this.$emit("input",1===this.limit?e[0]||"":e))},handleCancel:function(){this.previewVisible=!1}},render:function(){var e=arguments[0];return this.$refs.upload&&(void 0===this.formCreateInject.prop.props.showFileList&&(this.formCreateInject.prop.props.showFileList=this.$refs.upload.showFileList),this.formCreateInject.prop.props.fileList=this.$refs.upload.fileList),e("div",{class:"_fc-upload"},[[this.formCreateInject.prop.props.showFileList?[]:this.makeFiles(),this.makeUpload()],e("el-dialog",u([{},{props:{appendToBody:!0,modal:this.previewMask,title:this.modalTitle,visible:this.previewVisible}},{on:{close:this.handleCancel}}]),[e("img",{attrs:{alt:"example",src:this.previewImage},style:"width: 100%"})])])},mounted:function(){var e=this;this.uploadList=this.$refs.upload.uploadFiles,this.$watch(function(){return e.$refs.upload.uploadFiles},function(){e.update()},{deep:!0}),this.$emit("fc.el",this.$refs.upload)}};function R(e,n,r){t.set(e,n,r)}function I(e,n){t.delete(e,n)}function V(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))||w.Object(o)){var a=void 0===e[i];if(r)r=!1,a&&R(e,i,[]);else if(o._clone&&void 0!==n){if(!n){R(e,i,o._clone());continue}o=o.getRule(),a&&R(e,i,{})}else a&&R(e,i,{});e[i]=V(e[i],o,n)}else R(e,i,o),w.Undef(o)||(w.Undef(o.__json)||(e[i].__json=o.__json),w.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 A(e){return V({},{value:e}).value}var P=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)&&R(e,r,t[r]);return e};function D(){return P.apply(this,arguments)}x('._fc-group{\n display: flex;\n min-height: 42px;\n justify-content: center;\n flex-direction: column;\n}\n\n._fc-group-disabled ._fc-group-btn, ._fc-group-disabled ._fc-group-add{\n cursor: not-allowed;\n}\n\n._fc-group-handle {\n display: flex;\n flex-direction: row;\n position: absolute;\n bottom: -15px;\n right: 30px;\n border-radius: 15px;\n border: 1px dashed #d9d9d9;\n padding: 3px 8px;\n background-color: #ffffff;\n}\n\n._fc-group-btn{\n cursor: pointer;\n}\n\n._fc-group-idx {\n position: absolute;\n bottom: -15px;\n left: 10px;\n width: 30px;\n height: 30px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: #eee;\n border-radius: 15px;\n font-weight: 700;\n}\n\n._fc-group-handle ._fc-group-btn + ._fc-group-btn {\n margin-left: 7px;\n}\n\n._fc-group-container{\n position: relative;\n display: flex;\n flex-direction: column;\n border: 1px dashed #d9d9d9;\n padding: 20px;\n margin: 5px;\n border-radius: 5px;\n margin-bottom: 25px;\n padding-bottom: 25px;\n}\n\n._fc-group-arrow {\n position: relative;\n width: 20px;\n height: 20px;\n}\n\n._fc-group-arrow::before {\n content: "";\n position: absolute;\n top: 8px;\n left: 5px;\n width: 9px;\n height: 9px;\n border-left: 2px solid #999;\n border-top: 2px solid #999;\n}\n._fc-group-arrow::before {\n transform: rotate(45deg);\n}\n\n._fc-group-arrow._fc-group-down {\n transform: rotate(180deg);\n}\n\n._fc-group-plus-minus {\n width: 20px;\n height: 20px;\n position: relative;\n cursor: pointer;\n}\n\n._fc-group-plus-minus::before,\n._fc-group-plus-minus::after {\n content: "";\n position: absolute;\n top: 50%;\n left: 50%;\n width: 60%;\n height: 2px;\n background-color: #409eff;\n transform: translate(-50%, -50%);\n}\n\n._fc-group-plus-minus::before {\n transform: translate(-50%, -50%) rotate(90deg);\n}\n\n._fc-group-plus-minus._fc-group-minus::before {\n display: none;\n}\n._fc-group-plus-minus._fc-group-minus::after {\n background-color: #f56c6c;\n}\n\n\n._fc-group-add{\n cursor: pointer;\n width: 25px;\n height: 25px;\n border: 1px solid rgb(64 158 255 / 50%);\n border-radius: 15px;\n}\n\n._fc-group-add._fc-group-plus-minus::before, ._fc-group-add._fc-group-plus-minus::after {\n width: 50%;\n}\n\n');var T=[b,k,_,C,j,F,{name:"fcGroup",props:{field:String,rule:[Array,Object],rules:Array,expand:Number,options:Object,formCreateInject:{type:Object,required:!0},button:{type:Boolean,default:!0},max:{type:Number,default:0},min:{type:Number,default:0},value:{type:Array,default:function(){return[]}},sortBtn:{type:Boolean,default:!0},defaultValue:Object,disabled:{type:Boolean,default:!1},syncDisabled:{type:Boolean,default:!0},onBeforeRemove:{type:Function,default:function(){}},onBeforeAdd:{type:Function,default:function(){}},parse:Function},data:function(){return{len:0,cacheRule:{},cacheValue:{},sort:[],type:void 0}},computed:{formRule:function(){return this.rules?this.rules:this.rule?Array.isArray(this.rule)?this.rule:[this.rule]:[]}},watch:{cacheRule:{handler:function(e){this.sort=Object.keys(e)},immediate:!0},formRule:{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(){V(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=A(e)}}})},deep:!0},expand:function(e){var t=e-this.value.length;t>0&&this.expandRule(t)},value:function(e,t){var n=this;e=e||[];var r=this.sort,i=r.length,o=i-e.length;if(o<0){for(var a=o;a<0;a++)this.addRule(e.length+a);this.sort=Object.keys(this.cacheRule);for(var u=0;u<i;u++)this.setValue(r[u],e[u])}else{if(o>0){for(var c=0;c<o;c++)this.removeRule(r[i-c-1]);this.sort=Object.keys(this.cacheRule)}e.forEach(function(t,i){n.setValue(r[i],e[i])})}}},methods:{_value:function(e){return e&&O(e,this.field)?e[this.field]:e},cache:function(e,t){this.cacheValue[e]=JSON.stringify(t)},input:function(e){this.$emit("input",e),this.$emit("change",e)},formData:function(e,t){var n=this,r=this.cacheRule,i=this.sort;if(i.filter(function(e){return r[e].$f}).length===i.length){var o=i.map(function(r){var i=e===r?t:f({},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,r=this.cacheRule[e].$f;n&&(t=s({},n,this._value(t))),this.cacheValue[e]!==JSON.stringify(n?t[n]:t)&&(this.cache(e,t),r&&r.coverValue(t||{}))},addRule:function(e,t){var n=this,r=this.formCreateInject.form.copyRules(this.formRule),i=this.options?f({},this.options):{submitBtn:!1,resetBtn:!1};if(this.defaultValue){i.formData||(i.formData={});var o=A(this.defaultValue);D(i.formData,this.field?s({},this.field,o):o)}this.parse&&this.parse({rule:r,options:i,index:this.sort.length}),this.$set(this.cacheRule,++this.len,{rule:r,options:i}),t&&this.$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.$nextTick(function(){r.$emit("itemMounted",n,Object.keys(r.cacheRule).indexOf(t))})},removeRule:function(e,t){var n=this,r=Object.keys(this.cacheRule).indexOf(e);this.$delete(this.cacheRule,e),this.$delete(this.cacheValue,e),t&&this.$nextTick(function(){return n.$emit("remove",r)})},add:function(e){this.disabled||!1===this.onBeforeAdd(this.value)||this.addRule(e,!0)},del:function(e,t){if(!this.disabled&&!1!==this.onBeforeRemove(this.value,e)){this.removeRule(t,!0);var n=v(this.value);n.splice(e,1),this.input(n)}},addIcon:function(e){return(0,this.$createElement)("div",{class:"_fc-group-btn _fc-group-plus-minus",on:{click:this.add}})},delIcon:function(e,t){var n=this;return(0,this.$createElement)("div",{class:"_fc-group-btn _fc-group-plus-minus _fc-group-minus",on:{click:function(){return n.del(e,t)}}})},sortUpIcon:function(e){var t=this;return(0,this.$createElement)("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-up",on:{click:function(){return t.changeSort(e,-1)}}})},sortDownIcon:function(e){var t=this;return(0,this.$createElement)("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-down",on:{click:function(){return t.changeSort(e,1)}}})},changeSort:function(e,t){var n=this.sort[e];this.$set(this.sort,e,this.sort[e+t]),this.sort[e+t]=n,this.formData(0)},makeIcon:function(e,t,n){var r=this;if(this.$scopedSlots.button)return this.$scopedSlots.button({total:e,index:t,vm:this,key:n,del:function(){return r.del(t,n)},add:this.add});var i=[];return(!this.max||e<this.max)&&e===t+1&&i.push(this.addIcon(n)),e>this.min&&i.push(this.delIcon(t,n)),this.sortBtn&&t&&i.push(this.sortUpIcon(t)),this.sortBtn&&t!==e-1&&i.push(this.sortDownIcon(t)),i},emitEvent:function(e,t,n,r){this.$emit.apply(this,[e].concat(v(t),[this.cacheRule[r].$f,n]))},expandRule:function(e){for(var t=0;t<e;t++)this.value.push(this.field?null:{})}},created:function(){this.type=this.formCreateInject.form.$form();var e=(this.expand||0)-this.value.length;e>0&&this.expandRule(e);for(var t=0;t<this.value.length;t++)this.addRule(t)},render:function(){var e=this,t=arguments[0],n=this.sort,r=this.button,i=this.type,o=this.disabled,a=0===n.length?this.$scopedSlots.default?this.$scopedSlots.default({vm:this,add:this.add}):t("div",{key:"a_def",class:"_fc-group-plus-minus _fc-group-add",on:{click:this.add}}):n.map(function(a,c){var l=e.cacheRule[a],f=l.rule,p=l.options,d=r&&!o?e.makeIcon(n.length,c,a):[];return t("div",{class:"_fc-group-container",key:a},[t(i,u([{key:a},{on:{"update:value":function(t){return e.formData(a,t)},"emit-event":function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return e.emitEvent(t,r,c,a)},input:function(t){return e.add$f(c,a,t)}}},{},{props:{disabled:o,inFor:!0,value:e.field?s({},e.field,e._value(e.value[c])):e.value[c],rule:f,option:p,extendOption:!0}}])),t("div",{class:"_fc-group-idx"},[c+1]),d.length?t("div",{class:"_fc-group-handle"},[d]):null])});return t("div",{key:"con",class:"_fc-group "+(o?"_fc-group-disabled":"")},[a])}},{name:"fcSubForm",props:{rule:Array,options:Object,formCreateInject:{type:Object,required:!0},value:{type:Object,default:function(){return{}}},disabled:{type:Boolean,default:!1},syncDisabled:{type:Boolean,default:!0}},data:function(){return{cacheRule:{},cacheValue:{},type:void 0}},watch:{value:function(e){this.setValue(e)}},methods:{formData:function(e){this.cacheValue=JSON.stringify(e),this.$emit("input",e),this.$emit("change",e)},setValue:function(e){var t=JSON.stringify(e);this.cacheValue!==t&&(this.cacheValue=t,this.cacheRule.$f.coverValue(e||{}))},addRule:function(){var e=this.options?this.options:{submitBtn:!1,resetBtn:!1};e.formData=f({},this.value||{}),this.cacheRule={rule:this.rule,options:e}},add$f:function(e){var t=this;this.cacheRule.$f=e,this.$nextTick(function(){t.$emit("itemMounted",e)})},emitEvent:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];this.$emit.apply(this,[e].concat(n))}},created:function(){this.addRule(),this.type=this.formCreateInject.form.$form()},render:function(){var e=arguments[0],t=this.cacheRule,n=t.rule,r=t.options;return e(this.type,u([{},{on:{"update:value":this.formData,"emit-event":this.emitEvent,input:this.add$f}},{},{props:{rule:n,option:r,disabled:this.disabled,extendOption:!0}}]))}}],B="FormCreate",L=function e(t,n){if(t&&t!==n)return t.formCreateInject?t.formCreateInject:t.$parent?e(t.$parent,n):void 0};function N(e){return{name:B,componentName:B,model:{prop:"api"},provide:function(){return{$pfc:this}},inject:{$pfc:{default:null}},props:{rule:{type:Array,required:!0},option:{type:Object,default:function(){return{}}},extendOption:Boolean,disabled:{type:Boolean,default:void 0},value:Object,api:Object,name:String,subForm:{type:Boolean,default:!0},inFor:Boolean},data:function(){return{formData:void 0,destroyed:!1,validate:{},$f:void 0,isShow:!0,unique:1,renderRule:v(this.rule||[]),ctxInject:{},updateValue:JSON.stringify(this.value||{}),isMore:!!this.inFor}},render:function(){return this.formCreate.render()},methods:{_refresh:function(){++this.unique},_renderRule:function(){this.renderRule=v(this.rule||[])},_updateValue:function(e){this.destroyed||(this.updateValue=JSON.stringify(e),this.$emit("update:value",e))}},watch:{value:{handler:function(e){JSON.stringify(e||{})!==this.updateValue&&(this.$f.config.forceCoverValue?this.$f.coverValue(e||{}):this.$f.setValue(e||{}))},deep:!0},option:{handler:function(){this.formCreate.initOptions(),this.$f.refresh()},deep:!0},rule:function(e){var t=this;e.length===this.renderRule.length&&e.every(function(e){return t.renderRule.indexOf(e)>-1})||(this.formCreate.$handle.reloadRule(e),this._renderRule())},disabled:function(){this.$f.refresh()}},beforeCreate:function(){var t=this;this.formCreate=new e(this),Object.keys(this.formCreate.prop).forEach(function(e){D(t.$options[e],t.formCreate.prop[e])}),this.$emit("beforeCreate",this.formCreate.api())},created:function(){var e=this,t=this,n=this.formCreate.api(),r=function(){var e=L(t,t.$pfc);if(e)if(t.isMore){var r=$(e.getSubForm()),i=r.indexOf(n);i>-1&&r.splice(i,1)}else e.subForm()};t.$on("hook:beforeDestroy",function(){r()}),this.$watch(function(){return e.subForm},function(e){e?function(){if(t.$pfc){var e,r=L(t,t.$pfc);r&&(t.isMore?(e=$(r.getSubForm())).push(n):e=n,r.subForm(e))}}():r()},{immediate:!0})}}}var M=["attrs","props","domProps","scopedSlots"],q=["class","style","directives"],H=["on","nativeOn"],U=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(M,v(r.normal||[])),o=[].concat(q,v(r.array||[])),a=[].concat(H,v(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]=f(f({},t[r]),n[r]);else if(o.indexOf(r)>-1){var s=t[r]instanceof Array?t[r]:[t[r]],l=n[r]instanceof Array?n[r]:[n[r]];t[r]=[].concat(v(s),v(l))}else if(a.indexOf(r)>-1)for(var p in n[r])if(t[r][p]){var d=t[r][p]instanceof Array?t[r][p]:[t[r][p]],h=n[r][p]instanceof Array?n[r][p]:[n[r][p]];t[r][p]=[].concat(v(d),v(h))}else t[r][p]=n[r][p];else if("hook"===r)for(var m in n[r])t[r][m]?t[r][m]=J(t[r][m],n[r][m]):t[r][m]=n[r][m];else t[r]=n[r];else i.indexOf(r)>-1||a.indexOf(r)>-1||u.indexOf(r)>-1?t[r]=f({},n[r]):o.indexOf(r)>-1?t[r]=n[r]instanceof Array?v(n[r]):"object"===c(n[r])?f({},n[r]):n[r]:t[r]=n[r];return t},n)},J=function(e,t){return function(){e&&e.apply(this,arguments),t&&t.apply(this,arguments)}},W=["type","slot","emitPrefix","value","name","native","hidden","display","inject","options","emit","nativeEmit","link","prefix","suffix","update","sync","optionsTo","key","preview","component","cache"],K=["validate","children","control"],z=["effect","deep"];function G(e,t,n){return"[form-create ".concat(e,"]: ").concat(t)+(n?"\n\nrule: "+JSON.stringify(n.getRule?n.getRule():n):"")}function X(e,t){console.error(G("err",e,t))}var Q="[[FORM-CREATE-PREFIX-",Z="-FORM-CREATE-SUFFIX]]",Y="$FN:",ee="$FNX:",te="function";function ne(e,t){return JSON.stringify(V(Array.isArray(e)?[]:{},e,!0),function(e,t){if(!t||!0!==t._isVue){if(c(t)!==te)return t;if(t.__json)return t.__json;if(t.__origin&&(t=t.__origin),!t.__emit)return Q+t+Z}},t)}function re(e){return new Function("return "+e)()}function ie(e,t){if(e&&w.String(e)&&e.length>4){var n=e.trim(),r=!1;try{if(n.indexOf(Z)>0&&0===n.indexOf(Q))n=n.replace(Z,"").replace(Q,""),r=!0;else if(0===n.indexOf(Y))n=n.replace(Y,""),r=!0;else{if(0===n.indexOf(ee))return(n=re("function($inject){"+n.replace(ee,"")+"}")).__json=e,n.__inject=!0,n;t||0!==n.indexOf(te)||n===te||(r=!0)}if(!r)return e;var i=re(-1===n.indexOf(te)&&0!==n.indexOf("(")?te+" "+n:n);return i.__json=e,i}catch(e){return void X("解析失败:".concat(n,"\n\nerr: ").concat(e))}}return e}function oe(e,t){return JSON.parse(e,function(e,n){return w.Undef(n)||!n.indexOf?n:ie(n,t)})}function ae(e,t){return{value:e,enumerable:!1,configurable:!1,writable:!!t}}function ue(e){return ce([e])[0]}function ce(e,t){return V([],v(e),t||!1)}function se(e,t){return U(Array.isArray(t)?t:[t],e,{array:K,normal:z}),e}function le(e){var t=w.Function(e.getRule)?e.getRule():e;return t.type||(t.type="input"),t}function fe(e,t){Object.defineProperties(e,Object.keys(t).reduce(function(e,n){return e[n]={get:function(){return t[n]()}},e},{}))}function pe(e){return e.__fc__||(e.__origin__?e.__origin__.__fc__:null)}function de(e,t){try{t=e()}catch(e){!function(e){X(e.toString()),console.error(e)}(e)}return t}var he=function(e,t){return"string"==typeof e?String(t):"number"==typeof e?Number(t):t},me={"==":function(e,t){return JSON.stringify(e)===JSON.stringify(he(e,t))},"!=":function(e,t){return!me["=="](e,t)},">":function(e,t){return e>t},">=":function(e,t){return e>=t},"<":function(e,t){return e<t},"<=":function(e,t){return e<=t},on:function(e,t){return e&&e.indexOf&&e.indexOf(he(e[0],t))>-1},notOn:function(e,t){return!me.on(e,t)},in:function(e,t){return t&&t.indexOf&&t.indexOf(e)>-1},notIn:function(e,t){return!me.in(e,t)},between:function(e,t){return e>t[0]&&e<t[1]},notBetween:function(e,t){return e<t[0]||e>t[1]},empty:function(e){return w.empty(e)},notEmpty:function(e){return!w.empty(e)},pattern:function(e,t){return new RegExp(t,"g").test(e)}};function ve(e,t){return function(n,r,i){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=new ye(e,n,r,i,o);return t&&(w.Function(t)?t(a):a.props(t)),a}}function ye(e,t,n,r,i){this._data=D({props:{},on:{},options:[],children:[],effect:{},hidden:!1,display:!0,value:void 0},{type:e,title:t,field:n,value:r,props:i||{}}),this.event=this.on}function ge(e){e.forEach(function(e){ye.prototype[e]=function(t){return se(this._data,s({},e,arguments.length<2?t:s({},t,arguments[1]))),this}})}D(ye.prototype,{getRule:function(){return this._data},setProp:function(e,t){return R(this._data,e,t),this},_clone:function(){var e=new this.constructor;return e._data=ue(this._data),e}}),ge([].concat(W,v(M),v(q),v(H),K,z));var be=ve("");function $e(e,t,n){var r=be("",t);return r._data.type=e,r._data.title=n,r}function xe(e,t,n,r){var i=be("",n);return i._data.type="template",i._data.template=e,i._data.title=r,i._data.vm=t,i}function ke(){return{create:$e,createTmp:xe,template:xe,factory:ve}}function _e(e){var t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch(e){return t}}function we(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(function(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}(r,0,n),_e(n));e.onSuccess(_e(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)}}function Oe(e){return new Promise(function(t,n){we(f(f({},e),{},{onSuccess:function(n){var r=function(e){return e},i=ie(e.parse);w.Function(i)?r=i:i&&w.String(i)&&(r=function(e){return i.split(".").forEach(function(t){e&&(e=e[t])}),e}),t(r(n))},onError:function(e){n(e)}}))})}function Ce(e){return A(e)}function je(e){return Se(e.replace(/(-[a-z])/g,function(e){return e.replace("-","").toLocaleUpperCase()}))}function Se(e){return e.replace(e[0],e[0].toLowerCase())}function Ee(e){return null==e?"":"object"===c(e)?JSON.stringify(e,null,2):String(e)}function Fe(e){var t=e.replace(/([A-Z])/g,"-$1").toLocaleLowerCase();return 0===t.indexOf("-")&&(t=t.substr(1)),t}var Re=0;function Ie(){var e=++Re+370;return"F"+Math.random().toString(36).substr(3,3)+Number("".concat(Date.now())).toString(36)+e.toString(36)+"c"}function Ve(e,t,n){var r,i=e;return(t||"").split(".").forEach(function(e){r&&(i[r]&&"object"==c(i[r])||(i[r]={}),i=i[r]),r=e}),i[r]=n,i}function Ae(e){D(this,{$handle:e,fc:e.fc,vm:e.vm,$manager:e.$manager,vNode:new e.fc.CreateNode(e.vm)}),fe(this,{options:function(){return e.options},sort:function(){return e.sort}}),this.initCache(),this.initRender()}!function(e){D(e.prototype,{initCache:function(){this.clearCacheAll()},clearCache:function(e){if(!e.rule.cache)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}})}(Ae),function(e){D(e.prototype,{initRender:function(){this.tempList={},this.clearOrgChildren()},initOrgChildren:function(){var e=this.$handle.ctxs;this.orgChildren=Object.keys(e).reduce(function(t,n){if(!1!==e[n].parser.loadChildren){var r=e[n].rule.children;t[n]=w.trueArray(r)?v(r):[]}return t},{})},clearOrgChildren:function(){this.orgChildren={}},getTypeSlot:function(e){return function t(n){if(n){var r=void 0;return e.rule.field&&(r=n.$scopedSlots["field-"+Fe(e.rule.field)]||n.$scopedSlots["field-"+e.rule.field]),r||(r=n.$scopedSlots["type-"+Fe(e.type)]||n.$scopedSlots["type-"+e.type]),r||t(n.$pfc)}}(this.vm)},render:function(){var e=this;if(this.vm.isShow){var t;this.$h=this.vm.$createElement,this.$manager.beforeRender();var n=function(){return e.renderList()};return n.renderSlot=function(t){return e.renderList(t)},n.renderName=function(t){return e.renderId(t)},n.renderField=function(t){return e.renderId(t,"field")},t=this.vm.$scopedSlots.container?[this.vm.$scopedSlots.container(n)]:n(),this.$manager.render(t)}},renderList:function(e){var t=this;return this.sort.map(function(n){return e?t.renderSlot(t.$handle.ctxs[n],e):t.renderCtx(t.$handle.ctxs[n])}).filter(function(e){return void 0!==e})},makeVm:function(e){var t=this,n=e.vm;return n?w.Function(n)?de(function(){return e.vm(t.$handle.getInjectData(e))}):n._isVue?n:new Ze(n):new Ze},mergeGlobal:function(e){var t=this.$handle.options.global;t&&(e.cacheConfig||(e.cacheConfig=t[e.originType]||t[e.type]||t[e.trueType]||{}),e.prop=se({},[t["*"],e.cacheConfig,e.prop]))},setOptions:function(e){e.prop.optionsTo&&e.prop.options&&Ve(e.prop,e.prop.optionsTo,e.prop.options)},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){Ve(e.prop,n,t[n])})},setTempProps:function(e,t){if(e.$props){var n=t.prop,r=Object.keys(e.$props),i=this.injectProp(t),o=Object.keys(i);r.forEach(function(t){O(n.props,t)?e.$props[t]=n.props[t]:o.indexOf(t)>-1&&(e.$props[t]=i[t])});var a=e.$options.model&&e.$options.model.prop||"value";r.indexOf(a)>-1&&(e.$props[a]=n.value)}},renderTemp:function(e){var t=this;if(!Ze.compile)return function(e,t){console.warn(G("tip",e,t))}("当前使用的Vue构建版本不支持compile,无法使用template功能"),[];var n=e.prop,r=e.id,i=e.key;if(!this.tempList[r]){e.el||(e.el=this.makeVm(n),this.vm.$nextTick(function(){return e.parser.mounted(e)}));var o=e.el;e.input&&o.$on(o.$options.model&&o.$options.model.event||"input",function(n){t.onInput(e,n)}),this.tempList[r]={vm:o,template:Ze.compile(n.template)}}var a=this.tempList[r],u=a.vm,c=a.template;this.setTempProps(u,e);var s=c.render.call(u);return w.Undef(s.data)&&(s.data={}),s.key=i,s.data.ref=e.ref,s.data.key=i,s},parseSide:function(e,t){return w.Object(e)?se({props:{formCreateInject:t.prop.props.formCreateInject}},e):e},renderSides:function(e,t,n){var r=t[n?"rule":"prop"];return[this.renderRule(this.parseSide(r.prefix,t)),e,this.renderRule(this.parseSide(r.suffix,t))]},renderSlot:function(e,t){return e.rule.slot===t?this.renderCtx(e):void 0},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){if("hidden"!==e.type){var n=e.rule;if(!this.cache[e.id]||this.cache[e.id].slot!==n.slot){var r,i=!1!==n.cache,o=e.trueType,a=!(w.Undef(n.display)||n.display);if("template"!==o||n.template)if("fcFragment"===o)r=this.renderChildren(e);else{e.initProp(),this.mergeGlobal(e),this.$manager.tidyRule(e),this.deepSet(e),this.setOptions(e),this.ctxProp(e);var u=e.prop;u.preview=!!(O(u,"preview")?u.preview:this.options.preview),u.props.formCreateInject=this.injectProp(e);var c=u.preview;if(u.hidden)return void this.setCache(e,void 0,t);if("template"===o&&u.template)r=this.renderTemp(e),i=!1;else{var s=[];e.parser.renderChildren?s=e.parser.renderChildren(e):!1!==e.parser.loadChildren&&(s=this.renderChildren(e));var l=this.getTypeSlot(e);r=l?l({rule:n,prop:u,preview:c,children:s,api:this.$handle.api,model:u.model||{}}):c?e.parser.preview(s,e):e.parser.render(s,e)}r=this.renderSides(r,e),!e.input&&w.Undef(u.native)||!0===u.native||(r=this.$manager.makeWrap(e,r)),a&&(r=this.display(r)),r=this.item(e,r)}else r=this.renderSides(this.renderChildren(e),e,!0),a&&this.display(r),r=this.item(e,r);return i&&this.setCache(e,r,t),r}return this.getCache(e)}},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&&e.data)return Array.isArray(e.data.style)?e.data.style.push({display:"none"}):w.String(e.data.style)?e.data.style+=";display:none;":e.data.style=[e.data.style,{display:"none"}],e},item:function(e,t){return this.$h("fcFragment",{slot:e.rule.slot,key:e.key},[t])},injectProp:function(e){var t=this;this.vm.ctxInject[e.id]||R(this.vm.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:[],prop:{},preview:!1,id:e.id,field:e.field,rule:e.rule,input:e.input});var n,r=this.vm.ctxInject[e.id];return D(r,{preview:e.prop.preview,options:e.prop.options,children:e.rule.children,prop:(n=f({},e.prop),n.on=n.on?f({},n.on):{},delete n.model,n)}),r},ctxProp:function(e){var t=this,n=e.ref,r=e.key,i=e.rule;this.$manager.mergeProp(e),e.parser.mergeProp(e);var o=[{ref:n,key:i.key||"".concat(r,"fc"),slot:void 0,on:{"hook:mounted":function(){t.onMounted(e)},"fc.sub-form":function(n){t.$handle.addSubForm(e,n)},"fc.el":function(t){e.exportEl=t,t&&((t.$el||t).__rule__=e.rule)}}}];return e.input&&(!0===this.vm.$props.disabled&&(e.prop.props.disabled=!0),e.prop.model={value:this.$handle.getFormData(e),callback:function(n){t.onInput(e,n)},expression:"formData.".concat(e.id)}),U(o,e.prop),e.prop},onMounted:function(e){e.el=this.vm.$refs[e.ref],e.el&&((e.el.$el||e.el).__rule__=e.rule),e.parser.mounted(e),this.$handle.effect(e,"mounted")},onInput:function(e,t){this.$handle.onInput(e,t)},renderChildren:function(e){var t=this,n=e.rule.children,r=this.orgChildren[e.id],i=function(e){return!w.String(e)&&e.__fc__&&!t.$handle.ctxs[e.__fc__.id]};return!w.trueArray(n)&&r?(this.$handle.deferSyncValue(function(){r.forEach(function(e){e&&i(e)&&t.$handle.rmCtx(e.__fc__)})}),this.orgChildren[e.id]=[],[]):(r&&this.$handle.deferSyncValue(function(){r.forEach(function(e){e&&-1===n.indexOf(e)&&i(e)&&t.$handle.rmCtx(e.__fc__)})}),n.map(function(r){if(r)return w.String(r)?r:r.__fc__?t.renderCtx(r.__fc__,e):void(r.type&&t.vm.$nextTick(function(){t.$handle.loadChildren(n,e),t.$handle.refresh()}))}))},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(Se(e.originType),n,t)},renderRule:function(e,t,n){var r=this;if(e){if(w.String(e))return e;var i;if(n)i=e.type;else if(i=e.is,e.type){i=je(e.type);var o=this.vNode.aliasMap[i];o&&(i=je(o))}if(i){var a=[[t]];return w.trueArray(e.children)&&a.push(e.children.map(function(e){return r.renderRule(e)})),this.$h(i,f({},e),a)}}}})}(Ae);var Pe=["hook:updated","hook:mounted"];function De(e,t,n){var r,i=Ie();D(this,{id:i,ref:i,wrapRef:i+"fi",rule:t,origin:t.__origin__||t,name:t.name,watch:[],linkOn:[],root:[],ctrlRule:[],parent:null,cacheConfig:null,prop:f({},t),computed:{},payload:{},input:!!t.field,el:void 0,exportEl:void 0,defaultValue:t.field?A(n):void 0,field:t.field||void 0}),this.updateType(),this.updateKey(),r=this,Object.defineProperties(r.origin,{__fc__:ae(r,!0)}),this.update(e,!0)}function Te(e,t){for(var n=0;n<e.ctrlRule.length;n++){var r=e.ctrlRule[n];if(r.children===t)return r}}function Be(e){return!!e.rule.__ctrl}function Le(e,t){return"function"==typeof t?""+t:t}function Ne(e){Object.keys(e).forEach(function(t){return delete e[t]})}D(De.prototype,{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=Ie(),e&&this.parent&&this.parent.updateKey(e)},updateType:function(){this.originType=this.rule.type,this.type=je(this.rule.type)},setParser:function(e){this.parser=e,e.init(this)},initProp:function(){var e=this,t=f({},this.rule);delete t.children,this.prop=se({},[t].concat(v(Object.keys(this.payload).map(function(t){return e.payload[t]})),[this.computed]))},injectValidate:function(){var e=this;return $(this.prop.validate).map(function(t){if(w.Function(t.validator)){var n=f({},t),r=e;return n.validator=function(){for(var e,n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return(e=t.validator).call.apply(e,[{that:this,id:r.id,field:r.field,rule:r.rule,api:r.$handle.api}].concat(i))},n}return t})},check:function(e){return this.vm===e.vm},unwatch:function(){this.watch.forEach(function(e){return e()}),this.watch=[]},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(){this.unwatch(),this.unlink(),this.rmCtrl(),D(this,{deleted:!0,prop:f({},this.rule),computed:{},el:void 0,$handle:void 0,$render:void 0,$api:void 0,vm:void 0,vNode:void 0,parent:null,cacheConfig:null})},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),D(e,{root:[]})},e.input)})},update:function(e,t){D(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,cacheValue:this.rule.value}),!t&&this.unwatch(),this.watchTo(),this.link()}});var Me={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){}},qe=["field","value","vm","template","name","config","control","inject","sync","payload","optionsTo","update","component","cache"];function He(e){var t=this;D(this,{fc:e,vm:e.vm,watching:!1,loading:!1,reloading:!1,noWatchFn:null,deferSyncFn:null,isMounted:!1,formData:{},subForm:{},form:{},appendData:{},providers:{},cycleLoad:null,loadedId:1,nextTick:null,changeStatus:!1,pageEnd:!0,nextReload:function(){t.lifecycle("reload")}}),fe(this,{options:function(){return e.options},bus:function(){return e.bus}}),this.initData(e.rules),this.$manager=new e.manager(this),this.$render=new Ae(this),this.api=e.extendApi(function(e){function t(t){return w.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){R(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,v(r)):e.push(r),e):e},[])}var i={get config(){return e.options},get options(){return e.options},get form(){return e.form},get rule(){return e.rules},get parent(){return e.vm.$pfc&&e.vm.$pfc.$f},get top(){return i.parent?i.parent.top:i},get children(){return r()},formData:function(n){return t(n).reduce(function(t,n){var r=e.getFieldCtx(n);return r?(t[r.field]=Ce(r.rule.value),t):t},!1!==e.options.appendValue?Ce(e.appendData):{})},getValue:function(t){var n=e.getFieldCtx(t);if(n)return Ce(n.rule.value)},coverValue:function(t){var n=f({},t||{});e.deferSyncValue(function(){i.fields().forEach(function(t){var r=e.fieldCtx[t];if(r){var i=O(n,t);r.forEach(function(e){e.rule.value=i?n[t]:void 0}),delete n[t]}}),D(e.appendData,n)})},setValue:function(t){var n=t;arguments.length>=2&&(n=s({},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&&pe(e);if(t)return t.rm(),t.origin},destroy:function(){e.vm.$el.parentNode&&e.vm.$el.parentNode.removeChild(e.vm.$el),e.vm.$destroy()},fields:function(){return e.fields()},append:function(t,n,r){var i,o=e.sort.length-1,a=e.getCtx(n);a?r?(i=a.rule.children,o=a.rule.children.length-1):(o=a.root.indexOf(a.origin),i=a.root):i=e.rules,i.splice(o+1,0,t)},prepend:function(t,n,r){var i,o=0,a=e.getCtx(n);a?r?i=a.rule.children:(o=a.root.indexOf(a.origin),i=a.root):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){e.rule.props&&R(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=w.Object(t)?pe(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){R(e.vm,"isShow",!t)},changeStatus:function(){return e.changeStatus},clearChangeStatus:function(){e.changeStatus=!1},updateRule:function(t,n){e.getCtxs(t).forEach(function(e){D(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){se(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},getRenderRule:function(t){var n=e.getCtx(t);if(n)return n.prop},getRefRule:function(t){var n=e.getCtxs(t);if(n&&n.length){var r=n.map(function(e){return e.rule});return 1===r.length?r[0]:r}},setEffect:function(t,n,r){var i=e.getCtx(t);i&&n&&("$"===n[0]&&(n=n.substr(1)),O(i.rule,"$"+n)&&R(i.rule,"$"+n,r),O(i.rule,"effect")||R(i.rule,"effect",{}),R(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(){e.vm.validate={},i.refresh()},resetFields:function(n){t(n).forEach(function(t){e.getCtxs(t).forEach(function(t){e.$render.clearCache(t),t.rule.value=Ce(t.defaultValue)})})},method:function(e,t){var n=i.el(e);if(!n||!n[t])throw new Error(G("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 de(function(){return i.method(e,t).apply(void 0,r)})},toJson:function(e){return ne(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.exportEl||n.el||e.vm.$refs[n.ref]},closeModal:function(e){var t=i.el(e);t&&t.$emit&&t.$emit("close-modal")},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&&de(t)},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))},deferSyncValue:function(t,n){e.deferSyncValue(t,n)},fetch:function(t){return new Promise(function(n,r){e.beforeFetch(t).then(function(){return Oe(t).then(n).catch(r)})})},getData:function(t,n){return e.fc.getData(t,n)},setData:function(t,n){return e.fc.setData(t,n)},helper:{tidyFields:t,props:n}};return["on","once","off","set","emit"].forEach(function(t){i[t]=function(){var n;(n=e.vm)["$".concat(t)].apply(n,arguments)}}),i.changeValue=i.changeField=i.setValue,i}(this),this)}D(He.prototype,{initData:function(e){D(this,{ctxs:{},fieldCtx:{},nameCtx:{},sort:[],rules:e})},init:function(){this.appendData=f(f(f({},this.fc.options.formData||{}),this.vm.value||{}),this.appendData),this.useProvider(),this.usePage(),this.loadRule(),this.$manager.__init(),this.lifecycle("created"),this.vm.$set(this.vm,"formData",this.formData)},beforeFetch:function(e){var t=this;return new Promise(function(n){var r=t.options.beforeFetch&&de(function(){return t.options.beforeFetch(e,{api:t.api})});r&&w.Function(r.then)?r.then(n):n()})}}),function(e){D(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(w.Function(t)&&(!1!==n&&!w.Undef(n)||t.__inject))return this.inject(e,t,n);if(!r&&Array.isArray(t)&&t[0]&&(w.String(t[0])||w.Function(t[0])))return this.parseEventLst(e,t,n,!0);if(w.String(t)){var i=ie(t);if(i&&t!==i)return i.__inject?this.parseEvent(e,i,n,!0):i}},parseEmit:function(e,t){var n=this,r={},i=e.rule,o=i.emitPrefix,a=i.field,u=i.name,c=i.inject,s=i[t?"emit":"nativeEmit"]||[];return w.trueArray(s)&&s.forEach(function(e){if(e){var s,l=o||a||u;if(w.Object(e)&&(s=e.inject,l=(e=e.name).prefix||l),l){t||(l="native-".concat(l));var f=Fe("".concat(l,"-").concat(e)),p=function(){for(var e,t,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];(e=n.vm).$emit.apply(e,[f].concat(i)),(t=n.vm).$emit.apply(t,["emit-event",f].concat(i))};if(p.__emit=!0,s||!1!==c){var d=s||c||n.options.injectEvent;r[e]=w.Undef(d)?p:n.inject(i,p,d)}else r[e]=p}}}),e.computed[t?"on":"nativeOn"]=r,r},getInjectData:function(e,t){var n=this.vm.$options.propsData,r=n.option,i=n.rule;return{api:this.api,$f: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}})}(He),function(e){D(e.prototype,{usePage:function(){var e=this,t=this.options.page;if(t){var n,r=25,i=(n=this.rules).length<31?31:Math.ceil(n.length/3);w.Object(t)&&(t.first&&(r=parseInt(t.first,10)||r),t.limit&&(i=parseInt(t.limit,10)||i)),D(this,{first:r,limit:i,pageEnd:this.rules.length<=r}),this.bus.$on("page-end",function(){return e.vm.$emit("page-end",e.api)}),this.pageLoad()}},pageLoad:function(){var e=this;this.vm.$on(Pe,function t(){e.pageEnd?(e.vm.$off(Pe,t),e.bus.$emit("page-end")):(e.first+=e.limit,e.pageEnd=e.rules.length<=e.first,e.loadRule(),e.refresh())})}})}(He),function(e){D(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.unique>0?this.$render.render():(this.vm.unique=1,[])}})}(He),function(e){D(e.prototype,{nextRefresh:function(e){var t=this,n=this.loadedId;this.vm.$nextTick(function(){n===t.loadedId&&(e?e():t.refresh())})},parseRule:function(e){var t=this,n=le(e);return Object.defineProperties(n,{__origin__:ae(e,!0)}),function(e){var t={props:{},on:{},options:[],children:[],effect:{},hidden:!1,display:!0,value:void 0};Object.keys(t).forEach(function(n){O(e,n)||R(e,n,t[n])})}(n),this.appendValue(n),n.options=Array.isArray(n.options)?n.options:[],[n,n.prefix,n.suffix].forEach(function(e){e&&t.loadFn(e,n)}),this.loadCtrl(n),n.update&&(n.update=ie(n.update)),n},loadFn:function(e,t){var n=this;["on","props","nativeOn","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=ie(e.handle))})},syncProp:function(e){var t=this,n=e.rule;w.trueArray(n.sync)&&U([{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.pageEnd&&e.bus.$emit("load-end"),e.vm._renderRule(),e.$render.initOrgChildren(),e.syncForm()})},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.bus.$emit("load-end"),this.syncForm(),this.$render.clearCache(t)},_loadRule:function(e,t){var n=this,r=function(e,t){w.trueArray(e)&&n._loadRule(e,t)};e.map(function(i,o){if((!t||w.Object(i))&&(n.pageEnd||t||!(o>=n.first))){if(i.__fc__&&i.__fc__.root===e&&n.ctxs[i.__fc__.id])return r(i.__fc__.rule.children,i.__fc__),i.__fc__;var a,u=le(i),c=function(){return!(!u.field||!n.fieldCtx[u.field]||n.fieldCtx[u.field][0]===i.__fc__)};n.ruleEffect(u,"init",{repeat:c()}),c()&&n.vm.$emit("repeat-field",i,n.api);var s=!1,l=!!i.__fc__,f=u.value;if(l){f=(a=i.__fc__).defaultValue;var p=!a.check(n);if(a.deleted){if(p){if(Be(a))return;a.update(n)}}else if(p){if(Be(a))return;e[o]=i=i._clone?i._clone():ue(i),a=null,s=!0}}if(a)a.originType!==a.rule.type&&(a.updateType(),n.bindParser(a)),n.appendValue(a.rule);else{var d=n.parseRule(i);a=new De(n,d,f),n.bindParser(a)}if([!1,!0].forEach(function(e){return n.parseEmit(a,e)}),n.syncProp(a),a.parent=t||null,a.root=e,n.setCtx(a),!s&&!l&&n.effect(a,"load"),n.effect(a,"created"),!1===a.parser.loadChildren||r(a.rule.children,a),!t){var h=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)}(o);h>-1||!o?n.sort.splice(h+1,0,a.id):n.sort.push(a.id)}var m=a.rule;return a.updated||(a.updated=!0,w.Function(m.update)&&n.bus.$once("load-end",function(){n.refreshUpdate(a,m.value,"init")}),n.effect(a,"loaded")),a.input&&Object.defineProperty(m,"value",n.valueHandle(a)),n.refreshControl(a)&&(n.cycleLoad=!0),a}})},refreshControl:function(e){return e.input&&e.rule.control&&this.useCtrl(e)},useCtrl:function(e){var t=this,n=function(e){var t=e.rule.control||[];return w.Object(t)?[t]:t}(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(me[o.condition||"=="]||me["=="])(e,o.value)};if(!w.trueArray(o.rule))return"continue";var u=f(f({},o),{},{valid:de(function(){return a(e.rule.value,i)}),ctrl:Te(e,o.rule),isHidden:w.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=[],c=!1;return this.deferSyncValue(function(){r.reverse().forEach(function(n){var r=n.isHidden,o=n.valid,a=n.rule,s=n.prepend,l=n.append,f=n.child,p=n.ctrl,d=n.method;if(r)return o?e.ctrlRule.push({__ctrl:!0,children:a,valid:o}):e.ctrlRule.splice(e.ctrlRule.indexOf(p),1),void u[o?"push":"unshift"](function(){"disabled"===d?t.api.disabled(!o,a):"display"===d?t.api.display(o,a):"required"===d?(a.forEach(function(e){t.api.setEffect(e,"required",o)}),o||t.api.clearValidateState(a)):t.api.hidden(!o,a)});if(o){c=!0;var h={type:"fcFragment",native:!0,__ctrl:!0,children:a};e.ctrlRule.push(h),t.bus.$once("load-start",function(){s?i.prepend(h,s,f):l||f?i.append(h,l||e.id,f):e.root.splice(e.root.indexOf(e.origin)+1,0,h)})}else{e.ctrlRule.splice(e.ctrlRule.indexOf(p),1);var m=pe(p);m&&m.rm()}})}),u.length&&this.vm.$nextTick(function(){u.forEach(function(e){return e()})}),this.vm.$emit("control",e.origin,this.api),this.effect(e,"control"),c},reloadRule:function(e){return this._reloadRule(e)},_reloadRule:function(e){var t=this;e||(e=this.rules);var n=f({},this.ctxs);this.clearNextTick(),this.$render.clearOrgChildren(),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.vm.$emit("reloading",t.api)}),this.bus.$off("next-tick",this.nextReload),this.bus.$once("next-tick",this.nextReload),this.vm.$emit("update",this.api)},refresh:function(){this.vm._refresh()}})}(He),function(e){D(e.prototype,{getValue:function(e){return w.Undef(e.cacheValue)&&(e.cacheValue=e.parser.toValue(this.getFormData(e),e)),e.cacheValue},setValue:function(e,t,n,r){e.deleted||(e.cacheValue=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"),this.emitEvent("change",e.field,t,{rule:e.origin,api:this.api,setFlag:r||!1}))},onInput:function(e,t){var n;e.input&&(this.isQuote(e,n=e.parser.toValue(t,e))||this.isChange(e,n))&&this.setValue(e,n,t)},setFormData:function(e,t){R(this.formData,e.id,null===t?void 0:t)},getFormData:function(e){return this.formData[e.id]},validate:function(){var e=this;return Ne(this.vm.validate),this.fields().forEach(function(t){e.fieldCtx[t].forEach(function(t){e.vm.validate[t.id]=$(t.rule.validate)})}),this.vm.validate},syncForm:function(){var e=this;Ne(this.form),Object.defineProperties(this.form,this.fields().reduce(function(t,n){var r=e.getFieldCtx(n),i=e.valueHandle(r);return i.configurable=!0,t[n]=i,t},!1!==this.options.appendValue?Object.keys(this.appendData).reduce(function(t,n){return t[n]={enumerable:!0,configurable:!0,get:function(){return e.appendData[n]},set:function(t){e.appendData[n]=t}},t},{}):{})),this.syncValue()},valueHandle:function(e){var t=this;return{enumerable:!0,get:function(){return t.getValue(e)},set:function(n){t.isChange(e,n)&&t.setValue(e,n,e.parser.toFormValue(n,e),!0)}}},appendValue:function(e){e.field&&O(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),de(e),this.deferSyncFn===e&&(this.deferSyncFn=null,e.sync&&this.syncValue())},syncValue:function(){if(this.deferSyncFn)return this.deferSyncFn.sync=!0;this.vm._updateValue(f(f({},!1!==this.options.appendValue?this.appendData:{}),this.form))},isChange:function(e,t){return JSON.stringify(e.rule.value,Le)!==JSON.stringify(null===t?void 0:t,Le)},isQuote:function(e,t){return(w.Object(t)||Array.isArray(t))&&t===e.rule.value},refreshUpdate:function(e,t,n,r){var i=this;if(w.Function(e.rule.update)){var o=de(function(){return e.rule.update(t,e.origin,i.api,{origin:n||"change",linkField:r})});if(void 0===o)return;e.rule.hidden=!0===o}},valueChange:function(e,t){this.refreshRule(e,t),this.bus.$emit("change-"+e.field,t)},refreshRule:function(e,t,n,r){this.refreshControl(e)&&(this.$render.clearCacheAll(),this.loadRule(),this.vm.$emit("update",this.api),this.refresh()),this.refreshUpdate(e,t,n,r)},appendLink:function(e){var t=this,n=e.rule.link;w.trueArray(n)&&n.forEach(function(n){var r=function(){return t.refreshRule(e,e.rule.value,"link",n)};t.bus.$on("change-"+n,r),e.linkOn.push(function(){return t.bus.$off("change-"+n,r)})})},fields:function(){return Object.keys(this.fieldCtx)}})}(He),function(e){D(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[je(e.type)]||t[e.trueType]||Me},bindParser:function(e){e.setParser(this.getParser(e))},getType:function(e){var t=this.fc.CreateNode.aliasMap,n=t[e]||t[je(e)]||e;return je(n)},noWatch:function(e){this.noWatchFn||(this.noWatchFn=e),de(e),this.noWatchFn===e&&(this.noWatchFn=null)},watchCtx:function(e){var t=this,n=this.vm;Object.keys(e.rule).filter(function(e){return"_"!==e[0]&&"$"!==e[0]&&-1===qe.indexOf(e)}).forEach(function(r){var i="children"===r;e.watch.push(n.$watch(function(){return e.rule[r]},function(n,o){if(!(t.loading||t.noWatchFn||t.reloading)){if(i&&!1===e.parser.loadChildren)return t.$render.clearCache(e),void t.nextRefresh();if(t.watching=!0,"link"!==r){if(["props","on","nativeOn","deep"].indexOf(r)>-1)t.parseInjectEvent(e.rule,n||{}),"props"===r&&e.input&&t.setFormData(e,e.parser.toFormValue(e.rule.value,e));else if(["emit","nativeEmit"].indexOf(r)>-1)t.parseEmit(e,"emit"===r);else if(["prefix","suffix"].indexOf(r)>-1)n&&t.loadFn(n,e.rule);else if("type"===r)e.updateType(),t.bindParser(e);else if("children"===r){var a=w.trueArray(n);t.deferSyncValue(function(){n!==o&&(t.rmSub(o,e),t.$render.initOrgChildren()),a&&t.loadChildren(n,e),t.vm.$emit("update",t.api)})}t.$render.clearCache(e),t.refresh(),t.watching=!1}else e.link()}},{deep:!i,sync:i}))}),this.watchEffect(e)},rmSub:function(e,t){var n=this;w.trueArray(e)&&e.forEach(function(e){e&&e.__fc__&&e.__fc__.parent===t&&n.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;e.input&&Object.defineProperty(e.rule,"value",{value:e.rule.value,writable:!0}),I(this.ctxs,n),I(this.$render.tempList,n),I(this.$render.orgChildren,n),I(this.vm.ctxInject,n),I(this.formData,n),I(this.subForm,n),I(e,"cacheValue"),i&&this.rmIdCtx(e,r,"field"),o&&this.rmIdCtx(e,o,"name"),i&&!O(this.fieldCtx,r)&&I(this.form,r),this.deferSyncValue(function(){t.reloading||(!1!==e.parser.loadChildren&&w.trueArray(e.rule.children)&&e.rule.children.forEach(function(e){return e.__fc__&&t.rmCtx(e.__fc__)}),e.root===t.rules&&t.vm._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("removeField",r,e.rule,this.api),e.rule.__ctrl||this.vm.$emit("removeRule",e.rule,this.api),e}}})}(He),function(e){D(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){this.vm.$emit(e,this.api),this.emitEvent(e,this.api)},emitEvent:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var o=this.options[e]||this.options[je("on-"+e)];if(o){var a=ie(o);w.Function(a)&&de(function(){return a.apply(void 0,r)})}(t=this.bus).$emit.apply(t,[e].concat(r))}})}(He),function(e){D(e.prototype,{useProvider:function(){var e=this,t=this.fc.providers;Object.keys(t).forEach(function(n){var r=t[n];w.Function(r)&&(r=r(e.fc)),r._c=function(e){var t=e.components;if(Array.isArray(t)){var n=function(e){return e.filter(function(e,t,n){return n.indexOf(e,0)===t})}(t.filter(function(e){return"*"!==e}));return!!n.length&&n}return!!w.String(t)&&[t]}(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,v(n))}))}),e._used=n},watchEffect:function(e){var t=this,n=this.vm,r={required:function(){var t,n;return(O(e.rule,"$required")?e.rule.$required:null===(t=e.rule)||void 0===t?void 0:null===(n=t.effect)||void 0===n?void 0:n.required)||!1}};Object.keys(e.rule.effect||{}).forEach(function(t){r[t]=function(){return e.rule.effect[t]}}),Object.keys(e.rule).forEach(function(t){"$"===t[0]&&(r[t.substr(1)]=function(){return e.rule[t]})}),Object.keys(r||{}).forEach(function(i){e.watch.push(n.$watch(r[i],function(n){t.effect(e,"watch",s({},i,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 O(e,"$"+t)?e["$"+t]:O(e,"effect")&&O(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,c=e.custom;if(u&&"fcFragment"!==u){var s=c||Object.keys(o).reduce(function(e,t){return"$"===t[0]&&(e[t.substr(1)]=o[t]),e},f({},o.effect||{}));Object.keys(s).forEach(function(e){var c=r.providers[e];if(c&&(!c.input||a)){var l;if(c._c){if(!(c._used.indexOf(u)>-1))return;l=u}else l="*";var p=f({value:s[e],getValue:function(){return r.getEffect(o,e)}},n||{});i&&(p.getProp=function(){return i.effectData(e)},p.clearProp=function(){return i.clearEffectData(e)},p.mergeProp=function(e){return se(p.getProp(),[e])},p.id=i.id),r.bus.$emit("p:".concat(e,":").concat(l,":").concat(c.input?1:0),t,[p,o,r.api])}})}}})}(He);var Ue={name:"fcFragment",functional:!0,props:["vnode"],render:function(e,t){return t.props.vnode?t.props.vnode:t.children}};function Je(){var e={};function n(e){e&&this.setVm(e)}return D(n.prototype,{setVm:function(e){this.vm=e,this.$h=e.$createElement},make:function(e,n,r){return t.config.isReservedTag(e)&&n.nativeOn&&delete n.nativeOn,this.makeComponent(e,n,r)},makeComponent:function(e,t,n){var r,i=this.$h(e,(r=t,w.String(r)?{domProps:{innerHTML:r}}:r),n||[]);return i.context=this.vm,i},aliasMap:e}),D(n,{aliasMap:e,alias:function(t,n){e[t]=n},use:function(e){Object.keys(e).forEach(function(t){var r=Fe(t),i=Ee(t).toLocaleLowerCase(),o=e[t];[t,r,i].forEach(function(e){n.alias(t,o),n.prototype[e]=function(e,t){return this.make(o,e,t)}})})}}),n}function We(e){var t=function(e){!function(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&&d(e,t)}(n,Ke);var t=m(n);function n(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t.apply(this,arguments)}return n}();return Object.assign(t.prototype,e),t}function Ke(e){D(this,{$handle:e,vm:e.vm,options:{},ref:"fcForm",mergeOptionsRule:{normal:["form","row","info","submitBtn","resetBtn"]}}),this.updateKey(),this.init()}D(Ke.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=Ie()},init:function(){},update:function(){},beforeRender:function(){},form:function(){return this.vm.$refs[this.ref]},getSlot:function(e){return function t(n){if(n){var r=n.$scopedSlots[e];return r||t(n.$pfc)}}(this.vm)},mergeOptions:function(e,t){var n=this;return U(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 ze={name:"componentValidate",load:function(e,t,n){var r=e.getValue();r?e.getProp().validate=[{validator:function(){var i=pe(t);if(i){for(var o=arguments.length,a=new Array(o),u=0;u<o;u++)a[u]=arguments[u];return n.exec.apply(n,[i.id,!0===r?"formCreateValidate":r].concat(a,[{attr:e,rule:t,api:n}]))}}}]:(e.clearProp(),n.clearValidateState([t.field]))},watch:function(){ze.load.apply(ze,arguments)}},Ge={name:"required",load:function(e,t,n){var r=function(e){return w.Boolean(e)?{required:e}:w.String(e)?{message:e}:w.Undef(e)?{required:!1}:w.Function(e)?{validator:e}:w.Object(e)?e:{}}(e.getValue());if(!1===r.required)e.clearProp(),n.clearValidateState([t.field]);else{var i=f({required:!0,validator:function(e,t,n){w.empty(t)?n(i.message):n()}},r);if(!i.message){var o=t.title||"";i.message=(("object"===c(o)?o.title:o)||"")+"不能为空"}e.getProp().validate=[i]}n.sync(t)},watch:function(){Ge.load.apply(Ge,arguments)}};var Xe={fetch:function(e){function t(t,n,r){var i=t.value,o=function(e){void 0===e?(t.clearProp(),r.sync(n)):Ve(t.getProp(),i.to||"options",e)};if(w.Function(i)&&(i=i(n,r)),(i=function(e){return w.String(e)&&(e={action:e,to:"options"}),e}(i))&&i.action){(i=A(i)).to||(i.to="options");var a=i.onError,u=function(){if(!t.getValue())return t.clearProp(),r.sync(n),!0},c=f(f({headers:{}},i),{},{onSuccess:function(e,t){if(!u()){var a=function(e){return t?e:O(e,"data")?e.data:e};w.Function(i.parse)?a=i.parse:i.parse&&w.String(i.parse)&&(a=function(e){return i.parse.split(".").forEach(function(t){e&&(e=e[t])}),e}),o(a(e,n,r)),r.sync(n)}},onError:function(e){o(void 0),u()||(a||function(e){return X(e.message||"fetch fail "+i.action)})(e,n,r)}});e.$handle.beforeFetch(c,{rule:n,api:r}).then(function(){w.Function(i.action)?i.action(n,r).then(function(e){c.onSuccess(e,!0)}).catch(function(e){c.onError(e)}):de(function(){return e.create.fetch(c,{inject:t,rule:n,api:r})})})}else o(void 0)}return{name:"fetch",loaded:function(){t.apply(void 0,arguments)},watch:function(){t.apply(void 0,arguments)}}},loadData:function(e){var t={name:"loadData",_fn:[],created:function(t,n,r){this.deleted(t);var i=$(t.getValue()),o=[];i.forEach(function(i){if(i){var a=function o(){!1!==i.watch&&(e.bus.$off("p.loadData."+i.attr,o),e.bus.$once("p.loadData."+i.attr,o));var a=void 0;i.attr&&(a=e.loadData[i.attr]||i.default,!1!==i.copy&&(a=A(a))),Ve(t.getProp(),i.to||"options",a),r.sync(n)};o.push(function(){return e.bus.$off("p.loadData."+i.attr,a)}),a()}}),this._fn[t.id]=o},deleted:function(e){this._fn[e.id]&&(this._fn[e.id].forEach(function(e){e()}),delete this._fn[e.id]),e.clearProp()}};return t.watch=t.created,t},required:Ge,componentValidate:ze},Qe={name:"html",loadChildren:!1,render:function(e,t){return t.prop.domProps||(t.prop.domProps={}),t.prop.domProps.innerHTML=e,t.vNode.make(t.prop.props.tag||"div",t.prop)},renderChildren:function(e){return Array.isArray(e.rule.children)?e.rule.children.filter(function(e){return w.String(e)}).join(""):""}},Ze="undefined"!=typeof window&&window.Vue?window.Vue:t;function Ye(){return function(e,t){var n;return 2===arguments.length?t=(n=arguments[1])[e]:n=arguments[2],{id:t,prop:n}}.apply(void 0,["name"].concat(Array.prototype.slice.call(arguments)))}function et(e){return e&&e.el?w.Element(e.el)?e.el:document.querySelector(e.el):window.document.body}function tt(e,t){var n=new Ze({data:function(){return{rule:e,option:t||{}}},render:function(e){return e("FormCreate",{ref:"fc",props:this.$data})}});return n.$mount(),n}var nt=1,rt={};function it(e){var t,n,r,i,o=s({},Ue.name,Ue),a={},u={},c=f({},Xe),l=ke(),p={global:{}},d={},h=Je();function m(e){var t=rt[e];return Array.isArray(t)?t.map(function(e){return e.api()}):t?t.api():void 0}function y(){var e=Ye.apply(void 0,arguments);e.id&&e.prop&&(u[e.id]=e.prop)}function g(){var e=Ye.apply(void 0,arguments);e.id&&e.prop&&(c[e.id]=f(f({},e.prop),{},{name:e.id}))}function b(e){h.use(e)}function $(){var e=Ye.apply(void 0,arguments);if(!e.id||!e.prop)return Me;var t=je(e.id),n=e.prop,r=!0===n.merge?a[t]:void 0;a[t]=n,Object.setPrototypeOf(n,r||Me),l[t]=ve(t),n.maker&&D(l,n.maker)}function x(e,t){var n;if(w.String(e)){if(n=je(e),["form-create","formcreate"].indexOf(n)>-1)return S();if(void 0===t)return o[n]}else n=je(e.name),t=e;if(n&&t){var r=je(n);o[n]=t,o[r]=t,delete h.aliasMap[n],delete h.aliasMap[r],delete a[n],delete a[r],t.formCreateParser&&$(n,t.formCreateParser)}}function k(e){Object.keys(rt).forEach(function(t){(Array.isArray(rt[t])?rt[t]:[rt[t]]).forEach(function(t){t.bus.$emit("p.loadData."+e)})})}function _(e,t){d[e]=t,k(e)}function C(e,t){return O(d,e)?d[e]:t}function j(e){delete d[e],k(e)}function S(){return Ze.extend(N(V))}function E(){return Ze.extend(Ue)}function F(e,t){return w.Function(e.install)?e.install(R,t):w.Function(e)&&e(R,t),this}function R(e,t,n){var r=tt(e,t||{}),i=r.$refs.fc.formCreate;return i.$parent=n,et(i.options).appendChild(r.$el),i.api()}function I(t){var n=f({},e);return t?n.inherit={components:o,parsers:a,directives:u,providers:c,maker:l,loadData:d}:delete n.inherit,it(n)}function V(t){var n=t.$options.propsData.rule;D(this,{id:nt++,vm:t,create:R,manager:We(e.manager),parsers:a,providers:c,rules:Array.isArray(n)?n:[],name:t.$options.propsData.name||Ie(),inFor:t.$options.propsData.inFor,prop:{components:o,directives:u},setData:_,getData:C,loadData:d,CreateNode:h,bus:new Ze,unwatch:null,options:{},extendApi:e.extendApi||function(e){return e}}),this.init(),this.initOptions(),this.name&&(this.inFor?(rt[this.name]||(rt[this.name]=[]),rt[this.name].push(this)):rt[this.name]=this)}function P(t){D(t,{version:e.version,ui:e.ui,setData:_,getData:C,removeData:j,maker:l,component:x,directive:y,register:g,$vnode:E,parser:$,use:F,factory:I,componentAlias:b,copyRule:ue,copyRules:ce,fetch:we,$form:S,parseFn:ie,parseJson:oe,toJson:ne,getApi:m,init:function(e){var t=tt(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),n=t.$refs.fc.formCreate;return{mount:function(e){return e&&w.Element(e)&&(n.options.el=e),et(n.options).appendChild(t.$el),n.api()},remove:function(){t.$el.parentNode&&t.$el.parentNode.removeChild(t.$el)},destroy:function(){this.remove(),t.$destroy()},$f:n.api()}}})}if(t=e.attrs||{},n=t.key||[],r=t.array||[],i=t.normal||[],W.push.apply(W,v(n)),K.push.apply(K,v(r)),z.push.apply(z,v(i)),ge([].concat(v(n),v(r),v(i))),D(V.prototype,{init:function(){var e=this,t=this.vm,n=new He(this);this.$handle=n,t.$f=n.api,t.$emit("input",n.api),t.$on("hook:created",function(){e.isSub()&&(e.unwatch=t.$watch(function(){return t.$pfc.option},function(){e.initOptions(),t.$f.refresh()},{deep:!0}),e.initOptions()),e.created()}),t.$on("hook:mounted",function(){e.mounted()}),t.$on("hook:beforeDestroy",function(){if(t.destroyed=!0,e.unwatch&&e.unwatch(),n.reloadRule([]),e.name)if(e.inFor){var r=rt[e.name].indexOf(e);rt[e.name].splice(r,1),rt[e.name].length||delete rt[e.name]}else delete rt[e.name]}),t.$on("hook:updated",function(){n.bindNextTick(function(){return e.bus.$emit("next-tick",n.api)})})},isSub:function(){return this.vm.$pfc&&this.vm.extendOption},initOptions:function(){this.options={};var e=f({formData:{},submitBtn:{},resetBtn:{}},A(p));this.isSub()&&this.mergeOptions(this.options,this.vm.$pfc.$f.config||{},!0),e=this.mergeOptions(e,this.vm.$options.propsData.option),this.updateOptions(e)},mergeOptions:function(e,t,n){return t=A(t),n&&["page","onSubmit","mounted","reload","formData","el"].forEach(function(e){delete t[e]}),t.global&&(e.global=function(e,t){return e?(Object.keys(t||{}).forEach(function(n){t[n]&&(e[n]=se(e[n]||{},t[n]))}),e):t}(e.global,t.global),delete t.global),this.$handle.$manager.mergeOptions([t],e),e},updateOptions:function(e){this.mergeOptions(this.options,e),this.$handle.$manager.updateOptions(this.options)},created:function(){this.$handle.init(),this.vm.$emit("created",this.api())},api:function(){return this.$handle.api},render:function(){return this.$handle.render()},mounted:function(){this.$handle.mounted()}}),P(R),D(R,{create:R,install:function(e,t){if(p=f(f({},p),t||{}),!0!==e._installedFormCreate){e._installedFormCreate=!0,Ze=e;var n=function(e){return R(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},this)};P(n),e.prototype.$formCreate=n,e.component("FormCreate",S()),e.component("FcFragment",E())}}}),h.use({fragment:"fcFragment"}),$(Qe),e.install&&R.use(e),e.inherit){var T=e.inherit;T.components&&D(o,T.components),T.parsers&&D(a,T.parsers),T.directives&&D(u,T.directives),T.providers&&D(c,T.providers),T.maker&&D(l,T.maker),T.loadData&&D(d,T.loadData)}return R}var ot={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"},at={name:"datePicker",maker:["year","month","date","dates","week","datetime","datetimeRange","dateRange","monthRange"].reduce(function(e,t){return e[t]=ve("datePicker",{type:t.toLowerCase()}),e},{}),mergeProp:function(e){var t=e.prop.props;t.valueFormat||(t.valueFormat=ot[t.type]||ot.date)}},ut={name:"hidden",maker:s({},"hidden",function(e,t){return ve("hidden")("",e,t)}),render:function(){return[]}},ct=[at,ut,{name:"input",maker:function(){var e=["password","url","email","text","textarea"].reduce(function(e,t){return e[t]=ve("input",{type:t}),e},{});return e.idate=ve("input",{type:"date"}),e}(),mergeProp:function(e){var t=e.prop.props;t&&t.autosize&&t.autosize.minRows&&(t.rows=t.autosize.minRows||2)}},{name:"slider",maker:{sliderRange:ve("slider",{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:"timePicker",maker:{time:ve("timePicker",function(e){return e.props.isRange=!1}),timeRange:ve("timePicker",function(e){return e.props.isRange=!0})},mergeProp:function(e){var t=e.prop.props;t.valueFormat||(t.valueFormat="HH:mm:ss")}},{name:"FcRow",render:function(e,t){return t.vNode.col({props:{span:24}},[t.vNode.row(t.prop,e)])}},{name:"select",toFormValue:function(e,t){return t.prop.props.multiple&&!Array.isArray(e)?$(e):e}}],st={button:"elButton",icon:"i",slider:"elSlider",rate:"elRate",upload:"fcUpload",cascader:"elCascader",popover:"elPopover",tooltip:"elTooltip",colorPicker:"elColorPicker",timePicker:"elTimePicker",timeSelect:"elTimeSelect",datePicker:"elDatePicker",switch:"elSwitch",select:"fcSelect",checkbox:"fcCheckbox",radio:"fcRadio",inputNumber:"elInputNumber",number:"elInputNumber",input:"elInput",formItem:"elFormItem",form:"elForm",frame:"fcFrame",col:"elCol",row:"elRow",tree:"fcTree",autoComplete:"elAutocomplete",auto:"elAutocomplete",group:"fcGroup",object:"fcSubForm",subForm:"fcSubForm"};var lt=/[A-Z]/;function ft(e,t){var n;O(e,t)&&(w.String(e[t])&&(e[t]=(s(n={},t,e[t]),s(n,"show",!0),n)))}function pt(e){return!1===e}var dt={validate:function(){var e=this.form();return e?e.validate():new Promise(function(e){return e()})},validateField:function(e){var t=this.form();return t?new Promise(function(n,r){t.validateField(e,function(e){e?r(e):n(null)})}):new Promise(function(e){return e()})},clearValidateState:function(e){var t=this.vm.$refs[e.wrapRef];t&&(t.validateMessage="",t.validateState="")},tidyOptions:function(e){return["submitBtn","resetBtn","row","info","wrap","col","title"].forEach(function(t){!function(e,t){O(e,t)&&!w.Object(e[t])&&(e[t]={show:!!e[t]})}(e,t)}),e},tidyRule:function(e){var t=e.prop;return ft(t,"title"),ft(t,"info"),t},mergeProp:function(e){var t=e.prop.props;e.prop=U([{attrs:Object.keys(t).reduce(function(e,n){var r,i;return r=n,i=t[n],lt.test(r)||!w.String(i)&&!w.Number(i)||(e[n]=t[n]),e},{}),info:this.options.info||{},wrap:this.options.wrap||{},col:this.options.col||{},title:this.options.title||{}},e.prop],{info:{trigger:"hover",placement:"top-start",icon:"el-icon-warning"},title:{},col:{span:24},wrap:{}},{normal:["title","info","col","wrap"]})},getDefaultOptions:function(){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,icon:"el-icon-refresh",innerText:"重置",show:!1,col:void 0,click:void 0}}},update:function(){var e=this.options.form;this.rule={props:f({},e),nativeOn:{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;D(this.rule,{key:e,ref:t}),D(this.rule.props,{model:n.formData})},render:function(e){return e.length&&e.push(this.makeFormBtn()),this.$r(this.rule,pt(this.options.row.show)?e:[this.makeRow(e)])},makeWrap:function(e,t){var n=e.prop,r="".concat(this.key).concat(e.key),i=n.col,o=this.isTitle(n),a=i.labelWidth||o?i.labelWidth:0,u=this.rule.props,c=u.inline,s=u.col,l=pt(n.wrap.show)?t:this.$r(U([n.wrap,{props:f(f({labelWidth:void 0===a?a:Ee(a),label:o?n.title.title:void 0},n.wrap||{}),{},{prop:e.id,rules:e.injectValidate()}),class:n.className,key:"".concat(r,"fi"),ref:e.wrapRef,type:"formItem"}]),[t,o?this.makeInfo(n,r,e):null]);return!0===c||pt(s)||pt(i.show)?l:this.makeCol(n,r,[l])},isTitle:function(e){if(!1===this.options.form.title)return!1;var t=e.title;return!(!t.title&&!t.native||pt(t.show))},makeInfo:function(e,t,n){var r=e.title,i=e.info,o="tooltip"===i.type,a=this.options.form,u=this.getSlot("title"),c=[u?u({title:r.title||"",rule:n.rule,options:this.options}):(r.title||"")+(a.labelSuffix||a["label-suffix"]||"")];if(!pt(i.show)&&(i.info||i.native)&&!pt(i.icon)){var s={type:i.type||"popover",props:f({},i),key:"".concat(t,"pop"),slot:"label"};i.info&&!O(s.props,"content")&&(s.props.content=i.info),c["left"!==i.align?"unshift":"push"](this.$r(U([i,s]),[this.$r({type:"i",slot:o?"default":"reference",class:!0===i.icon?"el-icon-warning":i.icon,key:"".concat(t,"i")})]))}return this.$r(U([r,{props:r,slot:r.slot||"label",key:"".concat(t,"tit"),type:r.type||"span"}]),c)},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(pt(this.options.submitBtn.show)||e.push(this.makeSubmitBtn()),pt(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=this.options.resetBtn;return this.$r({type:"button",props:t,style:{width:t.width},on:{click:function(){var n=e.$handle.api;t.click?t.click(n):n.resetFields()}},key:"".concat(this.key,"b2")},[t.innerText])},makeSubmitBtn:function(){var e=this,t=this.options.submitBtn;return this.$r({type:"button",props:t,style:{width:t.width},on:{click:function(){var n=e.$handle.api;t.click?t.click(n):n.submit()}},key:"".concat(this.key,"b1")},[t.innerText])}},ht={};!function(e){["group","tree","switch","upload","autoComplete","checkbox","cascader","colorPicker","datePicker","frame","inputNumber","radio","rate"].forEach(function(t){e[t]=ve(t)}),e.auto=e.autoComplete,e.number=e.inputNumber,e.color=e.colorPicker}(ht),function(e){e.selectMultiple=ve("select",s({},"multiple",!0)),e.selectOne=ve("select",s({},"multiple",!1))}(ht),function(e){var t={treeSelected:"selected",treeChecked:"checked"};Object.keys(t).reduce(function(e,n){return e[n]=ve("tree",{type:t[n]}),e},e)}(ht),function(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]=ve("upload",function(e){return e.props({uploadType:t[n][0],maxLength:t[n][1]})}),e},e),e.uploadImage=e.image,e.uploadFile=e.file}(ht),function(e){var t={frameInputs:["input",0],frameFiles:["file",0],frameImages:["image",0],frameInputOne:["input",1],frameFileOne:["file",1],frameImageOne:["image",1]};Object.keys(t).reduce(function(e,n){return e[n]=ve("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}(ht);function mt(e,t){return w.Boolean(e)?e={show:e}:w.Undef(e)||w.Object(e)||(e={show:t}),e}function vt(e,t){return D(e,{formEl:function(){return t.$manager.form()},wrapEl:function(e){var n=t.getFieldCtx(e);if(n)return t.vm.$refs[n.wrapRef]},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(r){i(r),n&&n(!1,r),t.vm.$emit("validate-fail",r,{api:e})})})},validateField:function(n,r){return new Promise(function(i,o){var a=t.getFieldCtx(n);if(a){var u=t.subForm[a.id],c=[t.$manager.validateField(a.id)];$(u).forEach(function(e){c.push(e.validate().catch(function(){return Promise.reject("子表单验证未通过")}))}),Promise.all(c).then(function(){i(null),r&&r(null)}).catch(function(i){o(i),r&&r(i),t.vm.$emit("validate-field-fail",i,{field:n,api: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=mt(t.options.submitBtn,!0);D(r,n),t.options.submitBtn=r,e.refreshOptions()},resetBtnProps:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=mt(t.options.resetBtn,!1);D(r,n),t.options.resetBtn=r,e.refreshOptions()},submit:function(n,r){var i=arguments,o=this;e.validate(function(a){if(a){var u=e.formData();w.Function(n)?de(function(){return n(u,o)}):(w.Function(t.options.onSubmit)&&de(function(){return t.options.onSubmit(u,o)}),t.vm.$emit("submit",u,o))}else w.Function(r)&&de(function(){return r.apply(void 0,[o].concat(v(i)))})})}}),e}function yt(e){e.componentAlias(st),T.forEach(function(t){e.component(t.name,t)}),ct.forEach(function(t){e.parser(t)}),Object.keys(ht).forEach(function(t){e.maker[t]=ht[t]})}x(".form-create .form-create .el-form-item {\n margin-bottom: 22px;\n}\n\n.form-create .form-create .el-form-item .el-form-item {\n margin-bottom: 0px;\n}\n");var gt=it({ui:"".concat("element-ui"),version:"".concat("2.5.37"),manager:dt,extendApi:vt,install:yt,attrs:{normal:["col","wrap"],array:["className"],key:["title","info"]}});"undefined"!=typeof window&&(window.formCreate=gt,window.Vue&&gt.install(window.Vue));var bt=gt.maker;e.default=gt,e.maker=bt,Object.defineProperty(e,"__esModule",{value:!0})});
8
- //# sourceMappingURL=form-create.min.js.map
9
+ (function(){"use strict";try{if(typeof document!="undefined"){var o=document.createElement("style");o.appendChild(document.createTextNode('._fc-frame .fc-files img{width:100%;height:100%;display:inline-block;vertical-align:top}._fc-frame .fc-upload-btn{border:1px dashed #c0ccda;cursor:pointer}._fc-frame .fc-upload-cover{opacity:0;position:absolute;inset:0;background:#0009;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}._fc-frame .fc-upload-cover i{color:#fff;font-size:20px;cursor:pointer;margin:0 2px}._fc-frame .fc-files:hover .fc-upload-cover{opacity:1}._fc-frame .el-upload{display:block}._fc-frame .fc-upload-btn,.fc-files{display:inline-block;width:58px;height:58px;text-align:center;line-height:58px;border:1px solid #c0ccda;border-radius:4px;overflow:hidden;background:#fff;position:relative;-webkit-box-shadow:2px 2px 5px rgba(0,0,0,.1);box-shadow:2px 2px 5px #0000001a;margin-right:4px;-webkit-box-sizing:border-box;box-sizing:border-box}._fc-upload .fc-files img{width:100%;height:100%;display:inline-block;vertical-align:top}._fc-upload .fc-upload-btn{border:1px dashed #c0ccda;cursor:pointer}._fc-upload .fc-upload-cover{opacity:0;position:absolute;inset:0;background:#0009;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}._fc-upload .fc-upload-cover i{color:#fff;font-size:20px;cursor:pointer;margin:0 2px}._fc-upload .fc-files:hover .fc-upload-cover{opacity:1}._fc-upload .el-upload{display:block}._fc-upload .fc-upload-btn,._fc-upload .fc-files{display:inline-block;width:58px;height:58px;text-align:center;line-height:58px;border:1px solid #c0ccda;border-radius:4px;overflow:hidden;background:#fff;position:relative;-webkit-box-shadow:2px 2px 5px rgba(0,0,0,.1);box-shadow:2px 2px 5px #0000001a;margin-right:4px;-webkit-box-sizing:border-box;box-sizing:border-box}._fc-group{display:flex;min-height:42px;justify-content:center;flex-direction:column}._fc-group-disabled ._fc-group-btn,._fc-group-disabled ._fc-group-add{cursor:not-allowed}._fc-group-handle{display:flex;flex-direction:row;position:absolute;bottom:-15px;right:30px;border-radius:15px;border:1px dashed #d9d9d9;padding:3px 8px;background-color:#fff}._fc-group-btn{cursor:pointer}._fc-group-idx{position:absolute;bottom:-15px;left:10px;width:30px;height:30px;display:flex;align-items:center;justify-content:center;background:#eee;border-radius:15px;font-weight:700}._fc-group-handle ._fc-group-btn+._fc-group-btn{margin-left:7px}._fc-group-container{position:relative;display:flex;flex-direction:column;border:1px dashed #d9d9d9;padding:20px 20px 25px;margin:5px 5px 25px;border-radius:5px}._fc-group-arrow{position:relative;width:20px;height:20px}._fc-group-arrow:before{content:"";position:absolute;top:8px;left:5px;width:9px;height:9px;border-left:2px solid #999;border-top:2px solid #999}._fc-group-arrow:before{transform:rotate(45deg)}._fc-group-arrow._fc-group-down{transform:rotate(180deg)}._fc-group-plus-minus{width:20px;height:20px;position:relative;cursor:pointer}._fc-group-plus-minus:before,._fc-group-plus-minus:after{content:"";position:absolute;top:50%;left:50%;width:60%;height:2px;background-color:#409eff;transform:translate(-50%,-50%)}._fc-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-group-plus-minus._fc-group-minus:before{display:none}._fc-group-plus-minus._fc-group-minus:after{background-color:#f56c6c}._fc-group-add{cursor:pointer;width:25px;height:25px;border:1px solid rgb(64 158 255 / 50%);border-radius:15px}._fc-group-add._fc-group-plus-minus:before,._fc-group-add._fc-group-plus-minus:after{width:50%}.form-create .form-create .el-form-item{margin-bottom:22px}.form-create .form-create .el-form-item .el-form-item{margin-bottom:0}')),document.head.appendChild(o)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
10
+ (function(F,d){typeof exports=="object"&&typeof module!="undefined"?d(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],d):(F=typeof globalThis!="undefined"?globalThis:F||self,d(F.formCreate={},F.Vue))})(this,function(F,d){"use strict";var Hr=Object.defineProperty,xr=Object.defineProperties;var Jr=Object.getOwnPropertyDescriptors;var ct=Object.getOwnPropertySymbols;var Kr=Object.prototype.hasOwnProperty,Wr=Object.prototype.propertyIsEnumerable;var dt=(F,d,I)=>d in F?Hr(F,d,{enumerable:!0,configurable:!0,writable:!0,value:I}):F[d]=I,y=(F,d)=>{for(var I in d||(d={}))Kr.call(d,I)&&dt(F,I,d[I]);if(ct)for(var I of ct(d))Wr.call(d,I)&&dt(F,I,d[I]);return F},K=(F,d)=>xr(F,Jr(d));function I(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function ne(){return ne=Object.assign?Object.assign.bind():function(t){for(var e,r=1;r<arguments.length;r++)for(var i in e=arguments[r],e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},ne.apply(this,arguments)}var pt=["attrs","props","domProps"],mt=["class","style","directives"],yt=["on","nativeOn"],gt=function(t){return t.reduce(function(e,r){for(var i in r)if(!e[i])e[i]=r[i];else if(pt.indexOf(i)!==-1)e[i]=ne({},e[i],r[i]);else if(mt.indexOf(i)!==-1){var s=e[i]instanceof Array?e[i]:[e[i]],n=r[i]instanceof Array?r[i]:[r[i]];e[i]=[].concat(s,n)}else if(yt.indexOf(i)!==-1)for(var o in r[i])if(e[i][o]){var a=e[i][o]instanceof Array?e[i][o]:[e[i][o]],u=r[i][o]instanceof Array?r[i][o]:[r[i][o]];e[i][o]=[].concat(a,u)}else e[i][o]=r[i][o];else if(i==="hook")for(var l in r[i])e[i][l]=e[i][l]?$t(e[i][l],r[i][l]):r[i][l];else e[i]=r[i];return e},{})},$t=function(t,e){return function(){t&&t.apply(this,arguments),e&&e.apply(this,arguments)}},vt=gt;const E=I(vt);function Q(t,e){return Object.keys(t).reduce((r,i)=>((!e||e.indexOf(i)===-1)&&r.push(t[i]),r),[])}const bt={name:"fcCheckbox",props:{formCreateInject:{type:Object,required:!0},value:{type:Array,default:()=>[]},type:String},watch:{"formCreateInject.options":{handler(){this.update()},deep:!0},value(){this.update()}},data(){return{trueValue:[]}},methods:{options(){const t=this.formCreateInject.options;return Array.isArray(t)?t:[]},onInput(t){this.$emit("input",this.options().filter(e=>t.indexOf(e.label)!==-1).map(e=>e.value).filter(e=>e!==void 0))},update(){const t=Array.isArray(this.value)?this.value:[this.value];this.trueValue=this.options().filter(e=>t.indexOf(e.value)!==-1).map(e=>e.label)}},created(){this.update()},render(){return d.h("ElCheckboxGroup",E([{},this.formCreateInject.prop,{},{props:{value:this.trueValue}},{ref:"el",on:{input:this.onInput}}]),[this.options().map((t,e)=>{const r=y({},t),i=this.type==="button"?"ElCheckboxButton":"ElCheckbox";return delete r.value,d.h(i,E([{},{props:r},{key:i+e+"-"+t.value}]))}),Q(this.$slots)])},mounted(){this.$emit("fc.el",this.$refs.el)}};function P(t){return Array.isArray(t)?t:[null,void 0,""].indexOf(t)>-1?[]:[t]}const Ct={name:"fcFrame",props:{formCreateInject:{type:Object,required:!0},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:"el-icon-upload2"},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:()=>{}},onOk:{type:Function,default:()=>{}},onCancel:{type:Function,default:()=>{}},onLoad:{type:Function,default:()=>{}},onBeforeRemove:{type:Function,default:()=>{}},onRemove:{type:Function,default:()=>{}},onHandle:{type:Function,default(t){this.previewImage=this.getSrc(t),this.previewVisible=!0}},modal:{type:Object,default:()=>({})},srcKey:{type:[String,Number]},value:[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}},data(){return{fileList:P(this.value),previewVisible:!1,frameVisible:!1,previewImage:""}},watch:{value(t){this.fileList=P(t)},fileList(t){const e=this.maxLength===1?t[0]||"":t;this.$emit("input",e),this.$emit("change",e)},src(t){this.modalVm&&(this.modalVm.src=t)}},methods:{key(t){return t},closeModel(t){this.$emit(t?"$close":"$ok"),this.reload&&(this.$off("$ok"),this.$off("$close")),this.frameVisible=!1},handleCancel(){this.previewVisible=!1},showModel(){this.disabled||this.onOpen()===!1||(this.frameVisible=!0)},makeInput(){const t={type:"text",value:this.fileList.map(e=>this.getSrc(e)).toString(),readonly:!0};return d.h("ElInput",E([{},{props:t},{key:this.key("input")}]),[this.fileList.length?d.h("i",{slot:"suffix",class:"el-input__icon el-icon-circle-close",on:{click:()=>this.fileList=[]}}):null,d.h("ElButton",E([{attrs:{icon:this.icon}},{on:{click:()=>this.showModel()}},{slot:"append"}]))])},makeGroup(t){return(!this.maxLength||this.fileList.length<this.maxLength)&&t.push(this.makeBtn()),d.h("div",{key:this.key("group")},[...t])},makeItem(t,e){return d.h("div",{class:"fc-files",key:this.key("file"+t)},[...e])},valid(t){const e=this.formCreateInject.field||this.field;if(e&&t!==e)throw new Error("[frame]无效的字段值")},makeIcons(t,e){if(this.handleIcon!==!1||this.allowRemove===!0){const r=[];return(this.type!=="file"&&this.handleIcon!==!1||this.type==="file"&&this.handleIcon)&&r.push(this.makeHandleIcon(t,e)),this.allowRemove&&r.push(this.makeRemoveIcon(t,e)),d.h("div",{class:"fc-upload-cover",key:this.key("uc")},[r])}},makeHandleIcon(t,e){return d.h("i",{class:this.handleIcon===!0||this.handleIcon===void 0?"el-icon-view":this.handleIcon,on:{click:()=>this.handleClick(t)},key:this.key("hi"+e)})},makeRemoveIcon(t,e){return d.h("i",{class:"el-icon-delete",on:{click:()=>this.handleRemove(t)},key:this.key("ri"+e)})},makeFiles(){return this.makeGroup(this.fileList.map((t,e)=>this.makeItem(e,[d.h("i",{class:"el-icon-tickets",on:{click:()=>this.handleClick(t)}}),this.makeIcons(t,e)])))},makeImages(){return this.makeGroup(this.fileList.map((t,e)=>this.makeItem(e,[d.h("img",{attrs:{src:this.getSrc(t)}}),this.makeIcons(t,e)])))},makeBtn(){return d.h("div",{class:"fc-upload-btn",on:{click:()=>this.showModel()},key:this.key("btn")},[d.h("i",{class:this.icon})])},handleClick(t){return this.onHandle(t)},handleRemove(t){this.disabled||this.onBeforeRemove(t)!==!1&&(this.fileList.splice(this.fileList.indexOf(t),1),this.onRemove(t))},getSrc(t){return this.srcKey?t[this.srcKey]:t},frameLoad(t){this.onLoad(t);try{this.helper===!0&&(t.form_create_helper={api:this.formCreateInject.api,close:e=>{this.valid(e),this.closeModel()},set:(e,r)=>{this.valid(e),this.disabled||this.$emit("input",r)},get:e=>(this.valid(e),this.value),onOk:e=>this.$on("$ok",e),onClose:e=>this.$on("$close",e)})}catch(e){console.log(e)}},makeFooter(){const{okBtnText:t,closeBtnText:e,closeBtn:r,okBtn:i,footer:s}=this.$props;if(s)return d.h("div",{slot:"footer"},[r?d.h("ElButton",{on:{click:()=>this.onCancel()!==!1&&(this.frameVisible=!1)}},[e]):null,i?d.h("ElButton",{attrs:{type:"primary"},on:{click:()=>this.onOk()!==!1&&this.closeModel()}},[t]):null])}},render(){const t=this.type;let e;t==="input"?e=this.makeInput():t==="image"?e=this.makeImages():e=this.makeFiles();const{width:r="30%",height:i,src:s,title:n,modalTitle:o}=this.$props;return this.$nextTick(()=>{this.$refs.frame&&this.frameLoad(this.$refs.frame.contentWindow||{})}),d.h("div",{class:"_fc-frame"},[e,d.h("el-dialog",E([{},{props:{appendToBody:!0,modal:this.previewMask,title:o,visible:this.previewVisible}},{on:{close:this.handleCancel}}]),[d.h("img",{style:"width: 100%",attrs:{src:this.previewImage}})]),d.h("el-dialog",E([{},{props:K(y({width:r,title:n,appendToBody:!0},this.modal),{visible:this.frameVisible})},{on:{close:()=>this.closeModel(!0)}}]),[this.frameVisible||!this.reload?d.h("iframe",{ref:"frame",attrs:{src:s,frameBorder:"0"},style:{height:i,border:"0 none",width:"100%"}}):null,this.makeFooter()])])},mounted(){this.$on("fc.closeModal",this.closeModal)}},_t={name:"fcRadio",props:{formCreateInject:{type:Object,required:!0},value:{},type:String},watch:{"formCreateInject.options":{handler(){this.update()},deep:!0},value(){this.update()}},data(){return{trueValue:[]}},methods:{options(){const t=this.formCreateInject.options;return Array.isArray(t)?t:[]},onInput(t){this.$emit("input",this.options().filter(e=>e.label===t).reduce((e,r)=>r.value,""))},update(){this.trueValue=this.options().filter(t=>t.value===this.value).reduce((t,e)=>e.label,"")}},created(){this.update()},render(){return d.h("ElRadioGroup",E([{},this.formCreateInject.prop,{ref:"el"},{props:{value:this.trueValue}},{on:{input:this.onInput}}]),[this.options().map((t,e)=>{const r=y({},t),i=this.type==="button"?"ElRadioButton":"ElRadio";return delete r.value,d.h(i,E([{},{props:r},{key:i+e+"-"+t.value}]))}),Q(this.$slots)])},mounted(){this.$emit("fc.el",this.$refs.el)}},c={type(t,e){return Object.prototype.toString.call(t)==="[object "+e+"]"},Undef(t){return t==null},Element(t){return typeof t=="object"&&t!==null&&t.nodeType===1&&!c.Object(t)},trueArray(t){return Array.isArray(t)&&t.length>0},Function(t){const e=this.getType(t);return e==="Function"||e==="AsyncFunction"},getType(t){const e=Object.prototype.toString.call(t);return/^\[object (.*)\]$/.exec(e)[1]},empty(t){return t==null||Array.isArray(t)&&Array.isArray(t)&&!t.length?!0:typeof t=="string"&&!t}};["Date","Object","String","Boolean","Array","Number"].forEach(t=>{c[t]=function(e){return c.type(e,t)}});function w(t,e){return{}.hasOwnProperty.call(t,e)}const kt={name:"fcSelect",functional:!0,props:{formCreateInject:{type:Object,required:!0}},render(t,e){const r=(n,o)=>{const a=n.slot;return t("ElOption",E([{},{props:n},{key:""+o+"-"+n.value}]),[a?t("template",{slot:n.slotName||"default"},[c.Function(a)?n.slot(t):a]):null])},i=(n,o)=>t("ElOptionGroup",{attrs:{label:n.label},key:""+o+"-"+n.label},[c.trueArray(n.options)&&n.options.map((a,u)=>r(a,u))]),s=e.props.formCreateInject.options;return t("ElSelect",E([{},e.data,{ref:"el"}]),[(Array.isArray(s)?s:[]).map((n,o)=>w(n||"","options")?i(n,o):r(n,o)),e.children])},mounted(){this.$emit("fc.el",this.$refs.el)}},Ot={name:"fcTree",formCreateParser:{mergeProp(t){const e=t.prop.props;e.nodeKey||(e.nodeKey="id"),e.props||(e.props={label:"title"})}},props:{formCreateInject:{type:Object,required:!0},type:{type:String,default:"checked"},value:{type:[Array,String,Number],default:()=>[]}},watch:{value(){this.setValue()}},methods:{onChange(){this.updateValue()},updateValue(){if(!this.$refs.tree)return;const t=this.type.toLocaleLowerCase();let e;t==="selected"?e=this.$refs.tree.getCurrentKey():e=this.$refs.tree.getCheckedKeys(),this.$emit("input",e)},setValue(){this.type.toLocaleLowerCase()==="selected"?this.$refs.tree.setCurrentKey(this.value):this.$refs.tree.setCheckedKeys(P(this.value))}},render(){return d.h("ElTree",E([{},this.formCreateInject.prop,{ref:"tree",on:{check:()=>this.updateValue(),"node-click":()=>this.updateValue()}}]),[Q(this.$slots)])},mounted(){this.setValue(),this.$emit("fc.el",this.$refs.tree)}};function _e(t,e){return{url:t,name:wt(t),uid:e}}function wt(t){return(""+t).split("/").pop()}const Ft={name:"fcUpload",props:{formCreateInject:{type:Object,required:!0},onHandle:{type:Function,default(t){this.previewImage=t.url,this.previewVisible=!0}},uploadType:{type:String,default:"file"},limit:{type:Number,default:0},allowRemove:{type:Boolean,default:!0},previewMask:void 0,modalTitle:String,handleIcon:{type:[String,Boolean],default:()=>{}},value:[Array,String]},data(){return{uploadList:[],previewVisible:!1,previewImage:"",cacheFiles:[]}},created(){this.formCreateInject.prop.props.showFileList===void 0&&(this.formCreateInject.prop.props.showFileList=!1),this.formCreateInject.prop.props.fileList=P(this.value).map(_e)},watch:{value(t){this.$refs.upload.uploadFiles.every(e=>!e.status||e.status==="success")&&(this.$refs.upload.uploadFiles=P(t).map(_e),this.uploadList=this.$refs.upload.uploadFiles)},limit(t,e){(e===1||t===1)&&this.update()}},methods:{key(t){return t},isDisabled(){return this.formCreateInject.prop.props.disabled===!0},onRemove(t){this.isDisabled()||this.$refs.upload.handleRemove(t)},handleClick(t){this.onHandle(t)},makeItem(t,e){return this.uploadType==="image"?d.h("img",{attrs:{src:t.url},key:this.key("img"+e)}):d.h("i",{class:"el-icon-tickets",key:this.key("i"+e)})},makeRemoveIcon(t,e){return d.h("i",{class:"el-icon-delete",on:{click:()=>this.onRemove(t)},key:this.key("ri"+e)})},makeHandleIcon(t,e){return d.h("i",{class:this.handleIcon===!0||this.handleIcon===void 0?"el-icon-view":this.handleIcon,on:{click:()=>this.handleClick(t)},key:this.key("hi"+e)})},makeProgress(t,e){return d.h("ElProgress",E([{},{props:{percentage:t.percentage,type:"circle",width:52}},{style:"margin-top:2px;",key:this.key("pg"+e)}]))},makeIcons(t,e){const r=[];if(this.allowRemove||this.handleIcon!==!1)return(this.uploadType!=="file"&&this.handleIcon!==!1||this.uploadType==="file"&&this.handleIcon)&&r.push(this.makeHandleIcon(t,e)),this.allowRemove&&r.push(this.makeRemoveIcon(t,e)),d.h("div",{class:"fc-upload-cover"},[r])},makeFiles(){return this.uploadList.map((t,e)=>this.$scopedSlots.fileList?this.$scopedSlots.fileList({file:t,index:e,vm:this}):d.h("div",{key:this.key(e),class:"fc-files"},[t.percentage!==void 0&&t.status!=="success"?this.makeProgress(t,e):[this.makeItem(t,e),this.makeIcons(t,e)]]))},makeUpload(){const t=!this.limit||this.limit>this.uploadList.length;return d.h("ElUpload",E([{},this.formCreateInject.prop,{},{style:{display:"inline-block"},key:this.key("upload"),ref:"upload"}]),[t?d.h("template",{slot:"default"},[this.$slots.default||d.h("div",{class:"fc-upload-btn"},[d.h("i",{class:"el-icon-upload2"})])]):null,Q(this.$slots,["default"])])},update(){let t=this.$refs.upload.uploadFiles.map(e=>e.url).filter(e=>e!==void 0);(this.cacheFiles.length!==t.length||!t.length)&&(this.cacheFiles=[...t],this.$emit("input",this.limit===1?t[0]||"":t))},handleCancel(){this.previewVisible=!1}},render(){return this.$refs.upload&&(this.formCreateInject.prop.props.showFileList===void 0&&(this.formCreateInject.prop.props.showFileList=this.$refs.upload.showFileList),this.formCreateInject.prop.props.fileList=this.$refs.upload.fileList),d.h("div",{class:"_fc-upload"},[[this.formCreateInject.prop.props.showFileList?[]:this.makeFiles(),this.makeUpload()],d.h("el-dialog",E([{},{props:{appendToBody:!0,modal:this.previewMask,title:this.modalTitle,visible:this.previewVisible}},{on:{close:this.handleCancel}}]),[d.h("img",{attrs:{alt:"example",src:this.previewImage},style:"width: 100%"})])])},mounted(){this.uploadList=this.$refs.upload.uploadFiles,this.$watch(()=>this.$refs.upload.uploadFiles,()=>{this.update()},{deep:!0}),this.$emit("fc.el",this.$refs.upload)}};function S(t,e,r){d.set(t,e,r)}function q(t,e){d.delete(t,e)}function W(t,e={},r){let i=!1;for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s)){let n=e[s];if((i=Array.isArray(n))||c.Object(n)){let o=t[s]===void 0;if(i)i=!1,o&&S(t,s,[]);else if(n._clone&&r!==void 0)if(r)n=n.getRule(),o&&S(t,s,{});else{S(t,s,n._clone());continue}else o&&S(t,s,{});t[s]=W(t[s],n,r)}else S(t,s,n),c.Undef(n)||(c.Undef(n.__json)||(t[s].__json=n.__json),c.Undef(n.__origin)||(t[s].__origin=n.__origin))}return r!==void 0&&Array.isArray(t)?t.filter(s=>!s||!s.__ctrl):t}function U(t){return W({},{value:t}).value}const Et=Object.assign||function(t){for(let e,r=1;r<arguments.length;r++)for(let i in e=arguments[r],e)Object.prototype.hasOwnProperty.call(e,i)&&S(t,i,e[i]);return t};function m(){return Et.apply(this,arguments)}const St=[bt,Ct,_t,kt,Ot,Ft,{name:"fcGroup",props:{field:String,rule:[Array,Object],rules:Array,expand:Number,options:Object,formCreateInject:{type:Object,required:!0},button:{type:Boolean,default:!0},max:{type:Number,default:0},min:{type:Number,default:0},value:{type:Array,default:()=>[]},sortBtn:{type:Boolean,default:!0},defaultValue:Object,disabled:{type:Boolean,default:!1},syncDisabled:{type:Boolean,default:!0},onBeforeRemove:{type:Function,default:()=>{}},onBeforeAdd:{type:Function,default:()=>{}},parse:Function},data(){return{len:0,cacheRule:{},cacheValue:{},sort:[],type:void 0}},computed:{formRule(){return this.rules?this.rules:this.rule?Array.isArray(this.rule)?this.rule:[this.rule]:[]}},watch:{cacheRule:{handler(t){this.sort=Object.keys(t)},immediate:!0},formRule:{handler(t,e){Object.keys(this.cacheRule).forEach(r=>{const i=this.cacheRule[r];if(i.$f){const s=i.$f.formData();if(t===e)i.$f.deferSyncValue(()=>{W(i.rule,t),i.$f.setValue(s)},!0);else{const n=i.$f.formData();i.$f.once("reloading",()=>{i.$f.setValue(n)}),i.rule=U(t)}}})},deep:!0},expand(t){let e=t-this.value.length;e>0&&this.expandRule(e)},value(t,e){t=t||[];let r=this.sort,i=r.length,s=i-t.length;if(s<0){for(let n=s;n<0;n++)this.addRule(t.length+n);this.sort=Object.keys(this.cacheRule);for(let n=0;n<i;n++)this.setValue(r[n],t[n])}else{if(s>0){for(let n=0;n<s;n++)this.removeRule(r[i-n-1]);this.sort=Object.keys(this.cacheRule)}t.forEach((n,o)=>{this.setValue(r[o],t[o])})}}},methods:{_value(t){return t&&w(t,this.field)?t[this.field]:t},cache(t,e){this.cacheValue[t]=JSON.stringify(e)},input(t){this.$emit("input",t),this.$emit("change",t)},formData(t,e){const r=this.cacheRule,i=this.sort;if(i.filter(n=>r[n].$f).length!==i.length)return;const s=i.map(n=>{const o=t===n?e:y({},this.cacheRule[n].$f.form),a=this.field?o[this.field]||null:o;return this.cache(n,a),a});this.input(s)},setValue(t,e){const r=this.field,i=this.cacheRule[t].$f;r&&(e={[r]:this._value(e)}),this.cacheValue[t]!==JSON.stringify(r?e[r]:e)&&(this.cache(t,e),i&&i.coverValue(e||{}))},addRule(t,e){const r=this.formCreateInject.form.copyRules(this.formRule),i=this.options?y({},this.options):{submitBtn:!1,resetBtn:!1};if(this.defaultValue){i.formData||(i.formData={});const s=U(this.defaultValue);m(i.formData,this.field?{[this.field]:s}:s)}this.parse&&this.parse({rule:r,options:i,index:this.sort.length}),this.$set(this.cacheRule,++this.len,{rule:r,options:i}),e&&this.$nextTick(()=>this.$emit("add",r,Object.keys(this.cacheRule).length-1))},add$f(t,e,r){this.cacheRule[e].$f=r,this.$nextTick(()=>{this.$emit("itemMounted",r,Object.keys(this.cacheRule).indexOf(e))})},removeRule(t,e){const r=Object.keys(this.cacheRule).indexOf(t);this.$delete(this.cacheRule,t),this.$delete(this.cacheValue,t),e&&this.$nextTick(()=>this.$emit("remove",r))},add(t){this.disabled||this.onBeforeAdd(this.value)===!1||this.addRule(t,!0)},del(t,e){if(this.disabled||this.onBeforeRemove(this.value,t)===!1)return;this.removeRule(e,!0);const r=[...this.value];r.splice(t,1),this.input(r)},addIcon(t){return d.h("div",{class:"_fc-group-btn _fc-group-plus-minus",on:{click:this.add}})},delIcon(t,e){return d.h("div",{class:"_fc-group-btn _fc-group-plus-minus _fc-group-minus",on:{click:()=>this.del(t,e)}})},sortUpIcon(t){return d.h("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-up",on:{click:()=>this.changeSort(t,-1)}})},sortDownIcon(t){return d.h("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-down",on:{click:()=>this.changeSort(t,1)}})},changeSort(t,e){const r=this.sort[t];this.$set(this.sort,t,this.sort[t+e]),this.sort[t+e]=r,this.formData(0)},makeIcon(t,e,r){if(this.$scopedSlots.button)return this.$scopedSlots.button({total:t,index:e,vm:this,key:r,del:()=>this.del(e,r),add:this.add});const i=[];return(!this.max||t<this.max)&&t===e+1&&i.push(this.addIcon(r)),t>this.min&&i.push(this.delIcon(e,r)),this.sortBtn&&e&&i.push(this.sortUpIcon(e)),this.sortBtn&&e!==t-1&&i.push(this.sortDownIcon(e)),i},emitEvent(t,e,r,i){this.$emit(t,...e,this.cacheRule[i].$f,r)},expandRule(t){for(let e=0;e<t;e++)this.value.push(this.field?null:{})}},created(){this.type=this.formCreateInject.form.$form();const t=(this.expand||0)-this.value.length;t>0&&this.expandRule(t);for(let e=0;e<this.value.length;e++)this.addRule(e)},render(){const t=this.sort,e=this.button,r=this.type,i=this.disabled,s=t.length===0?this.$scopedSlots.default?this.$scopedSlots.default({vm:this,add:this.add}):d.h("div",{key:"a_def",class:"_fc-group-plus-minus _fc-group-add",on:{click:this.add}}):t.map((n,o)=>{const{rule:a,options:u}=this.cacheRule[n],l=e&&!i?this.makeIcon(t.length,o,n):[];return d.h("div",{class:"_fc-group-container",key:n},[d.h(r,E([{key:n},{on:{"update:value":h=>this.formData(n,h),"emit-event":(h,...g)=>this.emitEvent(h,g,o,n),input:h=>this.add$f(o,n,h)}},{},{props:{disabled:i,inFor:!0,value:this.field?{[this.field]:this._value(this.value[o])}:this.value[o],rule:a,option:u,extendOption:!0}}])),d.h("div",{class:"_fc-group-idx"},[o+1]),l.length?d.h("div",{class:"_fc-group-handle"},[l]):null])});return d.h("div",{key:"con",class:"_fc-group "+(i?"_fc-group-disabled":"")},[s])}},{name:"fcSubForm",props:{rule:Array,options:Object,formCreateInject:{type:Object,required:!0},value:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1},syncDisabled:{type:Boolean,default:!0}},data(){return{cacheRule:{},cacheValue:{},type:void 0}},watch:{value(t){this.setValue(t)}},methods:{formData(t){this.cacheValue=JSON.stringify(t),this.$emit("input",t),this.$emit("change",t)},setValue(t){const e=JSON.stringify(t);this.cacheValue!==e&&(this.cacheValue=e,this.cacheRule.$f.coverValue(t||{}))},addRule(){const t=this.options?this.options:{submitBtn:!1,resetBtn:!1};t.formData=y({},this.value||{}),this.cacheRule={rule:this.rule,options:t}},add$f(t){this.cacheRule.$f=t,this.$nextTick(()=>{this.$emit("itemMounted",t)})},emitEvent(t,...e){this.$emit(t,...e)}},created(){this.addRule(),this.type=this.formCreateInject.form.$form()},render(){const{rule:t,options:e}=this.cacheRule,r=this.type;return d.h(r,E([{},{on:{"update:value":this.formData,"emit-event":this.emitEvent,input:this.add$f}},{},{props:{rule:t,option:e,disabled:this.disabled,extendOption:!0}}]))}}],ke="FormCreate",se=(t,e)=>{if(!(!t||t===e)){if(t.formCreateInject)return t.formCreateInject;if(t.$parent)return se(t.$parent,e)}};function Rt(t){return{name:ke,componentName:ke,model:{prop:"api"},provide(){return{$pfc:this}},inject:{$pfc:{default:null}},props:{rule:{type:Array,required:!0},option:{type:Object,default:()=>({})},extendOption:Boolean,disabled:{type:Boolean,default:void 0},value:Object,api:Object,name:String,subForm:{type:Boolean,default:!0},inFor:Boolean},data(){return{formData:void 0,destroyed:!1,validate:{},$f:void 0,isShow:!0,unique:1,renderRule:[...this.rule||[]],ctxInject:{},updateValue:JSON.stringify(this.value||{}),isMore:!!this.inFor}},render(){return this.formCreate.render()},methods:{_refresh(){++this.unique},_renderRule(){this.renderRule=[...this.rule||[]]},_updateValue(e){this.destroyed||(this.updateValue=JSON.stringify(e),this.$emit("update:value",e))}},watch:{value:{handler(e){JSON.stringify(e||{})!==this.updateValue&&(this.$f.config.forceCoverValue?this.$f.coverValue(e||{}):this.$f.setValue(e||{}))},deep:!0},option:{handler(){this.formCreate.initOptions(),this.$f.refresh()},deep:!0},rule(e){e.length===this.renderRule.length&&e.every(r=>this.renderRule.indexOf(r)>-1)||(this.formCreate.$handle.reloadRule(e),this._renderRule())},disabled(){this.$f.refresh()}},beforeCreate(){this.formCreate=new t(this),Object.keys(this.formCreate.prop).forEach(e=>{m(this.$options[e],this.formCreate.prop[e])}),this.$emit("beforeCreate",this.formCreate.api())},created(){const e=this,r=this.formCreate.api(),i=()=>{if(e.$pfc){const n=se(e,e.$pfc);if(n){let o;e.isMore?(o=P(n.getSubForm()),o.push(r)):o=r,n.subForm(o)}}},s=()=>{const n=se(e,e.$pfc);if(n)if(e.isMore){const o=P(n.getSubForm()),a=o.indexOf(r);a>-1&&o.splice(a,1)}else n.subForm()};e.$on("hook:beforeDestroy",()=>{s()}),this.$watch(()=>this.subForm,n=>{n?i():s()},{immediate:!0})}}}const Oe=["attrs","props","domProps","scopedSlots"],we=["class","style","directives"],Fe=["on","nativeOn"],V=(t,e={},r={})=>{const i=[...Oe,...r.normal||[]],s=[...we,...r.array||[]],n=[...Fe,...r.functional||[]],o=r.props||[];return t.reduce((a,u)=>{for(const l in u)if(a[l])if(o.indexOf(l)>-1)a[l]=V([u[l]],a[l]);else if(i.indexOf(l)>-1)a[l]=y(y({},a[l]),u[l]);else if(s.indexOf(l)>-1){const h=a[l]instanceof Array?a[l]:[a[l]],g=u[l]instanceof Array?u[l]:[u[l]];a[l]=[...h,...g]}else if(n.indexOf(l)>-1)for(const h in u[l])if(a[l][h]){const g=a[l][h]instanceof Array?a[l][h]:[a[l][h]],b=u[l][h]instanceof Array?u[l][h]:[u[l][h]];a[l][h]=[...g,...b]}else a[l][h]=u[l][h];else if(l==="hook")for(let h in u[l])a[l][h]?a[l][h]=jt(a[l][h],u[l][h]):a[l][h]=u[l][h];else a[l]=u[l];else i.indexOf(l)>-1||n.indexOf(l)>-1||o.indexOf(l)>-1?a[l]=y({},u[l]):s.indexOf(l)>-1?a[l]=u[l]instanceof Array?[...u[l]]:typeof u[l]=="object"?y({},u[l]):u[l]:a[l]=u[l];return a},e)},jt=(t,e)=>function(){t&&t.apply(this,arguments),e&&e.apply(this,arguments)},Ee=["type","slot","emitPrefix","value","name","native","hidden","display","inject","options","emit","nativeEmit","link","prefix","suffix","update","sync","optionsTo","key","preview","component","cache"],oe=["validate","children","control"],ae=["effect","deep"];function At(){return[...Ee,...Oe,...we,...Fe,...oe,...ae]}function le(t,e,r){return`[form-create ${t}]: ${e}`}function It(t,e){console.warn(le("tip",t))}function ue(t,e){console.error(le("err",t))}function Pt(t){ue(t.toString()),console.error(t)}const he="[[FORM-CREATE-PREFIX-",fe="-FORM-CREATE-SUFFIX]]",Se="$FN:",Re="$FNX:",G="function";function je(t,e){return JSON.stringify(W(Array.isArray(t)?[]:{},t,!0),function(r,i){if(!(i&&i._isVue===!0)){if(typeof i!==G)return i;if(i.__json)return i.__json;if(i.__origin&&(i=i.__origin),!i.__emit)return he+i+fe}},e)}function Ae(t){return new Function("return "+t)()}function H(t,e){if(t&&c.String(t)&&t.length>4){let r=t.trim(),i=!1;try{if(r.indexOf(fe)>0&&r.indexOf(he)===0)r=r.replace(fe,"").replace(he,""),i=!0;else if(r.indexOf(Se)===0)r=r.replace(Se,""),i=!0;else{if(r.indexOf(Re)===0)return r=Ae("function($inject){"+r.replace(Re,"")+"}"),r.__json=t,r.__inject=!0,r;!e&&r.indexOf(G)===0&&r!==G&&(i=!0)}if(!i)return t;const s=Ae(r.indexOf(G)===-1&&r.indexOf("(")!==0?G+" "+r:r);return s.__json=t,s}catch(s){ue(`解析失败:${r}
11
+
12
+ err: ${s}`);return}}return t}function Tt(t,e){return JSON.parse(t,function(r,i){return c.Undef(i)||!i.indexOf?i:H(i,e)})}function Ie(t,e){return{value:t,enumerable:!1,configurable:!1,writable:!!e}}function ce(t){return Pe([t])[0]}function Pe(t,e){return W([],[...t],e||!1)}function x(t,e){return V(Array.isArray(e)?e:[e],t,{array:oe,normal:ae}),t}function Te(t){const e=c.Function(t.getRule)?t.getRule():t;return e.type||(e.type="input"),e}function Dt(t,e){return t?(Object.keys(e||{}).forEach(r=>{e[r]&&(t[r]=x(t[r]||{},e[r]))}),t):e}function De(t,e){Object.defineProperties(t,Object.keys(e).reduce((r,i)=>(r[i]={get(){return e[i]()}},r),{}))}function Z(t){return t.__fc__||(t.__origin__?t.__origin__.__fc__:null)}function A(t,e){try{e=t()}catch(r){Pt(r)}return e}const Be=(t,e)=>typeof t=="string"?String(e):typeof t=="number"?Number(e):e,X={"==":(t,e)=>JSON.stringify(t)===JSON.stringify(Be(t,e)),"!=":(t,e)=>!X["=="](t,e),">":(t,e)=>t>e,">=":(t,e)=>t>=e,"<":(t,e)=>t<e,"<=":(t,e)=>t<=e,on(t,e){return t&&t.indexOf&&t.indexOf(Be(t[0],e))>-1},notOn(t,e){return!X.on(t,e)},in(t,e){return e&&e.indexOf&&e.indexOf(t)>-1},notIn(t,e){return!X.in(t,e)},between(t,e){return t>e[0]&&t<e[1]},notBetween(t,e){return t<e[0]||t>e[1]},empty(t){return c.empty(t)},notEmpty(t){return!c.empty(t)},pattern(t,e){return new RegExp(e,"g").test(t)}};function Ve(){return{props:{},on:{},options:[],children:[],effect:{},hidden:!1,display:!0,value:void 0}}function R(t,e){return(r,i,s,n={})=>{const o=new de(t,r,i,s,n);return e&&(c.Function(e)?e(o):o.props(e)),o}}function de(t,e,r,i,s){this._data=m(Ve(),{type:t,title:e,field:r,value:i,props:s||{}}),this.event=this.on}m(de.prototype,{getRule(){return this._data},setProp(t,e){return S(this._data,t,e),this},_clone(){const t=new this.constructor;return t._data=ce(this._data),t}});function Me(t){t.forEach(e=>{de.prototype[e]=function(r){return x(this._data,{[e]:arguments.length<2?r:{[r]:arguments[1]}}),this}})}Me(At());const Ne=R("");function Bt(t,e,r){let i=Ne("",e);return i._data.type=t,i._data.title=r,i}function Le(t,e,r,i){let s=Ne("",r);return s._data.type="template",s._data.template=t,s._data.title=i,s._data.vm=e,s}function Vt(){return{create:Bt,createTmp:Le,template:Le,factory:R}}function Mt(t,e,r){const i=`fail to ${t} ${r.status}'`,s=new Error(i);return s.status=r.status,s.url=t,s}function qe(t){const e=t.responseText||t.response;if(!e)return e;try{return JSON.parse(e)}catch(r){return e}}function Ue(t){if(typeof XMLHttpRequest=="undefined")return;const e=new XMLHttpRequest,r=t.action;e.onerror=function(o){t.onError(o)},e.onload=function(){if(e.status<200||e.status>=300)return t.onError(Mt(r,t,e),qe(e));t.onSuccess(qe(e))},e.open(t.method||"get",r,!0);let i;t.data&&((t.dataType||"").toLowerCase()!=="json"?(i=new FormData,Object.keys(t.data).map(n=>{i.append(n,t.data[n])})):(i=JSON.stringify(t.data),e.setRequestHeader("content-type","application/json"))),t.withCredentials&&"withCredentials"in e&&(e.withCredentials=!0);const s=t.headers||{};Object.keys(s).forEach(n=>{s[n]!==null&&e.setRequestHeader(n,s[n])}),e.send(i)}function Nt(t){return new Promise((e,r)=>{Ue(K(y({},t),{onSuccess(i){let s=o=>o;const n=H(t.parse);c.Function(n)?s=n:n&&c.String(n)&&(s=o=>(n.split(".").forEach(a=>{o&&(o=o[a])}),o)),e(s(i))},onError(i){r(i)}}))})}function Y(t){return U(t)}function Lt(t){function e(n){return c.Undef(n)?n=t.fields():Array.isArray(n)||(n=[n]),n}function r(n,o,a){e(n).forEach(u=>{t.getCtxs(u).forEach(l=>{S(l.rule,o,a),t.$render.clearCache(l)})})}function i(){const n=t.subForm;return Object.keys(n).reduce((o,a)=>{const u=n[a];return u&&(Array.isArray(u)?o.push(...u):o.push(u)),o},[])}const s={get config(){return t.options},get options(){return t.options},get form(){return t.form},get rule(){return t.rules},get parent(){return t.vm.$pfc&&t.vm.$pfc.$f},get top(){return s.parent?s.parent.top:s},get children(){return i()},formData(n){return e(n).reduce((o,a)=>{const u=t.getFieldCtx(a);return u&&(o[u.field]=Y(u.rule.value)),o},t.options.appendValue!==!1?Y(t.appendData):{})},getValue(n){const o=t.getFieldCtx(n);if(o)return Y(o.rule.value)},coverValue(n){const o=y({},n||{});t.deferSyncValue(()=>{s.fields().forEach(a=>{const u=t.fieldCtx[a];if(u){const l=w(o,a);u.forEach(h=>{h.rule.value=l?o[a]:void 0}),delete o[a]}}),m(t.appendData,o)})},setValue(n){let o=n;arguments.length>=2&&(o={[n]:arguments[1]}),t.deferSyncValue(()=>{Object.keys(o).forEach(a=>{const u=t.fieldCtx[a];if(!u)return t.appendData[a]=o[a];u.forEach(l=>{l.rule.value=o[a]})})})},removeField(n){const o=t.getCtx(n);return t.deferSyncValue(()=>{t.getCtxs(n).forEach(a=>{a.rm()})},!0),o?o.origin:void 0},removeRule(n){const o=n&&Z(n);if(o)return o.rm(),o.origin},destroy:()=>{t.vm.$el.parentNode&&t.vm.$el.parentNode.removeChild(t.vm.$el),t.vm.$destroy()},fields:()=>t.fields(),append:(n,o,a)=>{let u=t.sort.length-1,l;const h=t.getCtx(o);h?a?(l=h.rule.children,u=h.rule.children.length-1):(u=h.root.indexOf(h.origin),l=h.root):l=t.rules,l.splice(u+1,0,n)},prepend:(n,o,a)=>{let u=0,l;const h=t.getCtx(o);h?a?l=h.rule.children:(u=h.root.indexOf(h.origin),l=h.root):l=t.rules,l.splice(u,0,n)},hidden(n,o){r(o,"hidden",!!n),t.refresh()},hiddenStatus(n){const o=t.getCtx(n);if(o)return!!o.rule.hidden},display(n,o){r(o,"display",!!n),t.refresh()},displayStatus(n){const o=t.getCtx(n);if(o)return!!o.rule.display},disabled(n,o){e(o).forEach(a=>{t.getCtxs(a).forEach(u=>{u.rule.props&&S(u.rule.props,"disabled",!!n)})}),t.refresh()},all(n){return Object.keys(t.ctxs).map(o=>{const a=t.ctxs[o];return n?a.origin:a.rule})},model(n){return t.fields().reduce((o,a)=>{const u=t.fieldCtx[a][0];return o[a]=n?u.origin:u.rule,o},{})},component(n){return Object.keys(t.nameCtx).reduce((o,a)=>{const u=t.nameCtx[a].map(l=>n?l.origin:l.rule);return o[a]=u.length===1?u[0]:u,o},{})},bind(){return s.form},reload:n=>{t.reloadRule(n)},updateOptions(n){t.fc.updateOptions(n),s.refresh()},onSubmit(n){s.updateOptions({onSubmit:n})},sync:n=>{if(Array.isArray(n)){n.forEach(a=>s.sync(a));return}let o=c.Object(n)?Z(n):t.getCtxs(n);o&&(o=Array.isArray(o)?o:[o],o.forEach(a=>{if(!a.deleted){const u=t.subForm[a.id];u&&(Array.isArray(u)?u.forEach(l=>{l.refresh()}):u&&u.refresh()),t.$render.clearCache(a)}}),t.refresh())},refresh:()=>{i().forEach(n=>{n.refresh()}),t.$render.clearCacheAll(),t.refresh()},refreshOptions(){t.$manager.updateOptions(t.options),s.refresh()},hideForm:n=>{S(t.vm,"isShow",!n)},changeStatus:()=>t.changeStatus,clearChangeStatus:()=>{t.changeStatus=!1},updateRule(n,o){t.getCtxs(n).forEach(a=>{m(a.rule,o)})},updateRules(n){Object.keys(n).forEach(o=>{s.updateRule(o,n[o])})},mergeRule:(n,o)=>{t.getCtxs(n).forEach(a=>{x(a.rule,o)})},mergeRules(n){Object.keys(n).forEach(o=>{s.mergeRule(o,n[o])})},getRule:(n,o)=>{const a=t.getCtx(n);if(a)return o?a.origin:a.rule},getRenderRule:n=>{const o=t.getCtx(n);if(o)return o.prop},getRefRule:n=>{const o=t.getCtxs(n);if(o&&o.length){const a=o.map(u=>u.rule);return a.length===1?a[0]:a}},setEffect(n,o,a){const u=t.getCtx(n);u&&o&&(o[0]==="$"&&(o=o.substr(1)),w(u.rule,"$"+o)&&S(u.rule,"$"+o,a),w(u.rule,"effect")||S(u.rule,"effect",{}),S(u.rule.effect,o,a))},clearEffectData(n,o){const a=t.getCtx(n);a&&(o&&o[0]==="$"&&(o=o.substr(1)),a.clearEffectData(o),s.sync(n))},updateValidate(n,o,a){a?s.mergeRule(n,{validate:o}):r(n,"validate",o)},updateValidates(n,o){Object.keys(n).forEach(a=>{s.updateValidate(a,n[a],o)})},refreshValidate(){t.vm.validate={},s.refresh()},resetFields(n){e(n).forEach(o=>{t.getCtxs(o).forEach(a=>{t.$render.clearCache(a),a.rule.value=Y(a.defaultValue)})})},method(n,o){const a=s.el(n);if(!a||!a[o])throw new Error(le("err",`${o}方法不存在`));return(...u)=>a[o](...u)},exec(n,o,...a){return A(()=>s.method(n,o)(...a))},toJson(n){return je(s.rule,n)},trigger(n,o,...a){const u=s.el(n);u&&u.$emit(o,...a)},el(n){const o=t.getCtx(n);if(o)return o.exportEl||o.el||t.vm.$refs[o.ref]},closeModal:n=>{const o=s.el(n);o&&o.$emit&&o.$emit("close-modal")},getSubForm(n){const o=t.getCtx(n);return o?t.subForm[o.id]:void 0},nextTick(n){t.bus.$once("next-tick",n),t.refresh()},nextRefresh(n){t.nextRefresh(),n&&A(n)},emit(n,...o){t.vm.$emit(n,...o)},deferSyncValue(n,o){t.deferSyncValue(n,o)},fetch(n){return new Promise((o,a)=>{t.beforeFetch(n).then(()=>Nt(n).then(o).catch(a))})},getData(n,o){return t.fc.getData(n,o)},setData(n,o){return t.fc.setData(n,o)},helper:{tidyFields:e,props:r}};return["on","once","off","set","emit"].forEach(n=>{s[n]=function(...o){t.vm[`$${n}`](...o)}}),s.changeValue=s.changeField=s.setValue,s}function qt(t){m(t.prototype,{initCache(){this.clearCacheAll()},clearCache(e){if(e.rule.cache)return;if(!this.cache[e.id]){e.parent&&this.clearCache(e.parent);return}(this.cache[e.id].use===!0||this.cache[e.id].parent)&&this.$handle.refresh();const r=this.cache[e.id].parent;this.cache[e.id]=null,r&&this.clearCache(r)},clearCacheAll(){this.cache={}},setCache(e,r,i){this.cache[e.id]={vnode:r,use:!1,parent:i,slot:e.rule.slot}},getCache(e){const r=this.cache[e.id];if(r)return r.use=!0,r.vnode}})}function T(t){const e=t.replace(/(-[a-z])/g,function(r){return r.replace("-","").toLocaleUpperCase()});return He(e)}function He(t){return t.replace(t[0],t[0].toLowerCase())}function xe(t){return t==null?"":typeof t=="object"?JSON.stringify(t,null,2):String(t)}function ee(t){let e=t.replace(/([A-Z])/g,"-$1").toLocaleLowerCase();return e.indexOf("-")===0&&(e=e.substr(1)),e}let Ut=0;function te(){const t=370+ ++Ut;return"F"+Math.random().toString(36).substr(3,3)+(+`${Date.now()}`).toString(36)+t.toString(36)+"c"}function re(t,e,r){let i=t,s;return(e||"").split(".").forEach(n=>{s&&((!i[s]||typeof i[s]!="object")&&(i[s]={}),i=i[s]),s=n}),i[s]=r,i}function Ht(t){m(t.prototype,{initRender(){this.tempList={},this.clearOrgChildren()},initOrgChildren(){const e=this.$handle.ctxs;this.orgChildren=Object.keys(e).reduce((r,i)=>{if(e[i].parser.loadChildren!==!1){const s=e[i].rule.children;r[i]=c.trueArray(s)?[...s]:[]}return r},{})},clearOrgChildren(){this.orgChildren={}},getTypeSlot(e){const r=i=>{if(i){let s;return e.rule.field&&(s=i.$scopedSlots["field-"+ee(e.rule.field)]||i.$scopedSlots["field-"+e.rule.field]),s||(s=i.$scopedSlots["type-"+ee(e.type)]||i.$scopedSlots["type-"+e.type]),s||r(i.$pfc)}};return r(this.vm)},render(){if(!this.vm.isShow)return;this.$h=this.vm.$createElement,this.$manager.beforeRender();let e;const r=()=>this.renderList();return r.renderSlot=i=>this.renderList(i),r.renderName=i=>this.renderId(i),r.renderField=i=>this.renderId(i,"field"),this.vm.$scopedSlots.container?e=[this.vm.$scopedSlots.container(r)]:e=r(),this.$manager.render(e)},renderList(e){return this.sort.map(r=>e?this.renderSlot(this.$handle.ctxs[r],e):this.renderCtx(this.$handle.ctxs[r])).filter(r=>r!==void 0)},makeVm(e){const r=e.vm;if(r){if(c.Function(r))return A(()=>e.vm(this.$handle.getInjectData(e)));if(!r._isVue)return new M(r)}else return new M;return r},mergeGlobal(e){const r=this.$handle.options.global;r&&(e.cacheConfig||(e.cacheConfig=r[e.originType]||r[e.type]||r[e.trueType]||{}),e.prop=x({},[r["*"],e.cacheConfig,e.prop]))},setOptions(e){e.prop.optionsTo&&e.prop.options&&re(e.prop,e.prop.optionsTo,e.prop.options)},deepSet(e){const r=e.rule.deep;r&&Object.keys(r).sort((i,s)=>i.length<s.length?-1:1).forEach(i=>{re(e.prop,i,r[i])})},setTempProps(e,r){if(!e.$props)return;const{prop:i}=r,s=Object.keys(e.$props),n=this.injectProp(r),o=Object.keys(n);s.forEach(u=>{w(i.props,u)?e.$props[u]=i.props[u]:o.indexOf(u)>-1&&(e.$props[u]=n[u])});const a=e.$options.model&&e.$options.model.prop||"value";s.indexOf(a)>-1&&(e.$props[a]=i.value)},renderTemp(e){if(!M.compile)return It("当前使用的Vue构建版本不支持compile,无法使用template功能"),[];const r=e.prop,{id:i,key:s}=e;if(!this.tempList[i]){e.el||(e.el=this.makeVm(r),this.vm.$nextTick(()=>e.parser.mounted(e)));let u=e.el;e.input&&u.$on(u.$options.model&&u.$options.model.event||"input",l=>{this.onInput(e,l)}),this.tempList[i]={vm:u,template:M.compile(r.template)}}const{vm:n,template:o}=this.tempList[i];this.setTempProps(n,e);const a=o.render.call(n);return c.Undef(a.data)&&(a.data={}),a.key=s,a.data.ref=e.ref,a.data.key=s,a},parseSide(e,r){return c.Object(e)?x({props:{formCreateInject:r.prop.props.formCreateInject}},e):e},renderSides(e,r,i){const s=r[i?"rule":"prop"];return[this.renderRule(this.parseSide(s.prefix,r)),e,this.renderRule(this.parseSide(s.suffix,r))]},renderSlot(e,r){return e.rule.slot===r?this.renderCtx(e):void 0},renderId(e,r){const i=this.$handle[r==="field"?"fieldCtx":"nameCtx"][e];return i?i.map(s=>this.renderCtx(s,s.parent)):void 0},renderCtx(e,r){if(e.type==="hidden")return;const i=e.rule;if(!this.cache[e.id]||this.cache[e.id].slot!==i.slot){let s,n=i.cache!==!1;const o=e.trueType,a=!(c.Undef(i.display)||i.display);if(o==="template"&&!i.template)s=this.renderSides(this.renderChildren(e),e,!0),a&&this.display(s),s=this.item(e,s);else if(o==="fcFragment")s=this.renderChildren(e);else{e.initProp(),this.mergeGlobal(e),this.$manager.tidyRule(e),this.deepSet(e),this.setOptions(e),this.ctxProp(e);let u=e.prop;u.preview=!!(w(u,"preview")?u.preview:this.options.preview),u.props.formCreateInject=this.injectProp(e);const l=u.preview;if(u.hidden){this.setCache(e,void 0,r);return}if(o==="template"&&u.template)s=this.renderTemp(e),n=!1;else{let h=[];e.parser.renderChildren?h=e.parser.renderChildren(e):e.parser.loadChildren!==!1&&(h=this.renderChildren(e));const g=this.getTypeSlot(e);g?s=g({rule:i,prop:u,preview:l,children:h,api:this.$handle.api,model:u.model||{}}):s=l?e.parser.preview(h,e):e.parser.render(h,e)}s=this.renderSides(s,e),!(!e.input&&c.Undef(u.native))&&u.native!==!0&&(s=this.$manager.makeWrap(e,s)),a&&(s=this.display(s)),s=this.item(e,s)}return n&&this.setCache(e,s,r),s}return this.getCache(e)},display(e){if(Array.isArray(e)){const r=[];return e.forEach(i=>{if(Array.isArray(i))return this.display(i);this.none(i)&&r.push(i)}),r}else return this.none(e)},none(e){if(e&&e.data)return Array.isArray(e.data.style)?e.data.style.push({display:"none"}):c.String(e.data.style)?e.data.style+=";display:none;":e.data.style=[e.data.style,{display:"none"}],e},item(e,r){return this.$h("fcFragment",{slot:e.rule.slot,key:e.key},[r])},injectProp(e){this.vm.ctxInject[e.id]||S(this.vm.ctxInject,e.id,{api:this.$handle.api,form:this.fc.create,subForm:i=>{this.$handle.addSubForm(e,i)},getSubForm:()=>this.$handle.subForm[e.id],options:[],children:[],prop:{},preview:!1,id:e.id,field:e.field,rule:e.rule,input:e.input});const r=this.vm.ctxInject[e.id];return m(r,{preview:e.prop.preview,options:e.prop.options,children:e.rule.children,prop:function(){const i=y({},e.prop);return i.on=i.on?y({},i.on):{},delete i.model,i}()}),r},ctxProp(e){const{ref:r,key:i,rule:s}=e;this.$manager.mergeProp(e),e.parser.mergeProp(e);const n=[{ref:r,key:s.key||`${i}fc`,slot:void 0,on:{"hook:mounted":()=>{this.onMounted(e)},"fc.sub-form":o=>{this.$handle.addSubForm(e,o)},"fc.el":o=>{e.exportEl=o,o&&((o.$el||o).__rule__=e.rule)}}}];return e.input&&(this.vm.$props.disabled===!0&&(e.prop.props.disabled=!0),e.prop.model={value:this.$handle.getFormData(e),callback:o=>{this.onInput(e,o)},expression:`formData.${e.id}`}),V(n,e.prop),e.prop},onMounted(e){e.el=this.vm.$refs[e.ref],e.el&&((e.el.$el||e.el).__rule__=e.rule),e.parser.mounted(e),this.$handle.effect(e,"mounted")},onInput(e,r){this.$handle.onInput(e,r)},renderChildren(e){const{children:r}=e.rule,i=this.orgChildren[e.id],s=n=>!c.String(n)&&n.__fc__&&!this.$handle.ctxs[n.__fc__.id];return!c.trueArray(r)&&i?(this.$handle.deferSyncValue(()=>{i.forEach(n=>{n&&s(n)&&this.$handle.rmCtx(n.__fc__)})}),this.orgChildren[e.id]=[],[]):(i&&this.$handle.deferSyncValue(()=>{i.forEach(n=>{n&&r.indexOf(n)===-1&&s(n)&&this.$handle.rmCtx(n.__fc__)})}),r.map(n=>{if(n){if(c.String(n))return n;if(n.__fc__)return this.renderCtx(n.__fc__,e);n.type&&this.vm.$nextTick(()=>{this.$handle.loadChildren(r,e),this.$handle.refresh()})}}))},defaultRender(e,r){const i=e.prop;return i.component?this.vNode.makeComponent(i.component,i,r):this.vNode[e.type]?this.vNode[e.type](i,r):this.vNode[e.originType]?this.vNode[e.originType](i,r):this.vNode.make(He(e.originType),i,r)},renderRule(e,r,i){if(!e)return;if(c.String(e))return e;let s;if(i)s=e.type;else if(s=e.is,e.type){s=T(e.type);const o=this.vNode.aliasMap[s];o&&(s=T(o))}if(!s)return;let n=[[r]];return c.trueArray(e.children)&&n.push(e.children.map(o=>this.renderRule(o))),this.$h(s,y({},e),n)}})}function pe(t){m(this,{$handle:t,fc:t.fc,vm:t.vm,$manager:t.$manager,vNode:new t.fc.CreateNode(t.vm)}),De(this,{options(){return t.options},sort(){return t.sort}}),this.initCache(),this.initRender()}qt(pe),Ht(pe);function xt(t){m(t.prototype,{parseInjectEvent(e,r){const i=e.inject||this.options.injectEvent;return this.parseEventLst(e,r,i)},parseEventLst(e,r,i,s){return Object.keys(r).forEach(n=>{const o=this.parseEvent(e,r[n],i,s);o&&(r[n]=o)}),r},parseEvent(e,r,i,s){if(c.Function(r)&&(i!==!1&&!c.Undef(i)||r.__inject))return this.inject(e,r,i);if(!s&&Array.isArray(r)&&r[0]&&(c.String(r[0])||c.Function(r[0])))return this.parseEventLst(e,r,i,!0);if(c.String(r)){const n=H(r);if(n&&r!==n)return n.__inject?this.parseEvent(e,n,i,!0):n}},parseEmit(e,r){let i={},s=e.rule,{emitPrefix:n,field:o,name:a,inject:u}=s,l=s[r?"emit":"nativeEmit"]||[];return c.trueArray(l)&&l.forEach(h=>{if(!h)return;let g,b=n||o||a;if(c.Object(h)&&(g=h.inject,h=h.name,b=h.prefix||b),b){r||(b=`native-${b}`);const k=ee(`${b}-${h}`),v=(...O)=>{this.vm.$emit(k,...O),this.vm.$emit("emit-event",k,...O)};if(v.__emit=!0,!g&&u===!1)i[h]=v;else{let O=g||u||this.options.injectEvent;i[h]=c.Undef(O)?v:this.inject(s,v,O)}}}),e.computed[r?"on":"nativeOn"]=i,i},getInjectData(e,r){const{option:i,rule:s}=this.vm.$options.propsData;return{api:this.api,$f:this.api,rule:s,self:e.__origin__,option:i,inject:r}},inject(e,r,i){if(r.__origin){if(this.watching&&!this.loading)return r;r=r.__origin}const s=this,n=function(...o){const a=s.getInjectData(e,i);return a.args=[...o],o.unshift(a),r.apply(this,o)};return n.__origin=r,n.__json=r.__json,n}})}const Je=["hook:updated","hook:mounted"];function Jt(t){m(t.prototype,{usePage(){const e=this.options.page;if(!e)return;let r=25,i=Kt(this.rules);c.Object(e)&&(e.first&&(r=parseInt(e.first,10)||r),e.limit&&(i=parseInt(e.limit,10)||i)),m(this,{first:r,limit:i,pageEnd:this.rules.length<=r}),this.bus.$on("page-end",()=>this.vm.$emit("page-end",this.api)),this.pageLoad()},pageLoad(){const e=()=>{this.pageEnd?(this.vm.$off(Je,e),this.bus.$emit("page-end")):(this.first+=this.limit,this.pageEnd=this.rules.length<=this.first,this.loadRule(),this.refresh())};this.vm.$on(Je,e)}})}function Kt(t){return t.length<31?31:Math.ceil(t.length/3)}function Wt(t){m(t.prototype,{clearNextTick(){this.nextTick&&clearTimeout(this.nextTick),this.nextTick=null},bindNextTick(e){this.clearNextTick(),this.nextTick=setTimeout(()=>{e(),this.nextTick=null},10)},render(){return++this.loadedId,this.vm.unique>0?this.$render.render():(this.vm.unique=1,[])}})}function Gt(t){Object.defineProperties(t.origin,{__fc__:Ie(t,!0)})}function Ke(t,e,r){const i=te();m(this,{id:i,ref:i,wrapRef:i+"fi",rule:e,origin:e.__origin__||e,name:e.name,watch:[],linkOn:[],root:[],ctrlRule:[],parent:null,cacheConfig:null,prop:y({},e),computed:{},payload:{},input:!!e.field,el:void 0,exportEl:void 0,defaultValue:e.field?U(r):void 0,field:e.field||void 0}),this.updateType(),this.updateKey(),Gt(this),this.update(t,!0)}m(Ke.prototype,{effectData(t){return this.payload[t]||(this.payload[t]={}),this.payload[t]},clearEffectData(t){t===void 0?this.payload={}:delete this.payload[t]},updateKey(t){this.key=te(),t&&this.parent&&this.parent.updateKey(t)},updateType(){this.originType=this.rule.type,this.type=T(this.rule.type)},setParser(t){this.parser=t,t.init(this)},initProp(){const t=y({},this.rule);delete t.children,this.prop=x({},[t,...Object.keys(this.payload).map(e=>this.payload[e]),this.computed])},injectValidate(){return P(this.prop.validate).map(t=>{if(c.Function(t.validator)){const e=y({},t),r=this;return e.validator=function(...i){return t.validator.call({that:this,id:r.id,field:r.field,rule:r.rule,api:r.$handle.api},...i)},e}return t})},check(t){return this.vm===t.vm},unwatch(){this.watch.forEach(t=>t()),this.watch=[]},unlink(){this.linkOn.forEach(t=>t()),this.linkOn=[]},link(){this.unlink(),this.$handle.appendLink(this)},watchTo(){this.$handle.watchCtx(this)},delete(){this.unwatch(),this.unlink(),this.rmCtrl(),m(this,{deleted:!0,prop:y({},this.rule),computed:{},el:void 0,$handle:void 0,$render:void 0,$api:void 0,vm:void 0,vNode:void 0,parent:null,cacheConfig:null})},rmCtrl(){this.ctrlRule.forEach(t=>t.__fc__&&t.__fc__.rm()),this.ctrlRule=[]},rm(){const t=()=>{let e=this.root.indexOf(this.origin);e>-1&&(this.root.splice(e,1),this.$handle&&this.$handle.refresh())};if(this.deleted){t();return}this.$handle.noWatch(()=>{this.$handle.deferSyncValue(()=>{this.rmCtrl(),t(),this.$handle.rmCtx(this),m(this,{root:[]})},this.input)})},update(t,e){m(this,{deleted:!1,$handle:t,$render:t.$render,$api:t.api,vm:t.vm,trueType:t.getType(this.originType),vNode:t.$render.vNode,updated:!1,cacheValue:this.rule.value}),!e&&this.unwatch(),this.watchTo(),this.link()}});function Xt(t){m(t.prototype,{nextRefresh(e){const r=this.loadedId;this.vm.$nextTick(()=>{r===this.loadedId&&(e?e():this.refresh())})},parseRule(e){const r=Te(e);return Object.defineProperties(r,{__origin__:Ie(e,!0)}),zt(r),this.appendValue(r),r.options=Array.isArray(r.options)?r.options:[],[r,r.prefix,r.suffix].forEach(i=>{i&&this.loadFn(i,r)}),this.loadCtrl(r),r.update&&(r.update=H(r.update)),r},loadFn(e,r){["on","props","nativeOn","deep"].forEach(i=>{e[i]&&this.parseInjectEvent(r,e[i])})},loadCtrl(e){e.control&&e.control.forEach(r=>{r.handle&&(r.handle=H(r.handle))})},syncProp(e){const r=e.rule;c.trueArray(r.sync)&&V([{on:r.sync.reduce((i,s)=>(i[`update:${s}`]=n=>{r.props[s]=n,this.vm.$emit("sync",s,n,r,this.fapi)},i),{})}],e.computed)},loadRule(){this.cycleLoad=!1,this.loading=!0,this.pageEnd&&this.bus.$emit("load-start"),this.deferSyncValue(()=>{if(this._loadRule(this.rules),this.loading=!1,this.cycleLoad&&this.pageEnd)return this.loadRule();this.pageEnd&&this.bus.$emit("load-end"),this.vm._renderRule(),this.$render.initOrgChildren(),this.syncForm()})},loadChildren(e,r){if(this.cycleLoad=!1,this.loading=!0,this.bus.$emit("load-start"),this._loadRule(e,r),this.loading=!1,this.cycleLoad)return this.loadRule();this.bus.$emit("load-end"),this.syncForm(),this.$render.clearCache(r)},_loadRule(e,r){const i=n=>{let o=e[n-1];if(!o||!o.__fc__)return n>0?i(n-1):-1;let a=this.sort.indexOf(o.__fc__.id);return a>-1?a:i(n-1)},s=(n,o)=>{c.trueArray(n)&&this._loadRule(n,o)};e.map((n,o)=>{if(r&&!c.Object(n)||!this.pageEnd&&!r&&o>=this.first)return;if(n.__fc__&&n.__fc__.root===e&&this.ctxs[n.__fc__.id])return s(n.__fc__.rule.children,n.__fc__),n.__fc__;let a=Te(n);const u=()=>!!(a.field&&this.fieldCtx[a.field]&&this.fieldCtx[a.field][0]!==n.__fc__);this.ruleEffect(a,"init",{repeat:u()}),u()&&this.vm.$emit("repeat-field",n,this.api);let l,h=!1,g=!!n.__fc__,b=a.value;if(g){l=n.__fc__,b=l.defaultValue;const v=!l.check(this);if(l.deleted){if(v){if(We(l))return;l.update(this)}}else if(v){if(We(l))return;e[o]=n=n._clone?n._clone():ce(n),l=null,h=!0}}if(l)l.originType!==l.rule.type&&(l.updateType(),this.bindParser(l)),this.appendValue(l.rule);else{const v=this.parseRule(n);l=new Ke(this,v,b),this.bindParser(l)}if([!1,!0].forEach(v=>this.parseEmit(l,v)),this.syncProp(l),l.parent=r||null,l.root=e,this.setCtx(l),!h&&!g&&this.effect(l,"load"),this.effect(l,"created"),l.parser.loadChildren===!1||s(l.rule.children,l),!r){const v=i(o);v>-1||!o?this.sort.splice(v+1,0,l.id):this.sort.push(l.id)}const k=l.rule;return l.updated||(l.updated=!0,c.Function(k.update)&&this.bus.$once("load-end",()=>{this.refreshUpdate(l,k.value,"init")}),this.effect(l,"loaded")),l.input&&Object.defineProperty(k,"value",this.valueHandle(l)),this.refreshControl(l)&&(this.cycleLoad=!0),l})},refreshControl(e){return e.input&&e.rule.control&&this.useCtrl(e)},useCtrl(e){const r=Qt(e),i=[],s=this.api;if(!r.length)return!1;for(let a=0;a<r.length;a++){const u=r[a],l=u.handle||function(g){return(X[u.condition||"=="]||X["=="])(g,u.value)};if(!c.trueArray(u.rule))continue;const h=K(y({},u),{valid:A(()=>l(e.rule.value,s)),ctrl:Zt(e,u.rule),isHidden:c.String(u.rule[0])});h.valid&&h.ctrl||!h.valid&&!h.ctrl&&!h.isHidden||i.push(h)}if(!i.length)return!1;const n=[];let o=!1;return this.deferSyncValue(()=>{i.reverse().forEach(({isHidden:a,valid:u,rule:l,prepend:h,append:g,child:b,ctrl:k,method:v})=>{if(a){u?e.ctrlRule.push({__ctrl:!0,children:l,valid:u}):e.ctrlRule.splice(e.ctrlRule.indexOf(k),1),n[u?"push":"unshift"](()=>{v==="disabled"?this.api.disabled(!u,l):v==="display"?this.api.display(u,l):v==="required"?(l.forEach(O=>{this.api.setEffect(O,"required",u)}),u||this.api.clearValidateState(l)):this.api.hidden(!u,l)});return}if(u){o=!0;const O={type:"fcFragment",native:!0,__ctrl:!0,children:l};e.ctrlRule.push(O),this.bus.$once("load-start",()=>{h?s.prepend(O,h,b):g||b?s.append(O,g||e.id,b):e.root.splice(e.root.indexOf(e.origin)+1,0,O)})}else{e.ctrlRule.splice(e.ctrlRule.indexOf(k),1);const O=Z(k);O&&O.rm()}})}),n.length&&this.vm.$nextTick(()=>{n.forEach(a=>a())}),this.vm.$emit("control",e.origin,this.api),this.effect(e,"control"),o},reloadRule(e){return this._reloadRule(e)},_reloadRule(e){e||(e=this.rules);const r=y({},this.ctxs);this.clearNextTick(),this.$render.clearOrgChildren(),this.initData(e),this.fc.rules=e,this.deferSyncValue(()=>{this.bus.$once("load-end",()=>{Object.keys(r).filter(i=>this.ctxs[i]===void 0).forEach(i=>this.rmCtx(r[i])),this.$render.clearCacheAll()}),this.reloading=!0,this.loadRule(),this.reloading=!1,this.refresh(),this.vm.$emit("reloading",this.api)}),this.bus.$off("next-tick",this.nextReload),this.bus.$once("next-tick",this.nextReload),this.vm.$emit("update",this.api)},refresh(){this.vm._refresh()}})}function zt(t){const e=Ve();return Object.keys(e).forEach(r=>{w(t,r)||S(t,r,e[r])}),t}function Qt(t){const e=t.rule.control||[];return c.Object(e)?[e]:e}function Zt(t,e){for(let r=0;r<t.ctrlRule.length;r++){const i=t.ctrlRule[r];if(i.children===e)return i}}function We(t){return!!t.rule.__ctrl}function Yt(t){m(t.prototype,{getValue(e){return c.Undef(e.cacheValue)&&(e.cacheValue=e.parser.toValue(this.getFormData(e),e)),e.cacheValue},setValue(e,r,i,s){e.deleted||(e.cacheValue=r,this.changeStatus=!0,this.nextRefresh(),this.$render.clearCache(e),this.setFormData(e,i),this.syncValue(),this.valueChange(e,r),this.vm.$emit("change",e.field,r,e.origin,this.api,s||!1),this.effect(e,"value"),this.emitEvent("change",e.field,r,{rule:e.origin,api:this.api,setFlag:s||!1}))},onInput(e,r){let i;e.input&&(this.isQuote(e,i=e.parser.toValue(r,e))||this.isChange(e,i))&&this.setValue(e,i,r)},setFormData(e,r){S(this.formData,e.id,r===null?void 0:r)},getFormData(e){return this.formData[e.id]},validate(){return Xe(this.vm.validate),this.fields().forEach(e=>{this.fieldCtx[e].forEach(r=>{this.vm.validate[r.id]=P(r.rule.validate)})}),this.vm.validate},syncForm(){Xe(this.form),Object.defineProperties(this.form,this.fields().reduce((e,r)=>{const i=this.getFieldCtx(r),s=this.valueHandle(i);return s.configurable=!0,e[r]=s,e},this.options.appendValue!==!1?Object.keys(this.appendData).reduce((e,r)=>(e[r]={enumerable:!0,configurable:!0,get:()=>this.appendData[r],set:i=>{this.appendData[r]=i}},e),{}):{})),this.syncValue()},valueHandle(e){return{enumerable:!0,get:()=>this.getValue(e),set:r=>{this.isChange(e,r)&&this.setValue(e,r,e.parser.toFormValue(r,e),!0)}}},appendValue(e){!e.field||!w(this.appendData,e.field)||(e.value=this.appendData[e.field],delete this.appendData[e.field])},addSubForm(e,r){this.subForm[e.id]=r},deferSyncValue(e,r){this.deferSyncFn||(this.deferSyncFn=e),this.deferSyncFn.sync||(this.deferSyncFn.sync=r),A(e),this.deferSyncFn===e&&(this.deferSyncFn=null,e.sync&&this.syncValue())},syncValue(){if(this.deferSyncFn)return this.deferSyncFn.sync=!0;this.vm._updateValue(y(y({},this.options.appendValue!==!1?this.appendData:{}),this.form))},isChange(e,r){return JSON.stringify(e.rule.value,Ge)!==JSON.stringify(r===null?void 0:r,Ge)},isQuote(e,r){return(c.Object(r)||Array.isArray(r))&&r===e.rule.value},refreshUpdate(e,r,i,s){if(c.Function(e.rule.update)){const n=A(()=>e.rule.update(r,e.origin,this.api,{origin:i||"change",linkField:s}));if(n===void 0)return;e.rule.hidden=n===!0}},valueChange(e,r){this.refreshRule(e,r),this.bus.$emit("change-"+e.field,r)},refreshRule(e,r,i,s){this.refreshControl(e)&&(this.$render.clearCacheAll(),this.loadRule(),this.vm.$emit("update",this.api),this.refresh()),this.refreshUpdate(e,r,i,s)},appendLink(e){const r=e.rule.link;c.trueArray(r)&&r.forEach(i=>{const s=()=>this.refreshRule(e,e.rule.value,"link",i);this.bus.$on("change-"+i,s),e.linkOn.push(()=>this.bus.$off("change-"+i,s))})},fields(){return Object.keys(this.fieldCtx)}})}function Ge(t,e){return typeof e=="function"?""+e:e}function Xe(t){Object.keys(t).forEach(e=>delete t[e])}const me={init(t){},toFormValue(t,e){return t},toValue(t,e){return t},mounted(t){},render(t,e){return e.$render.defaultRender(e,t)},preview(t,e){return this.render(t,e)},mergeProp(t){}},er=["field","value","vm","template","name","config","control","inject","sync","payload","optionsTo","update","component","cache"];function tr(t){m(t.prototype,{getCtx(e){return this.getFieldCtx(e)||this.getNameCtx(e)[0]||this.ctxs[e]},getCtxs(e){return this.fieldCtx[e]||this.nameCtx[e]||(this.ctxs[e]?[this.ctxs[e]]:[])},setIdCtx(e,r,i){const s=`${i}Ctx`;this[s][r]?this[s][r].push(e):this[s][r]=[e]},rmIdCtx(e,r,i){const s=`${i}Ctx`,n=this[s][r];if(!n)return!1;const o=n.splice(n.indexOf(e)>>>0,1).length>0;return n.length||delete this[s][r],o},getFieldCtx(e){return(this.fieldCtx[e]||[])[0]},getNameCtx(e){return this.nameCtx[e]||[]},setCtx(e){let{id:r,field:i,name:s,rule:n}=e;this.ctxs[r]=e,s&&this.setIdCtx(e,s,"name"),e.input&&(this.setIdCtx(e,i,"field"),this.setFormData(e,e.parser.toFormValue(n.value,e)),this.isMounted&&!this.reloading&&this.vm.$emit("change",e.field,n.value,e.origin,this.api))},getParser(e){const r=this.fc.parsers;return r[e.originType]||r[T(e.type)]||r[e.trueType]||me},bindParser(e){e.setParser(this.getParser(e))},getType(e){const r=this.fc.CreateNode.aliasMap,i=r[e]||r[T(e)]||e;return T(i)},noWatch(e){this.noWatchFn||(this.noWatchFn=e),A(e),this.noWatchFn===e&&(this.noWatchFn=null)},watchCtx(e){const r=this.vm;Object.keys(e.rule).filter(i=>i[0]!=="_"&&i[0]!=="$"&&er.indexOf(i)===-1).forEach(i=>{const s=i==="children";e.watch.push(r.$watch(()=>e.rule[i],(n,o)=>{if(!(this.loading||this.noWatchFn||this.reloading)){if(s&&e.parser.loadChildren===!1){this.$render.clearCache(e),this.nextRefresh();return}if(this.watching=!0,i==="link"){e.link();return}else if(["props","on","nativeOn","deep"].indexOf(i)>-1)this.parseInjectEvent(e.rule,n||{}),i==="props"&&e.input&&this.setFormData(e,e.parser.toFormValue(e.rule.value,e));else if(["emit","nativeEmit"].indexOf(i)>-1)this.parseEmit(e,i==="emit");else if(["prefix","suffix"].indexOf(i)>-1)n&&this.loadFn(n,e.rule);else if(i==="type")e.updateType(),this.bindParser(e);else if(i==="children"){const a=c.trueArray(n);this.deferSyncValue(()=>{n!==o&&(this.rmSub(o,e),this.$render.initOrgChildren()),a&&this.loadChildren(n,e),this.vm.$emit("update",this.api)})}this.$render.clearCache(e),this.refresh(),this.watching=!1}},{deep:!s,sync:s}))}),this.watchEffect(e)},rmSub(e,r){c.trueArray(e)&&e.forEach(i=>{i&&i.__fc__&&i.__fc__.parent===r&&this.rmCtx(i.__fc__)})},rmCtx(e){if(e.deleted)return;const{id:r,field:i,input:s,name:n}=e;e.input&&Object.defineProperty(e.rule,"value",{value:e.rule.value,writable:!0}),q(this.ctxs,r),q(this.$render.tempList,r),q(this.$render.orgChildren,r),q(this.vm.ctxInject,r),q(this.formData,r),q(this.subForm,r),q(e,"cacheValue"),s&&this.rmIdCtx(e,i,"field"),n&&this.rmIdCtx(e,n,"name"),s&&!w(this.fieldCtx,i)&&q(this.form,i),this.deferSyncValue(()=>{this.reloading||(e.parser.loadChildren!==!1&&c.trueArray(e.rule.children)&&e.rule.children.forEach(a=>a.__fc__&&this.rmCtx(a.__fc__)),e.root===this.rules&&this.vm._renderRule())},s);const o=this.sort.indexOf(r);return o>-1&&this.sort.splice(o,1),this.$render.clearCache(e),e.delete(),this.effect(e,"deleted"),s&&!this.fieldCtx[i]&&this.vm.$emit("removeField",i,e.rule,this.api),e.rule.__ctrl||this.vm.$emit("removeRule",e.rule,this.api),e}})}function rr(t){m(t.prototype,{mounted(){const e=()=>{this.isMounted=!0,this.lifecycle("mounted")};this.pageEnd?e():this.bus.$once("page-end",e)},lifecycle(e){this.vm.$emit(e,this.api),this.emitEvent(e,this.api)},emitEvent(e,...r){const i=this.options[e]||this.options[T("on-"+e)];if(i){const s=H(i);c.Function(s)&&A(()=>s(...r))}this.bus.$emit(e,...r)}})}function ir(t){m(t.prototype,{useProvider(){const e=this.fc.providers;Object.keys(e).forEach(r=>{let i=e[r];c.Function(i)&&(i=i(this.fc)),i._c=sr(i),this.onEffect(i),this.providers[r]=i})},onEffect(e){const r=[];(e._c||["*"]).forEach(i=>{const s=i==="*"?"*":this.getType(i);r.indexOf(s)>-1||(r.push(s),this.bus.$on(`p:${e.name}:${s}:${e.input?1:0}`,(n,o)=>{e[n]&&e[n](...o)}))}),e._used=r},watchEffect(e){const r=this.vm;let i={required:()=>{var s,n;return(w(e.rule,"$required")?e.rule.$required:(n=(s=e.rule)==null?void 0:s.effect)==null?void 0:n.required)||!1}};Object.keys(e.rule.effect||{}).forEach(s=>{i[s]=()=>e.rule.effect[s]}),Object.keys(e.rule).forEach(s=>{s[0]==="$"&&(i[s.substr(1)]=()=>e.rule[s])}),Object.keys(i||{}).forEach(s=>{e.watch.push(r.$watch(i[s],n=>{this.effect(e,"watch",{[s]:n})},{deep:!0}))})},ruleEffect(e,r,i){this.emitEffect({rule:e,input:!!e.field,type:this.getType(e.type)},r,i)},effect(e,r,i){this.emitEffect({rule:e.rule,input:e.input,type:e.trueType,ctx:e,custom:i},r)},getEffect(e,r){if(w(e,"$"+r))return e["$"+r];if(w(e,"effect")&&w(e.effect,r))return e.effect[r]},emitEffect({ctx:e,rule:r,input:i,type:s,custom:n},o,a){if(!s||s==="fcFragment")return;const u=n||Object.keys(r).reduce((l,h)=>(h[0]==="$"&&(l[h.substr(1)]=r[h]),l),y({},r.effect||{}));Object.keys(u).forEach(l=>{const h=this.providers[l];if(!h||h.input&&!i)return;let g;if(!h._c)g="*";else if(h._used.indexOf(s)>-1)g=s;else return;const b=y({value:u[l],getValue:()=>this.getEffect(r,l)},a||{});e&&(b.getProp=()=>e.effectData(l),b.clearProp=()=>e.clearEffectData(l),b.mergeProp=k=>x(b.getProp(),[k]),b.id=e.id),this.bus.$emit(`p:${l}:${g}:${h.input?1:0}`,o,[b,r,this.api])})}})}function nr(t){return t.filter(function(e,r,i){return i.indexOf(e,0)===r})}function sr(t){const e=t.components;if(Array.isArray(e)){const r=nr(e.filter(i=>i!=="*"));return r.length?r:!1}else return c.String(e)?[e]:!1}function D(t){m(this,{fc:t,vm:t.vm,watching:!1,loading:!1,reloading:!1,noWatchFn:null,deferSyncFn:null,isMounted:!1,formData:{},subForm:{},form:{},appendData:{},providers:{},cycleLoad:null,loadedId:1,nextTick:null,changeStatus:!1,pageEnd:!0,nextReload:()=>{this.lifecycle("reload")}}),De(this,{options(){return t.options},bus(){return t.bus}}),this.initData(t.rules),this.$manager=new t.manager(this),this.$render=new pe(this),this.api=t.extendApi(Lt(this),this)}m(D.prototype,{initData(t){m(this,{ctxs:{},fieldCtx:{},nameCtx:{},sort:[],rules:t})},init(){this.appendData=y(y(y({},this.fc.options.formData||{}),this.vm.value||{}),this.appendData),this.useProvider(),this.usePage(),this.loadRule(),this.$manager.__init(),this.lifecycle("created"),this.vm.$set(this.vm,"formData",this.formData)},beforeFetch(t){return new Promise(e=>{const r=this.options.beforeFetch&&A(()=>this.options.beforeFetch(t,{api:this.api}));r&&c.Function(r.then)?r.then(e):e()})}}),xt(D),Jt(D),Wt(D),Xt(D),Yt(D),tr(D),rr(D),ir(D);const ye={name:"fcFragment",functional:!0,props:["vnode"],render(t,e){return e.props.vnode?e.props.vnode:e.children}};function or(t){return c.String(t)?{domProps:{innerHTML:t}}:t}function ar(){const t={};function e(r){r&&this.setVm(r)}return m(e.prototype,{setVm(r){this.vm=r,this.$h=r.$createElement},make(r,i,s){return d.config.isReservedTag(r)&&i.nativeOn&&delete i.nativeOn,this.makeComponent(r,i,s)},makeComponent(r,i,s){let n=this.$h(r,or(i),s||[]);return n.context=this.vm,n},aliasMap:t}),m(e,{aliasMap:t,alias(r,i){t[r]=i},use(r){Object.keys(r).forEach(i=>{const s=ee(i),n=xe(i).toLocaleLowerCase(),o=r[i];[i,s,n].forEach(a=>{e.alias(i,o),e.prototype[a]=function(u,l){return this.make(o,u,l)}})})}}),e}function lr(t){class e extends ze{}return Object.assign(e.prototype,t),e}function ze(t){m(this,{$handle:t,vm:t.vm,options:{},ref:"fcForm",mergeOptionsRule:{normal:["form","row","info","submitBtn","resetBtn"]}}),this.updateKey(),this.init()}m(ze.prototype,{__init(){this.$render=this.$handle.$render,this.$r=(...t)=>this.$render.renderRule(...t)},updateKey(){this.key=te()},init(){},update(){},beforeRender(){},form(){return this.vm.$refs[this.ref]},getSlot(t){const e=r=>{if(r){let i=r.$scopedSlots[t];return i||e(r.$pfc)}};return e(this.vm)},mergeOptions(t,e){return V(t.map(r=>this.tidyOptions(r)),e,this.mergeOptionsRule)},updateOptions(t){this.options=this.mergeOptions([t],this.getDefaultOptions()),this.update()},tidyOptions(t){return t},tidyRule(t){},mergeProp(t){},getDefaultOptions(){return{}},render(t){}});const ur=function(t){const e={name:"loadData",_fn:[],created(r,i,s){this.deleted(r);let n=P(r.getValue());const o=[];n.forEach(a=>{if(a){const u=()=>{a.watch!==!1&&(t.bus.$off("p.loadData."+a.attr,u),t.bus.$once("p.loadData."+a.attr,u));let l;a.attr&&(l=t.loadData[a.attr]||a.default,a.copy!==!1&&(l=U(l))),re(r.getProp(),a.to||"options",l),s.sync(i)};o.push(()=>t.bus.$off("p.loadData."+a.attr,u)),u()}}),this._fn[r.id]=o},deleted(r){this._fn[r.id]&&(this._fn[r.id].forEach(i=>{i()}),delete this._fn[r.id]),r.clearProp()}};return e.watch=e.created,e},Qe={name:"componentValidate",load(t,e,r){const i=t.getValue();i?t.getProp().validate=[{validator(...s){const n=Z(e);if(n)return r.exec(n.id,i===!0?"formCreateValidate":i,...s,{attr:t,rule:e,api:r})}}]:(t.clearProp(),r.clearValidateState([e.field]))},watch(...t){Qe.load(...t)}},hr=function(t){function e(i){return c.String(i)&&(i={action:i,to:"options"}),i}function r(i,s,n){let o=i.value;const a=g=>{g===void 0?(i.clearProp(),n.sync(s)):re(i.getProp(),o.to||"options",g)};if(c.Function(o)&&(o=o(s,n)),o=e(o),!o||!o.action){a(void 0);return}o=U(o),o.to||(o.to="options");const u=o.onError,l=()=>{if(!i.getValue())return i.clearProp(),n.sync(s),!0},h=K(y({headers:{}},o),{onSuccess(g,b){if(l())return;let k=v=>b?v:w(v,"data")?v.data:v;c.Function(o.parse)?k=o.parse:o.parse&&c.String(o.parse)&&(k=v=>(o.parse.split(".").forEach(O=>{v&&(v=v[O])}),v)),a(k(g,s,n)),n.sync(s)},onError(g){a(void 0),!l()&&(u||(b=>ue(b.message||"fetch fail "+o.action)))(g,s,n)}});t.$handle.beforeFetch(h,{rule:s,api:n}).then(()=>{if(c.Function(o.action)){o.action(s,n).then(g=>{h.onSuccess(g,!0)}).catch(g=>{h.onError(g)});return}A(()=>t.create.fetch(h,{inject:i,rule:s,api:n}))})}return{name:"fetch",loaded(...i){r(...i)},watch(...i){r(...i)}}},Ze={name:"required",load(t,e,r){const i=fr(t.getValue());if(i.required===!1)t.clearProp(),r.clearValidateState([e.field]);else{const s=y({required:!0,validator(n,o,a){c.empty(o)?a(s.message):a()}},i);if(!s.message){let n=e.title||"";s.message=((typeof n=="object"?n.title:n)||"")+"不能为空"}t.getProp().validate=[s]}r.sync(e)},watch(...t){Ze.load(...t)}};function fr(t){return c.Boolean(t)?{required:t}:c.String(t)?{message:t}:c.Undef(t)?{required:!1}:c.Function(t)?{validator:t}:c.Object(t)?t:{}}const cr={fetch:hr,loadData:ur,required:Ze,componentValidate:Qe},dr={name:"html",loadChildren:!1,render(t,e){return e.prop.domProps||(e.prop.domProps={}),e.prop.domProps.innerHTML=t,e.vNode.make(e.prop.props.tag||"div",e.prop)},renderChildren(t){return Array.isArray(t.rule.children)?t.rule.children.filter(e=>c.String(e)).join(""):""}};let M=typeof window!="undefined"&&window.Vue?window.Vue:d;function pr(t,e){let r;return arguments.length===2?(r=arguments[1],e=r[t]):r=arguments[2],{id:e,prop:r}}function ge(){return pr("name",...arguments)}function Ye(t){return!t||!t.el?window.document.body:c.Element(t.el)?t.el:document.querySelector(t.el)}function et(t,e){const r=new M({data(){return{rule:t,option:e||{}}},render(i){return i("FormCreate",{ref:"fc",props:this.$data})}});return r.$mount(),r}function mr(t){const e=t.key||[],r=t.array||[],i=t.normal||[];Ee.push(...e),oe.push(...r),ae.push(...i),Me([...e,...r,...i])}let yr=1;const j={};function tt(t){const e={[ye.name]:ye},r={},i={},s=y({},cr),n=Vt();let o={global:{}};const a={},u=ar();mr(t.attrs||{});function l(f){const p=j[f];if(Array.isArray(p))return p.map($=>$.api());if(p)return p.api()}function h(){const f=ge(...arguments);f.id&&f.prop&&(i[f.id]=f.prop)}function g(){const f=ge(...arguments);f.id&&f.prop&&(s[f.id]=K(y({},f.prop),{name:f.id}))}function b(f){u.use(f)}function k(){const f=ge(...arguments);if(!f.id||!f.prop)return me;const p=T(f.id),$=f.prop,C=$.merge===!0?r[p]:void 0;r[p]=$,Object.setPrototypeOf($,C||me),n[p]=R(p),$.maker&&m(n,$.maker)}function v(f,p){let $;if(c.String(f)){if($=T(f),["form-create","formcreate"].indexOf($)>-1)return Ce();if(p===void 0)return e[$]}else $=T(f.name),p=f;if(!$||!p)return;const C=T($);e[$]=p,e[C]=p,delete u.aliasMap[$],delete u.aliasMap[C],delete r[$],delete r[C],p.formCreateParser&&k($,p.formCreateParser)}function O(f){Object.keys(j).forEach(p=>{(Array.isArray(j[p])?j[p]:[j[p]]).forEach(C=>{C.bus.$emit("p.loadData."+f)})})}function at(f,p){a[f]=p,O(f)}function lt(f,p){return w(a,f)?a[f]:p}function Nr(f){delete a[f],O(f)}function Ce(){return M.extend(Rt(ht))}function ut(){return M.extend(ye)}function Lr(f,p){return c.Function(f.install)?f.install(L,p):c.Function(f)&&f(L,p),this}function L(f,p,$){let C=et(f,p||{});const B=C.$refs.fc.formCreate;return B.$parent=$,Ye(B.options).appendChild(C.$el),B.api()}function qr(f){let p=y({},t);return f?p.inherit={components:e,parsers:r,directives:i,providers:s,maker:n,loadData:a}:delete p.inherit,tt(p)}function ht(f){const p=f.$options.propsData.rule;m(this,{id:yr++,vm:f,create:L,manager:lr(t.manager),parsers:r,providers:s,rules:Array.isArray(p)?p:[],name:f.$options.propsData.name||te(),inFor:f.$options.propsData.inFor,prop:{components:e,directives:i},setData:at,getData:lt,loadData:a,CreateNode:u,bus:new M,unwatch:null,options:{},extendApi:t.extendApi||($=>$)}),this.init(),this.initOptions(),this.name&&(this.inFor?(j[this.name]||(j[this.name]=[]),j[this.name].push(this)):j[this.name]=this)}m(ht.prototype,{init(){const f=this.vm,p=new D(this);this.$handle=p,f.$f=p.api,f.$emit("input",p.api),f.$on("hook:created",()=>{this.isSub()&&(this.unwatch=f.$watch(()=>f.$pfc.option,()=>{this.initOptions(),f.$f.refresh()},{deep:!0}),this.initOptions()),this.created()}),f.$on("hook:mounted",()=>{this.mounted()}),f.$on("hook:beforeDestroy",()=>{if(f.destroyed=!0,this.unwatch&&this.unwatch(),p.reloadRule([]),this.name)if(this.inFor){const $=j[this.name].indexOf(this);j[this.name].splice($,1),j[this.name].length||delete j[this.name]}else delete j[this.name]}),f.$on("hook:updated",()=>{p.bindNextTick(()=>this.bus.$emit("next-tick",p.api))})},isSub(){return this.vm.$pfc&&this.vm.extendOption},initOptions(){this.options={};let f=y({formData:{},submitBtn:{},resetBtn:{}},U(o));this.isSub()&&this.mergeOptions(this.options,this.vm.$pfc.$f.config||{},!0),f=this.mergeOptions(f,this.vm.$options.propsData.option),this.updateOptions(f)},mergeOptions(f,p,$){return p=U(p),$&&["page","onSubmit","mounted","reload","formData","el"].forEach(C=>{delete p[C]}),p.global&&(f.global=Dt(f.global,p.global),delete p.global),this.$handle.$manager.mergeOptions([p],f),f},updateOptions(f){this.mergeOptions(this.options,f),this.$handle.$manager.updateOptions(this.options)},created(){this.$handle.init(),this.vm.$emit("created",this.api())},api(){return this.$handle.api},render(){return this.$handle.render()},mounted(){this.$handle.mounted()}});function ft(f){m(f,{version:t.version,ui:t.ui,setData:at,getData:lt,removeData:Nr,maker:n,component:v,directive:h,register:g,$vnode:ut,parser:k,use:Lr,factory:qr,componentAlias:b,copyRule:ce,copyRules:Pe,fetch:Ue,$form:Ce,parseFn:H,parseJson:Tt,toJson:je,getApi:l,init(p,$={}){let C=et(p,$),B=C.$refs.fc.formCreate;return{mount(z){return z&&c.Element(z)&&(B.options.el=z),Ye(B.options).appendChild(C.$el),B.api()},remove(){C.$el.parentNode&&C.$el.parentNode.removeChild(C.$el)},destroy(){this.remove(),C.$destroy()},$f:B.api()}}})}function Ur(f){m(f,{create:L,install(p,$){if(o=y(y({},o),$||{}),p._installedFormCreate===!0)return;p._installedFormCreate=!0,M=p;const C=function(B,z={}){return L(B,z,this)};ft(C),p.prototype.$formCreate=C,p.component("FormCreate",Ce()),p.component("FcFragment",ut())}})}if(ft(L),Ur(L),u.use({fragment:"fcFragment"}),k(dr),t.install&&L.use(t),t.inherit){const f=t.inherit;f.components&&m(e,f.components),f.parsers&&m(r,f.parsers),f.directives&&m(i,f.directives),f.providers&&m(s,f.providers),f.maker&&m(n,f.maker),f.loadData&&m(a,f.loadData)}return L}const rt={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"},it="datePicker",gr={name:it,maker:function(){return["year","month","date","dates","week","datetime","datetimeRange","dateRange","monthRange"].reduce((t,e)=>(t[e]=R(it,{type:e.toLowerCase()}),t),{})}(),mergeProp(t){const e=t.prop.props;e.valueFormat||(e.valueFormat=rt[e.type]||rt.date)}},$e="hidden",$r={name:$e,maker:{[$e]:(t,e)=>R($e)("",t,e)},render(){return[]}},ve="input",vr={name:ve,maker:function(){const t=["password","url","email","text","textarea"].reduce((e,r)=>(e[r]=R(ve,{type:r}),e),{});return t.idate=R(ve,{type:"date"}),t}(),mergeProp(t){let{props:e}=t.prop;e&&e.autosize&&e.autosize.minRows&&(e.rows=e.autosize.minRows||2)}},nt="slider",br={name:nt,maker:{sliderRange:R(nt,{range:!0})},toFormValue(t,e){let r=Array.isArray(t),i=e.prop.props,s=i.min||0,n;return i.range===!0?n=r?t:[s,parseFloat(t)||s]:n=r?parseFloat(t[0])||s:parseFloat(t),n}},be="timePicker",Cr={name:be,maker:{time:R(be,t=>t.props.isRange=!1),timeRange:R(be,t=>t.props.isRange=!0)},mergeProp(t){const e=t.prop.props;e.valueFormat||(e.valueFormat="HH:mm:ss")}},_r=[gr,$r,vr,br,Cr,{name:"FcRow",render(t,e){return e.vNode.col({props:{span:24}},[e.vNode.row(e.prop,t)])}},{name:"select",toFormValue(t,e){return e.prop.props.multiple&&!Array.isArray(t)?P(t):t}}],_="el",kr={button:_+"Button",icon:"i",slider:_+"Slider",rate:_+"Rate",upload:"fcUpload",cascader:_+"Cascader",popover:_+"Popover",tooltip:_+"Tooltip",colorPicker:_+"ColorPicker",timePicker:_+"TimePicker",timeSelect:_+"TimeSelect",datePicker:_+"DatePicker",switch:_+"Switch",select:"fcSelect",checkbox:"fcCheckbox",radio:"fcRadio",inputNumber:_+"InputNumber",number:_+"InputNumber",input:_+"Input",formItem:_+"FormItem",form:_+"Form",frame:"fcFrame",col:_+"Col",row:_+"Row",tree:"fcTree",autoComplete:_+"Autocomplete",auto:_+"Autocomplete",group:"fcGroup",object:"fcSubForm",subForm:"fcSubForm"};function Or(){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,icon:"el-icon-refresh",innerText:"重置",show:!1,col:void 0,click:void 0}}}function wr(t){return t.type==="tooltip"}const Fr=/[A-Z]/;function Er(t,e){return!Fr.test(t)&&(c.String(e)||c.Number(e))}function st(t,e){w(t,e)&&c.String(t[e])&&(t[e]={[e]:t[e],show:!0})}function N(t){return t===!1}function Sr(t,e){w(t,e)&&!c.Object(t[e])&&(t[e]={show:!!t[e]})}const Rr={validate(){const t=this.form();return t?t.validate():new Promise(e=>e())},validateField(t){const e=this.form();return e?new Promise((r,i)=>{e.validateField(t,s=>{s?i(s):r(null)})}):new Promise(r=>r())},clearValidateState(t){const e=this.vm.$refs[t.wrapRef];e&&(e.validateMessage="",e.validateState="")},tidyOptions(t){return["submitBtn","resetBtn","row","info","wrap","col","title"].forEach(e=>{Sr(t,e)}),t},tidyRule({prop:t}){return st(t,"title"),st(t,"info"),t},mergeProp(t){let e=t.prop.props;t.prop=V([{attrs:Object.keys(e).reduce((r,i)=>(Er(i,e[i])&&(r[i]=e[i]),r),{}),info:this.options.info||{},wrap:this.options.wrap||{},col:this.options.col||{},title:this.options.title||{}},t.prop],{info:{trigger:"hover",placement:"top-start",icon:"el-icon-warning"},title:{},col:{span:24},wrap:{}},{normal:["title","info","col","wrap"]})},getDefaultOptions(){return Or()},update(){const t=this.options.form;this.rule={props:y({},t),nativeOn:{submit:e=>{e.preventDefault()}},class:[t.className,t.class,"form-create"],style:t.style,type:"form"}},beforeRender(){const{key:t,ref:e,$handle:r}=this;m(this.rule,{key:t,ref:e}),m(this.rule.props,{model:r.formData})},render(t){return t.length&&t.push(this.makeFormBtn()),this.$r(this.rule,N(this.options.row.show)?t:[this.makeRow(t)])},makeWrap(t,e){const r=t.prop,i=`${this.key}${t.key}`,s=r.col,n=this.isTitle(r),o=!s.labelWidth&&!n?0:s.labelWidth,{inline:a,col:u}=this.rule.props,l=N(r.wrap.show)?e:this.$r(V([r.wrap,{props:K(y({labelWidth:o===void 0?o:xe(o),label:n?r.title.title:void 0},r.wrap||{}),{prop:t.id,rules:t.injectValidate()}),class:r.className,key:`${i}fi`,ref:t.wrapRef,type:"formItem"}]),[e,n?this.makeInfo(r,i,t):null]);return a===!0||N(u)||N(s.show)?l:this.makeCol(r,i,[l])},isTitle(t){if(this.options.form.title===!1)return!1;const e=t.title;return!(!e.title&&!e.native||N(e.show))},makeInfo(t,e,r){const i=t.title,s=t.info,n=wr(s),o=this.options.form,a=this.getSlot("title"),u=[a?a({title:i.title||"",rule:r.rule,options:this.options}):(i.title||"")+(o.labelSuffix||o["label-suffix"]||"")];if(!N(s.show)&&(s.info||s.native)&&!N(s.icon)){const l={type:s.type||"popover",props:y({},s),key:`${e}pop`,slot:"label"},h="content";s.info&&!w(l.props,h)&&(l.props[h]=s.info),u[s.align!=="left"?"unshift":"push"](this.$r(V([s,l]),[this.$r({type:"i",slot:n?"default":"reference",class:s.icon===!0?"el-icon-warning":s.icon,key:`${e}i`})]))}return this.$r(V([i,{props:i,slot:i.slot||"label",key:`${e}tit`,type:i.type||"span"}]),u)},makeCol(t,e,r){const i=t.col;return this.$r({class:i.class,type:"col",props:i||{span:24},key:`${e}col`},r)},makeRow(t){const e=this.options.row||{};return this.$r({type:"row",props:e,class:e.class,key:`${this.key}row`},t)},makeFormBtn(){let t=[];if(N(this.options.submitBtn.show)||t.push(this.makeSubmitBtn()),N(this.options.resetBtn.show)||t.push(this.makeResetBtn()),!t.length)return;const e=this.$r({type:"formItem",key:`${this.key}fb`},t);return this.rule.props.inline===!0?e:this.$r({type:"col",props:{span:24},key:`${this.key}fc`},[e])},makeResetBtn(){const t=this.options.resetBtn;return this.$r({type:"button",props:t,style:{width:t.width},on:{click:()=>{const e=this.$handle.api;t.click?t.click(e):e.resetFields()}},key:`${this.key}b2`},[t.innerText])},makeSubmitBtn(){const t=this.options.submitBtn;return this.$r({type:"button",props:t,style:{width:t.width},on:{click:()=>{const e=this.$handle.api;t.click?t.click(e):e.submit()}},key:`${this.key}b1`},[t.innerText])}},J={};jr(J),Ar(J),Ir(J),Pr(J),Tr(J);function jr(t){["group","tree","switch","upload","autoComplete","checkbox","cascader","colorPicker","datePicker","frame","inputNumber","radio","rate"].forEach(e=>{t[e]=R(e)}),t.auto=t.autoComplete,t.number=t.inputNumber,t.color=t.colorPicker}function Ar(t){const e="select",r="multiple";t.selectMultiple=R(e,{[r]:!0}),t.selectOne=R(e,{[r]:!1})}function Ir(t){const e="tree",r={treeSelected:"selected",treeChecked:"checked"};Object.keys(r).reduce((i,s)=>(i[s]=R(e,{type:r[s]}),i),t)}function Pr(t){const e="upload",r={image:["image",0],file:["file",0],uploadFileOne:["file",1],uploadImageOne:["image",1]};Object.keys(r).reduce((i,s)=>(i[s]=R(e,n=>n.props({uploadType:r[s][0],maxLength:r[s][1]})),i),t),t.uploadImage=t.image,t.uploadFile=t.file}function Tr(t){const e={frameInputs:["input",0],frameFiles:["file",0],frameImages:["image",0],frameInputOne:["input",1],frameFileOne:["file",1],frameImageOne:["image",1]};return Object.keys(e).reduce((r,i)=>(r[i]=R("frame",s=>s.props({type:e[i][0],maxLength:e[i][1]})),r),t),t.frameInput=t.frameInputs,t.frameFile=t.frameFiles,t.frameImage=t.frameImages,t}function ot(t,e){return c.Boolean(t)?t={show:t}:!c.Undef(t)&&!c.Object(t)&&(t={show:e}),t}function Dr(t,e){return m(t,{formEl(){return e.$manager.form()},wrapEl(r){const i=e.getFieldCtx(r);if(i)return e.vm.$refs[i.wrapRef]},validate(r){return new Promise((i,s)=>{const n=t.children,o=[e.$manager.validate()];n.forEach(a=>{o.push(a.validate())}),Promise.all(o).then(()=>{i(!0),r&&r(!0)}).catch(a=>{s(a),r&&r(!1,a),e.vm.$emit("validate-fail",a,{api:t})})})},validateField:(r,i)=>new Promise((s,n)=>{const o=e.getFieldCtx(r);if(!o)return;const a=e.subForm[o.id],u=[e.$manager.validateField(o.id)];P(a).forEach(l=>{u.push(l.validate().catch(()=>Promise.reject("子表单验证未通过")))}),Promise.all(u).then(()=>{s(null),i&&i(null)}).catch(l=>{n(l),i&&i(l),e.vm.$emit("validate-field-fail",l,{field:r,api:t})})}),clearValidateState(r,i=!0){t.helper.tidyFields(r).forEach(s=>{i&&this.clearSubValidateState(s),e.getCtxs(s).forEach(n=>{e.$manager.clearValidateState(n)})})},clearSubValidateState(r){t.helper.tidyFields(r).forEach(i=>{e.getCtxs(i).forEach(s=>{const n=e.subForm[s.id];n&&(Array.isArray(n)?n.forEach(o=>{o.clearValidateState()}):n&&n.clearValidateState())})})},btn:{loading:(r=!0)=>{t.submitBtnProps({loading:!!r})},disabled:(r=!0)=>{t.submitBtnProps({disabled:!!r})},show:(r=!0)=>{t.submitBtnProps({show:!!r})}},resetBtn:{loading:(r=!0)=>{t.resetBtnProps({loading:!!r})},disabled:(r=!0)=>{t.resetBtnProps({disabled:!!r})},show:(r=!0)=>{t.resetBtnProps({show:!!r})}},submitBtnProps:(r={})=>{let i=ot(e.options.submitBtn,!0);m(i,r),e.options.submitBtn=i,t.refreshOptions()},resetBtnProps:(r={})=>{let i=ot(e.options.resetBtn,!1);m(i,r),e.options.resetBtn=i,t.refreshOptions()},submit(r,i){t.validate(s=>{if(s){let n=t.formData();c.Function(r)?A(()=>r(n,this)):(c.Function(e.options.onSubmit)&&A(()=>e.options.onSubmit(n,this)),e.vm.$emit("submit",n,this))}else c.Function(i)&&A(()=>i(this,...arguments))})}}),t}function Br(t){t.componentAlias(kr),St.forEach(e=>{t.component(e.name,e)}),_r.forEach(e=>{t.parser(e)}),Object.keys(J).forEach(e=>{t.maker[e]=J[e]})}function Vr(){return tt({ui:"element-ui",version:"2.6.0",manager:Rr,extendApi:Dr,install:Br,attrs:{normal:["col","wrap"],array:["className"],key:["title","info"]}})}const ie=Vr();typeof window!="undefined"&&(window.formCreate=ie,window.Vue&&ie.install(window.Vue));const Mr=ie.maker;F.default=ie,F.maker=Mr,Object.defineProperties(F,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,17 +1,25 @@
1
1
  {
2
2
  "name": "@form-create/element-ui",
3
- "version": "2.5.37",
4
- "description": "element-ui动态表单|form-create is a form generation component that can generate dynamic rendering, data collection, verification and submission functions through JSON. Supports 3 UI frameworks, and supports the generation of any Vue components. Built-in 20 kinds of commonly used form components and custom components, no matter how complex forms can be easily handled.",
3
+ "version": "2.6.0-alpha.0",
4
+ "description": "Element UI版本低代码表单|FormCreate 是一个可以通过 JSON 生成具有动态渲染、数据收集、验证和提交功能的低代码表单生成组件。支持6个UI框架,适配移动端,并且支持生成任何 Vue 组件。内置20种常用表单组件和自定义组件,再复杂的表单都可以轻松搞定。",
5
5
  "main": "./dist/form-create.min.js",
6
- "module": "./dist/form-create.min.js",
6
+ "module": "./dist/form-create.esm.js",
7
7
  "unpkg": "./dist/form-create.min.js",
8
8
  "jsdelivr": "./dist/form-create.min.js",
9
9
  "typings": "./types/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "import": "./dist/form-create.esm.js",
13
+ "types": "./types/index.d.ts",
14
+ "require": "./dist/form-create.min.js"
15
+ },
16
+ "./*": "./*"
17
+ },
10
18
  "scripts": {
11
19
  "clean": "rimraf dist/",
12
- "dev:ele": "vue-cli-service serve",
13
- "bili": "cross-env UI_LIB=element-ui bili",
14
- "build": "npm-run-all clean bili"
20
+ "build:lib": "npm-run-all clean build:lib:vite",
21
+ "dev:ele": "vite --config vite.dev.config.js",
22
+ "build:lib:vite": "vite build --config vite.build.config.js"
15
23
  },
16
24
  "repository": {
17
25
  "type": "git",
@@ -19,13 +27,14 @@
19
27
  },
20
28
  "keywords": [
21
29
  "动态表单",
30
+ "低代码",
22
31
  "@form-create",
23
32
  "form-builder",
24
33
  "form",
25
34
  "components",
26
- "vue.js",
35
+ "vue",
27
36
  "element-ui",
28
- "json-form",
37
+ "lowcode",
29
38
  "dynamic-form"
30
39
  ],
31
40
  "files": [
@@ -43,26 +52,25 @@
43
52
  },
44
53
  "homepage": "http://www.form-create.com",
45
54
  "dependencies": {
46
- "@form-create/component-elm-checkbox": "^2.5.36",
47
- "@form-create/component-elm-frame": "^2.5.36",
48
- "@form-create/component-elm-group": "^2.5.37",
49
- "@form-create/component-elm-radio": "^2.5.36",
50
- "@form-create/component-elm-select": "^2.5.36",
51
- "@form-create/component-elm-tree": "^2.5.36",
52
- "@form-create/component-elm-upload": "^2.5.36",
53
- "@form-create/component-subform": "^2.5.37",
54
- "@form-create/core": "^2.5.37",
55
+ "@form-create/component-elm-checkbox": "^2.6.0-alpha.0",
56
+ "@form-create/component-elm-frame": "^2.6.0-alpha.0",
57
+ "@form-create/component-elm-group": "^2.6.0-alpha.0",
58
+ "@form-create/component-elm-radio": "^2.6.0-alpha.0",
59
+ "@form-create/component-elm-select": "^2.6.0-alpha.0",
60
+ "@form-create/component-elm-tree": "^2.6.0-alpha.0",
61
+ "@form-create/component-elm-upload": "^2.6.0-alpha.0",
62
+ "@form-create/component-subform": "^2.6.0-alpha.0",
63
+ "@form-create/core": "^2.6.0-alpha.0",
55
64
  "@form-create/utils": "^2.5.36"
56
65
  },
57
66
  "publishConfig": {
58
67
  "access": "public"
59
68
  },
60
69
  "devDependencies": {
61
- "@form-create/component-wangeditor": "^2.5.15",
62
- "@vue/cli-plugin-babel": "~4.5.0",
63
- "@vue/cli-service": "^4.5.3",
70
+ "@form-create/component-wangeditor": "^2.6.0-alpha.0",
64
71
  "element-ui": "^2.15.9",
72
+ "rimraf": "^6.0.1",
65
73
  "v-jsoneditor": "^1.4.2"
66
74
  },
67
- "gitHead": "bd8498f476ccdb1cf9c72fd356efa78f87757269"
75
+ "gitHead": "5001b4e39b68fd306c5de5e9a1c76f5f6353acc6"
68
76
  }