-
Notifications
You must be signed in to change notification settings - Fork 174
/
form-create.iview.js
8 lines (8 loc) · 95.8 KB
/
form-create.iview.js
1
2
3
4
5
6
7
8
/*!
* @form-create/iview v2.5.37
* (c) 2018-2024 xaboy
* Github https://github.com/xaboy/form-create
* Released under the MIT License.
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e=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 f in t[u])if(e[u][f]){var l=e[u][f]instanceof Array?e[u][f]:[e[u][f]],p=t[u][f]instanceof Array?t[u][f]:[t[u][f]];e[u][f]=l.concat(p)}else e[u][f]=t[u][f];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 f(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 l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(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[]}}},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=arguments[0];return e("CheckboxGroup",u([{},this.formCreateInject.prop,{ref:"el"},{props:{value:this.trueValue}},{on:{input:this.onInput}}]),[this.options().map(function(t,n){var r=l({},t);return delete r.value,e("Checkbox",u([{},{props:r},{key:n+"-"+t.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-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 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 .ivu-upload-list {\n margin-top: 0;\n}\n\n._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, ._fc-frame .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 box-shadow: 2px 2px 5px rgba(0, 0, 0, .1);\n margin-right: 4px;\n box-sizing: border-box;\n}\n");var k="fcFrame";function _(e){return{name:k,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:e.fileUpIcon},width:{type:[Number,String],default:500},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},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(),icon:this.icon,readonly:!0,clearable:!1};return t("Input",u([{},{props:n},{},{on:{"on-click":function(){return e.showModel()}}},{key:this.key("input")}]))},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)("icon",u([{},{props:{type:!0===this.handleIcon||void 0===this.handleIcon?"ios-eye-outline":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)("icon",u([{},{props:{type:"ios-trash-outline"}},{on:{click:function(){return n.handleRemove(e)}},key:this.key("ri"+t)}]))},makeFiles:function(){var t=this,n=this.$createElement;return this.makeGroup(this.fileList.map(function(r,i){return t.makeItem(i,[n("icon",u([{},{props:{type:e.fileIcon,size:40}},{on:{click:function(){return t.handleClick(r)}}}])),t.makeIcons(r,i)])}))},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("icon",u([{},{props:{type:this.icon,size:20}}]))])},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,u=[];return n.footer?(o&&u.push(t("Button",{on:{click:function(){return!1!==e.onCancel()&&e.closeModel(!0)}}},[i])),a&&u.push(t("Button",{attrs:{type:"primary"},on:{click:function(){return!1!==e.onOk()&&e.closeModel()}}},[r])),u):u}},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=i.height,c=i.src,s=i.title,f=i.modalTitle;return this.$nextTick(function(){t.$refs.frame&&t.frameLoad(t.$refs.frame.contentWindow||{})}),n("div",{class:"_fc-frame"},[e,n("Modal",u([{},{props:{mask:this.previewMask,title:f,footerHide:!0}},{model:{value:t.previewVisible,callback:function(e){t.previewVisible=e}}}]),[n("img",{style:"width: 100%",attrs:{src:this.previewImage}})]),n("Modal",u([{},{props:l({width:o,title:s},this.modal)},{on:{"on-cancel":function(){return t.closeModel(!0)}},model:{value:t.frameVisible,callback:function(e){t.frameVisible=e}}}]),[this.frameVisible||!this.reload?n("iframe",{ref:"frame",attrs:{src:c,frameBorder:"0"},style:{height:a,border:"0 none",width:"100%"}}):null,n("div",{slot:"footer"},[this.makeFooter()])])])},mounted:function(){this.$on("fc.closeModal",this.closeModal)}}}var w=_({fileIcon:"md-document",fileUpIcon:"ios-folder-open"});w.v2=_({fileIcon:"document-text",fileUpIcon:"folder"});var O={name:"fcRadio",props:{formCreateInject:{type:Object,required:!0},value:{}},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=arguments[0];return e("RadioGroup",u([{},this.formCreateInject.prop,{},{props:{value:this.trueValue}},{ref:"el",on:{input:this.onInput}}]),[this.options().map(function(t,n){var r=l({},t);return delete r.value,e("Radio",u([{},{props:r},{key:n+"-"+t.value}]))}),g(this.$slots)])},mounted:function(){this.$emit("fc.el",this.$refs.el)}},C={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&&!C.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 S(e,t){return{}.hasOwnProperty.call(e,t)}["Date","Object","String","Boolean","Array","Number"].forEach(function(e){C[e]=function(t){return C.type(t,e)}});var j={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("Option",u([{},{props:t},{key:n+"-"+t.value}]),[r?e("template",{slot:t.slotName||"default"},[C.Function(r)?t.slot(e):r]):null])},r=t.props.formCreateInject.options;return e("Select",u([{},t.data,{ref:"el"}]),[(Array.isArray(r)?r:[]).map(function(t,r){return S(t||"","options")?function(t,r){return e("OptionGroup",{attrs:{label:t.label},key:r+"-"+t.label},[C.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)}},E={name:"fcTree",props:{formCreateInject:{type:Object,required:!0},type:{type:String,default:"checked"},value:{type:[Array,String,Number],default:function(){return[]}}},data:function(){return{treeData:[]}},watch:{value:function(e){this.setStatus(e)}},created:function(){this.setStatus(this.value)},methods:{setStatus:function(e){var t=$(e),n=this.formCreateInject.prop.props.data;"selected"===this.type?this.checked(n,t,"selected"):this.checked(n,t,"checked"),this.$forceUpdate()},checked:function(e,t,n){var r=this;e.forEach(function(e){r.$set(e,n,-1!==t.indexOf(e.id)),void 0!==e.children&&Array.isArray(e.children)&&r.checked(e.children,t,n)})},onInput:function(e){this.$emit("input",e.map(function(e){return e.id}))}},render:function(){var e=arguments[0],t={};return"selected"===this.type?t["on-select-change"]=this.onInput:t["on-check-change"]=this.onInput,e("Tree",u([{},this.formCreateInject.prop,{ref:"tree"},{on:t}]),[g(this.$slots)])},mounted:function(){this.$emit("fc.el",this.$refs.tree)}};function R(e){return{url:e,name:F(e)}}function F(e){return(""+e).split("/").pop()}x("._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 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 .ivu-upload-list {\n margin-top: 0;\n}\n\n._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, ._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 box-shadow: 2px 2px 5px rgba(0, 0, 0, .1);\n margin-right: 4px;\n box-sizing: border-box;\n}\n");var I="fcUpload";function V(e){return{name:I,props:{formCreateInject:{type:Object,required:!0},onHandle:{type:Function,default:function(e){this.previewImage=e.url,this.previewVisible=!0}},uploadType:{type:String,default:"file"},maxLength:{type:Number,default:0},allowRemove:{type:Boolean,default:!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.showUploadList&&(this.formCreateInject.prop.props.showUploadList=!1),this.formCreateInject.prop.props.defaultFileList=$(this.value).map(R)},watch:{value:function(e){this.$refs.upload.fileList.every(function(e){return!e.status||"finished"===e.status})&&(this.$refs.upload.fileList=$(e).map(R),this.uploadList=this.$refs.upload.fileList)},maxLength: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(t,n){var r=this.$createElement;return"image"===this.uploadType?r("img",{attrs:{src:t.url},key:this.key("img"+n)}):r("icon",u([{},{props:{type:e.fileIcon,size:40}},{key:this.key("i"+n)}]))},makeRemoveIcon:function(e,t){var n=this;return(0,this.$createElement)("icon",{attrs:{type:"ios-trash-outline"},on:{click:function(){return n.onRemove(e)}},key:this.key("ri"+t)})},makeHandleIcon:function(e,t){var n=this;return(0,this.$createElement)("icon",{attrs:{type:!0===this.handleIcon||void 0===this.handleIcon?"ios-eye-outline":this.handleIcon},on:{click:function(){return n.handleClick(e)}},key:this.key("hi"+t)})},makeProgress:function(e,t){return(0,this.$createElement)("Progress",u([{},{props:{percent:e.percentage,hideInfo:!0}},{style:"width:90%",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"},[n.showProgress?e.makeProgress(n,r):[e.makeItem(n,r),e.makeIcons(n,r)]])})},makeUpload:function(){var t=this.$createElement,n=!this.maxLength||this.maxLength>this.uploadList.length;return t("Upload",u([{},this.formCreateInject.prop,{},{style:{display:"inline-block"},key:this.key("upload"),ref:"upload"}]),[n?t("template",{slot:"default"},[this.$slots.default||t("div",{class:"fc-upload-btn"},[t("icon",u([{},{props:{type:"file"===this.uploadType?"ios-cloud-upload-outline":e.imgUpIcon,size:20}}]))])]):null,g(this.$slots,["default"])])},update:function(){var e=this.$refs.upload.fileList.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.maxLength?e[0]||"":e))},handleCancel:function(){this.previewVisible=!1}},render:function(){var e=this,t=arguments[0];return this.$refs.upload&&(void 0===this.formCreateInject.prop.props.showUploadList&&(this.formCreateInject.prop.props.showUploadList=this.$refs.upload.showUploadList),this.formCreateInject.prop.props.defaultFileList=this.$refs.upload.defaultFileList),t("div",{class:"_fc-upload"},[[this.formCreateInject.prop.props.showUploadList?[]:this.makeFiles(),this.makeUpload()],t("Modal",u([{},{props:{title:this.modalTitle,footerHide:!0}},{model:{value:e.previewVisible,callback:function(t){e.previewVisible=t}}}]),[t("img",{attrs:{alt:"example",src:this.previewImage},style:"width: 100%"})])])},mounted:function(){var e=this;this.uploadList=this.$refs.upload.fileList,this.$watch(function(){return e.$refs.upload.fileList},function(){e.update()},{deep:!0}),this.$emit("fc.el",this.$refs.upload)}}}var A=V({fileIcon:"md-document",imgUpIcon:"md-images"});function P(e,n,r){t.set(e,n,r)}function D(e,n){t.delete(e,n)}function T(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))||C.Object(o)){var a=void 0===e[i];if(r)r=!1,a&&P(e,i,[]);else if(o._clone&&void 0!==n){if(!n){P(e,i,o._clone());continue}o=o.getRule(),a&&P(e,i,{})}else a&&P(e,i,{});e[i]=T(e[i],o,n)}else P(e,i,o),C.Undef(o)||(C.Undef(o.__json)||(e[i].__json=o.__json),C.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 B(e){return T({},{value:e}).value}A.v2=V({fileIcon:"document-text",imgUpIcon:"image"});var L=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)&&P(e,r,t[r]);return e};function N(){return L.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 M={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(){T(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=B(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&&S(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:l({},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?l({},this.options):{submitBtn:!1,resetBtn:!1};if(this.defaultValue){i.formData||(i.formData={});var o=B(this.defaultValue);N(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 f=e.cacheRule[a],l=f.rule,p=f.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:l,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])}},U=[b,O,j,E,{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=l({},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}}]))}},w,A,M],q="FormCreate",z=function e(t,n){if(t&&t!==n)return t.formCreateInject?t.formCreateInject:t.$parent?e(t.$parent,n):void 0};function H(e){return{name:q,componentName:q,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){N(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=z(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=z(t,t.$pfc);r&&(t.isMore?(e=$(r.getSubForm())).push(n):e=n,r.subForm(e))}}():r()},{immediate:!0})}}}var J=["attrs","props","domProps","scopedSlots"],W=["class","style","directives"],G=["on","nativeOn"],K=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(J,v(r.normal||[])),o=[].concat(W,v(r.array||[])),a=[].concat(G,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]=l(l({},t[r]),n[r]);else if(o.indexOf(r)>-1){var s=t[r]instanceof Array?t[r]:[t[r]],f=n[r]instanceof Array?n[r]:[n[r]];t[r]=[].concat(v(s),v(f))}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]=X(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]=l({},n[r]):o.indexOf(r)>-1?t[r]=n[r]instanceof Array?v(n[r]):"object"===c(n[r])?l({},n[r]):n[r]:t[r]=n[r];return t},n)},X=function(e,t){return function(){e&&e.apply(this,arguments),t&&t.apply(this,arguments)}},Q=["type","slot","emitPrefix","value","name","native","hidden","display","inject","options","emit","nativeEmit","link","prefix","suffix","update","sync","optionsTo","key","preview","component","cache"],Z=["validate","children","control"],Y=["effect","deep"];function ee(e,t,n){return"[form-create ".concat(e,"]: ").concat(t)+(n?"\n\nrule: "+JSON.stringify(n.getRule?n.getRule():n):"")}function te(e,t){console.error(ee("err",e,t))}var ne="[[FORM-CREATE-PREFIX-",re="-FORM-CREATE-SUFFIX]]",ie="$FN:",oe="$FNX:",ae="function";function ue(e,t){return JSON.stringify(T(Array.isArray(e)?[]:{},e,!0),function(e,t){if(!t||!0!==t._isVue){if(c(t)!==ae)return t;if(t.__json)return t.__json;if(t.__origin&&(t=t.__origin),!t.__emit)return ne+t+re}},t)}function ce(e){return new Function("return "+e)()}function se(e,t){if(e&&C.String(e)&&e.length>4){var n=e.trim(),r=!1;try{if(n.indexOf(re)>0&&0===n.indexOf(ne))n=n.replace(re,"").replace(ne,""),r=!0;else if(0===n.indexOf(ie))n=n.replace(ie,""),r=!0;else{if(0===n.indexOf(oe))return(n=ce("function($inject){"+n.replace(oe,"")+"}")).__json=e,n.__inject=!0,n;t||0!==n.indexOf(ae)||n===ae||(r=!0)}if(!r)return e;var i=ce(-1===n.indexOf(ae)&&0!==n.indexOf("(")?ae+" "+n:n);return i.__json=e,i}catch(e){return void te("解析失败:".concat(n,"\n\nerr: ").concat(e))}}return e}function fe(e,t){return JSON.parse(e,function(e,n){return C.Undef(n)||!n.indexOf?n:se(n,t)})}function le(e,t){return{value:e,enumerable:!1,configurable:!1,writable:!!t}}function pe(e){return de([e])[0]}function de(e,t){return T([],v(e),t||!1)}function he(e,t){return K(Array.isArray(t)?t:[t],e,{array:Z,normal:Y}),e}function me(e){var t=C.Function(e.getRule)?e.getRule():e;return t.type||(t.type="input"),t}function ve(e,t){Object.defineProperties(e,Object.keys(t).reduce(function(e,n){return e[n]={get:function(){return t[n]()}},e},{}))}function ye(e){return e.__fc__||(e.__origin__?e.__origin__.__fc__:null)}function ge(e,t){try{t=e()}catch(e){!function(e){te(e.toString()),console.error(e)}(e)}return t}var be=function(e,t){return"string"==typeof e?String(t):"number"==typeof e?Number(t):t},$e={"==":function(e,t){return JSON.stringify(e)===JSON.stringify(be(e,t))},"!=":function(e,t){return!$e["=="](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(be(e[0],t))>-1},notOn:function(e,t){return!$e.on(e,t)},in:function(e,t){return t&&t.indexOf&&t.indexOf(e)>-1},notIn:function(e,t){return!$e.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 C.empty(e)},notEmpty:function(e){return!C.empty(e)},pattern:function(e,t){return new RegExp(t,"g").test(e)}};function xe(e,t){return function(n,r,i){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=new ke(e,n,r,i,o);return t&&(C.Function(t)?t(a):a.props(t)),a}}function ke(e,t,n,r,i){this._data=N({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 _e(e){e.forEach(function(e){ke.prototype[e]=function(t){return he(this._data,s({},e,arguments.length<2?t:s({},t,arguments[1]))),this}})}N(ke.prototype,{getRule:function(){return this._data},setProp:function(e,t){return P(this._data,e,t),this},_clone:function(){var e=new this.constructor;return e._data=pe(this._data),e}}),_e([].concat(Q,v(J),v(W),v(G),Z,Y));var we=xe("");function Oe(e,t,n){var r=we("",t);return r._data.type=e,r._data.title=n,r}function Ce(e,t,n,r){var i=we("",n);return i._data.type="template",i._data.template=e,i._data.title=r,i._data.vm=t,i}function Se(){return{create:Oe,createTmp:Ce,template:Ce,factory:xe}}function je(e){var t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch(e){return t}}function Ee(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),je(n));e.onSuccess(je(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 Re(e){return new Promise(function(t,n){Ee(l(l({},e),{},{onSuccess:function(n){var r=function(e){return e},i=se(e.parse);C.Function(i)?r=i:i&&C.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 Fe(e){return B(e)}function Ie(e){return Ve(e.replace(/(-[a-z])/g,function(e){return e.replace("-","").toLocaleUpperCase()}))}function Ve(e){return e.replace(e[0],e[0].toLowerCase())}function Ae(e){var t=e.replace(/([A-Z])/g,"-$1").toLocaleLowerCase();return 0===t.indexOf("-")&&(t=t.substr(1)),t}var Pe=0;function De(){var e=++Pe+370;return"F"+Math.random().toString(36).substr(3,3)+Number("".concat(Date.now())).toString(36)+e.toString(36)+"c"}function Te(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 Be(e){N(this,{$handle:e,fc:e.fc,vm:e.vm,$manager:e.$manager,vNode:new e.fc.CreateNode(e.vm)}),ve(this,{options:function(){return e.options},sort:function(){return e.sort}}),this.initCache(),this.initRender()}!function(e){N(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}})}(Be),function(e){N(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]=C.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-"+Ae(e.rule.field)]||n.$scopedSlots["field-"+e.rule.field]),r||(r=n.$scopedSlots["type-"+Ae(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?C.Function(n)?ge(function(){return e.vm(t.$handle.getInjectData(e))}):n._isVue?n:new nt(n):new nt},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=he({},[t["*"],e.cacheConfig,e.prop]))},setOptions:function(e){e.prop.optionsTo&&e.prop.options&&Te(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){Te(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){S(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(!nt.compile)return function(e,t){console.warn(ee("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:nt.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 C.Undef(s.data)&&(s.data={}),s.key=i,s.data.ref=e.ref,s.data.key=i,s},parseSide:function(e,t){return C.Object(e)?he({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=!(C.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=!!(S(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 f=this.getTypeSlot(e);r=f?f({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&&C.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"}):C.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]||P(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 N(r,{preview:e.prop.preview,options:e.prop.options,children:e.rule.children,prop:(n=l({},e.prop),n.on=n.on?l({},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)}),K(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!C.String(e)&&e.__fc__&&!t.$handle.ctxs[e.__fc__.id]};return!C.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 C.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(Ve(e.originType),n,t)},renderRule:function(e,t,n){var r=this;if(e){if(C.String(e))return e;var i;if(n)i=e.type;else if(i=e.is,e.type){i=Ie(e.type);var o=this.vNode.aliasMap[i];o&&(i=Ie(o))}if(i){var a=[[t]];return C.trueArray(e.children)&&a.push(e.children.map(function(e){return r.renderRule(e)})),this.$h(i,l({},e),a)}}}})}(Be);var Le=["hook:updated","hook:mounted"];function Ne(e,t,n){var r,i=De();N(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:l({},t),computed:{},payload:{},input:!!t.field,el:void 0,exportEl:void 0,defaultValue:t.field?B(n):void 0,field:t.field||void 0}),this.updateType(),this.updateKey(),r=this,Object.defineProperties(r.origin,{__fc__:le(r,!0)}),this.update(e,!0)}function Me(e,t){for(var n=0;n<e.ctrlRule.length;n++){var r=e.ctrlRule[n];if(r.children===t)return r}}function Ue(e){return!!e.rule.__ctrl}function qe(e,t){return"function"==typeof t?""+t:t}function ze(e){Object.keys(e).forEach(function(t){return delete e[t]})}N(Ne.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=De(),e&&this.parent&&this.parent.updateKey(e)},updateType:function(){this.originType=this.rule.type,this.type=Ie(this.rule.type)},setParser:function(e){this.parser=e,e.init(this)},initProp:function(){var e=this,t=l({},this.rule);delete t.children,this.prop=he({},[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(C.Function(t.validator)){var n=l({},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(),N(this,{deleted:!0,prop:l({},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),N(e,{root:[]})},e.input)})},update:function(e,t){N(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 He={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){}},Je=["field","value","vm","template","name","config","control","inject","sync","payload","optionsTo","update","component","cache"];function We(e){var t=this;N(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")}}),ve(this,{options:function(){return e.options},bus:function(){return e.bus}}),this.initData(e.rules),this.$manager=new e.manager(this),this.$render=new Be(this),this.api=e.extendApi(function(e){function t(t){return C.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){P(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]=Fe(r.rule.value),t):t},!1!==e.options.appendValue?Fe(e.appendData):{})},getValue:function(t){var n=e.getFieldCtx(t);if(n)return Fe(n.rule.value)},coverValue:function(t){var n=l({},t||{});e.deferSyncValue(function(){i.fields().forEach(function(t){var r=e.fieldCtx[t];if(r){var i=S(n,t);r.forEach(function(e){e.rule.value=i?n[t]:void 0}),delete n[t]}}),N(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&&ye(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&&P(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=C.Object(t)?ye(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){P(e.vm,"isShow",!t)},changeStatus:function(){return e.changeStatus},clearChangeStatus:function(){e.changeStatus=!1},updateRule:function(t,n){e.getCtxs(t).forEach(function(e){N(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){he(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)),S(i.rule,"$"+n)&&P(i.rule,"$"+n,r),S(i.rule,"effect")||P(i.rule,"effect",{}),P(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=Fe(t.defaultValue)})})},method:function(e,t){var n=i.el(e);if(!n||!n[t])throw new Error(ee("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 ge(function(){return i.method(e,t).apply(void 0,r)})},toJson:function(e){return ue(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&&ge(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 Re(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)}N(We.prototype,{initData:function(e){N(this,{ctxs:{},fieldCtx:{},nameCtx:{},sort:[],rules:e})},init:function(){this.appendData=l(l(l({},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&&ge(function(){return t.options.beforeFetch(e,{api:t.api})});r&&C.Function(r.then)?r.then(n):n()})}}),function(e){N(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(C.Function(t)&&(!1!==n&&!C.Undef(n)||t.__inject))return this.inject(e,t,n);if(!r&&Array.isArray(t)&&t[0]&&(C.String(t[0])||C.Function(t[0])))return this.parseEventLst(e,t,n,!0);if(C.String(t)){var i=se(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 C.trueArray(s)&&s.forEach(function(e){if(e){var s,f=o||a||u;if(C.Object(e)&&(s=e.inject,f=(e=e.name).prefix||f),f){t||(f="native-".concat(f));var l=Ae("".concat(f,"-").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,[l].concat(i)),(t=n.vm).$emit.apply(t,["emit-event",l].concat(i))};if(p.__emit=!0,s||!1!==c){var d=s||c||n.options.injectEvent;r[e]=C.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}})}(We),function(e){N(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);C.Object(t)&&(t.first&&(r=parseInt(t.first,10)||r),t.limit&&(i=parseInt(t.limit,10)||i)),N(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(Le,function t(){e.pageEnd?(e.vm.$off(Le,t),e.bus.$emit("page-end")):(e.first+=e.limit,e.pageEnd=e.rules.length<=e.first,e.loadRule(),e.refresh())})}})}(We),function(e){N(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,[])}})}(We),function(e){N(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=me(e);return Object.defineProperties(n,{__origin__:le(e,!0)}),function(e){var t={props:{},on:{},options:[],children:[],effect:{},hidden:!1,display:!0,value:void 0};Object.keys(t).forEach(function(n){S(e,n)||P(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=se(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=se(e.handle))})},syncProp:function(e){var t=this,n=e.rule;C.trueArray(n.sync)&&K([{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){C.trueArray(e)&&n._loadRule(e,t)};e.map(function(i,o){if((!t||C.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=me(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,f=!!i.__fc__,l=u.value;if(f){l=(a=i.__fc__).defaultValue;var p=!a.check(n);if(a.deleted){if(p){if(Ue(a))return;a.update(n)}}else if(p){if(Ue(a))return;e[o]=i=i._clone?i._clone():pe(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 Ne(n,d,l),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&&!f&&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,C.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 C.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($e[o.condition||"=="]||$e["=="])(e,o.value)};if(!C.trueArray(o.rule))return"continue";var u=l(l({},o),{},{valid:ge(function(){return a(e.rule.value,i)}),ctrl:Me(e,o.rule),isHidden:C.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,f=n.append,l=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,l):f||l?i.append(h,f||e.id,l):e.root.splice(e.root.indexOf(e.origin)+1,0,h)})}else{e.ctrlRule.splice(e.ctrlRule.indexOf(p),1);var m=ye(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=l({},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()}})}(We),function(e){N(e.prototype,{getValue:function(e){return C.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){P(this.formData,e.id,null===t?void 0:t)},getFormData:function(e){return this.formData[e.id]},validate:function(){var e=this;return ze(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;ze(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&&S(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),ge(e),this.deferSyncFn===e&&(this.deferSyncFn=null,e.sync&&this.syncValue())},syncValue:function(){if(this.deferSyncFn)return this.deferSyncFn.sync=!0;this.vm._updateValue(l(l({},!1!==this.options.appendValue?this.appendData:{}),this.form))},isChange:function(e,t){return JSON.stringify(e.rule.value,qe)!==JSON.stringify(null===t?void 0:t,qe)},isQuote:function(e,t){return(C.Object(t)||Array.isArray(t))&&t===e.rule.value},refreshUpdate:function(e,t,n,r){var i=this;if(C.Function(e.rule.update)){var o=ge(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;C.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)}})}(We),function(e){N(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[Ie(e.type)]||t[e.trueType]||He},bindParser:function(e){e.setParser(this.getParser(e))},getType:function(e){var t=this.fc.CreateNode.aliasMap,n=t[e]||t[Ie(e)]||e;return Ie(n)},noWatch:function(e){this.noWatchFn||(this.noWatchFn=e),ge(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===Je.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=C.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;C.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}),D(this.ctxs,n),D(this.$render.tempList,n),D(this.$render.orgChildren,n),D(this.vm.ctxInject,n),D(this.formData,n),D(this.subForm,n),D(e,"cacheValue"),i&&this.rmIdCtx(e,r,"field"),o&&this.rmIdCtx(e,o,"name"),i&&!S(this.fieldCtx,r)&&D(this.form,r),this.deferSyncValue(function(){t.reloading||(!1!==e.parser.loadChildren&&C.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}}})}(We),function(e){N(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[Ie("on-"+e)];if(o){var a=se(o);C.Function(a)&&ge(function(){return a.apply(void 0,r)})}(t=this.bus).$emit.apply(t,[e].concat(r))}})}(We),function(e){N(e.prototype,{useProvider:function(){var e=this,t=this.fc.providers;Object.keys(t).forEach(function(n){var r=t[n];C.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!!C.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(S(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 S(e,"$"+t)?e["$"+t]:S(e,"effect")&&S(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},l({},o.effect||{}));Object.keys(s).forEach(function(e){var c=r.providers[e];if(c&&(!c.input||a)){var f;if(c._c){if(!(c._used.indexOf(u)>-1))return;f=u}else f="*";var p=l({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 he(p.getProp(),[e])},p.id=i.id),r.bus.$emit("p:".concat(e,":").concat(f,":").concat(c.input?1:0),t,[p,o,r.api])}})}}})}(We);var Ge={name:"fcFragment",functional:!0,props:["vnode"],render:function(e,t){return t.props.vnode?t.props.vnode:t.children}};function Ke(){var e={};function n(e){e&&this.setVm(e)}return N(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,C.String(r)?{domProps:{innerHTML:r}}:r),n||[]);return i.context=this.vm,i},aliasMap:e}),N(n,{aliasMap:e,alias:function(t,n){e[t]=n},use:function(e){Object.keys(e).forEach(function(t){var r,i=Ae(t),o=(r=t,null==r?"":"object"===c(r)?JSON.stringify(r,null,2):String(r)).toLocaleLowerCase(),a=e[t];[t,i,o].forEach(function(e){n.alias(t,a),n.prototype[e]=function(e,t){return this.make(a,e,t)}})})}}),n}function Xe(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,Qe);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 Qe(e){N(this,{$handle:e,vm:e.vm,options:{},ref:"fcForm",mergeOptionsRule:{normal:["form","row","info","submitBtn","resetBtn"]}}),this.updateKey(),this.init()}N(Qe.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=De()},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 K(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=ye(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)}},Ye={name:"required",load:function(e,t,n){var r=function(e){return C.Boolean(e)?{required:e}:C.String(e)?{message:e}:C.Undef(e)?{required:!1}:C.Function(e)?{validator:e}:C.Object(e)?e:{}}(e.getValue());if(!1===r.required)e.clearProp(),n.clearValidateState([t.field]);else{var i=l({required:!0,validator:function(e,t,n){C.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(){Ye.load.apply(Ye,arguments)}};var et={fetch:function(e){function t(t,n,r){var i=t.value,o=function(e){void 0===e?(t.clearProp(),r.sync(n)):Te(t.getProp(),i.to||"options",e)};if(C.Function(i)&&(i=i(n,r)),(i=function(e){return C.String(e)&&(e={action:e,to:"options"}),e}(i))&&i.action){(i=B(i)).to||(i.to="options");var a=i.onError,u=function(){if(!t.getValue())return t.clearProp(),r.sync(n),!0},c=l(l({headers:{}},i),{},{onSuccess:function(e,t){if(!u()){var a=function(e){return t?e:S(e,"data")?e.data:e};C.Function(i.parse)?a=i.parse:i.parse&&C.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 te(e.message||"fetch fail "+i.action)})(e,n,r)}});e.$handle.beforeFetch(c,{rule:n,api:r}).then(function(){C.Function(i.action)?i.action(n,r).then(function(e){c.onSuccess(e,!0)}).catch(function(e){c.onError(e)}):ge(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=B(a))),Te(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:Ye,componentValidate:Ze},tt={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 C.String(e)}).join(""):""}},nt="undefined"!=typeof window&&window.Vue?window.Vue:t;function rt(){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 it(e){return e&&e.el?C.Element(e.el)?e.el:document.querySelector(e.el):window.document.body}function ot(e,t){var n=new nt({data:function(){return{rule:e,option:t||{}}},render:function(e){return e("FormCreate",{ref:"fc",props:this.$data})}});return n.$mount(),n}var at=1,ut={};function ct(e){var t,n,r,i,o=s({},Ge.name,Ge),a={},u={},c=l({},et),f=Se(),p={global:{}},d={},h=Ke();function m(e){var t=ut[e];return Array.isArray(t)?t.map(function(e){return e.api()}):t?t.api():void 0}function y(){var e=rt.apply(void 0,arguments);e.id&&e.prop&&(u[e.id]=e.prop)}function g(){var e=rt.apply(void 0,arguments);e.id&&e.prop&&(c[e.id]=l(l({},e.prop),{},{name:e.id}))}function b(e){h.use(e)}function $(){var e=rt.apply(void 0,arguments);if(!e.id||!e.prop)return He;var t=Ie(e.id),n=e.prop,r=!0===n.merge?a[t]:void 0;a[t]=n,Object.setPrototypeOf(n,r||He),f[t]=xe(t),n.maker&&N(f,n.maker)}function x(e,t){var n;if(C.String(e)){if(n=Ie(e),["form-create","formcreate"].indexOf(n)>-1)return j();if(void 0===t)return o[n]}else n=Ie(e.name),t=e;if(n&&t){var r=Ie(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(ut).forEach(function(t){(Array.isArray(ut[t])?ut[t]:[ut[t]]).forEach(function(t){t.bus.$emit("p.loadData."+e)})})}function _(e,t){d[e]=t,k(e)}function w(e,t){return S(d,e)?d[e]:t}function O(e){delete d[e],k(e)}function j(){return nt.extend(H(V))}function E(){return nt.extend(Ge)}function R(e,t){return C.Function(e.install)?e.install(F,t):C.Function(e)&&e(F,t),this}function F(e,t,n){var r=ot(e,t||{}),i=r.$refs.fc.formCreate;return i.$parent=n,it(i.options).appendChild(r.$el),i.api()}function I(t){var n=l({},e);return t?n.inherit={components:o,parsers:a,directives:u,providers:c,maker:f,loadData:d}:delete n.inherit,ct(n)}function V(t){var n=t.$options.propsData.rule;N(this,{id:at++,vm:t,create:F,manager:Xe(e.manager),parsers:a,providers:c,rules:Array.isArray(n)?n:[],name:t.$options.propsData.name||De(),inFor:t.$options.propsData.inFor,prop:{components:o,directives:u},setData:_,getData:w,loadData:d,CreateNode:h,bus:new nt,unwatch:null,options:{},extendApi:e.extendApi||function(e){return e}}),this.init(),this.initOptions(),this.name&&(this.inFor?(ut[this.name]||(ut[this.name]=[]),ut[this.name].push(this)):ut[this.name]=this)}function A(t){N(t,{version:e.version,ui:e.ui,setData:_,getData:w,removeData:O,maker:f,component:x,directive:y,register:g,$vnode:E,parser:$,use:R,factory:I,componentAlias:b,copyRule:pe,copyRules:de,fetch:Ee,$form:j,parseFn:se,parseJson:fe,toJson:ue,getApi:m,init:function(e){var t=ot(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),n=t.$refs.fc.formCreate;return{mount:function(e){return e&&C.Element(e)&&(n.options.el=e),it(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||[],Q.push.apply(Q,v(n)),Z.push.apply(Z,v(r)),Y.push.apply(Y,v(i)),_e([].concat(v(n),v(r),v(i))),N(V.prototype,{init:function(){var e=this,t=this.vm,n=new We(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=ut[e.name].indexOf(e);ut[e.name].splice(r,1),ut[e.name].length||delete ut[e.name]}else delete ut[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=l({formData:{},submitBtn:{},resetBtn:{}},B(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=B(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]=he(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()}}),A(F),N(F,{create:F,install:function(e,t){if(p=l(l({},p),t||{}),!0!==e._installedFormCreate){e._installedFormCreate=!0,nt=e;var n=function(e){return F(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},this)};A(n),e.prototype.$formCreate=n,e.component("FormCreate",j()),e.component("FcFragment",E())}}}),h.use({fragment:"fcFragment"}),$(tt),e.install&&F.use(e),e.inherit){var P=e.inherit;P.components&&N(o,P.components),P.parsers&&N(a,P.parsers),P.directives&&N(u,P.directives),P.providers&&N(c,P.providers),P.maker&&N(f,P.maker),P.loadData&&N(d,P.loadData)}return F}function st(e){if(C.Date(e))return e;var t=new Date(e);return"Invalid Date"===t.toString()?e:t}var ft={name:"datePicker",maker:["date","dateRange","datetime","datetimeRange","year","month"].reduce(function(e,t){return e[t]=xe("datePicker",{type:t.toLowerCase()}),e},{}),mergeProp:function(e){var t=e.prop.props;t.startDate&&(t.startDate=t.startDate&&st(t.startDate))},isRange:function(e){return e.type.includes("range")||e.multiple},_toValue:function(e,t){var n=t.el.formatDate(e||""),r=t.el.separator,i=this.isRange(t.el);return n?i?n.split(r):n:i?t.el.multiple?[]:["",""]:n},toValue:function(e,t){var n=t.el;return n?(this.el=n,this._toValue(e,t)):e},toFormValue:function(e,t){if(t.el){var n=t.el.parseDate(e);return this.isRange(t.el)?n:n[0]}var r,i=Array.isArray(e),o=t.prop.props,a=o.type||"date";return r=-1!==["daterange","datetimerange"].indexOf(a)?i?e.map(function(e){return e?st(e):""}):["",""]:"date"===a&&!0===o.multiple?toString(e):(r=i?e[0]||"":e)?st(r):""},mounted:function(e){e.rule.value=this.toValue(e.$handle.getFormData(e),e)}},lt={name:"hidden",maker:s({},"hidden",function(e,t){return xe("hidden")("",e,t)}),render:function(){return[]}},pt=[ft,lt,{name:"input",maker:function(){var e=["password","url","email","text","textarea"].reduce(function(e,t){return e[t]=xe("input",{type:t}),e},{});return e.idate=xe("input",{type:"date"}),e}(),mergeProp:function(e){var t=e.prop.props;t.autosize&&t.autosize.minRows&&(t.rows=t.autosize.minRows||2)}},{name:"slider",maker:{sliderRange:xe("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:"switch",mergeProp:function(e){var t=e.prop.props.slot||{},n=e.prop.scopedSlots||{};t.open&&(n.open=function(){return t.open}),t.close&&(n.close=function(){return t.close}),e.prop.scopedSlots=n}},{name:"FcRow",render:function(e,t){return t.vNode.col({props:{span:24}},[t.vNode.row(t.prop,e)])}}],dt={button:"iButton",icon:"Icon",slider:"Slider",rate:"Rate",upload:"fcUpload",cascader:"Cascader",colorPicker:"ColorPicker",timePicker:"TimePicker",datePicker:"DatePicker",switch:"iSwitch",select:"fcSelect",checkbox:"fcCheckbox",radio:"fcRadio",inputNumber:"InputNumber",input:"iInput",formItem:"FormItem",form:"iForm",frame:"fcFrame",col:"iCol",row:"row",tree:"fcTree",autoComplete:"AutoComplete",group:"fcGroup",subForm:"fcSubForm",object:"fcSubForm"},ht={resetBtnType:"default",resetBtnIcon:"md-refresh",infoIcon:"ios-information-circle-outline"};function mt(e,t){var n;S(e,t)&&(C.String(e[t])&&(e[t]=(s(n={},t,e[t]),s(n,"show",!0),n)))}function vt(e){return!1===e}var yt={validate:function(){var e=this.form();return e?new Promise(function(t,n){e.validate().then(function(e){e?t(!0):n(!1)})}):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){S(e,t)&&!C.Object(e[t])&&(e[t]={show:!!e[t]})}(e,t)}),e},tidyRule:function(e){var t=e.prop;return mt(t,"title"),mt(t,"info"),t},mergeProp:function(e){e.prop=K([{info:this.options.info||{},wrap:this.options.wrap||{},col:this.options.col||{},title:this.options.title||{}},e.prop],{info:{type:"poptip",trigger:"hover",placement:"top-start",wordWrap:!0,icon:ht.infoIcon},title:{},col:{span:24},wrap:{}},{normal:["title","info","col","wrap"]}),this.setSize(e.prop.props)},setSize:function(e){!e.size&&this.options.form.size&&(e.size=this.options.form.size)},getDefaultOptions:function(){return{form:{inline:!1,labelPosition:"right",labelWidth:125,showMessage:!0,autocomplete:"off",size:void 0},row:{gutter:0},submitBtn:{type:"primary",disabled:!1,innerText:"提交",loading:!1,show:!0,click:void 0},resetBtn:{type:ht.resetBtnType,disabled:!1,icon:ht.resetBtnIcon,innerText:"重置",loading:!1,show:!1,click:void 0}}},update:function(){var e=this.options.form;this.rule={props:l({},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;N(this.rule,{key:e,ref:t}),N(this.rule.props,{model:n.formData})},render:function(e){return e.length&&e.push(this.makeFormBtn()),this.$r(this.rule,vt(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,f=vt(n.wrap.show)?t:this.$r(K([n.wrap,{props:l(l({labelWidth:a},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||vt(s)||vt(i.show)?f:this.makeCol(n,r,[f])},isTitle:function(e){if(!1===this.options.form.title)return!1;var t=e.title;return!(!t.title&&!t.native||vt(t.show))},makeInfo:function(e,t,n){var r=e.title,i=e.info,o=this.getSlot("title"),a=[o?o({title:r.title||"",rule:n.rule,options:this.options}):r.title];if(!vt(i.show)&&(i.info||i.native)&&!vt(i.icon)){var u={type:i.type||"poptip",props:l({},i),key:"".concat(t,"pop"),slot:"label"};i.info&&!S(u.props,"content")&&(u.props.content=i.info),a["left"!==i.align?"unshift":"push"](this.$r(K([i,u]),[this.$r({type:"icon",props:{type:!0===i.icon?ht.infoIcon:i.icon,size:16},style:"margin-top: -1px",key:"".concat(t,"i")})]))}return this.$r(K([r,{props:r,slot:r.slot||"label",key:"".concat(t,"tit"),type:r.type||"span"}]),a)},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(vt(this.options.submitBtn.show)||e.push(this.makeSubmitBtn()),vt(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.setSize(t),this.$r({type:"button",props:t,style:{width:t.width,marginLeft:"15px"},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.setSize(t),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])}},gt={},bt=["upload","select","tree","checkbox","autoComplete","cascader","colorPicker","frame","inputNumber","radio","rate","timePicker","group"];!function(e){bt.forEach(function(t){e[t]=xe(t)}),e.auto=e.autoComplete,e.number=e.inputNumber,e.color=e.colorPicker}(gt),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]=xe("upload",function(e){return e.props({uploadType:t[n][0],maxLength:t[n][1]})}),e},e),e.uploadImage=e.image,e.uploadFile=e.file}(gt),function(e){var t={treeSelected:"selected",treeChecked:"checked"};Object.keys(t).reduce(function(e,n){return e[n]=xe("tree",{type:t[n]}),e},e)}(gt),function(e){e.selectMultiple=xe("select",{multiple:!0}),e.selectOne=xe("select",{multiple:!1})}(gt),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]=xe("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}(gt),function(e){e.time=xe("timePicker",{type:"time"}),e.timeRange=xe("timePicker",{type:"timerange"})}(gt);function $t(e,t){return C.Boolean(e)?e={show:e}:C.Undef(e)||C.Object(e)||(e={show:t}),e}function xt(e,t){return N(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(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=$t(t.options.submitBtn,!0);N(r,n),t.options.submitBtn=r,e.refreshOptions()},resetBtnProps:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=$t(t.options.resetBtn,!1);N(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();C.Function(n)?ge(function(){return n(u,o)}):(C.Function(t.options.onSubmit)&&ge(function(){return t.options.onSubmit(u,o)}),t.vm.$emit("submit",u,o))}else C.Function(r)&&ge(function(){return r.apply(void 0,[o].concat(v(i)))})})}}),e}function kt(e){e.componentAlias(dt),U.forEach(function(t){e.component(t.name,t)}),pt.forEach(function(t){e.parser(t)}),Object.keys(gt).forEach(function(t){e.maker[t]=gt[t]})}x(".form-create .form-create .ivu-form-item {\n margin-bottom: 24px;\n}\n\n.form-create .form-create .ivu-form-item .ivu-form-item {\n margin-bottom: 0px;\n}\n");var _t=ct({ui:"".concat("iview"),version:"".concat("2.5.37"),manager:yt,install:kt,extendApi:xt,attrs:{normal:["col","wrap"],array:["className"],key:["title","info"]}});"undefined"!=typeof window&&(window.formCreate=_t,window.Vue&&_t.install(window.Vue));var wt=_t.maker;e.default=_t,e.maker=wt,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=form-create.min.js.map