@form-create/view-design 2.7.3 → 2.7.4
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 +537 -515
- package/dist/form-create.js +3 -3
- package/dist/form-create.min.js +3 -3
- package/package.json +4 -4
package/dist/form-create.min.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* FormCreate 低代码表单渲染器
|
|
3
|
-
* @form-create/view-design v2.7.
|
|
3
|
+
* @form-create/view-design v2.7.4
|
|
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-upload-btn{border:1px dashed #c0ccda;cursor:pointer}._fc-frame .fc-upload-cover{opacity:0;position:absolute;inset:0;background:#0009;transition:opacity .3s}._fc-frame .fc-upload-cover i{color:#fff;font-size:20px;cursor:pointer;margin:0 2px}._fc-frame .fc-files:hover .fc-upload-cover{opacity:1}._fc-frame .ivu-upload-list{margin-top:0}._fc-frame .fc-files img{width:100%;height:100%;display:inline-block;vertical-align:top}._fc-frame .fc-upload-btn,._fc-frame .fc-files{display:inline-block;width:58px;height:58px;text-align:center;line-height:58px;border:1px solid #c0ccda;border-radius:4px;overflow:hidden;background:#fff;position:relative;box-shadow:2px 2px 5px #0000001a;margin-right:4px;box-sizing:border-box}._fc-upload .fc-upload-btn{border:1px dashed #c0ccda;cursor:pointer}._fc-upload .fc-upload-cover{opacity:0;position:absolute;inset:0;background:#0009;transition:opacity .3s}._fc-upload .fc-upload-cover i{color:#fff;font-size:20px;cursor:pointer;margin:0 2px}._fc-upload .fc-files:hover .fc-upload-cover{opacity:1}._fc-upload .ivu-upload-list{margin-top:0}._fc-upload .fc-files img{width:100%;height:100%;display:inline-block;vertical-align:top}._fc-upload .fc-upload-btn,._fc-upload .fc-files{display:inline-block;width:58px;height:58px;text-align:center;line-height:58px;border:1px solid #c0ccda;border-radius:4px;overflow:hidden;background:#fff;position:relative;box-shadow:2px 2px 5px #0000001a;margin-right:4px;box-sizing:border-box}._fc-group{display:flex;min-height:42px;justify-content:center;flex-direction:column}._fc-group-disabled ._fc-group-btn,._fc-group-disabled ._fc-group-add{cursor:not-allowed}._fc-group-handle{display:flex;flex-direction:row;position:absolute;bottom:-15px;right:30px;border-radius:15px;border:1px dashed #d9d9d9;padding:3px 8px;background-color:#fff}._fc-group-btn{cursor:pointer}._fc-group-idx{position:absolute;bottom:-15px;left:10px;width:30px;height:30px;display:flex;align-items:center;justify-content:center;background:#eee;border-radius:15px;font-weight:700}._fc-group-handle ._fc-group-btn+._fc-group-btn{margin-left:7px}._fc-group-container{position:relative;display:flex;flex-direction:column;border:1px dashed #d9d9d9;padding:20px 20px 25px;margin:5px 5px 25px;border-radius:5px}._fc-group-arrow{position:relative;width:20px;height:20px}._fc-group-arrow:before{content:"";position:absolute;top:8px;left:5px;width:9px;height:9px;border-left:2px solid #999;border-top:2px solid #999}._fc-group-arrow:before{transform:rotate(45deg)}._fc-group-arrow._fc-group-down{transform:rotate(180deg)}._fc-group-plus-minus{width:20px;height:20px;position:relative;cursor:pointer}._fc-group-plus-minus:before,._fc-group-plus-minus:after{content:"";position:absolute;top:50%;left:50%;width:60%;height:2px;background-color:#409eff;transform:translate(-50%,-50%)}._fc-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-group-plus-minus._fc-group-minus:before{display:none}._fc-group-plus-minus._fc-group-minus:after{background-color:#f56c6c}._fc-group-add{cursor:pointer;width:25px;height:25px;border:1px solid rgb(64 158 255 / 50%);border-radius:15px}._fc-group-add._fc-group-plus-minus:before,._fc-group-add._fc-group-plus-minus:after{width:50%}.form-create .form-create .ivu-form-item{margin-bottom:24px}.form-create .form-create .ivu-form-item .ivu-form-item{margin-bottom:0}')),document.head.appendChild(o)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
|
|
10
|
-
(function(P,m){typeof exports=="object"&&typeof module!="undefined"?m(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],m):(P=typeof globalThis!="undefined"?globalThis:P||self,m(P.formCreate={},P.Vue))})(this,function(P,m){"use strict";var ji=Object.defineProperty,Ii=Object.defineProperties;var Ai=Object.getOwnPropertyDescriptors;var Ut=Object.getOwnPropertySymbols;var Pi=Object.prototype.hasOwnProperty,Ti=Object.prototype.propertyIsEnumerable;var qt=(P,m,N)=>m in P?ji(P,m,{enumerable:!0,configurable:!0,writable:!0,value:N}):P[m]=N,_=(P,m)=>{for(var N in m||(m={}))Pi.call(m,N)&&qt(P,N,m[N]);if(Ut)for(var N of Ut(m))Ti.call(m,N)&&qt(P,N,m[N]);return P},H=(P,m)=>Ii(P,Ai(m));function N(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"],Ht=["class","style","directives"],Jt=["on","nativeOn"],Wt=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(Ht.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]?zt(e[i][u],r[i][u]):r[i][u];else e[i]=r[i];return e},{})},zt=function(t,e){return function(){t&&t.apply(this,arguments),e&&e.apply(this,arguments)}},Kt=Wt;const j=N(Kt);function ge(t,e){return Object.keys(t).reduce((r,i)=>((!e||e.indexOf(i)===-1)&&r.push(t[i]),r),[])}const Xt={name:"fcCheckbox",props:{formCreateInject:{type:Object,required:!0},value:{type:Array,default:()=>[]}},watch:{"formCreateInject.options":{handler(){this.update()},deep:!0},value(){this.update()}},data(){return{trueValue:[]}},methods:{options(){const t=this.formCreateInject.options;return Array.isArray(t)?t:[]},onInput(t){this.$emit("input",this.options().filter(e=>t.indexOf(e.label)!==-1).map(e=>e.value).filter(e=>e!==void 0))},update(){const t=Array.isArray(this.value)?this.value:[this.value];this.trueValue=this.options().filter(e=>t.indexOf(e.value)!==-1).map(e=>e.label)}},created(){this.update()},render(){const t=arguments[0];return t("CheckboxGroup",j([{},this.formCreateInject.prop,{ref:"el"},{props:{value:this.trueValue}},{on:{input:this.onInput}}]),[this.options().map((e,r)=>{const i=_({},e);return delete i.value,t("Checkbox",j([{},{props:i},{key:""+r+"-"+e.value}]))}),ge(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 Qt="fcFrame";function et(t){return{name:Qt,props:{formCreateInject:{type:Object,required:!0},type:{type:String,default:"input"},field:String,helper:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},src:{type:String,required:!0},icon:{type:String,default:t.fileUpIcon},width:{type:[Number,String],default:500},height:{type:String,default:"370px"},maxLength:{type:Number,default:0},okBtnText:{type:String,default:""},closeBtnText:{type:String,default:""},modalTitle:String,handleIcon:{type:[String,Boolean],default:void 0},title:String,allowRemove:{type:Boolean,default:!0},onOpen:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}},onCancel:{type:Function,default:()=>{}},onLoad:{type:Function,default:()=>{}},onBeforeRemove:{type:Function,default:()=>{}},onRemove:{type:Function,default:()=>{}},onHandle:{type:Function,default(e){this.previewImage=this.getSrc(e),this.previewVisible=!0}},modal:{type:Object,default:()=>({})},srcKey:{type:[String,Number]},value:[Array,String,Number,Object],previewMask:void 0,footer:{type:Boolean,default:!0},reload:{type:Boolean,default:!0},closeBtn:{type:Boolean,default:!0},okBtn:{type:Boolean,default:!0}},data(){return{fileList:q(this.value),previewVisible:!1,frameVisible:!1,previewImage:""}},watch:{value(e){this.fileList=q(e)},fileList(e){const r=this.maxLength===1?e[0]||"":e;this.$emit("input",r),this.$emit("change",r)},src(e){this.modalVm&&(this.modalVm.src=e)}},methods:{key(e){return e},closeModel(e){this.$emit(e?"$close":"$ok"),this.reload&&(this.$off("$ok"),this.$off("$close")),this.frameVisible=!1},showModel(){this.disabled||this.onOpen()===!1||(this.frameVisible=!0)},makeInput(){const e=this.$createElement,r={type:"text",value:this.fileList.map(i=>this.getSrc(i)).toString(),icon:this.icon,readonly:!0,clearable:!1};return e("Input",j([{},{props:r},{},{on:{"on-click":()=>this.showModel()}},{key:this.key("input")}]))},makeGroup(e){const r=this.$createElement;return(!this.maxLength||this.fileList.length<this.maxLength)&&e.push(this.makeBtn()),r("div",{key:this.key("group")},[...e])},makeItem(e,r){const i=this.$createElement;return i("div",{class:"fc-files",key:this.key("file"+e)},[...r])},valid(e){const r=this.formCreateInject.field||this.field;if(r&&e!==r)throw new Error("[frame]无效的字段值")},makeIcons(e,r){const i=this.$createElement;if(this.handleIcon!==!1||this.allowRemove===!0){const s=[];return(this.type!=="file"&&this.handleIcon!==!1||this.type==="file"&&this.handleIcon)&&s.push(this.makeHandleIcon(e,r)),this.allowRemove&&s.push(this.makeRemoveIcon(e,r)),i("div",{class:"fc-upload-cover",key:this.key("uc")},[s])}},makeHandleIcon(e,r){const i=this.$createElement;return i("icon",j([{},{props:{type:this.handleIcon===!0||this.handleIcon===void 0?"ios-eye-outline":this.handleIcon}},{on:{click:()=>this.handleClick(e)},key:this.key("hi"+r)}]))},makeRemoveIcon(e,r){const i=this.$createElement;return i("icon",j([{},{props:{type:"ios-trash-outline"}},{on:{click:()=>this.handleRemove(e)},key:this.key("ri"+r)}]))},makeFiles(){const e=this.$createElement;return this.makeGroup(this.fileList.map((r,i)=>this.makeItem(i,[e("icon",j([{},{props:{type:t.fileIcon,size:40}},{on:{click:()=>this.handleClick(r)}}])),this.makeIcons(r,i)])))},makeImages(){const e=this.$createElement;return this.makeGroup(this.fileList.map((r,i)=>this.makeItem(i,[e("img",{attrs:{src:this.getSrc(r)}}),this.makeIcons(r,i)])))},makeBtn(){const e=this.$createElement;return e("div",{class:"fc-upload-btn",on:{click:()=>this.showModel()},key:this.key("btn")},[e("icon",j([{},{props:{type:this.icon,size:20}}]))])},handleClick(e){return this.onHandle(e)},handleRemove(e){this.disabled||this.onBeforeRemove(e)!==!1&&(this.fileList.splice(this.fileList.indexOf(e),1),this.onRemove(e))},getSrc(e){return this.srcKey?e[this.srcKey]:e},frameLoad(e){this.onLoad(e);try{this.helper===!0&&(e.form_create_helper={api:this.formCreateInject.api,close:r=>{this.valid(r),this.closeModel()},set:(r,i)=>{this.valid(r),this.disabled||this.$emit("input",i)},get:r=>(this.valid(r),this.value),onOk:r=>this.$on("$ok",r),onClose:r=>this.$on("$close",r)})}catch(r){console.log(r)}},makeFooter(){const e=this.$createElement,{okBtnText:r,closeBtnText:i,closeBtn:s,okBtn:n,footer:o}=this.$props,a=[];return o&&(s&&a.push(e("Button",{on:{click:()=>this.onCancel()!==!1&&this.closeModel(!0)}},[i||this.formCreateInject.t("close")||"关闭"])),n&&a.push(e("Button",{attrs:{type:"primary"},on:{click:()=>this.onOk()!==!1&&this.closeModel()}},[r||this.formCreateInject.t("ok")||"确定"]))),a}},render(){const e=arguments[0],r=this.type;let i;r==="input"?i=this.makeInput():r==="image"?i=this.makeImages():i=this.makeFiles();const{width:s,height:n,src:o,title:a,modalTitle:l}=this.$props;return this.$nextTick(()=>{this.$refs.frame&&this.frameLoad(this.$refs.frame.contentWindow||{})}),e("div",{class:"_fc-frame"},[i,e("Modal",j([{},{props:{mask:this.previewMask,title:l,footerHide:!0}},{model:{value:this.previewVisible,callback:u=>{this.previewVisible=u}}}]),[e("img",{style:"width: 100%",attrs:{src:this.previewImage}})]),e("Modal",j([{},{props:_({width:s,title:a},this.modal)},{on:{"on-cancel":()=>this.closeModel(!0)},model:{value:this.frameVisible,callback:u=>{this.frameVisible=u}}}]),[this.frameVisible||!this.reload?e("iframe",{ref:"frame",attrs:{src:o,frameBorder:"0"},style:{height:n,border:"0 none",width:"100%"}}):null,e("div",{slot:"footer"},[this.makeFooter()])])])},mounted(){this.$on("fc.closeModal",this.closeModal)}}}const tt=et({fileIcon:"md-document",fileUpIcon:"ios-folder-open"});tt.v2=et({fileIcon:"document-text",fileUpIcon:"folder"});const Zt={name:"fcRadio",props:{formCreateInject:{type:Object,required:!0},value:{}},watch:{"formCreateInject.options":{handler(){this.update()},deep:!0},value(){this.update()}},data(){return{trueValue:[]}},methods:{options(){const t=this.formCreateInject.options;return Array.isArray(t)?t:[]},onInput(t){this.$emit("input",this.options().filter(e=>e.label===t).reduce((e,r)=>r.value,""))},update(){this.trueValue=this.options().filter(t=>t.value===this.value).reduce((t,e)=>e.label,"")}},created(){this.update()},render(){const t=arguments[0];return t("RadioGroup",j([{},this.formCreateInject.prop,{},{props:{value:this.trueValue}},{ref:"el",on:{input:this.onInput}}]),[this.options().map((e,r)=>{const i=_({},e);return delete i.value,t("Radio",j([{},{props:i},{key:""+r+"-"+e.value}]))}),ge(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 F(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("Option",j([{},{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("OptionGroup",{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("Select",j([{},e.data,{ref:"el"}]),[(Array.isArray(s)?s:[]).map((n,o)=>F(n||"","options")?i(n,o):r(n,o)),e.children])},mounted(){this.$emit("fc.el",this.$refs.el)}},xt={name:"fcTree",props:{formCreateInject:{type:Object,required:!0},type:{type:String,default:"checked"},value:{type:[Array,String,Number],default:()=>[]}},data(){return{treeData:[]}},watch:{value(t){this.setStatus(t)}},created(){this.setStatus(this.value)},methods:{setStatus(t){const e=q(t),r=this.formCreateInject.prop.props.data;this.type==="selected"?this.checked(r,e,"selected"):this.checked(r,e,"checked"),this.$forceUpdate()},checked(t,e,r){t.forEach(i=>{this.$set(i,r,e.indexOf(i.id)!==-1),i.children!==void 0&&Array.isArray(i.children)&&this.checked(i.children,e,r)})},onInput(t){this.$emit("input",t.map(e=>e.id))}},render(){const t=arguments[0],e={};return this.type==="selected"?e["on-select-change"]=this.onInput:e["on-check-change"]=this.onInput,t("Tree",j([{},this.formCreateInject.prop,{ref:"tree"},{on:e}]),[ge(this.$slots)])},mounted(){this.$emit("fc.el",this.$refs.tree)}};function rt(t){return typeof t=="object"?t:{url:t,is_string:!0,name:er(t)}}function it(t){return H(_({},t),{file:t,value:t})}function er(t){return(""+t).split("/").pop()}const tr="fcUpload";function nt(t){return{name:tr,props:{formCreateInject:{type:Object,required:!0},onHandle:{type:Function,default(e){this.previewImage=e.url,this.previewVisible=!0}},uploadType:{type:String,default:"file"},maxLength:{type:Number,default:0},allowRemove:{type:Boolean,default:!0},modalTitle:String,handleIcon:{type:[String,Boolean],default:()=>{}},value:[Array,String]},data(){return{uploadList:[],previewVisible:!1,previewImage:"",cacheFiles:[]}},created(){this.formCreateInject.prop.props.showUploadList===void 0&&(this.formCreateInject.prop.props.showUploadList=!1),this.formCreateInject.prop.props.defaultFileList=q(this.value).map(rt).map(it)},watch:{value(e){this.$refs.upload.fileList.every(r=>!r.status||r.status==="finished")&&(this.$refs.upload.fileList=q(e).map(rt).map(it),this.uploadList=this.$refs.upload.fileList)},maxLength(e,r){(r===1||e===1)&&this.update()}},methods:{key(e){return e},isDisabled(){return this.formCreateInject.prop.props.disabled===!0},onRemove(e){this.isDisabled()||this.$refs.upload.handleRemove(e)},handleClick(e){this.onHandle(e)},makeItem(e,r){const i=this.$createElement;return this.uploadType==="image"?i("img",{attrs:{src:e.url},key:this.key("img"+r)}):i("icon",j([{},{props:{type:t.fileIcon,size:40}},{key:this.key("i"+r)}]))},makeRemoveIcon(e,r){const i=this.$createElement;return i("icon",{attrs:{type:"ios-trash-outline"},on:{click:()=>this.onRemove(e)},key:this.key("ri"+r)})},makeHandleIcon(e,r){const i=this.$createElement;return i("icon",{attrs:{type:this.handleIcon===!0||this.handleIcon===void 0?"ios-eye-outline":this.handleIcon},on:{click:()=>this.handleClick(e)},key:this.key("hi"+r)})},makeProgress(e,r){const i=this.$createElement;return i("Progress",j([{},{props:{percent:e.percentage,hideInfo:!0}},{style:"width:90%",key:this.key("pg"+r)}]))},makeIcons(e,r){const i=this.$createElement,s=[];if(this.allowRemove||this.handleIcon!==!1)return(this.uploadType!=="file"&&this.handleIcon!==!1||this.uploadType==="file"&&this.handleIcon)&&s.push(this.makeHandleIcon(e,r)),this.allowRemove&&s.push(this.makeRemoveIcon(e,r)),i("div",{class:"fc-upload-cover"},[s])},makeFiles(){const e=this.$createElement;return this.uploadList.map((r,i)=>this.$scopedSlots.fileList?this.$scopedSlots.fileList({file:r,index:i,vm:this}):e("div",{key:this.key(i),class:"fc-files"},[r.showProgress?this.makeProgress(r,i):[this.makeItem(r,i),this.makeIcons(r,i)]]))},makeUpload(){const e=this.$createElement,r=!this.maxLength||this.maxLength>this.uploadList.length;return e("Upload",j([{},this.formCreateInject.prop,{},{style:{display:"inline-block"},key:this.key("upload"),ref:"upload"}]),[r?e("template",{slot:"default"},[this.$slots.default||e("div",{class:"fc-upload-btn"},[e("icon",j([{},{props:{type:this.uploadType==="file"?"ios-cloud-upload-outline":t.imgUpIcon,size:20}}]))])]):null,ge(this.$slots,["default"])])},update(){let e=this.$refs.upload.fileList.map(r=>r.is_string?r.url:r.value||r.url).filter(r=>r!==void 0);(this.cacheFiles.length!==e.length||!e.length)&&(this.cacheFiles=[...e],this.$emit("input",this.maxLength===1?e[0]||"":e))},handleCancel(){this.previewVisible=!1}},render(){const e=arguments[0];return this.$refs.upload&&(this.formCreateInject.prop.props.showUploadList===void 0&&(this.formCreateInject.prop.props.showUploadList=this.$refs.upload.showUploadList),this.formCreateInject.prop.props.defaultFileList=this.$refs.upload.defaultFileList),e("div",{class:"_fc-upload"},[[this.formCreateInject.prop.props.showUploadList?[]:this.makeFiles(),this.makeUpload()],e("Modal",j([{},{props:{title:this.modalTitle,footerHide:!0}},{model:{value:this.previewVisible,callback:r=>{this.previewVisible=r}}}]),[e("img",{attrs:{alt:"example",src:this.previewImage},style:"width: 100%"})])])},mounted(){this.uploadList=this.$refs.upload.fileList,this.$watch(()=>this.$refs.upload.fileList,()=>{this.update()},{deep:!0}),this.$emit("fc.el",this.$refs.upload)}}}const st=nt({fileIcon:"md-document",imgUpIcon:"md-images"});st.v2=nt({fileIcon:"document-text",imgUpIcon:"image"});function S(t,e,r){m.set(t,e,r)}function ee(t,e){(m.del||m.delete)(t,e)}function de(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&&S(t,s,[]);else if(n._clone&&r!==void 0)if(r)n=n.getRule(),o&&S(t,s,{});else{S(t,s,n._clone());continue}else o&&S(t,s,{});t[s]=de(t[s],n,r)}else S(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 J(t){return de({},{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)&&S(t,i,e[i]);return t};function C(){return rr.apply(this,arguments)}function je(t){return typeof t!="object"||t===null?t:t instanceof Array?[...t]:_({},t)}const ir=[Xt,Zt,Yt,xt,{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,j([{},{on:{"update:value":this.formData,"emit-event":this.emitEvent,input:this.add$f}},{},{props:{rule:e,option:r,disabled:this.disabled,extendOption:!0}}]))}},tt,st,{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(()=>{de(i.rule,t),i.$f.setValue(s)},!0);else{const n=i.$f.formData();i.$f.once("reloading",()=>{i.$f.setValue(n)}),i.rule=J(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&&F(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=J(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){this.disabled||this.onBeforeAdd(this.value)===!1||this.addRule(t,!0)},del(t,e){if(this.disabled||this.onBeforeRemove(this.value,t)===!1)return;this.removeRule(e,!0);const r=[...this.value];r.splice(t,1),this.input(r)},addIcon(t){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],f=r&&!s?this.makeIcon(e.length,a,o):[];return t("div",{class:"_fc-group-container",key:o},[t(i,j([{key:o},{on:{"update:value":d=>this.formData(o,d),"emit-event":(d,...g)=>this.emitEvent(d,g,a,o),input:d=>this.add$f(a,o,d)}},{},{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]),f.length?t("div",{class:"_fc-group-handle fc-clock"},[f]):null])});return t("div",{key:"con",class:"_fc-group "+(s?"_fc-group-disabled":"")},[n])}}];function se(t,e){var r=null;return function(...i){r!==null&&clearTimeout(r),r=setTimeout(()=>t.call(this,...i),e)}}function pe(t){let e=t.replace(/([A-Z])/g,"-$1").toLocaleLowerCase();return e.indexOf("-")===0&&(e=e.substr(1)),e}const ye=(t,e)=>{if(!(!t||t===e||!t.$props)){if(t.$props.formCreateInject)return t.$props.formCreateInject;if(t.$parent)return ye(t.$parent,e)}};function nr(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],name:String,subForm:{type:Boolean,default:!0},inFor:Boolean},render(){return this.fc.render()},setup(s){const n=m.getCurrentInstance().proxy;m.provide("parentFC",n);const o=m.inject("parentFC",null);let a=o;if(o)for(;a.parent;)a=a.parent;else a=n;const{rule:l,value:u,subForm:f,inFor:d}=m.toRefs(s),g=m.reactive({ctxInject:{},destroyed:!1,isShow:!0,unique:1,renderRule:[...l.value||[]],updateValue:JSON.stringify(u.value||{})}),y=new t(n),b=y.api(),O=d.value,A=()=>{if(o){const R=ye(n,o);if(R){let I;O?(I=q(R.getSubForm()),I.push(b)):I=b,R.subForm(I)}}},ie=()=>{const R=ye(n,o);if(R)if(O){const I=q(R.getSubForm()),L=I.indexOf(b);L>-1&&I.splice(L,1)}else R.subForm()};let B=null;m.onBeforeMount(()=>{m.watch(()=>{let R="";const I=s.option&&s.option.globalClass||{};Object.keys(I).forEach(L=>{let ae="";I[L].style&&Object.keys(I[L].style).forEach(Re=>{ae+=pe(Re)+":"+I[L].style[Re]+";"}),I[L].content&&(ae+=I[L].content+";"),ae&&(R+=`.${L}{${ae}}`)}),s.option&&s.option.style&&(R+=s.option.style),B||(B=document.createElement("style"),B.type="text/css",document.head.appendChild(B)),B.innerHTML=R||""},()=>{})});const U=se(()=>{y.bus.$emit("$loadData.$topForm")},100),Qe=se(()=>{y.bus.$emit("$loadData.$form")},100),ke=R=>{y.bus.$emit("change-$form."+R)};return m.onMounted(()=>{o&&(b.top.bus.$on("$loadData.$form",U),b.top.bus.$on("change",ke)),y.mounted()}),m.onBeforeUnmount(()=>{o&&(b.top.bus.$off("$loadData.$form",U),b.top.bus.$off("change",ke)),B&&document.head.removeChild(B),ie(),g.destroyed=!0,y.unmount()}),m.onUpdated(()=>{y.updated()}),m.watch(f,R=>{R?A():ie()},{immediate:!0}),m.watch(()=>[...l.value],R=>{y.$handle.isBreakWatch()||R.length===g.renderRule.length&&R.every(I=>g.renderRule.indexOf(I)>-1)||(y.$handle.updateAppendData(),y.$handle.reloadRule(l.value),n.renderRule())}),m.watch(()=>s.option,()=>{y.initOptions(),b.refresh()},{deep:!0}),m.watch(()=>[s.disabled,s.preview],()=>{b.refresh()}),m.watch(u,R=>{JSON.stringify(R||{})!==g.updateValue&&(b.config.forceCoverValue?b.coverValue(R||{}):b.setValue(R||{}))},{deep:!0,flush:"post"}),m.watch(()=>s.index,()=>{b.coverValue({}),y.$handle.updateAppendData(),m.nextTick(()=>{m.nextTick(()=>{b.clearValidateState()})})},{flush:"sync"}),H(_({fc:m.markRaw(y),parent:o&&m.markRaw(o),top:m.markRaw(a),fapi:m.markRaw(b)},m.toRefs(g)),{getGroupInject:()=>ye(n,o),refresh(){++g.unique},renderRule(){g.renderRule=[...l.value||[]]},updateValue(R){if(g.destroyed)return;const I=JSON.stringify(R);g.updateValue!==I&&(g.updateValue=I,n.$emit("update:value",R),m.nextTick(()=>{Qe(),o||U()}))}})},created(){this.$emit("input",this.fapi),this.fc.init()}}}const ot=["attrs","props","domProps","scopedSlots"],at=["class","style","directives"],lt=["on","nativeOn","hook"],X=(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]=X([l[u]],a[u]);else if(i.indexOf(u)>-1)a[u]=_(_({},a[u]),l[u]);else if(s.indexOf(u)>-1){const f=a[u]instanceof Array?a[u]:[a[u]],d=l[u]instanceof Array?l[u]:[l[u]];a[u]=[...f,...d]}else if(n.indexOf(u)>-1)for(const f in l[u])if(a[u][f]){const d=a[u][f]instanceof Array?a[u][f]:[a[u][f]],g=l[u][f]instanceof Array?l[u][f]:[l[u][f]];a[u][f]=[...d,...g]}else a[u][f]=l[u][f];else if(u==="hook")for(let f in l[u])a[u][f]?a[u][f]=sr(a[u][f],l[u][f]):a[u][f]=l[u][f];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)},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"],Ie=["validate","children","control"],Ae=["effect","deep","renderSlots"];function ft(){return[...ut,...ot,...at,...lt,...Ie,...Ae]}function ct(t,e,r){return`[form-create ${t}]: ${e}`}function Pe(t,e){console.error(ct("err",t))}function or(t){Pe(t.toString()),console.error(t)}function ar(t){return t==null?"":typeof t=="object"?JSON.stringify(t,null,2):String(t)}const Te="[[FORM-CREATE-PREFIX-",Be="-FORM-CREATE-SUFFIX]]";function Le(t,e){return JSON.stringify(de(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 Te+i+Be}},e)}function Ve(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(Te)===0)r=r.replace(Be,"").replace(Te,""),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=Ve("function($inject){"+r.substring(5)+"}"),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=Ve(r)}catch(n){s=Ve("function "+r)}return s.__json=t,s}catch(s){Pe(`解析失败:${r}
|
|
10
|
+
(function(P,m){typeof exports=="object"&&typeof module!="undefined"?m(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],m):(P=typeof globalThis!="undefined"?globalThis:P||self,m(P.formCreate={},P.Vue))})(this,function(P,m){"use strict";var ji=Object.defineProperty,Ii=Object.defineProperties;var Ai=Object.getOwnPropertyDescriptors;var Ut=Object.getOwnPropertySymbols;var Pi=Object.prototype.hasOwnProperty,Ti=Object.prototype.propertyIsEnumerable;var qt=(P,m,V)=>m in P?ji(P,m,{enumerable:!0,configurable:!0,writable:!0,value:V}):P[m]=V,_=(P,m)=>{for(var V in m||(m={}))Pi.call(m,V)&&qt(P,V,m[V]);if(Ut)for(var V of Ut(m))Ti.call(m,V)&&qt(P,V,m[V]);return P},H=(P,m)=>Ii(P,Ai(m));function V(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"],Ht=["class","style","directives"],Jt=["on","nativeOn"],Wt=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(Ht.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]?zt(e[i][u],r[i][u]):r[i][u];else e[i]=r[i];return e},{})},zt=function(t,e){return function(){t&&t.apply(this,arguments),e&&e.apply(this,arguments)}},Kt=Wt;const A=V(Kt);function $e(t,e){return Object.keys(t).reduce((r,i)=>((!e||e.indexOf(i)===-1)&&r.push(t[i]),r),[])}const Xt={name:"fcCheckbox",props:{formCreateInject:{type:Object,required:!0},value:{type:Array,default:()=>[]}},watch:{"formCreateInject.options":{handler(){this.update()},deep:!0},value(){this.update()}},data(){return{trueValue:[]}},methods:{options(){const t=this.formCreateInject.options;return Array.isArray(t)?t:[]},onInput(t){this.$emit("input",this.options().filter(e=>t.indexOf(e.label)!==-1).map(e=>e.value).filter(e=>e!==void 0))},update(){const t=Array.isArray(this.value)?this.value:[this.value];this.trueValue=this.options().filter(e=>t.indexOf(e.value)!==-1).map(e=>e.label)}},created(){this.update()},render(){const t=arguments[0];return t("CheckboxGroup",A([{},this.formCreateInject.prop,{ref:"el"},{props:{value:this.trueValue}},{on:{input:this.onInput}}]),[this.options().map((e,r)=>{const i=_({},e);return delete i.value,t("Checkbox",A([{},{props:i},{key:""+r+"-"+e.value}]))}),$e(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 Qt="fcFrame";function et(t){return{name:Qt,props:{formCreateInject:{type:Object,required:!0},type:{type:String,default:"input"},field:String,helper:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},src:{type:String,required:!0},icon:{type:String,default:t.fileUpIcon},width:{type:[Number,String],default:500},height:{type:String,default:"370px"},maxLength:{type:Number,default:0},okBtnText:{type:String,default:""},closeBtnText:{type:String,default:""},modalTitle:String,handleIcon:{type:[String,Boolean],default:void 0},title:String,allowRemove:{type:Boolean,default:!0},onOpen:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}},onCancel:{type:Function,default:()=>{}},onLoad:{type:Function,default:()=>{}},onBeforeRemove:{type:Function,default:()=>{}},onRemove:{type:Function,default:()=>{}},onHandle:{type:Function,default(e){this.previewImage=this.getSrc(e),this.previewVisible=!0}},modal:{type:Object,default:()=>({})},srcKey:{type:[String,Number]},value:[Array,String,Number,Object],previewMask:void 0,footer:{type:Boolean,default:!0},reload:{type:Boolean,default:!0},closeBtn:{type:Boolean,default:!0},okBtn:{type:Boolean,default:!0}},data(){return{fileList:q(this.value),previewVisible:!1,frameVisible:!1,previewImage:""}},watch:{value(e){this.fileList=q(e)},fileList(e){const r=this.maxLength===1?e[0]||"":e;this.$emit("input",r),this.$emit("change",r)},src(e){this.modalVm&&(this.modalVm.src=e)}},methods:{key(e){return e},closeModel(e){this.$emit(e?"$close":"$ok"),this.reload&&(this.$off("$ok"),this.$off("$close")),this.frameVisible=!1},showModel(){this.disabled||this.onOpen()===!1||(this.frameVisible=!0)},makeInput(){const e=this.$createElement,r={type:"text",value:this.fileList.map(i=>this.getSrc(i)).toString(),icon:this.icon,readonly:!0,clearable:!1};return e("Input",A([{},{props:r},{},{on:{"on-click":()=>this.showModel()}},{key:this.key("input")}]))},makeGroup(e){const r=this.$createElement;return(!this.maxLength||this.fileList.length<this.maxLength)&&e.push(this.makeBtn()),r("div",{key:this.key("group")},[...e])},makeItem(e,r){const i=this.$createElement;return i("div",{class:"fc-files",key:this.key("file"+e)},[...r])},valid(e){const r=this.formCreateInject.field||this.field;if(r&&e!==r)throw new Error("[frame]无效的字段值")},makeIcons(e,r){const i=this.$createElement;if(this.handleIcon!==!1||this.allowRemove===!0){const s=[];return(this.type!=="file"&&this.handleIcon!==!1||this.type==="file"&&this.handleIcon)&&s.push(this.makeHandleIcon(e,r)),this.allowRemove&&s.push(this.makeRemoveIcon(e,r)),i("div",{class:"fc-upload-cover",key:this.key("uc")},[s])}},makeHandleIcon(e,r){const i=this.$createElement;return i("icon",A([{},{props:{type:this.handleIcon===!0||this.handleIcon===void 0?"ios-eye-outline":this.handleIcon}},{on:{click:()=>this.handleClick(e)},key:this.key("hi"+r)}]))},makeRemoveIcon(e,r){const i=this.$createElement;return i("icon",A([{},{props:{type:"ios-trash-outline"}},{on:{click:()=>this.handleRemove(e)},key:this.key("ri"+r)}]))},makeFiles(){const e=this.$createElement;return this.makeGroup(this.fileList.map((r,i)=>this.makeItem(i,[e("icon",A([{},{props:{type:t.fileIcon,size:40}},{on:{click:()=>this.handleClick(r)}}])),this.makeIcons(r,i)])))},makeImages(){const e=this.$createElement;return this.makeGroup(this.fileList.map((r,i)=>this.makeItem(i,[e("img",{attrs:{src:this.getSrc(r)}}),this.makeIcons(r,i)])))},makeBtn(){const e=this.$createElement;return e("div",{class:"fc-upload-btn",on:{click:()=>this.showModel()},key:this.key("btn")},[e("icon",A([{},{props:{type:this.icon,size:20}}]))])},handleClick(e){return this.onHandle(e)},handleRemove(e){this.disabled||this.onBeforeRemove(e)!==!1&&(this.fileList.splice(this.fileList.indexOf(e),1),this.onRemove(e))},getSrc(e){return this.srcKey?e[this.srcKey]:e},frameLoad(e){this.onLoad(e);try{this.helper===!0&&(e.form_create_helper={api:this.formCreateInject.api,close:r=>{this.valid(r),this.closeModel()},set:(r,i)=>{this.valid(r),this.disabled||this.$emit("input",i)},get:r=>(this.valid(r),this.value),onOk:r=>this.$on("$ok",r),onClose:r=>this.$on("$close",r)})}catch(r){console.log(r)}},makeFooter(){const e=this.$createElement,{okBtnText:r,closeBtnText:i,closeBtn:s,okBtn:n,footer:o}=this.$props,a=[];return o&&(s&&a.push(e("Button",{on:{click:()=>this.onCancel()!==!1&&this.closeModel(!0)}},[i||this.formCreateInject.t("close")||"关闭"])),n&&a.push(e("Button",{attrs:{type:"primary"},on:{click:()=>this.onOk()!==!1&&this.closeModel()}},[r||this.formCreateInject.t("ok")||"确定"]))),a}},render(){const e=arguments[0],r=this.type;let i;r==="input"?i=this.makeInput():r==="image"?i=this.makeImages():i=this.makeFiles();const{width:s,height:n,src:o,title:a,modalTitle:l}=this.$props;return this.$nextTick(()=>{this.$refs.frame&&this.frameLoad(this.$refs.frame.contentWindow||{})}),e("div",{class:"_fc-frame"},[i,e("Modal",A([{},{props:{mask:this.previewMask,title:l,footerHide:!0}},{model:{value:this.previewVisible,callback:u=>{this.previewVisible=u}}}]),[e("img",{style:"width: 100%",attrs:{src:this.previewImage}})]),e("Modal",A([{},{props:_({width:s,title:a},this.modal)},{on:{"on-cancel":()=>this.closeModel(!0)},model:{value:this.frameVisible,callback:u=>{this.frameVisible=u}}}]),[this.frameVisible||!this.reload?e("iframe",{ref:"frame",attrs:{src:o,frameBorder:"0"},style:{height:n,border:"0 none",width:"100%"}}):null,e("div",{slot:"footer"},[this.makeFooter()])])])},mounted(){this.$on("fc.closeModal",this.closeModal)}}}const tt=et({fileIcon:"md-document",fileUpIcon:"ios-folder-open"});tt.v2=et({fileIcon:"document-text",fileUpIcon:"folder"});const Zt={name:"fcRadio",props:{formCreateInject:{type:Object,required:!0},value:{}},watch:{"formCreateInject.options":{handler(){this.update()},deep:!0},value(){this.update()}},data(){return{trueValue:[]}},methods:{options(){const t=this.formCreateInject.options;return Array.isArray(t)?t:[]},onInput(t){this.$emit("input",this.options().filter(e=>e.label===t).reduce((e,r)=>r.value,""))},update(){this.trueValue=this.options().filter(t=>t.value===this.value).reduce((t,e)=>e.label,"")}},created(){this.update()},render(){const t=arguments[0];return t("RadioGroup",A([{},this.formCreateInject.prop,{},{props:{value:this.trueValue}},{ref:"el",on:{input:this.onInput}}]),[this.options().map((e,r)=>{const i=_({},e);return delete i.value,t("Radio",A([{},{props:i},{key:""+r+"-"+e.value}]))}),$e(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 S(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("Option",A([{},{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("OptionGroup",{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("Select",A([{},e.data,{ref:"el"}]),[(Array.isArray(s)?s:[]).map((n,o)=>S(n||"","options")?i(n,o):r(n,o)),e.children])},mounted(){this.$emit("fc.el",this.$refs.el)}},xt={name:"fcTree",props:{formCreateInject:{type:Object,required:!0},type:{type:String,default:"checked"},value:{type:[Array,String,Number],default:()=>[]}},data(){return{treeData:[]}},watch:{value(t){this.setStatus(t)}},created(){this.setStatus(this.value)},methods:{setStatus(t){const e=q(t),r=this.formCreateInject.prop.props.data;this.type==="selected"?this.checked(r,e,"selected"):this.checked(r,e,"checked"),this.$forceUpdate()},checked(t,e,r){t.forEach(i=>{this.$set(i,r,e.indexOf(i.id)!==-1),i.children!==void 0&&Array.isArray(i.children)&&this.checked(i.children,e,r)})},onInput(t){this.$emit("input",t.map(e=>e.id))}},render(){const t=arguments[0],e={};return this.type==="selected"?e["on-select-change"]=this.onInput:e["on-check-change"]=this.onInput,t("Tree",A([{},this.formCreateInject.prop,{ref:"tree"},{on:e}]),[$e(this.$slots)])},mounted(){this.$emit("fc.el",this.$refs.tree)}};function rt(t){return typeof t=="object"?t:{url:t,is_string:!0,name:er(t)}}function it(t){return H(_({},t),{file:t,value:t})}function er(t){return(""+t).split("/").pop()}const tr="fcUpload";function nt(t){return{name:tr,props:{formCreateInject:{type:Object,required:!0},onHandle:{type:Function,default(e){this.previewImage=e.url,this.previewVisible=!0}},uploadType:{type:String,default:"file"},maxLength:{type:Number,default:0},allowRemove:{type:Boolean,default:!0},modalTitle:String,handleIcon:{type:[String,Boolean],default:()=>{}},value:[Array,String]},data(){return{uploadList:[],previewVisible:!1,previewImage:"",cacheFiles:[]}},created(){this.formCreateInject.prop.props.showUploadList===void 0&&(this.formCreateInject.prop.props.showUploadList=!1),this.formCreateInject.prop.props.defaultFileList=q(this.value).map(rt).map(it)},watch:{value(e){this.$refs.upload.fileList.every(r=>!r.status||r.status==="finished")&&(this.$refs.upload.fileList=q(e).map(rt).map(it),this.uploadList=this.$refs.upload.fileList)},maxLength(e,r){(r===1||e===1)&&this.update()}},methods:{key(e){return e},isDisabled(){return this.formCreateInject.prop.props.disabled===!0},onRemove(e){this.isDisabled()||this.$refs.upload.handleRemove(e)},handleClick(e){this.onHandle(e)},makeItem(e,r){const i=this.$createElement;return this.uploadType==="image"?i("img",{attrs:{src:e.url},key:this.key("img"+r)}):i("icon",A([{},{props:{type:t.fileIcon,size:40}},{key:this.key("i"+r)}]))},makeRemoveIcon(e,r){const i=this.$createElement;return i("icon",{attrs:{type:"ios-trash-outline"},on:{click:()=>this.onRemove(e)},key:this.key("ri"+r)})},makeHandleIcon(e,r){const i=this.$createElement;return i("icon",{attrs:{type:this.handleIcon===!0||this.handleIcon===void 0?"ios-eye-outline":this.handleIcon},on:{click:()=>this.handleClick(e)},key:this.key("hi"+r)})},makeProgress(e,r){const i=this.$createElement;return i("Progress",A([{},{props:{percent:e.percentage,hideInfo:!0}},{style:"width:90%",key:this.key("pg"+r)}]))},makeIcons(e,r){const i=this.$createElement,s=[];if(this.allowRemove||this.handleIcon!==!1)return(this.uploadType!=="file"&&this.handleIcon!==!1||this.uploadType==="file"&&this.handleIcon)&&s.push(this.makeHandleIcon(e,r)),this.allowRemove&&s.push(this.makeRemoveIcon(e,r)),i("div",{class:"fc-upload-cover"},[s])},makeFiles(){const e=this.$createElement;return this.uploadList.map((r,i)=>this.$scopedSlots.fileList?this.$scopedSlots.fileList({file:r,index:i,vm:this}):e("div",{key:this.key(i),class:"fc-files"},[r.showProgress?this.makeProgress(r,i):[this.makeItem(r,i),this.makeIcons(r,i)]]))},makeUpload(){const e=this.$createElement,r=!this.maxLength||this.maxLength>this.uploadList.length;return e("Upload",A([{},this.formCreateInject.prop,{},{style:{display:"inline-block"},key:this.key("upload"),ref:"upload"}]),[r?e("template",{slot:"default"},[this.$slots.default||e("div",{class:"fc-upload-btn"},[e("icon",A([{},{props:{type:this.uploadType==="file"?"ios-cloud-upload-outline":t.imgUpIcon,size:20}}]))])]):null,$e(this.$slots,["default"])])},update(){let e=this.$refs.upload.fileList.map(r=>r.is_string?r.url:r.value||r.url).filter(r=>r!==void 0);(this.cacheFiles.length!==e.length||!e.length)&&(this.cacheFiles=[...e],this.$emit("input",this.maxLength===1?e[0]||"":e))},handleCancel(){this.previewVisible=!1}},render(){const e=arguments[0];return this.$refs.upload&&(this.formCreateInject.prop.props.showUploadList===void 0&&(this.formCreateInject.prop.props.showUploadList=this.$refs.upload.showUploadList),this.formCreateInject.prop.props.defaultFileList=this.$refs.upload.defaultFileList),e("div",{class:"_fc-upload"},[[this.formCreateInject.prop.props.showUploadList?[]:this.makeFiles(),this.makeUpload()],e("Modal",A([{},{props:{title:this.modalTitle,footerHide:!0}},{model:{value:this.previewVisible,callback:r=>{this.previewVisible=r}}}]),[e("img",{attrs:{alt:"example",src:this.previewImage},style:"width: 100%"})])])},mounted(){this.uploadList=this.$refs.upload.fileList,this.$watch(()=>this.$refs.upload.fileList,()=>{this.update()},{deep:!0}),this.$emit("fc.el",this.$refs.upload)}}}const st=nt({fileIcon:"md-document",imgUpIcon:"md-images"});st.v2=nt({fileIcon:"document-text",imgUpIcon:"image"});function R(t,e,r){m.set(t,e,r)}function te(t,e){(m.del||m.delete)(t,e)}function me(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&&R(t,s,[]);else if(n._clone&&r!==void 0)if(r)n=n.getRule(),o&&R(t,s,{});else{R(t,s,n._clone());continue}else o&&R(t,s,{});t[s]=me(t[s],n,r)}else R(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 J(t){return me({},{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)&&R(t,i,e[i]);return t};function C(){return rr.apply(this,arguments)}function je(t){return typeof t!="object"||t===null?t:t instanceof Array?[...t]:_({},t)}const ir=[Xt,Zt,Yt,xt,{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,A([{},{on:{"update:value":this.formData,"emit-event":this.emitEvent,input:this.add$f}},{},{props:{rule:e,option:r,disabled:this.disabled,extendOption:!0}}]))}},tt,st,{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(()=>{me(i.rule,t),i.$f.setValue(s)},!0);else{const n=i.$f.formData();i.$f.once("reloading",()=>{i.$f.setValue(n)}),i.rule=J(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&&S(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=J(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){this.disabled||this.onBeforeAdd(this.value)===!1||this.addRule(t,!0)},del(t,e){if(this.disabled||this.onBeforeRemove(this.value,t)===!1)return;this.removeRule(e,!0);const r=[...this.value];r.splice(t,1),this.input(r)},addIcon(t){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],f=r&&!s?this.makeIcon(e.length,a,o):[];return t("div",{class:"_fc-group-container",key:o},[t(i,A([{key:o},{on:{"update:value":d=>this.formData(o,d),"emit-event":(d,...g)=>this.emitEvent(d,g,a,o),input:d=>this.add$f(a,o,d)}},{},{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]),f.length?t("div",{class:"_fc-group-handle fc-clock"},[f]):null])});return t("div",{key:"con",class:"_fc-group "+(s?"_fc-group-disabled":"")},[n])}}];function re(t,e){var r=null;return function(...i){r!==null&&clearTimeout(r),r=setTimeout(()=>t.call(this,...i),e)}}function ge(t){let e=t.replace(/([A-Z])/g,"-$1").toLocaleLowerCase();return e.indexOf("-")===0&&(e=e.substr(1)),e}const ve=(t,e)=>{if(!(!t||t===e||!t.$props)){if(t.$props.formCreateInject)return t.$props.formCreateInject;if(t.$parent)return ve(t.$parent,e)}};function nr(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],name:String,subForm:{type:Boolean,default:!0},inFor:Boolean},render(){return this.fc.render()},setup(s){const n=m.getCurrentInstance().proxy;m.provide("parentFC",n);const o=m.inject("parentFC",null);let a=o;if(o)for(;a.parent;)a=a.parent;else a=n;const{rule:l,value:u,subForm:f,inFor:d}=m.toRefs(s),g=m.reactive({ctxInject:{},destroyed:!1,isShow:!0,unique:1,renderRule:[...l.value||[]],updateValue:JSON.stringify(u.value||{})}),y=new t(n),v=y.api(),w=d.value,j=()=>{if(o){const F=ve(n,o);if(F){let E;w?(E=q(F.getSubForm()),E.push(v)):E=v,F.subForm(E)}}},se=()=>{const F=ve(n,o);if(F)if(w){const E=q(F.getSubForm()),U=E.indexOf(v);U>-1&&E.splice(U,1)}else F.subForm()};let B=null;m.onBeforeMount(()=>{m.watch(()=>{let F="";const E=s.option&&s.option.globalClass||{};Object.keys(E).forEach(U=>{let de="";E[U].style&&Object.keys(E[U].style).forEach(K=>{de+=ge(K)+":"+E[U].style[K]+";"}),E[U].content&&(de+=E[U].content+";"),de&&(F+=`.${U}{${de}}`)}),s.option&&s.option.style&&(F+=s.option.style),B||(B=document.createElement("style"),B.type="text/css",document.head.appendChild(B)),B.innerHTML=F||""},()=>{})});const M=re(()=>{y.bus.$emit("$loadData.$topForm")},100),ce=re(function(){y.bus.$emit("$loadData.$scopeForm")},100),Qe=re(()=>{y.bus.$emit("$loadData.$form")},100),he=F=>{y.bus.$emit("change-$form."+F)};return m.onMounted(()=>{o&&(v.top.bus.$on("$loadData.$form",M),v.top.bus.$on("change",he)),v!==v.scope&&v.scope.bus.$on("$loadData.$scopeForm",ce),y.mounted()}),m.onBeforeUnmount(()=>{o&&(v.top.bus.$off("$loadData.$form",M),v.top.bus.$off("change",he)),v!==v.scope&&v.scope.bus.$off("$loadData.$scopeForm",ce),B&&document.head.removeChild(B),se(),g.destroyed=!0,y.unmount()}),m.onUpdated(()=>{y.updated()}),m.watch(f,F=>{F?j():se()},{immediate:!0}),m.watch(()=>s.option,()=>{y.initOptions(),v.refresh()},{deep:!0}),m.watch(()=>[...l.value],F=>{y.$handle.isBreakWatch()||F.length===g.renderRule.length&&F.every(E=>g.renderRule.indexOf(E)>-1)||(y.$handle.updateAppendData(),y.$handle.reloadRule(l.value),n.renderRule())}),m.watch(()=>[s.disabled,s.preview],()=>{v.refresh()}),m.watch(u,F=>{JSON.stringify(F||{})!==g.updateValue&&(v.config.forceCoverValue?v.coverValue(F||{}):v.setValue(F||{}))},{deep:!0,flush:"post"}),m.watch(()=>s.index,()=>{v.coverValue({}),y.$handle.updateAppendData(),m.nextTick(()=>{m.nextTick(()=>{v.clearValidateState()})})},{flush:"sync"}),H(_({fc:m.markRaw(y),parent:o&&m.markRaw(o),top:m.markRaw(a),fapi:m.markRaw(v)},m.toRefs(g)),{getGroupInject:()=>ve(n,o),refresh(){++g.unique},renderRule(){g.renderRule=[...l.value||[]]},updateValue(F){if(g.destroyed)return;const E=JSON.stringify(F);g.updateValue!==E&&(g.updateValue=E,n.$emit("update:value",F),m.nextTick(()=>{Qe(),o?f.value||ce():(M(),ce())}))}})},created(){this.$emit("input",this.fapi),this.fc.init()}}}const 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 f=a[u]instanceof Array?a[u]:[a[u]],d=l[u]instanceof Array?l[u]:[l[u]];a[u]=[...f,...d]}else if(n.indexOf(u)>-1)for(const f in l[u])if(a[u][f]){const d=a[u][f]instanceof Array?a[u][f]:[a[u][f]],g=l[u][f]instanceof Array?l[u][f]:[l[u][f]];a[u][f]=[...d,...g]}else a[u][f]=l[u][f];else if(u==="hook")for(let f in l[u])a[u][f]?a[u][f]=sr(a[u][f],l[u][f]):a[u][f]=l[u][f];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)},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"],Ie=["validate","children","control"],Ae=["effect","deep","renderSlots"];function ft(){return[...ut,...ot,...at,...lt,...Ie,...Ae]}function ct(t,e,r){return`[form-create ${t}]: ${e}`}function Pe(t,e){console.error(ct("err",t))}function or(t){Pe(t.toString()),console.error(t)}function ar(t){return t==null?"":typeof t=="object"?JSON.stringify(t,null,2):String(t)}const Te="[[FORM-CREATE-PREFIX-",Be="-FORM-CREATE-SUFFIX]]";function Le(t,e){return JSON.stringify(me(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 Te+i+Be}},e)}function Ve(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(Te)===0)r=r.replace(Be,"").replace(Te,""),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=Ve("function($inject){"+r.substring(5)+"}"),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=Ve(r)}catch(n){s=Ve("function "+r)}return s.__json=t,s}catch(s){Pe(`解析失败:${r}
|
|
11
11
|
|
|
12
|
-
err: ${s}`);return}}return t}function ht(t,e){return JSON.parse(t,function(r,i){return h.Undef(i)||!i.indexOf?i:W(i,e)})}let lr=0;function $e(){const t=370+ ++lr;return"F"+Math.random().toString(36).substr(3,3)+(+`${Date.now()}`).toString(36)+t.toString(36)+"c"}function te(t,e,r){let i=t,s;return(e||"").split(".").forEach(n=>{s&&((!i[s]||typeof i[s]!="object")&&S(i,s,{}),i=i[s]),s=n}),S(i,s,r),i}function Ne(t,e){return{value:t,enumerable:!1,configurable:!1,writable:!!e}}function dt(t,e){return pt([t],e||!1)[0]}function pt(t,e){return de([],[...t],e||!1)}function Q(t,e){return X(Array.isArray(e)?e:[e],t,{array:Ie,normal:Ae}),t}function mt(t){const e=h.Function(t.getRule)?t.getRule():t;return e.type||(e.type="input"),e}function ur(t,e){return t?(Object.keys(e||{}).forEach(r=>{e[r]&&(t[r]=Q(t[r]||{},e[r]))}),t):e}function gt(t,e){Object.defineProperties(t,Object.keys(e).reduce((r,i)=>(r[i]={get(){return e[i]()}},r),{}))}function Z(t){return t.__fc__||(t.__origin__?t.__origin__.__fc__:null)}function k(t,e){try{e=t()}catch(r){or(r)}return e}function Me(t,e){let r=null;return h.Function(t)?r=t():Array.isArray(t)?r=t.map(i=>Me(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]=Me(t[i],i)}),r}else return Me(t,e)}function ve(){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 be(t,e){return Object.setPrototypeOf(t,e),t}const yt=(t,e)=>typeof t=="string"?String(e):typeof t=="number"?Number(e):e,oe={"==":(t,e)=>JSON.stringify(t)===JSON.stringify(yt(t,e)),"!=":(t,e)=>!oe["=="](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(yt(t[0],e))>-1},notOn(t,e){return!oe.on(t,e)},in(t,e){return e&&e.indexOf&&e.indexOf(t)>-1},notIn(t,e){return!oe.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 V(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 $t(t){let e=t.split("."),r=[],i="";return e.forEach((s,n)=>{n===0?i=s:i+="."+s,r.push(i)}),r.join(" && ")}function vt(){return{props:{},on:{},options:[],children:[],effect:{},hidden:!1,display:!0,value:void 0}}function T(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(vt(),{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 S(this._data,t,e),this},_clone(){const t=new this.constructor;return t._data=dt(this._data),t}});function bt(t){t.forEach(e=>{Ue.prototype[e]=function(r){return Q(this._data,{[e]:arguments.length<2?r:{[r]:arguments[1]}}),this}})}bt(ft());const _t=T("");function hr(t,e,r){let i=_t("",e);return i._data.type=t,i._data.title=r,i}function Ct(t,e,r,i){let s=_t("",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:Ct,template:Ct,factory:T}}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 wt(t){const e=t.responseText||t.response;if(!e)return e;try{return JSON.parse(e)}catch(r){return e}}function Ot(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),wt(e));t.onSuccess(wt(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||Ot)(H(_({},t),{onSuccess(n){let o=l=>l;const a=W(t.parse);h.Function(a)?o=a:a&&h.String(a)&&(o=l=>V(l,a)),i(o(n,void 0,r))},onError(n){s(n)}}))})}function me(t){return J(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){e(n).forEach(l=>{t.getCtxs(l).forEach(u=>{S(u.rule,o,a),t.$render.clearCache(u)})})}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 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 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}},formData(n){if(n==null){const o={};return Object.keys(t.form).forEach(a=>{t.ignoreFields.indexOf(a)===-1&&(o[a]=me(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?me(o.rule.value):t.options.appendValue!==!1&&F(t.appendData,n)?me(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=F(n,a);l.forEach(f=>{f.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=>{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&&Z(n);if(o)return o.rm(),o.origin},destroy:()=>{t.vm.$el.parentNode&&t.vm.$el.parentNode.removeChild(t.vm.$el),t.vm.$destroy()},fields:()=>t.fields(),append:(n,o,a)=>{let l=t.sort.length-1,u;const f=t.getCtx(o);if(f)if(a){if(u=f.getPending("children",f.rule.children),!Array.isArray(u))return;l=f.rule.children.length-1}else l=f.root.indexOf(f.origin),u=f.root;else u=t.rules;u.splice(l+1,0,n)},prepend:(n,o,a)=>{let l=0,u;const f=t.getCtx(o);if(f)if(a){if(u=f.getPending("children",f.rule.children),!Array.isArray(u))return}else l=f.root.indexOf(f.origin),u=f.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=>{S(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)?Z(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=>{S(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=>{Q(a.rule,o)})},mergeRules(n){Object.keys(n).forEach(o=>{s.mergeRule(o,n[o])})},getRule:(n,o)=>{const a=t.getCtx(n);if(a)return o?a.origin:a.rule},getRenderRule:n=>{const o=t.getCtx(n);if(o)return o.prop},getRefRule:n=>{const o=t.getCtxs(n);if(o){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)),F(l.rule,"$"+o)&&S(l.rule,"$"+o,a),F(l.rule,"effect")||S(l.rule,"effect",{}),S(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=me(a.defaultValue)})}),m.nextTick(()=>{m.nextTick(()=>{m.nextTick(()=>{s.clearValidateState(n)})})}),n==null&&(h.Function(t.options.onReset)&&k(()=>t.options.onReset(s)),t.vm.$emit("reset",s))},method(n,o){const a=s.el(n);if(!a||!a[o])throw new Error(ct("err",`${o} 方法不存在`));return(...l)=>a[o](...l)},exec(n,o,...a){return k(()=>s.method(n,o)(...a))},toJson(n){return Le(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?Z(n):t.getCtx(n),l=a?a.rule:o?n:s.getRule(n);if(!l)return[];const u=[];return(d=>{d&&d.forEach(g=>{typeof g=="object"&&(g.field&&u.push(g),u.push(...s.getChildrenRuleList(g)))})})(a?a.loadChildrenPending():l.children),u},getParentRule(n){return(typeof n=="object"?Z(n):t.getCtx(n)).parent.rule},getParentSubRule(n){const a=typeof n=="object"?Z(n):t.getCtx(n);if(a){const l=a.getParentGroup();if(l)return l.rule}},getChildrenFormData(n){return s.getChildrenRuleList(n).reduce((a,l)=>(a[l.field]=me(l.value),a),{})},setChildrenFormData(n,o,a){const l=s.getChildrenRuleList(n);t.deferSyncValue(()=>{l.forEach(u=>{F(o,u.field)?u.value=o[u.field]:a&&(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||o(t.fc.loadData[n]),l.type==="fetch"?s.fetch(l).then(u=>{o(u)}).catch(a):o(l.data)})},renderRule(n,o,a){const u=typeof n=="object"?Z(n):t.getCtx(n);return u?t.$render.createRuleVnode(u,o,a):void 0},renderChildren(n,o,a){const u=typeof n=="object"?Z(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&&k(n)},emit(n,...o){t.vm.$emit(n,...o)},deferSyncValue(n,o){t.deferSyncValue(n,o)},bus:t.bus,fetch(n){return new Promise((o,a)=>{n=J(n),n=t.loadFetchVar(n),t.beforeFetch(n).then(()=>kt(n,t.fc.create.fetch,s).then(l=>{k(()=>n.onSuccess&&n.onSuccess(l)),o(l)}).catch(l=>{k(()=>n.onError&&n.onError(l)),a(l)}))})},watchFetch(n,o,a,l){return t.fc.watchLoadData((u,f)=>{let d=J(n);d=t.loadFetchVar(d,u),!(l&&l(d,f)===!1)&&t.beforeFetch(d).then(()=>kt(d,t.fc.create.fetch,s).then(g=>{k(()=>d.onSuccess&&d.onSuccess(g)),o&&o(g,f)}).catch(g=>{k(()=>d.onError&&d.onError(g)),a&&a(g)}))},n.wait==null?1e3:n.wait)},getData(n,o){return 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 G(t){const e=t.replace(/(-[a-z])/g,function(r){return r.replace("-","").toLocaleUpperCase()});return Rt(e)}function Rt(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-"+pe(e.rule.field)]||i.$scopedSlots["field-"+e.rule.field]),s||(s=i.$scopedSlots["type-"+pe(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=ve();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]=m.computed(()=>{const i=this.$handle.options.global;return Q({},[i["*"]||i.default||{},i[e.originType]||i[e.type]||i[e.type]||{}])})),e.prop=Q({},[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&&te(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=>{te(e.prop,i,r[i])})},parseSide(e,r){return h.Object(e)?Q({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&&k(()=>i.slotUpdate(u));let f=[];const d=e.loadChildrenPending();e.parser.renderChildren?f=e.parser.renderChildren(d,e):e.parser.loadChildren!==!1&&(f=this.renderChildren(d,e)),Object.keys(n.renderSlots||{}).forEach(b=>{f.push(this.renderRule({type:"template",slot:b},(()=>{if(h.Function(n.renderSlots[b]))return k(()=>n.renderSlots[b]());const O=this.parseSide(n.renderSlots[b],e);return this.renderRule(O)})()))});const g=this.getTypeSlot(e);let y;return g?(u.children=f,y=g(u)):y=a?e.parser.preview(je(f),e):e.parser.render(je(f),e),y=this.renderSides(y,e),!(!e.input&&h.Undef(n.native))&&n.native!==!0&&(this.fc.targetFormDriver("updateWrap",e),y=this.$manager.makeWrap(e,y)),e.none&&(Array.isArray(y)?y=y.map(b=>!b||!b.tag?b:this.none(b)):y=this.none(y)),o&&this.setCache(e,()=>this.stable(y),r),y},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,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=[{ref:r,key:s.key||`${i}fc`,slot:void 0,on:{"hook:mounted":()=>{this.onMounted(e)},"fc.updateValue":o=>{this.$handle.onUpdateValue(e,o)},"fc.el":o=>{e.exportEl=o,o&&((o.$el||o).__rule__=e.rule)}}}];if(e.input){const o=this.tmpInput;this.vm.$props.disabled===!0&&(e.prop.props.disabled=!0),e.prop.model={value:this.$handle.getFormData(e),callback:a=>{o&&o(e.field,a,e.rule),this.onInput(e,a)},expression:`formData.${e.id}`},e.prop.modelEmit&&n.push({on:{[e.prop.modelEmit]:()=>this.onEmitInput(e)}})}return X(n,e.prop),e.prop},onMounted(e){e.el=this.vm.$refs[e.ref],e.el&&((e.el.$el||e.el).__rule__=e.rule),e.parser.mounted(e),this.$handle.effect(e,"mounted"),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=ve();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&&m.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(Rt(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=ve();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=G(e.type);const a=this.vNode.aliasMap[s];a&&(s=G(a))}if(!s)return;const n=ve();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 qe(t){C(this,{$handle:t,fc:t.fc,vm:t.vm,$manager:t.$manager,vNode:new t.fc.CreateNode(t.vm),force:!1,tmpInput:null,id:$r++}),gt(this,{options(){return t.options},sort(){return t.sort}}),this.initCache(),this.initRender()}gr(qe),yr(qe);function vr(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(f=>{if(!f)return;let d,g=n||o||a;if(h.Object(f)&&(d=f.inject,f=f.name,g=f.prefix||g),g){r||(g=`native-${g}`);const y=pe(`${g}-${f}`),b=(...O)=>{this.vm.$emit(y,...O),this.vm.$emit("emit-event",y,...O),this.bus.$emit(y,...O)};if(b.__emit=!0,!d&&l===!1)i[f]=b;else{let O=d||l||this.options.injectEvent;i[f]=h.Undef(O)?b:this.inject(s,b,O)}}}),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);let o;if(n.forEach(a=>{const l=a.split("||"),u=l[0].trim();if(u){const f=(l[1]||"").trim();let d,g=!1;if(i&&u.indexOf("$form.")===0){const y=u.split(".");y.shift(),F(i.value,y[0])&&(g=!0,d=r?r({id:"$form."+y[0]+"_"+i.rule.__fc__.id,getValue:()=>V(i.value,y)}):V(i.value,y))}g||(d=r?r(u,f):this.fc.getLoadData(u,f)),o=d,e=e.replaceAll(`{{${a}}}`,d==null?"":d)}}),n.length===1&&s===`{{${n[0]}}}`)return o}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 St=["hook:updated","hook:mounted"];function br(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(St,e),this.bus.$emit("page-end")):(this.first+=this.limit,this.pageEnd=this.rules.length<=this.first,this.loadRule(),this.refresh())};this.vm.$on(St,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__:Ne(m.markRaw(t),!0)}),t.rule!==t.origin&&Object.defineProperties(t.rule,{__fc__:Ne(m.markRaw(t),!0)})}function Ft(t,e,r){const i=$e(),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?J(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=k(()=>r({rule:this.rule,api:this.$api,update:u=>{const f=u||i,d=this.getPending(e,i);this.setPending(e,r,f),o&&o(f,d)},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 f=u||i;this.setPending(e,r,f),s&&s(f),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:m.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=$e(),t&&this.parent&&this.parent.updateKey(t)},updateType(){this.originType=this.rule.type,this.type=G(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=Q({},[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)},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 Or(t){C(t.prototype,{nextRefresh(e){const r=this.loadedId;m.nextTick(()=>{r===this.loadedId&&(e?e():this.refresh())})},parseRule(e){const r=mt(e);return Object.defineProperties(r,{__origin__:Ne(e,!0)}),kr(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)&&X([{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=mt(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 f,d=!1,g=!!o.__fc__,y=l.value;if(g){if(f=o.__fc__,y=f.defaultValue,f.deleted){if(Et(f))return;f.update(this)}else if(!f.check(this)){if(Et(f))return;e[a]=o=o._clone?o._clone():ht(Le(o)),f=null,d=!0}}if(f)f.originType!==f.rule.type&&f.updateType(),this.bindParser(f),this.appendValue(f.rule),f.parent&&f.parent!==r&&this.rmSubRuleData(f);else{const A=this.parseRule(o);f=new Ft(this,A,y),this.bindParser(f)}[!1,!0].forEach(A=>this.parseEmit(f,A)),this.syncProp(f),f.parent=r||null,f.root=e,this.setCtx(f),!d&&!g&&(this.effect(f,"load"),this.targetHook(f,"load")),this.effect(f,"created");const b=f.loadChildrenPending();if(f.parser.loadChildren===!1||s(b,f),!r){const A=i(a);A>-1||!a?this.sort.splice(A+1,0,f.id):this.sort.push(f.id)}const O=f.rule;return f.updated||(f.updated=!0,h.Function(O.update)&&this.bus.$once("load-end",()=>{this.refreshUpdate(f,O.value,"init")}),this.effect(f,"loaded")),this.refreshControl(f)&&(this.cycleLoad=!0),f}).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(d){return(oe[l.condition||"=="]||oe["=="])(d,l.value)};if(!h.trueArray(l.rule))continue;const f=H(_({},l),{valid:k(()=>u(e.rule.value,s)),ctrl:Sr(e,l.rule),isHidden:h.String(l.rule[0])});f.valid&&f.ctrl||!f.valid&&!f.ctrl&&!f.isHidden||i.push(f)}if(!i.length)return!1;const n=[];let o=!1;return this.deferSyncValue(()=>{i.reverse().forEach(({isHidden:a,valid:l,rule:u,prepend:f,append:d,child:g,ctrl:y,method:b})=>{if(a){l?e.ctrlRule.push({__ctrl:!0,children:u,valid:l}):y&&e.ctrlRule.splice(e.ctrlRule.indexOf(y)>>>0,1),n[l?"push":"unshift"](()=>{b==="disabled"||b==="enabled"?this.api.disabled(!l,u):b==="display"?this.api.display(l,u):b==="required"?(u.forEach(O=>{this.api.setEffect(O,"required",l)}),l||this.api.clearValidateState(u)):this.api.hidden(!l,u)});return}if(l){o=!0;const O={type:"fragment",native:!0,__ctrl:!0,children:u};e.ctrlRule.push(O),this.bus.$once("load-start",()=>{f?s.prepend(O,f,g):d||g?s.append(O,d||e.id,g):e.root.splice(e.root.indexOf(e.origin)+1,0,O)})}else{e.ctrlRule.splice(e.ctrlRule.indexOf(y),1);const O=Z(y);O&&O.rm()}})}),n.length&&(this.loading?n.length&&this.bus.$once("load-end",()=>{n.forEach(a=>a())}):n.length&&m.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 kr(t){const e=vt();return Object.keys(e).forEach(r=>{F(t,r)||S(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 Et(t){return!!t.rule.__ctrl}function Fr(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&&m.nextTick(()=>{m.nextTick(()=>{m.nextTick(()=>{this.api.clearValidateState(e.id)})})}))},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&&F(s,o)?n[o]=r[o]:F(this.api.form,o)?this.api.form[o]=r[o]:this.api.top!==this.api&&F(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]||S(this.subRuleData,i.id,{}),S(this.subRuleData[i.id],e.field,e.rule.value)),S(this.formData,e.id,r)},rmSubRuleData(e){const r=e.getParentGroup();r&&this.subRuleData[r.id]&&ee(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]=m.toRef(this.appendData,n)),s),e),r.reduce((s,n)=>{const o=(this.fieldCtx[n]||[]).filter(a=>!this.isIgnore(a.rule))[0]||this.fieldCtx[n][0];return this.isIgnore(o.rule)&&i.push(n),s[n]=m.toRef(o.rule,"value"),s},e),this.form=m.reactive(e),this.ignoreFields=i,this.syncValue()},isIgnore(e){return e.ignore===!0||e.ignore==="hidden"&&e.hidden||this.options.ignoreHiddenFields&&e.hidden},appendValue(e){(!e.field||!F(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),k(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),Dt)!==JSON.stringify(r,Dt)},isQuote(e,r){return(h.Object(r)||Array.isArray(r))&&r===e.rule.value},refreshUpdate(e,r,i,s){if(h.Function(e.rule.update)){const n=k(()=>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 Dt(t,e){return typeof e=="function"?""+e:e}const _e={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){}},Er=["field","value","vm","template","name","config","control","inject","sync","payload","optionsTo","update","slotUpdate","computed","component","cache"];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[G(e.type)]||s[e.trueType];if(n)return n}return r[e.originType]||r[G(e.type)]||r[e.trueType]||_e},bindParser(e){e.setParser(this.getParser(e))},getType(e){const r=this.fc.CreateNode.aliasMap,i=r[e]||r[G(e)]||e;return G(i)},noWatch(e){this.noWatchFn||(this.noWatchFn=e),k(e),this.noWatchFn===e&&(this.noWatchFn=null)},watchCtx(e){if(ft().filter(i=>i[0]!=="_"&&i[0]!=="$"&&Er.indexOf(i)===-1).forEach(i=>{const s=m.toRef(e.rule,i),n=i==="children";e.refRule[i]=s,e.watch.push(m.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,m.nextTick(()=>{this.targetHook(e,"watch",{key:i,oldValue:a,newValue:l})}),i==="hidden"&&!!l!=!!a&&(this.$render.clearCacheAll(),m.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=m.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=m.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=m.computed(()=>q(e.rule.validate).map(i=>{const s=_({},i);if(s.message){const n=s.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);n&&(s.message=this.api.t(n[1],{title:e.refRule.__$title.value}))}if(h.Function(s.validator)){const n=e;return s.validator=function(...o){return i.validator.call({that:this,id:n.id,field:n.field,rule:n.rule,api:n.$handle.api},...o)},s}return s})),e.input){const i=m.toRef(e.rule,"value");e.watch.push(m.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=>{let n;const o=m.computed(()=>{const l=i[s];if(!l)return;const u=this.compute(e,l);return l.linkage&&u===void 0?n:u}),a=l=>{s==="value"?this.onInput(e,l):s[0]==="$"?this.api.setEffect(e.id,s,l):te(e.rule,s,l)};(s==="value"?[void 0,null,""].indexOf(e.rule.value)>-1:o.value!==V(e.rule,s))&&a(o.value),e.watch.push(m.watch(o,l=>{n=l,setTimeout(()=>{a(l)})}))}))}),this.watchEffect(e)},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 f=0;f<a.group.length;f++){const d=a.group[f];let g,y=null;if(d.variable)y=JSON.stringify(this.fc.getLoadData(d.variable)||"");else if(d.field)y=$t(d.field||"");else return!0;let b=d.compare;if(b&&(b=$t(b||"")),d.mode?g=n(d):oe[d.condition]?h.Function(d.handler)?g=k(()=>d.handler(this.api,e.rule)):g=k(()=>new Function("$condition","$val","$form","$group","$rule",`with($form){with(this){with($group){ return $condition['${d.condition}'](${y}, ${b||"$val"}); }}}`).call(this.api.form,oe,d.value,this.api.top.form,s?this.subRuleData[s.id]||{}:{},e.rule)):g=!1,l&&g)return!0;l||(u=u&&g)}return l?!1:u};let o=n(r);return o=r.invert===!0?!o:o,r.linkage?o?k(()=>this.computeValue(r.linkage,e,s),void 0):void 0: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 k(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 new Function("$formulas","$form","$group","$rule","$api",`with($form){with(this){with($group){with($formulas){ return ${e} }}}}`).call(this.api.form,n,this.api.top.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;ee(this.ctxs,r),ee(this.formData,r),ee(this.subForm,r),ee(this.vm.ctxInject,r);const o=e.getParentGroup();o&&this.subRuleData[o.id]&&ee(this.subRuleData[o.id],i),e.group&&ee(this.subRuleData,r),s&&this.rmIdCtx(e,i,"field"),n&&this.rmIdCtx(e,n,"name"),s&&!F(this.fieldCtx,i)&&ee(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.__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 jr(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[G("on-"+e)];if(i){const s=W(i);h.Function(s)&&k(()=>s(...r))}this.bus.$emit(e,...r)},targetHook(e,r,i){var n,o;let s=(o=(n=e.prop)==null?void 0:n.hook)==null?void 0:o[r];s&&(s=Array.isArray(s)?s:[s],s.forEach(a=>{k(()=>a(H(_({},i||{}),{rule:e.rule,api:this.api})))}))}})}function Ir(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),this.providers[r]=i})},onEffect(e){const r=[];(e._c||["*"]).forEach(i=>{const s=i==="*"?"*":this.getType(i);r.indexOf(s)>-1||(r.push(s),this.bus.$on(`p:${e.name}:${s}:${e.input?1:0}`,(n,o)=>{e[n]&&e[n](...o)}))}),e._used=r},watchEffect(e){let r={required:()=>{var i,s;return(F(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(m.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(F(e,"$"+r))return e["$"+r];if(F(e,"effect")&&F(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,f)=>(f[0]==="$"&&(u[f.substr(1)]=r[f]),u),_({},r.effect||{}));Object.keys(l).forEach(u=>{const f=this.providers[u];if(!f||f.input&&!i)return;let d;if(!f._c)d="*";else if(f._used.indexOf(s)>-1)d=s;else return;const g=_({value:l[u],getValue:()=>this.getEffect(r,u)},a||{});e&&(g.getProp=()=>e.effectData(u),g.clearProp=()=>e.clearEffectData(u),g.mergeProp=y=>Q(g.getProp(),[y]),g.id=e.id),this.bus.$emit(`p:${u}:${d}:${f.input?1:0}`,o,[g,r,this.api])})}})}function Ar(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=Ar(e.filter(i=>i!=="*"));return r.length?r:!1}else return h.String(e)?[e]:!1}function z(t){gt(this,{options(){return t.options.value||{}},bus(){return t.bus},preview(){return t.vm.$options.propsData.preview!=null?t.vm.$options.propsData.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:m.reactive({}),subRuleData:m.reactive({}),subForm:{},form:m.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 qe(this),this.api=t.extendApiFn.reduce((e,r)=>{const i=k(()=>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.$options.propsData.value||{}),this.appendData)},isBreakWatch(){return this.loading||this.noWatchFn||this.reloading},beforeFetch(t){return new Promise(e=>{const r=this.options.beforeFetch&&k(()=>this.options.beforeFetch(t,{api:this.api}));r&&h.Function(r.then)?r.then(e):e()})}}),vr(z),br(z),Cr(z),Or(z),Fr(z),Dr(z),jr(z),Ir(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 Br(){const t={};function e(r){r&&this.setVm(r)}return C(e.prototype,{setVm(r){this.vm=r,this.h=this.$h=r.$createElement},make(r,i,s){var n,o;return(m.isReservedTag?m.isReservedTag(r):(n=m==null?void 0:m.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 o;let n=this.$h(r,Tr(i),s||[]);if((o=n==null?void 0:n.componentOptions)!=null&&o.propsData&&(i!=null&&i.props)){const a=Object.keys(n.componentOptions.propsData);n.data.attrs||(n.data.attrs={}),Object.keys(i.props).forEach(l=>{n.data.attrs[l]==null&&a.indexOf(l)===-1&&["string","number","boolean"].indexOf(typeof i.props[l])>-1&&(n.data.attrs[l]=i.props[l])})}return n.context=this.vm,n},aliasMap:t}),C(e,{aliasMap:t,alias(r,i){t[r]=i},use(r){Object.keys(r).forEach(i=>{const s=pe(i),n=ar(i).toLocaleLowerCase(),o=r[i];[i,s,n].forEach(a=>{e.alias(i,o),e.prototype[a]=function(l,u){return this.make(o,l,u)}})})}}),e}function Lr(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=$e()},init(){},update(){},beforeRender(){},form(){return this.vm.$refs[this.ref]},getSlot(t){const e=r=>{if(r){let i=r.$scopedSlots[t];return i||e(r.$pfc)}};return e(this.vm)},mergeOptions(t,e){return X(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{}},render(t){}});const Vr=function(t){const e={name:"loadData",_fn:[],loaded(r,i,s){this.deleted(r);let n=q(r.getValue());const o=[];n.forEach(a=>{if(a&&(a.attr||a.template)){let l=d=>{let g;a.template?g=t.$handle.loadStrVar(a.template,d):a.handler&&h.Function(a.handler)?g=a.handler(d,i,s):g=d(a.attr,a.default),a.copy!==!1&&(g=J(g));const y=a.modify?i:r.getProp();a.to==="child"?y.children?S(y.children,0,g):S(y,"children",[g]):te(y,a.to||"options",g),s.sync(i)},u=d=>l(d);const f=t.watchLoadData(u);l=se(l,a.wait||300),a.watch!==!1?o.push(f):f()}}),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.mounted,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 f=y=>{let b=t.t(u?l.attr:l,u?l.params:null,y);const O=u&&l.modify?i:r.getProp();a==="child"?O.children?S(O.children,0,b):S(O,"children",[b]):te(O,a,b),s.sync(i)},d=y=>f(y);const g=t.watchLoadData(d);f=se(f,l.wait||300),l.watch!==!1?o.push(g):g()}}),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},It={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;delete i.method,t.getProp().validate=[H(_({},i),{validator(...n){const o=Z(e);if(o)return r.exec(o.id,h.String(s)?s:"formCreateValidate",...n,{attr:t,rule:e,api:r})}})]}},watch(...t){It.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=d=>{d===void 0?s.clearProp():te(s.getProp(),a.to||"options",d),o.sync(n)};if(!a||!a.action&&!a.key){l(void 0);return}if(a=J(a),a.to||(a.to="options"),a.key){const d=t.$handle.options.globalData[a.key];if(!d){l(void 0);return}if(d.type==="static"){l(d.data);return}else a=_(_({},a),d)}const u=a.onError,f=()=>{if(!s.getValue())return s.clearProp(),o.sync(n),!0};i._fn[s.id]=t.watchLoadData(se((d,g)=>{if(g&&a.watch===!1)return i._fn[s.id]();const y=t.$handle.loadFetchVar(J(a),d,n),b=H(_({headers:{}},y),{onSuccess(O,A){if(f())return;let ie=U=>A?U:F(U,"data")?U.data:U;const B=W(y.parse);h.Function(B)?ie=B:B&&h.String(B)&&(ie=U=>V(U,B)),l(ie(O,n,o)),o.sync(n)},onError(O){l(void 0),!f()&&(u||(A=>Pe(A.message||"fetch fail "+y.action)))(O,n,o)}});t.$handle.beforeFetch(b,{rule:n,api:o}).then(()=>{if(h.Function(y.action)){y.action(n,o).then(O=>{b.onSuccess(O,!0)}).catch(O=>{b.onError(O)});return}k(()=>t.create.fetch(b,{inject:s,rule:n,api:o}))})},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:Vr,t:Nr,componentValidate:It};function Ur(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 qr={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 Gr(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 Hr(t){const e=localStorage.getItem(t);if(e)try{return JSON.parse(e)}catch(r){return e}return null}function Jr(t){const e=sessionStorage.getItem(t);if(e)try{return JSON.parse(e)}catch(r){return e}return null}function He(t,e){if(!e)return null;const r=e.split(".");let i=t(r.shift());return r.length?i==null?null:V(i,r):i}function Wr(t){return He(Gr,t)}function zr(t){return He(Hr,t)}function Kr(t){return He(Jr,t)}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 Qr(t){return!t||!t.el?window.document.body:h.Element(t.el)?t.el:document.querySelector(t.el)}function Zr(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||[];ut.push(...e),Ie.push(...r),Ae.push(...i),bt([...e,...r,...i])}let xr=1;const M={},Ce=Symbol("defValue");function At(t){const e={[Ge.name]:Ge},r={},i={},s={},n={},o=[],a=[],l=[t.extendApi],u=_({},Mr),f=dr();let d={global:{}};const g=t.isMobile===!0,y=m.reactive({$mobile:g}),b=Br(),O={},A={};Yr(t.attrs||{});function ie(c){const p=M[c];if(Array.isArray(p))return p.map($=>$.api());if(p)return p.api()}function B(c){o.push(c)}function U(){const c=Je(...arguments);c.id&&c.prop&&(i[c.id]=c.prop)}function Qe(){const c=Je(...arguments);c.id&&c.prop&&(u[c.id]=h.Function(c.prop)?c.prop:H(_({},c.prop),{name:c.id}))}function ke(c){b.use(c)}function R(){const c=Je(...arguments);if(!c.id||!c.prop)return _e;const p=G(c.id),$=c.prop,v=$.merge===!0?r[p]:void 0;r[p]=be($,v||_e),f[p]=T(p),$.maker&&C(f,$.maker)}function I(c,p){let $;if(h.String(c)){if($=c,p===void 0)return["form-create","formcreate"].indexOf($)>-1?L():e[$]}else $=G(c.name),p=c;if(!$||!p)return;const v=G($);e[$]=p,e[v]=p,delete b.aliasMap[$],delete b.aliasMap[v],delete r[$],delete r[v],p.formCreateParser&&R($,p.formCreateParser)}function L(){return nr(Ye,e,i)}function ae(){return Ge}function Re(c,p){return h.Function(c.install)?c.install(le,p):h.Function(c)&&c(le,p),this}function le(c,p,$){let v=Zr(c,p||{});const w=v.$refs.fc.formCreate;return w.$parent=$,Qr(w.options).appendChild(v.$el),w.api()}be(le,A);function Ci(c){let p=_({},t);return c?p.inherit={components:e,parsers:r,directives:i,modelFields:s,providers:u,useApps:o,maker:f,formulas:O,loadData:y}:delete p.inherit,At(p)}function wi(c,p){s[c]=p}function Oi(c,p){O[c]=p}function ki(c,p){const $=n[c]||{},v=$.parsers||{};p.parsers&&Object.keys(p.parsers).forEach(w=>{v[w]=be(p.parsers[w],_e)}),p.name=c,n[c]=H(_(_({},$),p),{parsers:v})}function Se(c){c&&Object.keys(M).forEach(p=>{(Array.isArray(M[p])?M[p]:[M[p]]).forEach(v=>{v.bus.$emit("$loadData."+c)})})}function Ze(c,p){te(y,c,p),Se(c)}function Fe(c,p){const $=(...v)=>k(()=>p(...v));$._driver=!0,Ze(c,$)}function Nt(c,p){const $=(c||"").split(".");c=$.shift();const v=$.join(".");if(F(y,c)||S(y,c,Ce),y[c]!==Ce){let w=y[c];return w&&w._driver?w=w(v):$.length&&(w=V(w,$)),w==null||w===""?p:w}else return p}function Ri(c){l.push(c)}function Si(c){delete y[c],Se(c)}function Fi(c,p){a.push({name:c,callback:p})}function Ye(c){C(this,{id:xr++,create:le,vm:c,manager:Lr(t.manager),parsers:r,providers:u,modelFields:s,formulas:O,isMobile:g,rules:c.$options.propsData.rule,name:c.$options.propsData.name||$e(),inFor:c.$options.propsData.inFor,prop:{components:e,directives:i},drivers:n,renderDriver:null,refreshData:Se,loadData:y,CreateNode:b,bus:new Ur,unwatch:[],options:m.ref({}),extendApiFn:l,fetchCache:new WeakMap,tmpData:m.reactive({})}),a.forEach(p=>{this.bus.$on(p.name,p.callback)}),m.nextTick(()=>{m.watch(this.options,()=>{this.$handle.$manager.updateOptions(this.options.value),this.api().refresh()},{deep:!0})}),C(c.$options.components,e),C(c.$options.directives,i),this.$handle=new z(this),this.name&&(this.inFor?(M[this.name]||(M[this.name]=[]),M[this.name].push(this)):M[this.name]=this)}Ye.isMobile=g,C(Ye.prototype,{init(){this.isSub()&&this.unwatch.push(m.watch(()=>this.vm.parent.fc.options.value,()=>{this.initOptions(),this.$handle.api.refresh()},{deep:!0})),this.vm.$options.propsData.driver&&(this.renderDriver=typeof this.vm.$options.propsData.driver=="object"?this.vm.$options.propsData.driver:this.drivers[this.vm.$options.propsData.driver]),!this.renderDriver&&this.vm.parent&&(this.renderDriver=this.vm.parent.renderDriver),this.renderDriver||(this.renderDriver=this.drivers.default),this.initOptions(),this.$handle.init()},targetFormDriver(c,...p){if(this.renderDriver&&this.renderDriver[c])return k(()=>this.renderDriver[c](...p))},t(c,p,$){let v=$?$("$t."+c):this.globalLanguageDriver(c);return v==null&&(v=""),v&&p&&Object.keys(p).forEach(w=>{const D=new RegExp(`{${w}}`,"g");v=v.replace(D,p[w])}),v},globalDataDriver(c){let p=c.split(".");const $=p.shift(),v=this.options.value.globalData&&this.options.value.globalData[$];if(v){if(v.type==="static")return V(v.data,p);{let w;const D=this.fetchCache.get(v);if(D){if(D.status&&(w=V(D.data,p)),!D.loading)return w;D.loading=!1,this.fetchCache.set(v,D)}else this.fetchCache.set(v,{status:!1});const E=se(()=>{fe();const K=this.fetchCache.get(v);this.options.value.globalData&&Object.values(this.options.value.globalData).indexOf(v)!==-1?(K&&(K.loading=!0,this.fetchCache.set(v,K)),this.bus.$emit("$loadData.$globalData."+$)):this.fetchCache.delete(v)},v.wait||600),ue=K=>{this.fetchCache.set(v,{status:!0,data:K}),this.bus.$emit("$loadData.$globalData."+$)},x=(K,ce)=>{if(ce&&v.watch===!1)return fe();if(ce){E();return}const he=this.$handle.loadFetchVar(je(v),K);this.$handle.api.fetch(he).then(ne=>{ue(ne)}).catch(ne=>{ue(null)})},fe=this.watchLoadData(x);return this.unwatch.push(fe),w}}},getLocale(){let c=this.vm.top.$props.locale;return c&&typeof c=="object"?c.name:typeof c=="string"?c:"zh-cn"},globalLanguageDriver(c){let p=this.vm.top.$props.locale,$;if(p&&typeof p=="object"&&($=V(p,c)),$==null){const v=this.options.value.language||{},w=this.getLocale();$=V(v[w],c)}return $},globalVarDriver(c){const $=c.split(".").shift(),v=this.options.value.globalVariable&&this.options.value.globalVariable[$];if(v){const w=h.Function(v)?v:W(v.handle);if(w){let D;const E=this.watchLoadData((ue,x)=>{x?(this.bus.$emit("$loadData.$var."+$),E()):D=w(ue,this.$handle.api)});return this.unwatch.push(E),D}}},setData(c,p,$){$?Ze(c,p):(te(this.vm.top.fc.tmpData,c,p),this.bus.$emit("$loadData."+c))},getLoadData(c,p){let $=null;if(c!=null){let v=c.split(".");const w=v.shift();if(w==="$topForm")$=this.$handle.api.top.formData();else if(w==="$form")$=this.$handle.api.formData();else if(w==="$options")$=this.options.value;else if(w==="$globalData")$=this.globalDataDriver(v.join(".")),v=[];else if(w==="$var")$=this.globalVarDriver(v.join(".")),v=[];else if(w==="$locale")$=this.getLocale(),v=[];else if(w==="$t")$=this.globalLanguageDriver(v.join(".")),v=[];else{if(w==="$preview")return this.$handle.preview;{const D=this.vm.top.fc.tmpData;F(D,w)||S(D,w,Ce),$=D[w]!==Ce?V(D,c):Nt(c),v=[]}}$&&v.length&&($=V($,v))}return $==null||$===""?p:$},watchLoadData(c,p){let $={};const v=E=>{k(()=>{c(w,E)})},w=(E,ue)=>{let x;if(typeof E=="object"&&(x=E.getValue,E=E.id),$[E])return $[E].val;const fe=m.computed(()=>x?x():this.getLoadData(E,ue)),K=E.split("."),ce=K.shift(),he=K.shift()||"",ne=se(()=>{const xe=x?x():this.getLoadData(E,ue);if($[E])JSON.stringify(xe)!==JSON.stringify($[E].val)&&($[E].val=xe,v(!0));else return},p||0),Di=m.watch(fe,xe=>{ne()});return this.bus.$on("$loadData."+ce,ne),he&&this.bus.$on("$loadData."+ce+"."+he,ne),$[E]={fn:()=>{this.bus.$off("$loadData."+ce,ne),he&&this.bus.$off("$loadData."+ce+"."+he,ne),Di()},val:fe.value},fe.value};v(!1);const D=()=>{Object.keys($).forEach(E=>$[E].fn()),$={}};return this.unwatch.push(D),D},isSub(){return this.vm.parent&&this.vm.extendOption},initOptions(){this.options.value={};let c=_({formData:{},submitBtn:{},resetBtn:{},globalEvent:{},globalData:{}},J(d));this.isSub()&&(c=this.mergeOptions(c,this.vm.parent.fc.options.value||{},!0)),c=this.mergeOptions(c,this.vm.$options.propsData.option||{}),this.updateOptions(c)},mergeOptions(c,p,$){return p=_({},p||{}),$&&["page","onSubmit","onReset","onCreated","onChange","onMounted","mounted","onReload","reload","formData","el","globalClass","style"].forEach(v=>{delete p[v]}),p.global&&(c.global=ur(c.global,p.global),delete p.global),this.$handle.$manager.mergeOptions([p],c),c},updateOptions(c){this.options.value=this.mergeOptions(this.options.value,c),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 c=M[this.name].indexOf(this);M[this.name].splice(c,1)}else delete M[this.name];a.forEach(c=>{this.bus.$off(c.name,c.callback)}),this.tmpData={},this.unwatch.forEach(c=>c()),this.unwatch=[],this.$handle.reloadRule([])},updated(){this.$handle.bindNextTick(()=>this.bus.$emit("next-tick",this.$handle.api))}});function Mt(c){C(c,{version:t.version,ui:t.ui,isMobile:g,extendApi:Ri,getData:Nt,setDataDriver:Fe,setData:Ze,removeData:Si,refreshData:Se,maker:f,component:I,directive:U,setModelField:wi,setFormula:Oi,setDriver:ki,register:Qe,$vnode:ae,parser:R,use:Re,factory:Ci,componentAlias:ke,copyRule:dt,copyRules:pt,mergeRule:Q,fetch:Ot,$form:L,parseFn:W,parseJson:ht,toJson:Le,useApp:B,getApi:ie,on:Fi})}function Ei(c){C(c,{create:le,install(p,$){if(d=_(_({},d),$||{}),p._installedFormCreate===!0)return;p._installedFormCreate=!0;const v=function(D,E={}){return le(D,E,this)};Mt(v),p.prototype.$formCreate=v;const w=L();p.component(w.name,w),p.component("FcFragment",ae()),o.forEach(D=>{k(()=>D(c,p))})}})}if(Mt(A),Ei(A),Fe("$cookie",Wr),Fe("$localStorage",zr),Fe("$sessionStorage",Kr),b.use({fragment:"fcFragment"}),t.install&&le.use(t),R(qr),t.inherit){const c=t.inherit;c.components&&C(e,c.components),c.parsers&&C(r,c.parsers),c.directives&&C(i,c.directives),c.modelFields&&C(s,c.modelFields),c.providers&&C(u,c.providers),c.useApps&&C(o,c.useApps),c.maker&&C(f,c.maker),c.loadData&&C(y,c.loadData),c.formulas&&C(O,c.formulas)}const Ee=L();return be(Ee,A),Object.defineProperties(Ee,{fetch:{get(){return A.fetch},set(c){A.fetch=c}}}),Ee.util=A,Ee}function We(t){if(h.Date(t))return t;{let e=new Date(t);return e.toString()==="Invalid Date"?t:e}}const Pt="datePicker",ei={name:Pt,maker:function(){return["date","dateRange","datetime","datetimeRange","year","month"].reduce((t,e)=>(t[e]=T(Pt,{type:e.toLowerCase()}),t),{})}(),mergeProp(t){let e=t.prop.props;e.startDate&&(e.startDate=e.startDate&&We(e.startDate))},isRange(t){return t.type.includes("range")||t.multiple},_toValue(t,e){const r=e.el.formatDate(t||""),{separator:i}=e.el,s=this.isRange(e.el);return r?s?r.split(i):r:s?e.el.multiple?[]:["",""]:r},toValue(t,e){const r=e.el;return r?(this.el=r,this._toValue(t,e)):t},toFormValue(t,e){if(e.el){const r=e.el.parseDate(t);return this.isRange(e.el)?r:r[0]}else{let r=Array.isArray(t),i=e.prop.props,s,n=i.type||"date";return["daterange","datetimerange"].indexOf(n)!==-1?r?s=t.map(o=>o?We(o):""):s=["",""]:n==="date"&&i.multiple===!0?s=toString(t):(s=r?t[0]||"":t,s=s?We(s):""),s}},mounted(t){t.rule.value=this.toValue(t.$handle.getFormData(t),t)}},ze="hidden",ti={name:ze,maker:{[ze]:(t,e)=>T(ze)("",t,e)},render(){return[]}},Ke="input",ri={name:Ke,maker:function(){const t=["password","url","email","text","textarea"].reduce((e,r)=>(e[r]=T(Ke,{type:r}),e),{});return t.idate=T(Ke,{type:"date"}),t}(),mergeProp(t){let{props:e}=t.prop;e.autosize&&e.autosize.minRows&&(e.rows=e.autosize.minRows||2)}},Tt="slider",ii={name:Tt,maker:{sliderRange:T(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}},ni=[ei,ti,ri,ii,{name:"switch",mergeProp(t){const e=t.prop.props.slot||{},r=t.prop.scopedSlots||{};e.open&&(r.open=()=>e.open),e.close&&(r.close=()=>e.close),t.prop.scopedSlots=r}},{name:"FcRow",render(t,e){return e.vNode.col({props:{span:24}},[e.vNode.row(e.prop,t)])}}],si={button:"iButton",icon:"Icon",slider:"Slider",rate:"Rate",upload:"fcUpload",cascader:"Cascader",colorPicker:"ColorPicker",timePicker:"TimePicker",datePicker:"DatePicker",switch:"iSwitch",select:"fcSelect",checkbox:"fcCheckbox",radio:"fcRadio",inputNumber:"InputNumber",input:"iInput",formItem:"FormItem",form:"iForm",frame:"fcFrame",col:"iCol",row:"row",tree:"fcTree",autoComplete:"AutoComplete",group:"fcGroup",array:"fcGroup",subForm:"fcSubForm",object:"fcSubForm"},we={resetBtnType:"default",resetBtnIcon:"md-refresh",infoIcon:"ios-information-circle-outline"};function oi(){return{type:"poptip",trigger:"hover",placement:"top-start",wordWrap:!0,icon:we.infoIcon}}function ai(){return{form:{inline:!1,labelPosition:"right",labelWidth:125,showMessage:!0,autocomplete:"off",size:void 0},row:{gutter:0},submitBtn:{type:"primary",disabled:!1,innerText:"",loading:!1,show:!0,click:void 0},resetBtn:{type:we.resetBtnType,disabled:!1,icon:we.resetBtnIcon,innerText:"",loading:!1,show:!1,click:void 0}}}function Bt(t,e){F(t,e)&&h.String(t[e])&&(t[e]={[e]:t[e],show:!0})}function Y(t){return t===!1}function li(t,e){F(t,e)&&!h.Object(t[e])&&(t[e]={show:!!t[e]})}function Xe(t){const e=_({},t);return delete e.children,e}const ui={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.validateMessage="",e.validateState="")},tidyOptions(t){return["submitBtn","resetBtn","row","info","wrap","col","title"].forEach(e=>{li(t,e)}),t},tidyRule({prop:t}){return Bt(t,"title"),Bt(t,"info"),t},mergeProp(t){const e={info:oi(),title:{},col:{span:24},wrap:{}};["info","wrap","col","title"].forEach(r=>{t.prop[r]=X([this.options[r]||{},t.prop[r]||{}],e[r])}),this.setSize(t.prop.props)},setSize(t){!t.size&&this.options.form.size&&(t.size=this.options.form.size)},getDefaultOptions(){return ai()},update(){const t=this.options.form;this.rule={props:_({},t),nativeOn:{submit:e=>{e.preventDefault()}},class:[t.className,t.class,"form-create",this.$handle.preview?"is-preview":""],style:t.style,type:"form"}},beforeRender(){const{key:t,ref:e,$handle:r}=this;C(this.rule,{key:t,ref:e}),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,Y(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;delete r.wrap.title;const u=Y(r.wrap.show)?e:this.$r(X([r.wrap,{props:H(_({labelWidth:o},Xe(r.wrap||{})),{prop:t.id,rules:t.injectValidate()}),class:this.$render.mergeClass(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||Y(l)||Y(s.show)?u:this.makeCol(r,i,[u])},isTitle(t){if(this.options.form.title===!1)return!1;const e=t.title;return!(!e.title&&!e.native||Y(e.show))},makeInfo(t,e,r){var u,f,d;const i=_({},t.title),s=_({},t.info),n=this.options.form,o=this.getSlot("title"),a=[o?o({title:(u=r.refRule)==null?void 0:u.__$title.value,rule:r.rule,options:this.options}):((f=r.refRule)==null?void 0:f.__$title.value)+(n.labelSuffix||n["label-suffix"]||"")];if(!Y(s.show)&&(s.info||s.native)&&!Y(s.icon)){const g={type:s.type||"poptip",props:Xe(s),key:`${e}pop`,slot:"label"};delete g.props.icon,delete g.props.show,delete g.props.info,delete g.props.align,delete g.props.native;const y="content";s.info&&!F(g.props,y)&&(g.props[y]=(d=r.refRule)==null?void 0:d.__$info.value),a[s.align!=="left"?"unshift":"push"](this.$r(X([s,g]),[this.$r({type:"icon",props:{type:s.icon===!0?we.infoIcon:s.icon,size:16},style:"margin-top: -1px",key:`${e}i`})]))}const l=X([i,{props:Xe(i),key:`${e}tit`,class:"fc-form-title",slot:i.slot||"label",type:i.type||"span"}]);return delete l.props.show,delete l.props.title,delete l.props.native,this.$r(l,a)},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(Y(this.options.submitBtn.show)||t.push(this.makeSubmitBtn()),Y(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])}},re={},fi=["upload","select","tree","checkbox","autoComplete","cascader","colorPicker","frame","inputNumber","radio","rate","timePicker","group"];function ci(t){fi.forEach(e=>{t[e]=T(e)}),t.auto=t.autoComplete,t.number=t.inputNumber,t.color=t.colorPicker}function hi(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]=T(e,n=>n.props({uploadType:r[s][0],maxLength:r[s][1]})),i),t),t.uploadImage=t.image,t.uploadFile=t.file}function di(t){const e="tree",r={treeSelected:"selected",treeChecked:"checked"};Object.keys(r).reduce((i,s)=>(i[s]=T(e,{type:r[s]}),i),t)}function pi(t){const e="timePicker";t.time=T(e,{type:"time"}),t.timeRange=T(e,{type:"timerange"})}function mi(t){const e="select";t.selectMultiple=T(e,{multiple:!0}),t.selectOne=T(e,{multiple:!1})}function gi(t){const e="frame",r={frameInputs:["input",0],frameFiles:["file",0],frameImages:["image",0],frameInputOne:["input",1],frameFileOne:["file",1],frameImageOne:["image",1]};Object.keys(r).reduce((i,s)=>(i[s]=T(e,n=>n.props({type:r[s][0],maxLength:r[s][1]})),i),t),t.frameInput=t.frameInputs,t.frameFile=t.frameFiles,t.frameImage=t.frameImages}ci(re),hi(re),di(re),mi(re),gi(re),pi(re);function Lt(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.forEach(a=>{o.push(a.validate())}),Promise.all(o).then(()=>{i(!0),r&&r(!0)}).catch(a=>{s(a),r&&r(a),e.vm.$emit("validate-fail",a,{api:t})})})},validateField(r,i){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).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)=>{t.validate().then(()=>{let o=t.formData();h.Function(r)&&k(()=>r(o,t)),h.Function(e.options.onSubmit)&&k(()=>e.options.onSubmit(o,t)),e.vm.emit("submit",o,t),s(o)}).catch((...o)=>{h.Function(i)&&k(()=>i(t,...o)),n(...o)})})}}}const Vt={name:"required",load(t,e,r){const i=$i(t.getValue());if(i.required===!1)t.clearProp(),r.clearValidateState([e.field]);else{const s=_({required:!0,validator(o,a,l){h.empty(a)?l(s.message):l()}},i),n=e.__fc__.refRule.__$title.value;if(!s.message)s.message=r.t("required",{title:n})||n+(r.getLocale()==="en"?" is required":"不能为空");else{const o=s.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);o&&(s.message=r.t(o[1],{title:n}))}t.getProp().validate=[s]}r.sync(e)},watch(...t){Vt.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 vi(t){t.componentAlias(si),ir.forEach(e=>{t.component(e.name,e)}),t.register(Vt),ni.forEach(e=>{t.parser(e)}),Object.keys(re).forEach(e=>{t.maker[e]=re[e]})}function bi(){return At({ui:"view-design",version:"2.7.3",manager:ui,install:vi,extendApi:yi,attrs:{normal:["col","wrap"],array:["className"],key:["title","info"]}})}const Oe=bi();typeof window!="undefined"&&(window.formCreate=Oe,window.Vue&&Oe.install(window.Vue));const _i=Oe.maker;P.default=Oe,P.maker=_i,Object.defineProperties(P,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
12
|
+
err: ${s}`);return}}return t}function ht(t,e){return JSON.parse(t,function(r,i){return h.Undef(i)||!i.indexOf?i:W(i,e)})}let lr=0;function be(){const t=370+ ++lr;return"F"+Math.random().toString(36).substr(3,3)+(+`${Date.now()}`).toString(36)+t.toString(36)+"c"}function ie(t,e,r){let i=t,s;return(e||"").split(".").forEach(n=>{s&&((!i[s]||typeof i[s]!="object")&&R(i,s,{}),i=i[s]),s=n}),R(i,s,r),i}function Ne(t,e){return{value:t,enumerable:!1,configurable:!1,writable:!!e}}function dt(t,e){return pt([t],e||!1)[0]}function pt(t,e){return me([],[...t],e||!1)}function Z(t,e){return Q(Array.isArray(e)?e:[e],t,{array:Ie,normal:Ae}),t}function mt(t){const e=h.Function(t.getRule)?t.getRule():t;return e.type||(e.type="input"),e}function ur(t,e){return t?(Object.keys(e||{}).forEach(r=>{e[r]&&(t[r]=Z(t[r]||{},e[r]))}),t):e}function gt(t,e){Object.defineProperties(t,Object.keys(e).reduce((r,i)=>(r[i]={get(){return e[i]()}},r),{}))}function Y(t){return t.__fc__||(t.__origin__?t.__origin__.__fc__:null)}function k(t,e){try{e=t()}catch(r){or(r)}return e}function Me(t,e){let r=null;return h.Function(t)?r=t():Array.isArray(t)?r=t.map(i=>Me(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]=Me(t[i],i)}),r}else return Me(t,e)}function _e(){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 Ce(t,e){return Object.setPrototypeOf(t,e),t}const yt=(t,e)=>typeof t=="string"?String(e):typeof t=="number"?Number(e):e,ae={"==":(t,e)=>JSON.stringify(t)===JSON.stringify(yt(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(yt(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 $t(t){let e=t.split("."),r=[],i="";return e.forEach((s,n)=>{n===0?i=s:i+="."+s,r.push(i)}),r.join(" && ")}function vt(){return{props:{},on:{},options:[],children:[],effect:{},hidden:!1,display:!0,value:void 0}}function T(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(vt(),{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 R(this._data,t,e),this},_clone(){const t=new this.constructor;return t._data=dt(this._data),t}});function bt(t){t.forEach(e=>{Ue.prototype[e]=function(r){return Z(this._data,{[e]:arguments.length<2?r:{[r]:arguments[1]}}),this}})}bt(ft());const _t=T("");function hr(t,e,r){let i=_t("",e);return i._data.type=t,i._data.title=r,i}function Ct(t,e,r,i){let s=_t("",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:Ct,template:Ct,factory:T}}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 wt(t){const e=t.responseText||t.response;if(!e)return e;try{return JSON.parse(e)}catch(r){return e}}function Ot(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),wt(e));t.onSuccess(wt(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||Ot)(H(_({},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 ye(t){return J(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){e(n).forEach(l=>{t.getCtxs(l).forEach(u=>{R(u.rule,o,a),t.$render.clearCache(u)})})}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 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}},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]=ye(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?ye(o.rule.value):t.options.appendValue!==!1&&S(t.appendData,n)?ye(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=S(n,a);l.forEach(f=>{f.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=>{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&&Y(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 f=t.getCtx(o);if(f)if(a){if(u=f.getPending("children",f.rule.children),!Array.isArray(u))return;l=f.rule.children.length-1}else l=f.root.indexOf(f.origin),u=f.root;else u=t.rules;u.splice(l+1,0,n)},prepend:(n,o,a)=>{let l=0,u;const f=t.getCtx(o);if(f)if(a){if(u=f.getPending("children",f.rule.children),!Array.isArray(u))return}else l=f.root.indexOf(f.origin),u=f.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=>{R(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)?Y(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=>{R(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=>{Z(a.rule,o)})},mergeRules(n){Object.keys(n).forEach(o=>{s.mergeRule(o,n[o])})},getRule:(n,o)=>{const a=t.getCtx(n);if(a)return o?a.origin:a.rule},getRenderRule:n=>{const o=t.getCtx(n);if(o)return o.prop},getRefRule:n=>{const o=t.getCtxs(n);if(o){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)),S(l.rule,"$"+o)&&R(l.rule,"$"+o,a),S(l.rule,"effect")||R(l.rule,"effect",{}),R(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=ye(a.defaultValue)})}),m.nextTick(()=>{m.nextTick(()=>{m.nextTick(()=>{s.clearValidateState(n)})})}),n==null&&(h.Function(t.options.onReset)&&k(()=>t.options.onReset(s)),t.vm.$emit("reset",s))},method(n,o){const a=s.el(n);if(!a||!a[o])throw new Error(ct("err",`${o} 方法不存在`));return(...l)=>a[o](...l)},exec(n,o,...a){return k(()=>s.method(n,o)(...a))},toJson(n){return Le(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?Y(n):t.getCtx(n),l=a?a.rule:o?n:s.getRule(n);if(!l)return[];const u=[];return(d=>{d&&d.forEach(g=>{typeof g=="object"&&(g.field&&u.push(g),u.push(...s.getChildrenRuleList(g)))})})(a?a.loadChildrenPending():l.children),u},getParentRule(n){return(typeof n=="object"?Y(n):t.getCtx(n)).parent.rule},getParentSubRule(n){const a=typeof n=="object"?Y(n):t.getCtx(n);if(a){const l=a.getParentGroup();if(l)return l.rule}},getChildrenFormData(n){return s.getChildrenRuleList(n).reduce((a,l)=>(a[l.field]=ye(l.value),a),{})},setChildrenFormData(n,o,a){const l=s.getChildrenRuleList(n);t.deferSyncValue(()=>{l.forEach(u=>{S(o,u.field)?u.value=o[u.field]:a&&(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||o(t.fc.loadData[n]),l.type==="fetch"?s.fetch(l).then(u=>{o(u)}).catch(a):o(l.data)})},renderRule(n,o,a){const u=typeof n=="object"?Y(n):t.getCtx(n);return u?t.$render.createRuleVnode(u,o,a):void 0},renderChildren(n,o,a){const u=typeof n=="object"?Y(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&&k(n)},emit(n,...o){t.vm.$emit(n,...o)},deferSyncValue(n,o){t.deferSyncValue(n,o)},bus:t.bus,fetch(n){return new Promise((o,a)=>{n=J(n),n=t.loadFetchVar(n),t.beforeFetch(n).then(()=>kt(n,t.fc.create.fetch,s).then(l=>{k(()=>n.onSuccess&&n.onSuccess(l)),o(l)}).catch(l=>{k(()=>n.onError&&n.onError(l)),a(l)}))})},watchFetch(n,o,a,l){return t.fc.watchLoadData((u,f)=>{let d=J(n);d=t.loadFetchVar(d,u),!(l&&l(d,f)===!1)&&t.beforeFetch(d).then(()=>kt(d,t.fc.create.fetch,s).then(g=>{k(()=>d.onSuccess&&d.onSuccess(g)),o&&o(g,f)}).catch(g=>{k(()=>d.onError&&d.onError(g)),a&&a(g)}))},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 G(t){const e=t.replace(/(-[a-z])/g,function(r){return r.replace("-","").toLocaleUpperCase()});return Ft(e)}function Ft(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-"+ge(e.rule.field)]||i.$scopedSlots["field-"+e.rule.field]),s||(s=i.$scopedSlots["type-"+ge(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=_e();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]=m.computed(()=>{const i=this.$handle.options.global;return Z({},[i["*"]||i.default||{},i[e.originType]||i[e.type]||i[e.type]||{}])})),e.prop=Z({},[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&&ie(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=>{ie(e.prop,i,r[i])})},parseSide(e,r){return h.Object(e)?Z({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&&k(()=>i.slotUpdate(u));let f=[];const d=e.loadChildrenPending();e.parser.renderChildren?f=e.parser.renderChildren(d,e):e.parser.loadChildren!==!1&&(f=this.renderChildren(d,e)),Object.keys(n.renderSlots||{}).forEach(v=>{f.push(this.renderRule({type:"template",slot:v},(()=>{if(h.Function(n.renderSlots[v]))return k(()=>n.renderSlots[v]());const w=this.parseSide(n.renderSlots[v],e);return this.renderRule(w)})()))});const g=this.getTypeSlot(e);let y;return g?(u.children=f,y=g(u)):y=a?e.parser.preview(je(f),e):e.parser.render(je(f),e),y=this.renderSides(y,e),!(!e.input&&h.Undef(n.native))&&n.native!==!0&&(this.fc.targetFormDriver("updateWrap",e),y=this.$manager.makeWrap(e,y)),e.none&&(Array.isArray(y)?y=y.map(v=>!v||!v.tag?v:this.none(v)):y=this.none(y)),o&&this.setCache(e,()=>this.stable(y),r),y},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,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=[{ref:r,key:s.key||`${i}fc`,slot:void 0,on:{"hook:mounted":()=>{this.onMounted(e)},"fc.updateValue":o=>{this.$handle.onUpdateValue(e,o)},"fc.el":o=>{e.exportEl=o,o&&((o.$el||o).__rule__=e.rule)}}}];if(e.input){const o=this.tmpInput;this.vm.$props.disabled===!0&&(e.prop.props.disabled=!0),e.prop.model={value:this.$handle.getFormData(e),callback:a=>{o&&o(e.field,a,e.rule),this.onInput(e,a)},expression:`formData.${e.id}`},e.prop.modelEmit&&n.push({on:{[e.prop.modelEmit]:()=>this.onEmitInput(e)}})}return Q(n,e.prop),e.prop},onMounted(e){e.el=this.vm.$refs[e.ref],e.el&&((e.el.$el||e.el).__rule__=e.rule),e.parser.mounted(e),this.$handle.effect(e,"mounted"),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=_e();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&&m.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(Ft(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=_e();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=G(e.type);const a=this.vNode.aliasMap[s];a&&(s=G(a))}if(!s)return;const n=_e();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 qe(t){C(this,{$handle:t,fc:t.fc,vm:t.vm,$manager:t.$manager,vNode:new t.fc.CreateNode(t.vm),force:!1,tmpInput:null,id:$r++}),gt(this,{options(){return t.options},sort(){return t.sort}}),this.initCache(),this.initRender()}gr(qe),yr(qe);function vr(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(f=>{if(!f)return;let d,g=n||o||a;if(h.Object(f)&&(d=f.inject,f=f.name,g=f.prefix||g),g){r||(g=`native-${g}`);const y=ge(`${g}-${f}`),v=(...w)=>{this.vm.$emit(y,...w),this.vm.$emit("emit-event",y,...w),this.bus.$emit(y,...w)};if(v.__emit=!0,!d&&l===!1)i[f]=v;else{let w=d||l||this.options.injectEvent;i[f]=h.Undef(w)?v:this.inject(s,v,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);let o;if(n.forEach(a=>{const l=a.split("||"),u=l[0].trim();if(u){const f=(l[1]||"").trim();let d,g=!1;if(i&&u.indexOf("$form.")===0){const y=u.split(".");y.shift(),S(i.value,y[0])&&(g=!0,d=r?r({id:"$form."+y[0]+"_"+i.rule.__fc__.id,getValue:()=>L(i.value,y)}):L(i.value,y))}g||(d=r?r(u,f):this.fc.getLoadData(u,f)),o=d,e=e.replaceAll(`{{${a}}}`,d==null?"":d)}}),n.length===1&&s===`{{${n[0]}}}`)return o}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 Rt=["hook:updated","hook:mounted"];function br(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(Rt,e),this.bus.$emit("page-end")):(this.first+=this.limit,this.pageEnd=this.rules.length<=this.first,this.loadRule(),this.refresh())};this.vm.$on(Rt,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__:Ne(m.markRaw(t),!0)}),t.rule!==t.origin&&Object.defineProperties(t.rule,{__fc__:Ne(m.markRaw(t),!0)})}function St(t,e,r){const i=be(),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?J(r):void 0,field:e.field||void 0}),this.updateKey(),wr(this),this.update(t,!0)}C(St.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=k(()=>r({rule:this.rule,api:this.$api,update:u=>{const f=u||i,d=this.getPending(e,i);this.setPending(e,r,f),o&&o(f,d)},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 f=u||i;this.setPending(e,r,f),s&&s(f),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:m.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=be(),t&&this.parent&&this.parent.updateKey(t)},updateType(){this.originType=this.rule.type,this.type=G(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=Z({},[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)},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 Or(t){C(t.prototype,{nextRefresh(e){const r=this.loadedId;m.nextTick(()=>{r===this.loadedId&&(e?e():this.refresh())})},parseRule(e){const r=mt(e);return Object.defineProperties(r,{__origin__:Ne(e,!0)}),kr(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=mt(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 f,d=!1,g=!!o.__fc__,y=l.value;if(g){if(f=o.__fc__,y=f.defaultValue,f.deleted){if(Et(f))return;f.update(this)}else if(!f.check(this)){if(Et(f))return;e[a]=o=o._clone?o._clone():ht(Le(o)),f=null,d=!0}}if(f)f.originType!==f.rule.type&&f.updateType(),this.bindParser(f),this.appendValue(f.rule),f.parent&&f.parent!==r&&this.rmSubRuleData(f);else{const j=this.parseRule(o);f=new St(this,j,y),this.bindParser(f)}[!1,!0].forEach(j=>this.parseEmit(f,j)),this.syncProp(f),f.parent=r||null,f.root=e,this.setCtx(f),!d&&!g&&(this.effect(f,"load"),this.targetHook(f,"load")),this.effect(f,"created");const v=f.loadChildrenPending();if(f.parser.loadChildren===!1||s(v,f),!r){const j=i(a);j>-1||!a?this.sort.splice(j+1,0,f.id):this.sort.push(f.id)}const w=f.rule;return f.updated||(f.updated=!0,h.Function(w.update)&&this.bus.$once("load-end",()=>{this.refreshUpdate(f,w.value,"init")}),this.effect(f,"loaded")),this.refreshControl(f)&&(this.cycleLoad=!0),f}).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(d){return(ae[l.condition||"=="]||ae["=="])(d,l.value)};if(!h.trueArray(l.rule))continue;const f=H(_({},l),{valid:k(()=>u(e.rule.value,s)),ctrl:Rr(e,l.rule),isHidden:h.String(l.rule[0])});f.valid&&f.ctrl||!f.valid&&!f.ctrl&&!f.isHidden||i.push(f)}if(!i.length)return!1;const n=[];let o=!1;return this.deferSyncValue(()=>{i.reverse().forEach(({isHidden:a,valid:l,rule:u,prepend:f,append:d,child:g,ctrl:y,method:v})=>{if(a){l?e.ctrlRule.push({__ctrl:!0,children:u,valid:l}):y&&e.ctrlRule.splice(e.ctrlRule.indexOf(y)>>>0,1),n[l?"push":"unshift"](()=>{v==="disabled"||v==="enabled"?this.api.disabled(!l,u):v==="display"||v==="show"?this.api.display(l,u):v==="required"?(u.forEach(w=>{this.api.setEffect(w,"required",l)}),l||this.api.clearValidateState(u)):v==="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",()=>{f?s.prepend(w,f,g):d||g?s.append(w,d||e.id,g):e.root.splice(e.root.indexOf(e.origin)+1,0,w)})}else{e.ctrlRule.splice(e.ctrlRule.indexOf(y),1);const w=Y(y);w&&w.rm()}})}),n.length&&(this.loading?n.length&&this.bus.$once("load-end",()=>{n.forEach(a=>a())}):n.length&&m.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 kr(t){const e=vt();return Object.keys(e).forEach(r=>{S(t,r)||R(t,r,e[r])}),t}function Fr(t){const e=t.rule.control||[];return h.Object(e)?[e]:e}function Rr(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 Sr(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&&m.nextTick(()=>{m.nextTick(()=>{m.nextTick(()=>{this.api.clearValidateState(e.id)})})}))},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&&S(s,o)?n[o]=r[o]:S(this.api.form,o)?this.api.form[o]=r[o]:this.api.top!==this.api&&S(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]||R(this.subRuleData,i.id,{}),R(this.subRuleData[i.id],e.field,e.rule.value)),R(this.formData,e.id,r)},rmSubRuleData(e){const r=e.getParentGroup();r&&this.subRuleData[r.id]&&te(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]=m.toRef(this.appendData,n)),s),e),r.reduce((s,n)=>{const o=(this.fieldCtx[n]||[]).filter(a=>!this.isIgnore(a.rule))[0]||this.fieldCtx[n][0];return this.isIgnore(o.rule)&&i.push(n),s[n]=m.toRef(o.rule,"value"),s},e),this.form=m.reactive(e),this.ignoreFields=i,this.syncValue()},isIgnore(e){return e.ignore===!0||e.ignore==="hidden"&&e.hidden||this.options.ignoreHiddenFields&&e.hidden},appendValue(e){(!e.field||!S(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),k(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),Dt)!==JSON.stringify(r,Dt)},isQuote(e,r){return(h.Object(r)||Array.isArray(r))&&r===e.rule.value},refreshUpdate(e,r,i,s){if(h.Function(e.rule.update)){const n=k(()=>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 Dt(t,e){return typeof e=="function"?""+e:e}const we={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){}},Er=["field","value","vm","template","name","config","control","inject","sync","payload","optionsTo","update","slotUpdate","computed","component","cache"];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[G(e.type)]||s[e.trueType];if(n)return n}return r[e.originType]||r[G(e.type)]||r[e.trueType]||we},bindParser(e){e.setParser(this.getParser(e))},getType(e){const r=this.fc.CreateNode.aliasMap,i=r[e]||r[G(e)]||e;return G(i)},noWatch(e){this.noWatchFn||(this.noWatchFn=e),k(e),this.noWatchFn===e&&(this.noWatchFn=null)},watchCtx(e){if(ft().filter(i=>i[0]!=="_"&&i[0]!=="$"&&Er.indexOf(i)===-1).forEach(i=>{const s=m.toRef(e.rule,i),n=i==="children";e.refRule[i]=s,e.watch.push(m.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,m.nextTick(()=>{this.targetHook(e,"watch",{key:i,oldValue:a,newValue:l})}),i==="hidden"&&!!l!=!!a&&(this.$render.clearCacheAll(),m.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=m.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=m.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=m.computed(()=>q(e.rule.validate).map(i=>{var n,o;const s=_({},i);if(s.message){const a=s.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);a&&(s.message=this.api.t(a[1],{title:(o=(n=e.refRule)==null?void 0:n.__$title)==null?void 0:o.value}))}if(h.Function(s.validator)){const a=e;return s.validator=function(...l){return i.validator.call({that:this,id:a.id,field:a.field,rule:a.rule,api:a.$handle.api},...l)},s}return s})),e.input){const i=m.toRef(e.rule,"value");e.watch.push(m.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=>{let n;const o=m.computed(()=>{const l=i[s];if(!l)return;const u=this.compute(e,l);return l.linkage&&u===void 0?n:u}),a=l=>{s==="value"?this.onInput(e,l):s[0]==="$"?this.api.setEffect(e.id,s,l):ie(e.rule,s,l)};(s==="value"?[void 0,null,""].indexOf(e.rule.value)>-1:o.value!==L(e.rule,s))&&a(o.value),e.watch.push(m.watch(o,l=>{n=l,setTimeout(()=>{a(l)})}))}))}),this.watchEffect(e)},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 f=0;f<a.group.length;f++){const d=a.group[f];let g,y=null;if(d.variable)y=JSON.stringify(this.fc.getLoadData(d.variable)||"");else if(d.field)y=$t(d.field||"");else return!0;let v=d.compare;if(v&&(v=$t(v||"")),d.mode?g=n(d):ae[d.condition]?h.Function(d.handler)?g=k(()=>d.handler(this.api,e.rule)):g=k(()=>new Function("$condition","$val","$form","$scope","$group","$rule",`with($form){with($scope){with(this){with($group){ return $condition['${d.condition}'](${y}, ${v||"$val"}); }}}}`).call(this.api.form,ae,d.value,this.api.top.form,this.api.top===this.api.scope?{}:this.api.scope.form,s?this.subRuleData[s.id]||{}:{},e.rule)):g=!1,l&&g)return!0;l||(u=u&&g)}return l?!1:u};let o=n(r);return o=r.invert===!0?!o:o,r.linkage?o?k(()=>this.computeValue(r.linkage,e,s),void 0):void 0: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 k(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 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;te(this.ctxs,r),te(this.formData,r),te(this.subForm,r),te(this.vm.ctxInject,r);const o=e.getParentGroup();o&&this.subRuleData[o.id]&&te(this.subRuleData[o.id],i),e.group&&te(this.subRuleData,r),s&&this.rmIdCtx(e,i,"field"),n&&this.rmIdCtx(e,n,"name"),s&&!S(this.fieldCtx,i)&&te(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.__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 jr(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[G("on-"+e)];if(i){const s=W(i);h.Function(s)&&k(()=>s(...r))}this.bus.$emit(e,...r)},targetHook(e,r,i){var n,o;let s=(o=(n=e.prop)==null?void 0:n.hook)==null?void 0:o[r];s&&(s=Array.isArray(s)?s:[s],s.forEach(a=>{k(()=>a(H(_({},i||{}),{self:e.rule,rule:e.rule,$f:this.api,api:this.api,option:this.vm.$props.option})))}))}})}function Ir(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),this.providers[r]=i})},onEffect(e){const r=[];(e._c||["*"]).forEach(i=>{const s=i==="*"?"*":this.getType(i);r.indexOf(s)>-1||(r.push(s),this.bus.$on(`p:${e.name}:${s}:${e.input?1:0}`,(n,o)=>{e[n]&&e[n](...o)}))}),e._used=r},watchEffect(e){let r={required:()=>{var i,s;return(S(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(m.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(S(e,"$"+r))return e["$"+r];if(S(e,"effect")&&S(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,f)=>(f[0]==="$"&&(u[f.substr(1)]=r[f]),u),_({},r.effect||{}));Object.keys(l).forEach(u=>{const f=this.providers[u];if(!f||f.input&&!i)return;let d;if(!f._c)d="*";else if(f._used.indexOf(s)>-1)d=s;else return;const g=_({value:l[u],getValue:()=>this.getEffect(r,u)},a||{});e&&(g.getProp=()=>e.effectData(u),g.clearProp=()=>e.clearEffectData(u),g.mergeProp=y=>Z(g.getProp(),[y]),g.id=e.id),this.bus.$emit(`p:${u}:${d}:${f.input?1:0}`,o,[g,r,this.api])})}})}function Ar(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=Ar(e.filter(i=>i!=="*"));return r.length?r:!1}else return h.String(e)?[e]:!1}function z(t){gt(this,{options(){return t.options.value||{}},bus(){return t.bus},preview(){return t.vm.$options.propsData.preview!=null?t.vm.$options.propsData.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:m.reactive({}),subRuleData:m.reactive({}),subForm:{},form:m.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 qe(this),this.api=t.extendApiFn.reduce((e,r)=>{const i=k(()=>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.$options.propsData.value||{}),this.appendData)},isBreakWatch(){return this.loading||this.noWatchFn||this.reloading},globalBeforeFetch(t){return new Promise((e,r)=>{const i=this.options.beforeFetch&&k(()=>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&&k(()=>t.beforeFetch(t,{api:this.api}));i&&h.Function(i.then)?i.then(e).catch(r):i===!1?r():e()}).then(()=>this.globalBeforeFetch(t))}}),vr(z),br(z),Cr(z),Or(z),Sr(z),Dr(z),jr(z),Ir(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 Br(){const t={};function e(r){r&&this.setVm(r)}return C(e.prototype,{setVm(r){this.vm=r,this.h=this.$h=r.$createElement},make(r,i,s){var n,o;return(m.isReservedTag?m.isReservedTag(r):(n=m==null?void 0:m.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 o;let n=this.$h(r,Tr(i),s||[]);if((o=n==null?void 0:n.componentOptions)!=null&&o.propsData&&(i!=null&&i.props)){const a=Object.keys(n.componentOptions.propsData);n.data.attrs||(n.data.attrs={}),Object.keys(i.props).forEach(l=>{n.data.attrs[l]==null&&a.indexOf(l)===-1&&["string","number","boolean"].indexOf(typeof i.props[l])>-1&&(n.data.attrs[l]=i.props[l])})}return n.context=this.vm,n},aliasMap:t}),C(e,{aliasMap:t,alias(r,i){t[r]=i},use(r){Object.keys(r).forEach(i=>{const s=ge(i),n=ar(i).toLocaleLowerCase(),o=r[i];[i,s,n].forEach(a=>{e.alias(i,o),e.prototype[a]=function(l,u){return this.make(o,l,u)}})})}}),e}function Lr(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=be()},init(){},update(){},beforeRender(){},form(){return this.vm.$refs[this.ref]},getSlot(t){const e=r=>{if(r){let i=r.$scopedSlots[t];return i||e(r.$pfc)}};return e(this.vm)},mergeOptions(t,e){return 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{}},render(t){}});const Vr=function(t){const e={name:"loadData",_fn:[],mounted(r,i,s){this.deleted(r);let n=q(r.getValue());const o=[];n.forEach(a=>{if(a&&(a.attr||a.template)){let l=d=>{let g;a.template?g=t.$handle.loadStrVar(a.template,d):a.handler&&h.Function(a.handler)?g=a.handler(d,i,s):g=d(a.attr,a.default),a.copy!==!1&&(g=J(g));const y=a.modify?i:r.getProp();a.to==="child"?y.children?R(y.children,0,g):R(y,"children",[g]):ie(y,a.to||"options",g),s.sync(i)},u=d=>l(d);const f=t.watchLoadData(u);l=re(l,a.wait||300),a.watch!==!1?o.push(f):f()}}),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.mounted,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 f=y=>{let v=t.t(u?l.attr:l,u?l.params:null,y);const w=u&&l.modify?i:r.getProp();a==="child"?w.children?R(w.children,0,v):R(w,"children",[v]):ie(w,a,v),s.sync(i)},d=y=>f(y);const g=t.watchLoadData(d);f=re(f,l.wait||300),l.watch!==!1?o.push(g):g()}}),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},It={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;delete i.method,t.getProp().validate=[H(_({},i),{validator(...n){const o=Y(e);if(o)return r.exec(o.id,h.String(s)?s:"formCreateValidate",...n,{attr:t,rule:e,api:r})}})]}},watch(...t){It.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=d=>{d===void 0?s.clearProp():ie(s.getProp(),a.to||"options",d),o.sync(n)};if(!a||!a.action&&!a.key){l(void 0);return}if(a=J(a),a.to||(a.to="options"),a.key){const d=t.$handle.options.globalData[a.key];if(!d){l(void 0);return}if(d.type==="static"){l(d.data);return}else a=_(_({},a),d)}const u=a.onError,f=()=>{if(!s.getValue())return s.clearProp(),o.sync(n),!0};i._fn[s.id]=t.watchLoadData(re((d,g)=>{if(g&&a.watch===!1)return i._fn[s.id]();const y=t.$handle.loadFetchVar(J(a),d,n),v=H(_({headers:{}},y),{onSuccess(w,j){if(f())return;let se=M=>j?M:S(M,"data")?M.data:M;const B=W(y.parse);h.Function(B)?se=B:B&&h.String(B)&&(se=M=>L(M,B)),l(se(w,n,o)),o.sync(n)},onError(w){l(void 0),!f()&&(u||(j=>Pe(j.message||"fetch fail "+y.action)))(w,n,o)}});t.$handle.beforeFetch(v,{rule:n,api:o}).then(()=>{if(h.Function(y.action)){y.action(n,o).then(w=>{v.onSuccess(w,!0)}).catch(w=>{v.onError(w)});return}k(()=>t.create.fetch(v,{inject:s,rule:n,api:o}))})},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:Vr,t:Nr,componentValidate:It};function Ur(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 qr={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 Gr(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 Hr(t){const e=localStorage.getItem(t);if(e)try{return JSON.parse(e)}catch(r){return e}return null}function Jr(t){const e=sessionStorage.getItem(t);if(e)try{return JSON.parse(e)}catch(r){return e}return null}function He(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 He(Gr,t)}function zr(t){return He(Hr,t)}function Kr(t){return He(Jr,t)}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 Qr(t){return!t||!t.el?window.document.body:h.Element(t.el)?t.el:document.querySelector(t.el)}function Zr(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||[];ut.push(...e),Ie.push(...r),Ae.push(...i),bt([...e,...r,...i])}let xr=1;const N={},Oe=Symbol("defValue");function At(t){const e={[Ge.name]:Ge},r={},i={},s={},n={},o=[],a=[],l=[t.extendApi],u=_({},Mr),f=dr();let d={global:{}};const g=t.isMobile===!0,y=m.reactive({$mobile:g}),v=Br(),w={},j={};Yr(t.attrs||{});function se(c){const p=N[c];if(Array.isArray(p))return p.map($=>$.api());if(p)return p.api()}function B(c){o.push(c)}function M(){const c=Je(...arguments);c.id&&c.prop&&(i[c.id]=c.prop)}function ce(){const c=Je(...arguments);c.id&&c.prop&&(u[c.id]=h.Function(c.prop)?c.prop:H(_({},c.prop),{name:c.id}))}function Qe(c){v.use(c)}function he(){const c=Je(...arguments);if(!c.id||!c.prop)return we;const p=G(c.id),$=c.prop,b=$.merge===!0?r[p]:void 0;r[p]=Ce($,b||we),f[p]=T(p),$.maker&&C(f,$.maker)}function F(c,p){let $;if(h.String(c)){if($=c,p===void 0)return["form-create","formcreate"].indexOf($)>-1?E():e[$]}else $=G(c.name),p=c;if(!$||!p)return;const b=G($);e[$]=p,e[b]=p,delete v.aliasMap[$],delete v.aliasMap[b],delete r[$],delete r[b],p.formCreateParser&&he($,p.formCreateParser)}function E(){return nr(Ye,e,i)}function U(){return Ge}function de(c,p){return h.Function(c.install)?c.install(K,p):h.Function(c)&&c(K,p),this}function K(c,p,$){let b=Zr(c,p||{});const O=b.$refs.fc.formCreate;return O.$parent=$,Qr(O.options).appendChild(b.$el),O.api()}Ce(K,j);function Ci(c){let p=_({},t);return c?p.inherit={components:e,parsers:r,directives:i,modelFields:s,providers:u,useApps:o,maker:f,formulas:w,loadData:y}:delete p.inherit,At(p)}function wi(c,p){s[c]=p}function Oi(c,p){w[c]=p}function ki(c,p){const $=n[c]||{},b=$.parsers||{};p.parsers&&Object.keys(p.parsers).forEach(O=>{b[O]=Ce(p.parsers[O],we)}),p.name=c,n[c]=H(_(_({},$),p),{parsers:b})}function Re(c){c&&Object.keys(N).forEach(p=>{(Array.isArray(N[p])?N[p]:[N[p]]).forEach(b=>{b.bus.$emit("$loadData."+c)})})}function Ze(c,p){ie(y,c,p),Re(c)}function Se(c,p){const $=(...b)=>k(()=>p(...b));$._driver=!0,Ze(c,$)}function Nt(c,p){const $=(c||"").split(".");c=$.shift();const b=$.join(".");if(S(y,c)||R(y,c,Oe),y[c]!==Oe){let O=y[c];return O&&O._driver?O=O(b):$.length&&(O=L(O,$)),O==null||O===""?p:O}else return p}function Fi(c){l.push(c)}function Ri(c){delete y[c],Re(c)}function Si(c,p){a.push({name:c,callback:p})}function Ye(c){C(this,{id:xr++,create:K,vm:c,manager:Lr(t.manager),parsers:r,providers:u,modelFields:s,formulas:w,isMobile:g,rules:c.$options.propsData.rule,name:c.$options.propsData.name||be(),inFor:c.$options.propsData.inFor,prop:{components:e,directives:i},get:null,drivers:n,renderDriver:null,refreshData:Re,loadData:y,CreateNode:v,bus:new Ur,unwatch:[],options:m.ref({}),extendApiFn:l,fetchCache:new WeakMap,tmpData:m.reactive({})}),a.forEach(p=>{this.bus.$on(p.name,p.callback)}),m.nextTick(()=>{m.watch(this.options,()=>{this.$handle.$manager.updateOptions(this.options.value),this.api().refresh()},{deep:!0})}),C(c.$options.components,e),C(c.$options.directives,i),this.$handle=new z(this),this.name&&(this.inFor?(N[this.name]||(N[this.name]=[]),N[this.name].push(this)):N[this.name]=this)}Ye.isMobile=g,C(Ye.prototype,{init(){this.isSub()&&this.unwatch.push(m.watch(()=>this.vm.parent.fc.options.value,()=>{this.initOptions(),this.$handle.api.refresh()},{deep:!0})),this.vm.$options.propsData.driver&&(this.renderDriver=typeof this.vm.$options.propsData.driver=="object"?this.vm.$options.propsData.driver:this.drivers[this.vm.$options.propsData.driver]),!this.renderDriver&&this.vm.parent&&(this.renderDriver=this.vm.parent.renderDriver),this.renderDriver||(this.renderDriver=this.drivers.default),this.initOptions(),this.$handle.init()},targetFormDriver(c,...p){if(this.renderDriver&&this.renderDriver[c])return k(()=>this.renderDriver[c](...p))},t(c,p,$){let b=$?$("$t."+c):this.globalLanguageDriver(c);return b==null&&(b=""),b&&p&&Object.keys(p).forEach(O=>{const I=new RegExp(`{${O}}`,"g");b=b.replace(I,p[O])}),b},globalDataDriver(c){let p=c.split(".");const $=p.shift(),b=this.options.value.globalData&&this.options.value.globalData[$];if(b){if(b.type==="static")return L(b.data,p);{let O;const I=this.fetchCache.get(b);if(I){if(I.status&&(O=L(I.data,p)),!I.loading)return O;I.loading=!1,this.fetchCache.set(b,I)}else this.fetchCache.set(b,{status:!1});const D=re(()=>{ue();const X=this.fetchCache.get(b);this.options.value.globalData&&Object.values(this.options.value.globalData).indexOf(b)!==-1?(X&&(X.loading=!0,this.fetchCache.set(b,X)),this.bus.$emit("$loadData.$globalData."+$)):this.fetchCache.delete(b)},b.wait||600),le=X=>{this.fetchCache.set(b,{status:!0,data:X}),this.bus.$emit("$loadData.$globalData."+$)},ee=(X,fe)=>{if(fe&&b.watch===!1)return ue();if(fe){D();return}const pe=this.$handle.loadFetchVar(je(b),X);this.$handle.api.fetch(pe).then(oe=>{le(oe)}).catch(oe=>{le(null)})},ue=this.watchLoadData(ee);return this.unwatch.push(ue),O}}},getLocale(){let c=this.vm.top.$props.locale;return c&&typeof c=="object"?c.name:typeof c=="string"?c:"zh-cn"},globalLanguageDriver(c){let p=this.vm.top.$props.locale,$;if(p&&typeof p=="object"&&($=L(p,c)),$==null){const b=this.options.value.language||{},O=this.getLocale();$=L(b[O],c)}return $},globalVarDriver(c){const $=c.split(".").shift(),b=this.options.value.globalVariable&&this.options.value.globalVariable[$];if(b){const O=h.Function(b)?b:W(b.handle);if(O){let I;const D=this.watchLoadData((le,ee)=>{ee?(this.bus.$emit("$loadData.$var."+$),D()):I=O(le,this.$handle.api)});return this.unwatch.push(D),I}}},setData(c,p,$){$?Ze(c,p):(ie(this.vm.top.fc.tmpData,c,p),this.bus.$emit("$loadData."+c))},getLoadData(c,p){let $=null;if(c!=null){let b=c.split(".");const O=b.shift();if(O==="$topForm")$=this.$handle.api.top.formData(!0);else if(O==="$scopeForm")$=this.$handle.api.scope.formData(!0);else if(O==="$form")$=this.$handle.api.formData(!0);else if(O==="$options")$=this.options.value;else if(O==="$globalData")$=this.globalDataDriver(b.join(".")),b=[];else if(O==="$var")$=this.globalVarDriver(b.join(".")),b=[];else if(O==="$locale")$=this.getLocale(),b=[];else if(O==="$t")$=this.globalLanguageDriver(b.join(".")),b=[];else{if(O==="$preview")return this.$handle.preview;{const I=this.vm.top.fc.tmpData;S(I,O)||R(I,O,Oe),$=I[O]!==Oe?L(I,c):Nt(c),b=[]}}$&&b.length&&($=L($,b))}return $==null||$===""?p:$},watchLoadData(c,p){let $={};const b=D=>{this.get||(this.get=O),k(()=>{c(O,D)}),this.get===O&&(this.get=void 0)},O=(D,le)=>{let ee;if(typeof D=="object"&&(ee=D.getValue,D=D.id),$[D])return $[D].val;const ue=m.computed(()=>ee?ee():this.getLoadData(D,le)),X=D.split("."),fe=X.shift(),pe=X.shift()||"",oe=re(()=>{const xe=ee?ee():this.getLoadData(D,le);if($[D])JSON.stringify(xe)!==JSON.stringify($[D].val)&&($[D].val=xe,b(!0));else return},p||0),Di=m.watch(ue,xe=>{oe()});return this.bus.$on("$loadData."+fe,oe),pe&&this.bus.$on("$loadData."+fe+"."+pe,oe),$[D]={fn:()=>{this.bus.$off("$loadData."+fe,oe),pe&&this.bus.$off("$loadData."+fe+"."+pe,oe),Di()},val:ue.value},ue.value};b(!1);const I=()=>{Object.keys($).forEach(D=>$[D].fn()),$={}};return this.unwatch.push(I),I},isSub(){return this.vm.parent&&this.vm.extendOption},initOptions(){this.options.value={};let c=_({formData:{},submitBtn:{},resetBtn:{},globalEvent:{},globalData:{}},J(d));this.isSub()&&(c=this.mergeOptions(c,this.vm.parent.fc.options.value||{},!0)),c=this.mergeOptions(c,this.vm.$options.propsData.option||{}),this.updateOptions(c)},mergeOptions(c,p,$){return p=_({},p||{}),$&&["page","onSubmit","onReset","onCreated","onChange","onMounted","mounted","onReload","reload","formData","el","globalClass","style"].forEach(b=>{delete p[b]}),p.global&&(c.global=ur(c.global,p.global),delete p.global),this.$handle.$manager.mergeOptions([p],c),c},updateOptions(c){this.options.value=this.mergeOptions(this.options.value,c),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 c=N[this.name].indexOf(this);N[this.name].splice(c,1)}else delete N[this.name];a.forEach(c=>{this.bus.$off(c.name,c.callback)}),this.tmpData={},this.unwatch.forEach(c=>c()),this.unwatch=[],this.$handle.reloadRule([])},updated(){this.$handle.bindNextTick(()=>this.bus.$emit("next-tick",this.$handle.api))}});function Mt(c){C(c,{version:t.version,ui:t.ui,isMobile:g,extendApi:Fi,getData:Nt,setDataDriver:Se,setData:Ze,removeData:Ri,refreshData:Re,maker:f,component:F,directive:M,setModelField:wi,setFormula:Oi,setDriver:ki,register:ce,$vnode:U,parser:he,use:de,factory:Ci,componentAlias:Qe,copyRule:dt,copyRules:pt,mergeRule:Z,fetch:Ot,$form:E,parseFn:W,parseJson:ht,toJson:Le,useApp:B,getApi:se,on:Si})}function Ei(c){C(c,{create:K,install(p,$){if(d=_(_({},d),$||{}),p._installedFormCreate===!0)return;p._installedFormCreate=!0;const b=function(I,D={}){return K(I,D,this)};Mt(b),p.prototype.$formCreate=b;const O=E();p.component(O.name,O),p.component("FcFragment",U()),o.forEach(I=>{k(()=>I(c,p))})}})}if(Mt(j),Ei(j),Se("$cookie",Wr),Se("$localStorage",zr),Se("$sessionStorage",Kr),v.use({fragment:"fcFragment"}),t.install&&K.use(t),he(qr),t.inherit){const c=t.inherit;c.components&&C(e,c.components),c.parsers&&C(r,c.parsers),c.directives&&C(i,c.directives),c.modelFields&&C(s,c.modelFields),c.providers&&C(u,c.providers),c.useApps&&C(o,c.useApps),c.maker&&C(f,c.maker),c.loadData&&C(y,c.loadData),c.formulas&&C(w,c.formulas)}const Ee=E();return Ce(Ee,j),Object.defineProperties(Ee,{fetch:{get(){return j.fetch},set(c){j.fetch=c}}}),Ee.util=j,Ee}function We(t){if(h.Date(t))return t;{let e=new Date(t);return e.toString()==="Invalid Date"?t:e}}const Pt="datePicker",ei={name:Pt,maker:function(){return["date","dateRange","datetime","datetimeRange","year","month"].reduce((t,e)=>(t[e]=T(Pt,{type:e.toLowerCase()}),t),{})}(),mergeProp(t){let e=t.prop.props;e.startDate&&(e.startDate=e.startDate&&We(e.startDate))},isRange(t){return t.type.includes("range")||t.multiple},_toValue(t,e){const r=e.el.formatDate(t||""),{separator:i}=e.el,s=this.isRange(e.el);return r?s?r.split(i):r:s?e.el.multiple?[]:["",""]:r},toValue(t,e){const r=e.el;return r?(this.el=r,this._toValue(t,e)):t},toFormValue(t,e){if(e.el){const r=e.el.parseDate(t);return this.isRange(e.el)?r:r[0]}else{let r=Array.isArray(t),i=e.prop.props,s,n=i.type||"date";return["daterange","datetimerange"].indexOf(n)!==-1?r?s=t.map(o=>o?We(o):""):s=["",""]:n==="date"&&i.multiple===!0?s=toString(t):(s=r?t[0]||"":t,s=s?We(s):""),s}},mounted(t){t.rule.value=this.toValue(t.$handle.getFormData(t),t)}},ze="hidden",ti={name:ze,maker:{[ze]:(t,e)=>T(ze)("",t,e)},render(){return[]}},Ke="input",ri={name:Ke,maker:function(){const t=["password","url","email","text","textarea"].reduce((e,r)=>(e[r]=T(Ke,{type:r}),e),{});return t.idate=T(Ke,{type:"date"}),t}(),mergeProp(t){let{props:e}=t.prop;e.autosize&&e.autosize.minRows&&(e.rows=e.autosize.minRows||2)}},Tt="slider",ii={name:Tt,maker:{sliderRange:T(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}},ni=[ei,ti,ri,ii,{name:"switch",mergeProp(t){const e=t.prop.props.slot||{},r=t.prop.scopedSlots||{};e.open&&(r.open=()=>e.open),e.close&&(r.close=()=>e.close),t.prop.scopedSlots=r}},{name:"FcRow",render(t,e){return e.vNode.col({props:{span:24}},[e.vNode.row(e.prop,t)])}}],si={button:"iButton",icon:"Icon",slider:"Slider",rate:"Rate",upload:"fcUpload",cascader:"Cascader",colorPicker:"ColorPicker",timePicker:"TimePicker",datePicker:"DatePicker",switch:"iSwitch",select:"fcSelect",checkbox:"fcCheckbox",radio:"fcRadio",inputNumber:"InputNumber",input:"iInput",formItem:"FormItem",form:"iForm",frame:"fcFrame",col:"iCol",row:"row",tree:"fcTree",autoComplete:"AutoComplete",group:"fcGroup",array:"fcGroup",subForm:"fcSubForm",object:"fcSubForm"},ke={resetBtnType:"default",resetBtnIcon:"md-refresh",infoIcon:"ios-information-circle-outline"};function oi(){return{type:"poptip",trigger:"hover",placement:"top-start",wordWrap:!0,icon:ke.infoIcon}}function ai(){return{form:{inline:!1,labelPosition:"right",labelWidth:125,showMessage:!0,autocomplete:"off",size:void 0},row:{gutter:0},submitBtn:{type:"primary",disabled:!1,innerText:"",loading:!1,show:!0,click:void 0},resetBtn:{type:ke.resetBtnType,disabled:!1,icon:ke.resetBtnIcon,innerText:"",loading:!1,show:!1,click:void 0}}}function Bt(t,e){S(t,e)&&h.String(t[e])&&(t[e]={[e]:t[e],show:!0})}function x(t){return t===!1}function li(t,e){S(t,e)&&!h.Object(t[e])&&(t[e]={show:!!t[e]})}function Xe(t){const e=_({},t);return delete e.children,e}const ui={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.validateMessage="",e.validateState="")},tidyOptions(t){return["submitBtn","resetBtn","row","info","wrap","col","title"].forEach(e=>{li(t,e)}),t},tidyRule({prop:t}){return Bt(t,"title"),Bt(t,"info"),t},mergeProp(t){const e={info:oi(),title:{},col:{span:24},wrap:{}};["info","wrap","col","title"].forEach(r=>{t.prop[r]=Q([this.options[r]||{},t.prop[r]||{}],e[r])}),this.setSize(t.prop.props)},setSize(t){!t.size&&this.options.form.size&&(t.size=this.options.form.size)},getDefaultOptions(){return ai()},update(){const t=this.options.form;this.rule={props:_({},t),nativeOn:{submit:e=>{e.preventDefault()}},class:[t.className,t.class,"form-create",this.$handle.preview?"is-preview":""],style:t.style,type:"form"}},beforeRender(){const{key:t,ref:e,$handle:r}=this;C(this.rule,{key:t,ref:e}),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,x(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;delete r.wrap.title;const u=x(r.wrap.show)?e:this.$r(Q([r.wrap,{props:H(_({labelWidth:o},Xe(r.wrap||{})),{prop:t.id,rules:t.injectValidate()}),class:this.$render.mergeClass(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||x(l)||x(s.show)?u:this.makeCol(r,i,[u])},isTitle(t){if(this.options.form.title===!1)return!1;const e=t.title;return!(!e.title&&!e.native||x(e.show))},makeInfo(t,e,r){var u,f,d,g,y,v;const i=_({},t.title),s=_({},t.info),n=this.options.form,o=this.getSlot("title"),a=[o?o({title:(f=(u=r.refRule)==null?void 0:u.__$title)==null?void 0:f.value,rule:r.rule,options:this.options}):((g=(d=r.refRule)==null?void 0:d.__$title)==null?void 0:g.value)+(n.labelSuffix||n["label-suffix"]||"")];if(!x(s.show)&&(s.info||s.native)&&!x(s.icon)){const w={type:s.type||"poptip",props:Xe(s),key:`${e}pop`,slot:"label"};delete w.props.icon,delete w.props.show,delete w.props.info,delete w.props.align,delete w.props.native;const j="content";s.info&&!S(w.props,j)&&(w.props[j]=(v=(y=r.refRule)==null?void 0:y.__$info)==null?void 0:v.value),a[s.align!=="left"?"unshift":"push"](this.$r(Q([s,w]),[this.$r({type:"icon",props:{type:s.icon===!0?ke.infoIcon:s.icon,size:16},style:"margin-top: -1px",key:`${e}i`})]))}const l=Q([i,{props:Xe(i),key:`${e}tit`,class:"fc-form-title",slot:i.slot||"label",type:i.type||"span"}]);return delete l.props.show,delete l.props.title,delete l.props.native,this.$r(l,a)},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(x(this.options.submitBtn.show)||t.push(this.makeSubmitBtn()),x(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])}},ne={},fi=["upload","select","tree","checkbox","autoComplete","cascader","colorPicker","frame","inputNumber","radio","rate","timePicker","group"];function ci(t){fi.forEach(e=>{t[e]=T(e)}),t.auto=t.autoComplete,t.number=t.inputNumber,t.color=t.colorPicker}function hi(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]=T(e,n=>n.props({uploadType:r[s][0],maxLength:r[s][1]})),i),t),t.uploadImage=t.image,t.uploadFile=t.file}function di(t){const e="tree",r={treeSelected:"selected",treeChecked:"checked"};Object.keys(r).reduce((i,s)=>(i[s]=T(e,{type:r[s]}),i),t)}function pi(t){const e="timePicker";t.time=T(e,{type:"time"}),t.timeRange=T(e,{type:"timerange"})}function mi(t){const e="select";t.selectMultiple=T(e,{multiple:!0}),t.selectOne=T(e,{multiple:!1})}function gi(t){const e="frame",r={frameInputs:["input",0],frameFiles:["file",0],frameImages:["image",0],frameInputOne:["input",1],frameFileOne:["file",1],frameImageOne:["image",1]};Object.keys(r).reduce((i,s)=>(i[s]=T(e,n=>n.props({type:r[s][0],maxLength:r[s][1]})),i),t),t.frameInput=t.frameInputs,t.frameFile=t.frameFiles,t.frameImage=t.frameImages}ci(ne),hi(ne),di(ne),mi(ne),gi(ne),pi(ne);function Lt(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.forEach(a=>{o.push(a.validate())}),Promise.all(o).then(()=>{i(!0),r&&r(!0)}).catch(a=>{s(a),r&&r(a),e.vm.$emit("validate-fail",a,{api:t})})})},validateField(r,i){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).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)=>{t.validate().then(()=>{let o=t.formData();h.Function(r)&&k(()=>r(o,t)),h.Function(e.options.onSubmit)&&k(()=>e.options.onSubmit(o,t)),e.vm.emit("submit",o,t),s(o)}).catch((...o)=>{h.Function(i)&&k(()=>i(t,...o)),n(...o)})})}}}const Vt={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,f){h.empty(u)?f(o.message):f()}},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){Vt.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 vi(t){t.componentAlias(si),ir.forEach(e=>{t.component(e.name,e)}),t.register(Vt),ni.forEach(e=>{t.parser(e)}),Object.keys(ne).forEach(e=>{t.maker[e]=ne[e]})}function bi(){return At({ui:"view-design",version:"2.7.4",manager:ui,install:vi,extendApi:yi,attrs:{normal:["col","wrap"],array:["className"],key:["title","info"]}})}const Fe=bi();typeof window!="undefined"&&(window.formCreate=Fe,window.Vue&&Fe.install(window.Vue));const _i=Fe.maker;P.default=Fe,P.maker=_i,Object.defineProperties(P,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@form-create/view-design",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.4",
|
|
4
4
|
"description": "ViewDesign版本低代码表单|FormCreate 是一个可以通过 JSON 生成具有动态渲染、数据收集、验证和提交功能的低代码表单生成组件。支持6个UI框架,适配移动端,并且支持生成任何 Vue 组件。内置20种常用表单组件和自定义组件,再复杂的表单都可以轻松搞定。",
|
|
5
5
|
"main": "./dist/form-create.min.js",
|
|
6
6
|
"module": "./dist/form-create.esm.js",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
},
|
|
45
45
|
"homepage": "http://www.form-create.com",
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@form-create/core": "^2.7.
|
|
48
|
-
"@form-create/iview": "^2.7.
|
|
47
|
+
"@form-create/core": "^2.7.4",
|
|
48
|
+
"@form-create/iview": "^2.7.4"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"view-design": "^4.0.2",
|
|
57
57
|
"vue": "2.7"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "4c5202e35bf7b40dcc9ca9e177cd860d54644d3e"
|
|
60
60
|
}
|