@form-create/iview 2.5.37 → 2.6.0-alpha.0

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