@form-create/element-ui 2.7.15 → 2.7.17
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.
- package/dist/form-create.esm.js +678 -649
- package/dist/form-create.js +4 -4
- package/dist/form-create.min.js +4 -4
- package/package.json +11 -11
- package/src/core/alias.js +1 -0
- package/src/parsers/index.js +2 -0
- package/src/parsers/textarea.js +11 -0
package/dist/form-create.min.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* FormCreate 低代码表单渲染器
|
|
3
|
-
* @form-create/element-ui v2.7.
|
|
3
|
+
* @form-create/element-ui v2.7.17
|
|
4
4
|
* (c) 2018-2025 xaboy
|
|
5
5
|
* Github https://github.com/xaboy/form-create
|
|
6
6
|
* Site https://form-create.com/
|
|
7
7
|
* Released under the MIT License.
|
|
8
8
|
*/
|
|
9
9
|
(function(){"use strict";try{if(typeof document!="undefined"){var o=document.createElement("style");o.appendChild(document.createTextNode('._fc-frame .fc-files img{width:100%;height:100%;display:inline-block;vertical-align:top}._fc-frame .fc-upload-btn{border:1px dashed #c0ccda;cursor:pointer}._fc-frame .fc-upload-cover{opacity:0;position:absolute;inset:0;background:#0009;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}._fc-frame .fc-upload-cover i{color:#fff;font-size:20px;cursor:pointer;margin:0 2px}._fc-frame .fc-files:hover .fc-upload-cover{opacity:1}._fc-frame .el-upload{display:block}._fc-frame .fc-upload-btn,.fc-files{display:inline-block;width:58px;height:58px;text-align:center;line-height:58px;border:1px solid #c0ccda;border-radius:4px;overflow:hidden;background:#fff;position:relative;-webkit-box-shadow:2px 2px 5px rgba(0,0,0,.1);box-shadow:2px 2px 5px #0000001a;margin-right:4px;-webkit-box-sizing:border-box;box-sizing:border-box}._fc-upload .fc-files img{width:100%;height:100%;display:inline-block;vertical-align:top}._fc-upload .fc-upload-btn{border:1px dashed #c0ccda;cursor:pointer}._fc-upload .fc-upload-cover{opacity:0;position:absolute;inset:0;background:#0009;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}._fc-upload .fc-upload-cover i{color:#fff;font-size:20px;cursor:pointer;margin:0 2px}._fc-upload .fc-files:hover .fc-upload-cover{opacity:1}._fc-upload .fc-upload-btn,._fc-upload .fc-files{display:inline-block;width:58px;height:58px;text-align:center;line-height:58px;border:1px solid #c0ccda;border-radius:4px;overflow:hidden;background:#fff;position:relative;-webkit-box-shadow:2px 2px 5px rgba(0,0,0,.1);box-shadow:2px 2px 5px #0000001a;margin-right:4px;-webkit-box-sizing:border-box;box-sizing:border-box}._fc-group{display:flex;min-height:42px;justify-content:center;flex-direction:column}._fc-group-disabled ._fc-group-btn,._fc-group-disabled ._fc-group-add{cursor:not-allowed}._fc-group-handle{display:flex;flex-direction:row;position:absolute;bottom:-15px;right:30px;border-radius:15px;border:1px dashed #d9d9d9;padding:3px 8px;background-color:#fff}._fc-group-btn{cursor:pointer}._fc-group-idx{position:absolute;bottom:-15px;left:10px;width:30px;height:30px;display:flex;align-items:center;justify-content:center;background:#eee;border-radius:15px;font-weight:700}._fc-group-handle ._fc-group-btn+._fc-group-btn{margin-left:7px}._fc-group-container{position:relative;display:flex;flex-direction:column;border:1px dashed #d9d9d9;padding:20px 20px 25px;margin:5px 5px 25px;border-radius:5px}._fc-group-arrow{position:relative;width:20px;height:20px}._fc-group-arrow:before{content:"";position:absolute;top:8px;left:5px;width:9px;height:9px;border-left:2px solid #999;border-top:2px solid #999}._fc-group-arrow:before{transform:rotate(45deg)}._fc-group-arrow._fc-group-down{transform:rotate(180deg)}._fc-group-plus-minus{width:20px;height:20px;position:relative;cursor:pointer}._fc-group-plus-minus:before,._fc-group-plus-minus:after{content:"";position:absolute;top:50%;left:50%;width:60%;height:2px;background-color:#409eff;transform:translate(-50%,-50%)}._fc-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-group-plus-minus._fc-group-minus:before{display:none}._fc-group-plus-minus._fc-group-minus:after{background-color:#f56c6c}._fc-group-add{cursor:pointer;width:25px;height:25px;border:1px solid rgb(64 158 255 / 50%);border-radius:15px}._fc-group-add._fc-group-plus-minus:before,._fc-group-add._fc-group-plus-minus:after{width:50%}.form-create .form-create .el-form-item{margin-bottom:22px}.form-create{width:100%}.fc-form-row{box-sizing:border-box;display:flex;flex-wrap:wrap;position:relative}.form-create.is-preview .fc-clock,.form-create .fc-none,.form-create.is-preview .el-form-item.is-required>.el-form-item__label-wrap>.el-form-item__label:before,.form-create.is-preview .el-form-item.is-required>.el-form-item__label:before{display:none!important}.fc-wrap-right>.el-form-item__label{display:flex;justify-content:flex-end}.fc-wrap-left>.el-form-item__label{display:flex;justify-content:flex-start}.fc-wrap-top.el-form-item{display:block}.fc-wrap-top.el-form-item>.el-form-item__label{display:block;height:auto;line-height:22px;margin-bottom:8px;text-align:left}.fc-wrap-top.el-form-item>.el-form-item__content{margin-left:0!important}.el-form--large .fc-wrap-top.el-form-item>.el-form-item__label{line-height:22px;margin-bottom:12px}.el-form--default .fc-wrap-top.el-form-item>.el-form-item__label{line-height:22px;margin-bottom:8px}.el-form--small .fc-wrap-top.el-form-item>.el-form-item__label{line-height:20px;margin-bottom:4px}.fc-form-footer{margin-top:12px}')),document.head.appendChild(o)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
10
|
-
(function(P,y){typeof exports=="object"&&typeof module!="undefined"?y(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],y):(P=typeof globalThis!="undefined"?globalThis:P||self,y(P.formCreate={},P.Vue))})(this,function(P,y){"use strict";var Ai=Object.defineProperty,Di=Object.defineProperties;var Ii=Object.getOwnPropertyDescriptors;var qt=Object.getOwnPropertySymbols;var Pi=Object.prototype.hasOwnProperty,Ti=Object.prototype.propertyIsEnumerable;var Ut=(P,y,N)=>y in P?Ai(P,y,{enumerable:!0,configurable:!0,writable:!0,value:N}):P[y]=N,_=(P,y)=>{for(var N in y||(y={}))Pi.call(y,N)&&Ut(P,N,y[N]);if(qt)for(var N of qt(y))Ti.call(y,N)&&Ut(P,N,y[N]);return P},G=(P,y)=>Di(P,Ii(y));function N(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Ae(){return Ae=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},Ae.apply(this,arguments)}var Ht=["attrs","props","domProps"],Gt=["class","style","directives"],xt=["on","nativeOn"],Jt=function(t){return t.reduce(function(e,r){for(var i in r)if(!e[i])e[i]=r[i];else if(Ht.indexOf(i)!==-1)e[i]=Ae({},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(xt.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]],l=r[i][o]instanceof Array?r[i][o]:[r[i][o]];e[i][o]=[].concat(a,l)}else e[i][o]=r[i][o];else if(i==="hook")for(var u in r[i])e[i][u]=e[i][u]?Kt(e[i][u],r[i][u]):r[i][u];else e[i]=r[i];return e},{})},Kt=function(t,e){return function(){t&&t.apply(this,arguments),e&&e.apply(this,arguments)}},Wt=Jt;const V=N(Wt);function De(t,e){return Object.keys(t).reduce((r,i)=>(r.push(t[i]),r),[])}const zt={name:"fcCheckbox",props:{formCreateInject:{type:Object,required:!0},value:{type:Array,default:()=>[]},type:String},watch:{"formCreateInject.options":{handler(){this.update()},deep:!0},value(){this.update()}},data(){return{trueValue:[]}},methods:{options(){const t=this.formCreateInject.options;return Array.isArray(t)?t:[]},onInput(t){this.$emit("input",this.options().filter(e=>t.indexOf(e.label)!==-1).map(e=>e.value).filter(e=>e!==void 0))},update(){const t=Array.isArray(this.value)?this.value:[this.value];this.trueValue=this.options().filter(e=>t.indexOf(e.value)!==-1).map(e=>e.label)}},created(){this.update()},render(){const t=arguments[0];return t("ElCheckboxGroup",V([{},this.formCreateInject.prop,{},{props:{value:this.trueValue}},{ref:"el",on:{input:this.onInput}}]),[this.options().map((e,r)=>{const i=_({},e),s=this.type==="button"?"ElCheckboxButton":"ElCheckbox";return delete i.value,t(s,V([{},{props:i},{key:s+r+"-"+e.value}]))}),De(this.$slots)])},mounted(){this.$emit("fc.el",this.$refs.el)}};function M(t){return Array.isArray(t)?t:[null,void 0,""].indexOf(t)>-1?[]:[t]}const Xt={name:"fcFrame",props:{formCreateInject:{type:Object,required:!0},type:{type:String,default:"input"},field:String,helper:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},src:{type:String,required:!0},icon:{type:String,default:"el-icon-upload2"},width:{type:String,default:"500px"},height:{type:String,default:"370px"},maxLength:{type:Number,default:0},okBtnText:{type:String,default:""},closeBtnText:{type:String,default:""},modalTitle:String,handleIcon:{type:[String,Boolean],default:void 0},title:String,allowRemove:{type:Boolean,default:!0},onOpen:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}},onCancel:{type:Function,default:()=>{}},onLoad:{type:Function,default:()=>{}},onBeforeRemove:{type:Function,default:()=>{}},onRemove:{type:Function,default:()=>{}},onHandle:{type:Function,default(t){this.previewImage=this.getSrc(t),this.previewVisible=!0}},modal:{type:Object,default:()=>({})},srcKey:{type:[String,Number]},value:[Array,String,Number,Object],previewMask:void 0,footer:{type:Boolean,default:!0},reload:{type:Boolean,default:!0},closeBtn:{type:Boolean,default:!0},okBtn:{type:Boolean,default:!0}},data(){return{fileList:M(this.value),previewVisible:!1,frameVisible:!1,previewImage:""}},watch:{value(t){this.fileList=M(t)},fileList(t){const e=this.maxLength===1?t[0]||"":t;this.$emit("input",e),this.$emit("change",e)},src(t){this.modalVm&&(this.modalVm.src=t)}},methods:{key(t){return t},closeModel(t){this.$emit(t?"$close":"$ok"),this.reload&&(this.$off("$ok"),this.$off("$close")),this.frameVisible=!1},handleCancel(){this.previewVisible=!1},showModel(){this.disabled||this.onOpen()===!1||(this.frameVisible=!0)},makeInput(){const t=this.$createElement,e={type:"text",value:this.fileList.map(r=>this.getSrc(r)).toString(),readonly:!0};return t("ElInput",V([{},{props:e},{key:this.key("input")}]),[this.fileList.length?t("i",{slot:"suffix",class:"el-input__icon el-icon-circle-close",on:{click:()=>this.fileList=[]}}):null,t("ElButton",V([{attrs:{icon:this.icon}},{on:{click:()=>this.showModel()}},{slot:"append"}]))])},makeGroup(t){const e=this.$createElement;return(!this.maxLength||this.fileList.length<this.maxLength)&&t.push(this.makeBtn()),e("div",{key:this.key("group")},[...t])},makeItem(t,e){const r=this.$createElement;return r("div",{class:"fc-files",key:this.key("file"+t)},[...e])},valid(t){const e=this.formCreateInject.field||this.field;if(e&&t!==e)throw new Error("[frame]无效的字段值")},makeIcons(t,e){const r=this.$createElement;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(t,e)),this.allowRemove&&i.push(this.makeRemoveIcon(t,e)),r("div",{class:"fc-upload-cover",key:this.key("uc")},[i])}},makeHandleIcon(t,e){const r=this.$createElement;return r("i",{class:this.handleIcon===!0||this.handleIcon===void 0?"el-icon-view":this.handleIcon,on:{click:()=>this.handleClick(t)},key:this.key("hi"+e)})},makeRemoveIcon(t,e){const r=this.$createElement;return r("i",{class:"el-icon-delete",on:{click:()=>this.handleRemove(t)},key:this.key("ri"+e)})},makeFiles(){const t=this.$createElement;return this.makeGroup(this.fileList.map((e,r)=>this.makeItem(r,[t("i",{class:"el-icon-tickets",on:{click:()=>this.handleClick(e)}}),this.makeIcons(e,r)])))},makeImages(){const t=this.$createElement;return this.makeGroup(this.fileList.map((e,r)=>this.makeItem(r,[t("img",{attrs:{src:this.getSrc(e)}}),this.makeIcons(e,r)])))},makeBtn(){const t=this.$createElement;return t("div",{class:"fc-upload-btn",on:{click:()=>this.showModel()},key:this.key("btn")},[t("i",{class:this.icon})])},handleClick(t){return this.onHandle(t)},handleRemove(t){this.disabled||this.onBeforeRemove(t)!==!1&&(this.fileList.splice(this.fileList.indexOf(t),1),this.onRemove(t))},getSrc(t){return this.srcKey?t[this.srcKey]:t},frameLoad(t){this.onLoad(t);try{this.helper===!0&&(t.form_create_helper={api:this.formCreateInject.api,close:e=>{this.valid(e),this.closeModel()},set:(e,r)=>{this.valid(e),this.disabled||this.$emit("input",r)},get:e=>(this.valid(e),this.value),onOk:e=>this.$on("$ok",e),onClose:e=>this.$on("$close",e)})}catch(e){console.log(e)}},makeFooter(){const t=this.$createElement,{okBtnText:e,closeBtnText:r,closeBtn:i,okBtn:s,footer:n}=this.$props;if(n)return t("div",{slot:"footer"},[i?t("ElButton",{on:{click:()=>this.onCancel()!==!1&&(this.frameVisible=!1)}},[r||this.formCreateInject.t("close")||"关闭"]):null,s?t("ElButton",{attrs:{type:"primary"},on:{click:()=>this.onOk()!==!1&&this.closeModel()}},[e||this.formCreateInject.t("ok")||"确定"]):null])}},render(){const t=arguments[0],e=this.type;let r;e==="input"?r=this.makeInput():e==="image"?r=this.makeImages():r=this.makeFiles();const{width:i="30%",height:s,src:n,title:o,modalTitle:a}=this.$props;return this.$nextTick(()=>{this.$refs.frame&&this.frameLoad(this.$refs.frame.contentWindow||{})}),t("div",{class:"_fc-frame"},[r,t("el-dialog",V([{},{props:{appendToBody:!0,modal:this.previewMask,title:a,visible:this.previewVisible}},{on:{close:this.handleCancel}}]),[t("img",{style:"width: 100%",attrs:{src:this.previewImage}})]),t("el-dialog",V([{},{props:G(_({width:i,title:o,appendToBody:!0},this.modal),{visible:this.frameVisible})},{on:{close:()=>this.closeModel(!0)}}]),[this.frameVisible||!this.reload?t("iframe",{ref:"frame",attrs:{src:n,frameBorder:"0"},style:{height:s,border:"0 none",width:"100%"}}):null,this.makeFooter()])])},mounted(){this.$on("fc.closeModal",this.closeModal)}},Zt={name:"fcRadio",props:{formCreateInject:{type:Object,required:!0},value:{},type:String},watch:{"formCreateInject.options":{handler(){this.update()},deep:!0},value(){this.update()}},data(){return{trueValue:[]}},methods:{options(){const t=this.formCreateInject.options;return Array.isArray(t)?t:[]},onInput(t){this.$emit("input",this.options().filter(e=>e.label===t).reduce((e,r)=>r.value,""))},update(){this.trueValue=this.options().filter(t=>t.value===this.value).reduce((t,e)=>e.label,"")}},created(){this.update()},render(){const t=arguments[0];return t("ElRadioGroup",V([{},this.formCreateInject.prop,{ref:"el"},{props:{value:this.trueValue}},{on:{input:this.onInput}}]),[this.options().map((e,r)=>{const i=_({},e),s=this.type==="button"?"ElRadioButton":"ElRadio";return delete i.value,t(s,V([{},{props:i},{key:s+r+"-"+e.value}]))}),De(this.$slots)])},mounted(){this.$emit("fc.el",this.$refs.el)}},h={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&&!h.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=>{h[t]=function(e){return h.type(e,t)}});function A(t,e){return{}.hasOwnProperty.call(t,e)}const Qt={name:"fcSelect",functional:!0,props:{formCreateInject:{type:Object,required:!0}},render(t,e){const r=(n,o)=>{const a=n.slot;return t("ElOption",V([{},{props:n},{key:""+o+"-"+n.value}]),[a?t("template",{slot:n.slotName||"default"},[h.Function(a)?n.slot(t):a]):null])},i=(n,o)=>t("ElOptionGroup",{attrs:{label:n.label},key:""+o+"-"+n.label},[h.trueArray(n.options)&&n.options.map((a,l)=>r(a,l))]),s=e.props.formCreateInject.options;return t("ElSelect",V([{},e.data,{ref:"el"}]),[(Array.isArray(s)?s:[]).map((n,o)=>A(n||"","options")?i(n,o):r(n,o)),e.children])},mounted(){this.$emit("fc.el",this.$refs.el)}},Yt={name:"fcTree",formCreateParser:{mergeProp(t){const e=t.prop.props;e.nodeKey||(e.nodeKey="id"),e.props||(e.props={label:"title"})}},props:{formCreateInject:{type:Object,required:!0},type:{type:String,default:"checked"},value:{type:[Array,String,Number],default:()=>[]}},watch:{value(){this.setValue()}},methods:{onChange(){this.updateValue()},updateValue(){if(!this.$refs.tree)return;const t=this.type.toLocaleLowerCase();let e;t==="selected"?e=this.$refs.tree.getCurrentKey():e=this.$refs.tree.getCheckedKeys(),this.$emit("input",e)},setValue(){this.type.toLocaleLowerCase()==="selected"?this.$refs.tree.setCurrentKey(this.value):this.$refs.tree.setCheckedKeys(M(this.value))}},render(){const t=arguments[0];return t("ElTree",V([{},this.formCreateInject.prop,{ref:"tree",on:{check:()=>this.updateValue(),"node-click":()=>this.updateValue()}}]),[De(this.$slots)])},mounted(){this.setValue(),this.$emit("fc.el",this.$refs.tree)}};function et(t,e){return typeof t=="object"?t:{url:t,is_string:!0,name:er(t),uid:e}}function tt(t){return G(_({},t),{file:t,value:t})}function er(t){return(""+t).split("/").pop()}const tr={name:"fcUpload",props:{formCreateInject:{type:Object,required:!0},onHandle:{type:Function,default(t){this.previewImage=t.url,this.previewVisible=!0}},uploadType:{type:String,default:"image"},limit:{type:Number,default:0},allowRemove:{type:Boolean,default:!0},previewMask:void 0,showFileList:Boolean,httpRequest:Function,modalTitle:String,listType:{type:String,default:"picture"},handleIcon:{type:[String,Boolean],default:()=>{}},uploadText:String,value:[Array,String]},data(){return{uploadList:[],previewVisible:!1,previewImage:"",cacheFiles:[]}},created(){this.formCreateInject.prop.props.showFileList===void 0&&(this.formCreateInject.prop.props.showFileList=!1),this.formCreateInject.prop.props.fileList=M(this.value).map(et).map(tt)},watch:{value(t){this.$refs.upload.uploadFiles.every(e=>!e.status||e.status==="success")&&(this.$refs.upload.uploadFiles=M(t).map(et).map(tt),this.uploadList=this.$refs.upload.uploadFiles)},limit(t,e){(e===1||t===1)&&this.update()}},methods:{key(t){return t},isDisabled(){return this.formCreateInject.prop.props.disabled===!0},onRemove(t){this.isDisabled()||this.$refs.upload.handleRemove(t)},handleClick(t){this.onHandle(t)},makeItem(t,e){const r=this.$createElement;return this.uploadType==="image"?r("img",{attrs:{src:t.url},key:this.key("img"+e)}):r("i",{class:"el-icon-tickets",key:this.key("i"+e)})},makeRemoveIcon(t,e){const r=this.$createElement;return r("i",{class:"el-icon-delete",on:{click:()=>this.onRemove(t)},key:this.key("ri"+e)})},makeHandleIcon(t,e){const r=this.$createElement;return r("i",{class:this.handleIcon===!0||this.handleIcon===void 0?"el-icon-view":this.handleIcon,on:{click:()=>this.handleClick(t)},key:this.key("hi"+e)})},makeProgress(t,e){const r=this.$createElement;return r("ElProgress",V([{},{props:{percentage:t.percentage,type:"circle",width:52}},{style:"margin-top:2px;",key:this.key("pg"+e)}]))},makeIcons(t,e){const r=this.$createElement,i=[];if(this.allowRemove||this.handleIcon!==!1)return(this.uploadType!=="file"&&this.handleIcon!==!1||this.uploadType==="file"&&this.handleIcon)&&i.push(this.makeHandleIcon(t,e)),this.allowRemove&&i.push(this.makeRemoveIcon(t,e)),r("div",{class:"fc-upload-cover"},[i])},makeFiles(){const t=this.$createElement;if(this.listType==="picture")return this.uploadList.map((e,r)=>this.$scopedSlots.fileList?this.$scopedSlots.fileList({file:e,index:r,vm:this}):t("div",{key:this.key(r),class:"fc-files"},[e.percentage!==void 0&&e.status!=="success"?this.makeProgress(e,r):[this.makeItem(e,r),this.makeIcons(e,r)]]))},makeDefaultSlot(){const t=this.$createElement;return this.listType==="picture"?t("div",{class:"fc-upload-btn"},[t("i",{class:"el-icon-upload2"})]):this.listType==="text"?t("ElButton",{attrs:{type:"primary"}},[this.formCreateInject.t("clickToUpload")||this.uploadText||"点击上传"]):t("i",{class:"el-icon-upload2"})},makeUpload(){const t=this.$createElement,e=!this.limit||this.limit>this.uploadList.length;return t("ElUpload",V([{},this.formCreateInject.prop,{},{props:{listType:this.listType,showFileList:this.listType!=="picture",httpRequest:this.doHttpRequest},style:{display:"inline-block"},key:this.key("upload"),ref:"upload"}]),[e?t("template",{slot:"default"},[this.$slots.default||this.makeDefaultSlot()]):null])},update(){let t=this.$refs.upload.uploadFiles.map(e=>e.is_string?e.url:e.value||e.url).filter(e=>e!==void 0);JSON.stringify(t)!==JSON.stringify(this.cacheFiles)&&(this.cacheFiles=[...t],this.$emit("input",this.limit===1?t[0]||"":t))},handleCancel(){this.previewVisible=!1},doHttpRequest(t){if(this.httpRequest)return this.httpRequest(t);t.source="upload",t.method="post",this.formCreateInject.api.fetch(t)}},render(){const t=arguments[0];return this.$refs.upload&&(this.formCreateInject.prop.props.fileList=this.$refs.upload.fileList),t("div",{class:"_fc-upload"},[[this.makeFiles(),this.makeUpload()],t("el-dialog",V([{},{props:{appendToBody:!0,modal:this.previewMask,title:this.modalTitle,visible:this.previewVisible}},{on:{close:this.handleCancel}}]),[t("img",{attrs:{alt:"example",src:this.previewImage},style:"width: 100%"})])])},mounted(){this.uploadList=this.$refs.upload.uploadFiles,this.$watch(()=>this.$refs.upload.uploadFiles,()=>{this.update()},{deep:!0}),this.$emit("fc.el",this.$refs.upload)}};function E(t,e,r){y.set(t,e,r)}function re(t,e){(y.del||y.delete)(t,e)}function ye(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))||h.Object(n)){let o=t[s]===void 0;if(i)i=!1,o&&E(t,s,[]);else if(n._clone&&r!==void 0)if(r)n=n.getRule(),o&&E(t,s,{});else{E(t,s,n._clone());continue}else o&&E(t,s,{});t[s]=ye(t[s],n,r)}else E(t,s,n),h.Undef(n)||(h.Undef(n.__json)||(t[s].__json=n.__json),h.Undef(n.__origin)||(t[s].__origin=n.__origin))}return r!==void 0&&Array.isArray(t)?t.filter(s=>!s||!s.__ctrl):t}function x(t){return ye({},{value:t}).value}const rr=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)&&E(t,i,e[i]);return t};function C(){return rr.apply(this,arguments)}function Ie(t){return typeof t!="object"||t===null?t:t instanceof Array?[...t]:_({},t)}const ir=[zt,Xt,Zt,Qt,Yt,tr,{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(()=>{ye(i.rule,t),i.$f.setValue(s)},!0);else{const n=i.$f.formData();i.$f.once("reloading",()=>{i.$f.setValue(n)}),i.rule=x(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&&A(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:_({},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?_({},this.options):{submitBtn:!1,resetBtn:!1};if(this.defaultValue){i.formData||(i.formData={});const s=x(this.defaultValue);C(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){if(this.disabled||this.onBeforeAdd(this.value)===!1)return;const e=[...this.value];e.push(this.defaultValue?x(this.defaultValue):this.field?null:{}),this.input(e)},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){const e=this.$createElement;return e("div",{class:"_fc-group-btn _fc-group-plus-minus",on:{click:this.add}})},delIcon(t,e){const r=this.$createElement;return r("div",{class:"_fc-group-btn _fc-group-plus-minus _fc-group-minus",on:{click:()=>this.del(t,e)}})},sortUpIcon(t){const e=this.$createElement;return e("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-up",on:{click:()=>this.changeSort(t,-1)}})},sortDownIcon(t){const e=this.$createElement;return e("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=arguments[0],e=this.sort,r=this.button,i=this.type,s=this.disabled,n=e.length===0?this.$scopedSlots.default?this.$scopedSlots.default({vm:this,add:this.add}):t("div",{key:"a_def",class:"_fc-group-plus-minus _fc-group-add fc-clock",on:{click:this.add}}):e.map((o,a)=>{const{rule:l,options:u}=this.cacheRule[o],c=r&&!s?this.makeIcon(e.length,a,o):[];return t("div",{class:"_fc-group-container",key:o},[t(i,V([{key:o},{on:{"update:value":p=>this.formData(o,p),"emit-event":(p,...d)=>this.emitEvent(p,d,a,o),input:p=>this.add$f(a,o,p)}},{},{props:{disabled:s,inFor:!0,value:this.field?{[this.field]:this._value(this.value[a])}:this.value[a],rule:l,option:u,extendOption:!0}}])),t("div",{class:"_fc-group-idx"},[a+1]),c.length?t("div",{class:"_fc-group-handle fc-clock"},[c]):null])});return t("div",{key:"con",class:"_fc-group "+(s?"_fc-group-disabled":"")},[n])}},{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=_({},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 t=arguments[0],{rule:e,options:r}=this.cacheRule,i=this.type;return t(i,V([{},{on:{"update:value":this.formData,"emit-event":this.emitEvent,input:this.add$f}},{},{props:{rule:e,option:r,disabled:this.disabled,extendOption:!0}}]))}}];function ie(t,e){var r=null;return function(...i){r!==null&&clearTimeout(r),r=setTimeout(()=>t.call(this,...i),e)}}function he(t){let e=t.replace(/([A-Z])/g,"-$1").toLocaleLowerCase();return e.indexOf("-")===0&&(e=e.substr(1)),e}function nr(t){return t.replace(t[0],t[0].toLocaleUpperCase())}const rt=["attrs","props","domProps","scopedSlots"],it=["class","style","directives"],nt=["on","nativeOn","hook"],Q=(t,e={},r={})=>{const i=[...rt,...r.normal||[]],s=[...it,...r.array||[]],n=[...nt,...r.functional||[]],o=r.props||[];return t.reduce((a,l)=>{for(const u in l)if(a[u])if(o.indexOf(u)>-1)a[u]=Q([l[u]],a[u]);else if(i.indexOf(u)>-1)a[u]=_(_({},a[u]),l[u]);else if(s.indexOf(u)>-1){const c=a[u]instanceof Array?a[u]:[a[u]],p=l[u]instanceof Array?l[u]:[l[u]];a[u]=[...c,...p]}else if(n.indexOf(u)>-1)for(const c in l[u])if(a[u][c]){const p=a[u][c]instanceof Array?a[u][c]:[a[u][c]],d=l[u][c]instanceof Array?l[u][c]:[l[u][c]];a[u][c]=[...p,...d]}else a[u][c]=l[u][c];else if(u==="hook")for(let c in l[u])a[u][c]?a[u][c]=sr(a[u][c],l[u][c]):a[u][c]=l[u][c];else a[u]=l[u];else i.indexOf(u)>-1||n.indexOf(u)>-1||o.indexOf(u)>-1?a[u]=_({},l[u]):s.indexOf(u)>-1?a[u]=l[u]instanceof Array?[...l[u]]:typeof l[u]=="object"?_({},l[u]):l[u]:a[u]=l[u];return a},e)},sr=(t,e)=>function(){t&&t.apply(this,arguments),e&&e.apply(this,arguments)},st=["type","slot","ignore","emitPrefix","value","name","native","hidden","display","inject","options","emit","nativeEmit","link","prefix","suffix","update","sync","optionsTo","key","slotUpdate","computed","preview","component","cache"],Pe=["validate","children","control"],Te=["effect","deep","renderSlots"];function ot(){return[...st,...rt,...it,...nt,...Pe,...Te]}function at(t,e,r){return`[form-create ${t}]: ${e}`}function Ve(t,e){console.error(at("err",t))}function or(t){Ve(t.toString()),console.error(t)}function lt(t){return t==null?"":typeof t=="object"?JSON.stringify(t,null,2):String(t)}const Be="[[FORM-CREATE-PREFIX-",Le="-FORM-CREATE-SUFFIX]]";function $e(t,e){return JSON.stringify(ye(Array.isArray(t)?[]:{},t,!0),function(r,i){if(!(i&&i._isVue===!0)){if(typeof i!="function")return i;if(i.__json)return i.__json;if(i.__origin&&(i=i.__origin),!i.__emit)return Be+i+Le}},e)}function Ne(t){return new Function("return "+t)()}function W(t,e){if(t&&h.String(t)&&t.length>4){let r=t.trim(),i=!1;try{if(r.indexOf(Le)>0&&r.indexOf(Be)===0)r=r.replace(Le,"").replace(Be,""),i=!0;else if(r.indexOf("$FN:")===0)r=r.substring(4),i=!0;else if(r.indexOf("$EXEC:")===0)r=r.substring(6),i=!0;else if(r.indexOf("$GLOBAL:")===0){const n=r.substring(8);return r=function(...o){const a=o[0].api.getGlobalEvent(n);if(a)return a.call(this,...o)},r.__json=t,r.__inject=!0,r}else{if(r.indexOf("$FNX:")===0)return r=Ne(`function($inject){
|
|
10
|
+
(function(P,y){typeof exports=="object"&&typeof module!="undefined"?y(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],y):(P=typeof globalThis!="undefined"?globalThis:P||self,y(P.formCreate={},P.Vue))})(this,function(P,y){"use strict";var Pi=Object.defineProperty,Ti=Object.defineProperties;var Vi=Object.getOwnPropertyDescriptors;var Ut=Object.getOwnPropertySymbols;var Bi=Object.prototype.hasOwnProperty,Li=Object.prototype.propertyIsEnumerable;var Ht=(P,y,M)=>y in P?Pi(P,y,{enumerable:!0,configurable:!0,writable:!0,value:M}):P[y]=M,_=(P,y)=>{for(var M in y||(y={}))Bi.call(y,M)&&Ht(P,M,y[M]);if(Ut)for(var M of Ut(y))Li.call(y,M)&&Ht(P,M,y[M]);return P},G=(P,y)=>Ti(P,Vi(y));function M(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function De(){return De=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},De.apply(this,arguments)}var Gt=["attrs","props","domProps"],xt=["class","style","directives"],Jt=["on","nativeOn"],Kt=function(t){return t.reduce(function(e,r){for(var i in r)if(!e[i])e[i]=r[i];else if(Gt.indexOf(i)!==-1)e[i]=De({},e[i],r[i]);else if(xt.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(Jt.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]],l=r[i][o]instanceof Array?r[i][o]:[r[i][o]];e[i][o]=[].concat(a,l)}else e[i][o]=r[i][o];else if(i==="hook")for(var u in r[i])e[i][u]=e[i][u]?Wt(e[i][u],r[i][u]):r[i][u];else e[i]=r[i];return e},{})},Wt=function(t,e){return function(){t&&t.apply(this,arguments),e&&e.apply(this,arguments)}},zt=Kt;const V=M(zt);function Ie(t,e){return Object.keys(t).reduce((r,i)=>(r.push(t[i]),r),[])}const Xt={name:"fcCheckbox",props:{formCreateInject:{type:Object,required:!0},value:{type:Array,default:()=>[]},type:String},watch:{"formCreateInject.options":{handler(){this.update()},deep:!0},value(){this.update()}},data(){return{trueValue:[]}},methods:{options(){const t=this.formCreateInject.options;return Array.isArray(t)?t:[]},onInput(t){this.$emit("input",this.options().filter(e=>t.indexOf(e.label)!==-1).map(e=>e.value).filter(e=>e!==void 0))},update(){const t=Array.isArray(this.value)?this.value:[this.value];this.trueValue=this.options().filter(e=>t.indexOf(e.value)!==-1).map(e=>e.label)}},created(){this.update()},render(){const t=arguments[0];return t("ElCheckboxGroup",V([{},this.formCreateInject.prop,{},{props:{value:this.trueValue}},{ref:"el",on:{input:this.onInput}}]),[this.options().map((e,r)=>{const i=_({},e),s=this.type==="button"?"ElCheckboxButton":"ElCheckbox";return delete i.value,t(s,V([{},{props:i},{key:s+r+"-"+e.value}]))}),Ie(this.$slots)])},mounted(){this.$emit("fc.el",this.$refs.el)}};function q(t){return Array.isArray(t)?t:[null,void 0,""].indexOf(t)>-1?[]:[t]}const Zt={name:"fcFrame",props:{formCreateInject:{type:Object,required:!0},type:{type:String,default:"input"},field:String,helper:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},src:{type:String,required:!0},icon:{type:String,default:"el-icon-upload2"},width:{type:String,default:"500px"},height:{type:String,default:"370px"},maxLength:{type:Number,default:0},okBtnText:{type:String,default:""},closeBtnText:{type:String,default:""},modalTitle:String,handleIcon:{type:[String,Boolean],default:void 0},title:String,allowRemove:{type:Boolean,default:!0},onOpen:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}},onCancel:{type:Function,default:()=>{}},onLoad:{type:Function,default:()=>{}},onBeforeRemove:{type:Function,default:()=>{}},onRemove:{type:Function,default:()=>{}},onHandle:{type:Function,default(t){this.previewImage=this.getSrc(t),this.previewVisible=!0}},modal:{type:Object,default:()=>({})},srcKey:{type:[String,Number]},value:[Array,String,Number,Object],previewMask:void 0,footer:{type:Boolean,default:!0},reload:{type:Boolean,default:!0},closeBtn:{type:Boolean,default:!0},okBtn:{type:Boolean,default:!0}},data(){return{fileList:q(this.value),previewVisible:!1,frameVisible:!1,previewImage:""}},watch:{value(t){this.fileList=q(t)},fileList(t){const e=this.maxLength===1?t[0]||"":t;this.$emit("input",e),this.$emit("change",e)},src(t){this.modalVm&&(this.modalVm.src=t)}},methods:{key(t){return t},closeModel(t){this.$emit(t?"$close":"$ok"),this.reload&&(this.$off("$ok"),this.$off("$close")),this.frameVisible=!1},handleCancel(){this.previewVisible=!1},showModel(){this.disabled||this.onOpen()===!1||(this.frameVisible=!0)},makeInput(){const t=this.$createElement,e={type:"text",value:this.fileList.map(r=>this.getSrc(r)).toString(),readonly:!0};return t("ElInput",V([{},{props:e},{key:this.key("input")}]),[this.fileList.length?t("i",{slot:"suffix",class:"el-input__icon el-icon-circle-close",on:{click:()=>this.fileList=[]}}):null,t("ElButton",V([{attrs:{icon:this.icon}},{on:{click:()=>this.showModel()}},{slot:"append"}]))])},makeGroup(t){const e=this.$createElement;return(!this.maxLength||this.fileList.length<this.maxLength)&&t.push(this.makeBtn()),e("div",{key:this.key("group")},[...t])},makeItem(t,e){const r=this.$createElement;return r("div",{class:"fc-files",key:this.key("file"+t)},[...e])},valid(t){const e=this.formCreateInject.field||this.field;if(e&&t!==e)throw new Error("[frame]无效的字段值")},makeIcons(t,e){const r=this.$createElement;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(t,e)),this.allowRemove&&i.push(this.makeRemoveIcon(t,e)),r("div",{class:"fc-upload-cover",key:this.key("uc")},[i])}},makeHandleIcon(t,e){const r=this.$createElement;return r("i",{class:this.handleIcon===!0||this.handleIcon===void 0?"el-icon-view":this.handleIcon,on:{click:()=>this.handleClick(t)},key:this.key("hi"+e)})},makeRemoveIcon(t,e){const r=this.$createElement;return r("i",{class:"el-icon-delete",on:{click:()=>this.handleRemove(t)},key:this.key("ri"+e)})},makeFiles(){const t=this.$createElement;return this.makeGroup(this.fileList.map((e,r)=>this.makeItem(r,[t("i",{class:"el-icon-tickets",on:{click:()=>this.handleClick(e)}}),this.makeIcons(e,r)])))},makeImages(){const t=this.$createElement;return this.makeGroup(this.fileList.map((e,r)=>this.makeItem(r,[t("img",{attrs:{src:this.getSrc(e)}}),this.makeIcons(e,r)])))},makeBtn(){const t=this.$createElement;return t("div",{class:"fc-upload-btn",on:{click:()=>this.showModel()},key:this.key("btn")},[t("i",{class:this.icon})])},handleClick(t){return this.onHandle(t)},handleRemove(t){this.disabled||this.onBeforeRemove(t)!==!1&&(this.fileList.splice(this.fileList.indexOf(t),1),this.onRemove(t))},getSrc(t){return this.srcKey?t[this.srcKey]:t},frameLoad(t){this.onLoad(t);try{this.helper===!0&&(t.form_create_helper={api:this.formCreateInject.api,close:e=>{this.valid(e),this.closeModel()},set:(e,r)=>{this.valid(e),this.disabled||this.$emit("input",r)},get:e=>(this.valid(e),this.value),onOk:e=>this.$on("$ok",e),onClose:e=>this.$on("$close",e)})}catch(e){console.log(e)}},makeFooter(){const t=this.$createElement,{okBtnText:e,closeBtnText:r,closeBtn:i,okBtn:s,footer:n}=this.$props;if(n)return t("div",{slot:"footer"},[i?t("ElButton",{on:{click:()=>this.onCancel()!==!1&&(this.frameVisible=!1)}},[r||this.formCreateInject.t("close")||"关闭"]):null,s?t("ElButton",{attrs:{type:"primary"},on:{click:()=>this.onOk()!==!1&&this.closeModel()}},[e||this.formCreateInject.t("ok")||"确定"]):null])}},render(){const t=arguments[0],e=this.type;let r;e==="input"?r=this.makeInput():e==="image"?r=this.makeImages():r=this.makeFiles();const{width:i="30%",height:s,src:n,title:o,modalTitle:a}=this.$props;return this.$nextTick(()=>{this.$refs.frame&&this.frameLoad(this.$refs.frame.contentWindow||{})}),t("div",{class:"_fc-frame"},[r,t("el-dialog",V([{},{props:{appendToBody:!0,modal:this.previewMask,title:a,visible:this.previewVisible}},{on:{close:this.handleCancel}}]),[t("img",{style:"width: 100%",attrs:{src:this.previewImage}})]),t("el-dialog",V([{},{props:G(_({width:i,title:o,appendToBody:!0},this.modal),{visible:this.frameVisible})},{on:{close:()=>this.closeModel(!0)}}]),[this.frameVisible||!this.reload?t("iframe",{ref:"frame",attrs:{src:n,frameBorder:"0"},style:{height:s,border:"0 none",width:"100%"}}):null,this.makeFooter()])])},mounted(){this.$on("fc.closeModal",this.closeModal)}},Qt={name:"fcRadio",props:{formCreateInject:{type:Object,required:!0},value:{},type:String},watch:{"formCreateInject.options":{handler(){this.update()},deep:!0},value(){this.update()}},data(){return{trueValue:[]}},methods:{options(){const t=this.formCreateInject.options;return Array.isArray(t)?t:[]},onInput(t){this.$emit("input",this.options().filter(e=>e.label===t).reduce((e,r)=>r.value,""))},update(){this.trueValue=this.options().filter(t=>t.value===this.value).reduce((t,e)=>e.label,"")}},created(){this.update()},render(){const t=arguments[0];return t("ElRadioGroup",V([{},this.formCreateInject.prop,{ref:"el"},{props:{value:this.trueValue}},{on:{input:this.onInput}}]),[this.options().map((e,r)=>{const i=_({},e),s=this.type==="button"?"ElRadioButton":"ElRadio";return delete i.value,t(s,V([{},{props:i},{key:s+r+"-"+e.value}]))}),Ie(this.$slots)])},mounted(){this.$emit("fc.el",this.$refs.el)}},h={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&&!h.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=>{h[t]=function(e){return h.type(e,t)}});function A(t,e){return{}.hasOwnProperty.call(t,e)}const Yt={name:"fcSelect",functional:!0,props:{formCreateInject:{type:Object,required:!0}},render(t,e){const r=(n,o)=>{const a=n.slot;return t("ElOption",V([{},{props:n},{key:""+o+"-"+n.value}]),[a?t("template",{slot:n.slotName||"default"},[h.Function(a)?n.slot(t):a]):null])},i=(n,o)=>t("ElOptionGroup",{attrs:{label:n.label},key:""+o+"-"+n.label},[h.trueArray(n.options)&&n.options.map((a,l)=>r(a,l))]),s=e.props.formCreateInject.options;return t("ElSelect",V([{},e.data,{ref:"el"}]),[(Array.isArray(s)?s:[]).map((n,o)=>A(n||"","options")?i(n,o):r(n,o)),e.children])},mounted(){this.$emit("fc.el",this.$refs.el)}},er={name:"fcTree",formCreateParser:{mergeProp(t){const e=t.prop.props;e.nodeKey||(e.nodeKey="id"),e.props||(e.props={label:"title"})}},props:{formCreateInject:{type:Object,required:!0},type:{type:String,default:"checked"},value:{type:[Array,String,Number],default:()=>[]}},watch:{value(){this.setValue()}},methods:{onChange(){this.updateValue()},updateValue(){if(!this.$refs.tree)return;const t=this.type.toLocaleLowerCase();let e;t==="selected"?e=this.$refs.tree.getCurrentKey():e=this.$refs.tree.getCheckedKeys(),this.$emit("input",e)},setValue(){this.type.toLocaleLowerCase()==="selected"?this.$refs.tree.setCurrentKey(this.value):this.$refs.tree.setCheckedKeys(q(this.value))}},render(){const t=arguments[0];return t("ElTree",V([{},this.formCreateInject.prop,{ref:"tree",on:{check:()=>this.updateValue(),"node-click":()=>this.updateValue()}}]),[Ie(this.$slots)])},mounted(){this.setValue(),this.$emit("fc.el",this.$refs.tree)}};function tt(t,e){return typeof t=="object"?t:{url:t,is_string:!0,name:tr(t),uid:e}}function rt(t){return G(_({},t),{file:t,value:t})}function tr(t){return(""+t).split("/").pop()}const rr={name:"fcUpload",props:{formCreateInject:{type:Object,required:!0},onHandle:{type:Function,default(t){this.previewImage=t.url,this.previewVisible=!0}},uploadType:{type:String,default:"image"},limit:{type:Number,default:0},allowRemove:{type:Boolean,default:!0},previewMask:void 0,showFileList:Boolean,httpRequest:Function,modalTitle:String,listType:{type:String,default:"picture"},handleIcon:{type:[String,Boolean],default:()=>{}},uploadText:String,value:[Array,String]},data(){return{uploadList:[],previewVisible:!1,previewImage:"",cacheFiles:[]}},created(){this.formCreateInject.prop.props.showFileList===void 0&&(this.formCreateInject.prop.props.showFileList=!1),this.formCreateInject.prop.props.fileList=q(this.value).map(tt).map(rt)},watch:{value(t){this.$refs.upload.uploadFiles.every(e=>!e.status||e.status==="success")&&(this.$refs.upload.uploadFiles=q(t).map(tt).map(rt),this.uploadList=this.$refs.upload.uploadFiles)},limit(t,e){(e===1||t===1)&&this.update()}},methods:{key(t){return t},isDisabled(){return this.formCreateInject.prop.props.disabled===!0},onRemove(t){this.isDisabled()||this.$refs.upload.handleRemove(t)},handleClick(t){this.onHandle(t)},makeItem(t,e){const r=this.$createElement;return this.uploadType==="image"?r("img",{attrs:{src:t.url},key:this.key("img"+e)}):r("i",{class:"el-icon-tickets",key:this.key("i"+e)})},makeRemoveIcon(t,e){const r=this.$createElement;return r("i",{class:"el-icon-delete",on:{click:()=>this.onRemove(t)},key:this.key("ri"+e)})},makeHandleIcon(t,e){const r=this.$createElement;return r("i",{class:this.handleIcon===!0||this.handleIcon===void 0?"el-icon-view":this.handleIcon,on:{click:()=>this.handleClick(t)},key:this.key("hi"+e)})},makeProgress(t,e){const r=this.$createElement;return r("ElProgress",V([{},{props:{percentage:t.percentage,type:"circle",width:52}},{style:"margin-top:2px;",key:this.key("pg"+e)}]))},makeIcons(t,e){const r=this.$createElement,i=[];if(this.allowRemove||this.handleIcon!==!1)return(this.uploadType!=="file"&&this.handleIcon!==!1||this.uploadType==="file"&&this.handleIcon)&&i.push(this.makeHandleIcon(t,e)),this.allowRemove&&i.push(this.makeRemoveIcon(t,e)),r("div",{class:"fc-upload-cover"},[i])},makeFiles(){const t=this.$createElement;if(this.listType==="picture")return this.uploadList.map((e,r)=>this.$scopedSlots.fileList?this.$scopedSlots.fileList({file:e,index:r,vm:this}):t("div",{key:this.key(r),class:"fc-files"},[e.percentage!==void 0&&e.status!=="success"?this.makeProgress(e,r):[this.makeItem(e,r),this.makeIcons(e,r)]]))},makeDefaultSlot(){const t=this.$createElement;return this.listType==="picture"?t("div",{class:"fc-upload-btn"},[t("i",{class:"el-icon-upload2"})]):this.listType==="text"?t("ElButton",{attrs:{type:"primary"}},[this.formCreateInject.t("clickToUpload")||this.uploadText||"点击上传"]):t("i",{class:"el-icon-upload2"})},makeUpload(){const t=this.$createElement,e=!this.limit||this.limit>this.uploadList.length;return t("ElUpload",V([{},this.formCreateInject.prop,{},{props:{listType:this.listType,showFileList:this.listType!=="picture",httpRequest:this.doHttpRequest},style:{display:"inline-block"},key:this.key("upload"),ref:"upload"}]),[e?t("template",{slot:"default"},[this.$slots.default||this.makeDefaultSlot()]):null])},update(){let t=this.$refs.upload.uploadFiles.map(e=>e.is_string?e.url:e.value||e.url).filter(e=>e!==void 0);JSON.stringify(t)!==JSON.stringify(this.cacheFiles)&&(this.cacheFiles=[...t],this.$emit("input",this.limit===1?t[0]||"":t))},handleCancel(){this.previewVisible=!1},doHttpRequest(t){if(this.httpRequest)return this.httpRequest(t);t.source="upload",t.method="post",this.formCreateInject.api.fetch(t)}},render(){const t=arguments[0];return this.$refs.upload&&(this.formCreateInject.prop.props.fileList=this.$refs.upload.fileList),t("div",{class:"_fc-upload"},[[this.makeFiles(),this.makeUpload()],t("el-dialog",V([{},{props:{appendToBody:!0,modal:this.previewMask,title:this.modalTitle,visible:this.previewVisible}},{on:{close:this.handleCancel}}]),[t("img",{attrs:{alt:"example",src:this.previewImage},style:"width: 100%"})])])},mounted(){this.uploadList=this.$refs.upload.uploadFiles,this.$watch(()=>this.$refs.upload.uploadFiles,()=>{this.update()},{deep:!0}),this.$emit("fc.el",this.$refs.upload)}};function F(t,e,r){y.set(t,e,r)}function re(t,e){(y.del||y.delete)(t,e)}function ye(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))||h.Object(n)){let o=t[s]===void 0;if(i)i=!1,o&&F(t,s,[]);else if(n._clone&&r!==void 0)if(r)n=n.getRule(),o&&F(t,s,{});else{F(t,s,n._clone());continue}else o&&F(t,s,{});t[s]=ye(t[s],n,r)}else F(t,s,n),h.Undef(n)||(h.Undef(n.__json)||(t[s].__json=n.__json),h.Undef(n.__origin)||(t[s].__origin=n.__origin))}return r!==void 0&&Array.isArray(t)?t.filter(s=>!s||!s.__ctrl):t}function x(t){return ye({},{value:t}).value}const ir=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)&&F(t,i,e[i]);return t};function C(){return ir.apply(this,arguments)}function Pe(t){return typeof t!="object"||t===null?t:t instanceof Array?[...t]:_({},t)}function ie(t,e){var r=null;return function(...i){r!==null&&clearTimeout(r),r=setTimeout(()=>t.call(this,...i),e)}}function it(t){return t==null?"":typeof t=="object"?JSON.stringify(t,null,2):String(t)}function nr(t){return t&&typeof t=="object"&&typeof t.then=="function"}function Ce(t){return nr(t)?t:Promise.resolve(t)}function de(t){let e=t.replace(/([A-Z])/g,"-$1").toLocaleLowerCase();return e.indexOf("-")===0&&(e=e.substr(1)),e}function sr(t){return t.replace(t[0],t[0].toLocaleUpperCase())}function nt(t,e,r){return`[form-create ${t}]: ${e}`}function Te(t,e){console.error(nt("err",t))}function or(t){Te(t.toString()),console.error(t)}const Ve="[[FORM-CREATE-PREFIX-",Be="-FORM-CREATE-SUFFIX]]";function $e(t,e){return JSON.stringify(ye(Array.isArray(t)?[]:{},t,!0),function(r,i){if(!(i&&i._isVue===!0)){if(typeof i!="function")return i;if(i.__json)return i.__json;if(i.__origin&&(i=i.__origin),!i.__emit)return Ve+i+Be}},e)}function Le(t){return new Function("return "+t)()}function W(t,e){if(t&&h.String(t)&&t.length>4){let r=t.trim(),i=!1;try{if(r.indexOf(Be)>0&&r.indexOf(Ve)===0)r=r.replace(Be,"").replace(Ve,""),i=!0;else if(r.indexOf("$FN:")===0)r=r.substring(4),i=!0;else if(r.indexOf("$EXEC:")===0)r=r.substring(6),i=!0;else if(r.indexOf("$GLOBAL:")===0){const n=r.substring(8);return r=function(...o){const a=o[0].api.getGlobalEvent(n);if(a)return a.call(this,...o)},r.__json=t,r.__inject=!0,r}else{if(r.indexOf("$FNX:")===0)return r=Le(`function($inject){
|
|
11
11
|
`+r.substring(5)+`
|
|
12
|
-
}`),r.__json=t,r.__inject=!0,r;(!e&&r.indexOf("function ")===0&&r!=="function "||!e&&r.indexOf("function(")===0&&r!=="function(")&&(i=!0)}if(!i)return t;let s;try{s=
|
|
12
|
+
}`),r.__json=t,r.__inject=!0,r;(!e&&r.indexOf("function ")===0&&r!=="function "||!e&&r.indexOf("function(")===0&&r!=="function(")&&(i=!0)}if(!i)return t;let s;try{s=Le(r)}catch(n){s=Le("function "+r)}return s.__json=t,s}catch(s){Te(`解析失败:${r}
|
|
13
13
|
|
|
14
|
-
err: ${s}`);return}}return t}function ut(t,e){return JSON.parse(t,function(r,i){return h.Undef(i)||!i.indexOf?i:W(i,e)})}let ar=0;function Ce(){const t=370+ ++ar;return"F"+Math.random().toString(36).substr(3,3)+(+`${Date.now()}`).toString(36)+t.toString(36)+"c"}function ne(t,e,r){let i=t,s;return(e||"").split(".").forEach(n=>{s&&((!i[s]||typeof i[s]!="object")&&E(i,s,{}),i=i[s]),s=n}),E(i,s,r),i}function Me(t,e){return{value:t,enumerable:!1,configurable:!1,writable:!!e}}function ct(t,e){return ft([t],e||!1)[0]}function ft(t,e){return ye([],[...t],e||!1)}function Y(t,e){return Q(Array.isArray(e)?e:[e],t,{array:Pe,normal:Te}),t}function ht(t){const e=h.Function(t.getRule)?t.getRule():t;return e.type||(e.type="input"),e}function lr(t,e){return t?(Object.keys(e||{}).forEach(r=>{e[r]&&(t[r]=Y(t[r]||{},e[r]))}),t):e}function dt(t,e){Object.defineProperties(t,Object.keys(e).reduce((r,i)=>(r[i]={get(){return e[i]()}},r),{}))}function ee(t){return t.__fc__||(t.__origin__?t.__origin__.__fc__:null)}function O(t,e){try{e=t()}catch(r){or(r)}return e}function qe(t,e){let r=null;return h.Function(t)?r=t():Array.isArray(t)?r=t.map(i=>qe(i,e)):r=t,r&&e&&M(r).forEach(i=>{(Array.isArray(i)?i:[i]).forEach(n=>{n&&typeof n=="object"&&(n.data||(n.data={}),(!n.data.slot||n.data.slot==="default")&&(n.data.slot=e||"default"))})}),r}function ur(t,e){if(h.Object(t)){const r={};return Object.keys(t).forEach(i=>{r[i]=qe(t[i],i)}),r}else return qe(t,e)}function we(){const t={},e=r=>r||"default";return{setSlot(r,i){r=e(r),!(!i||Array.isArray(i)&&i.length)&&(t[r]||(t[r]=[]),t[r].push(...Array.isArray(i)?i:[i]))},getSlot(r){r=e(r);const i=[];return(t[r]||[]).forEach(s=>{if(Array.isArray(s))i.push(...s);else if(h.Function(s)){const n=s();Array.isArray(n)?i.push(...n):i.push(n)}else h.Undef(s)||i.push(s)}),ur(i,r)},getSlots(){let r=[];return Object.keys(t).forEach(i=>{r=r.concat(this.getSlot(i)||[])}),r},slotLen(r){return r=e(r),t[r]?t[r].length:0},mergeBag(r){if(!r)return this;const i=h.Function(r.getSlots)?r.getSlots():r;return Array.isArray(r)||r.tag?this.setSlot(void 0,()=>r):Array.isArray(i)?this.setSlot(void 0,()=>i):Object.keys(i).forEach(s=>{this.setSlot(s,i[s])}),this}}}function ke(t,e){return Object.setPrototypeOf(t,e),t}const pt=(t,e)=>typeof t=="string"?String(e):typeof t=="number"?Number(e):e,ae={"==":(t,e)=>JSON.stringify(t)===JSON.stringify(pt(t,e)),"!=":(t,e)=>!ae["=="](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(pt(t[0],e))>-1},notOn(t,e){return!ae.on(t,e)},in(t,e){return e&&e.indexOf&&e.indexOf(t)>-1},notIn(t,e){return!ae.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 h.empty(t)},notEmpty(t){return!h.empty(t)},pattern(t,e){return new RegExp(e,"g").test(t)}};function L(t,e){return(Array.isArray(e)?e:(e||"").split(".")).forEach(r=>{t!=null&&(t=t[r])}),t}function cr(t){const e=/{{\s*(.*?)\s*}}/g;let r;const i={};for(;(r=e.exec(t))!==null;)r[1]&&(i[r[1]]=!0);return Object.keys(i)}function mt(t){let e=t.split("."),r=[],i="";return e.forEach((s,n)=>{n===0?i=s:i+="."+s,r.push(i)}),r.join(" && ")}function gt(t){const e=[];let r="",i=0;for(let s=0;s<t.length;s++){const n=t[s];n==="["?(i===0&&r&&(e.push({type:"key",value:r}),r=""),i++,r+=n):n==="]"?(i--,r+=n,i===0&&(e.push({type:"bracket",value:gt(r.slice(1,-1))}),r="")):n==="."&&i===0?r&&(e.push({type:"key",value:r}),r=""):r+=n}return r&&e.push({type:"key",value:r}),e.map(s=>s.type==="key"?{key:s.value}:{children:s.value})}const Oe=(t,e)=>{if(!(!t||t===e||!t.$props)){if(t.$props.formCreateInject)return t.$props.formCreateInject;if(t.$parent)return Oe(t.$parent,e)}};function fr(t,e,r){const i="FormCreate"+(t.isMobile?"Mobile":"");return{name:i,componentName:i,model:{prop:"api"},components:e,directives:r,provide(){return{$pfc:this}},inject:{$pfc:{default:null}},props:{rule:{type:Array,required:!0,default:()=>[]},option:{type:Object,default:()=>({})},extendOption:Boolean,driver:[String,Object],value:Object,disabled:{type:Boolean,default:void 0},preview:{type:Boolean,default:void 0},index:[String,Number],api:Object,locale:[String,Object],t:Function,name:String,subForm:{type:Boolean,default:!0},inFor:Boolean},render(){return this.fc.render()},setup(s){const n=y.getCurrentInstance().proxy;y.provide("parentFC",n);const o=y.inject("parentFC",null);let a=o;if(o)for(;a.parent;)a=a.parent;else a=n;const{rule:l,value:u,subForm:c,inFor:p}=y.toRefs(s),d=y.reactive({ctxInject:{},destroyed:!1,isShow:!0,unique:1,renderRule:[...l.value||[]],updateValue:JSON.stringify(u.value||{})}),g=new t(n),$=g.api(),w=p.value,F=()=>{if(o){const R=Oe(n,o);if(R){let S;w?(S=M(R.getSubForm()),S.push($)):S=$,R.subForm(S)}}},K=()=>{const R=Oe(n,o);if(R)if(w){const S=M(R.getSubForm()),H=S.indexOf($);H>-1&&S.splice(H,1)}else R.subForm()};let T=null;y.onBeforeMount(()=>{y.watch(()=>{let R="";const S=s.option&&s.option.globalClass||{};Object.keys(S).forEach(H=>{let me="";S[H].style&&Object.keys(S[H].style).forEach(X=>{me+=he(X)+":"+S[H].style[X]+";"}),S[H].content&&(me+=S[H].content+";"),me&&(R+=`.${H}{${me}}`)}),s.option&&s.option.style&&(R+=s.option.style),T||(T=document.createElement("style"),T.type="text/css",document.head.appendChild(T)),T.innerHTML=R||""},()=>{})});const U=ie(()=>{g.bus.$emit("$loadData.$topForm")},100),de=ie(function(){g.bus.$emit("$loadData.$scopeForm")},100),Ze=ie(()=>{g.bus.$emit("$loadData.$form")},100),pe=R=>{g.bus.$emit("change-$form."+R)};return y.onMounted(()=>{o&&($.top.bus.$on("$loadData.$form",U),$.top.bus.$on("change",pe)),$!==$.scope&&$.scope.bus.$on("$loadData.$scopeForm",de),g.mounted()}),y.onBeforeUnmount(()=>{o&&($.top.bus.$off("$loadData.$form",U),$.top.bus.$off("change",pe)),$!==$.scope&&$.scope.bus.$off("$loadData.$scopeForm",de),K(),d.destroyed=!0,g.unmount(),T&&(T.parentNode||T.parentElement)&&document.head.removeChild(T)}),y.onUpdated(()=>{g.updated()}),y.watch(c,R=>{R?F():K()},{immediate:!0}),y.watch(()=>s.option,()=>{g.initOptions(),$.refresh()},{deep:!0,flush:"sync"}),y.watch(()=>[...l.value],R=>{g.$handle.isBreakWatch()||R.length===d.renderRule.length&&R.every(S=>d.renderRule.indexOf(S)>-1)||(g.$handle.updateAppendData(),g.$handle.reloadRule(l.value),n.renderRule())}),y.watch(()=>[s.disabled,s.preview],()=>{$.refresh()}),y.watch(u,R=>{$e(R||{})!==d.updateValue&&($.config.forceCoverValue?$.coverValue(R||{}):$.setValue(R||{}))},{deep:!0,flush:"post"}),y.watch(()=>s.index,()=>{$.coverValue({}),g.$handle.updateAppendData(),y.nextTick(()=>{y.nextTick(()=>{$.clearValidateState()})})},{flush:"sync"}),G(_({fc:y.markRaw(g),parent:o&&y.markRaw(o),top:y.markRaw(a),fapi:y.markRaw($)},y.toRefs(d)),{getGroupInject:()=>Oe(n,o),refresh(){++d.unique},renderRule(){d.renderRule=[...l.value||[]]},updateValue(R){if(d.destroyed)return;const S=$e(R);d.updateValue!==S&&(d.updateValue=S,n.$emit("update:value",R),y.nextTick(()=>{Ze(),o?c.value||de():(U(),de())}))}})},created(){this.$emit("input",this.fapi),this.fc.init()}}}function yt(){return{props:{},on:{},options:[],children:[],effect:{},hidden:!1,display:!0,value:void 0}}function B(t,e){return(r,i,s,n={})=>{const o=new Ue(t,r,i,s,n);return e&&(h.Function(e)?e(o):o.props(e)),o}}function Ue(t,e,r,i,s){this._data=C(yt(),{type:t,title:e,field:r,value:i,props:s||{}}),this.event=this.on}C(Ue.prototype,{getRule(){return this._data},setProp(t,e){return E(this._data,t,e),this},_clone(){const t=new this.constructor;return t._data=ct(this._data),t}});function $t(t){t.forEach(e=>{Ue.prototype[e]=function(r){return Y(this._data,{[e]:arguments.length<2?r:{[r]:arguments[1]}}),this}})}$t(ot());const bt=B("");function hr(t,e,r){let i=bt("",e);return i._data.type=t,i._data.title=r,i}function vt(t,e,r,i){let s=bt("",r);return s._data.type="template",s._data.template=t,s._data.title=i,s._data.vm=e,s}function dr(){return{create:hr,createTmp:vt,template:vt,factory:B}}function pr(t,e,r){const i=`fail to ${t} ${r.status}'`,s=new Error(i);return s.status=r.status,s.url=t,s}function _t(t){const e=t.responseText||t.response;if(!e)return e;try{return JSON.parse(e)}catch(r){return e}}function Ct(t){if(typeof XMLHttpRequest=="undefined")return;const e=new XMLHttpRequest;let r=t.action||"";if(e.upload&&t.onProgress&&e.upload.addEventListener("progress",n=>{n.percent=n.total>0?n.loaded/n.total*100:0,t.onProgress(n)}),t.query){const n=new URLSearchParams(t.query).toString();n&&(r.includes("?")?r+=`&${n}`:r+=`?${n}`)}e.onerror=function(o){t.onError(o)},e.onload=function(){if(e.status<200||e.status>=300)return t.onError(pr(r,t,e),_t(e));t.onSuccess(_t(e))},e.open(t.method||"get",r,!0);let i;(t.data||t.file)&&(t.file||(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.file&&i.append(t.filename,t.file,t.file.name),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 wt(t,e,r){return new Promise((i,s)=>{(e||Ct)(G(_({},t),{onSuccess(n){let o=l=>l;const a=W(t.parse);h.Function(a)?o=a:a&&h.String(a)&&(o=l=>L(l,a)),i(o(n,void 0,r))},onError(n){s(n)}}))})}function be(t){return x(t)}function mr(t){function e(n){return h.Undef(n)?n=t.fields():Array.isArray(n)||(n=[n]),n}function r(n,o,a){h.Undef(n)?n=Object.keys(_(_({},t.fieldCtx),t.nameCtx)):Array.isArray(n)||(n=[n]),n.forEach(l=>{const u=t.fieldCtx[l]||t.nameCtx[l];u&&u.forEach(c=>{E(c.rule,o,a),t.$render.clearCache(c)})})}function i(){const n=t.subForm;return Object.keys(n).reduce((o,a)=>{const l=n[a];return l&&(Array.isArray(l)?o.push(...l):o.push(l)),o},[])}const s={get isScope(){return t.vm.$props.subForm===!1},get isPreview(){return t.preview},get config(){return t.options},set config(n){t.fc.options.value=n},get options(){return t.options},set options(n){t.fc.options.value=n},get form(){return t.form},get rule(){return t.rules},get parent(){return t.vm.parent&&t.vm.parent.fapi},get top(){return s.parent?s.parent.top:s},get scope(){let n=t.vm;for(;n&&n.fapi;)if(n.$props.subForm)n=n.parent;else return n.fapi;return s.top},get children(){return i()},get siblings(){const n=t.vm.getGroupInject();if(n){const o=n.getSubForm();if(Array.isArray(o))return[...o]}},get index(){const n=s.siblings;if(n){const o=n.indexOf(s);return o>-1?o:void 0}},get formulas(){return _({},t.fc.formulas)},formData(n){if(n==null||typeof n=="boolean"){const o={};return Object.keys(t.form).forEach(a=>{(n===!0||t.ignoreFields.indexOf(a)===-1)&&(o[a]=be(t.form[a]))}),o}else return e(n).reduce((o,a)=>(o[a]=s.getValue(a),o),{})},getValue(n){const o=t.getFieldCtx(n);return o?be(o.rule.value):t.options.appendValue!==!1&&A(t.appendData,n)?be(t.appendData[n]):void 0},coverValue(n){const o=_({},n||{});t.deferSyncValue(()=>{t.appendData={},s.fields().forEach(a=>{const l=t.fieldCtx[a];if(l){const u=A(n,a);l.forEach(c=>{E(c.rule,"value",u?n[a]:void 0)}),delete o[a]}}),C(t.appendData,o)},!0)},setValue(n){let o=n;arguments.length>=2&&(o={[n]:arguments[1]}),t.deferSyncValue(()=>{Object.keys(o).forEach(a=>{const l=t.fieldCtx[a];if(!l)return t.appendData[a]=o[a];l.forEach(u=>{E(u.rule,"value",o[a])})})},!0)},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&&ee(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 l=t.sort.length-1,u;const c=t.getCtx(o);if(c)if(a){if(u=c.getPending("children",c.rule.children),!Array.isArray(u))return;l=c.rule.children.length-1}else l=c.root.indexOf(c.origin),u=c.root;else u=t.rules;u.splice(l+1,0,n)},prepend:(n,o,a)=>{let l=0,u;const c=t.getCtx(o);if(c)if(a){if(u=c.getPending("children",c.rule.children),!Array.isArray(u))return}else l=c.root.indexOf(c.origin),u=c.root;else u=t.rules;u.splice(l,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(l=>{E(l.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 l=t.fieldCtx[a][0];return o[a]=n?l.origin:l.rule,o},{})},component(n){return Object.keys(t.nameCtx).reduce((o,a)=>{const l=t.nameCtx[a].map(u=>n?u.origin:u.rule);return o[a]=l.length===1?l[0]:l,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=h.Object(n)?ee(n):t.getCtxs(n);o&&(o=Array.isArray(o)?o:[o],o.forEach(a=>{if(!a.deleted){const l=t.subForm[a.id];l&&(Array.isArray(l)?l.forEach(u=>{u.refresh()}):l&&l.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=>{E(t.vm,"isShow",!n)},changeStatus:()=>t.changeStatus,clearChangeStatus:()=>{t.changeStatus=!1},updateRule(n,o){t.getCtxs(n).forEach(a=>{C(a.rule,o)})},updateRules(n){Object.keys(n).forEach(o=>{s.updateRule(o,n[o])})},mergeRule:(n,o)=>{t.getCtxs(n).forEach(a=>{Y(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},findType(n,o){let a;return Object.keys(t.ctxs).forEach(l=>{const u=t.ctxs[l];u.rule.type===n&&(a=o?u.origin:u.rule)}),a},findTypes(n,o){let a=[];return Object.keys(t.ctxs).forEach(l=>{const u=t.ctxs[l];u.rule.type===n&&a.push(o?u.origin:u.rule)}),a},getRenderRule:n=>{const o=t.getCtx(n);if(o)return o.prop},getRefRule:n=>{const o=t.getCtxs(n);if(o){const a=o.map(l=>l.rule);return a.length===1?a[0]:a}},setEffect(n,o,a){const l=t.getCtx(n);l&&o&&(o[0]==="$"&&(o=o.substr(1)),A(l.rule,"$"+o)&&E(l.rule,"$"+o,a),A(l.rule,"effect")||E(l.rule,"effect",{}),E(l.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(){s.refresh()},resetFields(n){e(n).forEach(o=>{t.getCtxs(o).forEach(a=>{t.$render.clearCache(a),a.rule.value=be(a.defaultValue)})}),y.nextTick(()=>{y.nextTick(()=>{y.nextTick(()=>{s.clearValidateState(n)})})}),n==null&&(h.Function(t.options.onReset)&&O(()=>t.options.onReset(s)),t.vm.$emit("reset",s))},method(n,o){const a=s.el(n);if(!a||!a[o])throw new Error(at("err",`${o} 方法不存在`));return(...l)=>a[o](...l)},exec(n,o,...a){return O(()=>s.method(n,o)(...a))},toJson(n){return $e(s.rule,n)},trigger(n,o,...a){const l=s.el(n);l&&l.$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},getChildrenRuleList(n){const o=typeof n=="object",a=o?ee(n):t.getCtx(n),l=a?a.rule:o?n:s.getRule(n);if(!l)return[];const u=[];return(p=>{p&&p.forEach(d=>{typeof d=="object"&&(d.field&&u.push(d),u.push(...s.getChildrenRuleList(d)))})})(a?a.loadChildrenPending():l.children),u},getParentRule(n){return(typeof n=="object"?ee(n):t.getCtx(n)).parent.rule},getParentSubRule(n){const a=typeof n=="object"?ee(n):t.getCtx(n);if(a){const l=a.getParentGroup();if(l)return l.rule}},getChildrenFormData(n,o){return s.getChildrenRuleList(n).reduce((l,u)=>((u.ignore!==!0||o===!0)&&(l[u.field]=be(u.value)),l),{})},setChildrenFormData(n,o,a){const l=s.getChildrenRuleList(n);t.deferSyncValue(()=>{l.forEach(u=>{A(o,u.field)?E(u,"value",o[u.field]):a&&E(u,"value",void 0)})})},getGlobalEvent(n){let o=s.options.globalEvent[n];if(o)return typeof o=="object"&&(o=o.handle),W(o)},getGlobalData(n){return new Promise((o,a)=>{let l=s.options.globalData[n];l?l.type==="fetch"?s.fetch(l).then(u=>{o(u)}).catch(a):o(l.data):o(t.fc.loadData[n])})},setGlobalData(n,o){s.setData("$globalData."+n,o)},setGlobalVar(n,o){s.setData("$var."+n,o)},renderRule(n,o,a){const u=typeof n=="object"?ee(n):t.getCtx(n);return u?t.$render.createRuleVnode(u,o,a):void 0},renderChildren(n,o,a){const u=typeof n=="object"?ee(n):t.getCtx(n);return u?t.$render.createChildrenVnodes(u,o,a):void 0},nextTick(n){t.bus.$once("next-tick",n),t.refresh()},nextRefresh(n){t.nextRefresh(),n&&O(n)},emit(n,...o){t.vm.$emit(n,...o)},deferSyncValue(n,o){t.deferSyncValue(n,o)},bus:t.bus,getCurrentFormRule(){var n;return(n=t.vm.getGroupInject())==null?void 0:n.rule},fetch(n){return new Promise((o,a)=>{n=x(n),n=t.loadFetchVar(n),t.beforeFetch(n).then(()=>wt(n,t.fc.create.fetch,s).then(l=>{O(()=>n.onSuccess&&n.onSuccess(l)),o(l)}).catch(l=>{O(()=>n.onError&&n.onError(l)),a(l)})).catch(l=>{})})},watchFetch(n,o,a,l){return t.fc.watchLoadData((u,c)=>{let p=x(n);p=t.loadFetchVar(p,u),!(l&&l(p,c)===!1)&&t.beforeFetch(p).then(()=>wt(p,t.fc.create.fetch,s).then(d=>{O(()=>p.onSuccess&&p.onSuccess(d)),o&&o(d,c)}).catch(d=>{O(()=>p.onError&&p.onError(d)),a&&a(d)})).catch(d=>{})},n.wait==null?1e3:n.wait)},getData(n,o){return t.fc.get?t.fc.get(n,o):t.fc.getLoadData(n,o)},setData(n,o,a){return t.fc.setData(n,o,a)},refreshData(n){return t.fc.refreshData(n)},t(n,o){return t.fc.t(n,o)},getLocale(){return t.fc.getLocale()},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 gr(t){C(t.prototype,{initCache(){this.clearCacheAll()},clearCache(e){if(!e.rule.cache){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(),this.cache[e.id].parent&&this.clearCache(this.cache[e.id].parent),this.cache[e.id]=null}},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 J(t){const e=t.replace(/(-[a-z])/g,function(r){return r.replace("-","").toLocaleUpperCase()});return kt(e)}function kt(t){return t.replace(t[0],t[0].toLowerCase())}function yr(t){C(t.prototype,{initRender(){this.cacheConfig={}},getTypeSlot(e){const r=i=>{if(i){let s;return e.rule.field&&(s=i.$scopedSlots["field-"+he(e.rule.field)]||i.$scopedSlots["field-"+e.rule.field]),s||(s=i.$scopedSlots["type-"+he(e.type)]||i.$scopedSlots["type-"+e.type]),s||r(i.$pfc)}};return r(this.vm)},render(){if(!this.vm.isShow)return;this.$manager.beforeRender();const e=we();return this.sort.forEach(r=>{this.renderSlot(e,this.$handle.ctxs[r])}),this.$manager.render(e)},renderSlot(e,r,i){this.isFragment(r)?(r.initProp(),this.mergeGlobal(r),r.initNone(),this.renderChildren(r.loadChildrenPending(),r,r.rule.slot).forEach(n=>{e.setSlot(r.rule.slot,n)})):e.setSlot(r.rule.slot,this.renderCtx(r,i))},mergeGlobal(e){this.$handle.options.global&&(this.cacheConfig[e.trueType]||(this.cacheConfig[e.trueType]=y.computed(()=>{const i=this.$handle.options.global;return Y({},[i["*"]||i.default||{},i[e.originType]||i[e.type]||i[e.type]||{}])})),e.prop=Y({},[this.cacheConfig[e.trueType].value,e.prop]))},setOptions(e){const r=e.loadPending({key:"options",origin:e.prop.options,def:[]});e.prop.options=r,e.prop.optionsTo&&r&&ne(e.prop,e.prop.optionsTo,r)},deepSet(e){const r=e.rule.deep;r&&Object.keys(r).sort((i,s)=>i.length<s.length?-1:1).forEach(i=>{ne(e.prop,i,r[i])})},parseSide(e,r){return h.Object(e)?Y({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))]},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){try{if(e.type==="hidden")return;const i=e.rule;if(this.force||!this.cache[e.id]||this.cache[e.id].slot!==i.slot){let s;e.initProp(),this.mergeGlobal(e),e.initNone(),this.$manager.tidyRule(e),this.deepSet(e),this.setOptions(e),this.ctxProp(e);let n=e.prop;n.preview=!!(n.preview!=null?n.preview:this.$handle.preview),n.props.formCreateInject=this.injectProp(e);let o=n.cache!==!1;const a=n.preview;if(n.hidden){this.setCache(e,void 0,r);return}s=(...l)=>{const u={rule:i,prop:n,preview:a,api:this.$handle.api,model:n.model||{},slotValue:l};l.length&&i.slotUpdate&&O(()=>i.slotUpdate(u));let c=[];const p=e.loadChildrenPending();e.parser.renderChildren?c=e.parser.renderChildren(p,e):e.parser.loadChildren!==!1&&(c=this.renderChildren(p,e)),Object.keys(n.renderSlots||{}).forEach($=>{c.push(this.renderRule({type:"template",slot:$},(()=>{if(h.Function(n.renderSlots[$]))return O(()=>n.renderSlots[$]());const w=this.parseSide(n.renderSlots[$],e);return this.renderRule(w)})()))});const d=this.getTypeSlot(e);let g;return d?(u.children=c,g=d(u)):g=a?e.parser.preview(Ie(c),e):e.parser.render(Ie(c),e),g=this.renderSides(g,e),!(!e.input&&h.Undef(n.native))&&n.native!==!0&&(this.fc.targetFormDriver("updateWrap",e),g=this.$manager.makeWrap(e,g)),e.none&&(Array.isArray(g)?g=g.map($=>!$||!$.tag?$:this.none($)):g=this.none(g)),o&&this.setCache(e,()=>this.stable(g),r),g},this.setCache(e,s,r)}return(...s)=>{const n=this.getCache(e);if(n)return n(...s);if(this.cache[e.id])return;const o=this.renderCtx(e,e.parent);if(o)return o()}}catch(i){console.error(i);return}},none(e){if(e)return e.data.class=this.mergeClass(e.data.class,"fc-none"),e},mergeClass(e,r){if(Array.isArray(e))e.push(r);else return e?[e,r]:r;return e},stable(e){return(Array.isArray(e)?e:[e]).forEach(i=>{i&&i.tag&&i.children&&typeof i.children=="object"&&(i.children.$stable=!0,this.stable(i.children))}),e},getModelField(e){return e.prop.modelField||e.parser.modelField||this.fc.modelFields[this.vNode.aliasMap[e.type]]||this.fc.modelFields[e.type]||this.fc.modelFields[e.originType]||"value"},isFragment(e){return e.type==="fragment"||e.type==="template"},injectProp(e){const r=this.vm;r.ctxInject[e.id]||(r.ctxInject[e.id]={api:this.$handle.api,form:this.fc.create,subForm:s=>{this.$handle.addSubForm(e,s)},getSubForm:()=>this.$handle.subForm[e.id],slots:()=>this.vm.top.$scopedSlots,getWrap:()=>this.vm.$refs[e.wrapRef],options:[],children:[],preview:!1,id:e.id,field:e.field,rule:e.rule,input:e.input,t:(...s)=>this.$handle.api.t(...s),updateValue:s=>{this.$handle.onUpdateValue(e,s)}});const i=r.ctxInject[e.id];return C(i,{preview:e.prop.preview,options:e.prop.options,prop:function(){const s=_({},e.prop);return s.on=s.on?_({},s.on):{},delete s.model,s}(),children:e.loadChildrenPending()}),i},ctxProp(e){const{ref:r,key:i,rule:s}=e;this.$manager.mergeProp(e),e.parser.mergeProp(e);const n=_({},e.prop.on||{}),o={};Object.keys(n).forEach(l=>{if(l.indexOf("native.")===0)o[l.replace("native.","")]=n[l],delete n[l];else if(this.$handle.options.transformEventName!==!1){const u=he(l);u!==l.toLowerCase()&&!n[u]&&(n[u]=n[l])}}),e.prop.on=n;const a=[{ref:r,key:s.key||`${i}fc`,slot:void 0,on:{"hook:mounted":()=>{this.onMounted(e)},"fc.updateValue":l=>{this.$handle.onUpdateValue(e,l)},"fc.el":l=>{e.exportEl=l,l&&((l.$el||l).__rule__=e.rule)}}},{nativeOn:o}];if(e.input){const l=this.tmpInput;this.vm.$props.disabled===!0&&(e.prop.props.disabled=!0),e.prop.model={value:this.$handle.getFormData(e),callback:u=>{l&&l(e.field,u,e.rule),this.onInput(e,u)},expression:`formData.${e.id}`},e.prop.modelEmit&&a.push({on:{[e.prop.modelEmit]:()=>this.onEmitInput(e)}})}return Q(a,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"),this.$handle.targetHook(e,"mounted")},onInput(e,r){if(e.prop.modelEmit){this.$handle.onBaseInput(e,r);return}this.$handle.onInput(e,r)},onEmitInput(e){this.$handle.setValue(e,e.parser.toValue(e.modelValue,e),e.modelValue)},renderChildren(e,r,i){if(!h.trueArray(e))return[];const s=we();return e.map(n=>{if(n){if(h.String(n))return s.setSlot(null,i?this.renderRule({type:"template",children:[n]}):n);if(n.__fc__)return this.renderSlot(s,n.__fc__,r);n.type&&y.nextTick(()=>{this.$handle.loadChildren(e,r),this.$handle.refresh()})}}),s.getSlots()},defaultRender(e,r){const i=e.prop;return i.component?typeof i.component=="string"?this.vNode.make(i.component,i,r):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(kt(i.type),i,r)},createChildrenVnodes(e,r,i){this.force=i!==!1,this.tmpInput=r;const s=this.renderChildren(e.rule.children,e);return this.force=!1,this.tmpInput=null,s},createRuleVnode(e,r,i){this.force=i!==!1,this.tmpInput=r;const s=we();return this.renderSlot(s,e,e.parent),this.force=!1,this.tmpInput=null,s.getSlots()},renderRule(e,r,i){if(!e)return;if(h.String(e))return e;let s;if(i)s=e.type;else if(s=e.is,e.type){s=J(e.type);const a=this.vNode.aliasMap[s];a&&(s=J(a))}if(!s)return;const n=we();h.trueArray(e.children)&&e.children.forEach(a=>{a&&n.setSlot(a==null?void 0:a.slot,()=>this.renderRule(a))});const o=_({},e);return delete o.type,delete o.is,this.vNode.make(s,o,n.mergeBag(r).getSlots())}})}let $r=1;function He(t){C(this,{$handle:t,fc:t.fc,vm:t.vm,$manager:t.$manager,vNode:new t.fc.CreateNode(t),force:!1,tmpInput:null,id:$r++}),dt(this,{options(){return t.options},sort(){return t.sort}}),this.initCache(),this.initRender()}gr(He),yr(He);function br(t){C(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(h.Function(r)&&(i!==!1&&!h.Undef(i)||r.__inject))return this.inject(e,r,i);if(!s&&Array.isArray(r)&&r[0]&&(h.String(r[0])||h.Function(r[0])))return this.parseEventLst(e,r,i,!0);if(h.String(r)){const n=W(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:l}=s,u=s[r?"emit":"nativeEmit"]||[];return h.trueArray(u)&&u.forEach(c=>{if(!c)return;let p,d=n||o||a;if(h.Object(c)&&(p=c.inject,c=c.name,d=c.prefix||d),d){r||(d=`native-${d}`);const g=he(`${d}-${c}`),$=(...w)=>{this.vm.$emit(g,...w),this.vm.$emit("emit-event",g,...w),this.bus.$emit(g,...w)};if($.__emit=!0,!p&&l===!1)i[c]=$;else{let w=p||l||this.options.injectEvent;i[c]=h.Undef(w)?$:this.inject(s,$,w)}}}),e.computed[r?"on":"nativeOn"]=i,i},getInjectData(e,r){const i=e.__fc__&&e.__fc__.$api,s=e.__fc__&&e.__fc__.$handle.vm||this.vm,{option:n,rule:o}=s.$props||s.$options.propsData;return{$f:i||this.api,api:i||this.api,rule:o,self:e.__origin__,option:n,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},loadStrVar(e,r,i){if(e&&typeof e=="string"&&e.indexOf("{{")>-1&&e.indexOf("}}")>-1){const s=e,n=cr(e),o=u=>{let c=!1,p;if(i&&u.indexOf("$form.")===0){const d=u.split(".");d.shift(),A(i.value,d[0])&&(c=!0,p=r?r({id:"$form."+d[0]+"_"+i.rule.__fc__.id,getValue:()=>L(i.value,d)}):L(i.value,d))}return c||(p=r?r(u):this.fc.getLoadData(u)),p},a=u=>{const c=[];u.forEach(d=>{d.key?c.push(d.key):d.children&&c.push(a(d.children))});let p=!1;return c.forEach((d,g)=>{d!=null&&(d.indexOf("'")===0||d.indexOf('"')===0)&&(c[g]=d.slice(1,-1),p=!0)}),c.length===1&&(p||!isNaN(Number(c[0])))?c[0]:o(c.join("."))};let l;if(n.forEach(u=>{const c=u.split("||"),p=c[0].trim();if(p){const d=(c[1]||"").trim(),g=gt(p);let $=O(()=>a(g));($==null||$==="")&&c.length>1&&($=d),l=$,e=e.replaceAll(`{{${u}}}`,$==null?"":$)}}),n.length===1&&s===`{{${n[0]}}}`)return l}return e},loadFetchVar(e,r,i){let s;i&&i.__fc__&&(s=i.__fc__.getParentGroup());const n=o=>this.loadStrVar(o,r,s?{rule:i,value:this.subRuleData[s.id]||{}}:null);return e.action=n(e.action||""),["headers","data","query"].forEach(o=>{if(e[o]){const a={};Object.keys(e[o]).forEach(l=>{a[n(l)]=n(e[o][l])}),e[o]=a}}),e}})}const Ot=["hook:updated","hook:mounted"];function vr(t){C(t.prototype,{usePage(){const e=this.options.page;if(!e)return;let r=25,i=_r(this.rules);h.Object(e)&&(e.first&&(r=parseInt(e.first,10)||r),e.limit&&(i=parseInt(e.limit,10)||i)),C(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(Ot,e),this.bus.$emit("page-end")):(this.first+=this.limit,this.pageEnd=this.rules.length<=this.first,this.loadRule(),this.refresh())};this.vm.$on(Ot,e)}})}function _r(t){return t.length<31?31:Math.ceil(t.length/3)}function Cr(t){C(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 wr(t){Object.defineProperties(t.origin,{__fc__:Me(y.markRaw(t),!0)}),t.rule!==t.origin&&Object.defineProperties(t.rule,{__fc__:Me(y.markRaw(t),!0)})}function Ft(t,e,r){const i=Ce(),s=!!e.field;C(this,{id:i,ref:i,wrapRef:i+"fi",rule:e,origin:e.__origin__||e,name:e.name,pending:{},none:!1,watch:[],linkOn:[],root:[],ctrlRule:[],children:[],parent:null,group:e.subRule?this:null,cacheConfig:null,prop:_({},e),computed:{},payload:{},refRule:{},input:s,el:void 0,exportEl:void 0,defaultValue:s?x(r):void 0,field:e.field||void 0}),this.updateKey(),wr(this),this.update(t,!0)}C(Ft.prototype,{getParentGroup(){let t=this.parent;for(;t;){if(t.group)return t;t=t.parent}},loadChildrenPending(){const t=this.rule.children||[];return Array.isArray(t)?t:this.loadPending({key:"children",origin:t,def:[],onLoad:e=>{this.$handle&&this.$handle.loadChildren(e,this)},onUpdate:(e,r)=>{this.$handle&&(e===r?this.$handle.loadChildren(e,this):this.$handle.updateChildren(this,e,r))},onReload:e=>{this.$handle?this.$handle.updateChildren(this,[],e):delete this.pending.children}})},loadPending(t){const{key:e,origin:r,def:i,onLoad:s,onReload:n,onUpdate:o}=t;if(this.pending[e]&&this.pending[e].origin===r)return this.getPending(e,i);delete this.pending[e];let a=r;if(h.Function(r)){let l=O(()=>r({rule:this.rule,api:this.$api,update:u=>{const c=u||i,p=this.getPending(e,i);this.setPending(e,r,c),o&&o(c,p)},reload:()=>{const u=this.getPending(e,i);delete this.pending[e],n&&n(u),this.$api&&this.$api.sync(this.rule)}}));l&&h.Function(l.then)?(l.then(u=>{const c=u||i;this.setPending(e,r,c),s&&s(c),this.$api&&this.$api.sync(this.rule)}).catch(u=>{console.error(u)}),a=i,this.setPending(e,r,a)):(a=l||i,this.setPending(e,r,a),s&&s(a))}return a},getPending(t,e){return this.pending[t]&&this.pending[t].value||e},setPending(t,e,r){this.pending[t]={origin:e,value:y.reactive(r)}},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=Ce(),t&&this.parent&&this.parent.updateKey(t)},updateType(){this.originType=this.rule.type,this.type=J(this.rule.type),this.trueType=this.$handle.getType(this.originType)},setParser(t){this.parser=t,t.init(this)},initProp(){var e,r;const t=_({},this.rule);delete t.children,delete t.validate,this.prop=Y({},[t,...Object.keys(this.payload).map(i=>this.payload[i]),this.computed]),this.prop.validate=[...((r=(e=this.refRule)==null?void 0:e.__$validate)==null?void 0:r.value)||[],...this.prop.validate||[]]},initNone(){this.none=!(h.Undef(this.prop.display)||this.prop.display)},hasHidden(){return!!this.rule.hidden||(this.parent?this.parent.hasHidden():!1)},injectValidate(){return this.prop.validate},check(t){return this.vm===t.vm},unwatch(){this.watch.forEach(t=>t()),this.watch=[],this.refRule={}},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(),this.parent&&this.parent.children.splice(this.parent.children.indexOf(this)>>>0,1),C(this,{deleted:!0,computed:{},parent:null,children:[],cacheConfig:null,none:!1})},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),C(this,{root:[]})},this.input)})},update(t,e){C(this,{deleted:!1,$handle:t,$render:t.$render,$api:t.api,vm:t.vm,vNode:t.$render.vNode,updated:!1,cacheValue:this.rule.value}),!e&&this.unwatch(),this.watchTo(),this.link(),this.updateType()}});function kr(t){C(t.prototype,{nextRefresh(e){const r=this.loadedId;y.nextTick(()=>{r===this.loadedId&&(e?e():this.refresh())})},parseRule(e){const r=ht(e);return Object.defineProperties(r,{__origin__:Me(e,!0)}),Or(r),this.appendValue(r),[r,r.prefix,r.suffix].forEach(i=>{i&&this.loadFn(i,r)}),this.loadCtrl(r),r.update&&(r.update=W(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=W(r.handle))})},syncProp(e){const r=e.rule;h.trueArray(r.sync)&&Q([{on:r.sync.reduce((i,s)=>(i[typeof s=="object"&&s.event||`update:${s}`]=n=>{r.props[typeof s=="object"&&s.prop||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.syncForm(),this.pageEnd&&this.bus.$emit("load-end"),this.vm.renderRule()})},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.syncForm(),this.bus.$emit("load-end"),this.$render.clearCache(r)},_loadRule(e,r){const i=o=>{let a=e[o-1];if(!a||!a.__fc__)return o>0?i(o-1):-1;let l=this.sort.indexOf(a.__fc__.id);return l>-1?l:i(o-1)},s=(o,a)=>{h.trueArray(o)&&this._loadRule(o,a)},n=e.map((o,a)=>{if(r&&!h.Object(o)||!this.pageEnd&&!r&&a>=this.first)return;if(o.__fc__&&o.__fc__.root===e&&this.ctxs[o.__fc__.id])return s(o.__fc__.loadChildrenPending(),o.__fc__),o.__fc__;let l=ht(o);const u=()=>!!(l.field&&this.fieldCtx[l.field]&&this.fieldCtx[l.field][0]!==o.__fc__);this.fc.targetFormDriver("loadRule",{rule:l,api:this.api},this.fc),this.ruleEffect(l,"init",{repeat:u()}),u()&&this.vm.$emit("repeat-field",o,this.api);let c,p=!1,d=!!o.__fc__,g=l.value;if(d){if(c=o.__fc__,g=c.defaultValue,c.deleted){if(Et(c))return;c.update(this)}else if(!c.check(this)){if(Et(c))return;e[a]=o=o._clone?o._clone():ut($e(o)),c=null,p=!0}}if(c)c.originType!==c.rule.type&&c.updateType(),this.bindParser(c),this.appendValue(c.rule),c.parent&&c.parent!==r&&this.rmSubRuleData(c);else{const F=this.parseRule(o);c=new Ft(this,F,g),this.bindParser(c)}[!1,!0].forEach(F=>this.parseEmit(c,F)),this.syncProp(c),c.parent=r||null,c.root=e,this.setCtx(c),!p&&!d&&(this.effect(c,"load"),this.targetHook(c,"load")),this.effect(c,"created");const $=c.loadChildrenPending();if(c.parser.loadChildren===!1||s($,c),!r){const F=i(a);F>-1||!a?this.sort.splice(F+1,0,c.id):this.sort.push(c.id)}const w=c.rule;return c.updated||(c.updated=!0,h.Function(w.update)&&this.bus.$once("load-end",()=>{this.refreshUpdate(c,w.value,"init")}),this.effect(c,"loaded")),this.refreshControl(c)&&(this.cycleLoad=!0),c}).filter(o=>!!o);r&&(r.children=n)},refreshControl(e){return e.input&&e.rule.control&&this.useCtrl(e)},useCtrl(e){const r=Fr(e),i=[],s=this.api;if(!r.length)return!1;for(let a=0;a<r.length;a++){const l=r[a],u=l.handle||function(p){return(ae[l.condition||"=="]||ae["=="])(p,l.value)};if(!h.trueArray(l.rule))continue;const c=G(_({},l),{valid:O(()=>u(e.rule.value,s)),ctrl:Er(e,l.rule),isHidden:h.String(l.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:l,rule:u,prepend:c,append:p,child:d,ctrl:g,method:$})=>{if(a){l?e.ctrlRule.push({__ctrl:!0,children:u,valid:l}):g&&e.ctrlRule.splice(e.ctrlRule.indexOf(g)>>>0,1),n[l?"push":"unshift"](()=>{$==="disabled"||$==="enabled"?this.api.disabled(!l,u):$==="display"||$==="show"?this.api.display(l,u):$==="required"?(u.forEach(w=>{this.api.setEffect(w,"required",l)}),l||this.api.clearValidateState(u)):$==="if"?this.api.hidden(!l,u):this.api.hidden(!l,u)});return}if(l){o=!0;const w={type:"fragment",native:!0,__ctrl:!0,children:u};e.ctrlRule.push(w),this.bus.$once("load-start",()=>{c?s.prepend(w,c,d):p||d?s.append(w,p||e.id,d):e.root.splice(e.root.indexOf(e.origin)+1,0,w)})}else{e.ctrlRule.splice(e.ctrlRule.indexOf(g),1);const w=ee(g);w&&w.rm()}})}),n.length&&(this.loading?n.length&&this.bus.$once("load-end",()=>{n.forEach(a=>a())}):n.length&&y.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=_({},this.ctxs);this.clearNextTick(),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.vm.$emit("update",this.api),this.bus.$off("next-tick",this.nextReload),this.bus.$once("next-tick",this.nextReload)},refresh(){this.vm.refresh()}})}function Or(t){const e=yt();return Object.keys(e).forEach(r=>{A(t,r)||E(t,r,e[r])}),t}function Fr(t){const e=t.rule.control||[];return h.Object(e)?[e]:e}function Er(t,e){for(let r=0;r<t.ctrlRule.length;r++){const i=t.ctrlRule[r];if(i.children===e)return i}}function Et(t){return!!t.rule.__ctrl}function Rr(t){C(t.prototype,{setValue(e,r,i,s){e.deleted||(e.rule.value=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.targetHook(e,"value",{value:r}),this.emitEvent("change",e.field,r,{rule:e.origin,api:this.api,setFlag:s||!1}),s&&y.nextTick(()=>{y.nextTick(()=>{y.nextTick(()=>{this.api.clearValidateState(e.id)})})}),this.$manager.fieldChange(e,r,i,s))},onInput(e,r){let i;e.input&&(this.isQuote(e,i=e.parser.toValue(r,e))||this.isChange(e,r))&&this.setValue(e,i,r)},onUpdateValue(e,r){this.deferSyncValue(()=>{const i=e.getParentGroup(),s=i?this.subRuleData[i.id]:null,n={};Object.keys(r||{}).forEach(o=>{s&&A(s,o)?n[o]=r[o]:A(this.api.form,o)?this.api.form[o]=r[o]:this.api.top!==this.api&&A(this.api.top.form,o)&&(this.api.top.form[o]=r[o])}),Object.keys(n).length&&this.api.setChildrenFormData(i.rule,n)})},onBaseInput(e,r){this.setFormData(e,r),e.modelValue=r,this.nextRefresh(),this.$render.clearCache(e)},setFormData(e,r){e.modelValue=r;const i=e.getParentGroup();i&&(this.subRuleData[i.id]||E(this.subRuleData,i.id,{}),E(this.subRuleData[i.id],e.field,e.rule.value)),E(this.formData,e.id,r)},rmSubRuleData(e){const r=e.getParentGroup();r&&this.subRuleData[r.id]&&re(this.subRuleData[r.id],e.field)},getFormData(e){return this.formData[e.id]},syncForm(){const e={},r=this.fields(),i=[];this.options.appendValue!==!1&&Object.keys(this.appendData).reduce((s,n)=>(r.indexOf(n)===-1&&(s[n]=y.toRef(this.appendData,n)),s),e),r.reduce((s,n)=>{let o=(this.fieldCtx[n]||[]).filter(a=>!this.isIgnore(a))[0];return o||(o=this.fieldCtx[n][0],i.push(n)),s[n]=y.toRef(o.rule,"value"),s},e),this.form=y.reactive(e),this.ignoreFields=i,this.syncValue()},isIgnore(e){return e.rule.ignore===!0||(e.rule.ignore==="hidden"||this.options.ignoreHiddenFields)&&e.hasHidden()},appendValue(e){(!e.field||!A(this.appendData,e.field))&&!this.options.forceCoverValue||(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),O(e),this.deferSyncFn===e&&(this.deferSyncFn=null,e.sync&&this.syncForm())},syncValue(){if(this.deferSyncFn)return this.deferSyncFn.sync=!0;const e={};Object.keys(this.form).forEach(r=>{this.ignoreFields.indexOf(r)===-1&&(e[r]=this.form[r])}),this.vm.updateValue(e)},isChange(e,r){return JSON.stringify(this.getFormData(e),Rt)!==JSON.stringify(r,Rt)},isQuote(e,r){return(r instanceof Function||h.Object(r)||Array.isArray(r))&&r===e.rule.value},refreshUpdate(e,r,i,s){if(h.Function(e.rule.update)){const n=O(()=>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;h.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 Rt(t,e){return typeof e=="function"?""+e:e}const Fe={init(t){},toFormValue(t,e){return t},toValue(t,e){return t},mounted(t){},render(t,e){return e.$handle.fc.renderDriver&&e.$handle.fc.renderDriver.defaultRender?e.$handle.fc.renderDriver.defaultRender(e,t):e.$render.defaultRender(e,t)},preview(t,e){return e.$handle.fc.renderDriver&&e.$handle.fc.renderDriver.defaultPreview?e.$handle.fc.renderDriver.defaultPreview(e,t):this.render(t,e)},mergeProp(t){}},Sr=["field","value","vm","template","name","config","control","inject","sync","payload","optionsTo","update","slotUpdate","computed","component","cache"],ve=Symbol("oldValue");function jr(t){C(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,i=this.fc.renderDriver;if(i){const s=i.parsers||{},n=s[e.originType]||s[J(e.type)]||s[e.trueType];if(n)return n}return r[e.originType]||r[J(e.type)]||r[e.trueType]||Fe},bindParser(e){e.setParser(this.getParser(e))},getType(e){const r=this.fc.CreateNode.aliasMap,i=r[e]||r[J(e)]||e;return J(i)},noWatch(e){this.noWatchFn||(this.noWatchFn=e),O(e),this.noWatchFn===e&&(this.noWatchFn=null)},watchCtx(e){if(ot().filter(i=>i[0]!=="_"&&i[0]!=="$"&&Sr.indexOf(i)===-1).forEach(i=>{const s=y.toRef(e.rule,i),n=i==="children";e.refRule[i]=s,e.watch.push(y.watch(n?()=>h.Function(s.value)?s.value:[...s.value||[]]:()=>s.value,(o,a)=>{let l=s.value;if(!this.isBreakWatch()){if(n&&e.parser.loadChildren===!1){this.$render.clearCache(e),this.nextRefresh();return}if(this.watching=!0,y.nextTick(()=>{this.targetHook(e,"watch",{key:i,oldValue:a,newValue:l})}),i==="hidden"&&!!l!=!!a&&(this.$render.clearCacheAll(),y.nextTick(()=>{this.targetHook(e,"hidden",{value:l})})),i==="ignore"&&e.input||i==="hidden"&&e.input&&(e.rule.ignore==="hidden"||this.options.ignoreHiddenFields))this.syncForm();else if(i==="link"){e.link();return}else["props","on","nativeOn","deep"].indexOf(i)>-1?(this.parseInjectEvent(e.rule,l||{}),i==="props"&&e.input&&this.setFormData(e,e.parser.toFormValue(e.rule.value,e))):["emit","nativeEmit"].indexOf(i)>-1?this.parseEmit(e,i==="emit"):["prefix","suffix"].indexOf(i)>-1?l&&this.loadFn(l,e.rule):i==="type"?(e.updateType(),this.bindParser(e)):n&&(h.Function(a)&&(a=e.getPending("children",[])),h.Function(l)&&(l=e.loadChildrenPending()),this.updateChildren(e,l,a));this.$render.clearCache(e),this.refresh(),this.watching=!1}},{deep:!n,sync:n}))}),e.refRule.__$title=y.computed(()=>{let i=(typeof e.rule.title=="object"?e.rule.title.title:e.rule.title)||"";if(i){const s=i.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);s&&(i=this.api.t(s[1]))}return i}),e.refRule.__$info=y.computed(()=>{let i=(typeof e.rule.info=="object"?e.rule.info.info:e.rule.info)||"";if(i){const s=i.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);s&&(i=this.api.t(s[1]))}return i}),e.refRule.__$validate=y.computed(()=>{const i=s=>{var o,a;const n=s.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);return n?this.api.t(n[1],{title:(a=(o=e.refRule)==null?void 0:o.__$title)==null?void 0:a.value}):s};return M(e.rule.validate).map(s=>{const n=_({},s);if(n.message&&(n.message=i(n.message)),h.Function(n.validator)){const o=e;n.validator=function(...a){return s.validator.call({that:this,id:o.id,field:o.field,rule:o.rule,api:o.$handle.api},...a)}}if(n.adapter){if(typeof n.error=="object"){const o=_({},n.error);Object.keys(o).forEach(a=>{o[a]=i(o[a])}),n.error=o}return this.adapterValidate(n,e)}return n})}),e.input){const i=y.toRef(e.rule,"value");e.watch.push(y.watch(()=>i.value,()=>{let s=e.parser.toFormValue(i.value,e);this.isChange(e,s)&&this.setValue(e,i.value,s,!0)}))}this.bus.$once("load-end",()=>{let i=e.rule.computed;i&&(typeof i!="object"&&(i={value:i}),Object.keys(i).forEach(s=>{const n=y.computed(()=>{const a=i[s];if(!a)return;const l=this.compute(e,a);return(a.linkage||a.linkageVariable)&&l===ve?ve:l}),o=a=>{s==="value"?this.onInput(e,a):s[0]==="$"?this.api.setEffect(e.id,s,a):ne(e.rule,s,a)};(s==="value"?[void 0,null,""].indexOf(e.rule.value)>-1:n.value!==L(e.rule,s))&&o(n.value),e.watch.push(y.watch(n,(a,l)=>{a===ve||a===l||setTimeout(()=>{o(a)})},{deep:!0}))}))}),this.watchEffect(e)},adapterValidate(e,r){const i=(s,n)=>{if((e.beforeValidate&&O(()=>e.beforeValidate({value:s,api:this.api,validate:e,rule:r.rule})))===!1)n();else{const a=this.validator(r,s,e);if(a){let l="";typeof e.error=="object"&&(l=e.error[a]||e.error.default),!l&&typeof e.message=="string"&&(l=e.message),l||(l=this.getValidateMessage(r,{key:a,rule:e[a]})),n(l)}else if(e.validator){const l=e.validator&&O(()=>e.validator(s,n));l&&h.Function(l.then)&&l.then(()=>n()).catch(u=>n(u))}else n()}};return this.$manager.adapterValidate({required:e.required,message:e.message,target:e.trigger},i)},getValidateMessage(e,r){var s,n;const i=Array.isArray(r.rule)?r.rule.join(","):""+r.rule;return this.api.t(r.key==="required"?r.key:"validate."+r.key,{[r.key]:i,title:(n=(s=e.refRule)==null?void 0:s.__$title)==null?void 0:n.value})},validator(e,r,i){if(h.empty(r))return i.required?"required":void 0;for(const[n,o]of Object.entries(i))switch(n){case"len":case"maxLen":case"minLen":const a=$=>n==="len"?$===o:n==="maxLen"?$<=o:$>=o;if(Array.isArray(r)){if(!a(r.length))return n}else{if(typeof r=="object")return n;if(!a((""+r).length))return n}break;case"pattern":if(!(typeof o=="string"?new RegExp(o):o).test(""+r))return n;break;case"uppercase":if(o&&(typeof r!="string"||!/^[A-Z]*$/.test(r)))return n;break;case"lowercase":if(o&&(typeof r!="string"||!/^[a-z]*$/.test(r)))return n;break;case"min":case"max":case"positive":case"negative":case"integer":case"number":const u=Number(r);if(Number.isNaN(u)||n==="min"&&u<o||n==="max"&&u>o||n==="positive"&&u<=0||n==="negative"&&u>=0||n==="integer"&&!Number.isInteger(u))return n;break;case"equal":if(r!==o)return n;break;case"enum":if(Array.isArray(o)&&!o.includes(r))return n;break;case"hasKeys":if(typeof r!="object"||Array.isArray(o)&&o.some($=>!($ in r)))return n;break;case"email":if(!/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(""+r))return n;break;case"url":if(!new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$","i").test(""+r))return n;break;case"ip":if(!/^(2(5[0-5]{1}|[0-4]\d{1})|[0-1]?\d{1,2})(\.(2(5[0-5]{1}|[0-4]\d{1})|[0-1]?\d{1,2})){3}$/.test(""+r))return n;break;case"phone":if(!/^(?:(?:\+|00)86)?1[3-9]\d{9}$/.test(""+r))return n;break;case"computed":if(!this.compute(e,o))return n;break}},compute(e,r){let i;if(typeof r=="object"){const s=e.getParentGroup(),n=a=>{if(a=Array.isArray(a)?{mode:"AND",group:a}:a,!h.trueArray(a.group))return!0;const l=a.mode==="OR";let u=!0;for(let c=0;c<a.group.length;c++){const p=a.group[c];let d,g=null;if(p.variable)g=JSON.stringify(this.fc.getLoadData(p.variable))||"";else if(p.field)g=mt(p.field||"");else if(!p.mode)return!0;let $=p.compare;if($&&($=mt($||"")),p.mode?d=n(p):ae[p.condition]?h.Function(p.handler)?d=O(()=>p.handler(this.api,e.rule)):d=O(()=>new Function("$condition","$val","$form","$scope","$group","$rule",`with($form){with($scope){with(this){with($group){ return $condition['${p.condition}'](${g}, ${$||"$val"}); }}}}`).call(this.api.form,ae,p.value,this.api.top.form,this.api.top===this.api.scope?{}:this.api.scope.form,s?this.subRuleData[s.id]||{}:{},e.rule)):d=!1,l&&d)return!0;l||(u=u&&d)}return l?!1:u};let o=n(r);return o=r.invert===!0?!o:o,r.linkage?o?O(()=>this.computeValue(r.linkage,e,s),void 0):ve:r.linkageVariable?o?O(()=>this.fc.getLoadData(r.linkageVariable),void 0):ve:o}else if(h.Function(r))i=()=>r(this.api.form,this.api);else{const s=e.getParentGroup();i=()=>this.computeValue(r,e,s)}return O(i,void 0)},computeValue(e,r,i){const s=this,n=Object.keys(this.fc.formulas).reduce((o,a)=>(o[a]=function(...l){return s.fc.formulas[a].call({that:this,rule:r.rule,api:s.api,fc:s.fc},...l)},o),{});return O(()=>new Function("$formulas","$form","$scope","$group","$rule","$api",`with($form){with($scope){with(this){with($group){with($formulas){ return ${e} }}}}}`).call(this.api.form,n,this.api.top.form,this.api.top===this.api.scope?{}:this.api.scope.form,i?this.subRuleData[i.id]||{}:{},r.rule,this.api))},updateChildren(e,r,i){this.deferSyncValue(()=>{i&&i.forEach(s=>{(r||[]).indexOf(s)===-1&&s&&!h.String(s)&&s.__fc__&&s.__fc__.parent===e&&this.rmCtx(s.__fc__)}),h.trueArray(r)&&(this.loadChildren(r,e),this.bus.$emit("update",this.api))})},rmSub(e){h.trueArray(e)&&e.forEach(r=>{r&&r.__fc__&&this.rmCtx(r.__fc__)})},rmCtx(e){if(e.deleted)return;const{id:r,field:i,input:s,name:n}=e;re(this.ctxs,r),re(this.formData,r),re(this.subForm,r),re(this.vm.ctxInject,r);const o=e.getParentGroup();o&&this.subRuleData[o.id]&&re(this.subRuleData[o.id],i),e.group&&re(this.subRuleData,r),s&&this.rmIdCtx(e,i,"field"),n&&this.rmIdCtx(e,n,"name"),s&&!A(this.fieldCtx,i)&&re(this.form,i),this.deferSyncValue(()=>{if(!this.reloading){if(e.parser.loadChildren!==!1){const l=e.getPending("children",e.rule.children);h.trueArray(l)&&l.forEach(u=>u&&u.__fc__&&this.rmCtx(u.__fc__))}e.root===this.rules&&this.vm.renderRule()}},s);const a=this.sort.indexOf(r);return a>-1&&this.sort.splice(a,1),this.$render.clearCache(e),e.delete(),this.effect(e,"deleted"),this.targetHook(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 Ar(t){C(t.prototype,{mounted(){const e=()=>{this.isMounted=!0,this.lifecycle("mounted")};this.pageEnd?e():this.bus.$once("page-end",e)},lifecycle(e){this.fc.targetFormDriver(e,this.api,this.fc),this.vm.$emit(e,this.api),this.emitEvent(e,this.api)},emitEvent(e,...r){const i=this.options[e]||this.options[J("on-"+e)];if(i){const s=W(i);h.Function(s)&&O(()=>s(...r))}this.bus.$emit(e,...r)},targetHook(e,r,i){var l,u,c,p;let s=(u=(l=e.prop)==null?void 0:l.hook)==null?void 0:u[r],n=(d,g)=>{d&&(d=Array.isArray(d)?d:[d],d.forEach($=>{O(()=>$(G(_({},i||{}),{self:e.rule,rule:e.rule,parent:g==null?void 0:g.rule,$f:this.api,api:this.api,option:this.vm.$props.option})))}))};n(s);let o="deep"+nr(r),a=e.parent;for(;a;){let d=(p=(c=a.prop)==null?void 0:c.hook)==null?void 0:p[o];n(d,a),a=a.parent}}})}function Dr(t){C(t.prototype,{useProvider(){const e=this.fc.providers;Object.keys(e).forEach(r=>{let i=e[r];h.Function(i)&&(i=i(this.fc)),i._c=Pr(i),this.onEffect(i,r),this.providers[r]=i})},onEffect(e,r){const i=[];(e._c||["*"]).forEach(s=>{const n=s==="*"?"*":this.getType(s);i.indexOf(n)>-1||(i.push(n),this.bus.$on(`p:${r||e.name}:${n}:${e.input?1:0}`,(o,a)=>{e[o]&&e[o](...a)}))}),e._used=i},watchEffect(e){let r={required:()=>{var i,s;return(A(e.rule,"$required")?e.rule.$required:(s=(i=e.rule)==null?void 0:i.effect)==null?void 0:s.required)||!1}};Object.keys(e.rule.effect||{}).forEach(i=>{r[i]=()=>e.rule.effect[i]}),Object.keys(e.rule).forEach(i=>{i[0]==="$"&&(r[i.substr(1)]=()=>e.rule[i])}),Object.keys(r).forEach(i=>{e.watch.push(y.watch(r[i],s=>{this.effect(e,"watch",{[i]:s})},{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(A(e,"$"+r))return e["$"+r];if(A(e,"effect")&&A(e.effect,r))return e.effect[r]},emitEffect({ctx:e,rule:r,input:i,type:s,custom:n},o,a){if(!s||["fcFragment","fragment"].indexOf(s)>-1)return;const l=n||Object.keys(r).reduce((u,c)=>(c[0]==="$"&&(u[c.substr(1)]=r[c]),u),_({},r.effect||{}));Object.keys(l).forEach(u=>{const c=this.providers[u];if(!c||c.input&&!i)return;let p;if(!c._c)p="*";else if(c._used.indexOf(s)>-1)p=s;else return;const d=_({value:l[u],getValue:()=>this.getEffect(r,u)},a||{});e&&(d.getProp=()=>e.effectData(u),d.clearProp=()=>e.clearEffectData(u),d.mergeProp=g=>Y(d.getProp(),[g]),d.id=e.id),this.bus.$emit(`p:${u}:${p}:${c.input?1:0}`,o,[d,r,this.api])})}})}function Ir(t){return t.filter(function(e,r,i){return i.indexOf(e,0)===r})}function Pr(t){const e=t.components;if(Array.isArray(e)){const r=Ir(e.filter(i=>i!=="*"));return r.length?r:!1}else return h.String(e)?[e]:!1}function z(t){dt(this,{options(){return t.options.value||{}},bus(){return t.bus},preview(){return t.vm.$props.preview!=null?t.vm.$props.preview:t.vm.parent&&t.vm.parent.$props.preview!=null?t.vm.parent.$props.preview:t.options.value.preview||!1}}),C(this,{fc:t,vm:t.vm,watching:!1,loading:!1,reloading:!1,noWatchFn:null,deferSyncFn:null,isMounted:!1,formData:y.reactive({}),subRuleData:y.reactive({}),subForm:{},form:y.reactive({}),appendData:{},ignoreFields:[],providers:{},cycleLoad:null,loadedId:1,nextTick:null,changeStatus:!1,pageEnd:!0,nextReload:()=>{this.lifecycle("reload")}}),this.initData(t.rules),this.$manager=new t.manager(this),this.$render=new He(this),this.api=t.extendApiFn.reduce((e,r)=>{const i=O(()=>r(e,this));return i&&i!==e&&C(e,i),e},mr(this))}C(z.prototype,{initData(t){C(this,{ctxs:{},fieldCtx:{},nameCtx:{},sort:[],rules:t})},init(){this.updateAppendData(),this.useProvider(),this.usePage(),this.loadRule(),this.$manager.__init(),this.lifecycle("created")},updateAppendData(){this.appendData=_(_(_({},this.options.formData||{}),this.fc.vm.$props.value||{}),this.appendData)},isBreakWatch(){return this.loading||this.noWatchFn||this.reloading},globalBeforeFetch(t){return new Promise((e,r)=>{const i=this.options.beforeFetch&&O(()=>this.options.beforeFetch(t,{api:this.api}));i&&h.Function(i.then)?i.then(e).catch(r):e()})},beforeFetch(t){return new Promise((e,r)=>{const i=t&&t.beforeFetch&&O(()=>t.beforeFetch(t,{api:this.api}));i&&h.Function(i.then)?i.then(e).catch(r):i===!1?r():e()}).then(()=>this.globalBeforeFetch(t))},beforeSubmit(t){return new Promise((e,r)=>{const i=this.options.beforeSubmit&&O(()=>this.options.beforeSubmit(t,{api:this.api}));i&&h.Function(i.then)?i.then(e).catch(r):i===!1?r():e()})}}),br(z),vr(z),Cr(z),kr(z),Rr(z),jr(z),Ar(z),Dr(z);const Ge={name:"fcFragment",functional:!0,props:["vnode"],render(t,e){return e.props.vnode?e.props.vnode:e.children}};function Tr(t){return h.String(t)?{domProps:{innerHTML:t}}:t}function Vr(){const t={};function e(r){r&&this.setVm(r)}return C(e.prototype,{setVm(r){this.handle=r,this.vm=r.vm,this.h=this.$h=r.vm.$createElement},make(r,i,s){var n,o;return(y.isReservedTag?y.isReservedTag(r):(n=y==null?void 0:y.config)!=null&&n.isReservedTag(r))&&(i==null||delete i.nativeOn,(o=i==null?void 0:i.props)==null||delete o.formCreateInject),this.makeComponent(r,i,s)},makeComponent(r,i,s){var a;const n=this.handle.fc.prop.components[r];n&&(r=n);let o=this.$h(r,Tr(i),s||[]);if((a=o==null?void 0:o.componentOptions)!=null&&a.propsData&&(i!=null&&i.props)){const l=Object.keys(o.componentOptions.propsData);o.data.attrs||(o.data.attrs={}),Object.keys(i.props).forEach(u=>{o.data.attrs[u]==null&&l.indexOf(u)===-1&&["string","number","boolean"].indexOf(typeof i.props[u])>-1&&(o.data.attrs[u]=i.props[u])})}return o.context=this.vm,o},aliasMap:t}),C(e,{aliasMap:t,alias(r,i){t[r]=i},use(r){Object.keys(r).forEach(i=>{const s=he(i),n=lt(i).toLocaleLowerCase(),o=r[i];e.alias(i,o),[i,s,n].forEach(a=>{e.prototype[a]=function(l,u){return this.make(t[i]||a,l,u)}})})}}),e}function Br(t){class e extends St{}return Object.assign(e.prototype,t),e}function St(t){C(this,{$handle:t,vm:t.vm,options:{},ref:"fcForm",mergeOptionsRule:{normal:["form","row","info","submitBtn","resetBtn"]}}),this.updateKey(),this.init()}C(St.prototype,{__init(){this.$render=this.$handle.$render,this.$r=(...t)=>this.$render.renderRule(...t)},updateKey(){this.key=Ce()},init(){},update(){},beforeRender(){},form(){return this.vm.$refs[this.ref]},adapterValidate(t,e){return t.validator=(r,i,s)=>e(i,s),t},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 Q(t.map(r=>this.tidyOptions(r)),e,this.mergeOptionsRule)},updateOptions(t){this.$handle.fc.targetFormDriver("updateOptions",t,{handle:this.$handle,api:this.$handle.api}),this.options=this.mergeOptions([t],this.getDefaultOptions()),this.update()},tidyOptions(t){return t},tidyRule(t){},mergeProp(t){},getDefaultOptions(){return{}},fieldChange(t,e,r,i){},render(t){}});const Lr=function(t){const e={name:"loadData",_fn:[],loaded(r,i,s){this.deleted(r),y.nextTick(()=>{let n=M(r.getValue());const o=[];n.forEach(a=>{if(a&&(a.attr||a.template)){let l=p=>{let d;i&&i.__fc__&&(d=i.__fc__.getParentGroup());let g;a.template?g=t.$handle.loadStrVar(a.template,p,d?{rule:i,value:t.$handle.subRuleData[d.id]||{}}:null):a.handler&&h.Function(a.handler)?g=a.handler(p,i,s):g=t.$handle.loadStrVar(`{{${a.attr}}}`,p,d?{rule:i,value:t.$handle.subRuleData[d.id]||{}}:null),(g==null||g==="")&&a.default!=null&&(g=a.default),a.copy!==!1&&(g=x(g));const $=a.modify?i:r.getProp();a.to==="child"?$.children?E($.children,0,g):E($,"children",[g]):ne($,a.to||"options",g),s.sync(i)},u=p=>l(p);const c=t.watchLoadData(u);l=ie(l,a.wait||300),a.watch!==!1?o.push(c):c()}}),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.loaded,e},Nr=function(t){const e={name:"t",_fn:[],loaded(r,i,s){this.deleted(r);let n=r.getValue()||{};const o=[];Object.keys(n).forEach(a=>{const l=n[a];if(l){const u=typeof l=="object";let c=g=>{let $=t.t(u?l.attr:l,u?l.params:null,g);const w=u&&l.modify?i:r.getProp();a==="child"?w.children?E(w.children,0,$):E(w,"children",[$]):ne(w,a,$),s.sync(i)},p=g=>c(g);const d=t.watchLoadData(p);c=ie(c,l.wait||300),l.watch!==!1?o.push(d):d()}}),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.loaded,e},jt={name:"componentValidate",load(t,e,r){let i=t.getValue();if(!i||i.method===!1)t.clearProp(),r.clearValidateState([e.field]);else{h.Object(i)||(i={method:i});const s=i.method,n=G(_({},i),{validator(...o){const a=ee(e);if(a)return r.exec(a.id,h.String(s)?s:"formCreateValidate",...o,{attr:t,rule:e,api:r})}});delete n.method,t.getProp().validate=[n]}},watch(...t){jt.load(...t)}},Mr={fetch:function(t){function e(s){return h.String(s)&&(s={action:s,to:"options"}),s}function r(s,n,o){let a=s.value;i.deleted(s),h.Function(a)&&(a=a(n,o)),a=e(a);const l=p=>{p===void 0?s.clearProp():ne(s.getProp(),a.to||"options",p),o.sync(n)};if(!a||!a.action&&!a.key){l(void 0);return}a=x(a),a.to||(a.to="options");const u=a.onError,c=()=>{if(!s.getValue())return s.clearProp(),o.sync(n),!0};i._fn[s.id]=t.watchLoadData(ie((p,d)=>{if(d&&a.watch===!1)return i._fn[s.id]();if(a.key){const w=p("$globalData."+a.key);if(w){if(c())return;l(w)}return}const g=t.$handle.loadFetchVar(x(a),p,n),$=G(_({headers:{}},g),{onSuccess(w,F){if(c())return;let K=U=>F?U:A(U,"data")?U.data:U;const T=W(g.parse);h.Function(T)?K=T:T&&h.String(T)&&(K=U=>L(U,T)),l(K(w,n,o))},onError(w){l(void 0),!c()&&(u||(F=>Ve(F.message||"fetch fail "+g.action)))(w,n,o)}});t.$handle.beforeFetch($,{rule:n,api:o}).then(()=>{if(h.Function(g.action)){g.action(n,o).then(w=>{$.onSuccess(w,!0)}).catch(w=>{$.onError(w)});return}O(()=>t.create.fetch($,{inject:s,rule:n,api:o}))}).catch(w=>{})},a.wait||600))}const i={name:"fetch",_fn:[],loaded(...s){r(...s)},watch(...s){r(...s)},deleted(s){this._fn[s.id]&&(this._fn[s.id](),delete this._fn[s.id]),s.clearProp()}};return i},loadData:Lr,t:Nr,componentValidate:jt};function qr(t){t=t||new Map;const e={$on(r,i){const s=t.get(r);s&&s.push(i)||t.set(r,[i])},$once(r,i){i._once=!0,e.$on(r,i)},$off(r,i){const s=t.get(r);s&&s.splice(s.indexOf(i)>>>0,1)},$emit(r,...i){(t.get(r)||[]).slice().map(s=>{s._once&&(e.$off(r,s),delete s._once),s(...i)}),(t.get("*")||[]).slice().map(s=>{s(r,i)})}};return e}const Ur={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)?t.filter(e=>h.String(e)).join(""):""}};function Hr(t){t=t+"=";const r=decodeURIComponent(document.cookie).split(";");for(let i=0;i<r.length;i++){let s=r[i];for(;s.charAt(0)===" ";)s=s.substring(1);if(s.indexOf(t)===0){s=s.substring(t.length,s.length);try{return JSON.parse(s)}catch(n){return s}}}return null}function Gr(t){const e=localStorage.getItem(t);if(e)try{return JSON.parse(e)}catch(r){return e}return null}function xr(t){const e=sessionStorage.getItem(t);if(e)try{return JSON.parse(e)}catch(r){return e}return null}function xe(t,e){if(!e)return null;const r=e.split(".");let i=t(r.shift());return r.length?i==null?null:L(i,r):i}function Jr(t){return xe(Hr,t)}function Kr(t){return xe(Gr,t)}function Wr(t){return xe(xr,t)}const zr={en:{required:"{title} is required",validate:{url:"{title} is not a valid url",email:"{title} is not a valid email",ip:"{title} {title} is not a valid ip",phone:"{title} {title} is not a valid phone",pattern:"{title} does not match pattern {pattern}",uppercase:"{title} must be all uppercase",lowercase:"{title} must be all lowercased",positive:"{title} is not a positive number",negative:"{title} is not a negative number",equal:"{title} is not equal to {equal}",min:"{title} cannot be less than {min}",max:"{title} cannot be greater than {max}",enum:"{title} must be one of {enum}",hasKeys:"{title} does not contain required fields {hasKeys}",minLen:"{title} must be at least {minLen}",maxLen:"{title} cannot be longer than {maxLen}",len:"{title} must be exactly {len}",integer:"{title} is not an integer",number:"{title} is not an number"}},"zh-cn":{required:"{title}不能为空",validate:{url:"{title}不是有效的 url 地址",email:"{title}不是有效的邮箱地址",ip:"{title}不是有效的 IP 地址",phone:"{title}不是正确的手机号",pattern:"{title}必须匹配 {pattern}",uppercase:"{title}必须全大写",lowercase:"{title}必须全小写",positive:"{title}不是正数",negative:"{title}不是负数",equal:"{title}必须等于 {equal}",min:"{title}必须大于等于 {min}",max:"{title}必须小于等于 {max}",enum:"{title}必须是 {enum} 之一",hasKeys:"{title}必须包含 {hasKeys} 字段",minLen:"{title}长度必须大于 {minLen}",maxLen:"{title}长度必须小于 {maxLen}",len:"{title}长度必须为 {len}",integer:"{title}必须为整数",number:"{title}必须为数字"}}};function Xr(t,e){let r;return arguments.length===2?(r=arguments[1],e=r[t]):r=arguments[2],{id:e,prop:r}}function Je(){return Xr("name",...arguments)}function Zr(t){return!t||!t.el?window.document.body:h.Element(t.el)?t.el:document.querySelector(t.el)}function Qr(t,e){const r=new Vue({data(){return{rule:t,option:e||{}}},render(i){return i("FormCreate",{ref:"fc",props:this.$data})}});return r.$mount(),r}function Yr(t){const e=t.key||[],r=t.array||[],i=t.normal||[];st.push(...e),Pe.push(...r),Te.push(...i),$t([...e,...r,...i])}let ei=1;const q={},At=Symbol("defValue");function Dt(t){const e={[Ge.name]:Ge},r={},i={},s={},n={},o=[],a=[],l=[t.extendApi],u=_({},Mr),c=dr();let p={global:{}};const d=t.isMobile===!0,g=y.reactive({$mobile:d}),$=Vr(),w={},F={};Yr(t.attrs||{});function K(f){const m=q[f];if(Array.isArray(m))return m.map(b=>b.api());if(m)return m.api()}function T(f){o.push(f)}function U(){const f=Je(...arguments);f.id&&f.prop&&(i[f.id]=f.prop)}function de(){const f=Je(...arguments);f.id&&f.prop&&(u[f.id]=h.Function(f.prop)?f.prop:G(_({},f.prop),{name:f.id}))}function Ze(f){$.use(f)}function pe(){const f=Je(...arguments);if(!f.id||!f.prop)return Fe;const m=J(f.id),b=f.prop,v=b.merge===!0?r[m]:void 0;r[m]=ke(b,v||Fe),c[m]=B(m),b.maker&&C(c,b.maker)}function R(f,m){let b;if(h.String(f)){if(b=f,m===void 0)return["form-create","formcreate"].indexOf(b)>-1?S():e[b]}else b=J(f.name),m=f;if(!b||!m)return;const v=J(b);e[b]=m,e[v]=m,delete $.aliasMap[b],delete $.aliasMap[v],delete r[b],delete r[v],m.formCreateParser&&pe(b,m.formCreateParser)}function S(){return fr(Ye,e,i)}function H(){return Ge}function me(f,m){return h.Function(f.install)?f.install(X,m):h.Function(f)&&f(X,m),this}function X(f,m,b){let v=Qr(f,m||{});const k=v.$refs.fc.formCreate;return k.$parent=b,Zr(k.options).appendChild(v.$el),k.api()}ke(X,F);function Ci(f){let m=_({},t);return f?m.inherit={components:e,parsers:r,directives:i,modelFields:s,providers:u,useApps:o,maker:c,formulas:w,loadData:g}:delete m.inherit,Dt(m)}function wi(f,m){s[f]=m}function ki(f,m){w[f]=m}function Oi(f,m){const b=n[f]||{},v=b.parsers||{};m.parsers&&Object.keys(m.parsers).forEach(k=>{v[k]=ke(m.parsers[k],Fe)}),m.name=f,n[f]=G(_(_({},b),m),{parsers:v})}function Re(f){f&&Object.keys(q).forEach(m=>{(Array.isArray(q[m])?q[m]:[q[m]]).forEach(v=>{v.bus.$emit("$loadData."+f)})})}function Qe(f,m){ne(g,f,m),Re(f)}function Se(f,m){const b=(...v)=>O(()=>m(...v));b._driver=!0,Qe(f,b)}function Nt(f,m){const b=(f||"").split(".");f=b.shift();const v=b.join(".");if(A(g,f)||E(g,f,At),g[f]!==At){let k=g[f];return k&&k._driver?k=k(v):b.length&&(k=L(k,b)),k==null||k===""?m:k}else return m}function Fi(f){l.push(f)}function Ei(f){delete g[f],Re(f)}function Ri(f,m){a.push({name:f,callback:m})}function Ye(f){C(this,{id:ei++,create:X,vm:f,manager:Br(t.manager),parsers:r,providers:u,modelFields:s,formulas:w,isMobile:d,rules:f.$props.rule,name:f.$props.name||Ce(),inFor:f.$props.inFor,prop:{components:e,directives:i},get:null,drivers:n,renderDriver:null,refreshData:Re,loadData:g,CreateNode:$,bus:new qr,unwatch:[],options:y.ref({}),extendApiFn:l,fetchCache:new WeakMap,tmpData:y.reactive({})}),a.forEach(m=>{this.bus.$on(m.name,m.callback)}),y.nextTick(()=>{y.watch(this.options,()=>{this.$handle.$manager.updateOptions(this.options.value),this.api().refresh()},{deep:!0})}),C(f.$options.components,e),C(f.$options.directives,i),this.$handle=new z(this),this.name&&(this.inFor?(q[this.name]||(q[this.name]=[]),q[this.name].push(this)):q[this.name]=this)}Ye.isMobile=d,C(Ye.prototype,{init(){this.isSub()&&this.unwatch.push(y.watch(()=>this.vm.parent.fc.options.value,()=>{this.initOptions(),this.$handle.api.refresh()},{deep:!0,flush:"sync"})),this.vm.$props.driver&&(this.renderDriver=typeof this.vm.$props.driver=="object"?this.vm.$props.driver:this.drivers[this.vm.$props.driver]),!this.renderDriver&&this.vm.parent&&(this.renderDriver=this.vm.parent.fc.renderDriver),this.renderDriver||(this.renderDriver=this.drivers.default),this.initOptions(),this.$handle.init()},targetFormDriver(f,...m){if(this.bus.$emit(f,...m),this.renderDriver&&this.renderDriver[f])return O(()=>this.renderDriver[f](...m))},t(f,m,b){let v=b?b("$t."+f):this.globalLanguageDriver(f);return v==null&&(v=""),v&&m&&Object.keys(m).forEach(k=>{const I=new RegExp(`{${k}}`,"g");v=v.replace(I,m[k])}),v},globalDataDriver(f){let m=f.split(".");const b=m.shift(),v=this.options.value.globalData&&this.options.value.globalData[b];if(v){if(v.type==="static")return L(v.data,m);{let k;const I=this.fetchCache.get(v);if(I){if(I.status&&(k=L(I.data,m)),!I.loading)return k;I.loading=!1,this.fetchCache.set(v,I)}else this.fetchCache.set(v,{status:!1});const j=ie(()=>{se();const Z=this.fetchCache.get(v);this.options.value.globalData&&Object.values(this.options.value.globalData).indexOf(v)!==-1?(Z&&(Z.loading=!0,this.fetchCache.set(v,Z)),this.bus.$emit("$loadData.$globalData."+b)):this.fetchCache.delete(v)},v.wait||600),_e=Z=>{this.fetchCache.set(v,{status:!0,data:Z}),this.bus.$emit("$loadData.$globalData."+b)},ue=(Z,ce)=>{if(ce&&v.watch===!1)return se();if(ce){j();return}const ge=this.$handle.loadFetchVar(Ie(v),Z);this.$handle.api.fetch(ge).then(oe=>{_e(oe)}).catch(oe=>{_e(null)})},se=this.watchLoadData(ue);return v.watch===!1&&se(),this.unwatch.push(se),k}}},getLocale(){let f=this.vm.top.$props.locale;return f&&typeof f=="object"?f.name:typeof f=="string"?f:"zh-cn"},globalLanguageDriver(f){let m=this.vm.top.$props.t,b=this.vm.top.$props.locale,v;if(m&&(v=O(()=>m(f))),v==null&&b&&typeof b=="object"&&(v=L(b,f)),v==null){const k=this.options.value.language||{},I=this.getLocale();v=L(k[I]||{},f),v==null&&(v=L(zr[I]||{},f))}return v},globalVarDriver(f){let m=f.split(".");const b=m.shift(),v=this.options.value.globalVariable&&this.options.value.globalVariable[b];if(v){const k=h.Function(v)?v:W(v.handle);if(k){let I=k((...j)=>this.$handle.api.getData(...j),this.$handle.api);return L(I,m)}}},setData(f,m,b){b?Qe(f,m):(ne(this.vm.top.fc.tmpData,f,m),this.bus.$emit("$loadData."+f))},getLoadData(f,m){let b=null;if(f!=null){let v=f.split(".");const k=v.shift();if(b=L(this.vm.top.fc.tmpData,f),b!=null)return b;if(k==="$topForm")b=this.$handle.api.top.formData(!0);else if(k==="$scopeForm")b=this.$handle.api.scope.formData(!0);else if(k==="$form")b=this.$handle.api.formData(!0);else if(k==="$options")b=this.options.value;else if(k==="$globalData")b=this.globalDataDriver(v.join(".")),v=[];else if(k==="$var")b=this.globalVarDriver(v.join(".")),v=[];else if(k==="$locale")b=this.getLocale(),v=[];else if(k==="$t")b=this.globalLanguageDriver(v.join(".")),v=[];else{if(k==="$preview")return this.$handle.preview;b=Nt(f),v=[]}b&&v.length&&(b=L(b,v))}return b==null||b===""?m:b},watchLoadData(f,m){let b={};const v=j=>{this.get||(this.get=k),O(()=>{f(k,j)}),this.get===k&&(this.get=void 0)},k=(j,_e)=>{let ue;if(typeof j=="object"&&(ue=j.getValue,j=j.id),b[j])return b[j].val;const se=y.computed(()=>ue?ue():this.getLoadData(j,_e)),Z=j.split("."),ce=Z.shift(),ge=Z.shift()||"",oe=ie(()=>{const fe=ue?ue():this.getLoadData(j,_e);if(b[j])((fe instanceof Function||h.Object(fe)||Array.isArray(fe))&&fe===b[j].val||JSON.stringify(fe)!==JSON.stringify(b[j].val))&&(b[j].val=fe,v(!0));else return},m||0),ji=y.watch(se,fe=>{oe()});return this.bus.$on("$loadData."+ce,oe),ge&&this.bus.$on("$loadData."+ce+"."+ge,oe),b[j]={fn:()=>{this.bus.$off("$loadData."+ce,oe),ge&&this.bus.$off("$loadData."+ce+"."+ge,oe),ji()},val:se.value},se.value};v(!1);const I=()=>{Object.keys(b).forEach(j=>b[j].fn()),b={}};return this.unwatch.push(I),I},isSub(){return this.vm.parent&&this.vm.extendOption},initOptions(){this.options.value={};let f=_({formData:{},submitBtn:{},resetBtn:{},globalEvent:{},globalData:{}},x(p));const m=this.isSub();m&&(f=this.mergeOptions(f,this.vm.parent.fc.options.value||{},!0)),f=this.mergeOptions(f,this.vm.$props.option||{});const b=this.api();this.targetFormDriver("initOptions",f,{api:b,isSubForm:m}),this.updateOptions(f)},mergeOptions(f,m,b){return m=_({},m||{}),b&&["page","onSubmit","onReset","onCreated","onChange","onMounted","mounted","onReload","reload","formData","el","globalClass","style"].forEach(v=>{delete m[v]}),m.global&&(f.global=lr(f.global,m.global),delete m.global),this.$handle.$manager.mergeOptions([m],f),f},updateOptions(f){this.options.value=this.mergeOptions(this.options.value,f),this.$handle.$manager.updateOptions(this.options.value),this.bus.$emit("$loadData.$options")},api(){return this.$handle.api},render(){return this.$handle.render()},mounted(){this.$handle.mounted()},unmount(){if(this.name)if(this.inFor){const f=q[this.name].indexOf(this);q[this.name].splice(f,1)}else delete q[this.name];a.forEach(f=>{this.bus.$off(f.name,f.callback)}),this.tmpData={},this.unwatch.forEach(f=>f()),this.unwatch=[],this.$handle.reloadRule([])},updated(){this.$handle.bindNextTick(()=>this.bus.$emit("next-tick",this.$handle.api))}});function Mt(f){C(f,{version:t.version,ui:t.ui,isMobile:d,extendApi:Fi,getData:Nt,setDataDriver:Se,setData:Qe,removeData:Ei,refreshData:Re,maker:c,component:R,directive:U,setModelField:wi,setFormula:ki,setDriver:Oi,register:de,$vnode:H,parser:pe,use:me,factory:Ci,componentAlias:Ze,copyRule:ct,copyRules:ft,mergeRule:Y,fetch:Ct,$form:S,parseFn:W,parseJson:ut,toJson:$e,useApp:T,getApi:K,on:Ri})}function Si(f){C(f,{create:X,install(m,b){if(p=_(_({},p),b||{}),m._installedFormCreate===!0)return;m._installedFormCreate=!0;const v=function(I,j={}){return X(I,j,this)};Mt(v),m.prototype.$formCreate=v;const k=S();m.component(k.name,k),m.component("FcFragment",H()),o.forEach(I=>{O(()=>I(f,m))})}})}if(Mt(F),Si(F),Se("$cookie",Jr),Se("$localStorage",Kr),Se("$sessionStorage",Wr),$.use({fragment:"fcFragment"}),t.install&&X.use(t),pe(Ur),t.inherit){const f=t.inherit;f.components&&C(e,f.components),f.parsers&&C(r,f.parsers),f.directives&&C(i,f.directives),f.modelFields&&C(s,f.modelFields),f.providers&&C(u,f.providers),f.useApps&&C(o,f.useApps),f.maker&&C(c,f.maker),f.loadData&&C(g,f.loadData),f.formulas&&C(w,f.formulas)}const je=S();return ke(je,F),Object.defineProperties(je,{fetch:{get(){return F.fetch},set(f){F.fetch=f}}}),je.util=F,je}const It={date:"yyyy-MM-dd",month:"yyyy-MM",datetime:"yyyy-MM-dd HH:mm:ss",timerange:"HH:mm:ss",daterange:"yyyy-MM-dd",monthrange:"yyyy-MM",datetimerange:"yyyy-MM-dd HH:mm:ss",year:"yyyy"},Pt="datePicker",ti={name:Pt,maker:function(){return["year","month","date","dates","week","datetime","datetimeRange","dateRange","monthRange"].reduce((t,e)=>(t[e]=B(Pt,{type:e.toLowerCase()}),t),{})}(),mergeProp(t){const e=t.prop.props;e.valueFormat||(e.valueFormat=It[e.type]||It.date)}},Ke="hidden",ri={name:Ke,maker:{[Ke]:(t,e)=>B(Ke)("",t,e)},render(){return[]}},We="input",ii={name:We,maker:function(){const t=["password","url","email","text","textarea"].reduce((e,r)=>(e[r]=B(We,{type:r}),e),{});return t.idate=B(We,{type:"date"}),t}(),mergeProp(t){let{props:e}=t.prop;e&&e.autosize&&e.autosize.minRows&&(e.rows=e.autosize.minRows||2)}},Tt="slider",ni={name:Tt,maker:{sliderRange:B(Tt,{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}},ze="timePicker",si={name:ze,maker:{time:B(ze,t=>t.props.isRange=!1),timeRange:B(ze,t=>t.props.isRange=!0)},mergeProp(t){const e=t.prop.props;e.valueFormat||(e.valueFormat="HH:mm:ss")}},oi=[ti,ri,ii,ni,si,{name:"FcRow",render(t,e){return e.vNode.col({props:{span:24}},[e.vNode.row(e.prop,t)])}},{name:"select",toFormValue(t,e){return e.prop.props.multiple&&!Array.isArray(t)?M(t):t}}],D="el",ai={button:D+"Button",icon:"i",slider:D+"Slider",rate:D+"Rate",upload:"fcUpload",cascader:D+"Cascader",popover:D+"Popover",tooltip:D+"Tooltip",colorPicker:D+"ColorPicker",timePicker:D+"TimePicker",timeSelect:D+"TimeSelect",datePicker:D+"DatePicker",switch:D+"Switch",select:"fcSelect",checkbox:"fcCheckbox",radio:"fcRadio",inputNumber:D+"InputNumber",number:D+"InputNumber",input:D+"Input",formItem:D+"FormItem",form:D+"Form",frame:"fcFrame",col:D+"Col",row:D+"Row",tree:"fcTree",autoComplete:D+"Autocomplete",auto:D+"Autocomplete",group:"fcGroup",array:"fcGroup",object:"fcSubForm",subForm:"fcSubForm"};function li(){return{form:{inline:!1,labelPosition:"right",labelWidth:"125px",disabled:!1,size:void 0},row:{show:!0,gutter:0},submitBtn:{type:"primary",loading:!1,disabled:!1,innerText:"",show:!0,col:void 0,click:void 0},resetBtn:{type:"default",loading:!1,disabled:!1,icon:"el-icon-refresh",innerText:"",show:!1,col:void 0,click:void 0}}}function ui(t){return t.type==="tooltip"}function Vt(t,e){A(t,e)&&h.String(t[e])&&(t[e]={[e]:t[e],show:!0})}function te(t){return t===!1}function ci(t,e){A(t,e)&&!h.Object(t[e])&&(t[e]={show:!!t[e]})}function Xe(t){const e=_({},t);return delete e.children,e}const fi={validate(){const t=this.form();return t?t.validate():new Promise(e=>e())},validateField(t){return new Promise((e,r)=>{const i=this.form();i?i.validateField(t,(s,n)=>{n?r(n):e(s)}):e()})},clearValidateState(t){const e=this.vm.$refs[t.wrapRef];e&&e.clearValidate()},fieldChange(t,e,r,i){var s;i||(s=this.vm.$refs[t.wrapRef])==null||s.validate("change")},tidyOptions(t){return["submitBtn","resetBtn","row","info","wrap","col","title"].forEach(e=>{ci(t,e)}),t},tidyRule({prop:t}){return Vt(t,"title"),Vt(t,"info"),t},mergeProp(t){const e={info:{trigger:"hover",placement:"top-start",icon:"el-icon-warning"},title:{},col:{span:24},wrap:{}};["info","wrap","col","title"].forEach(r=>{t.prop[r]=Q([this.options[r]||{},t.prop[r]||{}],e[r])})},getDefaultOptions(){return li()},update(){const t=this.options.form;this.rule={props:_({},t),nativeOn:{submit:e=>{e.preventDefault()}},style:t.style,type:"form"}},beforeRender(){const{key:t,ref:e,$handle:r}=this,i=this.options.form;C(this.rule,{key:t,ref:e,class:[i.className,i.class,"form-create",this.$handle.preview?"is-preview":""]}),C(this.rule.props,{model:r.formData})},render(t){return t.slotLen()&&!this.$handle.preview&&t.setSlot(void 0,()=>this.makeFormBtn()),this.$r(this.rule,te(this.options.row.show)?t.getSlots():[this.makeRow(t)])},makeWrap(t,e){const r=t.prop,i=`${this.key}${t.key}`,s=r.col,n=this.isTitle(r)&&r.wrap.title!==!1,o=!s.labelWidth&&!n?0:s.labelWidth,{inline:a,col:l}=this.rule.props,u=r.wrap.class;delete r.wrap.class,delete r.wrap.title;const c=te(r.wrap.show)?e:this.$r(Q([r.wrap,{props:G(_({labelWidth:o===void 0?o:lt(o),label:n?r.title.title:void 0},Xe(r.wrap||{})),{prop:t.id,rules:t.injectValidate()}),class:this.$render.mergeClass(u||r.className,"fc-form-item"),key:`${i}fi`,ref:t.wrapRef,type:"formItem"}]),_({default:()=>e},n?{label:()=>this.makeInfo(r,i,t)}:{}));return a===!0||te(l)||te(s.show)?c:this.makeCol(r,i,[c])},isTitle(t){if(this.options.form.title===!1)return!1;const e=t.title;return!(!e.title&&!e.native||te(e.show))},makeInfo(t,e,r){var c,p,d,g,$,w;const i=_({},t.title),s=_({},t.info),n=ui(s),o=this.options.form,a=this.getSlot("title"),l=[a?a({title:(p=(c=r.refRule)==null?void 0:c.__$title)==null?void 0:p.value,rule:r.rule,options:this.options}):((g=(d=r.refRule)==null?void 0:d.__$title)==null?void 0:g.value)+(o.labelSuffix||o["label-suffix"]||"")];if(!te(s.show)&&(s.info||s.native)&&!te(s.icon)){const F={type:s.type||"popover",slot:"label",props:Xe(s),key:`${e}pop`};delete F.props.icon,delete F.props.show,delete F.props.info,delete F.props.align,delete F.props.native;const K="content";s.info&&!A(F.props,K)&&(F.props[K]=(w=($=r.refRule)==null?void 0:$.__$info)==null?void 0:w.value),l[s.align!=="left"?"unshift":"push"](this.$r(Q([s,F]),[this.$r({type:"i",slot:n?"default":"reference",class:s.icon===!0?"el-icon-warning":s.icon,key:`${e}i`})]))}const u=Q([i,{props:Xe(i),key:`${e}tit`,class:"fc-form-title",slot:i.slot||"label",type:i.type||"span"}]);return delete u.props.show,delete u.props.title,delete u.props.native,this.$r(u,l)},makeCol(t,e,r){const i=t.col;return this.$r({class:this.$render.mergeClass(i.class,"fc-form-col"),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:this.$render.mergeClass(e.class,"fc-form-row"),key:`${this.key}row`},t)},makeFormBtn(){let t=[];if(te(this.options.submitBtn.show)||t.push(this.makeSubmitBtn()),te(this.options.resetBtn.show)||t.push(this.makeResetBtn()),!t.length)return;const e=this.$r({type:"formItem",class:"fc-form-item",key:`${this.key}fb`},t);return this.rule.props.inline===!0?e:this.$r({type:"col",class:"fc-form-col fc-form-footer",props:{span:24},key:`${this.key}fc`},[e])},makeResetBtn(){const t=_({},this.options.resetBtn),e=t.innerText||this.$handle.api.t("reset")||"重置";return delete t.innerText,delete t.click,delete t.col,delete t.show,this.$r({type:"button",props:t,class:"fc-reset-btn",style:{width:t.width},on:{click:()=>{const r=this.$handle.api;this.options.resetBtn.click?this.options.resetBtn.click(r):r.resetFields()}},key:`${this.key}b2`},[e])},makeSubmitBtn(){const t=_({},this.options.submitBtn),e=t.innerText||this.$handle.api.t("submit")||"提交";return delete t.innerText,delete t.click,delete t.col,delete t.show,this.$r({type:"button",props:t,class:"fc-submit-btn",style:{width:t.width},on:{click:()=>{const r=this.$handle.api;this.options.submitBtn.click?this.options.submitBtn.click(r):r.submit().catch(()=>{})}},key:`${this.key}b1`},[e])}},le={};hi(le),di(le),pi(le),mi(le),gi(le);function hi(t){["group","tree","switch","upload","autoComplete","checkbox","cascader","colorPicker","datePicker","frame","inputNumber","radio","rate"].forEach(e=>{t[e]=B(e)}),t.auto=t.autoComplete,t.number=t.inputNumber,t.color=t.colorPicker}function di(t){const e="select",r="multiple";t.selectMultiple=B(e,{[r]:!0}),t.selectOne=B(e,{[r]:!1})}function pi(t){const e="tree",r={treeSelected:"selected",treeChecked:"checked"};Object.keys(r).reduce((i,s)=>(i[s]=B(e,{type:r[s]}),i),t)}function mi(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]=B(e,n=>n.props({uploadType:r[s][0],maxLength:r[s][1]})),i),t),t.uploadImage=t.image,t.uploadFile=t.file}function gi(t){const e={frameInputs:["input",0],frameFiles:["file",0],frameImages:["image",0],frameInputOne:["input",1],frameFileOne:["file",1],frameImageOne:["image",1]};return Object.keys(e).reduce((r,i)=>(r[i]=B("frame",s=>s.props({type:e[i][0],maxLength:e[i][1]})),r),t),t.frameInput=t.frameInputs,t.frameFile=t.frameFiles,t.frameImage=t.frameImages,t}function Bt(t,e){return h.Boolean(t)?t={show:t}:!h.Undef(t)&&!h.Object(t)&&(t={show:e}),t}function yi(t,e){return{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.filter(a=>!a.isScope).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}),e.emitEvent("validate-fail",a,{api:t})})})},validateField(r,i){return new Promise((s,n)=>{const o=e.getFieldCtx(r);if(!o)return;const a=e.subForm[o.id],l=[e.$manager.validateField(o.id)];M(a).filter(u=>!u.isScope).forEach(u=>{l.push(u.validate())}),Promise.all(l).then(()=>{s(null),i&&i(null)}).catch(u=>{n(u),i&&i(u),e.vm.$emit("validate-field-fail",u,{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=Bt(e.options.submitBtn,!0);C(i,r),e.options.submitBtn=i,t.refreshOptions()},resetBtnProps:(r={})=>{let i=Bt(e.options.resetBtn,!1);C(i,r),e.options.resetBtn=i,t.refreshOptions()},submit(r,i){return new Promise((s,n)=>{(e.options.validateOnSubmit===!1?Promise.resolve():t.validate()).then(()=>{let a=t.formData();e.beforeSubmit(a).then(()=>{h.Function(r)&&O(()=>r(a,t)),h.Function(e.options.onSubmit)&&O(()=>e.options.onSubmit(a,t)),e.vm.$emit("submit",a,t),s(a)}).catch(l=>{})}).catch((...a)=>{h.Function(i)&&O(()=>i(t,...a)),n(...a)})})}}}const Lt={name:"required",load(t,e,r){var s,n;const i=$i(t.getValue());if(i.required===!1)t.clearProp(),r.clearValidateState([e.field]);else{const o=_({required:!0,validator(l,u,c){h.empty(u)?c(o.message):c()}},i),a=(n=(s=e.__fc__.refRule)==null?void 0:s.__$title)==null?void 0:n.value;if(!o.message)o.message=r.t("required",{title:a})||a+(r.getLocale()==="en"?" is required":"不能为空");else{const l=o.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);l&&(o.message=r.t(l[1],{title:a}))}t.getProp().validate=[o]}r.sync(e)},watch(...t){Lt.load(...t)}};function $i(t){return h.Boolean(t)?{required:t}:h.String(t)?{message:t}:h.Undef(t)?{required:!1}:h.Function(t)?{validator:t}:h.Object(t)?t:{}}function bi(t){t.componentAlias(ai),ir.forEach(e=>{t.component(e.name,e)}),t.register(Lt),oi.forEach(e=>{t.parser(e)}),Object.keys(le).forEach(e=>{t.maker[e]=le[e]})}function vi(){return Dt({ui:"element-ui",version:"2.7.15",manager:fi,extendApi:yi,install:bi,attrs:{normal:["col","wrap"],array:["className"],key:["title","info"]}})}const Ee=vi();typeof window!="undefined"&&(window.formCreate=Ee,window.Vue&&Ee.install(window.Vue));const _i=Ee.maker;P.default=Ee,P.maker=_i,Object.defineProperties(P,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
14
|
+
err: ${s}`);return}}return t}function st(t,e){return JSON.parse(t,function(r,i){return h.Undef(i)||!i.indexOf?i:W(i,e)})}let ar=0;function we(){const t=370+ ++ar;return"F"+Math.random().toString(36).substr(3,3)+(+`${Date.now()}`).toString(36)+t.toString(36)+"c"}function ne(t,e,r){let i=t,s;return(e||"").split(".").forEach(n=>{s&&((!i[s]||typeof i[s]!="object")&&F(i,s,{}),i=i[s]),s=n}),F(i,s,r),i}const lr=[Xt,Zt,Qt,Yt,er,rr,{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(()=>{ye(i.rule,t),i.$f.setValue(s)},!0);else{const n=i.$f.formData();i.$f.once("reloading",()=>{i.$f.setValue(n)}),i.rule=x(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&&A(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:_({},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?_({},this.options):{submitBtn:!1,resetBtn:!1};if(this.defaultValue){i.formData||(i.formData={});const s=x(this.defaultValue);C(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){if(this.disabled||this.onBeforeAdd(this.value)===!1)return;const e=[...this.value];e.push(this.defaultValue?x(this.defaultValue):this.field?null:{}),this.input(e)},del(t,e){if(this.disabled)return;const r=()=>{this.removeRule(e,!0);const i=[...this.value];i.splice(t,1),this.input(i)};Ce(this.onBeforeRemove(this.modelValue,t)).then(i=>{i!==!1&&r()})},addIcon(t){const e=this.$createElement;return e("div",{class:"_fc-group-btn _fc-group-plus-minus",on:{click:this.add}})},delIcon(t,e){const r=this.$createElement;return r("div",{class:"_fc-group-btn _fc-group-plus-minus _fc-group-minus",on:{click:()=>this.del(t,e)}})},sortUpIcon(t){const e=this.$createElement;return e("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-up",on:{click:()=>this.changeSort(t,-1)}})},sortDownIcon(t){const e=this.$createElement;return e("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=arguments[0],e=this.sort,r=this.button,i=this.type,s=this.disabled,n=e.length===0?this.$scopedSlots.default?this.$scopedSlots.default({vm:this,add:this.add}):t("div",{key:"a_def",class:"_fc-group-plus-minus _fc-group-add fc-clock",on:{click:this.add}}):e.map((o,a)=>{const{rule:l,options:u}=this.cacheRule[o],c=r&&!s?this.makeIcon(e.length,a,o):[];return t("div",{class:"_fc-group-container",key:o},[t(i,V([{key:o},{on:{"update:value":p=>this.formData(o,p),"emit-event":(p,...d)=>this.emitEvent(p,d,a,o),input:p=>this.add$f(a,o,p)}},{},{props:{disabled:s,inFor:!0,value:this.field?{[this.field]:this._value(this.value[a])}:this.value[a],rule:l,option:u,extendOption:!0}}])),t("div",{class:"_fc-group-idx"},[a+1]),c.length?t("div",{class:"_fc-group-handle fc-clock"},[c]):null])});return t("div",{key:"con",class:"_fc-group "+(s?"_fc-group-disabled":"")},[n])}},{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=_({},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 t=arguments[0],{rule:e,options:r}=this.cacheRule,i=this.type;return t(i,V([{},{on:{"update:value":this.formData,"emit-event":this.emitEvent,input:this.add$f}},{},{props:{rule:e,option:r,disabled:this.disabled,extendOption:!0}}]))}}],ot=["attrs","props","domProps","scopedSlots"],at=["class","style","directives"],lt=["on","nativeOn","hook"],Q=(t,e={},r={})=>{const i=[...ot,...r.normal||[]],s=[...at,...r.array||[]],n=[...lt,...r.functional||[]],o=r.props||[];return t.reduce((a,l)=>{for(const u in l)if(a[u])if(o.indexOf(u)>-1)a[u]=Q([l[u]],a[u]);else if(i.indexOf(u)>-1)a[u]=_(_({},a[u]),l[u]);else if(s.indexOf(u)>-1){const c=a[u]instanceof Array?a[u]:[a[u]],p=l[u]instanceof Array?l[u]:[l[u]];a[u]=[...c,...p]}else if(n.indexOf(u)>-1)for(const c in l[u])if(a[u][c]){const p=a[u][c]instanceof Array?a[u][c]:[a[u][c]],d=l[u][c]instanceof Array?l[u][c]:[l[u][c]];a[u][c]=[...p,...d]}else a[u][c]=l[u][c];else if(u==="hook")for(let c in l[u])a[u][c]?a[u][c]=ur(a[u][c],l[u][c]):a[u][c]=l[u][c];else a[u]=l[u];else i.indexOf(u)>-1||n.indexOf(u)>-1||o.indexOf(u)>-1?a[u]=_({},l[u]):s.indexOf(u)>-1?a[u]=l[u]instanceof Array?[...l[u]]:typeof l[u]=="object"?_({},l[u]):l[u]:a[u]=l[u];return a},e)},ur=(t,e)=>function(){t&&t.apply(this,arguments),e&&e.apply(this,arguments)},ut=["type","slot","ignore","emitPrefix","value","name","native","hidden","display","inject","options","emit","nativeEmit","link","prefix","suffix","update","sync","optionsTo","key","slotUpdate","computed","preview","component","cache"],Ne=["validate","children","control"],Me=["effect","deep","renderSlots"];function ct(){return[...ut,...ot,...at,...lt,...Ne,...Me]}function qe(t,e){return{value:t,enumerable:!1,configurable:!1,writable:!!e}}function ft(t,e){return ht([t],e||!1)[0]}function ht(t,e){return ye([],[...t],e||!1)}function Y(t,e){return Q(Array.isArray(e)?e:[e],t,{array:Ne,normal:Me}),t}function dt(t){const e=h.Function(t.getRule)?t.getRule():t;return e.type||(e.type="input"),e}function cr(t,e){return t?(Object.keys(e||{}).forEach(r=>{e[r]&&(t[r]=Y(t[r]||{},e[r]))}),t):e}function pt(t,e){Object.defineProperties(t,Object.keys(e).reduce((r,i)=>(r[i]={get(){return e[i]()}},r),{}))}function ee(t){return t.__fc__||(t.__origin__?t.__origin__.__fc__:null)}function O(t,e){try{e=t()}catch(r){or(r)}return e}function Ue(t,e){let r=null;return h.Function(t)?r=t():Array.isArray(t)?r=t.map(i=>Ue(i,e)):r=t,r&&e&&q(r).forEach(i=>{(Array.isArray(i)?i:[i]).forEach(n=>{n&&typeof n=="object"&&(n.data||(n.data={}),(!n.data.slot||n.data.slot==="default")&&(n.data.slot=e||"default"))})}),r}function fr(t,e){if(h.Object(t)){const r={};return Object.keys(t).forEach(i=>{r[i]=Ue(t[i],i)}),r}else return Ue(t,e)}function ke(){const t={},e=r=>r||"default";return{setSlot(r,i){r=e(r),!(!i||Array.isArray(i)&&i.length)&&(t[r]||(t[r]=[]),t[r].push(...Array.isArray(i)?i:[i]))},getSlot(r){r=e(r);const i=[];return(t[r]||[]).forEach(s=>{if(Array.isArray(s))i.push(...s);else if(h.Function(s)){const n=s();Array.isArray(n)?i.push(...n):i.push(n)}else h.Undef(s)||i.push(s)}),fr(i,r)},getSlots(){let r=[];return Object.keys(t).forEach(i=>{r=r.concat(this.getSlot(i)||[])}),r},slotLen(r){return r=e(r),t[r]?t[r].length:0},mergeBag(r){if(!r)return this;const i=h.Function(r.getSlots)?r.getSlots():r;return Array.isArray(r)||r.tag?this.setSlot(void 0,()=>r):Array.isArray(i)?this.setSlot(void 0,()=>i):Object.keys(i).forEach(s=>{this.setSlot(s,i[s])}),this}}}function Oe(t,e){return Object.setPrototypeOf(t,e),t}const mt=(t,e)=>typeof t=="string"?String(e):typeof t=="number"?Number(e):e,ae={"==":(t,e)=>JSON.stringify(t)===JSON.stringify(mt(t,e)),"!=":(t,e)=>!ae["=="](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(mt(t[0],e))>-1},notOn(t,e){return!ae.on(t,e)},in(t,e){return e&&e.indexOf&&e.indexOf(t)>-1},notIn(t,e){return!ae.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 h.empty(t)},notEmpty(t){return!h.empty(t)},pattern(t,e){return new RegExp(e,"g").test(t)}};function L(t,e){return(Array.isArray(e)?e:(e||"").split(".")).forEach(r=>{t!=null&&(t=t[r])}),t}function hr(t){const e=/{{\s*(.*?)\s*}}/g;let r;const i={};for(;(r=e.exec(t))!==null;)r[1]&&(i[r[1]]=!0);return Object.keys(i)}function gt(t){let e=t.split("."),r=[],i="";return e.forEach((s,n)=>{n===0?i=s:i+="."+s,r.push(i)}),r.join(" && ")}function yt(t){const e=[];let r="",i=0;for(let s=0;s<t.length;s++){const n=t[s];n==="["?(i===0&&r&&(e.push({type:"key",value:r}),r=""),i++,r+=n):n==="]"?(i--,r+=n,i===0&&(e.push({type:"bracket",value:yt(r.slice(1,-1))}),r="")):n==="."&&i===0?r&&(e.push({type:"key",value:r}),r=""):r+=n}return r&&e.push({type:"key",value:r}),e.map(s=>s.type==="key"?{key:s.value}:{children:s.value})}const Fe=(t,e)=>{if(!(!t||t===e||!t.$props)){if(t.$props.formCreateInject)return t.$props.formCreateInject;if(t.$parent)return Fe(t.$parent,e)}};function dr(t,e,r){const i="FormCreate"+(t.isMobile?"Mobile":"");return{name:i,componentName:i,model:{prop:"api"},components:e,directives:r,provide(){return{$pfc:this}},inject:{$pfc:{default:null}},props:{rule:{type:Array,required:!0,default:()=>[]},option:{type:Object,default:()=>({})},extendOption:Boolean,driver:[String,Object],value:Object,disabled:{type:Boolean,default:void 0},preview:{type:Boolean,default:void 0},index:[String,Number],api:Object,locale:[String,Object],t:Function,name:String,subForm:{type:Boolean,default:!0},inFor:Boolean},render(){return this.fc.render()},setup(s){const n=y.getCurrentInstance().proxy;y.provide("parentFC",n);const o=y.inject("parentFC",null);let a=o;if(o)for(;a.parent;)a=a.parent;else a=n;const{rule:l,value:u,subForm:c,inFor:p}=y.toRefs(s),d=y.reactive({ctxInject:{},destroyed:!1,isShow:!0,unique:1,renderRule:[...l.value||[]],updateValue:JSON.stringify(u.value||{})}),g=new t(n),$=g.api(),w=p.value,E=()=>{if(o){const R=Fe(n,o);if(R){let S;w?(S=q(R.getSubForm()),S.push($)):S=$,R.subForm(S)}}},K=()=>{const R=Fe(n,o);if(R)if(w){const S=q(R.getSubForm()),H=S.indexOf($);H>-1&&S.splice(H,1)}else R.subForm()};let T=null;y.onBeforeMount(()=>{y.watch(()=>{let R="";const S=s.option&&s.option.globalClass||{};Object.keys(S).forEach(H=>{let ge="";S[H].style&&Object.keys(S[H].style).forEach(X=>{ge+=de(X)+":"+S[H].style[X]+";"}),S[H].content&&(ge+=S[H].content+";"),ge&&(R+=`.${H}{${ge}}`)}),s.option&&s.option.style&&(R+=s.option.style),T||(T=document.createElement("style"),T.type="text/css",document.head.appendChild(T)),T.innerHTML=R||""},()=>{})});const N=ie(()=>{g.bus.$emit("$loadData.$topForm")},100),pe=ie(function(){g.bus.$emit("$loadData.$scopeForm")},100),Qe=ie(()=>{g.bus.$emit("$loadData.$form")},100),me=R=>{g.bus.$emit("change-$form."+R)};return y.onMounted(()=>{o&&($.top.bus.$on("$loadData.$form",N),$.top.bus.$on("change",me)),$!==$.scope&&$.scope.bus.$on("$loadData.$scopeForm",pe),g.mounted()}),y.onBeforeUnmount(()=>{o&&($.top.bus.$off("$loadData.$form",N),$.top.bus.$off("change",me)),$!==$.scope&&$.scope.bus.$off("$loadData.$scopeForm",pe),K(),d.destroyed=!0,g.unmount(),T&&(T.parentNode||T.parentElement)&&document.head.removeChild(T)}),y.onUpdated(()=>{g.updated()}),y.watch(c,R=>{R?E():K()},{immediate:!0}),y.watch(()=>s.option,()=>{g.initOptions(),$.refresh()},{deep:!0,flush:"sync"}),y.watch(()=>[...l.value],R=>{g.$handle.isBreakWatch()||R.length===d.renderRule.length&&R.every(S=>d.renderRule.indexOf(S)>-1)||(g.$handle.updateAppendData(),g.$handle.reloadRule(l.value),n.renderRule())}),y.watch(()=>[s.disabled,s.preview],()=>{$.refresh()}),y.watch(u,R=>{$e(R||{})!==d.updateValue&&($.config.forceCoverValue?$.coverValue(R||{}):$.setValue(R||{}))},{deep:!0,flush:"post"}),y.watch(()=>s.index,()=>{$.coverValue({}),g.$handle.updateAppendData(),y.nextTick(()=>{y.nextTick(()=>{$.clearValidateState()})})},{flush:"sync"}),G(_({fc:y.markRaw(g),parent:o&&y.markRaw(o),top:y.markRaw(a),fapi:y.markRaw($)},y.toRefs(d)),{getGroupInject:()=>Fe(n,o),refresh(){++d.unique},renderRule(){d.renderRule=[...l.value||[]]},updateValue(R){if(d.destroyed)return;const S=$e(R);d.updateValue!==S&&(d.updateValue=S,n.$emit("update:value",R),y.nextTick(()=>{Qe(),o?c.value||pe():(N(),pe())}))}})},created(){this.$emit("input",this.fapi),this.fc.init()}}}function $t(){return{props:{},on:{},options:[],children:[],effect:{},hidden:!1,display:!0,value:void 0}}function B(t,e){return(r,i,s,n={})=>{const o=new He(t,r,i,s,n);return e&&(h.Function(e)?e(o):o.props(e)),o}}function He(t,e,r,i,s){this._data=C($t(),{type:t,title:e,field:r,value:i,props:s||{}}),this.event=this.on}C(He.prototype,{getRule(){return this._data},setProp(t,e){return F(this._data,t,e),this},_clone(){const t=new this.constructor;return t._data=ft(this._data),t}});function bt(t){t.forEach(e=>{He.prototype[e]=function(r){return Y(this._data,{[e]:arguments.length<2?r:{[r]:arguments[1]}}),this}})}bt(ct());const vt=B("");function pr(t,e,r){let i=vt("",e);return i._data.type=t,i._data.title=r,i}function _t(t,e,r,i){let s=vt("",r);return s._data.type="template",s._data.template=t,s._data.title=i,s._data.vm=e,s}function mr(){return{create:pr,createTmp:_t,template:_t,factory:B}}function gr(t,e,r){const i=`fail to ${t} ${r.status}'`,s=new Error(i);return s.status=r.status,s.url=t,s}function Ct(t){const e=t.responseText||t.response;if(!e)return e;try{return JSON.parse(e)}catch(r){return e}}function wt(t){if(typeof XMLHttpRequest=="undefined")return;const e=new XMLHttpRequest;let r=t.action||"";if(e.upload&&t.onProgress&&e.upload.addEventListener("progress",n=>{n.percent=n.total>0?n.loaded/n.total*100:0,t.onProgress(n)}),t.query){const n=h.String(t.query)?t.query:Object.keys(t.query).reduce((a,l)=>(a[l]=t.query[l]===null||t.query[l]===void 0?"":t.query[l],a),{}),o=new URLSearchParams(n).toString();o&&(r.includes("?")?r+=`&${o}`:r+=`?${o}`)}e.onerror=function(o){t.onError(o)},e.onload=function(){if(e.status<200||e.status>=300)return t.onError(gr(r,t,e),Ct(e));t.onSuccess(Ct(e))},e.open(t.method||"get",r,!0);let i;(t.data||t.file)&&(t.file||(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.file&&i.append(t.filename,t.file,t.file.name),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 kt(t,e,r){return new Promise((i,s)=>{(e||wt)(G(_({},t),{onSuccess(n){let o=l=>l;const a=W(t.parse);h.Function(a)?o=a:a&&h.String(a)&&(o=l=>L(l,a)),Ce(o(n,t.targetRule,r)).then(l=>{i(l)})},onError(n){s(n)}}))})}function be(t){return x(t)}function yr(t){function e(n){return h.Undef(n)?n=t.fields():Array.isArray(n)||(n=[n]),n}function r(n,o,a){h.Undef(n)?n=Object.keys(_(_({},t.fieldCtx),t.nameCtx)):Array.isArray(n)||(n=[n]),n.forEach(l=>{const u=t.fieldCtx[l]||t.nameCtx[l];u&&u.forEach(c=>{F(c.rule,o,a),t.$render.clearCache(c)})})}function i(){const n=t.subForm;return Object.keys(n).reduce((o,a)=>{const l=n[a];return l&&(Array.isArray(l)?o.push(...l):o.push(l)),o},[])}const s={get isScope(){return t.vm.$props.subForm===!1},get isPreview(){return t.preview},get config(){return t.options},set config(n){t.fc.options.value=n},get options(){return t.options},set options(n){t.fc.options.value=n},get form(){return t.form},get rule(){return t.rules},get parent(){return t.vm.parent&&t.vm.parent.fapi},get top(){return s.parent?s.parent.top:s},get scope(){let n=t.vm;for(;n&&n.fapi;)if(n.$props.subForm)n=n.parent;else return n.fapi;return s.top},get children(){return i()},get siblings(){const n=t.vm.getGroupInject();if(n){const o=n.getSubForm();if(Array.isArray(o))return[...o]}},get index(){const n=s.siblings;if(n){const o=n.indexOf(s);return o>-1?o:void 0}},get formulas(){return _({},t.fc.formulas)},formData(n){if(n==null||typeof n=="boolean"){const o={};return Object.keys(t.form).forEach(a=>{(n===!0||t.ignoreFields.indexOf(a)===-1)&&(o[a]=be(t.form[a]))}),o}else return e(n).reduce((o,a)=>(o[a]=s.getValue(a),o),{})},getValue(n){const o=t.getFieldCtx(n);return o?be(o.rule.value):t.options.appendValue!==!1&&A(t.appendData,n)?be(t.appendData[n]):void 0},coverValue(n){const o=_({},n||{});t.deferSyncValue(()=>{t.appendData={},s.fields().forEach(a=>{const l=t.fieldCtx[a];if(l){const u=A(n,a);l.forEach(c=>{F(c.rule,"value",u?n[a]:void 0)}),delete o[a]}}),C(t.appendData,o)},!0)},setValue(n){let o=n;arguments.length>=2&&(o={[n]:arguments[1]}),t.deferSyncValue(()=>{Object.keys(o).forEach(a=>{const l=t.fieldCtx[a];if(!l)return t.appendData[a]=o[a];l.forEach(u=>{F(u.rule,"value",o[a])})})},!0)},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&&ee(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 l=t.sort.length-1,u;const c=t.getCtx(o);if(c)if(a){if(u=c.getPending("children",c.rule.children),!Array.isArray(u))return;l=c.rule.children.length-1}else l=c.root.indexOf(c.origin),u=c.root;else u=t.rules;u.splice(l+1,0,n)},prepend:(n,o,a)=>{let l=0,u;const c=t.getCtx(o);if(c)if(a){if(u=c.getPending("children",c.rule.children),!Array.isArray(u))return}else l=c.root.indexOf(c.origin),u=c.root;else u=t.rules;u.splice(l,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(l=>{F(l.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 l=t.fieldCtx[a][0];return o[a]=n?l.origin:l.rule,o},{})},component(n){return Object.keys(t.nameCtx).reduce((o,a)=>{const l=t.nameCtx[a].map(u=>n?u.origin:u.rule);return o[a]=l.length===1?l[0]:l,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=h.Object(n)?ee(n):t.getCtxs(n);o&&(o=Array.isArray(o)?o:[o],o.forEach(a=>{if(!a.deleted){const l=t.subForm[a.id];l&&(Array.isArray(l)?l.forEach(u=>{u.refresh()}):l&&l.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=>{F(t.vm,"isShow",!n)},changeStatus:()=>t.changeStatus,clearChangeStatus:()=>{t.changeStatus=!1},updateRule(n,o){t.getCtxs(n).forEach(a=>{C(a.rule,o)})},updateRules(n){Object.keys(n).forEach(o=>{s.updateRule(o,n[o])})},mergeRule:(n,o)=>{t.getCtxs(n).forEach(a=>{Y(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},findType(n,o){let a;return Object.keys(t.ctxs).forEach(l=>{const u=t.ctxs[l];u.rule.type===n&&(a=o?u.origin:u.rule)}),a},findTypes(n,o){let a=[];return Object.keys(t.ctxs).forEach(l=>{const u=t.ctxs[l];u.rule.type===n&&a.push(o?u.origin:u.rule)}),a},getRenderRule:n=>{const o=t.getCtx(n);if(o)return o.prop},getRefRule:n=>{const o=t.getCtxs(n);if(o){const a=o.map(l=>l.rule);return a.length===1?a[0]:a}},setEffect(n,o,a){const l=t.getCtx(n);l&&o&&(o[0]==="$"&&(o=o.substr(1)),A(l.rule,"$"+o)&&F(l.rule,"$"+o,a),A(l.rule,"effect")||F(l.rule,"effect",{}),F(l.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(){s.refresh()},resetFields(n){e(n).forEach(o=>{t.getCtxs(o).forEach(a=>{t.$render.clearCache(a),a.rule.value=be(a.defaultValue)})}),y.nextTick(()=>{y.nextTick(()=>{y.nextTick(()=>{s.clearValidateState(n)})})}),n==null&&(h.Function(t.options.onReset)&&O(()=>t.options.onReset(s)),t.vm.$emit("reset",s))},method(n,o){const a=s.el(n);if(!a||!a[o])throw new Error(nt("err",`${o} 方法不存在`));return(...l)=>a[o](...l)},exec(n,o,...a){return O(()=>s.method(n,o)(...a))},toJson(n){return $e(s.rule,n)},trigger(n,o,...a){const l=s.el(n);l&&l.$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},getChildrenRuleList(n){const o=typeof n=="object",a=o?ee(n):t.getCtx(n),l=a?a.rule:o?n:s.getRule(n);if(!l)return[];const u=[];return(p=>{p&&p.forEach(d=>{typeof d=="object"&&(d.field&&u.push(d),u.push(...s.getChildrenRuleList(d)))})})(a?a.loadChildrenPending():l.children),u},getParentRule(n){return(typeof n=="object"?ee(n):t.getCtx(n)).parent.rule},getParentSubRule(n){const a=typeof n=="object"?ee(n):t.getCtx(n);if(a){const l=a.getParentGroup();if(l)return l.rule}},getChildrenFormData(n,o){return s.getChildrenRuleList(n).reduce((l,u)=>((u.ignore!==!0||o===!0)&&(l[u.field]=be(u.value)),l),{})},setChildrenFormData(n,o,a){const l=s.getChildrenRuleList(n);t.deferSyncValue(()=>{l.forEach(u=>{A(o,u.field)?F(u,"value",o[u.field]):a&&F(u,"value",void 0)})})},getGlobalEvent(n){let o=s.options.globalEvent[n];if(o)return typeof o=="object"&&(o=o.handle),W(o)},getGlobalData(n){return new Promise((o,a)=>{let l=s.options.globalData[n];l?l.type==="fetch"?s.fetch(l).then(u=>{o(u)}).catch(a):o(l.data):o(t.fc.loadData[n])})},setGlobalData(n,o){s.setData("$globalData."+n,o)},setGlobalVar(n,o){s.setData("$var."+n,o)},renderRule(n,o,a){const u=typeof n=="object"?ee(n):t.getCtx(n);return u?t.$render.createRuleVnode(u,o,a):void 0},renderChildren(n,o,a){const u=typeof n=="object"?ee(n):t.getCtx(n);return u?t.$render.createChildrenVnodes(u,o,a):void 0},nextTick(n){t.bus.$once("next-tick",n),t.refresh()},nextRefresh(n){t.nextRefresh(),n&&O(n)},emit(n,...o){t.vm.$emit(n,...o)},deferSyncValue(n,o){t.deferSyncValue(n,o)},bus:t.bus,getCurrentFormRule(){var n;return(n=t.vm.getGroupInject())==null?void 0:n.rule},fetch(n){return new Promise((o,a)=>{n=x(n),n=t.loadFetchVar(n),t.beforeFetch(n).then(()=>kt(n,t.fc.create.fetch,s).then(l=>{O(()=>n.onSuccess&&n.onSuccess(l)),o(l)}).catch(l=>{O(()=>n.onError&&n.onError(l)),a(l)})).catch(l=>{})})},watchFetch(n,o,a,l){return t.fc.watchLoadData((u,c)=>{let p=x(n);p=t.loadFetchVar(p,u),!(l&&l(p,c)===!1)&&t.beforeFetch(p).then(()=>kt(p,t.fc.create.fetch,s).then(d=>{O(()=>p.onSuccess&&p.onSuccess(d)),o&&o(d,c)}).catch(d=>{O(()=>p.onError&&p.onError(d)),a&&a(d)})).catch(d=>{})},n.wait==null?1e3:n.wait)},getData(n,o){return t.fc.get?t.fc.get(n,o):t.fc.getLoadData(n,o)},setData(n,o,a){return t.fc.setData(n,o,a)},refreshData(n){return t.fc.refreshData(n)},t(n,o){return t.fc.t(n,o)},getLocale(){return t.fc.getLocale()},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 $r(t){C(t.prototype,{initCache(){this.clearCacheAll()},clearCache(e){if(!e.rule.cache){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(),this.cache[e.id].parent&&this.clearCache(this.cache[e.id].parent),this.cache[e.id]=null}},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 J(t){const e=t.replace(/(-[a-z])/g,function(r){return r.replace("-","").toLocaleUpperCase()});return Ot(e)}function Ot(t){return t.replace(t[0],t[0].toLowerCase())}function br(t){C(t.prototype,{initRender(){this.cacheConfig={}},getTypeSlot(e){const r=i=>{if(i){let s;return e.rule.field&&(s=i.$scopedSlots["field-"+de(e.rule.field)]||i.$scopedSlots["field-"+e.rule.field]),s||(s=i.$scopedSlots["type-"+de(e.type)]||i.$scopedSlots["type-"+e.type]),s||r(i.$pfc)}};return r(this.vm)},render(){if(!this.vm.isShow)return;this.$manager.beforeRender();const e=ke();return this.sort.forEach(r=>{this.renderSlot(e,this.$handle.ctxs[r])}),this.$manager.render(e)},renderSlot(e,r,i){this.isFragment(r)?(r.initProp(),this.mergeGlobal(r),r.initNone(),this.renderChildren(r.loadChildrenPending(),r,r.rule.slot).forEach(n=>{e.setSlot(r.rule.slot,n)})):e.setSlot(r.rule.slot,this.renderCtx(r,i))},mergeGlobal(e){this.$handle.options.global&&(this.cacheConfig[e.trueType]||(this.cacheConfig[e.trueType]=y.computed(()=>{const i=this.$handle.options.global;return Y({},[i["*"]||i.default||{},i[e.originType]||i[e.type]||i[e.type]||{}])})),e.prop=Y({},[this.cacheConfig[e.trueType].value,e.prop]))},setOptions(e){const r=e.loadPending({key:"options",origin:e.prop.options,def:[]});e.prop.options=r,e.prop.optionsTo&&r&&ne(e.prop,e.prop.optionsTo,r)},deepSet(e){const r=e.rule.deep;r&&Object.keys(r).sort((i,s)=>i.length<s.length?-1:1).forEach(i=>{ne(e.prop,i,r[i])})},parseSide(e,r){return h.Object(e)?Y({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))]},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){try{if(e.type==="hidden")return;const i=e.rule;if(this.force||!this.cache[e.id]||this.cache[e.id].slot!==i.slot){let s;e.initProp(),this.mergeGlobal(e),e.initNone(),this.$manager.tidyRule(e),this.deepSet(e),this.setOptions(e),this.ctxProp(e);let n=e.prop;n.preview=!!(n.preview!=null?n.preview:this.$handle.preview),n.props.formCreateInject=this.injectProp(e);let o=n.cache!==!1;const a=n.preview;if(n.hidden){this.setCache(e,void 0,r);return}s=(...l)=>{const u={rule:i,prop:n,preview:a,api:this.$handle.api,model:n.model||{},slotValue:l};l.length&&i.slotUpdate&&O(()=>i.slotUpdate(u));let c=[];const p=e.loadChildrenPending();e.parser.renderChildren?c=e.parser.renderChildren(p,e):e.parser.loadChildren!==!1&&(c=this.renderChildren(p,e)),Object.keys(n.renderSlots||{}).forEach($=>{c.push(this.renderRule({type:"template",slot:$},(()=>{if(h.Function(n.renderSlots[$]))return O(()=>n.renderSlots[$]());const w=this.parseSide(n.renderSlots[$],e);return this.renderRule(w)})()))});const d=this.getTypeSlot(e);let g;return d?(u.children=c,g=d(u)):g=a?e.parser.preview(Pe(c),e):e.parser.render(Pe(c),e),g=this.renderSides(g,e),!(!e.input&&h.Undef(n.native))&&n.native!==!0&&(this.fc.targetFormDriver("updateWrap",e),g=this.$manager.makeWrap(e,g)),e.none&&(Array.isArray(g)?g=g.map($=>!$||!$.tag?$:this.none($)):g=this.none(g)),o&&this.setCache(e,()=>this.stable(g),r),g},this.setCache(e,s,r)}return(...s)=>{const n=this.getCache(e);if(n)return n(...s);if(this.cache[e.id])return;const o=this.renderCtx(e,e.parent);if(o)return o()}}catch(i){console.error(i);return}},none(e){if(e)return e.data.class=this.mergeClass(e.data.class,"fc-none"),e},mergeClass(e,r){if(Array.isArray(e))e.push(r);else return e?[e,r]:r;return e},stable(e){return(Array.isArray(e)?e:[e]).forEach(i=>{i&&i.tag&&i.children&&typeof i.children=="object"&&(i.children.$stable=!0,this.stable(i.children))}),e},getModelField(e){return e.prop.modelField||e.parser.modelField||this.fc.modelFields[this.vNode.aliasMap[e.type]]||this.fc.modelFields[e.type]||this.fc.modelFields[e.originType]||"value"},isFragment(e){return e.type==="fragment"||e.type==="template"},injectProp(e){const r=this.vm;r.ctxInject[e.id]||F(r.ctxInject,e.id,{api:this.$handle.api,form:this.fc.create,subForm:n=>{this.$handle.addSubForm(e,n)},getSubForm:()=>this.$handle.subForm[e.id],slots:()=>this.vm.top.$scopedSlots,getWrap:()=>this.vm.$refs[e.wrapRef],options:[],children:[],preview:!1,id:e.id,field:e.field,rule:e.rule,input:e.input,t:(...n)=>this.$handle.api.t(...n),updateValue:n=>{this.$handle.onUpdateValue(e,n)}});const i=r.ctxInject[e.id],s={preview:e.prop.preview,options:e.prop.options,prop:function(){const n=_({},e.prop);return n.on=n.on?_({},n.on):{},delete n.model,n}(),children:e.loadChildrenPending()};return Object.keys(s).forEach(n=>{F(i,n,s[n])}),i},ctxProp(e){const{ref:r,key:i,rule:s}=e;this.$manager.mergeProp(e),e.parser.mergeProp(e);const n=_({},e.prop.on||{}),o={};Object.keys(n).forEach(l=>{if(l.indexOf("native.")===0)o[l.replace("native.","")]=n[l],delete n[l];else if(this.$handle.options.transformEventName!==!1){const u=de(l);u!==l.toLowerCase()&&!n[u]&&(n[u]=n[l])}}),e.prop.on=n;const a=[{ref:r,key:s.key||`${i}fc`,slot:void 0,on:{"hook:mounted":()=>{this.onMounted(e)},"fc.updateValue":l=>{this.$handle.onUpdateValue(e,l)},"fc.el":l=>{e.exportEl=l,l&&((l.$el||l).__rule__=e.rule)}}},{nativeOn:o}];if(e.input){const l=this.tmpInput;this.vm.$props.disabled===!0&&(e.prop.props.disabled=!0),e.prop.model={value:this.$handle.getFormData(e),callback:u=>{l&&l(e.field,u,e.rule),this.onInput(e,u)},expression:`formData.${e.id}`},e.prop.modelEmit&&a.push({on:{[e.prop.modelEmit]:()=>this.onEmitInput(e)}})}return Q(a,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"),this.$handle.targetHook(e,"mounted")},onInput(e,r){if(e.prop.modelEmit){this.$handle.onBaseInput(e,r);return}this.$handle.onInput(e,r)},onEmitInput(e){this.$handle.setValue(e,e.parser.toValue(e.modelValue,e),e.modelValue)},renderChildren(e,r,i){if(!h.trueArray(e))return[];const s=ke();return e.map(n=>{if(n){if(h.String(n))return s.setSlot(null,i?this.renderRule({type:"template",children:[n]}):n);if(n.__fc__)return this.renderSlot(s,n.__fc__,r);n.type&&y.nextTick(()=>{this.$handle.loadChildren(e,r),this.$handle.refresh()})}}),s.getSlots()},defaultRender(e,r){const i=e.prop;return i.component?typeof i.component=="string"?this.vNode.make(i.component,i,r):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(Ot(i.type),i,r)},createChildrenVnodes(e,r,i){this.force=i!==!1,this.tmpInput=r;const s=this.renderChildren(e.rule.children,e);return this.force=!1,this.tmpInput=null,s},createRuleVnode(e,r,i){this.force=i!==!1,this.tmpInput=r;const s=ke();return this.renderSlot(s,e,e.parent),this.force=!1,this.tmpInput=null,s.getSlots()},renderRule(e,r,i){if(!e)return;if(h.String(e))return e;let s;if(i)s=e.type;else if(s=e.is,e.type){s=J(e.type);const a=this.vNode.aliasMap[s];a&&(s=J(a))}if(!s)return;const n=ke();h.trueArray(e.children)&&e.children.forEach(a=>{a&&n.setSlot(a==null?void 0:a.slot,()=>this.renderRule(a))});const o=_({},e);return delete o.type,delete o.is,this.vNode.make(s,o,n.mergeBag(r).getSlots())}})}let vr=1;function Ge(t){C(this,{$handle:t,fc:t.fc,vm:t.vm,$manager:t.$manager,vNode:new t.fc.CreateNode(t),force:!1,tmpInput:null,id:vr++}),pt(this,{options(){return t.options},sort(){return t.sort}}),this.initCache(),this.initRender()}$r(Ge),br(Ge);function _r(t){C(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(h.Function(r)&&(i!==!1&&!h.Undef(i)||r.__inject))return this.inject(e,r,i);if(!s&&Array.isArray(r)&&r[0]&&(h.String(r[0])||h.Function(r[0])))return this.parseEventLst(e,r,i,!0);if(h.String(r)){const n=W(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:l}=s,u=s[r?"emit":"nativeEmit"]||[];return h.trueArray(u)&&u.forEach(c=>{if(!c)return;let p,d=n||o||a;if(h.Object(c)&&(p=c.inject,c=c.name,d=c.prefix||d),d){r||(d=`native-${d}`);const g=de(`${d}-${c}`),$=(...w)=>{this.vm.$emit(g,...w),this.vm.$emit("emit-event",g,...w),this.bus.$emit(g,...w)};if($.__emit=!0,!p&&l===!1)i[c]=$;else{let w=p||l||this.options.injectEvent;i[c]=h.Undef(w)?$:this.inject(s,$,w)}}}),e.computed[r?"on":"nativeOn"]=i,i},getInjectData(e,r){const i=e.__fc__&&e.__fc__.$api,s=e.__fc__&&e.__fc__.$handle.vm||this.vm,{option:n,rule:o}=s.$props||s.$options.propsData;return{$f:i||this.api,api:i||this.api,rule:o,self:e.__origin__,option:n,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},loadStrVar(e,r,i){if(e&&typeof e=="string"&&e.indexOf("{{")>-1&&e.indexOf("}}")>-1){const s=e,n=hr(e),o=u=>{let c=!1,p;if(i&&u.indexOf("$form.")===0){const d=u.split(".");d.shift(),A(i.value,d[0])&&(c=!0,p=r?r({id:"$form."+d[0]+"_"+i.rule.__fc__.id,getValue:()=>L(i.value,d)}):L(i.value,d))}return c||(p=r?r(u):this.fc.getLoadData(u)),p},a=u=>{const c=[];u.forEach(d=>{d.key?c.push(d.key):d.children&&c.push(a(d.children))});let p=!1;return c.forEach((d,g)=>{d!=null&&(d.indexOf("'")===0||d.indexOf('"')===0)&&(c[g]=d.slice(1,-1),p=!0)}),c.length===1&&(p||!isNaN(Number(c[0])))?c[0]:o(c.join("."))};let l;if(n.forEach(u=>{const c=u.split("||"),p=c[0].trim();if(p){const d=(c[1]||"").trim(),g=yt(p);let $=O(()=>a(g));($==null||$==="")&&c.length>1&&($=d),l=$,e=e.replaceAll(`{{${u}}}`,$==null?"":$)}}),n.length===1&&s===`{{${n[0]}}}`)return l}return e},loadFetchVar(e,r,i){let s;i&&i.__fc__&&(s=i.__fc__.getParentGroup());const n=o=>this.loadStrVar(o,r,s?{rule:i,value:this.subRuleData[s.id]||{}}:null);return e.action=n(e.action||""),["headers","data","query"].forEach(o=>{if(e[o]){const a=Array.isArray(e[o])?[]:{};Object.keys(e[o]).forEach(l=>{a[n(l)]=n(e[o][l])}),e[o]=a}}),e}})}const Ft=["hook:updated","hook:mounted"];function Cr(t){C(t.prototype,{usePage(){const e=this.options.page;if(!e)return;let r=25,i=wr(this.rules);h.Object(e)&&(e.first&&(r=parseInt(e.first,10)||r),e.limit&&(i=parseInt(e.limit,10)||i)),C(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(Ft,e),this.bus.$emit("page-end")):(this.first+=this.limit,this.pageEnd=this.rules.length<=this.first,this.loadRule(),this.refresh())};this.vm.$on(Ft,e)}})}function wr(t){return t.length<31?31:Math.ceil(t.length/3)}function kr(t){C(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 Or(t){Object.defineProperties(t.origin,{__fc__:qe(y.markRaw(t),!0)}),t.rule!==t.origin&&Object.defineProperties(t.rule,{__fc__:qe(y.markRaw(t),!0)})}function Et(t,e,r){const i=we(),s=!!e.field;C(this,{id:i,ref:i,wrapRef:i+"fi",rule:e,origin:e.__origin__||e,name:e.name,pending:{},none:!1,watch:[],linkOn:[],root:[],ctrlRule:[],children:[],parent:null,group:e.subRule?this:null,cacheConfig:null,prop:_({},e),computed:{},payload:{},refRule:{},input:s,el:void 0,exportEl:void 0,defaultValue:s?x(r):void 0,field:e.field||void 0}),this.updateKey(),Or(this),this.update(t,!0)}C(Et.prototype,{getParentGroup(){let t=this.parent;for(;t;){if(t.group)return t;t=t.parent}},loadChildrenPending(){const t=this.rule.children||[];return Array.isArray(t)?t:this.loadPending({key:"children",origin:t,def:[],onLoad:e=>{this.$handle&&this.$handle.loadChildren(e,this)},onUpdate:(e,r)=>{this.$handle&&(e===r?this.$handle.loadChildren(e,this):this.$handle.updateChildren(this,e,r))},onReload:e=>{this.$handle?this.$handle.updateChildren(this,[],e):delete this.pending.children}})},loadPending(t){const{key:e,origin:r,def:i,onLoad:s,onReload:n,onUpdate:o}=t;if(this.pending[e]&&this.pending[e].origin===r)return this.getPending(e,i);delete this.pending[e];let a=r;if(h.Function(r)){let l=O(()=>r({rule:this.rule,api:this.$api,update:u=>{const c=u||i,p=this.getPending(e,i);this.setPending(e,r,c),o&&o(c,p)},reload:()=>{const u=this.getPending(e,i);delete this.pending[e],n&&n(u),this.$api&&this.$api.sync(this.rule)}}));l&&h.Function(l.then)?(l.then(u=>{const c=u||i;this.setPending(e,r,c),s&&s(c),this.$api&&this.$api.sync(this.rule)}).catch(u=>{console.error(u)}),a=i,this.setPending(e,r,a)):(a=l||i,this.setPending(e,r,a),s&&s(a))}return a},getPending(t,e){return this.pending[t]&&this.pending[t].value||e},setPending(t,e,r){this.pending[t]={origin:e,value:y.reactive(r)}},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=we(),t&&this.parent&&this.parent.updateKey(t)},updateType(){this.originType=this.rule.type,this.type=J(this.rule.type),this.trueType=this.$handle.getType(this.originType)},setParser(t){this.parser=t,t.init(this)},initProp(){var e,r;const t=_({},this.rule);delete t.children,delete t.validate,this.prop=Y({},[t,...Object.keys(this.payload).map(i=>this.payload[i]),this.computed]),this.prop.validate=[...((r=(e=this.refRule)==null?void 0:e.__$validate)==null?void 0:r.value)||[],...this.prop.validate||[]]},initNone(){this.none=!(h.Undef(this.prop.display)||this.prop.display)},hasHidden(){return!!this.rule.hidden||(this.parent?this.parent.hasHidden():!1)},injectValidate(){return this.prop.validate},check(t){return this.vm===t.vm},unwatch(){this.watch.forEach(t=>t()),this.watch=[],Object.keys(this.refRule).forEach(t=>{t.indexOf("__$")!==0&&delete this.refRule[t]})},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(),this.parent&&this.parent.children.splice(this.parent.children.indexOf(this)>>>0,1),C(this,{deleted:!0,computed:{},parent:null,children:[],cacheConfig:null,none:!1})},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),C(this,{root:[]})},this.input)})},update(t,e){C(this,{deleted:!1,$handle:t,$render:t.$render,$api:t.api,vm:t.vm,vNode:t.$render.vNode,updated:!1,cacheValue:this.rule.value}),!e&&this.unwatch(),this.watchTo(),this.link(),this.updateType()}});function Fr(t){C(t.prototype,{nextRefresh(e){const r=this.loadedId;y.nextTick(()=>{r===this.loadedId&&(e?e():this.refresh())})},parseRule(e){const r=dt(e);return Object.defineProperties(r,{__origin__:qe(e,!0)}),Er(r),this.appendValue(r),[r,r.prefix,r.suffix].forEach(i=>{i&&this.loadFn(i,r)}),this.loadCtrl(r),r.update&&(r.update=W(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=W(r.handle))})},syncProp(e){const r=e.rule;h.trueArray(r.sync)&&Q([{on:r.sync.reduce((i,s)=>(i[typeof s=="object"&&s.event||`update:${s}`]=n=>{r.props[typeof s=="object"&&s.prop||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.syncForm(),this.pageEnd&&this.bus.$emit("load-end"),this.vm.renderRule()})},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.syncForm(),this.bus.$emit("load-end"),this.$render.clearCache(r)},_loadRule(e,r){const i=o=>{let a=e[o-1];if(!a||!a.__fc__)return o>0?i(o-1):-1;let l=this.sort.indexOf(a.__fc__.id);return l>-1?l:i(o-1)},s=(o,a)=>{h.trueArray(o)&&this._loadRule(o,a)},n=e.map((o,a)=>{if(r&&!h.Object(o)||!this.pageEnd&&!r&&a>=this.first)return;if(o.__fc__&&o.__fc__.root===e&&this.ctxs[o.__fc__.id])return s(o.__fc__.loadChildrenPending(),o.__fc__),o.__fc__;let l=dt(o);const u=()=>!!(l.field&&this.fieldCtx[l.field]&&this.fieldCtx[l.field][0]!==o.__fc__);this.fc.targetFormDriver("loadRule",{rule:l,api:this.api},this.fc),this.ruleEffect(l,"init",{repeat:u()}),u()&&this.vm.$emit("repeat-field",o,this.api);let c,p=!1,d=!!o.__fc__,g=l.value;if(d){if(c=o.__fc__,g=c.defaultValue,c.deleted){if(Rt(c))return;c.update(this)}else if(!c.check(this)){if(Rt(c))return;e[a]=o=o._clone?o._clone():st($e(o)),c=null,p=!0}}if(c)c.originType!==c.rule.type&&c.updateType(),this.bindParser(c),this.appendValue(c.rule),c.parent&&c.parent!==r&&this.rmSubRuleData(c);else{const E=this.parseRule(o);c=new Et(this,E,g),this.bindParser(c)}[!1,!0].forEach(E=>this.parseEmit(c,E)),this.syncProp(c),c.parent=r||null,c.root=e,this.setCtx(c),!p&&!d&&(this.effect(c,"load"),this.targetHook(c,"load")),this.effect(c,"created");const $=c.loadChildrenPending();if(c.parser.loadChildren===!1||s($,c),!r){const E=i(a);E>-1||!a?this.sort.splice(E+1,0,c.id):this.sort.push(c.id)}const w=c.rule;return c.updated||(c.updated=!0,h.Function(w.update)&&this.bus.$once("load-end",()=>{this.refreshUpdate(c,w.value,"init")}),this.effect(c,"loaded")),this.refreshControl(c)&&(this.cycleLoad=!0),c}).filter(o=>!!o);r&&(r.children=n)},refreshControl(e){return e.input&&e.rule.control&&this.useCtrl(e)},useCtrl(e){const r=Rr(e),i=[],s=this.api;if(!r.length)return!1;for(let a=0;a<r.length;a++){const l=r[a],u=l.handle||function(p){return(ae[l.condition||"=="]||ae["=="])(p,l.value)};if(!h.trueArray(l.rule))continue;const c=G(_({},l),{valid:O(()=>u(e.rule.value,s)),ctrl:Sr(e,l.rule),isHidden:h.String(l.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:l,rule:u,prepend:c,append:p,child:d,ctrl:g,method:$})=>{if(a){l?e.ctrlRule.push({__ctrl:!0,children:u,valid:l}):g&&e.ctrlRule.splice(e.ctrlRule.indexOf(g)>>>0,1),n[l?"push":"unshift"](()=>{$==="disabled"||$==="enabled"?this.api.disabled(!l,u):$==="display"||$==="show"?this.api.display(l,u):$==="required"?(u.forEach(w=>{this.api.setEffect(w,"required",l)}),l||this.api.clearValidateState(u)):$==="if"?this.api.hidden(!l,u):this.api.hidden(!l,u)});return}if(l){o=!0;const w={type:"fragment",native:!0,__ctrl:!0,children:u};e.ctrlRule.push(w),this.bus.$once("load-start",()=>{c?s.prepend(w,c,d):p||d?s.append(w,p||e.id,d):e.root.splice(e.root.indexOf(e.origin)+1,0,w)})}else{e.ctrlRule.splice(e.ctrlRule.indexOf(g),1);const w=ee(g);w&&w.rm()}})}),n.length&&(this.loading?n.length&&this.bus.$once("load-end",()=>{n.forEach(a=>a())}):n.length&&y.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=_({},this.ctxs);this.clearNextTick(),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.vm.$emit("update",this.api),this.bus.$off("next-tick",this.nextReload),this.bus.$once("next-tick",this.nextReload)},refresh(){this.vm.refresh()}})}function Er(t){const e=$t();return Object.keys(e).forEach(r=>{A(t,r)||F(t,r,e[r])}),t}function Rr(t){const e=t.rule.control||[];return h.Object(e)?[e]:e}function Sr(t,e){for(let r=0;r<t.ctrlRule.length;r++){const i=t.ctrlRule[r];if(i.children===e)return i}}function Rt(t){return!!t.rule.__ctrl}function jr(t){C(t.prototype,{setValue(e,r,i,s){e.deleted||(e.rule.value=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.targetHook(e,"value",{value:r}),this.emitEvent("change",e.field,r,{rule:e.origin,api:this.api,setFlag:s||!1}),s&&y.nextTick(()=>{y.nextTick(()=>{y.nextTick(()=>{this.api.clearValidateState(e.id)})})}),this.$manager.fieldChange(e,r,i,s))},onInput(e,r){let i;e.input&&(this.isQuote(e,i=e.parser.toValue(r,e))||this.isChange(e,r))&&this.setValue(e,i,r)},onUpdateValue(e,r){this.deferSyncValue(()=>{const i=e.getParentGroup(),s=i?this.subRuleData[i.id]:null,n={};Object.keys(r||{}).forEach(o=>{s&&A(s,o)?n[o]=r[o]:A(this.api.form,o)?this.api.form[o]=r[o]:this.api.top!==this.api&&A(this.api.top.form,o)&&(this.api.top.form[o]=r[o])}),Object.keys(n).length&&this.api.setChildrenFormData(i.rule,n)})},onBaseInput(e,r){this.setFormData(e,r),e.modelValue=r,this.nextRefresh(),this.$render.clearCache(e)},setFormData(e,r){e.modelValue=r;const i=e.getParentGroup();i&&(this.subRuleData[i.id]||F(this.subRuleData,i.id,{}),F(this.subRuleData[i.id],e.field,e.rule.value)),F(this.formData,e.id,r)},rmSubRuleData(e){const r=e.getParentGroup();r&&this.subRuleData[r.id]&&re(this.subRuleData[r.id],e.field)},getFormData(e){return this.formData[e.id]},syncForm(){const e={},r=this.fields(),i=[];this.options.appendValue!==!1&&Object.keys(this.appendData).reduce((s,n)=>(r.indexOf(n)===-1&&(s[n]=y.toRef(this.appendData,n)),s),e),r.reduce((s,n)=>{let o=(this.fieldCtx[n]||[]).filter(a=>!this.isIgnore(a))[0];return o||(o=this.fieldCtx[n][0],i.push(n)),s[n]=y.toRef(o.rule,"value"),s},e),this.form=y.reactive(e),this.ignoreFields=i,this.syncValue()},isIgnore(e){return e.rule.ignore===!0||(e.rule.ignore==="hidden"||this.options.ignoreHiddenFields)&&e.hasHidden()},appendValue(e){(!e.field||!A(this.appendData,e.field))&&(!h.Undef(e.value)||!this.options.forceCoverValue)||(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),O(e),this.deferSyncFn===e&&(this.deferSyncFn=null,e.sync&&this.syncForm())},syncValue(){if(this.deferSyncFn)return this.deferSyncFn.sync=!0;const e={};Object.keys(this.form).forEach(r=>{this.ignoreFields.indexOf(r)===-1&&(e[r]=this.form[r])}),this.vm.updateValue(e)},isChange(e,r){return JSON.stringify(this.getFormData(e),St)!==JSON.stringify(r,St)},isQuote(e,r){return(r instanceof Function||h.Object(r)||Array.isArray(r))&&r===e.rule.value},refreshUpdate(e,r,i,s){if(h.Function(e.rule.update)){const n=O(()=>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;h.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 St(t,e){return typeof e=="function"?""+e:e}const Ee={init(t){},toFormValue(t,e){return t},toValue(t,e){return t},mounted(t){},render(t,e){return e.$handle.fc.renderDriver&&e.$handle.fc.renderDriver.defaultRender?e.$handle.fc.renderDriver.defaultRender(e,t):e.$render.defaultRender(e,t)},preview(t,e){return e.$handle.fc.renderDriver&&e.$handle.fc.renderDriver.defaultPreview?e.$handle.fc.renderDriver.defaultPreview(e,t):this.render(t,e)},mergeProp(t){}},Ar=["field","value","vm","template","name","config","control","inject","sync","payload","optionsTo","update","slotUpdate","computed","component","cache"],ve=Symbol("oldValue");function Dr(t){C(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,i=this.fc.renderDriver;if(i){const s=i.parsers||{},n=s[e.originType]||s[J(e.type)]||s[e.trueType];if(n)return n}return r[e.originType]||r[J(e.type)]||r[e.trueType]||Ee},bindParser(e){e.setParser(this.getParser(e))},getType(e){const r=this.fc.CreateNode.aliasMap,i=r[e]||r[J(e)]||e;return J(i)},noWatch(e){this.noWatchFn||(this.noWatchFn=e),O(e),this.noWatchFn===e&&(this.noWatchFn=null)},watchCtx(e){if(ct().filter(i=>i[0]!=="_"&&i[0]!=="$"&&Ar.indexOf(i)===-1).forEach(i=>{const s=y.toRef(e.rule,i),n=i==="children";e.refRule[i]=s,e.watch.push(y.watch(n?()=>h.Function(s.value)?s.value:[...s.value||[]]:()=>s.value,(o,a)=>{let l=s.value;if(!this.isBreakWatch()){if(n&&e.parser.loadChildren===!1){this.$render.clearCache(e),this.nextRefresh();return}if(this.watching=!0,y.nextTick(()=>{this.targetHook(e,"watch",{key:i,oldValue:a,newValue:l})}),i==="hidden"&&!!l!=!!a&&(this.$render.clearCacheAll(),y.nextTick(()=>{this.targetHook(e,"hidden",{value:l})})),i==="ignore"&&e.input||i==="hidden"&&e.input&&(e.rule.ignore==="hidden"||this.options.ignoreHiddenFields))this.syncForm();else if(i==="link"){e.link();return}else["props","on","nativeOn","deep"].indexOf(i)>-1?(this.parseInjectEvent(e.rule,l||{}),i==="props"&&e.input&&this.setFormData(e,e.parser.toFormValue(e.rule.value,e))):["emit","nativeEmit"].indexOf(i)>-1?this.parseEmit(e,i==="emit"):["prefix","suffix"].indexOf(i)>-1?l&&this.loadFn(l,e.rule):i==="type"?(e.updateType(),this.bindParser(e)):n&&(h.Function(a)&&(a=e.getPending("children",[])),h.Function(l)&&(l=e.loadChildrenPending()),this.updateChildren(e,l,a));this.$render.clearCache(e),this.refresh(),this.watching=!1}},{deep:!n,sync:n}))}),e.refRule.__$title=y.computed(()=>{let i=(typeof e.rule.title=="object"?e.rule.title.title:e.rule.title)||"";if(i){const s=i.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);s&&(i=this.api.t(s[1]))}return i}),e.refRule.__$info=y.computed(()=>{let i=(typeof e.rule.info=="object"?e.rule.info.info:e.rule.info)||"";if(i){const s=i.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);s&&(i=this.api.t(s[1]))}return i}),e.refRule.__$validate=y.computed(()=>{const i=s=>{var o,a;const n=s.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);return n?this.api.t(n[1],{title:(a=(o=e.refRule)==null?void 0:o.__$title)==null?void 0:a.value}):s};return q(e.rule.validate).map(s=>{const n=_({},s);if(n.message&&(n.message=i(n.message)),h.Function(n.validator)){const o=e;n.validator=function(...a){return s.validator.call({that:this,id:o.id,field:o.field,rule:o.rule,api:o.$handle.api},...a)}}if(n.adapter){if(typeof n.error=="object"){const o=_({},n.error);Object.keys(o).forEach(a=>{o[a]=i(o[a])}),n.error=o}return this.adapterValidate(n,e)}return n})}),e.input){const i=y.toRef(e.rule,"value");e.watch.push(y.watch(()=>i.value,()=>{let s=e.parser.toFormValue(i.value,e);this.isChange(e,s)&&this.setValue(e,i.value,s,!0)}))}this.bus.$once("load-end",()=>{let i=e.rule.computed;i&&(typeof i!="object"&&(i={value:i}),Object.keys(i).forEach(s=>{const n=y.computed(()=>{const a=i[s];if(!a)return;const l=this.compute(e,a);return(a.linkage||a.linkageVariable)&&l===ve?ve:l}),o=a=>{s==="value"?this.onInput(e,a):s[0]==="$"?this.api.setEffect(e.id,s,a):ne(e.rule,s,a)};(s==="value"?[void 0,null,""].indexOf(e.rule.value)>-1:n.value!==L(e.rule,s))&&o(n.value),e.watch.push(y.watch(n,(a,l)=>{a===ve||a===l||setTimeout(()=>{o(a)})},{deep:!0}))}))}),this.watchEffect(e)},adapterValidate(e,r){const i=(s,n)=>{if((e.beforeValidate&&O(()=>e.beforeValidate({value:s,api:this.api,validate:e,rule:r.rule})))===!1)n();else{const a=this.validator(r,s,e);if(a){let l="";typeof e.error=="object"&&(l=e.error[a]||e.error.default),!l&&typeof e.message=="string"&&(l=e.message),l||(l=this.getValidateMessage(r,{key:a,rule:e[a]})),n(l)}else if(e.validator){const l=e.validator&&O(()=>e.validator(s,n));l&&h.Function(l.then)&&l.then(()=>n()).catch(u=>n(u))}else n()}};return this.$manager.adapterValidate({required:e.required,message:e.message,target:e.trigger},i)},getValidateMessage(e,r){var s,n;const i=Array.isArray(r.rule)?r.rule.join(","):""+r.rule;return this.api.t(r.key==="required"?r.key:"validate."+r.key,{[r.key]:i,title:(n=(s=e.refRule)==null?void 0:s.__$title)==null?void 0:n.value})},validator(e,r,i){if(h.empty(r))return i.required?"required":void 0;for(const[n,o]of Object.entries(i))switch(n){case"len":case"maxLen":case"minLen":const a=$=>n==="len"?$===o:n==="maxLen"?$<=o:$>=o;if(Array.isArray(r)){if(!a(r.length))return n}else{if(typeof r=="object")return n;if(!a((""+r).length))return n}break;case"pattern":if(!(typeof o=="string"?new RegExp(o):o).test(""+r))return n;break;case"uppercase":if(o&&(typeof r!="string"||!/^[A-Z]*$/.test(r)))return n;break;case"lowercase":if(o&&(typeof r!="string"||!/^[a-z]*$/.test(r)))return n;break;case"min":case"max":case"positive":case"negative":case"integer":case"number":const u=Number(r);if(Number.isNaN(u)||n==="min"&&u<o||n==="max"&&u>o||n==="positive"&&u<=0||n==="negative"&&u>=0||n==="integer"&&!Number.isInteger(u))return n;break;case"equal":if(r!==o)return n;break;case"enum":if(Array.isArray(o)&&!o.includes(r))return n;break;case"hasKeys":if(typeof r!="object"||Array.isArray(o)&&o.some($=>!($ in r)))return n;break;case"email":if(!/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(""+r))return n;break;case"url":if(!new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$","i").test(""+r))return n;break;case"ip":if(!/^(2(5[0-5]{1}|[0-4]\d{1})|[0-1]?\d{1,2})(\.(2(5[0-5]{1}|[0-4]\d{1})|[0-1]?\d{1,2})){3}$/.test(""+r))return n;break;case"phone":if(!/^(?:(?:\+|00)86)?1[3-9]\d{9}$/.test(""+r))return n;break;case"computed":if(!this.compute(e,o))return n;break}},compute(e,r){let i;if(typeof r=="object"){const s=e.getParentGroup(),n=a=>{if(a=Array.isArray(a)?{mode:"AND",group:a}:a,!h.trueArray(a.group))return!0;const l=a.mode==="OR";let u=!0;for(let c=0;c<a.group.length;c++){const p=a.group[c];let d,g=null;if(p.variable)g=JSON.stringify(this.fc.getLoadData(p.variable))||"";else if(p.field)g=gt(p.field||"");else if(!p.mode)return!0;let $=p.compare;if($&&($=gt($||"")),p.mode?d=n(p):ae[p.condition]?h.Function(p.handler)?d=O(()=>p.handler(this.api,e.rule)):d=O(()=>new Function("$condition","$val","$form","$scope","$group","$rule",`with($form){with($scope){with(this){with($group){ return $condition['${p.condition}'](${g}, ${$||"$val"}); }}}}`).call(this.api.form,ae,p.value,this.api.top.form,this.api.top===this.api.scope?{}:this.api.scope.form,s?this.subRuleData[s.id]||{}:{},e.rule)):d=!1,l&&d)return!0;l||(u=u&&d)}return l?!1:u};let o=n(r);return o=r.invert===!0?!o:o,r.linkage?o?O(()=>this.computeValue(r.linkage,e,s),void 0):ve:r.linkageVariable?o?O(()=>this.fc.getLoadData(r.linkageVariable),void 0):ve:o}else if(h.Function(r))i=()=>r(this.api.form,this.api,e.rule);else{const s=e.getParentGroup();i=()=>this.computeValue(r,e,s)}return O(i,void 0)},computeValue(e,r,i){const s=this,n=Object.keys(this.fc.formulas).reduce((o,a)=>(o[a]=function(...l){return s.fc.formulas[a].call({that:this,rule:r.rule,api:s.api,fc:s.fc},...l)},o),{});return O(()=>new Function("$formulas","$form","$scope","$group","$rule","$api",`with($form){with($scope){with(this){with($group){with($formulas){ return ${e} }}}}}`).call(this.api.form,n,this.api.top.form,this.api.top===this.api.scope?{}:this.api.scope.form,i?this.subRuleData[i.id]||{}:{},r.rule,this.api))},updateChildren(e,r,i){this.deferSyncValue(()=>{i&&i.forEach(s=>{(r||[]).indexOf(s)===-1&&s&&!h.String(s)&&s.__fc__&&s.__fc__.parent===e&&this.rmCtx(s.__fc__)}),h.trueArray(r)&&(this.loadChildren(r,e),this.bus.$emit("update",this.api))})},rmSub(e){h.trueArray(e)&&e.forEach(r=>{r&&r.__fc__&&this.rmCtx(r.__fc__)})},rmCtx(e){if(e.deleted)return;const{id:r,field:i,input:s,name:n}=e;re(this.ctxs,r),re(this.formData,r),re(this.subForm,r),re(this.vm.ctxInject,r);const o=e.getParentGroup();o&&this.subRuleData[o.id]&&re(this.subRuleData[o.id],i),e.group&&re(this.subRuleData,r),s&&this.rmIdCtx(e,i,"field"),n&&this.rmIdCtx(e,n,"name"),s&&!A(this.fieldCtx,i)&&re(this.form,i),this.deferSyncValue(()=>{if(!this.reloading){if(e.parser.loadChildren!==!1){const l=e.getPending("children",e.rule.children);h.trueArray(l)&&l.forEach(u=>u&&u.__fc__&&this.rmCtx(u.__fc__))}e.root===this.rules&&this.vm.renderRule()}},s);const a=this.sort.indexOf(r);return a>-1&&this.sort.splice(a,1),this.$render.clearCache(e),e.delete(),this.effect(e,"deleted"),this.targetHook(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 Ir(t){C(t.prototype,{mounted(){const e=()=>{this.isMounted=!0,this.lifecycle("mounted")};this.pageEnd?e():this.bus.$once("page-end",e)},lifecycle(e){this.fc.targetFormDriver(e,this.api,this.fc),this.vm.$emit(e,this.api),this.emitEvent(e,this.api)},emitEvent(e,...r){const i=this.options[e]||this.options[J("on-"+e)];if(i){const s=W(i);h.Function(s)&&O(()=>s(...r))}this.bus.$emit(e,...r)},targetHook(e,r,i){var l,u,c,p;let s=(u=(l=e.prop)==null?void 0:l.hook)==null?void 0:u[r],n=(d,g)=>{d&&(d=Array.isArray(d)?d:[d],d.forEach($=>{O(()=>$(G(_({},i||{}),{self:e.rule,rule:e.rule,parent:g==null?void 0:g.rule,$f:this.api,api:this.api,option:this.vm.$props.option})))}))};n(s);let o="deep"+sr(r),a=e.parent;for(;a;){let d=(p=(c=a.prop)==null?void 0:c.hook)==null?void 0:p[o];n(d,a),a=a.parent}}})}function Pr(t){C(t.prototype,{useProvider(){const e=this.fc.providers;Object.keys(e).forEach(r=>{let i=e[r];h.Function(i)&&(i=i(this.fc)),i._c=Vr(i),this.onEffect(i,r),this.providers[r]=i})},onEffect(e,r){const i=[];(e._c||["*"]).forEach(s=>{const n=s==="*"?"*":this.getType(s);i.indexOf(n)>-1||(i.push(n),this.bus.$on(`p:${r||e.name}:${n}:${e.input?1:0}`,(o,a)=>{e[o]&&e[o](...a)}))}),e._used=i},watchEffect(e){let r={required:()=>{var i,s;return(A(e.rule,"$required")?e.rule.$required:(s=(i=e.rule)==null?void 0:i.effect)==null?void 0:s.required)||!1}};Object.keys(e.rule.effect||{}).forEach(i=>{r[i]=()=>e.rule.effect[i]}),Object.keys(e.rule).forEach(i=>{i[0]==="$"&&(r[i.substr(1)]=()=>e.rule[i])}),Object.keys(r).forEach(i=>{e.watch.push(y.watch(r[i],s=>{this.effect(e,"watch",{[i]:s})},{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(A(e,"$"+r))return e["$"+r];if(A(e,"effect")&&A(e.effect,r))return e.effect[r]},emitEffect({ctx:e,rule:r,input:i,type:s,custom:n},o,a){if(!s||["fcFragment","fragment"].indexOf(s)>-1)return;const l=n||Object.keys(r).reduce((u,c)=>(c[0]==="$"&&(u[c.substr(1)]=r[c]),u),_({},r.effect||{}));Object.keys(l).forEach(u=>{const c=this.providers[u];if(!c||c.input&&!i)return;let p;if(!c._c)p="*";else if(c._used.indexOf(s)>-1)p=s;else return;const d=_({value:l[u],getValue:()=>this.getEffect(r,u)},a||{});e&&(d.getProp=()=>e.effectData(u),d.clearProp=()=>e.clearEffectData(u),d.mergeProp=g=>Y(d.getProp(),[g]),d.id=e.id),this.bus.$emit(`p:${u}:${p}:${c.input?1:0}`,o,[d,r,this.api])})}})}function Tr(t){return t.filter(function(e,r,i){return i.indexOf(e,0)===r})}function Vr(t){const e=t.components;if(Array.isArray(e)){const r=Tr(e.filter(i=>i!=="*"));return r.length?r:!1}else return h.String(e)?[e]:!1}function z(t){pt(this,{options(){return t.options.value||{}},bus(){return t.bus},preview(){return t.vm.$props.preview!=null?t.vm.$props.preview:t.vm.parent&&t.vm.parent.$props.preview!=null?t.vm.parent.$props.preview:t.options.value.preview||!1}}),C(this,{fc:t,vm:t.vm,watching:!1,loading:!1,reloading:!1,noWatchFn:null,deferSyncFn:null,isMounted:!1,formData:y.reactive({}),subRuleData:y.reactive({}),subForm:{},form:y.reactive({}),appendData:{},ignoreFields:[],providers:{},cycleLoad:null,loadedId:1,nextTick:null,changeStatus:!1,pageEnd:!0,nextReload:()=>{this.lifecycle("reload")}}),this.initData(t.rules),this.$manager=new t.manager(this),this.$render=new Ge(this),this.api=t.extendApiFn.reduce((e,r)=>{const i=O(()=>r(e,this));return i&&i!==e&&C(e,i),e},yr(this))}C(z.prototype,{initData(t){C(this,{ctxs:{},fieldCtx:{},nameCtx:{},sort:[],rules:t})},init(){this.updateAppendData(),this.useProvider(),this.usePage(),this.loadRule(),this.$manager.__init(),this.lifecycle("created")},updateAppendData(){this.appendData=_(_(_({},this.options.formData||{}),this.fc.vm.$props.value||{}),this.appendData)},isBreakWatch(){return this.loading||this.noWatchFn||this.reloading},globalBeforeFetch(t){return new Promise((e,r)=>{const i=this.options.beforeFetch&&O(()=>this.options.beforeFetch(t,{api:this.api}));i&&h.Function(i.then)?i.then(e).catch(r):e()})},beforeFetch(t){return new Promise((e,r)=>{const i=t&&t.beforeFetch&&O(()=>t.beforeFetch(t,{api:this.api}));i&&h.Function(i.then)?i.then(e).catch(r):i===!1?r():e()}).then(()=>this.globalBeforeFetch(t))},beforeSubmit(t){return new Promise((e,r)=>{const i=this.options.beforeSubmit&&O(()=>this.options.beforeSubmit(t,{api:this.api}));i&&h.Function(i.then)?i.then(e).catch(r):i===!1?r():e()})}}),_r(z),Cr(z),kr(z),Fr(z),jr(z),Dr(z),Ir(z),Pr(z);const xe={name:"fcFragment",functional:!0,props:["vnode"],render(t,e){return e.props.vnode?e.props.vnode:e.children}};function Br(t){return h.String(t)?{domProps:{innerHTML:t}}:t}function Lr(){const t={};function e(r){r&&this.setVm(r)}return C(e.prototype,{setVm(r){this.handle=r,this.vm=r.vm,this.h=this.$h=r.vm.$createElement},make(r,i,s){var n,o;return(y.isReservedTag?y.isReservedTag(r):(n=y==null?void 0:y.config)!=null&&n.isReservedTag(r))&&(i==null||delete i.nativeOn,(o=i==null?void 0:i.props)==null||delete o.formCreateInject),this.makeComponent(r,i,s)},makeComponent(r,i,s){var a;const n=this.handle.fc.prop.components[r];n&&(r=n);let o=this.$h(r,Br(i),s||[]);if((a=o==null?void 0:o.componentOptions)!=null&&a.propsData&&(i!=null&&i.props)){const l=Object.keys(o.componentOptions.propsData);o.data.attrs||(o.data.attrs={}),Object.keys(i.props).forEach(u=>{o.data.attrs[u]==null&&l.indexOf(u)===-1&&["string","number","boolean"].indexOf(typeof i.props[u])>-1&&(o.data.attrs[u]=i.props[u])})}return o.context=this.vm,o},aliasMap:t}),C(e,{aliasMap:t,alias(r,i){t[r]=i},use(r){Object.keys(r).forEach(i=>{const s=de(i),n=it(i).toLocaleLowerCase(),o=r[i];e.alias(i,o),[i,s,n].forEach(a=>{e.prototype[a]=function(l,u){return this.make(t[i]||a,l,u)}})})}}),e}function Nr(t){class e extends jt{}return Object.assign(e.prototype,t),e}function jt(t){C(this,{$handle:t,vm:t.vm,options:{},ref:"fcForm",mergeOptionsRule:{normal:["form","row","info","submitBtn","resetBtn"]}}),this.updateKey(),this.init()}C(jt.prototype,{__init(){this.$render=this.$handle.$render,this.$r=(...t)=>this.$render.renderRule(...t)},updateKey(){this.key=we()},init(){},update(){},beforeRender(){},form(){return this.vm.$refs[this.ref]},adapterValidate(t,e){return t.validator=(r,i,s)=>e(i,s),t},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 Q(t.map(r=>this.tidyOptions(r)),e,this.mergeOptionsRule)},updateOptions(t){this.$handle.fc.targetFormDriver("updateOptions",t,{handle:this.$handle,api:this.$handle.api}),this.options=this.mergeOptions([t],this.getDefaultOptions()),this.update()},tidyOptions(t){return t},tidyRule(t){},mergeProp(t){},getDefaultOptions(){return{}},fieldChange(t,e,r,i){},render(t){}});const Mr=function(t){const e={name:"loadData",_fn:[],loaded(r,i,s){this.deleted(r),y.nextTick(()=>{let n=q(r.getValue());const o=[];n.forEach(a=>{if(a&&(a.attr||a.template)){let l=p=>{let d;i&&i.__fc__&&(d=i.__fc__.getParentGroup());let g;a.template?g=t.$handle.loadStrVar(a.template,p,d?{rule:i,value:t.$handle.subRuleData[d.id]||{}}:null):a.handler&&h.Function(a.handler)?g=a.handler(p,i,s):g=t.$handle.loadStrVar(`{{${a.attr}}}`,p,d?{rule:i,value:t.$handle.subRuleData[d.id]||{}}:null),(g==null||g==="")&&a.default!=null&&(g=a.default),a.copy!==!1&&(g=x(g));const $=a.modify?i:r.getProp();a.to==="child"?$.children?F($.children,0,g):F($,"children",[g]):ne($,a.to||"options",g),s.sync(i)},u=p=>l(p);const c=t.watchLoadData(u);l=ie(l,a.wait||300),a.watch!==!1?o.push(c):c()}}),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.loaded,e},qr=function(t){const e={name:"t",_fn:[],loaded(r,i,s){this.deleted(r);let n=r.getValue()||{};const o=[];Object.keys(n).forEach(a=>{const l=n[a];if(l){const u=typeof l=="object";let c=g=>{let $=t.t(u?l.attr:l,u?l.params:null,g);const w=u&&l.modify?i:r.getProp();a==="child"?w.children?F(w.children,0,$):F(w,"children",[$]):ne(w,a,$),s.sync(i)},p=g=>c(g);const d=t.watchLoadData(p);c=ie(c,l.wait||300),l.watch!==!1?o.push(d):d()}}),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.loaded,e},At={name:"componentValidate",load(t,e,r){let i=t.getValue();if(!i||i.method===!1)t.clearProp(),r.clearValidateState([e.field]);else{h.Object(i)||(i={method:i});const s=i.method,n=G(_({},i),{validator(...o){const a=ee(e);if(a)return r.exec(a.id,h.String(s)?s:"formCreateValidate",...o,{attr:t,rule:e,api:r})}});delete n.method,t.getProp().validate=[n]}},watch(...t){At.load(...t)}},Ur={fetch:function(t){function e(s){return h.String(s)&&(s={action:s,to:"options"}),s}function r(s,n,o){let a=s.value;i.deleted(s),h.Function(a)&&(a=a(n,o)),a=e(a);const l=p=>{p===void 0?s.clearProp():ne(s.getProp(),a.to||"options",p),o.sync(n)};if(!a||!a.action&&!a.key){l(void 0);return}if(a=x(a),a.to||(a.to="options"),a.key){const p=t.$handle.options.globalData[a.key];if(!p){l(void 0);return}if(p.type==="static"){l(p.data);return}else a=_(_({},a),p)}const u=a.onError,c=()=>{if(!s.getValue())return s.clearProp(),o.sync(n),!0};i._fn[s.id]=t.watchLoadData(ie((p,d)=>{if(d&&a.watch===!1)return i._fn[s.id]();const g=t.$handle.loadFetchVar(x(a),p,n),$=G(_({headers:{}},g),{onSuccess(w,E){if(c())return;let K=N=>E?N:A(N,"data")?N.data:N;const T=W(g.parse);h.Function(T)?K=T:T&&h.String(T)&&(K=N=>L(N,T)),Ce(K(w,n,o)).then(N=>{l(N)})},onError(w){l(void 0),!c()&&(u||(E=>Te(E.message||"fetch fail "+g.action)))(w,n,o)}});t.$handle.beforeFetch($,{rule:n,api:o}).then(()=>{if(h.Function(g.action)){Ce(g.action(n,o)).then(w=>{$.onSuccess(w,!0)}).catch(w=>{$.onError(w)});return}O(()=>t.create.fetch($,{inject:s,rule:n,api:o}))}).catch(w=>{})},a.wait||600))}const i={name:"fetch",_fn:[],loaded(...s){r(...s)},watch(...s){r(...s)},deleted(s){this._fn[s.id]&&(this._fn[s.id](),delete this._fn[s.id]),s.clearProp()}};return i},loadData:Mr,t:qr,componentValidate:At};function Hr(t){t=t||new Map;const e={$on(r,i){const s=t.get(r);s&&s.push(i)||t.set(r,[i])},$once(r,i){i._once=!0,e.$on(r,i)},$off(r,i){const s=t.get(r);s&&s.splice(s.indexOf(i)>>>0,1)},$emit(r,...i){(t.get(r)||[]).slice().map(s=>{s._once&&(e.$off(r,s),delete s._once),s(...i)}),(t.get("*")||[]).slice().map(s=>{s(r,i)})}};return e}const Gr={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)?t.filter(e=>h.String(e)).join(""):""}};function xr(t){t=t+"=";const r=decodeURIComponent(document.cookie).split(";");for(let i=0;i<r.length;i++){let s=r[i];for(;s.charAt(0)===" ";)s=s.substring(1);if(s.indexOf(t)===0){s=s.substring(t.length,s.length);try{return JSON.parse(s)}catch(n){return s}}}return null}function Jr(t){const e=localStorage.getItem(t);if(e)try{return JSON.parse(e)}catch(r){return e}return null}function Kr(t){const e=sessionStorage.getItem(t);if(e)try{return JSON.parse(e)}catch(r){return e}return null}function Je(t,e){if(!e)return null;const r=e.split(".");let i=t(r.shift());return r.length?i==null?null:L(i,r):i}function Wr(t){return Je(xr,t)}function zr(t){return Je(Jr,t)}function Xr(t){return Je(Kr,t)}const Zr={en:{required:"{title} is required",validate:{url:"{title} is not a valid url",email:"{title} is not a valid email",ip:"{title} {title} is not a valid ip",phone:"{title} {title} is not a valid phone",pattern:"{title} does not match pattern {pattern}",uppercase:"{title} must be all uppercase",lowercase:"{title} must be all lowercased",positive:"{title} is not a positive number",negative:"{title} is not a negative number",equal:"{title} is not equal to {equal}",min:"{title} cannot be less than {min}",max:"{title} cannot be greater than {max}",enum:"{title} must be one of {enum}",hasKeys:"{title} does not contain required fields {hasKeys}",minLen:"{title} must be at least {minLen}",maxLen:"{title} cannot be longer than {maxLen}",len:"{title} must be exactly {len}",integer:"{title} is not an integer",number:"{title} is not an number"}},"zh-cn":{required:"{title}不能为空",validate:{url:"{title}不是有效的 url 地址",email:"{title}不是有效的邮箱地址",ip:"{title}不是有效的 IP 地址",phone:"{title}不是正确的手机号",pattern:"{title}必须匹配 {pattern}",uppercase:"{title}必须全大写",lowercase:"{title}必须全小写",positive:"{title}不是正数",negative:"{title}不是负数",equal:"{title}必须等于 {equal}",min:"{title}必须大于等于 {min}",max:"{title}必须小于等于 {max}",enum:"{title}必须是 {enum} 之一",hasKeys:"{title}必须包含 {hasKeys} 字段",minLen:"{title}长度必须大于 {minLen}",maxLen:"{title}长度必须小于 {maxLen}",len:"{title}长度必须为 {len}",integer:"{title}必须为整数",number:"{title}必须为数字"}}};function Qr(t,e){let r;return arguments.length===2?(r=arguments[1],e=r[t]):r=arguments[2],{id:e,prop:r}}function Ke(){return Qr("name",...arguments)}function Yr(t){return!t||!t.el?window.document.body:h.Element(t.el)?t.el:document.querySelector(t.el)}function ei(t,e){const r=new Vue({data(){return{rule:t,option:e||{}}},render(i){return i("FormCreate",{ref:"fc",props:this.$data})}});return r.$mount(),r}function ti(t){const e=t.key||[],r=t.array||[],i=t.normal||[];ut.push(...e),Ne.push(...r),Me.push(...i),bt([...e,...r,...i])}let ri=1;const U={},Dt=Symbol("defValue");function It(t){const e={[xe.name]:xe},r={},i={},s={},n={},o=[],a=[],l=[t.extendApi],u=_({},Ur),c=mr();let p={global:{}};const d=t.isMobile===!0,g=y.reactive({$mobile:d}),$=Lr(),w={},E={};ti(t.attrs||{});function K(f){const m=U[f];if(Array.isArray(m))return m.map(b=>b.api());if(m)return m.api()}function T(f){o.push(f)}function N(){const f=Ke(...arguments);f.id&&f.prop&&(i[f.id]=f.prop)}function pe(){const f=Ke(...arguments);f.id&&f.prop&&(u[f.id]=h.Function(f.prop)?f.prop:G(_({},f.prop),{name:f.id}))}function Qe(f){$.use(f)}function me(){const f=Ke(...arguments);if(!f.id||!f.prop)return Ee;const m=J(f.id),b=f.prop,v=b.merge===!0?r[m]:void 0;r[m]=Oe(b,v||Ee),c[m]=B(m),b.maker&&C(c,b.maker)}function R(f,m){let b;if(h.String(f)){if(b=f,m===void 0)return["form-create","formcreate"].indexOf(b)>-1?S():e[b]}else b=J(f.name),m=f;if(!b||!m)return;const v=J(b);e[b]=m,e[v]=m,delete $.aliasMap[b],delete $.aliasMap[v],delete r[b],delete r[v],m.formCreateParser&&me(b,m.formCreateParser)}function S(){return dr(et,e,i)}function H(){return xe}function ge(f,m){return h.Function(f.install)?f.install(X,m):h.Function(f)&&f(X,m),this}function X(f,m,b){let v=ei(f,m||{});const k=v.$refs.fc.formCreate;return k.$parent=b,Yr(k.options).appendChild(v.$el),k.api()}Oe(X,E);function Oi(f){let m=_({},t);return f?m.inherit={components:e,parsers:r,directives:i,modelFields:s,providers:u,useApps:o,maker:c,formulas:w,loadData:g}:delete m.inherit,It(m)}function Fi(f,m){s[f]=m}function Ei(f,m){w[f]=m}function Ri(f,m){const b=n[f]||{},v=b.parsers||{};m.parsers&&Object.keys(m.parsers).forEach(k=>{v[k]=Oe(m.parsers[k],Ee)}),m.name=f,n[f]=G(_(_({},b),m),{parsers:v})}function Se(f){f&&Object.keys(U).forEach(m=>{(Array.isArray(U[m])?U[m]:[U[m]]).forEach(v=>{v.bus.$emit("$loadData."+f)})})}function Ye(f,m){ne(g,f,m),Se(f)}function je(f,m){const b=(...v)=>O(()=>m(...v));b._driver=!0,Ye(f,b)}function Mt(f,m){const b=(f||"").split(".");f=b.shift();const v=b.join(".");if(A(g,f)||F(g,f,Dt),g[f]!==Dt){let k=g[f];return k&&k._driver?k=k(v):b.length&&(k=L(k,b)),k==null||k===""?m:k}else return m}function Si(f){l.push(f)}function ji(f){delete g[f],Se(f)}function Ai(f,m){a.push({name:f,callback:m})}function et(f){C(this,{id:ri++,create:X,vm:f,manager:Nr(t.manager),parsers:r,providers:u,modelFields:s,formulas:w,isMobile:d,rules:f.$props.rule,name:f.$props.name||we(),inFor:f.$props.inFor,prop:{components:e,directives:i},get:null,drivers:n,renderDriver:null,refreshData:Se,loadData:g,CreateNode:$,bus:new Hr,unwatch:[],options:y.ref({}),extendApiFn:l,fetchCache:new WeakMap,tmpData:y.reactive({})}),a.forEach(m=>{this.bus.$on(m.name,m.callback)}),y.nextTick(()=>{y.watch(this.options,()=>{this.$handle.$manager.updateOptions(this.options.value),this.api().refresh()},{deep:!0})}),C(f.$options.components,e),C(f.$options.directives,i),this.$handle=new z(this),this.name&&(this.inFor?(U[this.name]||(U[this.name]=[]),U[this.name].push(this)):U[this.name]=this)}et.isMobile=d,C(et.prototype,{init(){this.isSub()&&this.unwatch.push(y.watch(()=>this.vm.parent.fc.options.value,()=>{this.initOptions(),this.$handle.api.refresh()},{deep:!0,flush:"sync"})),this.vm.$props.driver&&(this.renderDriver=typeof this.vm.$props.driver=="object"?this.vm.$props.driver:this.drivers[this.vm.$props.driver]),!this.renderDriver&&this.vm.parent&&(this.renderDriver=this.vm.parent.fc.renderDriver),this.renderDriver||(this.renderDriver=this.drivers.default),this.initOptions(),this.$handle.init()},targetFormDriver(f,...m){if(this.bus.$emit(f,...m),this.renderDriver&&this.renderDriver[f])return O(()=>this.renderDriver[f](...m))},t(f,m,b){let v=b?b("$t."+f):this.globalLanguageDriver(f);return v==null&&(v=""),v&&m&&Object.keys(m).forEach(k=>{const I=new RegExp(`{${k}}`,"g");v=v.replace(I,m[k])}),v},globalDataDriver(f){let m=f.split(".");const b=m.shift(),v=this.options.value.globalData&&this.options.value.globalData[b];if(v){if(v.type==="static")return L(v.data,m);{let k;const I=this.fetchCache.get(v);if(I){if(I.status&&(k=L(I.data,m)),!I.loading)return k;I.loading=!1,this.fetchCache.set(v,I)}else this.fetchCache.set(v,{status:!1});const j=ie(()=>{se();const Z=this.fetchCache.get(v);this.options.value.globalData&&Object.values(this.options.value.globalData).indexOf(v)!==-1?(Z&&(Z.loading=!0,this.fetchCache.set(v,Z)),this.bus.$emit("$loadData.$globalData."+b)):this.fetchCache.delete(v)},v.wait||600),_e=Z=>{this.fetchCache.set(v,{status:!0,data:Z}),this.bus.$emit("$loadData.$globalData."+b)},ue=(Z,ce)=>{if(ce&&v.watch===!1)return se();if(ce){j();return}const fe=this.$handle.loadFetchVar(Pe(v),Z);fe.targetRule=this.targetRule,this.$handle.api.fetch(fe).then(oe=>{_e(oe)}).catch(oe=>{_e(null)})},se=this.watchLoadData(ue);return v.watch===!1&&se(),this.unwatch.push(se),k}}},getLocale(){let f=this.vm.top.$props.locale;return f&&typeof f=="object"?f.name:typeof f=="string"?f:"zh-cn"},globalLanguageDriver(f){let m=this.vm.top.$props.t,b=this.vm.top.$props.locale,v;if(m&&(v=O(()=>m(f))),v==null&&b&&typeof b=="object"&&(v=L(b,f)),v==null){const k=this.options.value.language||{},I=this.getLocale();v=L(k[I]||{},f),v==null&&(v=L(Zr[I]||{},f))}return v},globalVarDriver(f){let m=f.split(".");const b=m.shift(),v=this.options.value.globalVariable&&this.options.value.globalVariable[b];if(v){const k=h.Function(v)?v:W(v.handle);if(k){let I=k((...j)=>this.$handle.api.getData(...j),this.$handle.api);return L(I,m)}}},setData(f,m,b){b?Ye(f,m):(ne(this.vm.top.fc.tmpData,f,m),this.bus.$emit("$loadData."+f))},getLoadData(f,m){let b=null;if(f!=null){let v=f.split(".");const k=v.shift();if(b=L(this.vm.top.fc.tmpData,f),b!=null)return b;if(k==="$topForm")b=this.$handle.api.top.formData(!0);else if(k==="$scopeForm")b=this.$handle.api.scope.formData(!0);else if(k==="$form")b=this.$handle.api.formData(!0);else if(k==="$options")b=this.options.value;else if(k==="$globalData")b=this.globalDataDriver(v.join(".")),v=[];else if(k==="$var")b=this.globalVarDriver(v.join(".")),v=[];else if(k==="$locale")b=this.getLocale(),v=[];else if(k==="$t")b=this.globalLanguageDriver(v.join(".")),v=[];else{if(k==="$preview")return this.$handle.preview;b=Mt(f),v=[]}b&&v.length&&(b=L(b,v))}return b==null||b===""?m:b},watchLoadData(f,m){let b={};const v=j=>{this.get||(this.get=k),O(()=>{f(k,j)}),this.get===k&&(this.get=void 0)},k=(j,_e)=>{let ue;if(typeof j=="object"&&(ue=j.getValue,j=j.id),b[j])return b[j].val;const se=y.computed(()=>ue?ue():this.getLoadData(j,_e)),Z=j.split("."),ce=Z.shift(),fe=Z.shift()||"",oe=ie(()=>{const he=ue?ue():this.getLoadData(j,_e);if(b[j])((he instanceof Function||h.Object(he)||Array.isArray(he))&&he===b[j].val||JSON.stringify(he)!==JSON.stringify(b[j].val))&&(b[j].val=he,v(!0));else return},m||0),Ii=y.watch(se,he=>{oe()});return this.bus.$on("$loadData."+ce,oe),fe&&this.bus.$on("$loadData."+ce+"."+fe,oe),b[j]={fn:()=>{this.bus.$off("$loadData."+ce,oe),fe&&this.bus.$off("$loadData."+ce+"."+fe,oe),Ii()},val:se.value},se.value};v(!1);const I=()=>{Object.keys(b).forEach(j=>b[j].fn()),b={}};return this.unwatch.push(I),I},isSub(){return this.vm.parent&&this.vm.extendOption},initOptions(){this.options.value={};let f=_({formData:{},submitBtn:{},resetBtn:{},globalEvent:{},globalData:{}},x(p));const m=this.isSub();m&&(f=this.mergeOptions(f,this.vm.parent.fc.options.value||{},!0)),f=this.mergeOptions(f,this.vm.$props.option||{});const b=this.api();this.targetFormDriver("initOptions",f,{api:b,isSubForm:m}),this.updateOptions(f)},mergeOptions(f,m,b){return m=_({},m||{}),b&&["page","onSubmit","onReset","onCreated","onChange","onMounted","mounted","onReload","reload","formData","el","globalClass","style"].forEach(v=>{delete m[v]}),m.global&&(f.global=cr(f.global,m.global),delete m.global),this.$handle.$manager.mergeOptions([m],f),f},updateOptions(f){this.options.value=this.mergeOptions(this.options.value,f),this.$handle.$manager.updateOptions(this.options.value),this.bus.$emit("$loadData.$options")},api(){return this.$handle.api},render(){return this.$handle.render()},mounted(){this.$handle.mounted()},unmount(){if(this.name)if(this.inFor){const f=U[this.name].indexOf(this);U[this.name].splice(f,1)}else delete U[this.name];a.forEach(f=>{this.bus.$off(f.name,f.callback)}),this.tmpData={},this.unwatch.forEach(f=>f()),this.unwatch=[],this.$handle.reloadRule([])},updated(){this.$handle.bindNextTick(()=>this.bus.$emit("next-tick",this.$handle.api))}});function qt(f){C(f,{version:t.version,ui:t.ui,isMobile:d,extendApi:Si,getData:Mt,setDataDriver:je,setData:Ye,removeData:ji,refreshData:Se,maker:c,component:R,directive:N,setModelField:Fi,setFormula:Ei,setDriver:Ri,register:pe,$vnode:H,parser:me,use:ge,factory:Oi,componentAlias:Qe,copyRule:ft,copyRules:ht,mergeRule:Y,fetch:wt,$form:S,parseFn:W,parseJson:st,toJson:$e,useApp:T,getApi:K,on:Ai})}function Di(f){C(f,{create:X,install(m,b){if(p=_(_({},p),b||{}),m._installedFormCreate===!0)return;m._installedFormCreate=!0;const v=function(I,j={}){return X(I,j,this)};qt(v),m.prototype.$formCreate=v;const k=S();m.component(k.name,k),m.component("FcFragment",H()),o.forEach(I=>{O(()=>I(f,m))})}})}if(qt(E),Di(E),je("$cookie",Wr),je("$localStorage",zr),je("$sessionStorage",Xr),$.use({fragment:"fcFragment"}),t.install&&X.use(t),me(Gr),t.inherit){const f=t.inherit;f.components&&C(e,f.components),f.parsers&&C(r,f.parsers),f.directives&&C(i,f.directives),f.modelFields&&C(s,f.modelFields),f.providers&&C(u,f.providers),f.useApps&&C(o,f.useApps),f.maker&&C(c,f.maker),f.loadData&&C(g,f.loadData),f.formulas&&C(w,f.formulas)}const Ae=S();return Oe(Ae,E),Object.defineProperties(Ae,{fetch:{get(){return E.fetch},set(f){E.fetch=f}}}),Ae.util=E,Ae}const Pt={date:"yyyy-MM-dd",month:"yyyy-MM",datetime:"yyyy-MM-dd HH:mm:ss",timerange:"HH:mm:ss",daterange:"yyyy-MM-dd",monthrange:"yyyy-MM",datetimerange:"yyyy-MM-dd HH:mm:ss",year:"yyyy"},Tt="datePicker",ii={name:Tt,maker:function(){return["year","month","date","dates","week","datetime","datetimeRange","dateRange","monthRange"].reduce((t,e)=>(t[e]=B(Tt,{type:e.toLowerCase()}),t),{})}(),mergeProp(t){const e=t.prop.props;e.valueFormat||(e.valueFormat=Pt[e.type]||Pt.date)}},We="hidden",ni={name:We,maker:{[We]:(t,e)=>B(We)("",t,e)},render(){return[]}},ze="input",si={name:ze,maker:function(){const t=["password","url","email","text","textarea"].reduce((e,r)=>(e[r]=B(ze,{type:r}),e),{});return t.idate=B(ze,{type:"date"}),t}(),mergeProp(t){let{props:e}=t.prop;e&&e.autosize&&e.autosize.minRows&&(e.rows=e.autosize.minRows||2)}},oi={name:"textarea",mergeProp(t){let{props:e}=t.prop;e.type="textarea",e&&e.autosize&&e.autosize.minRows&&(e.rows=e.autosize.minRows||2)}},Vt="slider",ai={name:Vt,maker:{sliderRange:B(Vt,{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}},Xe="timePicker",li={name:Xe,maker:{time:B(Xe,t=>t.props.isRange=!1),timeRange:B(Xe,t=>t.props.isRange=!0)},mergeProp(t){const e=t.prop.props;e.valueFormat||(e.valueFormat="HH:mm:ss")}},ui=[ii,ni,si,oi,ai,li,{name:"FcRow",render(t,e){return e.vNode.col({props:{span:24}},[e.vNode.row(e.prop,t)])}},{name:"select",toFormValue(t,e){return e.prop.props.multiple&&!Array.isArray(t)?q(t):t}}],D="el",ci={button:D+"Button",icon:"i",slider:D+"Slider",rate:D+"Rate",upload:"fcUpload",cascader:D+"Cascader",popover:D+"Popover",tooltip:D+"Tooltip",colorPicker:D+"ColorPicker",timePicker:D+"TimePicker",timeSelect:D+"TimeSelect",datePicker:D+"DatePicker",switch:D+"Switch",select:"fcSelect",checkbox:"fcCheckbox",radio:"fcRadio",inputNumber:D+"InputNumber",number:D+"InputNumber",input:D+"Input",textarea:D+"Input",formItem:D+"FormItem",form:D+"Form",frame:"fcFrame",col:D+"Col",row:D+"Row",tree:"fcTree",autoComplete:D+"Autocomplete",auto:D+"Autocomplete",group:"fcGroup",array:"fcGroup",object:"fcSubForm",subForm:"fcSubForm"};function fi(){return{form:{inline:!1,labelPosition:"right",labelWidth:"125px",disabled:!1,size:void 0},row:{show:!0,gutter:0},submitBtn:{type:"primary",loading:!1,disabled:!1,innerText:"",show:!0,col:void 0,click:void 0},resetBtn:{type:"default",loading:!1,disabled:!1,icon:"el-icon-refresh",innerText:"",show:!1,col:void 0,click:void 0}}}function hi(t){return t.type==="tooltip"}function Bt(t,e){A(t,e)&&h.String(t[e])&&(t[e]={[e]:t[e],show:!0})}function te(t){return t===!1}function di(t,e){A(t,e)&&!h.Object(t[e])&&(t[e]={show:!!t[e]})}function Ze(t){const e=_({},t);return delete e.children,e}const pi={validate(){const t=this.form();return t?t.validate():new Promise(e=>e())},validateField(t){return new Promise((e,r)=>{const i=this.form();i?i.validateField(t,(s,n)=>{n?r(n):e(s)}):e()})},clearValidateState(t){const e=this.vm.$refs[t.wrapRef];e&&e.clearValidate()},fieldChange(t,e,r,i){var s;i||(s=this.vm.$refs[t.wrapRef])==null||s.validate("change")},tidyOptions(t){return["submitBtn","resetBtn","row","info","wrap","col","title"].forEach(e=>{di(t,e)}),t},tidyRule({prop:t}){return Bt(t,"title"),Bt(t,"info"),t},mergeProp(t){const e={info:{trigger:"hover",placement:"top-start",icon:"el-icon-warning"},title:{},col:{span:24},wrap:{}};["info","wrap","col","title"].forEach(r=>{t.prop[r]=Q([this.options[r]||{},t.prop[r]||{}],e[r])})},getDefaultOptions(){return fi()},update(){const t=this.options.form;this.rule={props:_({},t),nativeOn:{submit:e=>{e.preventDefault()}},style:t.style,type:"form"}},beforeRender(){const{key:t,ref:e,$handle:r}=this,i=this.options.form;C(this.rule,{key:t,ref:e,class:[i.className,i.class,"form-create",this.$handle.preview?"is-preview":""]}),C(this.rule.props,{model:r.formData})},render(t){return t.slotLen()&&!this.$handle.preview&&t.setSlot(void 0,()=>this.makeFormBtn()),this.$r(this.rule,te(this.options.row.show)?t.getSlots():[this.makeRow(t)])},makeWrap(t,e){const r=t.prop,i=`${this.key}${t.key}`,s=r.col,n=this.isTitle(r)&&r.wrap.title!==!1,o=!s.labelWidth&&!n?0:s.labelWidth,{inline:a,col:l}=this.rule.props,u=r.wrap.class;delete r.wrap.class,delete r.wrap.title;const c=te(r.wrap.show)?e:this.$r(Q([r.wrap,{props:G(_({labelWidth:o===void 0?o:it(o),label:n?r.title.title:void 0},Ze(r.wrap||{})),{prop:t.id,rules:t.injectValidate()}),class:this.$render.mergeClass(u||r.className,"fc-form-item"),key:`${i}fi`,ref:t.wrapRef,type:"formItem"}]),_({default:()=>e},n?{label:()=>this.makeInfo(r,i,t)}:{}));return a===!0||te(l)||te(s.show)?c:this.makeCol(r,i,[c])},isTitle(t){if(this.options.form.title===!1)return!1;const e=t.title;return!(!e.title&&!e.native||te(e.show))},makeInfo(t,e,r){var c,p,d,g,$,w;const i=_({},t.title),s=_({},t.info),n=hi(s),o=this.options.form,a=this.getSlot("title"),l=[a?a({title:(p=(c=r.refRule)==null?void 0:c.__$title)==null?void 0:p.value,rule:r.rule,options:this.options}):((g=(d=r.refRule)==null?void 0:d.__$title)==null?void 0:g.value)+(o.labelSuffix||o["label-suffix"]||"")];if(!te(s.show)&&(s.info||s.native)&&!te(s.icon)){const E={type:s.type||"popover",slot:"label",props:Ze(s),key:`${e}pop`};delete E.props.icon,delete E.props.show,delete E.props.info,delete E.props.align,delete E.props.native;const K="content";s.info&&!A(E.props,K)&&(E.props[K]=(w=($=r.refRule)==null?void 0:$.__$info)==null?void 0:w.value),l[s.align!=="left"?"unshift":"push"](this.$r(Q([s,E]),[this.$r({type:"i",slot:n?"default":"reference",class:s.icon===!0?"el-icon-warning":s.icon,key:`${e}i`})]))}const u=Q([i,{props:Ze(i),key:`${e}tit`,class:"fc-form-title",slot:i.slot||"label",type:i.type||"span"}]);return delete u.props.show,delete u.props.title,delete u.props.native,this.$r(u,l)},makeCol(t,e,r){const i=t.col;return this.$r({class:this.$render.mergeClass(i.class,"fc-form-col"),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:this.$render.mergeClass(e.class,"fc-form-row"),key:`${this.key}row`},t)},makeFormBtn(){let t=[];if(te(this.options.submitBtn.show)||t.push(this.makeSubmitBtn()),te(this.options.resetBtn.show)||t.push(this.makeResetBtn()),!t.length)return;const e=this.$r({type:"formItem",class:"fc-form-item",key:`${this.key}fb`},t);return this.rule.props.inline===!0?e:this.$r({type:"col",class:"fc-form-col fc-form-footer",props:{span:24},key:`${this.key}fc`},[e])},makeResetBtn(){const t=_({},this.options.resetBtn),e=t.innerText||this.$handle.api.t("reset")||"重置";return delete t.innerText,delete t.click,delete t.col,delete t.show,this.$r({type:"button",props:t,class:"fc-reset-btn",style:{width:t.width},on:{click:()=>{const r=this.$handle.api;this.options.resetBtn.click?this.options.resetBtn.click(r):r.resetFields()}},key:`${this.key}b2`},[e])},makeSubmitBtn(){const t=_({},this.options.submitBtn),e=t.innerText||this.$handle.api.t("submit")||"提交";return delete t.innerText,delete t.click,delete t.col,delete t.show,this.$r({type:"button",props:t,class:"fc-submit-btn",style:{width:t.width},on:{click:()=>{const r=this.$handle.api;this.options.submitBtn.click?this.options.submitBtn.click(r):r.submit().catch(()=>{})}},key:`${this.key}b1`},[e])}},le={};mi(le),gi(le),yi(le),$i(le),bi(le);function mi(t){["group","tree","switch","upload","autoComplete","checkbox","cascader","colorPicker","datePicker","frame","inputNumber","radio","rate"].forEach(e=>{t[e]=B(e)}),t.auto=t.autoComplete,t.number=t.inputNumber,t.color=t.colorPicker}function gi(t){const e="select",r="multiple";t.selectMultiple=B(e,{[r]:!0}),t.selectOne=B(e,{[r]:!1})}function yi(t){const e="tree",r={treeSelected:"selected",treeChecked:"checked"};Object.keys(r).reduce((i,s)=>(i[s]=B(e,{type:r[s]}),i),t)}function $i(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]=B(e,n=>n.props({uploadType:r[s][0],maxLength:r[s][1]})),i),t),t.uploadImage=t.image,t.uploadFile=t.file}function bi(t){const e={frameInputs:["input",0],frameFiles:["file",0],frameImages:["image",0],frameInputOne:["input",1],frameFileOne:["file",1],frameImageOne:["image",1]};return Object.keys(e).reduce((r,i)=>(r[i]=B("frame",s=>s.props({type:e[i][0],maxLength:e[i][1]})),r),t),t.frameInput=t.frameInputs,t.frameFile=t.frameFiles,t.frameImage=t.frameImages,t}function Lt(t,e){return h.Boolean(t)?t={show:t}:!h.Undef(t)&&!h.Object(t)&&(t={show:e}),t}function vi(t,e){return{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.filter(a=>!a.isScope).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}),e.emitEvent("validate-fail",a,{api:t})})})},validateField(r,i){return new Promise((s,n)=>{const o=e.getFieldCtx(r);if(!o)return;const a=e.subForm[o.id],l=[e.$manager.validateField(o.id)];q(a).filter(u=>!u.isScope).forEach(u=>{l.push(u.validate())}),Promise.all(l).then(()=>{s(null),i&&i(null)}).catch(u=>{n(u),i&&i(u),e.vm.$emit("validate-field-fail",u,{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);C(i,r),e.options.submitBtn=i,t.refreshOptions()},resetBtnProps:(r={})=>{let i=Lt(e.options.resetBtn,!1);C(i,r),e.options.resetBtn=i,t.refreshOptions()},submit(r,i){return new Promise((s,n)=>{(e.options.validateOnSubmit===!1?Promise.resolve():t.validate()).then(()=>{let a=t.formData();e.beforeSubmit(a).then(()=>{h.Function(r)&&O(()=>r(a,t)),h.Function(e.options.onSubmit)&&O(()=>e.options.onSubmit(a,t)),e.vm.$emit("submit",a,t),s(a)}).catch(l=>{})}).catch((...a)=>{h.Function(i)&&O(()=>i(t,...a)),n(...a)})})}}}const Nt={name:"required",load(t,e,r){var s,n;const i=_i(t.getValue());if(i.required===!1)t.clearProp(),r.clearValidateState([e.field]);else{const o=_({required:!0,validator(l,u,c){h.empty(u)?c(o.message):c()}},i),a=(n=(s=e.__fc__.refRule)==null?void 0:s.__$title)==null?void 0:n.value;if(!o.message)o.message=r.t("required",{title:a})||a+(r.getLocale()==="en"?" is required":"不能为空");else{const l=o.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);l&&(o.message=r.t(l[1],{title:a}))}t.getProp().validate=[o]}r.sync(e)},watch(...t){Nt.load(...t)}};function _i(t){return h.Boolean(t)?{required:t}:h.String(t)?{message:t}:h.Undef(t)?{required:!1}:h.Function(t)?{validator:t}:h.Object(t)?t:{}}function Ci(t){t.componentAlias(ci),lr.forEach(e=>{t.component(e.name,e)}),t.register(Nt),ui.forEach(e=>{t.parser(e)}),Object.keys(le).forEach(e=>{t.maker[e]=le[e]})}function wi(){return It({ui:"element-ui",version:"2.7.17",manager:pi,extendApi:vi,install:Ci,attrs:{normal:["col","wrap"],array:["className"],key:["title","info"]}})}const Re=wi();typeof window!="undefined"&&(window.formCreate=Re,window.Vue&&Re.install(window.Vue));const ki=Re.maker;P.default=Re,P.maker=ki,Object.defineProperties(P,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|