@form-create/element-ui 3.3.1 → 3.3.2
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 +1831 -1725
- package/dist/form-create.js +4 -4
- package/dist/form-create.min.js +4 -4
- package/package.json +3 -3
- package/src/core/manager.js +1 -1
package/dist/form-create.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* FormCreate 低代码表单渲染器
|
|
3
|
-
* @form-create/element-ui v3.3.
|
|
3
|
+
* @form-create/element-ui v3.3.2
|
|
4
4
|
* (c) 2018-2026 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 r=document.createElement("style");r.appendChild(document.createTextNode('._fc-frame ._fc-files img{width:100%;height:100%;display:inline-block;vertical-align:top}._fc-frame ._fc-upload-btn{border:1px dashed #c0ccda;cursor:pointer}._fc-frame._fc-disabled ._fc-upload-btn,._fc-frame._fc-disabled .el-button{cursor:not-allowed!important;color:#999}._fc-frame ._fc-upload-cover{opacity:0;position:absolute;inset:0;background:#0009;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}._fc-frame ._fc-upload-cover i{color:#fff;font-size:20px;cursor:pointer;margin:0 2px}._fc-frame ._fc-files:hover ._fc-upload-cover{opacity:1}._fc-frame .el-upload{display:block}._fc-frame ._fc-upload-icon{cursor:pointer}._fc-frame ._fc-upload-btn,._fc-files{display:inline-block;width:58px;height:58px;text-align:center;line-height:58px;border:1px solid #c0ccda;border-radius:4px;overflow:hidden;background:#fff;position:relative;-webkit-box-shadow:2px 2px 5px rgba(0,0,0,.1);box-shadow:2px 2px 5px #0000001a;margin-right:4px;-webkit-box-sizing:border-box;box-sizing:border-box}._fc-upload{width:100%}._fc-exceed .el-upload{display:none}.el-upload-list.is-disabled .el-upload{cursor:not-allowed!important}._fc-group{display:flex;min-height:38px;justify-content:center;flex-direction:column;width:100%}._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;border-radius:5px;margin:5px 5px 25px;padding:20px 20px 25px}._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%}._fc-group._fc-group-card{display:flex;flex-direction:column;width:100%;gap:16px}._fc-group._fc-group-card._fc-group-disabled ._fc-group-btn,._fc-group._fc-group-card._fc-group-disabled ._fc-group-add{cursor:not-allowed;opacity:.5}._fc-group._fc-group-card ._fc-group-container{position:relative;background:#fff;border:1px solid #f0f0f0;border-radius:6px;overflow:hidden;display:flex;flex-direction:column;padding:0;margin:0}._fc-group._fc-group-card ._fc-group-header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px 12px;border-bottom:1px solid #f0f0f0;background:#fafafa}._fc-group._fc-group-card ._fc-group-idx{display:flex;align-items:center;justify-content:center;width:24px;height:24px;background:#f0f0f0;color:#666;border-radius:6px;font-size:12px;font-weight:500;margin-right:12px;flex-shrink:0;position:static;border:1px solid #e0e0e0}._fc-group._fc-group-card ._fc-group-title{flex:1;font-size:14px;font-weight:500;color:#000000d9;line-height:1.5715}._fc-group._fc-group-card ._fc-group-handle{display:flex;align-items:center;gap:4px;margin-left:12px;flex-shrink:0;position:static;bottom:auto;right:auto;border-radius:0;border:none;padding:0;background-color:transparent;flex-direction:row}._fc-group._fc-group-card ._fc-group-btn{cursor:pointer;display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:4px;border:1px solid #d9d9d9;background:#fff;color:#00000073;position:relative}._fc-group._fc-group-card ._fc-group-btn:hover{color:#1890ff;border-color:#1890ff;background:#f0f8ff}._fc-group._fc-group-card ._fc-group-btn:active{color:#096dd9;border-color:#096dd9}._fc-group._fc-group-card ._fc-group-arrow{position:relative}._fc-group._fc-group-card ._fc-group-arrow:before{content:"";position:absolute;top:50%;left:50%;width:5px;height:5px;border-left:1px solid currentColor;border-top:1px solid currentColor;transform:translate(-50%,-50%) rotate(45deg)}._fc-group._fc-group-card ._fc-group-arrow._fc-group-down{transform:rotate(180deg)}._fc-group._fc-group-card ._fc-group-sort{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;height:24px}._fc-group._fc-group-card ._fc-group-sort:before,._fc-group._fc-group-card ._fc-group-sort:after{content:"";position:absolute;left:50%;width:4px;height:4px;border-left:1px solid currentColor;border-top:1px solid currentColor;transform:translate(-50%)}._fc-group._fc-group-card ._fc-group-sort:before{top:6px;transform:translate(-50%) rotate(45deg)}._fc-group._fc-group-card ._fc-group-sort:after{bottom:6px;transform:translate(-50%) rotate(225deg)}._fc-group._fc-group-card ._fc-group-sort-up,._fc-group._fc-group-card ._fc-group-sort-down{position:absolute;left:0;right:0;height:12px;cursor:pointer;z-index:1}._fc-group._fc-group-card ._fc-group-sort-up{top:0}._fc-group._fc-group-card ._fc-group-sort-down{bottom:0}._fc-group._fc-group-card ._fc-group-sort-up:hover,._fc-group._fc-group-card ._fc-group-sort-down:hover{background:#1890ff1a}._fc-group._fc-group-card ._fc-group-plus-minus{position:relative;background:#409eff;border-color:#409eff;color:#fff;width:24px;height:24px}._fc-group._fc-group-card ._fc-group-plus-minus:hover{background:#66b1ff;border-color:#66b1ff;color:#fff}._fc-group._fc-group-card ._fc-group-plus-minus:before,._fc-group._fc-group-card ._fc-group-plus-minus:after{content:"";position:absolute;top:50%;left:50%;width:8px;height:1px;background-color:currentColor;transform:translate(-50%,-50%)}._fc-group._fc-group-card ._fc-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-group._fc-group-card ._fc-group-plus-minus._fc-group-minus{background:#f56c6c;border-color:#f56c6c}._fc-group._fc-group-card ._fc-group-plus-minus._fc-group-minus:hover{background:#f78989;border-color:#f78989}._fc-group._fc-group-card ._fc-group-plus-minus._fc-group-minus:before{display:none}._fc-group._fc-group-card ._fc-group-content{padding:20px}._fc-group._fc-group-card ._fc-group-add{cursor:pointer;display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:4px;border:1px solid #d9d9d9;background:#fff;color:#00000073;position:relative}._fc-group._fc-group-card ._fc-group-add:hover{color:#409eff;border-color:#409eff;background:#f0f8ff}._fc-group._fc-group-card ._fc-group-add._fc-group-plus-minus{width:24px;height:24px;background:#409eff;border-color:#409eff;color:#fff}._fc-group._fc-group-card ._fc-group-add._fc-group-plus-minus:hover{background:#66b1ff;border-color:#66b1ff;color:#fff}._fc-group._fc-group-card ._fc-group-add._fc-group-plus-minus:before,._fc-group._fc-group-card ._fc-group-add._fc-group-plus-minus:after{content:"";position:absolute;top:50%;left:50%;width:8px;height:1px;background-color:currentColor;transform:translate(-50%,-50%)}._fc-group._fc-group-card ._fc-group-add._fc-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-group._fc-group-card ._fc-group-empty{text-align:center;padding:40px 20px;color:#00000073;font-size:14px}@media (max-width: 768px){._fc-group._fc-group-card ._fc-group-container{margin:0 -8px;border-radius:0;border-left:none;border-right:none}._fc-group._fc-group-card ._fc-group-header{padding:12px 16px 8px}._fc-group._fc-group-card ._fc-group-content{padding:16px}._fc-group._fc-group-card ._fc-group-handle{gap:2px}._fc-group._fc-group-card ._fc-group-btn{width:22px;height:22px}}.form-create .form-create .el-form-item{margin-bottom:22px}.form-create{width:100%}.form-create.is-preview .fc-clock,.form-create .fc-none,.form-create.is-preview .el-form-item.is-required>.el-form-item__label-wrap>.el-form-item__label:before,.form-create.is-preview .el-form-item.is-required>.el-form-item__label:before{display:none!important}.fc-wrap-right>.el-form-item__label{display:flex;justify-content:flex-end}.fc-wrap-left>.el-form-item__label{display:flex;justify-content:flex-start}.fc-wrap-top.el-form-item{display:block}.fc-wrap-top.el-form-item>.el-form-item__label{display:block;height:auto;line-height:22px;margin-bottom:8px;text-align:left;float:unset}.el-form--large .fc-wrap-top.el-form-item>.el-form-item__label{line-height:22px;margin-bottom:12px}.el-form--default .fc-wrap-top.el-form-item>.el-form-item__label{line-height:22px;margin-bottom:8px}.el-form--small .fc-wrap-top.el-form-item>.el-form-item__label{line-height:20px;margin-bottom:4px}.fc-form-footer{margin-top:12px}')),document.head.appendChild(r)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
10
|
-
(function(I,l){typeof exports=="object"&&typeof module!="undefined"?l(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],l):(I=typeof globalThis!="undefined"?globalThis:I||self,l(I.formCreate={},I.Vue))})(this,function(I,l){"use strict";var ni=Object.defineProperty,ii=Object.defineProperties;var si=Object.getOwnPropertyDescriptors;var Ut=Object.getOwnPropertySymbols;var oi=Object.prototype.hasOwnProperty,ai=Object.prototype.propertyIsEnumerable;var xt=(I,l,T)=>l in I?ni(I,l,{enumerable:!0,configurable:!0,writable:!0,value:T}):I[l]=T,C=(I,l)=>{for(var T in l||(l={}))oi.call(l,T)&&xt(I,T,l[T]);if(Ut)for(var T of Ut(l))ai.call(l,T)&&xt(I,T,l[T]);return I},q=(I,l)=>ii(I,si(l));function T(t,e){return Object.keys(t).reduce((r,n)=>((!e||e.indexOf(n)===-1)&&(r[n]=t[n]),r),{})}function M(t){return Array.isArray(t)?t:[null,void 0,""].indexOf(t)>-1?[]:[t]}const qt=l.defineComponent({name:"fcCheckbox",inheritAttrs:!1,props:{formCreateInject:Object,modelValue:{type:Array,default:()=>[]},type:String,options:Array,input:Boolean,inputValue:String},emits:["update:modelValue","fc.el"],setup(t,e){const r=l.toRef(t.formCreateInject,"options",[]),n=l.toRef(t,"options"),s=l.toRef(t,"modelValue"),i=l.toRef(t,"inputValue",""),o=l.ref(i.value),a=l.toRef(t,"input",!1),u=h=>{const p=[...M(s.value)],m=p.indexOf(o.value);o.value=h,m>-1&&(p.splice(m,1),p.push(h),f(p))};l.watch(i,h=>{if(!a.value){o.value=h;return}u(h)});const c=l.computed(()=>{let h=r.value||[];return n.value&&(h=n.value||[]),Array.isArray(h)?h:[]});l.watch(s,h=>{let p=null;if(!i.value&&h!=null&&Array.isArray(h)&&h.length>0&&a.value){const m=c.value.map(_=>_.value);h.forEach(_=>{m.indexOf(_)===-1&&(p=_)})}p!=null&&(o.value=p)},{immediate:!0});const f=h=>{e.emit("update:modelValue",h)};return{options:c,value:s,onInput:f,updateCustomValue:u,makeInput(h){if(a.value)return l.createVNode(h,{value:o.value||void 0,label:o.value||void 0},{default:()=>[l.createVNode(l.resolveComponent("ElInput"),{size:"small",modelValue:o.value,"onUpdate:modelValue":u},null)]})}}},render(){const t=this.type==="button"?"ElCheckboxButton":"ElCheckbox",e=l.resolveComponent(t);return l.createVNode(l.resolveComponent("ElCheckboxGroup"),l.mergeProps(this.$attrs,{modelValue:this.value===null?void 0:this.value,"onUpdate:modelValue":this.onInput,ref:"el"}),C({default:()=>{var r,n;return[this.options.map((s,i)=>{const o=C({},s),a=o.value,u=o.label;return delete o.value,delete o.label,l.createVNode(e,l.mergeProps(o,{label:a,value:a,key:t+i+"-"+a}),{default:()=>[u||a||""]})}),(n=(r=this.$slots).default)==null?void 0:n.call(r),this.makeInput(e)]}},T(this.$slots,["default"])))},mounted(){this.$emit("fc.el",this.$refs.el)}});function Ze(t){t=t||new Map;const e={$on(r,n){const s=t.get(r);s&&s.push(n)||t.set(r,[n])},$once(r,n){n._once=!0,e.$on(r,n)},$off(r,n){const s=t.get(r);s&&s.splice(s.indexOf(n)>>>0,1)},$emit(r,...n){(t.get(r)||[]).slice().map(s=>{s._once&&(e.$off(r,s),delete s._once),s(...n)}),(t.get("*")||[]).slice().map(s=>{s(r,n)})}};return e}const ee=(t,e)=>{const r=t.__vccOpts||t;for(const[n,s]of e)r[n]=s;return r},Ht={name:"IconCircleClose"},zt={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"};function Gt(t,e,r,n,s,i){return l.openBlock(),l.createElementBlock("svg",zt,[...e[0]||(e[0]=[l.createElementVNode("path",{fill:"currentColor",d:"M466.752 512l-90.496-90.496a32 32 0 0145.248-45.248L512 466.752l90.496-90.496a32 32 0 1145.248 45.248L557.248 512l90.496 90.496a32 32 0 11-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 01-45.248-45.248L466.752 512z"},null,-1),l.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"},null,-1)])])}const Yt=ee(Ht,[["render",Gt]]),Wt={name:"IconDocument"},Jt={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"};function Kt(t,e,r,n,s,i){return l.openBlock(),l.createElementBlock("svg",Jt,[...e[0]||(e[0]=[l.createElementVNode("path",{fill:"currentColor",d:"M832 384H576V128H192v768h640V384zm-26.496-64L640 154.496V320h165.504zM160 64h480l256 256v608a32 32 0 01-32 32H160a32 32 0 01-32-32V96a32 32 0 0132-32zm160 448h384v64H320v-64zm0-192h160v64H320v-64zm0 384h384v64H320v-64z"},null,-1)])])}const Xt=ee(Wt,[["render",Kt]]),Zt={name:"IconDelete"},Qt={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"};function er(t,e,r,n,s,i){return l.openBlock(),l.createElementBlock("svg",Qt,[...e[0]||(e[0]=[l.createElementVNode("path",{fill:"currentColor",d:"M160 256H96a32 32 0 010-64h256V95.936a32 32 0 0132-32h256a32 32 0 0132 32V192h256a32 32 0 110 64h-64v672a32 32 0 01-32 32H192a32 32 0 01-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 01-32-32V416a32 32 0 0164 0v320a32 32 0 01-32 32zm192 0a32 32 0 01-32-32V416a32 32 0 0164 0v320a32 32 0 01-32 32z"},null,-1)])])}const tr=ee(Zt,[["render",er]]),rr={name:"IconView"},nr={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"};function ir(t,e,r,n,s,i){return l.openBlock(),l.createElementBlock("svg",nr,[...e[0]||(e[0]=[l.createElementVNode("path",{fill:"currentColor",d:"M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 110 448 224 224 0 010-448zm0 64a160.192 160.192 0 00-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z"},null,-1)])])}const sr=ee(rr,[["render",ir]]),or={name:"IconFolderOpened"},ar={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"};function lr(t,e,r,n,s,i){return l.openBlock(),l.createElementBlock("svg",ar,[...e[0]||(e[0]=[l.createElementVNode("path",{fill:"currentColor",d:"M878.08 448H241.92l-96 384h636.16l96-384zM832 384v-64H485.76L357.504 192H128v448l57.92-231.744A32 32 0 01216.96 384H832zm-24.96 512H96a32 32 0 01-32-32V160a32 32 0 0132-32h287.872l128.384 128H864a32 32 0 0132 32v96h23.04a32 32 0 0131.04 39.744l-112 448A32 32 0 01807.04 896z"},null,-1)])])}const ur=ee(or,[["render",lr]]),cr=l.defineComponent({name:"fcFrame",props:{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:"IconFolderOpened"},width:{type:String,default:"500px"},height:{type:String,default:"370px"},maxLength:{type:Number,default:0},okBtnText:{type:String,default:""},closeBtnText:{type:String,default:""},modalTitle:String,handleIcon:{type:[String,Boolean],default:void 0},title:String,allowRemove:{type:Boolean,default:!0},onOpen:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}},onCancel:{type:Function,default:()=>{}},onLoad:{type:Function,default:()=>{}},onBeforeRemove:{type:Function,default:()=>{}},onRemove:{type:Function,default:()=>{}},onHandle:Function,modal:{type:Object,default:()=>({})},srcKey:[String,Number],modelValue:[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},formCreateInject:Object},emits:["update:modelValue","change"],components:{IconFolderOpened:ur,IconView:sr},data(){return{fileList:M(this.modelValue),previewVisible:!1,frameVisible:!1,previewImage:"",bus:new Ze}},watch:{modelValue(t){this.fileList=M(t)}},methods:{close(){this.closeModel(!0)},closeModel(t){this.bus.$emit(t?"$close":"$ok"),this.reload&&(this.bus.$off("$ok"),this.bus.$off("$close")),this.frameVisible=!1},handleCancel(){this.previewVisible=!1},showModel(){this.disabled||this.onOpen()===!1||(this.frameVisible=!0)},input(){const t=this.fileList,e=this.maxLength===1?t[0]||"":t;this.$emit("update:modelValue",e),this.$emit("change",e)},makeInput(){return l.createVNode(l.resolveComponent("ElInput"),l.mergeProps({type:"text",modelValue:this.fileList.map(t=>this.getSrc(t)).toString(),readonly:!0},{key:1}),{append:()=>l.createVNode(l.resolveComponent("ElButton"),{icon:l.resolveComponent(this.icon),onClick:()=>this.showModel()},null),suffix:()=>this.fileList.length&&!this.disabled?l.createVNode(l.resolveComponent("ElIcon"),{class:"el-input__icon _fc-upload-icon",onClick:()=>{this.fileList=[],this.input()}},{default:()=>[l.createVNode(Yt,null,null)]}):null})},makeGroup(t){return(!this.maxLength||this.fileList.length<this.maxLength)&&t.push(this.makeBtn()),l.createVNode("div",{key:2},[t])},makeItem(t,e){return l.createVNode("div",{class:"_fc-files",key:"3"+t},[e])},valid(t){const e=this.formCreateInject.field||this.field;if(e&&t!==e)throw new Error("[frame]无效的字段值")},makeIcons(t,e){if(this.handleIcon!==!1||this.allowRemove===!0){const r=[];return(this.type!=="file"&&this.handleIcon!==!1||this.type==="file"&&this.handleIcon)&&r.push(this.makeHandleIcon(t,e)),this.allowRemove&&r.push(this.makeRemoveIcon(t,e)),l.createVNode("div",{class:"_fc-upload-cover",key:4},[r])}},makeHandleIcon(t,e){const r=l.resolveComponent(this.handleIcon===!0||this.handleIcon===void 0?"icon-view":this.handleIcon);return l.createVNode(l.resolveComponent("ElIcon"),{onClick:()=>this.handleClick(t),key:"5"+e},{default:()=>[l.createVNode(r,null,null)]})},makeRemoveIcon(t,e){return l.createVNode(l.resolveComponent("ElIcon"),{onClick:()=>this.handleRemove(t),key:"6"+e},{default:()=>[l.createVNode(tr,null,null)]})},makeFiles(){return this.makeGroup(this.fileList.map((t,e)=>this.makeItem(e,[l.createVNode(l.resolveComponent("ElIcon"),{onClick:()=>this.handleClick(t)},{default:()=>[l.createVNode(Xt,null,null)]}),this.makeIcons(t,e)])))},makeImages(){return this.makeGroup(this.fileList.map((t,e)=>this.makeItem(e,[l.createVNode("img",{src:this.getSrc(t)},null),this.makeIcons(t,e)])))},makeBtn(){const t=l.resolveComponent(this.icon);return l.createVNode("div",{class:"_fc-upload-btn",onClick:()=>this.showModel(),key:7},[l.createVNode(l.resolveComponent("ElIcon"),null,{default:()=>[l.createVNode(t,null,null)]})])},handleClick(t){if(this.onHandle)return this.onHandle(t);this.previewImage=this.getSrc(t),this.previewVisible=!0},handleRemove(t){this.disabled||this.onBeforeRemove(t)!==!1&&(this.fileList.splice(this.fileList.indexOf(t),1),this.input(),this.onRemove(t))},getSrc(t){return this.srcKey?t[this.srcKey]:t},frameLoad(t){this.onLoad(t);try{this.helper===!0&&(t.form_create_helper={api:this.formCreateInject.api,close:e=>{this.valid(e),this.closeModel()},set:(e,r)=>{this.valid(e),!this.disabled&&this.$emit("update:modelValue",r)},get:e=>(this.valid(e),this.modelValue),onOk:e=>this.bus.$on("$ok",e),onClose:e=>this.bus.$on("$close",e)})}catch(e){console.error(e)}},makeFooter(){const{okBtnText:t,closeBtnText:e,closeBtn:r,okBtn:n,footer:s}=this.$props;if(s)return l.createVNode("div",null,[r?l.createVNode(l.resolveComponent("ElButton"),{onClick:()=>this.onCancel()!==!1&&(this.frameVisible=!1)},{default:()=>[e||this.formCreateInject.t("close")||"关闭"]}):null,n?l.createVNode(l.resolveComponent("ElButton"),{type:"primary",onClick:()=>this.onOk()!==!1&&this.closeModel()},{default:()=>[t||this.formCreateInject.t("ok")||"确定"]}):null])}},render(){const t=this.type;let e;t==="input"?e=this.makeInput():t==="image"?e=this.makeImages():e=this.makeFiles();const{width:r="30%",height:n,src:s,title:i,modalTitle:o}=this.$props;return l.nextTick(()=>{this.$refs.frame&&this.frameLoad(this.$refs.frame.contentWindow||{})}),l.createVNode("div",{class:{"_fc-frame":!0,"_fc-disabled":this.disabled}},[e,l.createVNode(l.resolveComponent("ElDialog"),{appendToBody:!0,modal:this.previewMask,title:o,modelValue:this.previewVisible,onClose:this.handleCancel},{default:()=>[l.createVNode("img",{style:"width: 100%",src:this.previewImage},null)]}),l.createVNode(l.resolveComponent("ElDialog"),l.mergeProps({appendToBody:!0},C({width:r,title:i},this.modal),{modelValue:this.frameVisible,onClose:()=>this.closeModel(!0)}),{default:()=>[this.frameVisible||!this.reload?l.createVNode("iframe",{ref:"frame",src:s,frameBorder:"0",style:{height:n,border:"0 none",width:"100%"}},null):null],footer:()=>this.makeFooter()})])},beforeMount(){const{name:t,field:e,api:r}=this.formCreateInject;t&&r.on("fc:closeModal:"+t,this.close),e&&r.on("fc:closeModal:"+e,this.close)},beforeUnmount(){const{name:t,field:e,api:r}=this.formCreateInject;t&&r.off("fc:closeModal:"+t,this.close),e&&r.off("fc:closeModal:"+e,this.close)}}),fr=l.defineComponent({name:"fcRadio",inheritAttrs:!1,props:{formCreateInject:Object,modelValue:{type:[String,Number,Boolean],default:""},options:Array,type:String,input:Boolean,inputValue:String},emits:["update:modelValue","fc.el"],setup(t,e){const r=l.toRef(t.formCreateInject,"options",[]),n=l.toRef(t,"options"),s=l.toRef(t,"modelValue"),i=l.toRef(t,"inputValue",""),o=l.ref(i.value),a=l.toRef(t,"input",!1);l.watch(i,h=>{if(!a.value){o.value=h;return}f(h)});const u=l.computed(()=>{let h=r.value||[];return n.value&&(h=n.value||[]),Array.isArray(h)?h:[]});l.watch(s,h=>{let p=!1;!i.value&&h!=null&&a.value&&(p=u.value.map(m=>m.value).indexOf(h)===-1),p&&(o.value=h)},{immediate:!0});const c=h=>{e.emit("update:modelValue",h)},f=h=>{const p=o.value;o.value=h,s.value===p&&c(h)};return{options:u,value:s,onInput:c,updateCustomValue:f,customValue:o,makeInput(h){if(a.value)return l.createVNode(h,{checked:!1,value:o.value||void 0,label:o.value||void 0},{default:()=>[l.createVNode(l.resolveComponent("ElInput"),{size:"small",modelValue:o.value,"onUpdate:modelValue":f},null)]})}}},render(){const t=this.type==="button"?"ElRadioButton":"ElRadio",e=l.resolveComponent(t);return l.createVNode(l.resolveComponent("ElRadioGroup"),l.mergeProps(this.$attrs,{modelValue:this.value,"onUpdate:modelValue":this.onInput,ref:"el"}),C({default:()=>{var r,n;return[this.options.map((s,i)=>{const o=C({},s),a=o.value,u=o.label;return delete o.value,delete o.label,l.createVNode(e,l.mergeProps(o,{label:a,value:a,key:t+i+"-"+a}),{default:()=>[u||a||""]})}),(n=(r=this.$slots).default)==null?void 0:n.call(r),this.makeInput(e)]}},T(this.$slots,["default"])))},mounted(){this.$emit("fc.el",this.$refs.el)}}),g={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&&!g.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=>{g[t]=function(e){return g.type(e,t)}});function v(t,e){return{}.hasOwnProperty.call(t,e)}const dr=l.defineComponent({name:"fcSelect",inheritAttrs:!1,props:{formCreateInject:Object,modelValue:{type:[Array,String,Number,Boolean,Object],default:void 0},type:String},emits:["update:modelValue","fc.el"],setup(t,{emit:e}){const r=l.toRef(t.formCreateInject,"options",[]),n=l.toRef(t,"modelValue");return{options:l.computed(()=>Array.isArray(r.value)?r.value:[]),value:n,handleUpdate:o=>{e("update:modelValue",o)},hasProperty:v,is:g}},mounted(){this.$emit("fc.el",this.$refs.el)}});function hr(t,e,r,n,s,i){const o=l.resolveComponent("el-option"),a=l.resolveComponent("el-option-group"),u=l.resolveComponent("el-select");return l.openBlock(),l.createBlock(u,l.mergeProps(t.$attrs,{"model-value":t.value,"onUpdate:modelValue":t.handleUpdate,ref:"el"}),{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(t.options,(c,f)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[t.hasProperty(c,"options")?(l.openBlock(),l.createBlock(a,{label:c.label,key:`${f}-${c.label}`},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(t.is.trueArray(c.options)?c.options:[],(h,p)=>(l.openBlock(),l.createBlock(o,l.mergeProps({key:`${p}-${h.value}`},{ref_for:!0},h),null,16))),128))]),_:2},1032,["label"])):(l.openBlock(),l.createBlock(o,l.mergeProps({key:`${f}-${c.value}`},{ref_for:!0},c),null,16))],64))),256)),l.renderSlot(t.$slots,"default")]),_:3},16,["model-value","onUpdate:modelValue"])}const pr=ee(dr,[["render",hr]]),mr=l.defineComponent({name:"fcTree",inheritAttrs:!1,formCreateParser:{mergeProp(t){const e=t.prop.props;e.nodeKey||(e.nodeKey="id"),e.props||(e.props={label:"title"})}},props:{type:String,modelValue:{type:[Array,String,Number],default:()=>[]}},emits:["update:modelValue","fc.el"],watch:{modelValue(){this.setValue()}},methods:{updateValue(){if(!this.$refs.tree)return;let t;this.type==="selected"?t=this.$refs.tree.getCurrentKey():t=this.$refs.tree.getCheckedKeys(),this.$emit("update:modelValue",t)},setValue(){if(!this.$refs.tree)return;this.type==="selected"?this.$refs.tree.setCurrentKey(this.modelValue):this.$refs.tree.setCheckedKeys(M(this.modelValue))}},render(){return l.createVNode(l.resolveComponent("ElTree"),l.mergeProps(this.$attrs,{ref:"tree",onCheck:this.updateValue,onNodeClick:this.updateValue}),this.$slots)},mounted(){this.setValue(),this.$emit("fc.el",this.$refs.tree)}}),gr={name:"IconUpload"},yr={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"};function $r(t,e,r,n,s,i){return l.openBlock(),l.createElementBlock("svg",yr,[...e[0]||(e[0]=[l.createElementVNode("path",{fill:"currentColor",d:"M160 832h704a32 32 0 110 64H160a32 32 0 110-64zm384-578.304V704h-64V247.296L237.248 490.048 192 444.8 508.8 128l316.8 316.8-45.312 45.248L544 253.696z"},null,-1)])])}const br=ee(gr,[["render",$r]]);function Qe(t,e){return typeof t=="object"?t:{url:t,is_string:!0,name:_r(t),uid:e}}function et(t){return q(C({},t),{file:t,value:t})}function _r(t){return(""+t).split("/").pop()}const Cr=l.defineComponent({name:"fcUpload",inheritAttrs:!1,formCreateParser:{toFormValue(t){return M(t)},toValue(t,e){return e.prop.props.limit===1?t[0]||"":t}},props:{previewMask:void 0,onPreview:Function,httpRequest:Function,modalTitle:String,listType:String,uploadText:String,formCreateInject:Object,modelValue:[Array,String,Object]},emits:["update:modelValue","change","remove","fc.el"],data(){return{previewVisible:!1,previewImage:"",fileList:[]}},created(){this.fileList=M(this.modelValue).map(Qe).map(et)},watch:{modelValue(t){this.fileList=M(t).map(Qe).map(et)}},methods:{handlePreview(t){this.onPreview?this.onPreview(...arguments):this.listType==="text"?window.open(t.url):(this.previewImage=t.url,this.previewVisible=!0)},update(t){let e=t.map(r=>r.is_string?r.url:r.value||r.url).filter(r=>r!==void 0);this.$emit("update:modelValue",e)},handleCancel(){this.previewVisible=!1},handleChange(t,e){this.$emit("change",...arguments),t.status==="success"&&this.update(e)},handleRemove(t,e){this.$emit("remove",...arguments),this.update(e)},doHttpRequest(t){if(this.httpRequest)return this.httpRequest(t);t.source="upload",this.formCreateInject.api.fetch(t)}},render(){const t=M(this.modelValue).length;return l.createVNode("div",{class:"_fc-upload"},[l.createVNode(l.resolveComponent("ElUpload"),l.mergeProps({key:t},this.$attrs,{listType:this.listType||"picture-card",class:{"_fc-exceed":this.$attrs.limit?this.$attrs.limit<=t:!1},onPreview:this.handlePreview,onChange:this.handleChange,onRemove:this.handleRemove,httpRequest:this.doHttpRequest,fileList:this.fileList,ref:"upload"}),C({default:()=>{var e,r;return[((r=(e=this.$slots).default)==null?void 0:r.call(e))||(["text","picture"].indexOf(this.listType)===-1?l.createVNode(l.resolveComponent("ElIcon"),null,{default:()=>[l.createVNode(br,null,null)]}):l.createVNode(l.resolveComponent("ElButton"),{type:"primary"},{default:()=>[this.formCreateInject.t("clickToUpload")||this.uploadText||"点击上传"]}))]}},T(this.$slots,["default"]))),l.createVNode(l.resolveComponent("ElDialog"),{appendToBody:!0,modal:this.previewMask,title:this.modalTitle,modelValue:this.previewVisible,onClose:this.handleCancel},{default:()=>[l.createVNode("img",{style:"width: 100%",src:this.previewImage},null)]})])},mounted(){this.$emit("fc.el",this.$refs.upload)}});function H(t,e,r){t[e]=r}function ae(t,e){delete t[e]}function me(t,e={},r){let n=!1;for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s)){let i=e[s];if((n=Array.isArray(i))||g.Object(i)){let o=t[s]===void 0;if(n)n=!1,o&&H(t,s,[]);else if(i._clone&&r!==void 0)if(r)i=i.getRule(),o&&H(t,s,{});else{H(t,s,i._clone());continue}else o&&H(t,s,{});t[s]=me(t[s],i,r)}else H(t,s,i),g.Undef(i)||(g.Undef(i.__json)||(t[s].__json=i.__json),g.Undef(i.__origin)||(t[s].__origin=i.__origin))}return r!==void 0&&Array.isArray(t)?t.filter(s=>!s||!s.__ctrl):t}function G(t){return me({},{value:t}).value}const wr=Object.assign||function(t){for(let e,r=1;r<arguments.length;r++)for(let n in e=arguments[r],e)Object.prototype.hasOwnProperty.call(e,n)&&H(t,n,e[n]);return t};function w(){return wr.apply(this,arguments)}function De(t){return typeof t!="object"||t===null?t:t instanceof Array?[...t]:C({},t)}function te(t,e){var r=null;return function(...n){r!==null&&clearTimeout(r),r=setTimeout(()=>t.call(this,...n),e)}}function tt(t){return t==null?"":typeof t=="object"?JSON.stringify(t,null,2):String(t)}function Vr(t){return t&&typeof t=="object"&&typeof t.then=="function"}function Ce(t){return Vr(t)?t:Promise.resolve(t)}function ge(t){let e=t.replace(/([A-Z])/g,"-$1").toLocaleLowerCase();return e.indexOf("-")===0&&(e=e.substr(1)),e}function rt(t){return t.replace(t[0],t[0].toLocaleUpperCase())}function nt(t,e,r){return`[form-create ${t}]: ${e}`}function Ae(t,e){console.error(nt("err",t))}function Sr(t){Ae(t.toString()),console.error(t)}const je="[[FORM-CREATE-PREFIX-",Ie="-FORM-CREATE-SUFFIX]]";function ye(t,e){return JSON.stringify(me(Array.isArray(t)?[]:{},t,!0),function(r,n){if(!(n&&n._isVue===!0)){if(typeof n!="function")return n;if(n.__json)return n.__json;if(n.__origin&&(n=n.__origin),!n.__emit)return je+n+Ie}},e)}function Pe(t){return new Function("return "+t)()}function Y(t,e){if(t&&g.String(t)&&t.length>4){let r=t.trim(),n=!1;try{if(r.indexOf(Ie)>0&&r.indexOf(je)===0)r=r.replace(Ie,"").replace(je,""),n=!0;else if(r.indexOf("$FN:")===0)r=r.substring(4),n=!0;else if(r.indexOf("$EXEC:")===0)r=r.substring(6),n=!0;else if(r.indexOf("$GLOBAL:")===0){const i=r.substring(8);return r=function(...o){const a=o[0].api.getGlobalEvent(i);if(a)return a.call(this,...o)},r.__json=t,r.__inject=!0,r}else{if(r.indexOf("$FNX:")===0)return r=Pe(`function($inject){
|
|
10
|
+
(function(I,u){typeof exports=="object"&&typeof module!="undefined"?u(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],u):(I=typeof globalThis!="undefined"?globalThis:I||self,u(I.formCreate={},I.Vue))})(this,function(I,u){"use strict";var di=Object.defineProperty,hi=Object.defineProperties;var pi=Object.getOwnPropertyDescriptors;var zt=Object.getOwnPropertySymbols;var mi=Object.prototype.hasOwnProperty,gi=Object.prototype.propertyIsEnumerable;var xt=(I,u,M)=>u in I?di(I,u,{enumerable:!0,configurable:!0,writable:!0,value:M}):I[u]=M,C=(I,u)=>{for(var M in u||(u={}))mi.call(u,M)&&xt(I,M,u[M]);if(zt)for(var M of zt(u))gi.call(u,M)&&xt(I,M,u[M]);return I},q=(I,u)=>hi(I,pi(u));function M(t,e){return Object.keys(t).reduce((r,n)=>((!e||e.indexOf(n)===-1)&&(r[n]=t[n]),r),{})}function L(t){return Array.isArray(t)?t:[null,void 0,""].indexOf(t)>-1?[]:[t]}const Gt=u.defineComponent({name:"fcCheckbox",inheritAttrs:!1,props:{formCreateInject:Object,modelValue:{type:Array,default:()=>[]},type:String,options:Array,input:Boolean,inputValue:String},emits:["update:modelValue","fc.el"],setup(t,e){const r=u.toRef(t.formCreateInject,"options",[]),n=u.toRef(t,"options"),o=u.toRef(t,"modelValue"),i=u.toRef(t,"inputValue",""),s=u.ref(i.value),a=u.toRef(t,"input",!1),l=d=>{const p=[...L(o.value)],$=p.indexOf(s.value);s.value=d,$>-1&&(p.splice($,1),p.push(d),f(p))};u.watch(i,d=>{if(!a.value){s.value=d;return}l(d)});const c=u.computed(()=>{let d=r.value||[];return n.value&&(d=n.value||[]),Array.isArray(d)?d:[]});u.watch(o,d=>{let p=null;if(!i.value&&d!=null&&Array.isArray(d)&&d.length>0&&a.value){const $=c.value.map(y=>y.value);d.forEach(y=>{$.indexOf(y)===-1&&(p=y)})}p!=null&&(s.value=p)},{immediate:!0});const f=d=>{e.emit("update:modelValue",d)};return{options:c,value:o,onInput:f,updateCustomValue:l,makeInput(d){if(a.value)return u.createVNode(d,{value:s.value||void 0,label:s.value||void 0},{default:()=>[u.createVNode(u.resolveComponent("ElInput"),{size:"small",modelValue:s.value,"onUpdate:modelValue":l},null)]})}}},render(){const t=this.type==="button"?"ElCheckboxButton":"ElCheckbox",e=u.resolveComponent(t);return u.createVNode(u.resolveComponent("ElCheckboxGroup"),u.mergeProps(this.$attrs,{modelValue:this.value===null?void 0:this.value,"onUpdate:modelValue":this.onInput,ref:"el"}),C({default:()=>{var r,n;return[this.options.map((o,i)=>{const s=C({},o),a=s.value,l=s.label;return delete s.value,delete s.label,u.createVNode(e,u.mergeProps(s,{label:a,value:a,key:t+i+"-"+a}),{default:()=>[l||a||""]})}),(n=(r=this.$slots).default)==null?void 0:n.call(r),this.makeInput(e)]}},M(this.$slots,["default"])))},mounted(){this.$emit("fc.el",this.$refs.el)}});function Ze(t){t=t||new Map;const e={$on(r,n){const o=t.get(r);o&&o.push(n)||t.set(r,[n])},$once(r,n){n._once=!0,e.$on(r,n)},$off(r,n){const o=t.get(r);o&&o.splice(o.indexOf(n)>>>0,1)},$emit(r,...n){(t.get(r)||[]).slice().map(o=>{o._once&&(e.$off(r,o),delete o._once),o(...n)}),(t.get("*")||[]).slice().map(o=>{o(r,n)})}};return e}const ee=(t,e)=>{const r=t.__vccOpts||t;for(const[n,o]of e)r[n]=o;return r},Yt={name:"IconCircleClose"},Kt={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"};function Wt(t,e,r,n,o,i){return u.openBlock(),u.createElementBlock("svg",Kt,[...e[0]||(e[0]=[u.createElementVNode("path",{fill:"currentColor",d:"M466.752 512l-90.496-90.496a32 32 0 0145.248-45.248L512 466.752l90.496-90.496a32 32 0 1145.248 45.248L557.248 512l90.496 90.496a32 32 0 11-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 01-45.248-45.248L466.752 512z"},null,-1),u.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"},null,-1)])])}const Jt=ee(Yt,[["render",Wt]]),Qt={name:"IconDocument"},Xt={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"};function Zt(t,e,r,n,o,i){return u.openBlock(),u.createElementBlock("svg",Xt,[...e[0]||(e[0]=[u.createElementVNode("path",{fill:"currentColor",d:"M832 384H576V128H192v768h640V384zm-26.496-64L640 154.496V320h165.504zM160 64h480l256 256v608a32 32 0 01-32 32H160a32 32 0 01-32-32V96a32 32 0 0132-32zm160 448h384v64H320v-64zm0-192h160v64H320v-64zm0 384h384v64H320v-64z"},null,-1)])])}const er=ee(Qt,[["render",Zt]]),tr={name:"IconDelete"},rr={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"};function nr(t,e,r,n,o,i){return u.openBlock(),u.createElementBlock("svg",rr,[...e[0]||(e[0]=[u.createElementVNode("path",{fill:"currentColor",d:"M160 256H96a32 32 0 010-64h256V95.936a32 32 0 0132-32h256a32 32 0 0132 32V192h256a32 32 0 110 64h-64v672a32 32 0 01-32 32H192a32 32 0 01-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 01-32-32V416a32 32 0 0164 0v320a32 32 0 01-32 32zm192 0a32 32 0 01-32-32V416a32 32 0 0164 0v320a32 32 0 01-32 32z"},null,-1)])])}const ir=ee(tr,[["render",nr]]),sr={name:"IconView"},or={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"};function ar(t,e,r,n,o,i){return u.openBlock(),u.createElementBlock("svg",or,[...e[0]||(e[0]=[u.createElementVNode("path",{fill:"currentColor",d:"M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 110 448 224 224 0 010-448zm0 64a160.192 160.192 0 00-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z"},null,-1)])])}const lr=ee(sr,[["render",ar]]),ur={name:"IconFolderOpened"},cr={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"};function fr(t,e,r,n,o,i){return u.openBlock(),u.createElementBlock("svg",cr,[...e[0]||(e[0]=[u.createElementVNode("path",{fill:"currentColor",d:"M878.08 448H241.92l-96 384h636.16l96-384zM832 384v-64H485.76L357.504 192H128v448l57.92-231.744A32 32 0 01216.96 384H832zm-24.96 512H96a32 32 0 01-32-32V160a32 32 0 0132-32h287.872l128.384 128H864a32 32 0 0132 32v96h23.04a32 32 0 0131.04 39.744l-112 448A32 32 0 01807.04 896z"},null,-1)])])}const dr=ee(ur,[["render",fr]]),hr=u.defineComponent({name:"fcFrame",props:{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:"IconFolderOpened"},width:{type:String,default:"500px"},height:{type:String,default:"370px"},maxLength:{type:Number,default:0},okBtnText:{type:String,default:""},closeBtnText:{type:String,default:""},modalTitle:String,handleIcon:{type:[String,Boolean],default:void 0},title:String,allowRemove:{type:Boolean,default:!0},onOpen:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}},onCancel:{type:Function,default:()=>{}},onLoad:{type:Function,default:()=>{}},onBeforeRemove:{type:Function,default:()=>{}},onRemove:{type:Function,default:()=>{}},onHandle:Function,modal:{type:Object,default:()=>({})},srcKey:[String,Number],modelValue:[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},formCreateInject:Object},emits:["update:modelValue","change"],components:{IconFolderOpened:dr,IconView:lr},data(){return{fileList:L(this.modelValue),previewVisible:!1,frameVisible:!1,previewImage:"",bus:new Ze}},watch:{modelValue(t){this.fileList=L(t)}},methods:{close(){this.closeModel(!0)},closeModel(t){this.bus.$emit(t?"$close":"$ok"),this.reload&&(this.bus.$off("$ok"),this.bus.$off("$close")),this.frameVisible=!1},handleCancel(){this.previewVisible=!1},showModel(){this.disabled||this.onOpen()===!1||(this.frameVisible=!0)},input(){const t=this.fileList,e=this.maxLength===1?t[0]||"":t;this.$emit("update:modelValue",e),this.$emit("change",e)},makeInput(){return u.createVNode(u.resolveComponent("ElInput"),u.mergeProps({type:"text",modelValue:this.fileList.map(t=>this.getSrc(t)).toString(),readonly:!0},{key:1}),{append:()=>u.createVNode(u.resolveComponent("ElButton"),{icon:u.resolveComponent(this.icon),onClick:()=>this.showModel()},null),suffix:()=>this.fileList.length&&!this.disabled?u.createVNode(u.resolveComponent("ElIcon"),{class:"el-input__icon _fc-upload-icon",onClick:()=>{this.fileList=[],this.input()}},{default:()=>[u.createVNode(Jt,null,null)]}):null})},makeGroup(t){return(!this.maxLength||this.fileList.length<this.maxLength)&&t.push(this.makeBtn()),u.createVNode("div",{key:2},[t])},makeItem(t,e){return u.createVNode("div",{class:"_fc-files",key:"3"+t},[e])},valid(t){const e=this.formCreateInject.field||this.field;if(e&&t!==e)throw new Error("[frame]无效的字段值")},makeIcons(t,e){if(this.handleIcon!==!1||this.allowRemove===!0){const r=[];return(this.type!=="file"&&this.handleIcon!==!1||this.type==="file"&&this.handleIcon)&&r.push(this.makeHandleIcon(t,e)),this.allowRemove&&r.push(this.makeRemoveIcon(t,e)),u.createVNode("div",{class:"_fc-upload-cover",key:4},[r])}},makeHandleIcon(t,e){const r=u.resolveComponent(this.handleIcon===!0||this.handleIcon===void 0?"icon-view":this.handleIcon);return u.createVNode(u.resolveComponent("ElIcon"),{onClick:()=>this.handleClick(t),key:"5"+e},{default:()=>[u.createVNode(r,null,null)]})},makeRemoveIcon(t,e){return u.createVNode(u.resolveComponent("ElIcon"),{onClick:()=>this.handleRemove(t),key:"6"+e},{default:()=>[u.createVNode(ir,null,null)]})},makeFiles(){return this.makeGroup(this.fileList.map((t,e)=>this.makeItem(e,[u.createVNode(u.resolveComponent("ElIcon"),{onClick:()=>this.handleClick(t)},{default:()=>[u.createVNode(er,null,null)]}),this.makeIcons(t,e)])))},makeImages(){return this.makeGroup(this.fileList.map((t,e)=>this.makeItem(e,[u.createVNode("img",{src:this.getSrc(t)},null),this.makeIcons(t,e)])))},makeBtn(){const t=u.resolveComponent(this.icon);return u.createVNode("div",{class:"_fc-upload-btn",onClick:()=>this.showModel(),key:7},[u.createVNode(u.resolveComponent("ElIcon"),null,{default:()=>[u.createVNode(t,null,null)]})])},handleClick(t){if(this.onHandle)return this.onHandle(t);this.previewImage=this.getSrc(t),this.previewVisible=!0},handleRemove(t){this.disabled||this.onBeforeRemove(t)!==!1&&(this.fileList.splice(this.fileList.indexOf(t),1),this.input(),this.onRemove(t))},getSrc(t){return this.srcKey?t[this.srcKey]:t},frameLoad(t){this.onLoad(t);try{this.helper===!0&&(t.form_create_helper={api:this.formCreateInject.api,close:e=>{this.valid(e),this.closeModel()},set:(e,r)=>{this.valid(e),!this.disabled&&this.$emit("update:modelValue",r)},get:e=>(this.valid(e),this.modelValue),onOk:e=>this.bus.$on("$ok",e),onClose:e=>this.bus.$on("$close",e)})}catch(e){console.error(e)}},makeFooter(){const{okBtnText:t,closeBtnText:e,closeBtn:r,okBtn:n,footer:o}=this.$props;if(o)return u.createVNode("div",null,[r?u.createVNode(u.resolveComponent("ElButton"),{onClick:()=>this.onCancel()!==!1&&(this.frameVisible=!1)},{default:()=>[e||this.formCreateInject.t("close")||"关闭"]}):null,n?u.createVNode(u.resolveComponent("ElButton"),{type:"primary",onClick:()=>this.onOk()!==!1&&this.closeModel()},{default:()=>[t||this.formCreateInject.t("ok")||"确定"]}):null])}},render(){const t=this.type;let e;t==="input"?e=this.makeInput():t==="image"?e=this.makeImages():e=this.makeFiles();const{width:r="30%",height:n,src:o,title:i,modalTitle:s}=this.$props;return u.nextTick(()=>{this.$refs.frame&&this.frameLoad(this.$refs.frame.contentWindow||{})}),u.createVNode("div",{class:{"_fc-frame":!0,"_fc-disabled":this.disabled}},[e,u.createVNode(u.resolveComponent("ElDialog"),{appendToBody:!0,modal:this.previewMask,title:s,modelValue:this.previewVisible,onClose:this.handleCancel},{default:()=>[u.createVNode("img",{style:"width: 100%",src:this.previewImage},null)]}),u.createVNode(u.resolveComponent("ElDialog"),u.mergeProps({appendToBody:!0},C({width:r,title:i},this.modal),{modelValue:this.frameVisible,onClose:()=>this.closeModel(!0)}),{default:()=>[this.frameVisible||!this.reload?u.createVNode("iframe",{ref:"frame",src:o,frameBorder:"0",style:{height:n,border:"0 none",width:"100%"}},null):null],footer:()=>this.makeFooter()})])},beforeMount(){const{name:t,field:e,api:r}=this.formCreateInject;t&&r.on("fc:closeModal:"+t,this.close),e&&r.on("fc:closeModal:"+e,this.close)},beforeUnmount(){const{name:t,field:e,api:r}=this.formCreateInject;t&&r.off("fc:closeModal:"+t,this.close),e&&r.off("fc:closeModal:"+e,this.close)}}),pr=u.defineComponent({name:"fcRadio",inheritAttrs:!1,props:{formCreateInject:Object,modelValue:{type:[String,Number,Boolean],default:""},options:Array,type:String,input:Boolean,inputValue:String},emits:["update:modelValue","fc.el"],setup(t,e){const r=u.toRef(t.formCreateInject,"options",[]),n=u.toRef(t,"options"),o=u.toRef(t,"modelValue"),i=u.toRef(t,"inputValue",""),s=u.ref(i.value),a=u.toRef(t,"input",!1);u.watch(i,d=>{if(!a.value){s.value=d;return}f(d)});const l=u.computed(()=>{let d=r.value||[];return n.value&&(d=n.value||[]),Array.isArray(d)?d:[]});u.watch(o,d=>{let p=!1;!i.value&&d!=null&&a.value&&(p=l.value.map($=>$.value).indexOf(d)===-1),p&&(s.value=d)},{immediate:!0});const c=d=>{e.emit("update:modelValue",d)},f=d=>{const p=s.value;s.value=d,o.value===p&&c(d)};return{options:l,value:o,onInput:c,updateCustomValue:f,customValue:s,makeInput(d){if(a.value)return u.createVNode(d,{checked:!1,value:s.value||void 0,label:s.value||void 0},{default:()=>[u.createVNode(u.resolveComponent("ElInput"),{size:"small",modelValue:s.value,"onUpdate:modelValue":f},null)]})}}},render(){const t=this.type==="button"?"ElRadioButton":"ElRadio",e=u.resolveComponent(t);return u.createVNode(u.resolveComponent("ElRadioGroup"),u.mergeProps(this.$attrs,{modelValue:this.value,"onUpdate:modelValue":this.onInput,ref:"el"}),C({default:()=>{var r,n;return[this.options.map((o,i)=>{const s=C({},o),a=s.value,l=s.label;return delete s.value,delete s.label,u.createVNode(e,u.mergeProps(s,{label:a,value:a,key:t+i+"-"+a}),{default:()=>[l||a||""]})}),(n=(r=this.$slots).default)==null?void 0:n.call(r),this.makeInput(e)]}},M(this.$slots,["default"])))},mounted(){this.$emit("fc.el",this.$refs.el)}}),m={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&&!m.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=>{m[t]=function(e){return m.type(e,t)}});function E(t,e){return{}.hasOwnProperty.call(t,e)}const mr=u.defineComponent({name:"fcSelect",inheritAttrs:!1,props:{formCreateInject:Object,modelValue:{type:[Array,String,Number,Boolean,Object],default:void 0},type:String},emits:["update:modelValue","fc.el"],setup(t,{emit:e}){const r=u.toRef(t.formCreateInject,"options",[]),n=u.toRef(t,"modelValue");return{options:u.computed(()=>Array.isArray(r.value)?r.value:[]),value:n,handleUpdate:s=>{e("update:modelValue",s)},hasProperty:E,is:m}},mounted(){this.$emit("fc.el",this.$refs.el)}});function gr(t,e,r,n,o,i){const s=u.resolveComponent("el-option"),a=u.resolveComponent("el-option-group"),l=u.resolveComponent("el-select");return u.openBlock(),u.createBlock(l,u.mergeProps(t.$attrs,{"model-value":t.value,"onUpdate:modelValue":t.handleUpdate,ref:"el"}),{default:u.withCtx(()=>[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(t.options,(c,f)=>(u.openBlock(),u.createElementBlock(u.Fragment,null,[t.hasProperty(c,"options")?(u.openBlock(),u.createBlock(a,{label:c.label,key:`${f}-${c.label}`},{default:u.withCtx(()=>[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(t.is.trueArray(c.options)?c.options:[],(d,p)=>(u.openBlock(),u.createBlock(s,u.mergeProps({key:`${p}-${d.value}`},{ref_for:!0},d),null,16))),128))]),_:2},1032,["label"])):(u.openBlock(),u.createBlock(s,u.mergeProps({key:`${f}-${c.value}`},{ref_for:!0},c),null,16))],64))),256)),u.renderSlot(t.$slots,"default")]),_:3},16,["model-value","onUpdate:modelValue"])}const yr=ee(mr,[["render",gr]]),$r=u.defineComponent({name:"fcTree",inheritAttrs:!1,formCreateParser:{mergeProp(t){const e=t.prop.props;e.nodeKey||(e.nodeKey="id"),e.props||(e.props={label:"title"})}},props:{type:String,modelValue:{type:[Array,String,Number],default:()=>[]}},emits:["update:modelValue","fc.el"],watch:{modelValue(){this.setValue()}},methods:{updateValue(){if(!this.$refs.tree)return;let t;this.type==="selected"?t=this.$refs.tree.getCurrentKey():t=this.$refs.tree.getCheckedKeys(),this.$emit("update:modelValue",t)},setValue(){if(!this.$refs.tree)return;this.type==="selected"?this.$refs.tree.setCurrentKey(this.modelValue):this.$refs.tree.setCheckedKeys(L(this.modelValue))}},render(){return u.createVNode(u.resolveComponent("ElTree"),u.mergeProps(this.$attrs,{ref:"tree",onCheck:this.updateValue,onNodeClick:this.updateValue}),this.$slots)},mounted(){this.setValue(),this.$emit("fc.el",this.$refs.tree)}}),br={name:"IconUpload"},_r={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"};function Cr(t,e,r,n,o,i){return u.openBlock(),u.createElementBlock("svg",_r,[...e[0]||(e[0]=[u.createElementVNode("path",{fill:"currentColor",d:"M160 832h704a32 32 0 110 64H160a32 32 0 110-64zm384-578.304V704h-64V247.296L237.248 490.048 192 444.8 508.8 128l316.8 316.8-45.312 45.248L544 253.696z"},null,-1)])])}const wr=ee(br,[["render",Cr]]);function et(t,e){return typeof t=="object"?t:{url:t,is_string:!0,name:Vr(t),uid:e}}function tt(t){return q(C({},t),{file:t,value:t})}function Vr(t){return(""+t).split("/").pop()}const Sr=u.defineComponent({name:"fcUpload",inheritAttrs:!1,formCreateParser:{toFormValue(t){return L(t)},toValue(t,e){return e.prop.props.limit===1?t[0]||"":t}},props:{previewMask:void 0,onPreview:Function,httpRequest:Function,modalTitle:String,listType:String,uploadText:String,formCreateInject:Object,modelValue:[Array,String,Object]},emits:["update:modelValue","change","remove","fc.el"],data(){return{previewVisible:!1,previewImage:"",fileList:[]}},created(){this.fileList=L(this.modelValue).map(et).map(tt)},watch:{modelValue(t){this.fileList=L(t).map(et).map(tt)}},methods:{handlePreview(t){this.onPreview?this.onPreview(...arguments):this.listType==="text"?window.open(t.url):(this.previewImage=t.url,this.previewVisible=!0)},update(t){let e=t.map(r=>r.is_string?r.url:r.value||r.url).filter(r=>r!==void 0);this.$emit("update:modelValue",e)},handleCancel(){this.previewVisible=!1},handleChange(t,e){this.$emit("change",...arguments),t.status==="success"&&this.update(e)},handleRemove(t,e){this.$emit("remove",...arguments),this.update(e)},doHttpRequest(t){if(this.httpRequest)return this.httpRequest(t);t.source="upload",this.formCreateInject.api.fetch(t)}},render(){const t=L(this.modelValue).length;return u.createVNode("div",{class:"_fc-upload"},[u.createVNode(u.resolveComponent("ElUpload"),u.mergeProps({key:t},this.$attrs,{listType:this.listType||"picture-card",class:{"_fc-exceed":this.$attrs.limit?this.$attrs.limit<=t:!1},onPreview:this.handlePreview,onChange:this.handleChange,onRemove:this.handleRemove,httpRequest:this.doHttpRequest,fileList:this.fileList,ref:"upload"}),C({default:()=>{var e,r;return[((r=(e=this.$slots).default)==null?void 0:r.call(e))||(["text","picture"].indexOf(this.listType)===-1?u.createVNode(u.resolveComponent("ElIcon"),null,{default:()=>[u.createVNode(wr,null,null)]}):u.createVNode(u.resolveComponent("ElButton"),{type:"primary"},{default:()=>[this.formCreateInject.t("clickToUpload")||this.uploadText||"点击上传"]}))]}},M(this.$slots,["default"]))),u.createVNode(u.resolveComponent("ElDialog"),{appendToBody:!0,modal:this.previewMask,title:this.modalTitle,modelValue:this.previewVisible,onClose:this.handleCancel},{default:()=>[u.createVNode("img",{style:"width: 100%",src:this.previewImage},null)]})])},mounted(){this.$emit("fc.el",this.$refs.upload)}});function H(t,e,r){t[e]=r}function oe(t,e){delete t[e]}function ye(t,e={},r){let n=!1;for(let o in e)if(Object.prototype.hasOwnProperty.call(e,o)){let i=e[o];if((n=Array.isArray(i))||m.Object(i)){let s=t[o]===void 0;if(n)n=!1,s&&H(t,o,[]);else if(i._clone&&r!==void 0)if(r)i=i.getRule(),s&&H(t,o,{});else{H(t,o,i._clone());continue}else s&&H(t,o,{});t[o]=ye(t[o],i,r)}else H(t,o,i),m.Undef(i)||(m.Undef(i.__json)||(t[o].__json=i.__json),m.Undef(i.__origin)||(t[o].__origin=i.__origin))}return r!==void 0&&Array.isArray(t)?t.filter(o=>!o||!o.__ctrl):t}function G(t){return ye({},{value:t}).value}const kr=Object.assign||function(t){for(let e,r=1;r<arguments.length;r++)for(let n in e=arguments[r],e)Object.prototype.hasOwnProperty.call(e,n)&&H(t,n,e[n]);return t};function w(){return kr.apply(this,arguments)}function vr(t){return typeof t!="object"||t===null?t:t instanceof Array?[...t]:C({},t)}function te(t,e){var r=null;return function(...n){r!==null&&clearTimeout(r),r=setTimeout(()=>t.call(this,...n),e)}}function rt(t){return t==null?"":typeof t=="object"?JSON.stringify(t,null,2):String(t)}function Er(t){return t&&typeof t=="object"&&typeof t.then=="function"}function Ve(t){return Er(t)?t:Promise.resolve(t)}function $e(t){let e=t.replace(/([A-Z])/g,"-$1").toLocaleLowerCase();return e.indexOf("-")===0&&(e=e.substr(1)),e}function nt(t){return t.replace(t[0],t[0].toLocaleUpperCase())}function it(t,e,r){return`[form-create ${t}]: ${e}`}function je(t,e){console.error(it("err",t))}function Or(t){je(t.toString()),console.error(t)}const Pe="[[FORM-CREATE-PREFIX-",Ie="-FORM-CREATE-SUFFIX]]";function be(t,e){return JSON.stringify(ye(Array.isArray(t)?[]:{},t,!0),function(r,n){if(!(n&&n._isVue===!0)){if(typeof n!="function")return n;if(n.__json)return n.__json;if(n.__origin&&(n=n.__origin),!n.__emit)return Pe+n+Ie}},e)}function Ne(t){return new Function("return "+t)()}function Y(t,e){if(t&&m.String(t)&&t.length>4){let r=t.trim(),n=!1;try{if(r.indexOf(Ie)>0&&r.indexOf(Pe)===0)r=r.replace(Ie,"").replace(Pe,""),n=!0;else if(r.indexOf("$FN:")===0)r=r.substring(4),n=!0;else if(r.indexOf("$EXEC:")===0)r=r.substring(6),n=!0;else if(r.indexOf("$GLOBAL:")===0){const i=r.substring(8);return r=function(...s){const a=s[0].api.getGlobalEvent(i);if(a)return a.call(this,...s)},r.__json=t,r.__inject=!0,r}else{if(r.indexOf("$FNX:")===0)return r=Ne(`function($inject){
|
|
11
11
|
`+r.substring(5)+`
|
|
12
|
-
}`),r.__json=t,r.__inject=!0,r;(!e&&r.indexOf("function ")===0&&r!=="function "||!e&&r.indexOf("function(")===0&&r!=="function(")&&(n=!0)}if(!n)return t;let
|
|
12
|
+
}`),r.__json=t,r.__inject=!0,r;(!e&&r.indexOf("function ")===0&&r!=="function "||!e&&r.indexOf("function(")===0&&r!=="function(")&&(n=!0)}if(!n)return t;let o;try{o=Ne(r)}catch(i){o=Ne("function "+r)}return o.__json=t,o}catch(o){je(`解析失败:${r}
|
|
13
13
|
|
|
14
|
-
err: ${s}`);return}}return t}function it(t,e){return JSON.parse(t,function(r,n){return g.Undef(n)||!n.indexOf?n:Y(n,e)})}let kr=0;function we(){const t=370+ ++kr;return"F"+Math.random().toString(36).substr(3,3)+(+`${Date.now()}`).toString(36)+t.toString(36)+"c"}function re(t,e,r){let n=t,s;return(e||"").split(".").forEach(i=>{s&&((!n[s]||typeof n[s]!="object")&&(n[s]={}),n=n[s]),s=i}),n[s]=r,n}const Er=l.defineComponent({name:"fcGroup",props:{field:String,rule:Array,expand:Number,options:Object,button:{type:Boolean,default:!0},max:{type:Number,default:0},min:{type:Number,default:0},modelValue:{type:Array,default:()=>[]},defaultValue:Object,sortBtn:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},syncDisabled:{type:Boolean,default:!0},title:{type:[String,Function],default:null},type:{type:String,default:"default"},onBeforeRemove:{type:Function,default:()=>{}},onBeforeAdd:{type:Function,default:()=>{}},formCreateInject:Object,parse:Function},data(){return{len:0,cacheRule:{},cacheValue:{},sort:[],form:l.markRaw(this.formCreateInject.form.$form())}},emits:["update:modelValue","change","itemMounted","remove","add"],watch:{rule:{handler(t,e){Object.keys(this.cacheRule).forEach(r=>{const n=this.cacheRule[r];if(n.$f){const s=n.$f.formData();if(t===e)n.$f.deferSyncValue(()=>{me(n.rule,t),n.$f.setValue(s)},!0);else{const i=n.$f.formData();n.$f.once("reloading",()=>{n.$f.setValue(i)}),n.rule=G(t)}}})},deep:!0},expand(t){let e=t-this.modelValue.length;e>0&&this.expandRule(e)},modelValue:{handler(t){t=t||[];let e=this.sort,r=e.length,n=r-t.length;if(n<0){for(let s=n;s<0;s++)this.addRule(t.length+s,!0);for(let s=0;s<r;s++)this.setValue(e[s],t[s])}else{if(n>0)for(let s=0;s<n;s++)this.removeRule(e[r-s-1]);t.forEach((s,i)=>{this.setValue(e[i],t[i])})}},deep:!0}},methods:{_value(t){return t&&v(t,this.field)?t[this.field]:t},cache(t,e){this.cacheValue[t]=JSON.stringify(e)},input(t){this.$emit("update:modelValue",t),this.$emit("change",t)},formData(t,e){const r=this.cacheRule,n=this.sort;if(n.filter(i=>r[i]&&r[i].$f).length!==n.length)return;const s=n.map(i=>{const o=t===i?e:C({},this.cacheRule[i].$f.form),a=this.field?g.Undef(o[this.field])?null:o[this.field]:o;return this.cache(i,a),a});this.input(s)},setValue(t,e){const r=this.field;r&&(e={[r]:this._value(e)}),this.cacheValue[t]!==JSON.stringify(r?e[r]:e)&&(this.cacheRule[t].$f&&this.cacheRule[t].$f.coverValue(e),this.cache(t,e))},addRule(t,e){const r=this.formCreateInject.form.copyRules(this.rule||[]),n=this.options?C({},this.options):{submitBtn:!1,resetBtn:!1};if(this.defaultValue){n.formData||(n.formData={});const s=G(this.defaultValue);w(n.formData,this.field?{[this.field]:s}:s)}this.parse&&this.parse({rule:r,options:n,index:this.sort.length}),this.cacheRule[++this.len]={rule:r,options:n},this.sort=Object.keys(this.cacheRule),e&&l.nextTick(()=>this.$emit("add",r,Object.keys(this.cacheRule).length-1))},add$f(t,e,r){this.cacheRule[e].$f=r,l.nextTick(()=>{this.$emit("itemMounted",r,Object.keys(this.cacheRule).indexOf(e))})},removeRule(t,e){const r=Object.keys(this.cacheRule).indexOf(t);delete this.cacheRule[t],delete this.cacheValue[t],this.sort=Object.keys(this.cacheRule),e&&l.nextTick(()=>this.$emit("remove",r))},add(t){if(this.disabled||this.onBeforeAdd(this.modelValue)===!1)return;const e=[...this.modelValue];e.push(this.defaultValue?G(this.defaultValue):this.field?null:{}),this.input(e)},del(t,e){if(this.disabled)return;const r=()=>{this.removeRule(e,!0);const n=[...this.modelValue];n.splice(t,1),this.input(n)};Ce(this.onBeforeRemove(this.modelValue,t)).then(n=>{n!==!1&&r()})},addIcon(t){return l.createVNode("div",{class:"_fc-group-btn _fc-group-plus-minus",onClick:this.add},null)},delIcon(t,e){return l.createVNode("div",{class:"_fc-group-btn _fc-group-plus-minus _fc-group-minus",onClick:()=>this.del(t,e)},null)},sortUpIcon(t){return l.createVNode("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-up",onClick:()=>this.changeSort(t,-1)},null)},sortDownIcon(t){return l.createVNode("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-down",onClick:()=>this.changeSort(t,1)},null)},changeSort(t,e){const r=this.sort[t];this.sort[t]=this.sort[t+e],this.sort[t+e]=r,this.formCreateInject.subForm(this.sort.map(n=>this.cacheRule[n].$f)),this.formData(0)},sortIcon(t,e){const r=t>0,n=t<e-1,s=[];return!r&&!n?s:this.type==="card"&&r&&n?(s.push(l.createVNode("div",{class:"_fc-group-btn _fc-group-sort"},[l.createVNode("div",{class:" _fc-group-sort-up",onClick:()=>this.changeSort(t,-1)},null),l.createVNode("div",{class:" _fc-group-sort-down",onClick:()=>this.changeSort(t,1)},null)])),s):(r&&s.push(this.sortUpIcon(t)),n&&s.push(this.sortDownIcon(t)),s)},makeIcon(t,e,r){if(this.$slots.button)return this.$slots.button({total:t,index:e,vm:this,key:r,del:()=>this.del(e,r),add:this.add});const n=[];if((!this.max||t<this.max)&&t===e+1&&n.push(this.addIcon(r)),t>this.min&&n.push(this.delIcon(e,r)),this.sortBtn){const s=this.sortIcon(e,t);s&&n.push(...s)}return n},expandRule(t){for(let e=0;e<t;e++)this.modelValue.push(this.field?null:{});this.input([...this.modelValue])},getTitle(t,e){return typeof this.title=="function"?this.title(t,this.modelValue[t],e):typeof this.title=="string"?this.title.replace("{index}",t+1):!1}},created(){const t=(this.expand||0)-this.modelValue.length;for(let e=0;e<this.modelValue.length;e++)this.addRule(e);t>0&&this.expandRule(t)},render(){const t=this.sort,e=this.button,r=this.form,n=this.disabled,s=this.type==="card",i=t.length===0?this.$slots.default?this.$slots.default({vm:this,add:this.add}):l.createVNode("div",{key:"a_def",class:"_fc-group-plus-minus _fc-group-add fc-clock",onClick:this.add},null):t.map((o,a)=>{const{rule:u,options:c}=this.cacheRule[o],f=e&&!n?this.makeIcon(t.length,a,o):[],h=this.getTitle(a,o);return s?l.createVNode("div",{class:"_fc-group-container",key:o},[l.createVNode("div",{class:"_fc-group-header"},[h===!1?l.createVNode("div",{class:"_fc-group-idx"},[a+1]):null,h!==!1?l.createVNode("div",{class:"_fc-group-title"},[h]):null,l.createVNode("div",{class:"_fc-group-handle fc-clock"},[f.length?f:null])]),l.createVNode("div",{class:"_fc-group-content"},[l.createVNode(r,l.mergeProps({key:o},q(C({},this.$attrs),{disabled:n,"onUpdate:modelValue":p=>this.formData(o,p),"onUpdate:api":p=>this.add$f(a,o,p),inFor:!0,modelValue:this.field?{[this.field]:this._value(this.modelValue[a])}:this.modelValue[a],rule:u,option:c,extendOption:!0})),null)])]):l.createVNode("div",{class:"_fc-group-container",key:o},[l.createVNode(r,l.mergeProps({key:o},q(C({},this.$attrs),{disabled:n,"onUpdate:modelValue":p=>this.formData(o,p),"onUpdate:api":p=>this.add$f(a,o,p),inFor:!0,modelValue:this.field?{[this.field]:this._value(this.modelValue[a])}:this.modelValue[a],rule:u,option:c,extendOption:!0})),null),l.createVNode("div",{class:"_fc-group-idx"},[a+1]),f.length?l.createVNode("div",{class:"_fc-group-handle fc-clock"},[f]):null])});return l.createVNode("div",{key:"con",class:"_fc-group "+(n?"_fc-group-disabled":"")+(s?" _fc-group-card":"")},[i])}}),Rr=l.defineComponent({name:"fcSubForm",props:{rule:Array,options:{type:Object,default:()=>l.reactive({submitBtn:!1,resetBtn:!1})},modelValue:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1},syncDisabled:{type:Boolean,default:!0},formCreateInject:Object},data(){return{cacheValue:{},subApi:{},form:l.markRaw(this.formCreateInject.form.$form())}},emits:["fc:subform","update:modelValue","change","itemMounted"],watch:{modelValue(t){this.setValue(t)}},methods:{formData(t){this.cacheValue=JSON.stringify(t),this.$emit("update:modelValue",t),this.$emit("change",t)},setValue(t){const e=JSON.stringify(t);this.cacheValue!==e&&(this.cacheValue=e,this.subApi.coverValue(t||{}))},add$f(t){this.subApi=t,l.nextTick(()=>{this.$emit("itemMounted",t)})}},render(){const t=this.form;return l.createVNode(t,{disabled:this.disabled,"onUpdate:modelValue":this.formData,modelValue:this.modelValue,"onUpdate:api":this.add$f,rule:this.rule,option:this.options,extendOption:!0},null)}}),Fr={name:"IconWarning"},Or={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"};function vr(t,e,r,n,s,i){return l.openBlock(),l.createElementBlock("svg",Or,[...e[0]||(e[0]=[l.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 110 896 448 448 0 010-896zm0 832a384 384 0 000-768 384 384 0 000 768zm48-176a48 48 0 11-96 0 48 48 0 0196 0zm-48-464a32 32 0 0132 32v288a32 32 0 01-64 0V288a32 32 0 0132-32z"},null,-1)])])}const Dr=[qt,cr,fr,pr,mr,Cr,Er,Rr,ee(Fr,[["render",vr]])],st=["props"],ot=["class","style","directives"],at=["on","hook"],X=(t,e={},r={})=>{const n=[...st,...r.normal||[]],s=[...ot,...r.array||[]],i=[...at,...r.functional||[]],o=r.props||[];return t.reduce((a,u)=>{for(const c in u)if(a[c])if(o.indexOf(c)>-1)a[c]=X([u[c]],a[c]);else if(n.indexOf(c)>-1)a[c]=C(C({},a[c]),u[c]);else if(s.indexOf(c)>-1){const f=a[c]instanceof Array?a[c]:[a[c]],h=u[c]instanceof Array?u[c]:[u[c]];a[c]=[...f,...h]}else if(i.indexOf(c)>-1)for(const f in u[c])if(a[c][f]){const h=a[c][f]instanceof Array?a[c][f]:[a[c][f]],p=u[c][f]instanceof Array?u[c][f]:[u[c][f]];a[c][f]=[...h,...p]}else a[c][f]=u[c][f];else if(c==="hook")for(let f in u[c])a[c][f]?a[c][f]=Ar(a[c][f],u[c][f]):a[c][f]=u[c][f];else a[c]=u[c];else n.indexOf(c)>-1||i.indexOf(c)>-1||o.indexOf(c)>-1?a[c]=C({},u[c]):s.indexOf(c)>-1?a[c]=u[c]instanceof Array?[...u[c]]:typeof u[c]=="object"?C({},u[c]):u[c]:a[c]=u[c];return a},e)},Ar=(t,e)=>function(){t&&t.apply(this,arguments),e&&e.apply(this,arguments)},lt=["type","slot","ignore","emitPrefix","value","name","native","hidden","display","inject","options","emit","link","prefix","suffix","update","sync","optionsTo","key","slotUpdate","computed","preview","component","cache","modelEmit"],Ne=["validate","children","control"],Be=["effect","deep","renderSlots"];function ut(){return[...lt,...st,...ot,...at,...Ne,...Be]}function L(t){const e=t.replace(/(-[a-z])/g,function(r){return r.replace("-","").toLocaleUpperCase()});return ct(e)}function ct(t){return t.replace(t[0],t[0].toLowerCase())}function Te(t,e){return{value:t,enumerable:!1,configurable:!1,writable:!0}}function ft(t,e){return dt([t],e||!1)[0]}function dt(t,e){return me([],[...t],e||!1)}function Z(t,e){return X(Array.isArray(e)?e:[e],t,{array:Ne,normal:Be}),t}function ht(t){const e=g.Function(t.getRule)?t.getRule():t;return e.type||(e.type="input"),e}function jr(t,e){return t?(Object.keys(e||{}).forEach(r=>{e[r]&&(t[r]=Z(t[r]||{},e[r]))}),t):e}function pt(t,e){Object.defineProperties(t,Object.keys(e).reduce((r,n)=>(r[n]={get(){return e[n]()}},r),{}))}function W(t){return t.__fc__||(t.__origin__?t.__origin__.__fc__:null)}function k(t,e){try{e=t()}catch(r){Sr(r)}return e}function Ve(){const t={},e=r=>r||"default";return{setSlot(r,n){r=e(r),!(!n||Array.isArray(n)&&n.length)&&(t[r]||(t[r]=[]),t[r].push(n))},getSlot(r,n){r=e(r);const s=[];return(t[r]||[]).forEach(i=>{if(Array.isArray(i))s.push(...i);else if(g.Function(i)){const o=i(...n||[]);Array.isArray(o)?s.push(...o):s.push(o)}else g.Undef(i)||s.push(i)}),s},getSlots(){const r={};return Object.keys(t).forEach(n=>{r[n]=(...s)=>this.getSlot(n,s)}),r},slotLen(r){return r=e(r),t[r]?t[r].length:0},mergeBag(r){if(!r)return this;const n=g.Function(r.getSlots)?r.getSlots():r;return Array.isArray(r)||l.isVNode(r)?this.setSlot(void 0,()=>r):Object.keys(n).forEach(s=>{this.setSlot(s,n[s])}),this}}}function mt(t){const e=C({},t.props||{});return Object.keys(t.on||{}).forEach(r=>{r.indexOf("-")>0&&(r=L(r));const n=`on${rt(r)}`;Array.isArray(e[n])?e[n]=[...e[n],t.on[r]]:e[n]?e[n]=[e[n],t.on[r]]:e[n]=t.on[r]}),e.key=t.key,e.ref=t.ref,e.class=t.class,e.id=t.id,e.style=t.style,e.slot&&delete e.slot,e}function Se(t,e){return Object.setPrototypeOf(t,e),t}const gt=(t,e)=>typeof t=="string"?String(e):typeof t=="number"?Number(e):e,le={"==":(t,e)=>JSON.stringify(t)===JSON.stringify(gt(t,e)),"!=":(t,e)=>!le["=="](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(gt(t[0],e))>-1},notOn(t,e){return!le.on(t,e)},in(t,e){return e&&e.indexOf&&e.indexOf(t)>-1},notIn(t,e){return!le.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 g.empty(t)},notEmpty(t){return!g.empty(t)},pattern(t,e){return new RegExp(e,"g").test(t)}};function N(t,e){return(Array.isArray(e)?e:(e||"").split(".")).forEach(r=>{t!=null&&(t=t[r])}),t}function Ir(t){const e=/{{\s*(.*?)\s*}}/g;let r;const n={};for(;(r=e.exec(t))!==null;)r[1]&&(n[r[1]]=!0);return Object.keys(n)}function yt(t){let e=t.split("."),r=[],n="";return e.forEach((s,i)=>{i===0?n=s:n+="."+s,r.push(n)}),r.join(" && ")}function $t(t){const e=[];let r="",n=0;for(let s=0;s<t.length;s++){const i=t[s];i==="["?(n===0&&r&&(e.push({type:"key",value:r}),r=""),n++,r+=i):i==="]"?(n--,r+=i,n===0&&(e.push({type:"bracket",value:$t(r.slice(1,-1))}),r="")):i==="."&&n===0?r&&(e.push({type:"key",value:r}),r=""):r+=i}return r&&e.push({type:"key",value:r}),e.map(s=>s.type==="key"?{key:s.value}:{children:s.value})}const ke=(t,e)=>{if(!(!t||t===e)){if(t.props.formCreateInject)return t.props.formCreateInject;if(t.parent)return ke(t.parent,e)}};function Pr(t,e,r){return l.defineComponent({name:"FormCreate"+(t.isMobile?"Mobile":""),components:e,directives:r,props:{rule:{type:Array,required:!0,default:()=>[]},option:{type:Object,default:()=>({})},extendOption:Boolean,driver:[String,Object],modelValue:Object,disabled:{type:Boolean,default:void 0},preview:{type:Boolean,default:void 0},index:[String,Number],api:Object,locale:[String,Object],t:Function,name:String,subForm:{type:Boolean,default:!0},inFor:Boolean},emits:["update:api","update:modelValue","mounted","beforeUnmount","submit","reset","change","emit-event","control","remove-rule","remove-field","sync","reload","repeat-field","update","validate-field-fail","validate-fail","created"],render(){return this.fc.render()},setup(n){const s=l.getCurrentInstance();l.provide("parentFC",s);const i=l.inject("parentFC",null);let o=i;if(i)for(;o.setupState.parent;)o=o.setupState.parent;else o=s;const{rule:a,modelValue:u,subForm:c,inFor:f}=l.toRefs(n),h=l.reactive({ctxInject:{},destroyed:!1,isShow:!0,unique:1,renderRule:[...a.value||[]],updateValue:JSON.stringify(u.value||{})}),p=new t(s),m=p.api(),_=f.value,V=()=>{if(i){const F=ke(s,i);if(F){let D;_?(D=M(F.getSubForm()),D.push(m)):D=m,F.subForm(D)}}},E=()=>{const F=ke(s,i);if(F)if(_){const D=M(F.getSubForm()),x=D.indexOf(m);x>-1&&D.splice(x,1)}else F.subForm()};let j=null;l.onBeforeMount(()=>{l.watchEffect(()=>{let F="";const D=n.option&&n.option.globalClass||{};Object.keys(D).forEach(x=>{let pe="";D[x].style&&Object.keys(D[x].style).forEach(Re=>{pe+=ge(Re)+":"+D[x].style[Re]+";"}),D[x].content&&(pe+=D[x].content+";"),pe&&(F+=`.${x}{${pe}}`)}),n.option&&n.option.style&&(F+=n.option.style),j||(j=document.createElement("style"),j.type="text/css",document.head.appendChild(j)),j.innerHTML=F||""})});const U=te(()=>{p.bus.$emit("$loadData.$topForm")},100),B=te(function(){p.bus.$emit("$loadData.$scopeForm")},100),Je=te(()=>{p.bus.$emit("$loadData.$form")},100),Ee=F=>{p.bus.$emit("change-$form."+F)};return l.onMounted(()=>{i&&(m.top.bus.$on("$loadData.$form",U),m.top.bus.$on("change",Ee)),m!==m.scope&&m.scope.bus.$on("$loadData.$scopeForm",B),p.mounted()}),l.onBeforeUnmount(()=>{i&&(m.top.bus.$off("$loadData.$form",U),m.top.bus.$off("change",Ee)),m!==m.scope&&m.scope.bus.$off("$loadData.$scopeForm",B),E(),h.destroyed=!0,p.unmount(),j&&(j.parentNode||j.parentElement)&&document.head.removeChild(j)}),l.onUpdated(()=>{p.updated()}),V(),l.watch(()=>n.option,()=>{p.initOptions(),m.refresh()},{deep:!0,flush:"sync"}),l.watch(()=>[...a.value],F=>{p.$handle.isBreakWatch()||F.length===h.renderRule.length&&F.every(D=>h.renderRule.indexOf(D)>-1)||(p.$handle.updateAppendData(),p.$handle.reloadRule(a.value),s.setupState.renderRule())}),l.watch(()=>[n.disabled,n.preview],()=>{m.refresh()}),l.watch(u,F=>{ye(F||{})!==h.updateValue&&(m.config.forceCoverValue?m.coverValue(F||{}):m.setValue(F||{}))},{deep:!0,flush:"post"}),l.watch(()=>n.index,()=>{m.coverValue({}),p.$handle.updateAppendData(),l.nextTick(()=>{l.nextTick(()=>{m.clearValidateState()})})},{flush:"sync"}),q(C({fc:l.markRaw(p),parent:i&&l.markRaw(i),top:l.markRaw(o),fapi:l.markRaw(m)},l.toRefs(h)),{getGroupInject:()=>ke(s,i),refresh(){++h.unique},renderRule(){h.renderRule=[...a.value||[]]},updateValue(F){if(h.destroyed)return;const D=ye(F);h.updateValue!==D&&(h.updateValue=D,s.emit("update:modelValue",F),l.nextTick(()=>{Je(),i?c.value||B():(U(),B())}))}})},created(){const n=l.getCurrentInstance();n.emit("update:api",n.setupState.fapi),n.setupState.fc.init()}})}function bt(){return{props:{},on:{},options:[],children:[],hidden:!1,display:!0,value:void 0}}function P(t,e){return(r,n,s,i={})=>{const o=new Me(t,r,n,s,i);return e&&(g.Function(e)?e(o):o.props(e)),o}}function Me(t,e,r,n,s){this._data=w(bt(),{type:t,title:e,field:r,value:n,props:s||{}}),this.event=this.on}w(Me.prototype,{getRule(){return this._data},setProp(t,e){return H(this._data,t,e),this},modelField(t){return this._data.modelField=t,this},_clone(){const t=new this.constructor;return t._data=ft(this._data),t}});function _t(t){t.forEach(e=>{Me.prototype[e]=function(r){return Z(this._data,{[e]:arguments.length<2?r:{[r]:arguments[1]}}),this}})}_t(ut());const Nr=P("");function Br(t,e,r){let n=Nr("",e);return n._data.type=t,n._data.title=r,n}function Tr(){return{create:Br,factory:P}}function Mr(t,e,r){const n=`fail to ${t} ${r.status}'`,s=new Error(n);return s.status=r.status,s.url=t,s}function Ct(t){const e=t.responseText||t.response;if(!e)return e;try{return JSON.parse(e)}catch(r){return e}}function wt(t){if(typeof XMLHttpRequest=="undefined")return;const e=new XMLHttpRequest;let r=t.action||"";if(e.upload&&t.onProgress&&e.upload.addEventListener("progress",i=>{i.percent=i.total>0?i.loaded/i.total*100:0,t.onProgress(i)}),t.query){const i=g.String(t.query)?t.query:Object.keys(t.query).reduce((a,u)=>(a[u]=t.query[u]===null||t.query[u]===void 0?"":t.query[u],a),{}),o=new URLSearchParams(i).toString();o&&(r.includes("?")?r+=`&${o}`:r+=`?${o}`)}e.onerror=function(o){t.onError(o)},e.onload=function(){if(e.status<200||e.status>=300)return t.onError(Mr(r,t,e),Ct(e));t.onSuccess(Ct(e))},e.open(t.method||"get",r,!0);let n;(t.data||t.file)&&(t.file||(t.dataType||"").toLowerCase()!=="json"?(n=new FormData,Object.keys(t.data||{}).map(i=>{n.append(i,t.data[i])})):(n=JSON.stringify(t.data||{}),e.setRequestHeader("content-type","application/json"))),t.file&&n.append(t.filename,t.file,t.file.name),t.withCredentials&&"withCredentials"in e&&(e.withCredentials=!0);const s=t.headers||{};Object.keys(s).forEach(i=>{s[i]!=null&&e.setRequestHeader(i,s[i])}),e.send(n)}function Vt(t,e,r){return new Promise((n,s)=>{(e||wt)(q(C({},t),{onSuccess(i){let o=u=>u;const a=Y(t.parse);g.Function(a)?o=a:a&&g.String(a)&&(o=u=>N(u,a)),Ce(o(i,t.targetRule,r)).then(u=>{n(u)})},onError(i){s(i)}}))})}function $e(t){return G(t)}function Lr(t){function e(i){return g.Undef(i)?i=t.fields():Array.isArray(i)||(i=[i]),i}function r(i,o,a){g.Undef(i)?i=Object.keys(C(C({},t.fieldCtx),t.nameCtx)):Array.isArray(i)||(i=[i]),i.forEach(u=>{const c=t.fieldCtx[u]||t.nameCtx[u];c&&c.forEach(f=>{H(f.rule,o,a),t.$render.clearCache(f)})})}function n(){const i=t.subForm;return Object.keys(i).reduce((o,a)=>{const u=i[a];return u&&(Array.isArray(u)?o.push(...u):o.push(u)),o},[])}const s={get isScope(){return t.vm.props.subForm===!1},get isPreview(){return t.preview},get config(){return t.options},set config(i){t.fc.options.value=i},get options(){return t.options},set options(i){t.fc.options.value=i},get form(){return t.form},get rule(){return t.rules},get parent(){return t.vm.setupState.parent&&t.vm.setupState.parent.setupState.fapi},get top(){return s.parent?s.parent.top:s},get scope(){let i=t.vm;for(;i&&i.setupState.fapi;)if(i.props.subForm)i=i.setupState.parent;else return i.setupState.fapi;return s.top},get children(){return n()},get siblings(){const i=t.vm.setupState.getGroupInject();if(i){const o=i.getSubForm();if(Array.isArray(o))return[...o]}},get index(){const i=s.siblings;if(i){const o=i.indexOf(s);return o>-1?o:void 0}},get formulas(){return C({},t.fc.formulas)},formData(i){if(i==null||typeof i=="boolean"){const o={};return Object.keys(t.form).forEach(a=>{(i===!0||t.ignoreFields.indexOf(a)===-1)&&(o[a]=$e(t.form[a]))}),o}else return e(i).reduce((o,a)=>(o[a]=s.getValue(a),o),{})},getValue(i){const o=t.getFieldCtx(i);return o?$e(o.rule.value):t.options.appendValue!==!1&&v(t.appendData,i)?$e(t.appendData[i]):void 0},coverValue(i){const o=C({},i||{});t.deferSyncValue(()=>{t.appendData={},s.fields().forEach(a=>{const u=t.fieldCtx[a];if(u){const c=v(i,a);u.forEach(f=>{f.rule.value=c?i[a]:void 0}),delete o[a]}}),w(t.appendData,o)},!0)},setValue(i){let o=i;arguments.length>=2&&(o={[i]:arguments[1]}),t.deferSyncValue(()=>{Object.keys(o).forEach(a=>{const u=t.fieldCtx[a];if(!u)return t.appendData[a]=o[a];u.forEach(c=>{c.rule.value=o[a]})})},!0)},removeField(i){const o=t.getCtx(i);return t.deferSyncValue(()=>{t.getCtxs(i).forEach(a=>{a.rm()})},!0),o?o.origin:void 0},removeRule(i){const o=i&&W(i);if(o)return o.rm(),o.origin},fields:()=>t.fields(),append:(i,o,a)=>{let u=t.sort.length-1,c;const f=t.getCtx(o);if(f)if(a){if(c=f.getPending("children",f.rule.children),!Array.isArray(c))return;u=f.rule.children.length-1}else u=f.root.indexOf(f.origin),c=f.root;else c=t.rules;c.splice(u+1,0,i)},prepend:(i,o,a)=>{let u=0,c;const f=t.getCtx(o);if(f)if(a){if(c=f.getPending("children",f.rule.children),!Array.isArray(c))return}else u=f.root.indexOf(f.origin),c=f.root;else c=t.rules;c.splice(u,0,i)},hidden(i,o){r(o,"hidden",!!i),t.refresh()},hiddenStatus(i){const o=t.getCtx(i);if(o)return!!o.rule.hidden},display(i,o){r(o,"display",!!i),t.refresh()},displayStatus(i){const o=t.getCtx(i);if(o)return!!o.rule.display},disabled(i,o){e(o).forEach(a=>{t.getCtxs(a).forEach(u=>{H(u.rule.props,"disabled",!!i)})}),t.refresh()},all(i){return Object.keys(t.ctxs).map(o=>{const a=t.ctxs[o];return i?a.origin:a.rule})},model(i){return t.fields().reduce((o,a)=>{const u=t.fieldCtx[a][0];return o[a]=i?u.origin:u.rule,o},{})},component(i){return Object.keys(t.nameCtx).reduce((o,a)=>{const u=t.nameCtx[a].map(c=>i?c.origin:c.rule);return o[a]=u.length===1?u[0]:u,o},{})},bind(){return s.form},reload:i=>{t.reloadRule(i)},updateOptions(i){t.fc.updateOptions(i),s.refresh()},onSubmit(i){s.updateOptions({onSubmit:i})},sync:i=>{if(Array.isArray(i)){i.forEach(a=>s.sync(a));return}let o=g.Object(i)?W(i):t.getCtxs(i);o&&(o=Array.isArray(o)?o:[o],o.forEach(a=>{if(!a.deleted){const u=t.subForm[a.id];u&&(Array.isArray(u)?u.forEach(c=>{c.refresh()}):u&&u.refresh()),t.$render.clearCache(a)}}),t.refresh())},refresh:()=>{n().forEach(i=>{i.refresh()}),t.$render.clearCacheAll(),t.refresh()},refreshOptions(){t.$manager.updateOptions(t.options),s.refresh()},hideForm:i=>{t.vm.setupState.isShow=!i},changeStatus:()=>t.changeStatus,clearChangeStatus:()=>{t.changeStatus=!1},updateRule(i,o){t.getCtxs(i).forEach(a=>{w(a.rule,o)})},updateRules(i){Object.keys(i).forEach(o=>{s.updateRule(o,i[o])})},mergeRule:(i,o)=>{t.getCtxs(i).forEach(a=>{Z(a.rule,o)})},mergeRules(i){Object.keys(i).forEach(o=>{s.mergeRule(o,i[o])})},getRule:(i,o)=>{const a=t.getCtx(i);if(a)return o?a.origin:a.rule},findType(i,o){let a;return Object.keys(t.ctxs).forEach(u=>{const c=t.ctxs[u];c.rule.type===i&&(a=o?c.origin:c.rule)}),a},findTypes(i,o){let a=[];return Object.keys(t.ctxs).forEach(u=>{const c=t.ctxs[u];c.rule.type===i&&a.push(o?c.origin:c.rule)}),a},getRenderRule:i=>{const o=t.getCtx(i);if(o)return o.prop},getRefRule:i=>{const o=t.getCtxs(i);if(o){const a=o.map(u=>u.rule);return a.length===1?a[0]:a}},setEffect(i,o,a){const u=t.getCtx(i);u&&o&&(o[0]==="$"&&(o=o.substr(1)),v(u.rule,"$"+o)&&H(u.rule,"$"+o,a),v(u.rule,"effect")||(u.rule.effect={}),H(u.rule.effect,o,a))},clearEffectData(i,o){const a=t.getCtx(i);a&&(o&&o[0]==="$"&&(o=o.substr(1)),a.clearEffectData(o),s.sync(i))},updateValidate(i,o,a){a?s.mergeRule(i,{validate:o}):r(i,"validate",o)},updateValidates(i,o){Object.keys(i).forEach(a=>{s.updateValidate(a,i[a],o)})},refreshValidate(){s.refresh()},resetFields(i){e(i).forEach(o=>{t.getCtxs(o).forEach(a=>{t.$render.clearCache(a),a.rule.value=$e(a.defaultValue)})}),l.nextTick(()=>{l.nextTick(()=>{l.nextTick(()=>{s.clearValidateState(i)})})}),i==null&&(g.Function(t.options.onReset)&&k(()=>t.options.onReset(s)),t.vm.emit("reset",s))},method(i,o){const a=s.el(i);if(!a||!a[o])throw new Error(nt("err",`${o} 方法不存在`));return(...u)=>a[o](...u)},exec(i,o,...a){return k(()=>s.method(i,o)(...a))},toJson(i){return ye(s.rule,i)},trigger(i,o,...a){const u=s.el(i);u&&u.$emit(o,...a)},el(i){const o=t.getCtx(i);if(o)return o.el||t.vm.refs[o.ref]},scrollTo(i,o={block:"center",inline:"nearest",behavior:"smooth"}){const a=s.el(i);if(!a)return;const u=a.$el!==void 0?a.$el:a;if(!u)return;const c=u.nodeType===1?u:u.firstElementChild;c&&typeof c.scrollIntoView=="function"&&c.scrollIntoView(o)},focus(i){const o=s.el(i);if(!o)return;const a=h=>!h||typeof h.focus!="function"?!1:(k(()=>h.focus()),!0);if(a(o))return;const u=o.$el!==void 0?o.$el:o;if(a(u))return;const c=u&&(u.nodeType===1?u:u.firstElementChild);if(a(c)||!c||!c.querySelector)return;const f=c.querySelector('input:not([type=hidden]):not([disabled]),textarea:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])');a(f)},closeModal:i=>{t.bus.$emit("fc:closeModal:"+i)},getSubForm(i){const o=t.getCtx(i);return o?t.subForm[o.id]:void 0},getChildrenRuleList(i){const o=typeof i=="object",a=o?W(i):t.getCtx(i),u=a?a.rule:o?i:s.getRule(i);if(!u)return[];const c=[];return(h=>{h&&h.forEach(p=>{typeof p=="object"&&(p.field&&c.push(p),c.push(...s.getChildrenRuleList(p)))})})(a?a.loadChildrenPending():u.children),c},getParentRule(i){return(typeof i=="object"?W(i):t.getCtx(i)).parent.rule},getParentSubRule(i){const a=typeof i=="object"?W(i):t.getCtx(i);if(a){const u=a.getParentGroup();if(u)return u.rule}},getChildrenFormData(i,o){return s.getChildrenRuleList(i).reduce((u,c)=>((c.ignore!==!0||o===!0)&&(u[c.field]=$e(c.value)),u),{})},setChildrenFormData(i,o,a){const u=s.getChildrenRuleList(i);t.deferSyncValue(()=>{u.forEach(c=>{v(o,c.field)?c.value=o[c.field]:a&&(c.value=void 0)})})},getGlobalEvent(i){let o=s.options.globalEvent[i];if(o)return typeof o=="object"&&(o=o.handle),Y(o)},getGlobalData(i){return new Promise((o,a)=>{let u=s.options.globalData[i];u?u.type==="fetch"?s.fetch(u).then(c=>{o(c)}).catch(a):o(u.data):o(t.fc.loadData[i])})},emitGlobalEvent(i,...o){const a=s.getGlobalEvent(i);if(a){const u=t.getInjectData({},void 0);return u.args=[...o],o.unshift(u),a.apply(null,o)}},setGlobalData(i,o){s.setData("$globalData."+i,o)},setGlobalVar(i,o){s.setData("$var."+i,o)},renderRule(i,o,a){const c=typeof i=="object"?W(i):t.getCtx(i);return c?t.$render.createRuleVnode(c,o,a):void 0},renderChildren(i,o,a){const c=typeof i=="object"?W(i):t.getCtx(i);return c?t.$render.createChildrenVnodes(c,o,a):void 0},nextTick(i){t.bus.$once("next-tick",i),t.refresh()},nextRefresh(i){t.nextRefresh(),i&&k(i)},deferSyncValue(i,o){t.deferSyncValue(i,o)},emit(i,...o){t.vm.emitsOptions&&!t.vm.emitsOptions[i]&&(t.vm.emitsOptions[i]=null),t.vm.emit(i,...o)},bus:t.bus,getCurrentFormRule(){var i;return(i=t.vm.setupState.getGroupInject())==null?void 0:i.rule},fetch(i){return new Promise((o,a)=>{let u=C({},i);u=t.loadFetchVar(u);const c=f=>{k(()=>u.onError&&u.onError(f)),a(f)};t.beforeFetch(u).then(()=>Vt(u,t.fc.create.fetch,s).then(f=>{k(()=>u.onSuccess&&u.onSuccess(f)),o(f)}).catch(f=>{c(f)})).catch(f=>{c(f)})})},watchFetch(i,o,a,u){return t.fc.watchLoadData((c,f)=>{let h=C({},i);if(h=t.loadFetchVar(h,c),u&&u(h,f)===!1)return;const p=m=>{k(()=>h.onError&&h.onError(m)),a&&a(m)};t.beforeFetch(h).then(()=>Vt(h,t.fc.create.fetch,s).then(m=>{k(()=>h.onSuccess&&h.onSuccess(m)),o&&o(m,f)}).catch(m=>{p(m)})).catch(m=>{p(m)})},i.wait==null?1e3:i.wait)},getData(i,o){return t.fc.get?t.fc.get(i,o):t.fc.getLoadData(i,o)},watchData(i){return t.fc.watchLoadData((o,a)=>{k(()=>i(o,a))})},setData(i,o,a){return t.fc.setData(i,o,a)},refreshData(i){return t.fc.refreshData(i)},t(i,o){return t.fc.t(i,o)},getLocale(){return t.fc.getLocale()},helper:{tidyFields:e,props:r}};return["on","once","off"].forEach(i=>{s[i]=function(...o){t.bus[`$${i}`](...o)}}),s.changeValue=s.changeField=s.setValue,s}function Ur(t){w(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,n){this.cache[e.id]={vnode:r,use:!1,parent:n,slot:e.rule.slot}},getCache(e){const r=this.cache[e.id];if(r)return r.use=!0,r.vnode}})}function xr(t){w(t.prototype,{initRender(){this.cacheConfig={}},getTypeSlot(e){const r=n=>{if(n){let s;return e.rule.field&&(s=n.slots["field-"+ge(e.rule.field)]||n.slots["field-"+e.rule.field]),s||(s=n.slots["type-"+ge(e.type)]||n.slots["type-"+e.type]),s||r(n.setupState.parent)}};return r(this.vm)},render(){if(!this.vm.setupState.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,n){if(this.isFragment(r)){r.initProp(),this.mergeGlobal(r),r.initNone();const s=this.renderChildren(r.loadChildrenPending(),r),i=s.default;i&&e.setSlot(r.rule.slot,()=>i()),delete s.default,e.mergeBag(s)}else e.setSlot(r.rule.slot,this.renderCtx(r,n))},mergeGlobal(e){this.$handle.options.global&&(this.cacheConfig[e.trueType]||(this.cacheConfig[e.trueType]=l.computed(()=>{const n=this.$handle.options.global;return Z({},[n["*"]||n.default||{},n[e.originType]||n[e.type]||n[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&&re(e.prop,e.prop.optionsTo,r)},deepSet(e){const r=e.prop.deep;r&&Object.keys(r).sort((n,s)=>n.length<s.length?-1:1).forEach(n=>{re(e.prop,n,r[n])})},parseSide(e,r){return g.Object(e)?Z({props:{formCreateInject:r.prop.props.formCreateInject}},e):e},renderSides(e,r,n){const s=r[n?"rule":"prop"];return[this.renderRule(this.parseSide(s.prefix,r)),e,this.renderRule(this.parseSide(s.suffix,r))]},renderId(e,r){const n=this.$handle[r==="field"?"fieldCtx":"nameCtx"][e];return n?n.map(s=>this.renderCtx(s,s.parent)):void 0},renderCtx(e,r){try{if(e.type==="hidden")return;const n=e.rule;if(this.force||!this.cache[e.id]||this.cache[e.id].slot!==n.slot){let s;e.initProp(),this.mergeGlobal(e),e.initNone(),this.$manager.tidyRule(e),this.deepSet(e),this.setOptions(e),this.ctxProp(e);let i=e.prop;i.preview=!!(i.preview!=null?i.preview:this.$handle.preview),i.props.formCreateInject=this.injectProp(e);let o=i.cache!==!1;const a=i.preview;if(i.hidden){this.setCache(e,void 0,r);return}s=(...u)=>{var _,V;const c={rule:n,prop:i,preview:a,api:this.$handle.api,model:i.model||{},slotValue:u};u.length&&n.slotUpdate&&k(()=>n.slotUpdate(c));let f={};const h=e.loadChildrenPending();e.parser.renderChildren?f=e.parser.renderChildren(h,e):e.parser.loadChildren!==!1&&(f=this.renderChildren(h,e)),Object.keys(i.renderSlots||{}).forEach(E=>{f[E]=(...j)=>{if(g.Function(i.renderSlots[E]))return k(()=>i.renderSlots[E](...j));const U=this.parseSide(i.renderSlots[E],e);return this.renderRule(U)}});const p=this.getTypeSlot(e);let m;return p?(c.children=f,m=p(c)):m=a?e.parser.preview(De(f),e):e.parser.render(De(f),e),m=this.renderSides(m,e),(_=i.title)!=null&&_.show&&(i.wrap=C({show:!0},i.wrap||{}),i.native||(i.native=!1)),(!(!e.input&&g.Undef(i.native))||((V=i.col)==null?void 0:V.show)===!0)&&i.native!==!0&&(this.fc.targetFormDriver("updateWrap",e),m=this.$manager.makeWrap(e,m)),e.none&&(Array.isArray(m)?m=m.map(E=>!E||!E.__v_isVNode?E:this.none(E)):m=this.none(m)),o&&this.setCache(e,()=>this.stable(m),r),m},this.setCache(e,s,r)}return(...s)=>{const i=this.getCache(e);if(i)return i(...s);if(this.cache[e.id])return;const o=this.renderCtx(e,e.parent);if(o)return o()}}catch(n){console.error(n);return}},none(e){if(e)return e.props.class=this.mergeClass(e.props.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(n=>{n&&n.__v_isVNode&&n.children&&typeof n.children=="object"&&(n.children.$stable=!0,this.stable(n.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]||"modelValue"},isFragment(e){return e.type==="fragment"||e.type==="template"},injectProp(e){const r=this.vm.setupState;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.setupState.top.slots,getWrap:()=>this.vm.refs[e.wrapRef],options:[],children:[],preview:!1,id:e.id,field:e.field,rule:e.rule,input:e.input,t:(...s)=>this.$handle.api.t(...s),updateValue:s=>{this.$handle.onUpdateValue(e,s)}});const n=r.ctxInject[e.id];return w(n,{preview:e.prop.preview,options:e.prop.options,children:e.loadChildrenPending()}),n},ctxProp(e){const{ref:r,key:n,rule:s}=e;this.$manager.mergeProp(e),e.parser.mergeProp(e);const i=[{ref:r,key:s.key||`${n}fc`,slot:void 0,on:{vnodeMounted:o=>{o.el.__rule__=e.rule,this.onMounted(e,o.el)},vnodeBeforeUnmount:()=>{this.$handle.effect(e,"beforeUnmount"),this.$handle.targetHook(e,"beforeUnmount")},"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);const a=this.getModelField(e),u={callback:c=>{o&&o(e.field,c,e.rule),this.onInput(e,c)},modelField:a,value:this.$handle.getFormData(e)};i.push({on:C({[`update:${a}`]:u.callback},e.prop.modelEmit?{[e.prop.modelEmit]:()=>this.onEmitInput(e)}:{}),props:{[a]:u.value}}),e.prop.model=u}return X(i,e.prop),e.prop},onMounted(e,r){e.el=this.vm.refs[e.ref]||r,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){if(!g.trueArray(e))return{};const n=Ve();return e.map(s=>{if(s){if(g.String(s)||g.Number(s))return n.setSlot(null,`${s}`);if(s.__fc__)return this.renderSlot(n,s.__fc__,r);s.type&&l.nextTick(()=>{this.$handle.loadChildren(e,r),this.$handle.refresh()})}}),n.getSlots()},defaultRender(e,r){const n=e.prop;return n.component?typeof n.component=="string"?this.vNode.make(n.component,n,r):this.vNode.makeComponent(n.component,n,r):this.vNode[e.type]?this.vNode[e.type](n,r):this.vNode[e.originType]?this.vNode[e.originType](n,r):this.vNode.make(ct(n.type),n,r)},createChildrenVnodes(e,r,n){this.force=n!==!1,this.tmpInput=r;const s=this.renderChildren(e.rule.children,e);return this.force=!1,this.tmpInput=null,s},createRuleVnode(e,r,n){this.force=n!==!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,n){if(!e)return;if(g.String(e)||g.Number(e))return`${e}`;let s;if(n)s=e.type;else if(s=e.is,e.type){s=L(e.type);const a=this.vNode.aliasMap[s];a&&(s=L(a))}if(!s)return;const i=Ve();g.trueArray(e.children)&&e.children.forEach(a=>{a&&i.setSlot(a==null?void 0:a.slot,()=>this.renderRule(a))});const o=C({},e);return delete o.type,delete o.is,this.vNode.make(s,o,i.mergeBag(r).getSlots())}})}let qr=1;function Le(t){w(this,{$handle:t,fc:t.fc,vm:t.vm,$manager:t.$manager,vNode:new t.fc.CreateNode(t),force:!1,tmpInput:null,id:qr++}),pt(this,{options(){return t.options},sort(){return t.sort}}),this.initCache(),this.initRender()}Ur(Le),xr(Le);function Hr(t){w(t.prototype,{parseInjectEvent(e,r){const n=e.inject||this.options.injectEvent;return this.parseEventLst(e,r,n)},parseEventLst(e,r,n,s){return Object.keys(r).forEach(i=>{const o=this.parseEvent(e,r[i],n,s);o&&(r[i]=o)}),r},parseEvent(e,r,n,s){if(g.Function(r)&&(n!==!1&&!g.Undef(n)||r.__inject))return this.inject(e,r,n);if(!s&&Array.isArray(r)&&r[0]&&(g.String(r[0])||g.Function(r[0])))return this.parseEventLst(e,r,n,!0);if(g.String(r)){const i=Y(r);if(i&&r!==i)return i.__inject?this.parseEvent(e,i,n,!0):i}},parseEmit(e){let r={},n=e.rule,{emitPrefix:s,field:i,name:o,inject:a}=n,u=n.emit||[];return g.trueArray(u)&&u.forEach(c=>{if(!c)return;let f,h=s||i||o;if(g.Object(c)&&(f=c.inject,c=c.name,h=c.prefix||h),h){const p=ge(`${h}-${c}`),m=(..._)=>{this.vm.emitsOptions&&!this.vm.emitsOptions[p]&&(this.vm.emitsOptions[p]=null),this.vm.emit(p,..._),this.vm.emit("emit-event",p,..._),this.bus.$emit(p,..._)};if(m.__emit=!0,!f&&a===!1)r[L(c)]=m;else{let _=f||a||this.options.injectEvent;r[L(c)]=g.Undef(_)?m:this.inject(n,m,_)}}}),e.computed.on=r,r},getInjectData(e,r){const n=e.__fc__&&e.__fc__.$api,s=e.__fc__&&e.__fc__.$handle.vm||this.vm,{option:i,rule:o}=s.props;return{$f:n||this.api,api:n||this.api,rule:o,self:e.__origin__,option:i,inject:r}},inject(e,r,n){if(r.__origin){if(this.watching&&!this.loading)return r;r=r.__origin}const s=this,i=function(...o){const a=s.getInjectData(e,n);return a.args=[...o],o.unshift(a),r.apply(this,o)};return i.__origin=r,i.__json=r.__json,i},loadStrVar(e,r,n){if(e&&typeof e=="string"&&e.indexOf("{{")>-1&&e.indexOf("}}")>-1){const s=e,i=Ir(e),o=c=>{let f=!1,h;if(n&&c.indexOf("$form.")===0){const p=c.split(".");p.shift(),v(n.value,p[0])&&(f=!0,h=r?r({id:"$form."+p[0]+"_"+n.rule.__fc__.id,getValue:()=>N(n.value,p)}):N(n.value,p))}return f||(h=r?r(c):this.fc.getLoadData(c)),h},a=c=>{const f=[];c.forEach(p=>{p.key?f.push(p.key):p.children&&f.push(a(p.children))});let h=!1;return f.forEach((p,m)=>{p!=null&&(p.indexOf("'")===0||p.indexOf('"')===0)&&(f[m]=p.slice(1,-1),h=!0)}),f.length===1&&(h||!isNaN(Number(f[0])))?f[0]:o(f.join("."))};let u;if(i.forEach(c=>{const f=c.split("||"),h=f[0].trim();if(h){const p=(f[1]||"").trim(),m=$t(h);let _=k(()=>a(m));(_==null||_==="")&&f.length>1&&(_=p),u=_,e=e.replaceAll(`{{${c}}}`,_==null?"":_)}}),i.length===1&&s===`{{${i[0]}}}`)return u}return e},loadFetchVar(e,r,n){let s;n&&n.__fc__&&(s=n.__fc__.getParentGroup()),!s&&e.targetRule&&e.targetRule.__fc__&&(s=e.targetRule.__fc__.getParentGroup());const i=o=>this.loadStrVar(o,r,s?{rule:n,value:this.subRuleData[s.id]||{}}:null);return e.action=i(e.action||""),["headers","data","query"].forEach(o=>{if(e[o]){const a=Array.isArray(e[o])?[]:{};Object.keys(e[o]).forEach(u=>{a[i(u)]=i(e[o][u])}),e[o]=a}}),e}})}const St=["hook:updated","hook:mounted"];function zr(t){w(t.prototype,{usePage(){const e=this.options.page;if(!e)return;let r=25,n=Gr(this.rules);g.Object(e)&&(e.first&&(r=parseInt(e.first,10)||r),e.limit&&(n=parseInt(e.limit,10)||n)),w(this,{first:r,limit:n,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.bus.$off(St,e),this.bus.$emit("page-end")):(this.first+=this.limit,this.pageEnd=this.rules.length<=this.first,this.loadRule(),this.refresh())};this.bus.$on(St,e)}})}function Gr(t){return t.length<31?31:Math.ceil(t.length/3)}function Yr(t){w(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.setupState.unique>0?this.$render.render():(this.vm.setupState.unique=1,[])}})}function Wr(t){Object.defineProperties(t.origin,{__fc__:Te(l.markRaw(t))}),t.rule!==t.origin&&Object.defineProperties(t.rule,{__fc__:Te(l.markRaw(t))})}function kt(t,e,r){const n=we(),s=!!e.field;w(this,{id:n,ref:n,wrapRef:n+"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:C({},e),computed:{},payload:{},refRule:{},input:s,el:void 0,exportEl:void 0,defaultValue:s?G(r):void 0,field:e.field||void 0}),this.updateKey(),Wr(this),this.update(t,!0)}w(kt.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:n,onLoad:s,onReload:i,onUpdate:o}=t;if(this.pending[e]&&this.pending[e].origin===r)return this.getPending(e,n);delete this.pending[e];let a=r;if(g.Function(r)){let u=k(()=>r({rule:this.rule,api:this.$api,update:c=>{const f=c||n,h=this.getPending(e,n);this.setPending(e,r,f),o&&o(f,h)},reload:()=>{const c=this.getPending(e,n);delete this.pending[e],i&&i(c),this.$api&&this.$api.sync(this.rule)}}));u&&g.Function(u.then)?(u.then(c=>{const f=c||n;this.setPending(e,r,f),s&&s(f),this.$api&&this.$api.sync(this.rule)}).catch(c=>{console.error(c)}),a=n,this.setPending(e,r,a)):(a=u||n,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:l.reactive(r)}},effectData(t){return this.payload[t]||(this.payload[t]={}),this.payload[t]},clearEffectData(t){t===void 0?this.payload={}:delete this.payload[t]},updateKey(t){this.key=we(),t&&this.parent&&this.parent.updateKey(t)},updateType(){this.originType=this.rule.type,this.type=L(this.rule.type),this.trueType=this.$handle.getType(this.originType)},setParser(t){this.parser=t,t.init(this)},initProp(){var e,r,n;const t=C({},this.rule);delete t.children,delete t.validate,this.prop=Z({},[t,...Object.keys(this.payload).map(s=>this.payload[s]),this.computed]),t.col&&((e=t.col)==null?void 0:e.show)!==!1&&(this.prop.col.show=!0),this.prop.validate=[...((n=(r=this.refRule)==null?void 0:r.__$validate)==null?void 0:n.value)||[],...this.prop.validate||[]]},initNone(){this.none=!(g.Undef(this.prop.display)||this.prop.display)},hasHidden(){return!!this.rule.hidden||(this.parent?this.parent.hasHidden():!1)},injectValidate(){return this.prop.validate},check(t){return this.vm===t.vm},unwatch(){this.watch.forEach(t=>t()),this.watch=[],Object.keys(this.refRule).forEach(t=>{t.indexOf("__$")!==0&&delete this.refRule[t]})},unlink(){this.linkOn.forEach(t=>t()),this.linkOn=[]},link(){this.unlink(),this.$handle.appendLink(this)},watchTo(){this.$handle.watchCtx(this)},delete(){this.unwatch(),this.unlink(),this.rmCtrl(),this.parent&&this.parent.children.splice(this.parent.children.indexOf(this)>>>0,1),w(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),w(this,{root:[]})},this.input)})},update(t,e){w(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 Jr(t){w(t.prototype,{nextRefresh(e){const r=this.loadedId;l.nextTick(()=>{r===this.loadedId&&(e?e():this.refresh())})},parseRule(e){const r=ht(e);return Object.defineProperties(r,{__origin__:Te(e)}),Kr(r),this.appendValue(r),[r,r.prefix,r.suffix].forEach(n=>{n&&this.loadFn(n,r)}),this.loadCtrl(r),r.update&&(r.update=Y(r.update)),r},loadFn(e,r){["on","props","deep"].forEach(n=>{e[n]&&this.parseInjectEvent(r,e[n])})},loadCtrl(e){e.control&&e.control.forEach(r=>{r.handle&&(r.handle=Y(r.handle))})},syncProp(e){const r=e.rule;g.trueArray(r.sync)&&X([{on:r.sync.reduce((n,s)=>(n[typeof s=="object"&&s.event||`update:${s}`]=i=>{r.props[typeof s=="object"&&s.prop||s]=i,this.vm.emit("sync",s,i,r,this.fapi)},n),{})}],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.setupState.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 n=o=>{let a=e[o-1];if(!a||!a.__fc__)return o>0?n(o-1):-1;let u=this.sort.indexOf(a.__fc__.id);return u>-1?u:n(o-1)},s=(o,a)=>{g.trueArray(o)&&this._loadRule(o,a)},i=e.map((o,a)=>{if(r&&!g.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 u=ht(o);const c=()=>!!(u.field&&this.fieldCtx[u.field]&&this.fieldCtx[u.field][0]!==o.__fc__);this.fc.targetFormDriver("loadRule",{rule:u,api:this.api},this.fc),this.ruleEffect(u,"init",{repeat:c()}),c()&&this.vm.emit("repeat-field",o,this.api);let f,h=!1,p=!!o.__fc__,m=u.value;if(p){if(f=o.__fc__,m=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():it(ye(o)),f=null,h=!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 E=this.parseRule(o);f=new kt(this,E,m),this.bindParser(f)}this.parseEmit(f),this.syncProp(f),f.parent=r||null,f.root=e,this.setCtx(f),!h&&!p&&(this.effect(f,"load"),this.targetHook(f,"load")),this.effect(f,"created");const _=f.loadChildrenPending();if(f.parser.loadChildren===!1||s(_,f),!r){const E=n(a);E>-1||!a?this.sort.splice(E+1,0,f.id):this.sort.push(f.id)}const V=f.rule;return f.updated||(f.updated=!0,g.Function(V.update)&&this.bus.$once("load-end",()=>{this.refreshUpdate(f,V.value,"init")}),this.effect(f,"loaded")),this.refreshControl(f)&&(this.cycleLoad=!0),f}).filter(o=>!!o);r&&(r.children=i)},refreshControl(e){return e.input&&e.rule.control&&this.useCtrl(e)},useCtrl(e){const r=Xr(e),n=[],s=this.api;if(!r.length)return!1;for(let a=0;a<r.length;a++){const u=r[a],c=u.handle||function(h){return(le[u.condition||"=="]||le["=="])(h,u.value)};if(!g.trueArray(u.rule))continue;const f=q(C({},u),{valid:k(()=>c(e.rule.value,s)),ctrl:Zr(e,u.rule),isHidden:g.String(u.rule[0])});f.valid&&f.ctrl||!f.valid&&!f.ctrl&&!f.isHidden||n.push(f)}if(!n.length)return!1;const i=[];let o=!1;return this.deferSyncValue(()=>{n.reverse().forEach(({isHidden:a,valid:u,rule:c,prepend:f,append:h,child:p,ctrl:m,method:_})=>{if(a){u?e.ctrlRule.push({__ctrl:!0,children:c,valid:u}):m&&e.ctrlRule.splice(e.ctrlRule.indexOf(m)>>>0,1),i[u?"push":"unshift"](()=>{_==="disabled"||_==="enabled"?this.api.disabled(!u,c):_==="display"||_==="show"?this.api.display(u,c):_==="required"?(c.forEach(V=>{this.api.setEffect(V,"required",u)}),u||this.api.clearValidateState(c)):_==="if"?this.api.hidden(!u,c):this.api.hidden(!u,c)});return}if(u){o=!0;const V={type:"fragment",native:!0,__ctrl:!0,children:c};e.ctrlRule.push(V),this.bus.$once("load-start",()=>{f?s.prepend(V,f,p):h||p?s.append(V,h||e.id,p):e.root.splice(e.root.indexOf(e.origin)+1,0,V)})}else{e.ctrlRule.splice(e.ctrlRule.indexOf(m),1);const V=W(m);V&&V.rm()}})}),i.length&&(this.loading?i.length&&this.bus.$once("load-end",()=>{i.forEach(a=>a())}):i.length&&l.nextTick(()=>{i.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=C({},this.ctxs);this.clearNextTick(),this.initData(e),this.fc.rules=e,this.deferSyncValue(()=>{this.bus.$once("load-end",()=>{Object.keys(r).filter(n=>this.ctxs[n]===void 0).forEach(n=>this.rmCtx(r[n])),this.$render.clearCacheAll()}),this.reloading=!0,this.loadRule(),this.reloading=!1,this.refresh(),this.bus.$emit("reloading",this.api)}),this.bus.$off("next-tick",this.nextReload),this.bus.$once("next-tick",this.nextReload),this.bus.$emit("update",this.api)},refresh(){this.vm.setupState.refresh()}})}function Kr(t){const e=bt();return Object.keys(e).forEach(r=>{v(t,r)||(t[r]=e[r])}),t}function Xr(t){const e=t.rule.control||[];return g.Object(e)?[e]:e}function Zr(t,e){for(let r=0;r<t.ctrlRule.length;r++){const n=t.ctrlRule[r];if(n.children===e)return n}}function Et(t){return!!t.rule.__ctrl}function Qr(t){w(t.prototype,{setValue(e,r,n,s){e.deleted||(e.rule.value=r,this.changeStatus=!0,this.nextRefresh(),this.$render.clearCache(e),this.setFormData(e,n),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&&l.nextTick(()=>{l.nextTick(()=>{l.nextTick(()=>{this.api.clearValidateState(e.id)})})}),this.$manager.fieldChange(e,r,n,s))},onInput(e,r){let n;e.input&&(this.isQuote(e,n=e.parser.toValue(r,e))||this.isChange(e,r))&&this.setValue(e,n,r)},onUpdateValue(e,r){this.deferSyncValue(()=>{const n=e.getParentGroup(),s=n?this.subRuleData[n.id]:null,i={};Object.keys(r||{}).forEach(o=>{s&&v(s,o)?i[o]=r[o]:v(this.api.form,o)?this.api.form[o]=r[o]:this.api.top!==this.api&&v(this.api.top.form,o)&&(this.api.top.form[o]=r[o])}),Object.keys(i).length&&this.api.setChildrenFormData(n.rule,i)})},onBaseInput(e,r){this.setFormData(e,r),e.modelValue=r,this.nextRefresh(),this.$render.clearCache(e)},setFormData(e,r){e.modelValue=r;const n=e.getParentGroup();n&&(this.subRuleData[n.id]||(this.subRuleData[n.id]={}),this.subRuleData[n.id][e.field]=e.rule.value),H(this.formData,e.id,r)},rmSubRuleData(e){const r=e.getParentGroup();r&&this.subRuleData[r.id]&&delete this.subRuleData[r.id][e.field]},getFormData(e){return this.formData[e.id]},syncForm(){const e=l.reactive({}),r=this.fields(),n=[];this.options.appendValue!==!1&&Object.keys(this.appendData).reduce((s,i)=>(r.indexOf(i)===-1&&(s[i]=l.toRef(this.appendData,i)),s),e),r.reduce((s,i)=>{let o=(this.fieldCtx[i]||[]).filter(a=>!this.isIgnore(a))[0];return o||(o=this.fieldCtx[i][0],n.push(i)),s[i]=l.toRef(o.rule,"value"),s},e),this.form=e,this.ignoreFields=n,this.syncValue()},isIgnore(e){return e.rule.ignore===!0||(e.rule.ignore==="hidden"||this.options.ignoreHiddenFields)&&e.hasHidden()},appendValue(e){(!e.field||!v(this.appendData,e.field))&&(!g.Undef(e.value)||!this.options.forceCoverValue)||(e.value=this.appendData[e.field],delete this.appendData[e.field])},addSubForm(e,r){this.subForm[e.id]=r},deferSyncValue(e,r){this.deferSyncFn||(this.deferSyncFn=e),this.deferSyncFn.sync||(this.deferSyncFn.sync=r),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.setupState.updateValue(e)},isChange(e,r){return JSON.stringify(this.getFormData(e),Rt)!==JSON.stringify(r,Rt)},isQuote(e,r){return(r instanceof Function||g.Object(r)||Array.isArray(r))&&r===e.rule.value},refreshUpdate(e,r,n,s){if(g.Function(e.rule.update)){const i=k(()=>e.rule.update(r,e.origin,this.api,{origin:n||"change",linkField:s}));if(i===void 0)return;e.rule.hidden=i===!0}},valueChange(e,r){this.refreshRule(e,r),this.bus.$emit("change-"+e.field,r)},refreshRule(e,r,n,s){this.refreshControl(e)&&(this.$render.clearCacheAll(),this.loadRule(),this.bus.$emit("update",this.api),this.refresh()),this.refreshUpdate(e,r,n,s)},appendLink(e){const r=e.rule.link;g.trueArray(r)&&r.forEach(n=>{const s=()=>this.refreshRule(e,e.rule.value,"link",n);this.bus.$on("change-"+n,s),e.linkOn.push(()=>this.bus.$off("change-"+n,s))})},fields(){return Object.keys(this.fieldCtx)}})}function Rt(t,e){return typeof e=="function"?""+e:e}const be={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){}},en=["field","value","vm","template","name","config","control","inject","sync","payload","optionsTo","update","slotUpdate","computed","component","cache"],_e=Symbol("oldValue");function tn(t){w(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,n){const s=`${n}Ctx`;this[s][r]?this[s][r].push(e):this[s][r]=[e]},rmIdCtx(e,r,n){const s=`${n}Ctx`,i=this[s][r];if(!i)return!1;const o=i.splice(i.indexOf(e)>>>0,1).length>0;return i.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:n,name:s,rule:i}=e;this.ctxs[r]=e,s&&this.setIdCtx(e,s,"name"),e.input&&(this.setIdCtx(e,n,"field"),this.setFormData(e,e.parser.toFormValue(i.value,e)),this.isMounted&&!this.reloading&&this.vm.emit("change",e.field,i.value,e.origin,this.api,!1,!0))},getParser(e){const r=this.fc.parsers,n=this.fc.renderDriver;if(n){const s=n.parsers||{},i=s[e.originType]||s[L(e.type)]||s[e.trueType];if(i)return i}return r[e.originType]||r[L(e.type)]||r[e.trueType]||be},bindParser(e){e.setParser(this.getParser(e))},getType(e){const r=this.fc.CreateNode.aliasMap,n=r[e]||r[L(e)]||e;return L(n)},noWatch(e){this.noWatchFn||(this.noWatchFn=e),k(e),this.noWatchFn===e&&(this.noWatchFn=null)},watchCtx(e){if(ut().filter(n=>n[0]!=="_"&&n[0]!=="$"&&en.indexOf(n)===-1).forEach(n=>{const s=l.toRef(e.rule,n),i=n==="children";e.refRule[n]=s,e.watch.push(l.watch(i?()=>g.Function(s.value)?s.value:[...s.value||[]]:()=>s.value,(o,a)=>{let u=s.value;if(!this.isBreakWatch()){if(i&&e.parser.loadChildren===!1){this.$render.clearCache(e),this.nextRefresh();return}if(this.watching=!0,l.nextTick(()=>{this.targetHook(e,"watch",{key:n,oldValue:a,newValue:u})}),n==="hidden"&&!!u!=!!a&&(this.$render.clearCacheAll(),l.nextTick(()=>{this.targetHook(e,"hidden",{value:u})})),n==="ignore"&&e.input||n==="hidden"&&(e.rule.ignore==="hidden"||this.options.ignoreHiddenFields))this.syncForm();else if(n==="link"){e.link();return}else["props","on","deep"].indexOf(n)>-1?(this.parseInjectEvent(e.rule,u||{}),n==="props"&&e.input&&this.setFormData(e,e.parser.toFormValue(e.rule.value,e))):n==="emit"?this.parseEmit(e):["prefix","suffix"].indexOf(n)>-1?u&&this.loadFn(u,e.rule):n==="type"?(e.updateType(),this.bindParser(e)):i&&(g.Function(a)&&(a=e.getPending("children",[])),g.Function(u)&&(u=e.loadChildrenPending()),this.updateChildren(e,u,a));this.$render.clearCache(e),this.refresh(),this.watching=!1}},{deep:!i,sync:i}))}),e.refRule.__$title=l.computed(()=>{let n=(typeof e.rule.title=="object"?e.rule.title.title:e.rule.title)||"";if(n){const s=n.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);s&&(n=this.api.t(s[1]))}return n}),e.refRule.__$info=l.computed(()=>{let n=(typeof e.rule.info=="object"?e.rule.info.info:e.rule.info)||"";if(n){const s=n.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);s&&(n=this.api.t(s[1]))}return n}),e.refRule.__$validate=l.computed(()=>{const n=s=>{var o,a;const i=s.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);return i?this.api.t(i[1],{title:(a=(o=e.refRule)==null?void 0:o.__$title)==null?void 0:a.value}):s};return M(e.rule.validate).map(s=>{const i=C({},s);if(i.message&&(i.message=n(i.message)),g.Function(i.validator)){const o=e;i.validator=function(...a){return s.validator.call({that:this,id:o.id,field:o.field,rule:o.rule,api:o.$handle.api},...a)}}if(i.adapter){if(typeof i.error=="object"){const o=C({},i.error);Object.keys(o).forEach(a=>{o[a]=n(o[a])}),i.error=o}return this.adapterValidate(i,e)}return i})}),e.input){const n=l.toRef(e.rule,"value");e.watch.push(l.watch(()=>n.value,()=>{let s=e.parser.toFormValue(n.value,e);this.isChange(e,s)&&this.setValue(e,n.value,s,!0)}))}this.bus.$once("load-end",()=>{let n=e.rule.computed;n&&(typeof n!="object"&&(n={value:n}),Object.keys(n).forEach(s=>{const i=l.computed(()=>{const a=n[s];if(!a)return;const u=this.compute(e,a);return(a.linkage||a.linkageVariable)&&u===_e?_e:u}),o=a=>{s==="value"?this.onInput(e,a):s[0]==="$"?this.api.setEffect(e.id,s,a):re(e.rule,s,a)};(s==="value"?[void 0,null,""].indexOf(e.rule.value)>-1:i.value!==N(e.rule,s))&&o(i.value),e.watch.push(l.watch(i,a=>{a!==_e&&setTimeout(()=>{o(a)})},{deep:!0}))}))}),this.watchEffect(e)},adapterValidate(e,r){const n=(s,i)=>{if((e.beforeValidate&&k(()=>e.beforeValidate({value:s,api:this.api,validate:e,rule:r.rule})))===!1)i();else{const a=this.validator(r,s,e);if(a){let u="";typeof e.error=="object"&&(u=e.error[a]||e.error.default),!u&&typeof e.message=="string"&&(u=e.message),u||(u=this.getValidateMessage(r,{key:a,rule:e[a]})),i(u)}else if(e.validator){const u=e.validator&&k(()=>e.validator(s,i));u&&g.Function(u.then)&&u.then(()=>i()).catch(c=>i(c))}else i()}};return this.$manager.adapterValidate({required:e.required,message:e.message,trigger:e.trigger},n)},getValidateMessage(e,r){var s,i;const n=Array.isArray(r.rule)?r.rule.join(","):""+r.rule;return this.api.t(r.key==="required"?r.key:"validate."+r.key,{[r.key]:n,title:(i=(s=e.refRule)==null?void 0:s.__$title)==null?void 0:i.value})},validator(e,r,n){if(g.empty(r))return n.required?"required":void 0;for(const[i,o]of Object.entries(n))switch(i){case"len":case"maxLen":case"minLen":const a=_=>i==="len"?_===o:i==="maxLen"?_<=o:_>=o;if(Array.isArray(r)){if(!a(r.length))return i}else{if(typeof r=="object")return i;if(!a((""+r).length))return i}break;case"pattern":if(!(typeof o=="string"?new RegExp(o):o).test(""+r))return i;break;case"uppercase":if(o&&(typeof r!="string"||!/^[A-Z]*$/.test(r)))return i;break;case"lowercase":if(o&&(typeof r!="string"||!/^[a-z]*$/.test(r)))return i;break;case"min":case"max":case"positive":case"negative":case"integer":case"number":const c=Number(r);if(Number.isNaN(c)||i==="min"&&c<o||i==="max"&&c>o||i==="positive"&&c<=0||i==="negative"&&c>=0||i==="integer"&&!Number.isInteger(c))return i;break;case"equal":if(r!==o)return i;break;case"enum":if(Array.isArray(o)&&!o.includes(r))return i;break;case"hasKeys":if(typeof r!="object"||Array.isArray(o)&&o.some(_=>!(_ in r)))return i;break;case"email":if(!/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(""+r))return i;break;case"url":if(!new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$","i").test(""+r))return i;break;case"ip":if(!/^(2(5[0-5]{1}|[0-4]\d{1})|[0-1]?\d{1,2})(\.(2(5[0-5]{1}|[0-4]\d{1})|[0-1]?\d{1,2})){3}$/.test(""+r))return i;break;case"phone":if(!/^(?:(?:\+|00)86)?1[3-9]\d{9}$/.test(""+r))return i;break;case"computed":if(!this.compute(e,o))return i;break}},compute(e,r){let n;if(typeof r=="object"){const s=e.getParentGroup(),i=a=>{if(a=Array.isArray(a)?{mode:"AND",group:a}:a,!g.trueArray(a.group))return!0;const u=a.mode==="OR";let c=!0;for(let f=0;f<a.group.length;f++){const h=a.group[f];let p,m=null,_=null;if(h.variable)_=this.fc.getLoadData(h.variable);else if(h.field)m=yt(h.field||"");else if(!h.mode)return!0;let V=h.compare;if(V&&(V=yt(V||"")),h.mode?p=i(h):le[h.condition]?g.Function(h.handler)?p=k(()=>h.handler(this.api,e.rule)):p=k(()=>new Function("$condition","$variableVal","$val","$form","$scope","$group","$rule",`with($form){with($scope){with(this){with($group){ return $condition['${h.condition}'](${h.variable?"$variableVal":m}, ${V||"$val"}); }}}}`).call(this.api.form,le,_,h.value,this.api.top.form,this.api.top===this.api.scope?{}:this.api.scope.form,s?this.subRuleData[s.id]||{}:{},e.rule)):p=!1,u&&p)return!0;u||(c=c&&p)}return u?!1:c};let o=i(r);return o=r.invert===!0?!o:o,r.linkage?o?k(()=>this.computeValue(r.linkage,e,s),void 0):_e:r.linkageVariable?o?k(()=>this.fc.getLoadData(r.linkageVariable),void 0):_e:o}else if(g.Function(r))n=()=>r(this.api.form,this.api,e.rule);else{const s=e.getParentGroup();n=()=>this.computeValue(r,e,s)}return k(n,void 0)},computeValue(e,r,n){const s=this,i=Object.keys(this.fc.formulas).reduce((o,a)=>(o[a]=function(...u){return s.fc.formulas[a].call({that:this,rule:r.rule,api:s.api,fc:s.fc},...u)},o),{});return k(()=>new Function("$formulas","$form","$scope","$group","$rule","$api",`with($form){with($scope){with(this){with($group){with($formulas){ return ${e} }}}}}`).call(this.api.form,i,this.api.top.form,this.api.top===this.api.scope?{}:this.api.scope.form,n?this.subRuleData[n.id]||{}:{},r.rule,this.api),void 0)},updateChildren(e,r,n){this.deferSyncValue(()=>{n&&n.forEach(s=>{(r||[]).indexOf(s)===-1&&s&&!g.String(s)&&s.__fc__&&s.__fc__.parent===e&&this.rmCtx(s.__fc__)}),g.trueArray(r)&&(this.loadChildren(r,e),this.bus.$emit("update",this.api))})},rmSub(e){g.trueArray(e)&&e.forEach(r=>{r&&r.__fc__&&this.rmCtx(r.__fc__)})},rmCtx(e){if(e.deleted)return;const{id:r,field:n,input:s,name:i}=e;ae(this.ctxs,r),ae(this.formData,r),ae(this.subForm,r),ae(this.vm.setupState.ctxInject,r);const o=e.getParentGroup();o&&this.subRuleData[o.id]&&ae(this.subRuleData[o.id],n),e.group&&ae(this.subRuleData,r),s&&this.rmIdCtx(e,n,"field"),i&&this.rmIdCtx(e,i,"name"),s&&!v(this.fieldCtx,n)&&ae(this.form,n),this.deferSyncValue(()=>{if(!this.reloading){if(e.parser.loadChildren!==!1){const u=e.getPending("children",e.rule.children);g.trueArray(u)&&u.forEach(c=>c&&c.__fc__&&this.rmCtx(c.__fc__))}e.root===this.rules&&this.vm.setupState.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[n]&&this.vm.emit("remove-field",n,e.rule,this.api),e.rule.__ctrl||this.vm.emit("remove-rule",e.rule,this.api),e}})}function rn(t){w(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 n=this.options[e]||this.options[L("on-"+e)];if(n){const s=Y(n);g.Function(s)&&k(()=>s(...r))}this.bus.$emit(e,...r)},targetHook(e,r,n){var u,c,f,h;let s=(c=(u=e.prop)==null?void 0:u.hook)==null?void 0:c[r],i=(p,m)=>{p&&(p=Array.isArray(p)?p:[p],p.forEach(_=>{k(()=>_(q(C({args:Object.values(n||{})},n||{}),{self:e.rule,rule:e.rule,parent:m==null?void 0:m.rule,$f:this.api,api:this.api,option:this.vm.props.option})))}))};i(s);let o="deep"+rt(r),a=e.parent;for(;a;){let p=(h=(f=a.prop)==null?void 0:f.hook)==null?void 0:h[o];i(p,a),a=a.parent}}})}function nn(t){w(t.prototype,{useProvider(){const e=this.fc.providers;Object.keys(e).forEach(r=>{let n=e[r];g.Function(n)&&(n=n(this.fc)),n._c=on(n),this.onEffect(n,r),this.providers[r]=n})},onEffect(e,r){const n=[];(e._c||["*"]).forEach(s=>{const i=s==="*"?"*":this.getType(s);n.indexOf(i)>-1||(n.push(i),this.bus.$on(`p:${r||e.name}:${i}:${e.input?1:0}`,(o,a)=>{e[o]&&e[o](...a)}))}),e._used=n},watchEffect(e){let r={required:()=>{var n,s;return(v(e.rule,"$required")?e.rule.$required:(s=(n=e.rule)==null?void 0:n.effect)==null?void 0:s.required)||!1}};Object.keys(e.rule.effect||{}).forEach(n=>{r[n]=()=>e.rule.effect[n]}),Object.keys(e.rule).forEach(n=>{n[0]==="$"&&(r[n.substr(1)]=()=>e.rule[n])}),Object.keys(r).forEach(n=>{e.watch.push(l.watch(r[n],s=>{this.effect(e,"watch",{[n]:s})},{deep:!0}))})},ruleEffect(e,r,n){this.emitEffect({rule:e,input:!!e.field,type:this.getType(e.type)},r,n)},effect(e,r,n){this.emitEffect({rule:e.rule,input:e.input,type:e.trueType,ctx:e,custom:n},r)},getEffect(e,r){if(v(e,"$"+r))return e["$"+r];if(v(e,"effect")&&v(e.effect,r))return e.effect[r]},emitEffect({ctx:e,rule:r,input:n,type:s,custom:i},o,a){if(!s||["fcFragment","fragment"].indexOf(s)>-1)return;const u=i||Object.keys(r).reduce((c,f)=>(f[0]==="$"&&(c[f.substr(1)]=r[f]),c),C({},r.effect||{}));Object.keys(u).forEach(c=>{const f=this.providers[c];if(!f||f.input&&!n)return;let h;if(!f._c)h="*";else if(f._used.indexOf(s)>-1)h=s;else return;const p=C({value:u[c],getValue:()=>this.getEffect(r,c)},a||{});e&&(p.getProp=()=>e.effectData(c),p.clearProp=()=>e.clearEffectData(c),p.mergeProp=m=>Z(p.getProp(),[m]),p.id=e.id),this.bus.$emit(`p:${c}:${h}:${f.input?1:0}`,o,[p,r,this.api])})}})}function sn(t){return t.filter(function(e,r,n){return n.indexOf(e,0)===r})}function on(t){const e=t.components;if(Array.isArray(e)){const r=sn(e.filter(n=>n!=="*"));return r.length?r:!1}else return g.String(e)?[e]:!1}function J(t){pt(this,{options(){return t.options.value||{}},bus(){return t.bus},preview(){return t.vm.props.preview!=null?t.vm.props.preview:t.vm.setupState.parent&&t.vm.setupState.parent.props.preview!=null?t.vm.setupState.parent.props.preview:t.options.value.preview||!1}}),w(this,{fc:t,vm:t.vm,watching:!1,loading:!1,reloading:!1,noWatchFn:null,deferSyncFn:null,isMounted:!1,formData:l.reactive({}),subRuleData:l.reactive({}),subForm:{},form:l.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 Le(this),this.api=t.extendApiFn.reduce((e,r)=>{const n=k(()=>r(e,this));return n&&n!==e&&w(e,n),e},Lr(this))}w(J.prototype,{initData(t){w(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=C(C(C({},G(this.options.formData||{})),this.fc.vm.props.modelValue||{}),this.appendData)},isBreakWatch(){return this.loading||this.noWatchFn||this.reloading},globalBeforeFetch(t){return new Promise((e,r)=>{const n=this.options.beforeFetch&&k(()=>this.options.beforeFetch(t,{api:this.api}));n&&g.Function(n.then)?n.then(e).catch(r):e()})},beforeFetch(t){return new Promise((e,r)=>{const n=t&&t.beforeFetch&&k(()=>t.beforeFetch(t,{api:this.api}));n&&g.Function(n.then)?n.then(e).catch(r):n===!1?r():e()}).then(()=>this.globalBeforeFetch(t))},beforeSubmit(t){return new Promise((e,r)=>{const n=this.options.beforeSubmit&&k(()=>this.options.beforeSubmit(t,{api:this.api}));n&&g.Function(n.then)?n.then(e).catch(r):n===!1?r():e()})}}),Hr(J),zr(J),Yr(J),Jr(J),Qr(J),tn(J),rn(J),nn(J);const Ue=l.defineComponent({name:"fcFragment",inheritAttrs:!1,props:["vnode"],render(){return this.vnode}});function an(t){return Object.keys(t).map(e=>{const r=t[e],n=l.resolveDirective(e);if(n)return[n,r.value,r.arg,r.modifiers]}).filter(e=>!!e)}function Ft(t,e){let r=t.directives;return r?(Array.isArray(r)||(r=[r]),l.withDirectives(e,r.reduce((n,s)=>n.concat(an(s)),[]))):e}function ln(){const t={};function e(r){this.vm=r.vm,this.handle=r}return w(e.prototype,{make(r,n,s){return Ft(n,this.h(r,mt(n),s))},makeComponent(r,n,s){try{return Ft(n,l.createVNode(r,mt(n),s))}catch(i){return console.error(i),l.createVNode("")}},h(r,n,s){const o=(this.vm||l.getCurrentInstance()).appContext.config.isNativeTag(r),a=this.handle.fc.prop.components[r];!a&&o&&delete n.formCreateInject;try{return l.createVNode(a||(o?r:l.resolveComponent(r)),n,s)}catch(u){return console.error(u),l.createVNode("")}},aliasMap:t}),w(e,{aliasMap:t,alias(r,n){t[r]=n},use(r){Object.keys(r).forEach(n=>{const s=ge(n),i=tt(n).toLocaleLowerCase(),o=r[n];e.alias(n,o),[n,s,i].forEach(a=>{e.prototype[a]=function(u,c){return this.make(t[n]||a,u,c)}})})}}),e}function un(t){class e extends Ot{}return Object.assign(e.prototype,t),e}function Ot(t){w(this,{$handle:t,vm:t.vm,options:{},ref:"fcForm",mergeOptionsRule:{normal:["form","row","info","submitBtn","resetBtn"]}}),this.updateKey(),this.init()}w(Ot.prototype,{__init(){this.$render=this.$handle.$render,this.$r=(...t)=>this.$render.renderRule(...t)},updateKey(){this.key=we()},init(){},update(){},beforeRender(){},form(){return this.vm.refs[this.ref]},adapterValidate(t,e){return t.validator=(r,n,s)=>e(n,s),t},getSlot(t){const e=r=>{if(r){let n=r.slots[t];return n||e(r.setupState.parent)}};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{}},fieldChange(t,e,r,n){},render(t){}});const cn=function(t){const e={name:"loadData",_fn:[],loaded(r,n,s){this.deleted(r),l.nextTick(()=>{let i=M(r.getValue());const o=[];i.forEach(a=>{if(a&&(a.attr||a.template)){let u=h=>{let p;n&&n.__fc__&&(p=n.__fc__.getParentGroup());let m;a.template?m=t.$handle.loadStrVar(a.template,h,p?{rule:n,value:t.$handle.subRuleData[p.id]||{}}:null):a.handler&&g.Function(a.handler)?m=a.handler(h,n,s):m=t.$handle.loadStrVar(`{{${a.attr}}}`,h,p?{rule:n,value:t.$handle.subRuleData[p.id]||{}}:null),(m==null||m==="")&&a.default!=null&&(m=a.default),a.copy!==!1&&(m=G(m));const _=a.modify?n:r.getProp();a.to==="child"?_.children?_.children[0]=m:_.children=[m]:re(_,a.to||"options",m),s.sync(n)},c=h=>u(h);const f=t.watchLoadData(c);u=te(u,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(n=>{n()}),delete this._fn[r.id]),r.clearProp()}};return e.watch=e.loaded,e},fn=function(t){const e={name:"t",_fn:[],loaded(r,n,s){this.deleted(r);let i=r.getValue()||{};const o=[];Object.keys(i).forEach(a=>{const u=i[a];if(u){const c=typeof u=="object";let f=m=>{let _=t.t(c?u.attr:u,c?u.params:null,m);const V=c&&u.modify?n:r.getProp();a==="child"?V.children?V.children[0]=_:V.children=[_]:re(V,a,_),s.sync(n)},h=m=>f(m);const p=t.watchLoadData(h);f=te(f,u.wait||300),u.watch!==!1?o.push(p):p()}}),this._fn[r.id]=o},deleted(r){this._fn[r.id]&&(this._fn[r.id].forEach(n=>{n()}),delete this._fn[r.id]),r.clearProp()}};return e.watch=e.loaded,e},vt={name:"componentValidate",load(t,e,r){let n=t.getValue();if(!n||n.method===!1)t.clearProp(),r.clearValidateState([e.field]);else{g.Object(n)||(n={method:n});const s=n.method,i=q(C({},n),{validator(...o){const a=W(e);if(a)return r.exec(a.id,g.String(s)?s:"formCreateValidate",...o,{attr:t,rule:e,api:r})}});delete i.method,t.getProp().validate=[i]}},watch(...t){vt.load(...t)}},dn={fetch:function(t){function e(s){return g.String(s)&&(s={action:s,to:"options"}),s}function r(s,i,o){let a=s.value;n.deleted(s),g.Function(a)&&(a=a(i,o)),a=e(a);const u=h=>{h===void 0?s.clearProp():re(s.getProp(),a.to||"options",h),h!=null&&a&&a.key&&t.$handle.options.globalData[a.key]&&t.fetchCache.set(t.$handle.options.globalData[a.key],{status:!0,data:h}),o.sync(i)};if(!a||!a.action&&!a.key){u(void 0);return}a=G(a),a.to||(a.to="options");const c=a.onError,f=()=>{if(!s.getValue())return s.clearProp(),o.sync(i),!0};n._fn[s.id]=t.watchLoadData(te((h,p)=>{if(p&&a.watch===!1)return n._fn[s.id]();if(a.key){t.targetRule=i;const V=h("$globalData."+a.key);if(delete t.targetRule,V){if(f())return;u(V)}return}const m=t.$handle.loadFetchVar(G(a),h,i),_=q(C({headers:{}},m),{onSuccess(V,E){if(f())return;let j=B=>E?B:v(B,"data")?B.data:B;const U=Y(m.parse);g.Function(U)?j=U:U&&g.String(U)&&(j=B=>N(B,U)),Ce(j(V,i,o)).then(B=>{u(B)})},onError(V){u(void 0),!f()&&(c||(E=>Ae(E.message||"fetch fail "+m.action)))(V,i,o)}});t.$handle.beforeFetch(_,{rule:i,api:o}).then(()=>{if(g.Function(m.action)){Ce(m.action(i,o)).then(V=>{_.onSuccess(V,!0)}).catch(V=>{_.onError(V)});return}k(()=>t.create.fetch(_,{inject:s,rule:i,api:o}))}).catch(V=>{})},a.wait||600))}const n={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 n},loadData:cn,t:fn,componentValidate:vt},hn={name:"html",loadChildren:!1,render(t,e){return e.prop.props.innerHTML=t.default(),e.vNode.make(e.prop.props.tag||"div",e.prop)},renderChildren(t){return{default:()=>t.filter(e=>g.String(e)).join("")}}};function pn(t){t=t+"=";const r=decodeURIComponent(document.cookie).split(";");for(let n=0;n<r.length;n++){let s=r[n];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(i){return s}}}return null}function mn(t){const e=localStorage.getItem(t);if(e)try{return JSON.parse(e)}catch(r){return e}return null}function gn(t){const e=sessionStorage.getItem(t);if(e)try{return JSON.parse(e)}catch(r){return e}return null}function xe(t,e){if(!e)return null;const r=e.split(".");let n=t(r.shift());return r.length?n==null?null:N(n,r):n}function yn(t){return xe(pn,t)}function $n(t){return xe(mn,t)}function bn(t){return xe(gn,t)}const _n={en:{required:"{title} is required",validate:{url:"{title} is not a valid url",email:"{title} is not a valid email",ip:"{title} {title} is not a valid ip",phone:"{title} {title} is not a valid phone",pattern:"{title} does not match pattern {pattern}",uppercase:"{title} must be all uppercase",lowercase:"{title} must be all lowercased",positive:"{title} is not a positive number",negative:"{title} is not a negative number",equal:"{title} is not equal to {equal}",min:"{title} cannot be less than {min}",max:"{title} cannot be greater than {max}",enum:"{title} must be one of {enum}",hasKeys:"{title} does not contain required fields {hasKeys}",minLen:"{title} must be at least {minLen}",maxLen:"{title} cannot be longer than {maxLen}",len:"{title} must be exactly {len}",integer:"{title} is not an integer",number:"{title} is not an number"}},"zh-cn":{required:"{title}不能为空",validate:{url:"{title}不是有效的 url 地址",email:"{title}不是有效的邮箱地址",ip:"{title}不是有效的 IP 地址",phone:"{title}不是正确的手机号",pattern:"{title}必须匹配 {pattern}",uppercase:"{title}必须全大写",lowercase:"{title}必须全小写",positive:"{title}不是正数",negative:"{title}不是负数",equal:"{title}必须等于 {equal}",min:"{title}必须大于等于 {min}",max:"{title}必须小于等于 {max}",enum:"{title}必须是 {enum} 之一",hasKeys:"{title}必须包含 {hasKeys} 字段",minLen:"{title}长度必须大于 {minLen}",maxLen:"{title}长度必须小于 {maxLen}",len:"{title}长度必须为 {len}",integer:"{title}必须为整数",number:"{title}必须为数字"}}};function Cn(t,e){let r;return arguments.length===2?(r=arguments[1],e=r[t]):r=arguments[2],{id:e,prop:r}}function qe(){return Cn("name",...arguments)}function wn(t){const e=t.key||[],r=t.array||[],n=t.normal||[];lt.push(...e),Ne.push(...r),Be.push(...n),_t([...e,...r,...n])}let Vn=1;const z={},Dt=Symbol("defValue");function At(t){const e={[Ue.name]:Ue},r={},n={},s={},i={},o=[],a=[],u=[t.extendApi],c=C({},dn),f=Tr();let h={global:{}};const p=t.isMobile===!0,m=l.reactive({$mobile:p}),_=ln(),V={},E={};wn(t.attrs||{});function j(d){const y=z[d];if(Array.isArray(y))return y.map($=>$.api());if(y)return y.api()}function U(d){o.push(d)}function B(){const d=qe(...arguments);d.id&&d.prop&&(n[d.id]=d.prop)}function Je(){const d=qe(...arguments);d.id&&d.prop&&(c[d.id]=g.Function(d.prop)?d.prop:q(C({},d.prop),{name:d.id}))}function Ee(d){_.use(d)}function F(d){if(arguments.length===0)return be;if(typeof d=="string"&&arguments.length===1)return r[L(d)];const y=qe(...arguments);if(!y.id||!y.prop)return be;const $=L(y.id),b=y.prop,S=b.merge===!0?r[$]:void 0;r[$]=Se(b,S||be),f[$]=P($),b.maker&&w(f,b.maker)}function D(d,y){let $;if(g.String(d)){if($=d,y===void 0)return e[$]}else $=d.displayName||d.name,y=d;if(!$||!y)return;const b=L($);e[$]=y,e[b]=y,delete _.aliasMap[$],delete _.aliasMap[b],delete r[$],delete r[b],y.formCreateParser&&F($,y.formCreateParser)}function x(){return Pr(Xe,e,n)}function pe(d,y){const $=x();return l.createApp({data(){return l.reactive({rule:d,option:y})},render(){return l.h($,C({ref:"fc"},this.$data))}})}function Re(){return Ue}function Yn(d,y){return g.Function(d.install)?d.install(ie,y):g.Function(d)&&d(ie,y),this}function ie(d,y){let $=pe(d,y||{});o.forEach(A=>{k(()=>A(ie,$))});const b=document.createElement("div");return((y==null?void 0:y.el)||document.body).appendChild(b),$.mount(b).$refs.fc.fapi}Se(ie,E);function Wn(d){let y=C({},t);return d?y.inherit={components:e,parsers:r,directives:n,modelFields:s,providers:c,useApps:o,maker:f,formulas:V,loadData:m}:delete y.inherit,At(y)}function Jn(d,y){s[d]=y}function Kn(d,y){V[d]=y}function Xn(d,y){const $=i[d]||{},b=$.parsers||{};y.parsers&&Object.keys(y.parsers).forEach(S=>{b[S]=Se(y.parsers[S],be)}),y.name=d,i[d]=q(C(C({},$),y),{parsers:b})}function Fe(d){d&&Object.keys(z).forEach(y=>{(Array.isArray(z[y])?z[y]:[z[y]]).forEach(b=>{b.bus.$emit("$loadData."+d)})})}function Ke(d,y){re(m,d,y),Fe(d)}function Oe(d,y){const $=(...b)=>k(()=>y(...b));$._driver=!0,Ke(d,$)}function Mt(d,y){const $=(d||"").split(".");d=$.shift();const b=$.join(".");if(v(m,d)||(m[d]=Dt),m[d]!==Dt){let S=m[d];return S&&S._driver?S=S(b):$.length&&(S=N(S,$)),S==null||S===""?y:S}else return y}function Zn(d){u.push(d)}function Qn(d){delete m[d],Fe(d)}function ei(d,y){a.push({name:d,callback:y})}function Xe(d){w(this,{id:Vn++,create:ie,vm:d,manager:un(t.manager),parsers:r,providers:c,modelFields:s,formulas:V,isMobile:p,rules:d.props.rule,name:d.props.name||we(),inFor:d.props.inFor,prop:{components:e,directives:n},get:null,drivers:i,renderDriver:null,refreshData:Fe,loadData:m,CreateNode:_,bus:new Ze,unwatch:[],options:l.ref({}),extendApiFn:u,fetchCache:new WeakMap,tmpData:l.reactive({})}),a.forEach(y=>{this.bus.$on(y.name,y.callback)}),l.nextTick(()=>{l.watch(this.options,()=>{this.$handle.$manager.updateOptions(this.options.value),this.api().refresh()},{deep:!0})}),w(d.appContext.components,e),w(d.appContext.directives,n),this.$handle=new J(this),this.name&&(this.inFor?(z[this.name]||(z[this.name]=[]),z[this.name].push(this)):z[this.name]=this)}Xe.isMobile=p,w(Xe.prototype,{init(){this.isSub()&&this.unwatch.push(l.watch(()=>this.vm.setupState.parent.setupState.fc.options.value,()=>{this.initOptions(),this.$handle.api.refresh()},{deep:!0,flush:"sync"})),this.vm.props.driver&&(this.renderDriver=typeof this.vm.props.driver=="object"?this.vm.props.driver:this.drivers[this.vm.props.driver]),!this.renderDriver&&this.vm.setupState.parent&&(this.renderDriver=this.vm.setupState.parent.setupState.fc.renderDriver),this.renderDriver||(this.renderDriver=this.drivers.default),this.initOptions(),this.$handle.init()},targetFormDriver(d,...y){if(this.bus.$emit(d,...y),this.renderDriver&&this.renderDriver[d])return k(()=>this.renderDriver[d](...y))},t(d,y,$){let b=$?$("$t."+d):this.globalLanguageDriver(d);return b==null&&(b=""),b&&y&&Object.keys(y).forEach(S=>{const A=new RegExp(`{${S}}`,"g");b=b.replace(A,y[S])}),b},globalDataDriver(d){let y=d.split(".");const $=y.shift(),b=this.options.value.globalData&&this.options.value.globalData[$];if(b){if(b.type==="static")return N(b.data,y);{let S;const A=this.fetchCache.get(b);if(A){if(A.status&&(S=N(A.data,y)),!A.loading)return S;A.loading=!1,this.fetchCache.set(b,A)}else this.fetchCache.set(b,{status:!1});const O=te(()=>{se();const K=this.fetchCache.get(b);this.options.value.globalData&&Object.values(this.options.value.globalData).indexOf(b)!==-1?(K&&(K.loading=!0,this.fetchCache.set(b,K)),this.bus.$emit("$loadData.$globalData."+$)):this.fetchCache.delete(b)},b.wait||600),ue=K=>{this.fetchCache.set(b,{status:!0,data:K}),this.bus.$emit("$loadData.$globalData."+$)},ce=(K,fe)=>{if(fe&&b.watch===!1)return se();if(fe){O();return}const de=this.$handle.loadFetchVar(De(b),K);de.targetRule=this.targetRule,this.$handle.api.fetch(de).then(oe=>{ue(oe)}).catch(oe=>{ue(null)})},se=this.watchLoadData(ce);return b.watch===!1&&se(),this.unwatch.push(se),S}}},getLocale(){let d=this.vm.setupState.top.props.locale;return d&&typeof d=="object"?d.name:typeof d=="string"?d:"zh-cn"},globalLanguageDriver(d){let y=this.vm.setupState.top.props.t,$=this.vm.setupState.top.props.locale,b;if(y&&(b=k(()=>y(d))),b==null&&$&&typeof $=="object"&&(b=N($,d)),b==null){const S=this.options.value.language||{},A=this.getLocale();b=N(S[A]||{},d),b==null&&(b=N(_n[A]||{},d))}return b},globalVarDriver(d){let y=d.split(".");const $=y.shift(),b=this.options.value.globalVariable&&this.options.value.globalVariable[$];if(b){const S=g.Function(b)?b:Y(b.handle);if(S){let A=S((...O)=>this.$handle.api.getData(...O),this.$handle.api);return N(A,y)}}},setData(d,y,$){$?Ke(d,y):(re(this.vm.setupState.top.setupState.fc.tmpData,d,y),this.bus.$emit("$loadData."+d))},getLoadData(d,y){let $=null;if(d!=null){let b=d.split(".");const S=b.shift();if($=N(this.vm.setupState.top.setupState.fc.tmpData,d),$!=null)return $;if(S==="$topForm")$=this.$handle.api.top.formData(!0);else if(S==="$scopeForm")$=this.$handle.api.scope.formData(!0);else if(S==="$form")$=this.$handle.api.formData(!0);else if(S==="$options")$=this.options.value;else if(S==="$globalData")$=this.globalDataDriver(b.join(".")),b=[];else if(S==="$var")$=this.globalVarDriver(b.join(".")),b=[];else if(S==="$locale")$=this.getLocale(),b=[];else if(S==="$t")$=this.globalLanguageDriver(b.join(".")),b=[];else{if(S==="$preview")return this.$handle.preview;$=Mt(d),b=[]}$&&b.length&&($=N($,b))}return $==null||$===""?y:$},watchLoadData(d,y){let $={};const b=O=>{this.get||(this.get=S),k(()=>{d(S,O)}),this.get===S&&(this.get=void 0)},S=(O,ue)=>{let ce;if(typeof O=="object"&&(ce=O.getValue,O=O.id),$[O])return $[O].val;const se=l.computed(()=>ce?ce():this.getLoadData(O,ue)),K=O.split("."),fe=K.shift(),de=K.shift()||"",oe=te(()=>{const he=ce?ce():this.getLoadData(O,ue);if($[O])((he instanceof Function||g.Object(he)||Array.isArray(he))&&he===$[O].val||JSON.stringify(he)!==JSON.stringify($[O].val))&&($[O].val=he,b(!0));else return},y||0),ri=l.watch(se,he=>{oe()});return this.bus.$on("$loadData."+fe,oe),de&&this.bus.$on("$loadData."+fe+"."+de,oe),$[O]={fn:()=>{this.bus.$off("$loadData."+fe,oe),de&&this.bus.$off("$loadData."+fe+"."+de,oe),ri()},val:se.value},se.value};b(!1);const A=()=>{Object.keys($).forEach(O=>$[O].fn()),$={}};return this.unwatch.push(A),A},isSub(){return this.vm.setupState.parent&&this.vm.props.extendOption},initOptions(){this.options.value={};let d=C({formData:{},submitBtn:{},resetBtn:{},globalEvent:{},globalData:{}},G(h));const y=this.isSub();y&&(d=this.mergeOptions(d,this.vm.setupState.parent.setupState.fc.options.value||{},!0)),d=this.mergeOptions(d,this.vm.props.option);const $=this.api();this.targetFormDriver("initOptions",d,{api:$,isSubForm:y}),this.updateOptions(d)},mergeOptions(d,y,$){return y=C({},y||{}),$&&["page","onSubmit","onReset","onCreated","onChange","onMounted","mounted","beforeUnmount","beforeSubmit","onBeforeUnmount","onReload","reload","formData","el","globalClass","style"].forEach(b=>{delete y[b]}),y.global&&(d.global=jr(d.global,y.global),delete y.global),this.$handle.$manager.mergeOptions([y],d),d},updateOptions(d){this.options.value=this.mergeOptions(this.options.value,d),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(k(()=>this.$handle.lifecycle("beforeUnmount")),this.name)if(this.inFor){const d=z[this.name].indexOf(this);z[this.name].splice(d,1)}else delete z[this.name];a.forEach(d=>{this.bus.$off(d.name,d.callback)}),this.tmpData={},this.unwatch.forEach(d=>d()),this.unwatch=[],this.$handle.reloadRule([])},updated(){this.$handle.bindNextTick(()=>this.bus.$emit("next-tick",this.$handle.api))}});function Lt(d){w(d,{version:t.version,ui:t.ui,isMobile:p,extendApi:Zn,getData:Mt,setDataDriver:Oe,setData:Ke,removeData:Qn,refreshData:Fe,maker:f,component:D,directive:B,setModelField:Jn,setFormula:Kn,setDriver:Xn,register:Je,$vnode:Re,parser:F,use:Yn,factory:Wn,componentAlias:Ee,copyRule:ft,copyRules:dt,mergeRule:Z,fetch:wt,$form:x,parseFn:Y,parseJson:it,toJson:ye,useApp:U,getApi:j,on:ei})}function ti(d){w(d,{create:ie,install(y,$){h=C(C({},h),$||{});const b=`_installedFormCreate${p?"Mobile":""}_${t.ui}`;if(y[b]===!0)return;y[b]=!0;const S=function(O,ue={}){return ie(O,ue)};Lt(S),y.config.globalProperties.$formCreate=S;const A=x();y.component(A.name,A),o.forEach(O=>{k(()=>O(d,y))})}})}if(Lt(E),ti(E),Oe("$cookie",yn),Oe("$localStorage",$n),Oe("$sessionStorage",bn),_.use({fragment:"fcFragment"}),t.install&&ie.use(t),U((d,y)=>{y.mixin({props:["formCreateInject"],emits:["fc.updateValue","fc.el"]})}),F(hn),t.inherit){const d=t.inherit;d.components&&w(e,d.components),d.parsers&&w(r,d.parsers),d.directives&&w(n,d.directives),d.modelFields&&w(s,d.modelFields),d.providers&&w(c,d.providers),d.useApps&&w(o,d.useApps),d.maker&&w(f,d.maker),d.loadData&&w(m,d.loadData),d.formulas&&w(V,d.formulas)}const ve=x();return Se(ve,E),Object.defineProperties(ve,{fetch:{get(){return E.fetch},set(d){E.fetch=d}}}),ve.util=E,ve}const jt={date:"YYYY-MM-DD",month:"YYYY-MM",week:"YYYY-wo",datetime:"YYYY-MM-DD HH:mm:ss",timerange:"HH:mm:ss",daterange:"YYYY-MM-DD",monthrange:"YYYY-MM",datetimerange:"YYYY-MM-DD HH:mm:ss",year:"YYYY"},It="datePicker",Sn={name:It,maker:function(){return["year","month","date","dates","week","datetime","datetimeRange","dateRange","monthRange"].reduce((t,e)=>(t[e]=P(It,{type:e.toLowerCase()}),t),{})}(),mergeProp(t){const e=t.prop.props;e.valueFormat||(e.valueFormat=jt[e.type]||jt.date)}},He="hidden",kn={name:He,maker:{[He]:(t,e)=>P(He)("",t,e)},render(){return[]}},ze="input",En={name:ze,maker:function(){const t=["password","url","email","text","textarea"].reduce((e,r)=>(e[r]=P(ze,{type:r}),e),{});return t.idate=P(ze,{type:"date"}),t}(),mergeProp(t){let{props:e}=t.prop;e&&e.autosize&&e.autosize.minRows&&(e.rows=e.autosize.minRows||2)}},Rn={name:"textarea",mergeProp(t){let{props:e}=t.prop;e.type="textarea",e&&e.autosize&&e.autosize.minRows&&(e.rows=e.autosize.minRows||2)}},Pt="slider",Fn={name:Pt,maker:{sliderRange:P(Pt,{range:!0})},toFormValue(t,e){let r=Array.isArray(t),n=e.prop.props,s=n.min||0,i;return n.range===!0?i=r?t:[s,parseFloat(t)||s]:i=r?parseFloat(t[0])||s:parseFloat(t),i}},Ge="timePicker",On={name:Ge,maker:{time:P(Ge,t=>t.props.isRange=!1),timeRange:P(Ge,t=>t.props.isRange=!0)},mergeProp(t){const e=t.prop.props;e.valueFormat||(e.valueFormat="HH:mm:ss")}},vn=[Sn,kn,En,Rn,Fn,On,{name:"FcRow",render(t,e){return e.vNode.col({props:{span:24}},{default:()=>[e.vNode.row(e.prop,t)]})}},{name:"select",toFormValue(t,e){return e.prop.props.multiple&&!Array.isArray(t)?M(t):t}}],R="el",Dn={button:R+"-button",icon:R+"-icon",slider:R+"-slider",rate:R+"-rate",upload:"fc-upload",cascader:R+"-cascader",popover:R+"-popover",tooltip:R+"-tooltip",colorPicker:R+"-colorPicker",timePicker:R+"-time-picker",timeSelect:R+"-time-select",datePicker:R+"-date-picker",switch:R+"-switch",select:"fc-select",checkbox:"fc-checkbox",radio:"fc-radio",inputNumber:R+"-input-number",number:R+"-input-number",input:R+"-input",textarea:R+"-input",formItem:R+"-form-item",form:R+"-form",frame:"fc-frame",col:R+"-col",row:R+"-row",tree:"fc-tree",inputTag:R+"-input-tag",inputOtp:R+"-input-otp",mention:R+"-mention",transfer:R+"-transfer",treeSelect:R+"-tree-select",autoComplete:R+"-autocomplete",auto:R+"-autocomplete",group:"fc-group",array:"fc-group",object:"fc-sub-form",subForm:"fc-sub-form"};function An(){return{form:{inline:!1,labelPosition:"right",labelWidth:"125px",disabled:!1,size:void 0},row:{show:!0,gutter:0},submitBtn:{type:"primary",loading:!1,disabled:!1,innerText:"",show:!0,col:void 0,click:void 0},resetBtn:{type:"default",loading:!1,disabled:!1,innerText:"",show:!1,col:void 0,click:void 0}}}function jn(t){return t.type==="tooltip"}function Nt(t,e){v(t,e)&&g.String(t[e])&&(t[e]={[e]:t[e],show:!0})}function Q(t){return t===!1}function In(t,e){v(t,e)&&!g.Object(t[e])&&(t[e]={show:!!t[e]})}function Ye(t){const e=C({},t);return delete e.children,e}const Pn={validate(){const t=this.form();return t?t.validate():new Promise(e=>e())},validateField(t){return new Promise((e,r)=>{const n=this.form();n?n.validateField(t,(s,i)=>{i?r(i):e(s)}):e()})},clearValidateState(t){const e=this.vm.refs[t.wrapRef];e&&e.clearValidate()},fieldChange(t,e,r,n){var s,i;n||(i=(s=this.vm.refs[t.wrapRef])==null?void 0:s.validate("change"))==null||i.catch(()=>{})},tidyOptions(t){return["submitBtn","resetBtn","row","info","wrap","col","title"].forEach(e=>{In(t,e)}),t},tidyRule({prop:t}){return Nt(t,"title"),Nt(t,"info"),t},mergeProp(t){const e={info:{trigger:"hover",placement:"top-start",icon:!0},title:{},col:{span:24},wrap:{}};["info","wrap","col","title"].forEach(r=>{t.prop[r]=X([this.options[r]||{},t.prop[r]||{}],e[r])})},getDefaultOptions(){return An()},update(){const t=this.options.form;this.rule={props:C({},t),on:{submit:e=>{e.preventDefault()}},style:t.style,type:"form"}},beforeRender(){const{key:t,ref:e,$handle:r}=this,n=this.options.form;w(this.rule,{key:t,ref:e,class:[n.className,n.class,"form-create",this.$handle.preview?"is-preview":""]}),w(this.rule.props,{model:r.formData})},render(t){return t.slotLen()&&!this.$handle.preview&&t.setSlot(void 0,()=>this.makeFormBtn()),this.$r(this.rule,Q(this.options.row.show)?t.getSlots():[this.makeRow(t)])},makeWrap(t,e){const r=t.prop,n=`${this.key}${t.key}`,s=r.col,i=this.isTitle(r)&&r.wrap.title!==!1,o=!s.labelWidth&&!i?0:s.labelWidth,{inline:a,col:u}=this.rule.props,c=r.wrap.class;delete r.wrap.class,delete r.wrap.title;const f=(g.Undef(r.wrap.show)?!t.input:Q(r.wrap.show))?e:this.$r(X([r.wrap,{props:q(C({labelWidth:o===void 0?o:tt(o),label:i?r.title.title:void 0},Ye(r.wrap||{})),{prop:t.id,rules:t.injectValidate()}),class:this.$render.mergeClass(c||r.className,"fc-form-item"),key:`${n}fi`,ref:t.wrapRef,type:"formItem"}]),C({default:()=>e},i?{label:()=>this.makeInfo(r,n,t)}:{}));return a===!0||Q(u)||Q(s.show)?f:this.makeCol(r,n,[f])},isTitle(t){if(this.options.form.title===!1)return!1;const e=t.title;return!(!e.title&&!e.native||Q(e.show))},makeInfo(t,e,r){var f,h,p,m,_,V;const n=C({},t.title),s=C({},t.info),i=jn(s),o=this.options.form,a=this.getSlot("title"),u=[a?a({title:(h=(f=r.refRule)==null?void 0:f.__$title)==null?void 0:h.value,rule:r.rule,options:this.options}):((m=(p=r.refRule)==null?void 0:p.__$title)==null?void 0:m.value)+(o.labelSuffix||o["label-suffix"]||"")];if(!Q(s.show)&&(s.info||s.native)&&!Q(s.icon)){const E={type:s.type||"popover",props:Ye(s),key:`${e}pop`};delete E.props.icon,delete E.props.show,delete E.props.info,delete E.props.align,delete E.props.native;const j="content";s.info&&!v(E.props,j)&&(E.props[j]=(V=(_=r.refRule)==null?void 0:_.__$info)==null?void 0:V.value),u[s.align!=="left"?"unshift":"push"](this.$r(X([s,E]),{[n.slot||(i?"default":"reference")]:()=>this.$r({type:"ElIcon",style:"top:2px",key:`${e}i`},{default:()=>this.$r({type:s.icon===!0?"icon-warning":s.icon})},!0)}))}const c=X([n,{props:Ye(n),key:`${e}tit`,class:"fc-form-title",type:n.type||"span",on:{click:(...E)=>{this.$handle.targetHook(r,"titleClick",{args:E})}}}]);return delete c.props.show,delete c.props.title,delete c.props.native,this.$r(c,u)},makeCol(t,e,r){const n=C({},t.col);return delete n.show,this.$r({class:this.$render.mergeClass(n.class,"fc-form-col"),type:"col",props:n||{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(Q(this.options.submitBtn.show)||t.push(this.makeSubmitBtn()),Q(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=C({},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=C({},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={};Nn(ne),Bn(ne),Tn(ne),Mn(ne),Ln(ne),Un(ne);function Nn(t){["group","tree","switch","upload","autoComplete","checkbox","cascader","colorPicker","datePicker","frame","inputNumber","inputTag","inputOtp","mention","transfer","treeSelect","radio","rate"].forEach(e=>{t[e]=P(e)}),t.auto=t.autoComplete,t.number=t.inputNumber,t.color=t.colorPicker,t.tag=t.inputTag}function Bn(t){t.treeSelectMultiple=P("treeSelect",{multiple:!0})}function Tn(t){const e="select",r="multiple";t.selectMultiple=P(e,{[r]:!0}),t.selectOne=P(e,{[r]:!1})}function Mn(t){const e="tree",r={treeSelected:"selected",treeChecked:"checked"};Object.keys(r).reduce((n,s)=>(n[s]=P(e,{type:r[s]}),n),t)}function Ln(t){const e="upload",r={image:["image",0],file:["file",0],uploadFileOne:["file",1],uploadImageOne:["image",1]};Object.keys(r).reduce((n,s)=>(n[s]=P(e,i=>i.props({uploadType:r[s][0],maxLength:r[s][1]})),n),t),t.uploadImage=t.image,t.uploadFile=t.file}function Un(t){const e={frameInputs:["input",0],frameFiles:["file",0],frameImages:["image",0],frameInputOne:["input",1],frameFileOne:["file",1],frameImageOne:["image",1]};return Object.keys(e).reduce((r,n)=>(r[n]=P("frame",s=>s.props({type:e[n][0],maxLength:e[n][1]})),r),t),t.frameInput=t.frameInputs,t.frameFile=t.frameFiles,t.frameImage=t.frameImages,t}function Bt(t,e){return g.Boolean(t)?t={show:t}:!g.Undef(t)&&!g.Object(t)&&(t={show:e}),t}function xn(t,e){return{formEl(){return e.$manager.form()},wrapEl(r){const n=e.getFieldCtx(r);if(n)return e.vm.refs[n.wrapRef]},validate(r){return new Promise((n,s)=>{const i=t.children,o=[e.$manager.validate()];i.filter(a=>!a.isScope).forEach(a=>{o.push(a.validate())}),Promise.all(o).then(()=>{n(!0),r&&r(!0)}).catch(a=>{s(a),r&&r(a),e.vm.emit("validate-fail",a,{api:t}),e.emitEvent("validate-fail",a,{api:t})})})},validateField(r,n){return new Promise((s,i)=>{const a=typeof r=="object"?W(r):e.getCtx(r);if(!a){s(null),n&&n(null);return}const u=e.subForm[a.id],c=[e.$manager.validateField(a.id)];M(u).filter(f=>!f.isScope).forEach(f=>{c.push(f.validate())}),Promise.all(c).then(()=>{s(null),n&&n(null)}).catch(f=>{i(f),n&&n(f),e.vm.emit("validate-field-fail",f,{field:r,api:t})})})},validateFields(r,n){return new Promise((s,i)=>{Array.isArray(r)||(r=[r]);const o=r.map(a=>t.validateField(a));Promise.all(o).then(()=>{s(null),n&&n(null)}).catch(a=>{i(a),n&&n(a)})})},clearValidateState(r,n=!0){t.helper.tidyFields(r).forEach(s=>{n&&this.clearSubValidateState(s),e.getCtxs(s).forEach(i=>{e.$manager.clearValidateState(i)})})},clearSubValidateState(r){t.helper.tidyFields(r).forEach(n=>{e.getCtxs(n).forEach(s=>{const i=e.subForm[s.id];i&&(Array.isArray(i)?i.forEach(o=>{o.clearValidateState()}):i&&i.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 n=Bt(e.options.submitBtn,!0);w(n,r),e.options.submitBtn=n,t.refreshOptions()},resetBtnProps:(r={})=>{let n=Bt(e.options.resetBtn,!1);w(n,r),e.options.resetBtn=n,t.refreshOptions()},submit(r,n){return new Promise((s,i)=>{(e.options.validateOnSubmit===!1?Promise.resolve():t.validate()).then(()=>{let a=t.formData();e.beforeSubmit(a).then(()=>{g.Function(r)&&k(()=>r(a,t)),g.Function(e.options.onSubmit)&&k(()=>e.options.onSubmit(a,t)),e.vm.emit("submit",a,t),s(a)}).catch(u=>{})}).catch((...a)=>{g.Function(n)&&k(()=>n(t,...a)),i(...a)})})}}}const Tt={name:"required",load(t,e,r){const n=qn(t.getValue());let s;if(n.required===!1)t.clearProp(),r.clearValidateState([e.field]);else{const i=C({required:!0,validator(a,u,c){o(),g.empty(u)?c(i.message):c()}},n),o=()=>{var u;const a=(u=e.__fc__.refRule.__$title)==null?void 0:u.value;if(s!==a)if(s=a,!n.message)i.message=r.t("required",{title:a})||a+(r.getLocale()==="en"?" is required":"不能为空");else{const c=n.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);c&&(i.message=r.t(c[1],{title:a}))}};o(),t.getProp().validate=[i]}r.sync(e)},watch(...t){Tt.load(...t)}};function qn(t){return g.Boolean(t)?{required:t}:g.String(t)?{message:t}:g.Undef(t)?{required:!1}:g.Function(t)?{validator:t}:g.Object(t)?t:{}}function Hn(t){t.componentAlias(Dn),Dr.forEach(e=>{t.component(e.name,e)}),t.register(Tt),vn.forEach(e=>{t.parser(e)}),Object.keys(ne).forEach(e=>{t.maker[e]=ne[e]}),typeof window!="undefined"&&window.ElementPlus&&t.useApp((e,r)=>{r.use(window.ElementPlus)})}function zn(){return At({ui:"element-ui",version:"3.3.1",manager:Pn,extendApi:xn,install:Hn,attrs:{normal:["col","wrap"],array:["className"],key:["title","info"]}})}const We=zn();typeof window!="undefined"&&(window.formCreate=We);const Gn=We.maker;I.default=We,I.maker=Gn,Object.defineProperties(I,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
14
|
+
err: ${o}`);return}}return t}function st(t,e){return JSON.parse(t,function(r,n){return m.Undef(n)||!n.indexOf?n:Y(n,e)})}let Fr=0;function Se(){const t=370+ ++Fr;return"F"+Math.random().toString(36).substr(3,3)+(+`${Date.now()}`).toString(36)+t.toString(36)+"c"}function re(t,e,r){let n=t,o;return(e||"").split(".").forEach(i=>{o&&((!n[o]||typeof n[o]!="object")&&(n[o]={}),n=n[o]),o=i}),n[o]=r,n}const Rr=u.defineComponent({name:"fcGroup",props:{field:String,rule:Array,expand:Number,options:Object,button:{type:Boolean,default:!0},max:{type:Number,default:0},min:{type:Number,default:0},modelValue:{type:Array,default:()=>[]},defaultValue:Object,sortBtn:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},syncDisabled:{type:Boolean,default:!0},title:{type:[String,Function],default:null},type:{type:String,default:"default"},onBeforeRemove:{type:Function,default:()=>{}},onBeforeAdd:{type:Function,default:()=>{}},formCreateInject:Object,parse:Function},data(){return{len:0,cacheRule:{},cacheValue:{},sort:[],form:u.markRaw(this.formCreateInject.form.$form())}},emits:["update:modelValue","change","itemMounted","remove","add"],watch:{rule:{handler(t,e){Object.keys(this.cacheRule).forEach(r=>{const n=this.cacheRule[r];if(n.$f){const o=n.$f.formData();if(t===e)n.$f.deferSyncValue(()=>{ye(n.rule,t),n.$f.setValue(o)},!0);else{const i=n.$f.formData();n.$f.once("reloading",()=>{n.$f.setValue(i)}),n.rule=G(t)}}})},deep:!0},expand(t){let e=t-this.modelValue.length;e>0&&this.expandRule(e)},modelValue:{handler(t){t=t||[];let e=this.sort,r=e.length,n=r-t.length;if(n<0){for(let o=n;o<0;o++)this.addRule(t.length+o,!0);for(let o=0;o<r;o++)this.setValue(e[o],t[o])}else{if(n>0)for(let o=0;o<n;o++)this.removeRule(e[r-o-1]);t.forEach((o,i)=>{this.setValue(e[i],t[i])})}},deep:!0}},methods:{_value(t){return t&&E(t,this.field)?t[this.field]:t},cache(t,e){this.cacheValue[t]=JSON.stringify(e)},input(t){this.$emit("update:modelValue",t),this.$emit("change",t)},formData(t,e){const r=this.cacheRule,n=this.sort;if(n.filter(i=>r[i]&&r[i].$f).length!==n.length)return;const o=n.map(i=>{const s=t===i?e:C({},this.cacheRule[i].$f.form),a=this.field?m.Undef(s[this.field])?null:s[this.field]:s;return this.cache(i,a),a});this.input(o)},setValue(t,e){const r=this.field;r&&(e={[r]:this._value(e)}),this.cacheValue[t]!==JSON.stringify(r?e[r]:e)&&(this.cacheRule[t].$f&&this.cacheRule[t].$f.coverValue(e),this.cache(t,e))},addRule(t,e){const r=this.formCreateInject.form.copyRules(this.rule||[]),n=this.options?C({},this.options):{submitBtn:!1,resetBtn:!1};if(this.defaultValue){n.formData||(n.formData={});const o=G(this.defaultValue);w(n.formData,this.field?{[this.field]:o}:o)}this.parse&&this.parse({rule:r,options:n,index:this.sort.length}),this.cacheRule[++this.len]={rule:r,options:n},this.sort=Object.keys(this.cacheRule),e&&u.nextTick(()=>this.$emit("add",r,Object.keys(this.cacheRule).length-1))},add$f(t,e,r){this.cacheRule[e].$f=r,u.nextTick(()=>{this.$emit("itemMounted",r,Object.keys(this.cacheRule).indexOf(e))})},removeRule(t,e){const r=Object.keys(this.cacheRule).indexOf(t);delete this.cacheRule[t],delete this.cacheValue[t],this.sort=Object.keys(this.cacheRule),e&&u.nextTick(()=>this.$emit("remove",r))},add(t){if(this.disabled||this.onBeforeAdd(this.modelValue)===!1)return;const e=[...this.modelValue];e.push(this.defaultValue?G(this.defaultValue):this.field?null:{}),this.input(e)},del(t,e){if(this.disabled)return;const r=()=>{this.removeRule(e,!0);const n=[...this.modelValue];n.splice(t,1),this.input(n)};Ve(this.onBeforeRemove(this.modelValue,t)).then(n=>{n!==!1&&r()})},addIcon(t){return u.createVNode("div",{class:"_fc-group-btn _fc-group-plus-minus",onClick:this.add},null)},delIcon(t,e){return u.createVNode("div",{class:"_fc-group-btn _fc-group-plus-minus _fc-group-minus",onClick:()=>this.del(t,e)},null)},sortUpIcon(t){return u.createVNode("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-up",onClick:()=>this.changeSort(t,-1)},null)},sortDownIcon(t){return u.createVNode("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-down",onClick:()=>this.changeSort(t,1)},null)},changeSort(t,e){const r=this.sort[t];this.sort[t]=this.sort[t+e],this.sort[t+e]=r,this.formCreateInject.subForm(this.sort.map(n=>this.cacheRule[n].$f)),this.formData(0)},sortIcon(t,e){const r=t>0,n=t<e-1,o=[];return!r&&!n?o:this.type==="card"&&r&&n?(o.push(u.createVNode("div",{class:"_fc-group-btn _fc-group-sort"},[u.createVNode("div",{class:" _fc-group-sort-up",onClick:()=>this.changeSort(t,-1)},null),u.createVNode("div",{class:" _fc-group-sort-down",onClick:()=>this.changeSort(t,1)},null)])),o):(r&&o.push(this.sortUpIcon(t)),n&&o.push(this.sortDownIcon(t)),o)},makeIcon(t,e,r){if(this.$slots.button)return this.$slots.button({total:t,index:e,vm:this,key:r,del:()=>this.del(e,r),add:this.add});const n=[];if((!this.max||t<this.max)&&t===e+1&&n.push(this.addIcon(r)),t>this.min&&n.push(this.delIcon(e,r)),this.sortBtn){const o=this.sortIcon(e,t);o&&n.push(...o)}return n},expandRule(t){for(let e=0;e<t;e++)this.modelValue.push(this.field?null:{});this.input([...this.modelValue])},getTitle(t,e){return typeof this.title=="function"?this.title(t,this.modelValue[t],e):typeof this.title=="string"?this.title.replace("{index}",t+1):!1}},created(){const t=(this.expand||0)-this.modelValue.length;for(let e=0;e<this.modelValue.length;e++)this.addRule(e);t>0&&this.expandRule(t)},render(){const t=this.sort,e=this.button,r=this.form,n=this.disabled,o=this.type==="card",i=t.length===0?this.$slots.default?this.$slots.default({vm:this,add:this.add}):u.createVNode("div",{key:"a_def",class:"_fc-group-plus-minus _fc-group-add fc-clock",onClick:this.add},null):t.map((s,a)=>{const{rule:l,options:c}=this.cacheRule[s],f=e&&!n?this.makeIcon(t.length,a,s):[],d=this.getTitle(a,s);return o?u.createVNode("div",{class:"_fc-group-container",key:s},[u.createVNode("div",{class:"_fc-group-header"},[d===!1?u.createVNode("div",{class:"_fc-group-idx"},[a+1]):null,d!==!1?u.createVNode("div",{class:"_fc-group-title"},[d]):null,u.createVNode("div",{class:"_fc-group-handle fc-clock"},[f.length?f:null])]),u.createVNode("div",{class:"_fc-group-content"},[u.createVNode(r,u.mergeProps({key:s},q(C({},this.$attrs),{disabled:n,"onUpdate:modelValue":p=>this.formData(s,p),"onUpdate:api":p=>this.add$f(a,s,p),inFor:!0,modelValue:this.field?{[this.field]:this._value(this.modelValue[a])}:this.modelValue[a],rule:l,option:c,extendOption:!0})),null)])]):u.createVNode("div",{class:"_fc-group-container",key:s},[u.createVNode(r,u.mergeProps({key:s},q(C({},this.$attrs),{disabled:n,"onUpdate:modelValue":p=>this.formData(s,p),"onUpdate:api":p=>this.add$f(a,s,p),inFor:!0,modelValue:this.field?{[this.field]:this._value(this.modelValue[a])}:this.modelValue[a],rule:l,option:c,extendOption:!0})),null),u.createVNode("div",{class:"_fc-group-idx"},[a+1]),f.length?u.createVNode("div",{class:"_fc-group-handle fc-clock"},[f]):null])});return u.createVNode("div",{key:"con",class:"_fc-group "+(n?"_fc-group-disabled":"")+(o?" _fc-group-card":"")},[i])}}),Dr=u.defineComponent({name:"fcSubForm",props:{rule:Array,options:{type:Object,default:()=>u.reactive({submitBtn:!1,resetBtn:!1})},modelValue:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1},syncDisabled:{type:Boolean,default:!0},formCreateInject:Object},data(){return{cacheValue:{},subApi:{},form:u.markRaw(this.formCreateInject.form.$form())}},emits:["fc:subform","update:modelValue","change","itemMounted"],watch:{modelValue(t){this.setValue(t)}},methods:{formData(t){this.cacheValue=JSON.stringify(t),this.$emit("update:modelValue",t),this.$emit("change",t)},setValue(t){const e=JSON.stringify(t);this.cacheValue!==e&&(this.cacheValue=e,this.subApi.coverValue(t||{}))},add$f(t){this.subApi=t,u.nextTick(()=>{this.$emit("itemMounted",t)})}},render(){const t=this.form;return u.createVNode(t,{disabled:this.disabled,"onUpdate:modelValue":this.formData,modelValue:this.modelValue,"onUpdate:api":this.add$f,rule:this.rule,option:this.options,extendOption:!0},null)}}),Ar={name:"IconWarning"},jr={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"};function Pr(t,e,r,n,o,i){return u.openBlock(),u.createElementBlock("svg",jr,[...e[0]||(e[0]=[u.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 110 896 448 448 0 010-896zm0 832a384 384 0 000-768 384 384 0 000 768zm48-176a48 48 0 11-96 0 48 48 0 0196 0zm-48-464a32 32 0 0132 32v288a32 32 0 01-64 0V288a32 32 0 0132-32z"},null,-1)])])}const Ir=[Gt,hr,pr,yr,$r,Sr,Rr,Dr,ee(Ar,[["render",Pr]])],ot=["props"],at=["class","style","directives"],lt=["on","hook"],Q=(t,e={},r={})=>{const n=[...ot,...r.normal||[]],o=[...at,...r.array||[]],i=[...lt,...r.functional||[]],s=r.props||[];return t.reduce((a,l)=>{for(const c in l)if(a[c])if(s.indexOf(c)>-1)a[c]=Q([l[c]],a[c]);else if(n.indexOf(c)>-1)a[c]=C(C({},a[c]),l[c]);else if(o.indexOf(c)>-1){const f=a[c]instanceof Array?a[c]:[a[c]],d=l[c]instanceof Array?l[c]:[l[c]];a[c]=[...f,...d]}else if(i.indexOf(c)>-1)for(const f in l[c])if(a[c][f]){const d=a[c][f]instanceof Array?a[c][f]:[a[c][f]],p=l[c][f]instanceof Array?l[c][f]:[l[c][f]];a[c][f]=[...d,...p]}else a[c][f]=l[c][f];else if(c==="hook")for(let f in l[c])a[c][f]?a[c][f]=Nr(a[c][f],l[c][f]):a[c][f]=l[c][f];else a[c]=l[c];else n.indexOf(c)>-1||i.indexOf(c)>-1||s.indexOf(c)>-1?a[c]=C({},l[c]):o.indexOf(c)>-1?a[c]=l[c]instanceof Array?[...l[c]]:typeof l[c]=="object"?C({},l[c]):l[c]:a[c]=l[c];return a},e)},Nr=(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","link","prefix","suffix","update","sync","optionsTo","key","slotUpdate","computed","preview","component","cache","modelEmit"],Be=["validate","children","control"],Te=["effect","deep","renderSlots"];function ct(){return[...ut,...ot,...at,...lt,...Be,...Te]}function U(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 Me(t,e){return{value:t,enumerable:!1,configurable:!1,writable:!0}}function dt(t,e){return ht([t],e||!1)[0]}function ht(t,e){return ye([],[...t],e||!1)}const Br={array:Be,normal:Te};function X(t,e){return Q(Array.isArray(e)?e:[e],t,Br),t}function pt(t){const e=m.Function(t.getRule)?t.getRule():t;return e.type||(e.type="input"),e}function Tr(t,e){return t?(Object.keys(e||{}).forEach(r=>{e[r]&&(t[r]=X(t[r]||{},e[r]))}),t):e}function mt(t,e){Object.defineProperties(t,Object.keys(e).reduce((r,n)=>(r[n]={get(){return e[n]()}},r),{}))}function K(t){return t.__fc__||(t.__origin__?t.__origin__.__fc__:null)}function k(t,e){try{e=t()}catch(r){Or(r)}return e}function ke(){const t={},e=r=>r||"default";return{setSlot(r,n){r=e(r),!(!n||Array.isArray(n)&&n.length)&&(t[r]||(t[r]=[]),t[r].push(n))},getSlot(r,n){r=e(r);const o=[];return(t[r]||[]).forEach(i=>{if(Array.isArray(i))o.push(...i);else if(m.Function(i)){const s=i(...n||[]);Array.isArray(s)?o.push(...s):o.push(s)}else m.Undef(i)||o.push(i)}),o},getSlots(){const r={};return Object.keys(t).forEach(n=>{r[n]=(...o)=>this.getSlot(n,o)}),r},slotLen(r){return r=e(r),t[r]?t[r].length:0},mergeBag(r){if(!r)return this;const n=m.Function(r.getSlots)?r.getSlots():r;return Array.isArray(r)||u.isVNode(r)?this.setSlot(void 0,()=>r):Object.keys(n).forEach(o=>{this.setSlot(o,n[o])}),this}}}function gt(t){const e=C({},t.props||{});return Object.keys(t.on||{}).forEach(r=>{r.indexOf("-")>0&&(r=U(r));const n=`on${nt(r)}`;Array.isArray(e[n])?e[n]=[...e[n],t.on[r]]:e[n]?e[n]=[e[n],t.on[r]]:e[n]=t.on[r]}),e.key=t.key,e.ref=t.ref,e.class=t.class,e.id=t.id,e.style=t.style,e.slot&&delete e.slot,e}function ve(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 m.empty(t)},notEmpty(t){return!m.empty(t)},pattern(t,e){return new RegExp(e,"g").test(t)}};function T(t,e){return(Array.isArray(e)?e:(e||"").split(".")).forEach(r=>{t!=null&&(t=t[r])}),t}function Mr(t){const e=/{{\s*(.*?)\s*}}/g;let r;const n={};for(;(r=e.exec(t))!==null;)r[1]&&(n[r[1]]=!0);return Object.keys(n)}function $t(t){let e=t.split("."),r=[],n="";return e.forEach((o,i)=>{i===0?n=o:n+="."+o,r.push(n)}),r.join(" && ")}function bt(t){const e=[];let r="",n=0;for(let o=0;o<t.length;o++){const i=t[o];i==="["?(n===0&&r&&(e.push({type:"key",value:r}),r=""),n++,r+=i):i==="]"?(n--,r+=i,n===0&&(e.push({type:"bracket",value:bt(r.slice(1,-1))}),r="")):i==="."&&n===0?r&&(e.push({type:"key",value:r}),r=""):r+=i}return r&&e.push({type:"key",value:r}),e.map(o=>o.type==="key"?{key:o.value}:{children:o.value})}const Ee=(t,e)=>{if(!(!t||t===e)){if(t.props.formCreateInject)return t.props.formCreateInject;if(t.parent)return Ee(t.parent,e)}};function Lr(t,e){if(t===e)return!0;if(t==null||e==null)return t===e;const r=typeof t;return r!==typeof e||r==="string"||r==="boolean"?!1:r==="number"?Number.isNaN(t)&&Number.isNaN(e):be(t)===be(e)}function _t(t,e){if(t===e)return!0;t=t||{},e=e||{};const r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(let o=0;o<r.length;o++){const i=r[o];if(!Object.prototype.hasOwnProperty.call(e,i)||!Lr(t[i],e[i]))return!1}return!0}function Ur(t,e,r){return u.defineComponent({name:"FormCreate"+(t.isMobile?"Mobile":""),components:e,directives:r,props:{rule:{type:Array,required:!0,default:()=>[]},option:{type:Object,default:()=>({})},extendOption:Boolean,driver:[String,Object],modelValue:Object,disabled:{type:Boolean,default:void 0},preview:{type:Boolean,default:void 0},index:[String,Number],api:Object,locale:[String,Object],t:Function,name:String,subForm:{type:Boolean,default:!0},inFor:Boolean},emits:["update:api","update:modelValue","mounted","beforeUnmount","submit","reset","change","emit-event","control","remove-rule","remove-field","sync","reload","repeat-field","update","validate-field-fail","validate-fail","created"],render(){return this.fc.render()},setup(n){const o=u.getCurrentInstance();u.provide("parentFC",o);const i=u.inject("parentFC",null);let s=i;if(i)for(;s.setupState.parent;)s=s.setupState.parent;else s=o;const{rule:a,modelValue:l,subForm:c,inFor:f}=u.toRefs(n),d=u.reactive({ctxInject:{},destroyed:!1,isShow:!0,unique:1,renderRule:[...a.value||[]]});let p=l.value||{};const $=new t(o),y=$.api(),V=f.value,v=()=>{if(i){const F=Ee(o,i);if(F){let A;V?(A=L(F.getSubForm()),A.push(y)):A=y,F.subForm(A)}}},j=()=>{const F=Ee(o,i);if(F)if(V){const A=L(F.getSubForm()),x=A.indexOf(y);x>-1&&A.splice(x,1)}else F.subForm()};let P=null;u.onBeforeMount(()=>{u.watchEffect(()=>{let F="";const A=n.option&&n.option.globalClass||{};Object.keys(A).forEach(x=>{let ge="";A[x].style&&Object.keys(A[x].style).forEach(Fe=>{ge+=$e(Fe)+":"+A[x].style[Fe]+";"}),A[x].content&&(ge+=A[x].content+";"),ge&&(F+=`.${x}{${ge}}`)}),n.option&&n.option.style&&(F+=n.option.style),P||(P=document.createElement("style"),P.type="text/css",document.head.appendChild(P)),P.innerHTML=F||""})});const B=te(()=>{$.bus.$emit("$loadData.$topForm")},100),pe=te(function(){$.bus.$emit("$loadData.$scopeForm")},100),Je=te(()=>{$.bus.$emit("$loadData.$form")},100),me=F=>{$.bus.$emit("change-$form."+F)};return u.onMounted(()=>{i&&(y.top.bus.$on("$loadData.$form",B),y.top.bus.$on("change",me)),y!==y.scope&&y.scope.bus.$on("$loadData.$scopeForm",pe),$.mounted()}),u.onBeforeUnmount(()=>{i&&(y.top.bus.$off("$loadData.$form",B),y.top.bus.$off("change",me)),y!==y.scope&&y.scope.bus.$off("$loadData.$scopeForm",pe),j(),d.destroyed=!0,$.unmount(),P&&(P.parentNode||P.parentElement)&&document.head.removeChild(P)}),u.onUpdated(()=>{$.updated()}),v(),u.watch(()=>n.option,()=>{$.initOptions(),y.refresh()},{deep:!0,flush:"sync"}),u.watch(()=>[...a.value],F=>{$.$handle.isBreakWatch()||F.length===d.renderRule.length&&F.every(A=>d.renderRule.indexOf(A)>-1)||($.$handle.updateAppendData(),$.$handle.reloadRule(a.value),o.setupState.renderRule())}),u.watch(()=>[n.disabled,n.preview],()=>{y.refresh()}),u.watch(l,F=>{_t(F||{},p)||(y.config.forceCoverValue?y.coverValue(F||{}):y.setValue(F||{}))},{deep:!0,flush:"post"}),u.watch(()=>n.index,()=>{y.coverValue({}),$.$handle.updateAppendData(),u.nextTick(()=>{u.nextTick(()=>{y.clearValidateState()})})},{flush:"sync"}),q(C({fc:u.markRaw($),parent:i&&u.markRaw(i),top:u.markRaw(s),fapi:u.markRaw(y)},u.toRefs(d)),{getGroupInject:()=>Ee(o,i),refresh(){++d.unique},renderRule(){d.renderRule=[...a.value||[]]},updateValue(F){d.destroyed||_t(F,p)||(p=F,o.emit("update:modelValue",F),u.nextTick(()=>{Je(),i?c.value||pe():(B(),pe())}))}})},created(){const n=u.getCurrentInstance();n.emit("update:api",n.setupState.fapi),n.setupState.fc.init()}})}function Ct(){return{props:{},on:{},options:[],children:[],hidden:!1,display:!0,value:void 0}}function N(t,e){return(r,n,o,i={})=>{const s=new Le(t,r,n,o,i);return e&&(m.Function(e)?e(s):s.props(e)),s}}function Le(t,e,r,n,o){this._data=w(Ct(),{type:t,title:e,field:r,value:n,props:o||{}}),this.event=this.on}w(Le.prototype,{getRule(){return this._data},setProp(t,e){return H(this._data,t,e),this},modelField(t){return this._data.modelField=t,this},_clone(){const t=new this.constructor;return t._data=dt(this._data),t}});function wt(t){t.forEach(e=>{Le.prototype[e]=function(r){return X(this._data,{[e]:arguments.length<2?r:{[r]:arguments[1]}}),this}})}wt(ct());const qr=N("");function Hr(t,e,r){let n=qr("",e);return n._data.type=t,n._data.title=r,n}function zr(){return{create:Hr,factory:N}}function xr(t,e,r){const n=`fail to ${t} ${r.status}'`,o=new Error(n);return o.status=r.status,o.url=t,o}function Vt(t){const e=t.responseText||t.response;if(!e)return e;try{return JSON.parse(e)}catch(r){return e}}function St(t){if(typeof XMLHttpRequest=="undefined")return;const e=new XMLHttpRequest;let r=t.action||"";if(e.upload&&t.onProgress&&e.upload.addEventListener("progress",i=>{i.percent=i.total>0?i.loaded/i.total*100:0,t.onProgress(i)}),t.query){const i=m.String(t.query)?t.query:Object.keys(t.query).reduce((a,l)=>(a[l]=t.query[l]===null||t.query[l]===void 0?"":t.query[l],a),{}),s=new URLSearchParams(i).toString();s&&(r.includes("?")?r+=`&${s}`:r+=`?${s}`)}e.onerror=function(s){t.onError(s)},e.onload=function(){if(e.status<200||e.status>=300)return t.onError(xr(r,t,e),Vt(e));t.onSuccess(Vt(e))},e.open(t.method||"get",r,!0);let n;(t.data||t.file)&&(t.file||(t.dataType||"").toLowerCase()!=="json"?(n=new FormData,Object.keys(t.data||{}).map(i=>{n.append(i,t.data[i])})):(n=JSON.stringify(t.data||{}),e.setRequestHeader("content-type","application/json"))),t.file&&n.append(t.filename,t.file,t.file.name),t.withCredentials&&"withCredentials"in e&&(e.withCredentials=!0);const o=t.headers||{};Object.keys(o).forEach(i=>{o[i]!=null&&e.setRequestHeader(i,o[i])}),e.send(n)}function kt(t,e,r){return new Promise((n,o)=>{(e||St)(q(C({},t),{onSuccess(i){let s=l=>l;const a=Y(t.parse);m.Function(a)?s=a:a&&m.String(a)&&(s=l=>T(l,a)),Ve(s(i,t.targetRule,r)).then(l=>{n(l)})},onError(i){o(i)}}))})}function _e(t){return G(t)}function Gr(t){function e(i){return m.Undef(i)?i=t.fields():Array.isArray(i)||(i=[i]),i}function r(i,s,a){m.Undef(i)?i=Object.keys(C(C({},t.fieldCtx),t.nameCtx)):Array.isArray(i)||(i=[i]),i.forEach(l=>{const c=t.fieldCtx[l]||t.nameCtx[l];c&&c.forEach(f=>{H(f.rule,s,a),t.$render.clearCache(f)})})}function n(){const i=t.subForm;return Object.keys(i).reduce((s,a)=>{const l=i[a];return l&&(Array.isArray(l)?s.push(...l):s.push(l)),s},[])}const o={get isScope(){return t.vm.props.subForm===!1},get isPreview(){return t.preview},get config(){return t.options},set config(i){t.fc.options.value=i},get options(){return t.options},set options(i){t.fc.options.value=i},get form(){return t.form},get rule(){return t.rules},get parent(){return t.vm.setupState.parent&&t.vm.setupState.parent.setupState.fapi},get top(){return o.parent?o.parent.top:o},get scope(){let i=t.vm;for(;i&&i.setupState.fapi;)if(i.props.subForm)i=i.setupState.parent;else return i.setupState.fapi;return o.top},get children(){return n()},get siblings(){const i=t.vm.setupState.getGroupInject();if(i){const s=i.getSubForm();if(Array.isArray(s))return[...s]}},get index(){const i=o.siblings;if(i){const s=i.indexOf(o);return s>-1?s:void 0}},get formulas(){return C({},t.fc.formulas)},formData(i){if(i==null||typeof i=="boolean"){const s={};return Object.keys(t.form).forEach(a=>{(i===!0||t.ignoreFields.indexOf(a)===-1)&&(s[a]=_e(t.form[a]))}),s}else return e(i).reduce((s,a)=>(s[a]=o.getValue(a),s),{})},getValue(i){const s=t.getFieldCtx(i);return s?_e(s.rule.value):t.options.appendValue!==!1&&E(t.appendData,i)?_e(t.appendData[i]):void 0},coverValue(i){const s=C({},i||{});t.deferSyncValue(()=>{t.appendData={},o.fields().forEach(a=>{const l=t.fieldCtx[a];if(l){const c=E(i,a);l.forEach(f=>{f.rule.value=c?i[a]:void 0}),delete s[a]}}),w(t.appendData,s)},!0)},setValue(i){let s=i;arguments.length>=2&&(s={[i]:arguments[1]}),t.deferSyncValue(()=>{Object.keys(s).forEach(a=>{const l=t.fieldCtx[a];if(!l)return t.appendData[a]=s[a];l.forEach(c=>{c.rule.value=s[a]})})},!0)},removeField(i){const s=t.getCtx(i);return t.deferSyncValue(()=>{t.getCtxs(i).forEach(a=>{a.rm()})},!0),s?s.origin:void 0},removeRule(i){const s=i&&K(i);if(s)return s.rm(),s.origin},fields:()=>t.fields(),append:(i,s,a)=>{let l=t.sort.length-1,c;const f=t.getCtx(s);if(f)if(a){if(c=f.getPending("children",f.rule.children),!Array.isArray(c))return;l=f.rule.children.length-1}else l=f.root.indexOf(f.origin),c=f.root;else c=t.rules;c.splice(l+1,0,i)},prepend:(i,s,a)=>{let l=0,c;const f=t.getCtx(s);if(f)if(a){if(c=f.getPending("children",f.rule.children),!Array.isArray(c))return}else l=f.root.indexOf(f.origin),c=f.root;else c=t.rules;c.splice(l,0,i)},hidden(i,s){r(s,"hidden",!!i),t.refresh()},hiddenStatus(i){const s=t.getCtx(i);if(s)return!!s.rule.hidden},display(i,s){r(s,"display",!!i),t.refresh()},displayStatus(i){const s=t.getCtx(i);if(s)return!!s.rule.display},disabled(i,s){e(s).forEach(a=>{t.getCtxs(a).forEach(l=>{H(l.rule.props,"disabled",!!i)})}),t.refresh()},all(i){return Object.keys(t.ctxs).map(s=>{const a=t.ctxs[s];return i?a.origin:a.rule})},model(i){return t.fields().reduce((s,a)=>{const l=t.fieldCtx[a][0];return s[a]=i?l.origin:l.rule,s},{})},component(i){return Object.keys(t.nameCtx).reduce((s,a)=>{const l=t.nameCtx[a].map(c=>i?c.origin:c.rule);return s[a]=l.length===1?l[0]:l,s},{})},bind(){return o.form},reload:i=>{t.reloadRule(i)},updateOptions(i){t.fc.updateOptions(i),o.refresh()},onSubmit(i){o.updateOptions({onSubmit:i})},sync:i=>{if(Array.isArray(i)){i.forEach(a=>o.sync(a));return}let s=m.Object(i)?K(i):t.getCtxs(i);s&&(s=Array.isArray(s)?s:[s],s.forEach(a=>{if(!a.deleted){const l=t.subForm[a.id];l&&(Array.isArray(l)?l.forEach(c=>{c.refresh()}):l&&l.refresh()),t.$render.clearCache(a)}}),t.refresh())},refresh:()=>{n().forEach(i=>{i.refresh()}),t.$render.clearCacheAll(),t.refresh()},refreshOptions(){t.$manager.updateOptions(t.options),o.refresh()},hideForm:i=>{t.vm.setupState.isShow=!i},changeStatus:()=>t.changeStatus,clearChangeStatus:()=>{t.changeStatus=!1},updateRule(i,s){t.getCtxs(i).forEach(a=>{w(a.rule,s)})},updateRules(i){Object.keys(i).forEach(s=>{o.updateRule(s,i[s])})},mergeRule:(i,s)=>{t.getCtxs(i).forEach(a=>{X(a.rule,s)})},mergeRules(i){Object.keys(i).forEach(s=>{o.mergeRule(s,i[s])})},getRule:(i,s)=>{const a=t.getCtx(i);if(a)return s?a.origin:a.rule},findType(i,s){let a;return Object.keys(t.ctxs).forEach(l=>{const c=t.ctxs[l];c.rule.type===i&&(a=s?c.origin:c.rule)}),a},findTypes(i,s){let a=[];return Object.keys(t.ctxs).forEach(l=>{const c=t.ctxs[l];c.rule.type===i&&a.push(s?c.origin:c.rule)}),a},getRenderRule:i=>{const s=t.getCtx(i);if(s)return s.prop},getRefRule:i=>{const s=t.getCtxs(i);if(s){const a=s.map(l=>l.rule);return a.length===1?a[0]:a}},setEffect(i,s,a){const l=t.getCtx(i);l&&s&&(s[0]==="$"&&(s=s.substr(1)),E(l.rule,"$"+s)&&H(l.rule,"$"+s,a),E(l.rule,"effect")||(l.rule.effect={}),H(l.rule.effect,s,a))},clearEffectData(i,s){const a=t.getCtx(i);a&&(s&&s[0]==="$"&&(s=s.substr(1)),a.clearEffectData(s),o.sync(i))},updateValidate(i,s,a){a?o.mergeRule(i,{validate:s}):r(i,"validate",s)},updateValidates(i,s){Object.keys(i).forEach(a=>{o.updateValidate(a,i[a],s)})},refreshValidate(){o.refresh()},resetFields(i){e(i).forEach(s=>{t.getCtxs(s).forEach(a=>{t.$render.clearCache(a),a.rule.value=_e(a.defaultValue)})}),u.nextTick(()=>{u.nextTick(()=>{u.nextTick(()=>{o.clearValidateState(i)})})}),i==null&&(m.Function(t.options.onReset)&&k(()=>t.options.onReset(o)),t.vm.emit("reset",o))},method(i,s){const a=o.el(i);if(!a||!a[s])throw new Error(it("err",`${s} 方法不存在`));return(...l)=>a[s](...l)},exec(i,s,...a){return k(()=>o.method(i,s)(...a))},toJson(i){return be(o.rule,i)},trigger(i,s,...a){const l=o.el(i);l&&l.$emit(s,...a)},el(i){const s=t.getCtx(i);if(s)return s.el||t.vm.refs[s.ref]},scrollTo(i,s={block:"center",inline:"nearest",behavior:"smooth"}){const a=o.el(i);if(!a)return;const l=a.$el!==void 0?a.$el:a;if(!l)return;const c=l.nodeType===1?l:l.firstElementChild;c&&typeof c.scrollIntoView=="function"&&c.scrollIntoView(s)},focus(i){const s=o.el(i);if(!s)return;const a=d=>!d||typeof d.focus!="function"?!1:(k(()=>d.focus()),!0);if(a(s))return;const l=s.$el!==void 0?s.$el:s;if(a(l))return;const c=l&&(l.nodeType===1?l:l.firstElementChild);if(a(c)||!c||!c.querySelector)return;const f=c.querySelector('input:not([type=hidden]):not([disabled]),textarea:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])');a(f)},closeModal:i=>{t.bus.$emit("fc:closeModal:"+i)},getSubForm(i){const s=t.getCtx(i);return s?t.subForm[s.id]:void 0},getChildrenRuleList(i){const s=typeof i=="object",a=s?K(i):t.getCtx(i),l=a?a.rule:s?i:o.getRule(i);if(!l)return[];const c=[];return(d=>{d&&d.forEach(p=>{typeof p=="object"&&(p.field&&c.push(p),c.push(...o.getChildrenRuleList(p)))})})(a?a.loadChildrenPending():l.children),c},getParentRule(i){return(typeof i=="object"?K(i):t.getCtx(i)).parent.rule},getParentSubRule(i){const a=typeof i=="object"?K(i):t.getCtx(i);if(a){const l=a.getParentGroup();if(l)return l.rule}},getChildrenFormData(i,s){return o.getChildrenRuleList(i).reduce((l,c)=>((c.ignore!==!0||s===!0)&&(l[c.field]=_e(c.value)),l),{})},setChildrenFormData(i,s,a){const l=o.getChildrenRuleList(i);t.deferSyncValue(()=>{l.forEach(c=>{E(s,c.field)?c.value=s[c.field]:a&&(c.value=void 0)})})},getGlobalEvent(i){let s=o.options.globalEvent[i];if(s)return typeof s=="object"&&(s=s.handle),Y(s)},getGlobalData(i){return new Promise((s,a)=>{let l=o.options.globalData[i];l?l.type==="fetch"?o.fetch(l).then(c=>{s(c)}).catch(a):s(l.data):s(t.fc.loadData[i])})},emitGlobalEvent(i,...s){const a=o.getGlobalEvent(i);if(a){const l=t.getInjectData({},void 0);return l.args=[...s],s.unshift(l),a.apply(null,s)}},setGlobalData(i,s){o.setData("$globalData."+i,s)},setGlobalVar(i,s){o.setData("$var."+i,s)},renderRule(i,s,a){const c=typeof i=="object"?K(i):t.getCtx(i);return c?t.$render.createRuleVnode(c,s,a):void 0},renderChildren(i,s,a){const c=typeof i=="object"?K(i):t.getCtx(i);return c?t.$render.createChildrenVnodes(c,s,a):void 0},nextTick(i){t.bus.$once("next-tick",i),t.refresh()},nextRefresh(i){t.nextRefresh(),i&&k(i)},deferSyncValue(i,s){t.deferSyncValue(i,s)},emit(i,...s){t.vm.emitsOptions&&!t.vm.emitsOptions[i]&&(t.vm.emitsOptions[i]=null),t.vm.emit(i,...s)},bus:t.bus,getCurrentFormRule(){var i;return(i=t.vm.setupState.getGroupInject())==null?void 0:i.rule},fetch(i){return new Promise((s,a)=>{let l=C({},i);l=t.loadFetchVar(l);const c=f=>{k(()=>l.onError&&l.onError(f)),a(f)};t.beforeFetch(l).then(()=>kt(l,t.fc.create.fetch,o).then(f=>{k(()=>l.onSuccess&&l.onSuccess(f)),s(f)}).catch(f=>{c(f)})).catch(f=>{c(f)})})},watchFetch(i,s,a,l){return t.fc.watchLoadData((c,f)=>{let d=C({},i);if(d=t.loadFetchVar(d,c),l&&l(d,f)===!1)return;const p=$=>{k(()=>d.onError&&d.onError($)),a&&a($)};t.beforeFetch(d).then(()=>kt(d,t.fc.create.fetch,o).then($=>{k(()=>d.onSuccess&&d.onSuccess($)),s&&s($,f)}).catch($=>{p($)})).catch($=>{p($)})},i.wait==null?1e3:i.wait)},getData(i,s){return t.fc.get?t.fc.get(i,s):t.fc.getLoadData(i,s)},watchData(i){return t.fc.watchLoadData((s,a)=>{k(()=>i(s,a))})},setData(i,s,a){return t.fc.setData(i,s,a)},refreshData(i){return t.fc.refreshData(i)},t(i,s){return t.fc.t(i,s)},getLocale(){return t.fc.getLocale()},helper:{tidyFields:e,props:r}};return["on","once","off"].forEach(i=>{o[i]=function(...s){t.bus[`$${i}`](...s)}}),o.changeValue=o.changeField=o.setValue,o}function Yr(t){w(t.prototype,{initCache(){this.clearCacheAll()},syncModelProp(e){const r=e.prop;if(!r||!r.model)return!1;const n=r.model.modelField,o=this.$handle.getFormData(e);return r.model.value=o,r.props||(r.props={}),r.props[n]=o,!0},clearCache(e,r){if(e.rule.cache)return;if(r==="value"&&this.$handle.options.valueOnly!==!1&&e.prop?(e.prop.model&&this.syncModelProp(e),this.valueOnly[e.id]=!0):(delete this.fragmentProp[e.id],delete this.valueOnly[e.id]),!this.cache[e.id]){e.parent&&this.clearCache(e.parent,r);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,r),delete this.cache[e.id]},clearCacheAll(){this.cache={},this.fragmentProp={},this.valueOnly={}},setCache(e,r,n){this.cache[e.id]={vnode:r,use:!1,parent:n,slot:e.rule.slot}},getCache(e){const r=this.cache[e.id];if(r)return r.use=!0,r.vnode}})}const Kr=["info","wrap","col","title"];function Wr(t){w(t.prototype,{initRender(){this.cacheConfig={}},getTypeSlot(e){const r=n=>{if(n){let o;return e.rule.field&&(o=n.slots["field-"+$e(e.rule.field)]||n.slots["field-"+e.rule.field]),o||(o=n.slots["type-"+$e(e.type)]||n.slots["type-"+e.type]),o||r(n.setupState.parent)}};return r(this.vm)},render(){if(!this.vm.setupState.isShow)return;this.$manager.beforeRender();const e=ke();return this.sort.forEach(r=>{this.renderSlot(e,this.$handle.ctxs[r])}),this.$manager.render(e)},renderSlot(e,r,n){if(this.isFragment(r)){(this.force||!this.fragmentProp[r.id])&&(r.initProp(),this.mergeGlobal(r),r.initNone(),this.fragmentProp[r.id]=!0);const o=this.renderChildren(r.loadChildrenPending(),r),i=o.default;i&&e.setSlot(r.rule.slot,()=>i()),delete o.default,e.mergeBag(o)}else e.setSlot(r.rule.slot,this.renderCtx(r,n))},mergeGlobal(e){if(!this.$handle.options.global)return;const{trueType:n,originType:o,type:i}=e;this.cacheConfig[n]||(this.cacheConfig[n]=u.computed(()=>{const s=this.$handle.options.global;return X({},[s["*"]||s.default||{},s[o]||s[i]||{}])})),e.prop=X({},[this.cacheConfig[n].value,e.prop])},renewLayoutProp(e){const r=e.prop;if(!r)return;const n=e.rule;Kr.forEach(o=>{if(E(n,o)){const i=n[o];r[o]=m.Object(i)?C({},i):i}else delete r[o]}),E(n,"native")?r.native=n.native:delete r.native,this.$manager.tidyRule(e),this.deepSet(e),this.$manager.mergeProp(e)},setOptions(e){const r=e.loadPending({key:"options",origin:e.prop.options,def:[]});e.prop.options=r,e.prop.optionsTo&&r&&re(e.prop,e.prop.optionsTo,r)},deepSet(e){const r=e.prop.deep;r&&Object.keys(r).sort((n,o)=>n.length<o.length?-1:1).forEach(n=>{re(e.prop,n,r[n])})},parseSide(e,r){return m.Object(e)?X({props:{formCreateInject:r.prop.props.formCreateInject}},e):e},renderSides(e,r,n){const o=r[n?"rule":"prop"];return[this.renderRule(this.parseSide(o.prefix,r)),e,this.renderRule(this.parseSide(o.suffix,r))]},renderId(e,r){const n=this.$handle[r==="field"?"fieldCtx":"nameCtx"][e];return n?n.map(o=>this.renderCtx(o,o.parent)):void 0},renderCtx(e,r){try{if(e.type==="hidden")return;const n=e.rule;if(this.force||!this.cache[e.id]||this.cache[e.id].slot!==n.slot){let o;const i=!this.force&&this.valueOnly[e.id]&&e.prop;delete this.valueOnly[e.id],i?this.renewLayoutProp(e):(e.initProp(),this.mergeGlobal(e),e.initNone(),this.$manager.tidyRule(e),this.deepSet(e),this.setOptions(e),this.ctxProp(e));let s=e.prop;s.preview=!!(s.preview!=null?s.preview:this.$handle.preview),s.props.formCreateInject=this.injectProp(e);let a=s.cache!==!1;const l=s.preview;if(s.hidden){this.setCache(e,void 0,r);return}o=(...c)=>{var V,v;const f={rule:n,prop:s,preview:l,api:this.$handle.api,model:s.model||{},slotValue:c};c.length&&n.slotUpdate&&k(()=>n.slotUpdate(f));let d={};const p=e.loadChildrenPending();e.parser.renderChildren?d=e.parser.renderChildren(p,e):e.parser.loadChildren!==!1&&(d=this.renderChildren(p,e)),Object.keys(s.renderSlots||{}).forEach(j=>{d[j]=(...P)=>{if(m.Function(s.renderSlots[j]))return k(()=>s.renderSlots[j](...P));const B=this.parseSide(s.renderSlots[j],e);return this.renderRule(B)}});const $=this.getTypeSlot(e);let y;return $?(f.children=d,y=$(f)):y=l?e.parser.preview(d,e):e.parser.render(d,e),y=this.renderSides(y,e),(V=s.title)!=null&&V.show&&(s.wrap=C({show:!0},s.wrap||{}),s.native||(s.native=!1)),(!(!e.input&&m.Undef(s.native))||((v=s.col)==null?void 0:v.show)===!0)&&s.native!==!0&&(this.fc.targetFormDriver("updateWrap",e),y=this.$manager.makeWrap(e,y)),e.none&&(Array.isArray(y)?y=y.map(j=>!j||!j.__v_isVNode?j:this.none(j)):y=this.none(y)),a&&this.setCache(e,()=>this.stable(y),r),y},this.setCache(e,o,r)}return(...o)=>{const i=this.getCache(e);if(i)return i(...o);if(this.cache[e.id])return;const s=this.renderCtx(e,e.parent);if(s)return s()}}catch(n){console.error(n);return}},none(e){if(e)return e.props.class=this.mergeClass(e.props.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(n=>{n&&n.__v_isVNode&&n.children&&typeof n.children=="object"&&(n.children.$stable=!0,this.stable(n.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]||"modelValue"},isFragment(e){return e.type==="fragment"||e.type==="template"},injectProp(e){const r=this.vm.setupState;r.ctxInject[e.id]||(r.ctxInject[e.id]={api:this.$handle.api,form:this.fc.create,subForm:o=>{this.$handle.addSubForm(e,o)},getSubForm:()=>this.$handle.subForm[e.id],slots:()=>this.vm.setupState.top.slots,getWrap:()=>this.vm.refs[e.wrapRef],options:[],children:[],preview:!1,id:e.id,field:e.field,rule:e.rule,input:e.input,t:(...o)=>this.$handle.api.t(...o),updateValue:o=>{this.$handle.onUpdateValue(e,o)}});const n=r.ctxInject[e.id];return w(n,{preview:e.prop.preview,options:e.prop.options,children:e.loadChildrenPending()}),n},ensureCtxHandlers(e){if(e.handlers)return e.handlers;const r=this;return e.handlers={vnodeMounted(n){n.el.__rule__=e.rule,r.onMounted(e,n.el)},vnodeBeforeUnmount(){r.$handle.effect(e,"beforeUnmount"),r.$handle.targetHook(e,"beforeUnmount")},fcUpdateValue(n){r.$handle.onUpdateValue(e,n)},fcEl(n){e.exportEl=n,n&&((n.$el||n).__rule__=e.rule)},modelCallback(n){r.tmpInput&&r.tmpInput(e.field,n,e.rule),r.onInput(e,n)},modelEmit(){r.onEmitInput(e)}},e.handlers},ctxProp(e){const{ref:r,key:n,rule:o}=e;this.$manager.mergeProp(e),e.parser.mergeProp(e);const i=this.ensureCtxHandlers(e),s=[{ref:r,key:o.key||`${n}fc`,slot:void 0,on:{vnodeMounted:i.vnodeMounted,vnodeBeforeUnmount:i.vnodeBeforeUnmount,"fc.updateValue":i.fcUpdateValue,"fc.el":i.fcEl}}];if(e.input){this.vm.props.disabled===!0&&(e.prop.props.disabled=!0);const a=this.getModelField(e),l={callback:i.modelCallback,modelField:a,value:this.$handle.getFormData(e)};s.push({on:C({[`update:${a}`]:l.callback},e.prop.modelEmit?{[e.prop.modelEmit]:i.modelEmit}:{}),props:{[a]:l.value}}),e.prop.model=l}return Q(s,e.prop),e.prop},onMounted(e,r){e.el=this.vm.refs[e.ref]||r,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){if(!m.trueArray(e))return{};const n=ke();return e.map(o=>{if(o){if(m.String(o)||m.Number(o))return n.setSlot(null,`${o}`);if(o.__fc__)return this.renderSlot(n,o.__fc__,r);o.type&&u.nextTick(()=>{this.$handle.loadChildren(e,r),this.$handle.refresh()})}}),n.getSlots()},defaultRender(e,r){const n=e.prop;return n.component?typeof n.component=="string"?this.vNode.make(n.component,n,r):this.vNode.makeComponent(n.component,n,r):this.vNode[e.type]?this.vNode[e.type](n,r):this.vNode[e.originType]?this.vNode[e.originType](n,r):this.vNode.make(ft(n.type),n,r)},createChildrenVnodes(e,r,n){this.force=n!==!1,this.tmpInput=r;const o=this.renderChildren(e.rule.children,e);return this.force=!1,this.tmpInput=null,o},createRuleVnode(e,r,n){this.force=n!==!1,this.tmpInput=r;const o=ke();return this.renderSlot(o,e,e.parent),this.force=!1,this.tmpInput=null,o.getSlots()},renderRule(e,r,n){if(!e)return;if(m.String(e)||m.Number(e))return`${e}`;let o;if(n)o=e.type;else if(o=e.is,e.type){o=U(e.type);const a=this.vNode.aliasMap[o];a&&(o=U(a))}if(!o)return;const i=ke();m.trueArray(e.children)&&e.children.forEach(a=>{a&&i.setSlot(a==null?void 0:a.slot,()=>this.renderRule(a))});const s=C({},e);return delete s.type,delete s.is,this.vNode.make(o,s,i.mergeBag(r).getSlots())}})}let Jr=1;function Ue(t){w(this,{$handle:t,fc:t.fc,vm:t.vm,$manager:t.$manager,vNode:new t.fc.CreateNode(t),force:!1,tmpInput:null,id:Jr++}),mt(this,{options(){return t.options},sort(){return t.sort}}),this.initCache(),this.initRender()}Yr(Ue),Wr(Ue);function Qr(t){w(t.prototype,{parseInjectEvent(e,r){const n=e.inject||this.options.injectEvent;return this.parseEventLst(e,r,n)},parseEventLst(e,r,n,o){return Object.keys(r).forEach(i=>{const s=this.parseEvent(e,r[i],n,o);s&&(r[i]=s)}),r},parseEvent(e,r,n,o){if(m.Function(r)&&(n!==!1&&!m.Undef(n)||r.__inject))return this.inject(e,r,n);if(!o&&Array.isArray(r)&&r[0]&&(m.String(r[0])||m.Function(r[0])))return this.parseEventLst(e,r,n,!0);if(m.String(r)){const i=Y(r);if(i&&r!==i)return i.__inject?this.parseEvent(e,i,n,!0):i}},parseEmit(e){let r={},n=e.rule,{emitPrefix:o,field:i,name:s,inject:a}=n,l=n.emit||[];return m.trueArray(l)&&l.forEach(c=>{if(!c)return;let f,d=o||i||s;if(m.Object(c)&&(f=c.inject,c=c.name,d=c.prefix||d),d){const p=$e(`${d}-${c}`),$=(...y)=>{this.vm.emitsOptions&&!this.vm.emitsOptions[p]&&(this.vm.emitsOptions[p]=null),this.vm.emit(p,...y),this.vm.emit("emit-event",p,...y),this.bus.$emit(p,...y)};if($.__emit=!0,!f&&a===!1)r[U(c)]=$;else{let y=f||a||this.options.injectEvent;r[U(c)]=m.Undef(y)?$:this.inject(n,$,y)}}}),e.computed.on=r,r},getInjectData(e,r){const n=e.__fc__&&e.__fc__.$api,o=e.__fc__&&e.__fc__.$handle.vm||this.vm,{option:i,rule:s}=o.props;return{$f:n||this.api,api:n||this.api,rule:s,self:e.__origin__,option:i,inject:r}},inject(e,r,n){if(r.__origin){if(this.watching&&!this.loading)return r;r=r.__origin}const o=this,i=function(...s){const a=o.getInjectData(e,n);return a.args=[...s],s.unshift(a),r.apply(this,s)};return i.__origin=r,i.__json=r.__json,i},loadStrVar(e,r,n){if(e&&typeof e=="string"&&e.indexOf("{{")>-1&&e.indexOf("}}")>-1){const o=e,i=Mr(e),s=c=>{let f=!1,d;if(n&&c.indexOf("$form.")===0){const p=c.split(".");p.shift(),E(n.value,p[0])&&(f=!0,d=r?r({id:"$form."+p[0]+"_"+n.rule.__fc__.id,getValue:()=>T(n.value,p)}):T(n.value,p))}return f||(d=r?r(c):this.fc.getLoadData(c)),d},a=c=>{const f=[];c.forEach(p=>{p.key?f.push(p.key):p.children&&f.push(a(p.children))});let d=!1;return f.forEach((p,$)=>{p!=null&&(p.indexOf("'")===0||p.indexOf('"')===0)&&(f[$]=p.slice(1,-1),d=!0)}),f.length===1&&(d||!isNaN(Number(f[0])))?f[0]:s(f.join("."))};let l;if(i.forEach(c=>{const f=c.split("||"),d=f[0].trim();if(d){const p=(f[1]||"").trim(),$=bt(d);let y=k(()=>a($));(y==null||y==="")&&f.length>1&&(y=p),l=y,e=e.replaceAll(`{{${c}}}`,y==null?"":y)}}),i.length===1&&o===`{{${i[0]}}}`)return l}return e},loadFetchVar(e,r,n){let o;n&&n.__fc__&&(o=n.__fc__.getParentGroup()),!o&&e.targetRule&&e.targetRule.__fc__&&(o=e.targetRule.__fc__.getParentGroup());const i=s=>this.loadStrVar(s,r,o?{rule:n,value:this.subRuleData[o.id]||{}}:null);return e.action=i(e.action||""),["headers","data","query"].forEach(s=>{if(e[s]){const a=Array.isArray(e[s])?[]:{};Object.keys(e[s]).forEach(l=>{a[i(l)]=i(e[s][l])}),e[s]=a}}),e}})}const vt=["hook:updated","hook:mounted"];function Xr(t){w(t.prototype,{usePage(){const e=this.options.page;if(!e)return;let r=25,n=Zr(this.rules);m.Object(e)&&(e.first&&(r=parseInt(e.first,10)||r),e.limit&&(n=parseInt(e.limit,10)||n)),w(this,{first:r,limit:n,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.bus.$off(vt,e),this.bus.$emit("page-end")):(this.first+=this.limit,this.pageEnd=this.rules.length<=this.first,this.loadRule(),this.refresh())};this.bus.$on(vt,e)}})}function Zr(t){return t.length<31?31:Math.ceil(t.length/3)}function en(t){w(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.setupState.unique>0?this.$render.render():(this.vm.setupState.unique=1,[])}})}function tn(t){Object.defineProperties(t.origin,{__fc__:Me(u.markRaw(t))}),t.rule!==t.origin&&Object.defineProperties(t.rule,{__fc__:Me(u.markRaw(t))})}function Et(t,e,r){const n=Se(),o=!!e.field;w(this,{id:n,ref:n,wrapRef:n+"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:C({},e),computed:{},payload:{},refRule:{},handlers:null,input:o,el:void 0,exportEl:void 0,defaultValue:o?G(r):void 0,field:e.field||void 0}),this.updateKey(),tn(this),this.update(t,!0)}w(Et.prototype,{getParentGroup(){let t=this.parent;for(;t;){if(t.group)return t;t=t.parent}},loadChildrenPending(){const t=this.rule.children||[];return Array.isArray(t)?t:this.loadPending({key:"children",origin:t,def:[],onLoad:e=>{this.$handle&&this.$handle.loadChildren(e,this)},onUpdate:(e,r)=>{this.$handle&&(e===r?this.$handle.loadChildren(e,this):this.$handle.updateChildren(this,e,r))},onReload:e=>{this.$handle?this.$handle.updateChildren(this,[],e):delete this.pending.children}})},loadPending(t){const{key:e,origin:r,def:n,onLoad:o,onReload:i,onUpdate:s}=t;if(this.pending[e]&&this.pending[e].origin===r)return this.getPending(e,n);delete this.pending[e];let a=r;if(m.Function(r)){let l=k(()=>r({rule:this.rule,api:this.$api,update:c=>{const f=c||n,d=this.getPending(e,n);this.setPending(e,r,f),s&&s(f,d)},reload:()=>{const c=this.getPending(e,n);delete this.pending[e],i&&i(c),this.$api&&this.$api.sync(this.rule)}}));l&&m.Function(l.then)?(l.then(c=>{const f=c||n;this.setPending(e,r,f),o&&o(f),this.$api&&this.$api.sync(this.rule)}).catch(c=>{console.error(c)}),a=n,this.setPending(e,r,a)):(a=l||n,this.setPending(e,r,a),o&&o(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:u.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=Se(),t&&this.parent&&this.parent.updateKey(t)},updateType(){this.originType=this.rule.type,this.type=U(this.rule.type),this.trueType=this.$handle.getType(this.originType)},setParser(t){this.parser=t,t.init(this)},initProp(){var e,r,n;const t=C({},this.rule);delete t.children,delete t.validate,this.prop=X({},[t,...Object.keys(this.payload).map(o=>this.payload[o]),this.computed]),t.col&&((e=t.col)==null?void 0:e.show)!==!1&&(this.prop.col.show=!0),this.prop.validate=[...((n=(r=this.refRule)==null?void 0:r.__$validate)==null?void 0:n.value)||[],...this.prop.validate||[]]},initNone(){this.none=!(m.Undef(this.prop.display)||this.prop.display)},hasHidden(){return!!this.rule.hidden||(this.parent?this.parent.hasHidden():!1)},injectValidate(){return this.prop.validate},check(t){return this.vm===t.vm},unwatch(){this.watch.forEach(t=>t()),this.watch=[],Object.keys(this.refRule).forEach(t=>{t.indexOf("__$")!==0&&delete this.refRule[t]})},unlink(){this.linkOn.forEach(t=>t()),this.linkOn=[]},link(){this.unlink(),this.$handle.appendLink(this)},watchTo(){this.$handle.watchCtx(this)},delete(){this.unwatch(),this.unlink(),this.rmCtrl(),this.parent&&this.parent.children.splice(this.parent.children.indexOf(this)>>>0,1),w(this,{deleted:!0,computed:{},parent:null,children:[],cacheConfig:null,none:!1,handlers:null,el:void 0,exportEl:void 0})},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),w(this,{root:[]})},this.input)})},update(t,e){w(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 rn(t){w(t.prototype,{nextRefresh(e){const r=this.loadedId;u.nextTick(()=>{r===this.loadedId&&(e?e():this.refresh())})},parseRule(e){const r=pt(e);return Object.defineProperties(r,{__origin__:Me(e)}),nn(r),this.appendValue(r),[r,r.prefix,r.suffix].forEach(n=>{n&&this.loadFn(n,r)}),this.loadCtrl(r),r.update&&(r.update=Y(r.update)),r},loadFn(e,r){["on","props","deep"].forEach(n=>{e[n]&&this.parseInjectEvent(r,e[n])})},loadCtrl(e){e.control&&e.control.forEach(r=>{r.handle&&(r.handle=Y(r.handle))})},syncProp(e){const r=e.rule;m.trueArray(r.sync)&&Q([{on:r.sync.reduce((n,o)=>(n[typeof o=="object"&&o.event||`update:${o}`]=i=>{r.props[typeof o=="object"&&o.prop||o]=i,this.vm.emit("sync",o,i,r,this.fapi)},n),{})}],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.setupState.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 n=s=>{let a=e[s-1];if(!a||!a.__fc__)return s>0?n(s-1):-1;let l=this.sort.indexOf(a.__fc__.id);return l>-1?l:n(s-1)},o=(s,a)=>{m.trueArray(s)&&this._loadRule(s,a)},i=e.map((s,a)=>{if(r&&!m.Object(s)||!this.pageEnd&&!r&&a>=this.first)return;if(s.__fc__&&s.__fc__.root===e&&this.ctxs[s.__fc__.id])return o(s.__fc__.loadChildrenPending(),s.__fc__),s.__fc__;let l=pt(s);const c=()=>!!(l.field&&this.fieldCtx[l.field]&&this.fieldCtx[l.field][0]!==s.__fc__);this.fc.targetFormDriver("loadRule",{rule:l,api:this.api},this.fc),this.ruleEffect(l,"init",{repeat:c()}),c()&&this.vm.emit("repeat-field",s,this.api);let f,d=!1,p=!!s.__fc__,$=l.value;if(p){if(f=s.__fc__,$=f.defaultValue,f.deleted){if(Ot(f))return;f.update(this)}else if(!f.check(this)){if(Ot(f))return;e[a]=s=s._clone?s._clone():st(be(s)),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 v=this.parseRule(s);f=new Et(this,v,$),this.bindParser(f)}this.parseEmit(f),this.syncProp(f),f.parent=r||null,f.root=e,this.setCtx(f),!d&&!p&&(this.effect(f,"load"),this.targetHook(f,"load")),this.effect(f,"created");const y=f.loadChildrenPending();if(f.parser.loadChildren===!1||o(y,f),!r){const v=n(a);v>-1||!a?this.sort.splice(v+1,0,f.id):this.sort.push(f.id)}const V=f.rule;return f.updated||(f.updated=!0,m.Function(V.update)&&this.bus.$once("load-end",()=>{this.refreshUpdate(f,V.value,"init")}),this.effect(f,"loaded")),this.refreshControl(f)&&(this.cycleLoad=!0),f}).filter(s=>!!s);r&&(r.children=i)},refreshControl(e){return e.input&&e.rule.control&&this.useCtrl(e)},useCtrl(e){const r=sn(e),n=[],o=this.api;if(!r.length)return!1;for(let a=0;a<r.length;a++){const l=r[a],c=l.handle||function(d){return(ae[l.condition||"=="]||ae["=="])(d,l.value)};if(!m.trueArray(l.rule))continue;const f=q(C({},l),{valid:k(()=>c(e.rule.value,o)),ctrl:on(e,l.rule),isHidden:m.String(l.rule[0])});f.valid&&f.ctrl||!f.valid&&!f.ctrl&&!f.isHidden||n.push(f)}if(!n.length)return!1;const i=[];let s=!1;return this.deferSyncValue(()=>{n.reverse().forEach(({isHidden:a,valid:l,rule:c,prepend:f,append:d,child:p,ctrl:$,method:y})=>{if(a){l?e.ctrlRule.push({__ctrl:!0,children:c,valid:l}):$&&e.ctrlRule.splice(e.ctrlRule.indexOf($)>>>0,1),i[l?"push":"unshift"](()=>{y==="disabled"||y==="enabled"?this.api.disabled(!l,c):y==="display"||y==="show"?this.api.display(l,c):y==="required"?(c.forEach(V=>{this.api.setEffect(V,"required",l)}),l||this.api.clearValidateState(c)):y==="if"?this.api.hidden(!l,c):this.api.hidden(!l,c)});return}if(l){s=!0;const V={type:"fragment",native:!0,__ctrl:!0,children:c};e.ctrlRule.push(V),this.bus.$once("load-start",()=>{f?o.prepend(V,f,p):d||p?o.append(V,d||e.id,p):e.root.splice(e.root.indexOf(e.origin)+1,0,V)})}else{e.ctrlRule.splice(e.ctrlRule.indexOf($),1);const V=K($);V&&V.rm()}})}),i.length&&(this.loading?i.length&&this.bus.$once("load-end",()=>{i.forEach(a=>a())}):i.length&&u.nextTick(()=>{i.forEach(a=>a())})),this.vm.emit("control",e.origin,this.api),this.effect(e,"control"),s},reloadRule(e){return this._reloadRule(e)},_reloadRule(e){e||(e=this.rules);const r=C({},this.ctxs);this.clearNextTick(),this.initData(e),this.fc.rules=e,this.deferSyncValue(()=>{this.bus.$once("load-end",()=>{Object.keys(r).filter(n=>this.ctxs[n]===void 0).forEach(n=>this.rmCtx(r[n])),this.$render.clearCacheAll()}),this.reloading=!0,this.loadRule(),this.reloading=!1,this.refresh(),this.bus.$emit("reloading",this.api)}),this.bus.$off("next-tick",this.nextReload),this.bus.$once("next-tick",this.nextReload),this.bus.$emit("update",this.api)},refresh(){this.vm.setupState.refresh()}})}function nn(t){const e=Ct();return Object.keys(e).forEach(r=>{E(t,r)||(t[r]=e[r])}),t}function sn(t){const e=t.rule.control||[];return m.Object(e)?[e]:e}function on(t,e){for(let r=0;r<t.ctrlRule.length;r++){const n=t.ctrlRule[r];if(n.children===e)return n}}function Ot(t){return!!t.rule.__ctrl}function an(t){w(t.prototype,{setValue(e,r,n,o){e.deleted||(e.rule.value=r,this.changeStatus=!0,this.setFormData(e,n),this.$render.clearCache(e,"value"),this.nextRefresh(),this.syncValue(),this.valueChange(e,r),this.vm.emit("change",e.field,r,e.origin,this.api,o||!1),this.effect(e,"value"),this.targetHook(e,"value",{value:r}),this.emitEvent("change",e.field,r,{rule:e.origin,api:this.api,setFlag:o||!1}),o&&u.nextTick(()=>{u.nextTick(()=>{u.nextTick(()=>{this.api.clearValidateState(e.id)})})}),this.$manager.fieldChange(e,r,n,o))},onInput(e,r){let n;e.input&&(this.isQuote(e,n=e.parser.toValue(r,e))||this.isChange(e,r))&&this.setValue(e,n,r)},onUpdateValue(e,r){this.deferSyncValue(()=>{const n=e.getParentGroup(),o=n?this.subRuleData[n.id]:null,i={};Object.keys(r||{}).forEach(s=>{o&&E(o,s)?i[s]=r[s]:E(this.api.form,s)?this.api.form[s]=r[s]:this.api.top!==this.api&&E(this.api.top.form,s)&&(this.api.top.form[s]=r[s])}),Object.keys(i).length&&this.api.setChildrenFormData(n.rule,i)})},onBaseInput(e,r){this.setFormData(e,r),this.$render.clearCache(e,"value"),this.nextRefresh()},setFormData(e,r){e.modelValue=r;const n=e.getParentGroup();n&&(this.subRuleData[n.id]||(this.subRuleData[n.id]={}),this.subRuleData[n.id][e.field]=e.rule.value),H(this.formData,e.id,r)},rmSubRuleData(e){const r=e.getParentGroup();r&&this.subRuleData[r.id]&&delete this.subRuleData[r.id][e.field]},getFormData(e){return this.formData[e.id]},syncForm(){const e=u.reactive({}),r=this.fields(),n=[];this.options.appendValue!==!1&&Object.keys(this.appendData).reduce((o,i)=>(r.indexOf(i)===-1&&(o[i]=u.toRef(this.appendData,i)),o),e),r.reduce((o,i)=>{let s=(this.fieldCtx[i]||[]).filter(a=>!this.isIgnore(a))[0];return s||(s=this.fieldCtx[i][0],n.push(i)),o[i]=u.toRef(s.rule,"value"),o},e),this.form=e,this.ignoreFields=n,this.syncValue()},isIgnore(e){return e.rule.ignore===!0||(e.rule.ignore==="hidden"||this.options.ignoreHiddenFields)&&e.hasHidden()},appendValue(e){(!e.field||!E(this.appendData,e.field))&&(!m.Undef(e.value)||!this.options.forceCoverValue)||(e.value=this.appendData[e.field],delete this.appendData[e.field])},addSubForm(e,r){this.subForm[e.id]=r},deferSyncValue(e,r){this.deferSyncFn||(this.deferSyncFn=e),this.deferSyncFn.sync||(this.deferSyncFn.sync=r),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.setupState.updateValue(e)},isChange(e,r){const n=this.getFormData(e);if(n===r)return!1;const o=typeof n;return o===typeof r&&(o==="string"||o==="boolean"||o==="number"&&Number.isFinite(n)&&Number.isFinite(r))?!0:JSON.stringify(n,Ft)!==JSON.stringify(r,Ft)},isQuote(e,r){return(r instanceof Function||m.Object(r)||Array.isArray(r))&&r===e.rule.value},refreshUpdate(e,r,n,o){if(m.Function(e.rule.update)){const i=k(()=>e.rule.update(r,e.origin,this.api,{origin:n||"change",linkField:o}));if(i===void 0)return;e.rule.hidden=i===!0}},valueChange(e,r){this.refreshRule(e,r),this.bus.$emit("change-"+e.field,r)},refreshRule(e,r,n,o){this.refreshControl(e)&&(this.$render.clearCacheAll(),this.loadRule(),this.bus.$emit("update",this.api),this.refresh()),this.refreshUpdate(e,r,n,o)},appendLink(e){const r=e.rule.link;m.trueArray(r)&&r.forEach(n=>{const o=()=>this.refreshRule(e,e.rule.value,"link",n);this.bus.$on("change-"+n,o),e.linkOn.push(()=>this.bus.$off("change-"+n,o))})},fields(){return Object.keys(this.fieldCtx)}})}function Ft(t,e){return typeof e=="function"?""+e:e}const Ce={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){}},ln=["field","value","vm","template","name","config","control","inject","sync","payload","optionsTo","update","slotUpdate","computed","component","cache"],we=Symbol("oldValue"),un=["$condition","$variableVal","$val","$form","$scope","$group","$rule"],cn=["$formulas","$form","$scope","$group","$rule","$api"],Oe=new Map,fn=1e3;function Rt(t,e){const r=t.join(",")+"|"+e;let n=Oe.get(r);return n||(Oe.size>=fn&&Oe.clear(),n=new Function(...t,e),Oe.set(r,n)),n}function dn(t){w(t.prototype,{scheduleComputedUpdate(e){(this._computedQueue||(this._computedQueue=[])).push(e),!(this._computedFlushing||this._computedScheduled)&&(this._computedScheduled=!0,setTimeout(()=>{this._computedScheduled=!1,this._computedFlushing=!0;try{const r=this._computedQueue||[];this._computedQueue=[];for(let n=0;n<r.length;n++)k(r[n]),this._computedQueue&&this._computedQueue.length&&(r.push(...this._computedQueue),this._computedQueue=[])}finally{this._computedFlushing=!1}}))},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,n){const o=`${n}Ctx`;this[o][r]?this[o][r].push(e):this[o][r]=[e]},rmIdCtx(e,r,n){const o=`${n}Ctx`,i=this[o][r];if(!i)return!1;const s=i.splice(i.indexOf(e)>>>0,1).length>0;return i.length||delete this[o][r],s},getFieldCtx(e){return(this.fieldCtx[e]||[])[0]},getNameCtx(e){return this.nameCtx[e]||[]},setCtx(e){let{id:r,field:n,name:o,rule:i}=e;this.ctxs[r]=e,o&&this.setIdCtx(e,o,"name"),e.input&&(this.setIdCtx(e,n,"field"),this.setFormData(e,e.parser.toFormValue(i.value,e)),this.isMounted&&!this.reloading&&this.vm.emit("change",e.field,i.value,e.origin,this.api,!1,!0))},getParser(e){const r=this.fc.parsers,n=this.fc.renderDriver;if(n){const o=n.parsers||{},i=o[e.originType]||o[U(e.type)]||o[e.trueType];if(i)return i}return r[e.originType]||r[U(e.type)]||r[e.trueType]||Ce},bindParser(e){e.setParser(this.getParser(e))},getType(e){const r=this.fc.CreateNode.aliasMap,n=r[e]||r[U(e)]||e;return U(n)},noWatch(e){this.noWatchFn||(this.noWatchFn=e),k(e),this.noWatchFn===e&&(this.noWatchFn=null)},watchCtx(e){const r=ct().filter(s=>s[0]!=="_"&&s[0]!=="$"&&ln.indexOf(s)===-1),n={},o=(s,a,l)=>(c,f)=>{let d=a.value;if(!this.isBreakWatch()){if(l&&e.parser.loadChildren===!1){this.$render.clearCache(e),this.nextRefresh();return}if(this.watching=!0,u.nextTick(()=>{this.targetHook(e,"watch",{key:s,oldValue:f,newValue:d})}),s==="hidden"&&!!d!=!!f&&u.nextTick(()=>{this.targetHook(e,"hidden",{value:d})}),s==="ignore"&&e.input||s==="hidden"&&(e.rule.ignore==="hidden"||this.options.ignoreHiddenFields))this.syncForm();else if(s==="link"){e.link();return}else["props","on","deep"].indexOf(s)>-1?(this.parseInjectEvent(e.rule,d||{}),s==="props"&&e.input&&this.setFormData(e,e.parser.toFormValue(e.rule.value,e))):s==="emit"?this.parseEmit(e):["prefix","suffix"].indexOf(s)>-1?d&&this.loadFn(d,e.rule):s==="type"?(e.updateType(),this.bindParser(e)):l&&(m.Function(f)&&(f=e.getPending("children",[])),m.Function(d)&&(d=e.loadChildrenPending()),this.updateChildren(e,d,f));this.$render.clearCache(e),this.refresh(),this.watching=!1}},i=(s,a)=>{if(n[s])return;n[s]=!0;const l=e.refRule[s],c=s==="children",f=o(s,l,c);e.watch.push(u.watch(c?()=>m.Function(l.value)?l.value:[...l.value||[]]:()=>l.value,f,{deep:!c,sync:c})),a&&f(l.value,void 0)};if(r.forEach(s=>{e.refRule[s]=u.toRef(e.rule,s),E(e.rule,s)&&i(s)}),e.watch.push(u.watch(()=>Object.keys(e.rule).join("|"),()=>{r.forEach(s=>{!n[s]&&E(e.rule,s)&&i(s,!0)})})),e.refRule.__$title=u.computed(()=>{let s=(typeof e.rule.title=="object"?e.rule.title.title:e.rule.title)||"";if(s){const a=s.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);a&&(s=this.api.t(a[1]))}return s}),e.refRule.__$info=u.computed(()=>{let s=(typeof e.rule.info=="object"?e.rule.info.info:e.rule.info)||"";if(s){const a=s.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);a&&(s=this.api.t(a[1]))}return s}),e.refRule.__$validate=u.computed(()=>{const s=a=>{var c,f;const l=a.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);return l?this.api.t(l[1],{title:(f=(c=e.refRule)==null?void 0:c.__$title)==null?void 0:f.value}):a};return L(e.rule.validate).map(a=>{const l=C({},a);if(l.message&&(l.message=s(l.message)),m.Function(l.validator)){const c=e;l.validator=function(...f){return a.validator.call({that:this,id:c.id,field:c.field,rule:c.rule,api:c.$handle.api},...f)}}if(l.adapter){if(typeof l.error=="object"){const c=C({},l.error);Object.keys(c).forEach(f=>{c[f]=s(c[f])}),l.error=c}return this.adapterValidate(l,e)}return l})}),e.input){const s=u.toRef(e.rule,"value");e.watch.push(u.watch(()=>s.value,()=>{let a=e.parser.toFormValue(s.value,e);this.isChange(e,a)&&this.setValue(e,s.value,a,!0)}))}this.bus.$once("load-end",()=>{let s=e.rule.computed;s&&(typeof s!="object"&&(s={value:s}),Object.keys(s).forEach(a=>{const l=u.computed(()=>{const f=s[a];if(!f)return;const d=this.compute(e,f);return(f.linkage||f.linkageVariable)&&d===we?we:d}),c=f=>{a==="value"?this.onInput(e,f):a[0]==="$"?this.api.setEffect(e.id,a,f):re(e.rule,a,f)};(a==="value"?[void 0,null,""].indexOf(e.rule.value)>-1:l.value!==T(e.rule,a))&&c(l.value),e.watch.push(u.watch(l,f=>{f!==we&&this.scheduleComputedUpdate(()=>c(f))},{deep:!0}))}))}),this.watchEffect(e)},adapterValidate(e,r){const n=(o,i)=>{if((e.beforeValidate&&k(()=>e.beforeValidate({value:o,api:this.api,validate:e,rule:r.rule})))===!1)i();else{const a=this.validator(r,o,e);if(a){let l="";typeof e.error=="object"&&(l=e.error[a]||e.error.default),!l&&typeof e.message=="string"&&(l=e.message),l||(l=this.getValidateMessage(r,{key:a,rule:e[a]})),i(l)}else if(e.validator){const l=e.validator&&k(()=>e.validator(o,i));l&&m.Function(l.then)&&l.then(()=>i()).catch(c=>i(c))}else i()}};return this.$manager.adapterValidate({required:e.required,message:e.message,trigger:e.trigger},n)},getValidateMessage(e,r){var o,i;const n=Array.isArray(r.rule)?r.rule.join(","):""+r.rule;return this.api.t(r.key==="required"?r.key:"validate."+r.key,{[r.key]:n,title:(i=(o=e.refRule)==null?void 0:o.__$title)==null?void 0:i.value})},validator(e,r,n){if(m.empty(r))return n.required?"required":void 0;for(const[i,s]of Object.entries(n))switch(i){case"len":case"maxLen":case"minLen":const a=y=>i==="len"?y===s:i==="maxLen"?y<=s:y>=s;if(Array.isArray(r)){if(!a(r.length))return i}else{if(typeof r=="object")return i;if(!a((""+r).length))return i}break;case"pattern":if(!(typeof s=="string"?new RegExp(s):s).test(""+r))return i;break;case"uppercase":if(s&&(typeof r!="string"||!/^[A-Z]*$/.test(r)))return i;break;case"lowercase":if(s&&(typeof r!="string"||!/^[a-z]*$/.test(r)))return i;break;case"min":case"max":case"positive":case"negative":case"integer":case"number":const c=Number(r);if(Number.isNaN(c)||i==="min"&&c<s||i==="max"&&c>s||i==="positive"&&c<=0||i==="negative"&&c>=0||i==="integer"&&!Number.isInteger(c))return i;break;case"equal":if(r!==s)return i;break;case"enum":if(Array.isArray(s)&&!s.includes(r))return i;break;case"hasKeys":if(typeof r!="object"||Array.isArray(s)&&s.some(y=>!(y in r)))return i;break;case"email":if(!/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(""+r))return i;break;case"url":if(!new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$","i").test(""+r))return i;break;case"ip":if(!/^(2(5[0-5]{1}|[0-4]\d{1})|[0-1]?\d{1,2})(\.(2(5[0-5]{1}|[0-4]\d{1})|[0-1]?\d{1,2})){3}$/.test(""+r))return i;break;case"phone":if(!/^(?:(?:\+|00)86)?1[3-9]\d{9}$/.test(""+r))return i;break;case"computed":if(!this.compute(e,s))return i;break}},compute(e,r){let n;if(typeof r=="object"){const o=e.getParentGroup(),i=a=>{if(a=Array.isArray(a)?{mode:"AND",group:a}:a,!m.trueArray(a.group))return!0;const l=a.mode==="OR";let c=!0;for(let f=0;f<a.group.length;f++){const d=a.group[f];let p,$=null,y=null;if(d.variable)y=this.fc.getLoadData(d.variable);else if(d.field)$=$t(d.field||"");else if(!d.mode)return!0;let V=d.compare;if(V&&(V=$t(V||"")),d.mode?p=i(d):ae[d.condition]?m.Function(d.handler)?p=k(()=>d.handler(this.api,e.rule)):p=k(()=>Rt(un,`with($form){with($scope){with(this){with($group){ return $condition['${d.condition}'](${d.variable?"$variableVal":$}, ${V||"$val"}); }}}}`).call(this.api.form,ae,y,d.value,this.api.top.form,this.api.top===this.api.scope?{}:this.api.scope.form,o?this.subRuleData[o.id]||{}:{},e.rule)):p=!1,l&&p)return!0;l||(c=c&&p)}return l?!1:c};let s=i(r);return s=r.invert===!0?!s:s,r.linkage?s?k(()=>this.computeValue(r.linkage,e,o),void 0):we:r.linkageVariable?s?k(()=>this.fc.getLoadData(r.linkageVariable),void 0):we:s}else if(m.Function(r))n=()=>r(this.api.form,this.api,e.rule);else{const o=e.getParentGroup();n=()=>this.computeValue(r,e,o)}return k(n,void 0)},computeValue(e,r,n){const o=this,i=Object.keys(this.fc.formulas).reduce((s,a)=>(s[a]=function(...l){return o.fc.formulas[a].call({that:this,rule:r.rule,api:o.api,fc:o.fc},...l)},s),{});return k(()=>Rt(cn,`with($form){with($scope){with(this){with($group){with($formulas){ return ${e} }}}}}`).call(this.api.form,i,this.api.top.form,this.api.top===this.api.scope?{}:this.api.scope.form,n?this.subRuleData[n.id]||{}:{},r.rule,this.api),void 0)},updateChildren(e,r,n){this.deferSyncValue(()=>{n&&n.forEach(o=>{(r||[]).indexOf(o)===-1&&o&&!m.String(o)&&o.__fc__&&o.__fc__.parent===e&&this.rmCtx(o.__fc__)}),m.trueArray(r)&&(this.loadChildren(r,e),this.bus.$emit("update",this.api))})},rmSub(e){m.trueArray(e)&&e.forEach(r=>{r&&r.__fc__&&this.rmCtx(r.__fc__)})},rmCtx(e){if(e.deleted)return;const{id:r,field:n,input:o,name:i}=e;oe(this.ctxs,r),oe(this.formData,r),oe(this.subForm,r),oe(this.vm.setupState.ctxInject,r);const s=e.getParentGroup();s&&this.subRuleData[s.id]&&oe(this.subRuleData[s.id],n),e.group&&oe(this.subRuleData,r),o&&this.rmIdCtx(e,n,"field"),i&&this.rmIdCtx(e,i,"name"),o&&!E(this.fieldCtx,n)&&oe(this.form,n),this.deferSyncValue(()=>{if(!this.reloading){if(e.parser.loadChildren!==!1){const l=e.getPending("children",e.rule.children);m.trueArray(l)&&l.forEach(c=>c&&c.__fc__&&this.rmCtx(c.__fc__))}e.root===this.rules&&this.vm.setupState.renderRule()}},o);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"),o&&!this.fieldCtx[n]&&this.vm.emit("remove-field",n,e.rule,this.api),e.rule.__ctrl||this.vm.emit("remove-rule",e.rule,this.api),e}})}function hn(t){w(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 n=this.options[e]||this.options[U("on-"+e)];if(n){const o=Y(n);m.Function(o)&&k(()=>o(...r))}this.bus.$emit(e,...r)},targetHook(e,r,n){var l,c,f,d;let o=(c=(l=e.prop)==null?void 0:l.hook)==null?void 0:c[r],i=(p,$)=>{p&&(p=Array.isArray(p)?p:[p],p.forEach(y=>{k(()=>y(q(C({args:Object.values(n||{})},n||{}),{self:e.rule,rule:e.rule,parent:$==null?void 0:$.rule,$f:this.api,api:this.api,option:this.vm.props.option})))}))};i(o);let s="deep"+nt(r),a=e.parent;for(;a;){let p=(d=(f=a.prop)==null?void 0:f.hook)==null?void 0:d[s];i(p,a),a=a.parent}}})}function pn(t){w(t.prototype,{useProvider(){const e=this.fc.providers;Object.keys(e).forEach(r=>{let n=e[r];m.Function(n)&&(n=n(this.fc)),n._c=gn(n),this.onEffect(n,r),this.providers[r]=n})},onEffect(e,r){const n=[];(e._c||["*"]).forEach(o=>{const i=o==="*"?"*":this.getType(o);n.indexOf(i)>-1||(n.push(i),this.bus.$on(`p:${r||e.name}:${i}:${e.input?1:0}`,(s,a)=>{e[s]&&e[s](...a)}))}),e._used=n},watchEffect(e){let r={required:()=>{var n,o;return(E(e.rule,"$required")?e.rule.$required:(o=(n=e.rule)==null?void 0:n.effect)==null?void 0:o.required)||!1}};Object.keys(e.rule.effect||{}).forEach(n=>{r[n]=()=>e.rule.effect[n]}),Object.keys(e.rule).forEach(n=>{n[0]==="$"&&(r[n.substr(1)]=()=>e.rule[n])}),Object.keys(r).forEach(n=>{e.watch.push(u.watch(r[n],o=>{this.effect(e,"watch",{[n]:o})},{deep:!0}))})},ruleEffect(e,r,n){this.emitEffect({rule:e,input:!!e.field,type:this.getType(e.type)},r,n)},effect(e,r,n){this.emitEffect({rule:e.rule,input:e.input,type:e.trueType,ctx:e,custom:n},r)},getEffect(e,r){if(E(e,"$"+r))return e["$"+r];if(E(e,"effect")&&E(e.effect,r))return e.effect[r]},emitEffect({ctx:e,rule:r,input:n,type:o,custom:i},s,a){if(!o||["fcFragment","fragment"].indexOf(o)>-1)return;const l=i||Object.keys(r).reduce((c,f)=>(f[0]==="$"&&(c[f.substr(1)]=r[f]),c),C({},r.effect||{}));Object.keys(l).forEach(c=>{const f=this.providers[c];if(!f||f.input&&!n)return;let d;if(!f._c)d="*";else if(f._used.indexOf(o)>-1)d=o;else return;const p=C({value:l[c],getValue:()=>this.getEffect(r,c)},a||{});e&&(p.getProp=()=>e.effectData(c),p.clearProp=()=>e.clearEffectData(c),p.mergeProp=$=>X(p.getProp(),[$]),p.id=e.id),this.bus.$emit(`p:${c}:${d}:${f.input?1:0}`,s,[p,r,this.api])})}})}function mn(t){return t.filter(function(e,r,n){return n.indexOf(e,0)===r})}function gn(t){const e=t.components;if(Array.isArray(e)){const r=mn(e.filter(n=>n!=="*"));return r.length?r:!1}else return m.String(e)?[e]:!1}function W(t){mt(this,{options(){return t.options.value||{}},bus(){return t.bus},preview(){return t.vm.props.preview!=null?t.vm.props.preview:t.vm.setupState.parent&&t.vm.setupState.parent.props.preview!=null?t.vm.setupState.parent.props.preview:t.options.value.preview||!1}}),w(this,{fc:t,vm:t.vm,watching:!1,loading:!1,reloading:!1,noWatchFn:null,deferSyncFn:null,isMounted:!1,formData:u.reactive({}),subRuleData:u.reactive({}),subForm:{},form:u.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 Ue(this),this.api=t.extendApiFn.reduce((e,r)=>{const n=k(()=>r(e,this));return n&&n!==e&&w(e,n),e},Gr(this))}w(W.prototype,{initData(t){w(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=C(C(C({},G(this.options.formData||{})),this.fc.vm.props.modelValue||{}),this.appendData)},isBreakWatch(){return this.loading||this.noWatchFn||this.reloading},globalBeforeFetch(t){return new Promise((e,r)=>{const n=this.options.beforeFetch&&k(()=>this.options.beforeFetch(t,{api:this.api}));n&&m.Function(n.then)?n.then(e).catch(r):e()})},beforeFetch(t){return new Promise((e,r)=>{const n=t&&t.beforeFetch&&k(()=>t.beforeFetch(t,{api:this.api}));n&&m.Function(n.then)?n.then(e).catch(r):n===!1?r():e()}).then(()=>this.globalBeforeFetch(t))},beforeSubmit(t){return new Promise((e,r)=>{const n=this.options.beforeSubmit&&k(()=>this.options.beforeSubmit(t,{api:this.api}));n&&m.Function(n.then)?n.then(e).catch(r):n===!1?r():e()})}}),Qr(W),Xr(W),en(W),rn(W),an(W),dn(W),hn(W),pn(W);const qe=u.defineComponent({name:"fcFragment",inheritAttrs:!1,props:["vnode"],render(){return this.vnode}});function yn(t){return Object.keys(t).map(e=>{const r=t[e],n=u.resolveDirective(e);if(n)return[n,r.value,r.arg,r.modifiers]}).filter(e=>!!e)}function Dt(t,e){let r=t.directives;return r?(Array.isArray(r)||(r=[r]),u.withDirectives(e,r.reduce((n,o)=>n.concat(yn(o)),[]))):e}function $n(){const t={};function e(r){this.vm=r.vm,this.handle=r}return w(e.prototype,{make(r,n,o){return Dt(n,this.h(r,gt(n),o))},makeComponent(r,n,o){try{return Dt(n,u.createVNode(r,gt(n),o))}catch(i){return console.error(i),u.createVNode("")}},h(r,n,o){const s=(this.vm||u.getCurrentInstance()).appContext.config.isNativeTag(r),a=this.handle.fc.prop.components[r];!a&&s&&delete n.formCreateInject;try{return u.createVNode(a||(s?r:u.resolveComponent(r)),n,o)}catch(l){return console.error(l),u.createVNode("")}},aliasMap:t}),w(e,{aliasMap:t,alias(r,n){t[r]=n},use(r){Object.keys(r).forEach(n=>{const o=$e(n),i=rt(n).toLocaleLowerCase(),s=r[n];e.alias(n,s),[n,o,i].forEach(a=>{e.prototype[a]=function(l,c){return this.make(t[n]||a,l,c)}})})}}),e}function bn(t){class e extends At{}return Object.assign(e.prototype,t),e}function At(t){w(this,{$handle:t,vm:t.vm,options:{},ref:"fcForm",mergeOptionsRule:{normal:["form","row","info","submitBtn","resetBtn"]}}),this.updateKey(),this.init()}w(At.prototype,{__init(){this.$render=this.$handle.$render,this.$r=(...t)=>this.$render.renderRule(...t)},updateKey(){this.key=Se()},init(){},update(){},beforeRender(){},form(){return this.vm.refs[this.ref]},adapterValidate(t,e){return t.validator=(r,n,o)=>e(n,o),t},getSlot(t){const e=r=>{if(r){let n=r.slots[t];return n||e(r.setupState.parent)}};return e(this.vm)},mergeOptions(t,e){return Q(t.map(r=>this.tidyOptions(r)),e,this.mergeOptionsRule)},updateOptions(t){this.$handle.fc.targetFormDriver("updateOptions",t,{handle:this.$handle,api:this.$handle.api}),this.options=this.mergeOptions([t],this.getDefaultOptions()),this.update()},tidyOptions(t){return t},tidyRule(t){},mergeProp(t){},getDefaultOptions(){return{}},fieldChange(t,e,r,n){},render(t){}});const _n=function(t){const e={name:"loadData",_fn:[],loaded(r,n,o){this.deleted(r),u.nextTick(()=>{let i=L(r.getValue());const s=[];i.forEach(a=>{if(a&&(a.attr||a.template||a.handler)){let l=d=>{let p;n&&n.__fc__&&(p=n.__fc__.getParentGroup());let $;a.template?$=t.$handle.loadStrVar(a.template,d,p?{rule:n,value:t.$handle.subRuleData[p.id]||{}}:null):a.handler&&m.Function(a.handler)?$=a.handler(d,n,o):$=t.$handle.loadStrVar(`{{${a.attr}}}`,d,p?{rule:n,value:t.$handle.subRuleData[p.id]||{}}:null),($==null||$==="")&&a.default!=null&&($=a.default),a.copy!==!1&&($=G($));const y=a.modify?n:r.getProp();a.to==="child"?y.children?y.children[0]=$:y.children=[$]:re(y,a.to||"options",$),o.sync(n)},c=d=>l(d);const f=t.watchLoadData(c);l=te(l,a.wait||300),a.watch!==!1?s.push(f):f()}}),this._fn[r.id]=s})},deleted(r){this._fn[r.id]&&(this._fn[r.id].forEach(n=>{n()}),delete this._fn[r.id]),r.clearProp()}};return e.watch=e.loaded,e},Cn=function(t){const e={name:"t",_fn:[],loaded(r,n,o){this.deleted(r);let i=r.getValue()||{};const s=[];Object.keys(i).forEach(a=>{const l=i[a];if(l){const c=typeof l=="object";let f=$=>{let y=t.t(c?l.attr:l,c?l.params:null,$);const V=c&&l.modify?n:r.getProp();a==="child"?V.children?V.children[0]=y:V.children=[y]:re(V,a,y),o.sync(n)},d=$=>f($);const p=t.watchLoadData(d);f=te(f,l.wait||300),l.watch!==!1?s.push(p):p()}}),this._fn[r.id]=s},deleted(r){this._fn[r.id]&&(this._fn[r.id].forEach(n=>{n()}),delete this._fn[r.id]),r.clearProp()}};return e.watch=e.loaded,e},jt={name:"componentValidate",load(t,e,r){let n=t.getValue();if(!n||n.method===!1)t.clearProp(),r.clearValidateState([e.field]);else{m.Object(n)||(n={method:n});const o=n.method,i=q(C({},n),{validator(...s){const a=K(e);if(a)return r.exec(a.id,m.String(o)?o:"formCreateValidate",...s,{attr:t,rule:e,api:r})}});delete i.method,t.getProp().validate=[i]}},watch(...t){jt.load(...t)}},wn={fetch:function(t){function e(o){return m.String(o)&&(o={action:o,to:"options"}),o}function r(o,i,s){let a=o.value;n.deleted(o),m.Function(a)&&(a=a(i,s)),a=e(a);const l=d=>{d===void 0?o.clearProp():re(o.getProp(),a.to||"options",d),d!=null&&a&&a.key&&t.$handle.options.globalData[a.key]&&t.fetchCache.set(t.$handle.options.globalData[a.key],{status:!0,data:d}),s.sync(i)};if(!a||!a.action&&!a.key){l(void 0);return}a=G(a),a.to||(a.to="options");const c=a.onError,f=()=>{if(!o.getValue())return o.clearProp(),s.sync(i),!0};n._fn[o.id]=t.watchLoadData(te((d,p)=>{if(p&&a.watch===!1)return n._fn[o.id]();if(a.key){t.targetRule=i;const V=d("$globalData."+a.key);if(delete t.targetRule,V){if(f())return;l(V)}return}const $=t.$handle.loadFetchVar(G(a),d,i),y=q(C({headers:{}},$),{onSuccess(V,v){if(f())return;let j=B=>v?B:E(B,"data")?B.data:B;const P=Y($.parse);m.Function(P)?j=P:P&&m.String(P)&&(j=B=>T(B,P)),Ve(j(V,i,s)).then(B=>{l(B)})},onError(V){l(void 0),!f()&&(c||(v=>je(v.message||"fetch fail "+$.action)))(V,i,s)}});t.$handle.beforeFetch(y,{rule:i,api:s}).then(()=>{if(m.Function($.action)){Ve($.action(i,s)).then(V=>{y.onSuccess(V,!0)}).catch(V=>{y.onError(V)});return}k(()=>t.create.fetch(y,{inject:o,rule:i,api:s}))}).catch(V=>{})},a.wait||600))}const n={name:"fetch",_fn:[],loaded(...o){r(...o)},watch(...o){r(...o)},deleted(o){this._fn[o.id]&&(this._fn[o.id](),delete this._fn[o.id]),o.clearProp()}};return n},loadData:_n,t:Cn,componentValidate:jt},Vn={name:"html",loadChildren:!1,render(t,e){return e.prop.props.innerHTML=t.default(),e.vNode.make(e.prop.props.tag||"div",e.prop)},renderChildren(t){return{default:()=>t.filter(e=>m.String(e)).join("")}}};function Sn(t){t=t+"=";const r=decodeURIComponent(document.cookie).split(";");for(let n=0;n<r.length;n++){let o=r[n];for(;o.charAt(0)===" ";)o=o.substring(1);if(o.indexOf(t)===0){o=o.substring(t.length,o.length);try{return JSON.parse(o)}catch(i){return o}}}return null}function kn(t){const e=localStorage.getItem(t);if(e)try{return JSON.parse(e)}catch(r){return e}return null}function vn(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 n=t(r.shift());return r.length?n==null?null:T(n,r):n}function En(t){return He(Sn,t)}function On(t){return He(kn,t)}function Fn(t){return He(vn,t)}const Rn={en:{required:"{title} is required",validate:{url:"{title} is not a valid url",email:"{title} is not a valid email",ip:"{title} {title} is not a valid ip",phone:"{title} {title} is not a valid phone",pattern:"{title} does not match pattern {pattern}",uppercase:"{title} must be all uppercase",lowercase:"{title} must be all lowercased",positive:"{title} is not a positive number",negative:"{title} is not a negative number",equal:"{title} is not equal to {equal}",min:"{title} cannot be less than {min}",max:"{title} cannot be greater than {max}",enum:"{title} must be one of {enum}",hasKeys:"{title} does not contain required fields {hasKeys}",minLen:"{title} must be at least {minLen}",maxLen:"{title} cannot be longer than {maxLen}",len:"{title} must be exactly {len}",integer:"{title} is not an integer",number:"{title} is not an number"}},"zh-cn":{required:"{title}不能为空",validate:{url:"{title}不是有效的 url 地址",email:"{title}不是有效的邮箱地址",ip:"{title}不是有效的 IP 地址",phone:"{title}不是正确的手机号",pattern:"{title}必须匹配 {pattern}",uppercase:"{title}必须全大写",lowercase:"{title}必须全小写",positive:"{title}不是正数",negative:"{title}不是负数",equal:"{title}必须等于 {equal}",min:"{title}必须大于等于 {min}",max:"{title}必须小于等于 {max}",enum:"{title}必须是 {enum} 之一",hasKeys:"{title}必须包含 {hasKeys} 字段",minLen:"{title}长度必须大于 {minLen}",maxLen:"{title}长度必须小于 {maxLen}",len:"{title}长度必须为 {len}",integer:"{title}必须为整数",number:"{title}必须为数字"}}};function Dn(t,e){let r;return arguments.length===2?(r=arguments[1],e=r[t]):r=arguments[2],{id:e,prop:r}}function ze(){return Dn("name",...arguments)}function An(t){const e=t.key||[],r=t.array||[],n=t.normal||[];ut.push(...e),Be.push(...r),Te.push(...n),wt([...e,...r,...n])}let jn=1;const z={},Pt=Symbol("defValue");function It(t){const e={[qe.name]:qe},r={},n={},o={},i={},s=[],a=[],l=[t.extendApi],c=C({},wn),f=zr();let d={global:{}};const p=t.isMobile===!0,$=u.reactive({$mobile:p}),y=$n(),V={},v={};An(t.attrs||{});function j(h){const g=z[h];if(Array.isArray(g))return g.map(b=>b.api());if(g)return g.api()}function P(h){s.push(h)}function B(){const h=ze(...arguments);h.id&&h.prop&&(n[h.id]=h.prop)}function pe(){const h=ze(...arguments);h.id&&h.prop&&(c[h.id]=m.Function(h.prop)?h.prop:q(C({},h.prop),{name:h.id}))}function Je(h){y.use(h)}function me(h){if(arguments.length===0)return Ce;if(typeof h=="string"&&arguments.length===1)return r[U(h)];const g=ze(...arguments);if(!g.id||!g.prop)return Ce;const b=U(g.id),_=g.prop,S=_.merge===!0?r[b]:void 0;r[b]=ve(_,S||Ce),f[b]=N(b),_.maker&&w(f,_.maker)}function F(h,g){let b;if(m.String(h)){if(b=h,g===void 0)return e[b]}else b=h.displayName||h.name,g=h;if(!b||!g)return;const _=U(b);e[b]=g,e[_]=g,delete y.aliasMap[b],delete y.aliasMap[_],delete r[b],delete r[_],g.formCreateParser&&me(b,g.formCreateParser)}function A(){return Ur(Xe,e,n)}function x(h,g){const b=A();return u.createApp({data(){return u.reactive({rule:h,option:g})},render(){return u.h(b,C({ref:"fc"},this.$data))}})}function ge(){return qe}function Fe(h,g){return m.Function(h.install)?h.install(ie,g):m.Function(h)&&h(ie,g),this}function ie(h,g){let b=x(h,g||{});s.forEach(D=>{k(()=>D(ie,b))});const _=document.createElement("div");return((g==null?void 0:g.el)||document.body).appendChild(_),b.mount(_).$refs.fc.fapi}ve(ie,v);function ni(h){let g=C({},t);return h?g.inherit={components:e,parsers:r,directives:n,modelFields:o,providers:c,useApps:s,maker:f,formulas:V,loadData:$}:delete g.inherit,It(g)}function ii(h,g){o[h]=g}function si(h,g){V[h]=g}function oi(h,g){const b=i[h]||{},_=b.parsers||{};g.parsers&&Object.keys(g.parsers).forEach(S=>{_[S]=ve(g.parsers[S],Ce)}),g.name=h,i[h]=q(C(C({},b),g),{parsers:_})}function Re(h){h&&Object.keys(z).forEach(g=>{(Array.isArray(z[g])?z[g]:[z[g]]).forEach(_=>{_.bus.$emit("$loadData."+h)})})}function Qe(h,g){re($,h,g),Re(h)}function De(h,g){const b=(..._)=>k(()=>g(..._));b._driver=!0,Qe(h,b)}function qt(h,g){const b=(h||"").split(".");h=b.shift();const _=b.join(".");if(E($,h)||($[h]=Pt),$[h]!==Pt){let S=$[h];return S&&S._driver?S=S(_):b.length&&(S=T(S,b)),S==null||S===""?g:S}else return g}function ai(h){l.push(h)}function li(h){delete $[h],Re(h)}function ui(h,g){a.push({name:h,callback:g})}function Xe(h){w(this,{id:jn++,create:ie,vm:h,manager:bn(t.manager),parsers:r,providers:c,modelFields:o,formulas:V,isMobile:p,rules:h.props.rule,name:h.props.name||Se(),inFor:h.props.inFor,prop:{components:e,directives:n},get:null,drivers:i,renderDriver:null,refreshData:Re,loadData:$,CreateNode:y,bus:new Ze,unwatch:new Set,options:u.ref({}),extendApiFn:l,fetchCache:new WeakMap,tmpData:u.reactive({})}),this.unwatch.push=this.unwatch.add,a.forEach(g=>{this.bus.$on(g.name,g.callback)}),u.nextTick(()=>{u.watch(this.options,()=>{this.$handle.$manager.updateOptions(this.options.value),this.api().refresh()},{deep:!0})}),w(h.appContext.components,e),w(h.appContext.directives,n),this.$handle=new W(this),this.name&&(this.inFor?(z[this.name]||(z[this.name]=[]),z[this.name].push(this)):z[this.name]=this)}Xe.isMobile=p,w(Xe.prototype,{init(){this.isSub()&&this.unwatch.add(u.watch(()=>this.vm.setupState.parent.setupState.fc.options.value,()=>{this.initOptions(),this.$handle.api.refresh()},{deep:!0,flush:"sync"})),this.vm.props.driver&&(this.renderDriver=typeof this.vm.props.driver=="object"?this.vm.props.driver:this.drivers[this.vm.props.driver]),!this.renderDriver&&this.vm.setupState.parent&&(this.renderDriver=this.vm.setupState.parent.setupState.fc.renderDriver),this.renderDriver||(this.renderDriver=this.drivers.default),this.initOptions(),this.$handle.init()},targetFormDriver(h,...g){if(this.bus.$emit(h,...g),this.renderDriver&&this.renderDriver[h])return k(()=>this.renderDriver[h](...g))},t(h,g,b){let _=b?b("$t."+h):this.globalLanguageDriver(h);return _==null&&(_=""),_&&g&&Object.keys(g).forEach(S=>{const D=new RegExp(`{${S}}`,"g");_=_.replace(D,g[S])}),_},globalDataDriver(h){let g=h.split(".");const b=g.shift(),_=this.options.value.globalData&&this.options.value.globalData[b];if(_){if(_.type==="static")return T(_.data,g);{let S;const D=this.fetchCache.get(_);if(D){if(D.status&&(S=T(D.data,g)),!D.loading)return S;D.loading=!1,this.fetchCache.set(_,D)}else this.fetchCache.set(_,{status:!1});const R=te(()=>{ce();const J=this.fetchCache.get(_);this.options.value.globalData&&Object.values(this.options.value.globalData).indexOf(_)!==-1?(J&&(J.loading=!0,this.fetchCache.set(_,J)),this.bus.$emit("$loadData.$globalData."+b)):this.fetchCache.delete(_)},_.wait||600),le=J=>{this.fetchCache.set(_,{status:!0,data:J}),this.bus.$emit("$loadData.$globalData."+b)},ue=(J,fe)=>{if(fe&&_.watch===!1)return ce();if(fe){R();return}const de=this.$handle.loadFetchVar(vr(_),J);de.targetRule=this.targetRule,this.$handle.api.fetch(de).then(se=>{le(se)}).catch(se=>{le(null)})},ce=this.watchLoadData(ue);return _.watch===!1&&ce(),S}}},getLocale(){let h=this.vm.setupState.top.props.locale;return h&&typeof h=="object"?h.name:typeof h=="string"?h:"zh-cn"},globalLanguageDriver(h){let g=this.vm.setupState.top.props.t,b=this.vm.setupState.top.props.locale,_;if(g&&(_=k(()=>g(h))),_==null&&b&&typeof b=="object"&&(_=T(b,h)),_==null){const S=this.options.value.language||{},D=this.getLocale();_=T(S[D]||{},h),_==null&&(_=T(Rn[D]||{},h))}return _},globalVarDriver(h){let g=h.split(".");const b=g.shift(),_=this.options.value.globalVariable&&this.options.value.globalVariable[b];if(_){const S=m.Function(_)?_:Y(_.handle);if(S){let D=S((...R)=>this.$handle.api.getData(...R),this.$handle.api);return T(D,g)}}},setData(h,g,b){b?Qe(h,g):(re(this.vm.setupState.top.setupState.fc.tmpData,h,g),this.bus.$emit("$loadData."+h))},getLoadData(h,g){let b=null;if(h!=null){let _=h.split(".");const S=_.shift();if(b=T(this.vm.setupState.top.setupState.fc.tmpData,h),b!=null)return b;if(S==="$topForm")b=this.$handle.api.top.formData(!0);else if(S==="$scopeForm")b=this.$handle.api.scope.formData(!0);else if(S==="$form")b=this.$handle.api.formData(!0);else if(S==="$options")b=this.options.value;else if(S==="$globalData")b=this.globalDataDriver(_.join(".")),_=[];else if(S==="$var")b=this.globalVarDriver(_.join(".")),_=[];else if(S==="$locale")b=this.getLocale(),_=[];else if(S==="$t")b=this.globalLanguageDriver(_.join(".")),_=[];else{if(S==="$preview")return this.$handle.preview;b=qt(h),_=[]}b&&_.length&&(b=T(b,_))}return b==null||b===""?g:b},watchLoadData(h,g){let b={};const _=R=>{this.get||(this.get=S),k(()=>{h(S,R)}),this.get===S&&(this.get=void 0)},S=(R,le)=>{let ue;if(typeof R=="object"&&(ue=R.getValue,R=R.id),b[R])return b[R].val;const ce=u.computed(()=>ue?ue():this.getLoadData(R,le)),J=R.split("."),fe=J.shift(),de=J.shift()||"",se=te(()=>{const he=ue?ue():this.getLoadData(R,le);if(b[R])((he instanceof Function||m.Object(he)||Array.isArray(he))&&he===b[R].val||JSON.stringify(he)!==JSON.stringify(b[R].val))&&(b[R].val=he,_(!0));else return},g||0),fi=u.watch(ce,he=>{se()});return this.bus.$on("$loadData."+fe,se),de&&this.bus.$on("$loadData."+fe+"."+de,se),b[R]={fn:()=>{this.bus.$off("$loadData."+fe,se),de&&this.bus.$off("$loadData."+fe+"."+de,se),fi()},val:ce.value},ce.value};_(!1);const D=()=>{Object.keys(b).forEach(R=>b[R].fn()),b={},this.unwatch.delete(D)};return this.unwatch.add(D),D},isSub(){return this.vm.setupState.parent&&this.vm.props.extendOption},initOptions(){this.options.value={};let h=C({formData:{},submitBtn:{},resetBtn:{},globalEvent:{},globalData:{}},G(d));const g=this.isSub();g&&(h=this.mergeOptions(h,this.vm.setupState.parent.setupState.fc.options.value||{},!0)),h=this.mergeOptions(h,this.vm.props.option);const b=this.api();this.targetFormDriver("initOptions",h,{api:b,isSubForm:g}),this.updateOptions(h)},mergeOptions(h,g,b){return g=C({},g||{}),b&&["page","onSubmit","onReset","onCreated","onChange","onMounted","mounted","beforeUnmount","beforeSubmit","onBeforeUnmount","onReload","reload","formData","el","globalClass","style"].forEach(_=>{delete g[_]}),g.global&&(h.global=Tr(h.global,g.global),delete g.global),this.$handle.$manager.mergeOptions([g],h),h},updateOptions(h){this.options.value=this.mergeOptions(this.options.value,h),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(k(()=>this.$handle.lifecycle("beforeUnmount")),this.name)if(this.inFor){const h=z[this.name].indexOf(this);z[this.name].splice(h,1)}else delete z[this.name];a.forEach(h=>{this.bus.$off(h.name,h.callback)}),this.tmpData={},[...this.unwatch].forEach(h=>h()),this.unwatch.clear(),this.$handle.reloadRule([])},updated(){this.$handle.bindNextTick(()=>this.bus.$emit("next-tick",this.$handle.api))}});function Ht(h){w(h,{version:t.version,ui:t.ui,isMobile:p,extendApi:ai,getData:qt,setDataDriver:De,setData:Qe,removeData:li,refreshData:Re,maker:f,component:F,directive:B,setModelField:ii,setFormula:si,setDriver:oi,register:pe,$vnode:ge,parser:me,use:Fe,factory:ni,componentAlias:Je,copyRule:dt,copyRules:ht,mergeRule:X,fetch:St,$form:A,parseFn:Y,parseJson:st,toJson:be,useApp:P,getApi:j,on:ui})}function ci(h){w(h,{create:ie,install(g,b){d=C(C({},d),b||{});const _=`_installedFormCreate${p?"Mobile":""}_${t.ui}`;if(g[_]===!0)return;g[_]=!0;const S=function(R,le={}){return ie(R,le)};Ht(S),g.config.globalProperties.$formCreate=S;const D=A();g.component(D.name,D),s.forEach(R=>{k(()=>R(h,g))})}})}if(Ht(v),ci(v),De("$cookie",En),De("$localStorage",On),De("$sessionStorage",Fn),y.use({fragment:"fcFragment"}),t.install&&ie.use(t),P((h,g)=>{g.mixin({props:["formCreateInject"],emits:["fc.updateValue","fc.el"]})}),me(Vn),t.inherit){const h=t.inherit;h.components&&w(e,h.components),h.parsers&&w(r,h.parsers),h.directives&&w(n,h.directives),h.modelFields&&w(o,h.modelFields),h.providers&&w(c,h.providers),h.useApps&&w(s,h.useApps),h.maker&&w(f,h.maker),h.loadData&&w($,h.loadData),h.formulas&&w(V,h.formulas)}const Ae=A();return ve(Ae,v),Object.defineProperties(Ae,{fetch:{get(){return v.fetch},set(h){v.fetch=h}}}),Ae.util=v,Ae}const Nt={date:"YYYY-MM-DD",month:"YYYY-MM",week:"YYYY-wo",datetime:"YYYY-MM-DD HH:mm:ss",timerange:"HH:mm:ss",daterange:"YYYY-MM-DD",monthrange:"YYYY-MM",datetimerange:"YYYY-MM-DD HH:mm:ss",year:"YYYY"},Bt="datePicker",Pn={name:Bt,maker:function(){return["year","month","date","dates","week","datetime","datetimeRange","dateRange","monthRange"].reduce((t,e)=>(t[e]=N(Bt,{type:e.toLowerCase()}),t),{})}(),mergeProp(t){const e=t.prop.props;e.valueFormat||(e.valueFormat=Nt[e.type]||Nt.date)}},xe="hidden",In={name:xe,maker:{[xe]:(t,e)=>N(xe)("",t,e)},render(){return[]}},Ge="input",Nn={name:Ge,maker:function(){const t=["password","url","email","text","textarea"].reduce((e,r)=>(e[r]=N(Ge,{type:r}),e),{});return t.idate=N(Ge,{type:"date"}),t}(),mergeProp(t){let{props:e}=t.prop;e&&e.autosize&&e.autosize.minRows&&(e.rows=e.autosize.minRows||2)}},Bn={name:"textarea",mergeProp(t){let{props:e}=t.prop;e.type="textarea",e&&e.autosize&&e.autosize.minRows&&(e.rows=e.autosize.minRows||2)}},Tt="slider",Tn={name:Tt,maker:{sliderRange:N(Tt,{range:!0})},toFormValue(t,e){let r=Array.isArray(t),n=e.prop.props,o=n.min||0,i;return n.range===!0?i=r?t:[o,parseFloat(t)||o]:i=r?parseFloat(t[0])||o:parseFloat(t),i}},Ye="timePicker",Mn={name:Ye,maker:{time:N(Ye,t=>t.props.isRange=!1),timeRange:N(Ye,t=>t.props.isRange=!0)},mergeProp(t){const e=t.prop.props;e.valueFormat||(e.valueFormat="HH:mm:ss")}},Ln=[Pn,In,Nn,Bn,Tn,Mn,{name:"FcRow",render(t,e){return e.vNode.col({props:{span:24}},{default:()=>[e.vNode.row(e.prop,t)]})}},{name:"select",toFormValue(t,e){return e.prop.props.multiple&&!Array.isArray(t)?L(t):t}}],O="el",Un={button:O+"-button",icon:O+"-icon",slider:O+"-slider",rate:O+"-rate",upload:"fc-upload",cascader:O+"-cascader",popover:O+"-popover",tooltip:O+"-tooltip",colorPicker:O+"-colorPicker",timePicker:O+"-time-picker",timeSelect:O+"-time-select",datePicker:O+"-date-picker",switch:O+"-switch",select:"fc-select",checkbox:"fc-checkbox",radio:"fc-radio",inputNumber:O+"-input-number",number:O+"-input-number",input:O+"-input",textarea:O+"-input",formItem:O+"-form-item",form:O+"-form",frame:"fc-frame",col:O+"-col",row:O+"-row",tree:"fc-tree",inputTag:O+"-input-tag",inputOtp:O+"-input-otp",mention:O+"-mention",transfer:O+"-transfer",treeSelect:O+"-tree-select",autoComplete:O+"-autocomplete",auto:O+"-autocomplete",group:"fc-group",array:"fc-group",object:"fc-sub-form",subForm:"fc-sub-form"};function qn(){return{form:{inline:!1,labelPosition:"right",labelWidth:"125px",disabled:!1,size:void 0},row:{show:!0,gutter:0},submitBtn:{type:"primary",loading:!1,disabled:!1,innerText:"",show:!0,col:void 0,click:void 0},resetBtn:{type:"default",loading:!1,disabled:!1,innerText:"",show:!1,col:void 0,click:void 0}}}function Hn(t){return t.type==="tooltip"}function Mt(t,e){E(t,e)&&m.String(t[e])&&(t[e]={[e]:t[e],show:!0})}function Z(t){return t===!1}function zn(t,e){E(t,e)&&!m.Object(t[e])&&(t[e]={show:!!t[e]})}function Ke(t){const e=C({},t);return delete e.children,e}const xn={validate(){const t=this.form();return t?t.validate():new Promise(e=>e())},validateField(t){return new Promise((e,r)=>{const n=this.form();n?n.validateField(t,(o,i)=>{i?r(i):e(o)}):e()})},clearValidateState(t){const e=this.vm.refs[t.wrapRef];e&&e.clearValidate()},fieldChange(t,e,r,n){var o,i;n||(i=(o=this.vm.refs[t.wrapRef])==null?void 0:o.validate("change"))==null||i.catch(()=>{})},tidyOptions(t){return["submitBtn","resetBtn","row","info","wrap","col","title"].forEach(e=>{zn(t,e)}),t},tidyRule({prop:t}){return Mt(t,"title"),Mt(t,"info"),t},mergeProp(t){const e={info:{trigger:"hover",placement:"top-start",icon:!0},title:{},col:{span:24},wrap:{}};["info","wrap","col","title"].forEach(r=>{t.prop[r]=Q([this.options[r]||{},t.prop[r]||{}],e[r])})},getDefaultOptions(){return qn()},update(){const t=this.options.form;this.rule={props:C({},t),on:{submit:e=>{e.preventDefault()}},style:t.style,type:"form"}},beforeRender(){const{key:t,ref:e,$handle:r}=this,n=this.options.form;w(this.rule,{key:t,ref:e,class:[n.className,n.class,"form-create",this.$handle.preview?"is-preview":""]}),w(this.rule.props,{model:r.formData})},render(t){return t.slotLen()&&!this.$handle.preview&&t.setSlot(void 0,()=>this.makeFormBtn()),this.$r(this.rule,Z(this.options.row.show)?t.getSlots():[this.makeRow(t)])},makeWrap(t,e){const r=t.prop,n=`${this.key}${t.key}`,o=r.col,i=this.isTitle(r)&&r.wrap.title!==!1,s=!(o!=null&&o.labelWidth)&&!i?0:o==null?void 0:o.labelWidth,{inline:a,col:l}=this.rule.props,c=r.wrap.class;delete r.wrap.class,delete r.wrap.title;const f=(m.Undef(r.wrap.show)?!t.input:Z(r.wrap.show))?e:this.$r(Q([r.wrap,{props:q(C({labelWidth:s===void 0?s:rt(s),label:i?r.title.title:void 0},Ke(r.wrap||{})),{prop:t.id,rules:t.injectValidate()}),class:this.$render.mergeClass(c||r.className,"fc-form-item"),key:`${n}fi`,ref:t.wrapRef,type:"formItem"}]),C({default:()=>e},i?{label:()=>this.makeInfo(r,n,t)}:{}));return a===!0||Z(l)||Z(o.show)?f:this.makeCol(r,n,[f])},isTitle(t){if(this.options.form.title===!1)return!1;const e=t.title;return!(!e.title&&!e.native||Z(e.show))},makeInfo(t,e,r){var f,d,p,$,y,V;const n=C({},t.title),o=C({},t.info),i=Hn(o),s=this.options.form,a=this.getSlot("title"),l=[a?a({title:(d=(f=r.refRule)==null?void 0:f.__$title)==null?void 0:d.value,rule:r.rule,options:this.options}):(($=(p=r.refRule)==null?void 0:p.__$title)==null?void 0:$.value)+(s.labelSuffix||s["label-suffix"]||"")];if(!Z(o.show)&&(o.info||o.native)&&!Z(o.icon)){const v={type:o.type||"popover",props:Ke(o),key:`${e}pop`};delete v.props.icon,delete v.props.show,delete v.props.info,delete v.props.align,delete v.props.native;const j="content";o.info&&!E(v.props,j)&&(v.props[j]=(V=(y=r.refRule)==null?void 0:y.__$info)==null?void 0:V.value),l[o.align!=="left"?"unshift":"push"](this.$r(Q([o,v]),{[n.slot||(i?"default":"reference")]:()=>this.$r({type:"ElIcon",style:"top:2px",key:`${e}i`},{default:()=>this.$r({type:o.icon===!0?"icon-warning":o.icon})},!0)}))}const c=Q([n,{props:Ke(n),key:`${e}tit`,class:"fc-form-title",type:n.type||"span",on:{click:(...v)=>{this.$handle.targetHook(r,"titleClick",{args:v})}}}]);return delete c.props.show,delete c.props.title,delete c.props.native,this.$r(c,l)},makeCol(t,e,r){const n=C({},t.col);return delete n.show,this.$r({class:this.$render.mergeClass(n.class,"fc-form-col"),type:"col",props:n||{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(Z(this.options.submitBtn.show)||t.push(this.makeSubmitBtn()),Z(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=C({},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=C({},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={};Gn(ne),Yn(ne),Kn(ne),Wn(ne),Jn(ne),Qn(ne);function Gn(t){["group","tree","switch","upload","autoComplete","checkbox","cascader","colorPicker","datePicker","frame","inputNumber","inputTag","inputOtp","mention","transfer","treeSelect","radio","rate"].forEach(e=>{t[e]=N(e)}),t.auto=t.autoComplete,t.number=t.inputNumber,t.color=t.colorPicker,t.tag=t.inputTag}function Yn(t){t.treeSelectMultiple=N("treeSelect",{multiple:!0})}function Kn(t){const e="select",r="multiple";t.selectMultiple=N(e,{[r]:!0}),t.selectOne=N(e,{[r]:!1})}function Wn(t){const e="tree",r={treeSelected:"selected",treeChecked:"checked"};Object.keys(r).reduce((n,o)=>(n[o]=N(e,{type:r[o]}),n),t)}function Jn(t){const e="upload",r={image:["image",0],file:["file",0],uploadFileOne:["file",1],uploadImageOne:["image",1]};Object.keys(r).reduce((n,o)=>(n[o]=N(e,i=>i.props({uploadType:r[o][0],maxLength:r[o][1]})),n),t),t.uploadImage=t.image,t.uploadFile=t.file}function Qn(t){const e={frameInputs:["input",0],frameFiles:["file",0],frameImages:["image",0],frameInputOne:["input",1],frameFileOne:["file",1],frameImageOne:["image",1]};return Object.keys(e).reduce((r,n)=>(r[n]=N("frame",o=>o.props({type:e[n][0],maxLength:e[n][1]})),r),t),t.frameInput=t.frameInputs,t.frameFile=t.frameFiles,t.frameImage=t.frameImages,t}function Lt(t,e){return m.Boolean(t)?t={show:t}:!m.Undef(t)&&!m.Object(t)&&(t={show:e}),t}function Xn(t,e){return{formEl(){return e.$manager.form()},wrapEl(r){const n=e.getFieldCtx(r);if(n)return e.vm.refs[n.wrapRef]},validate(r){return new Promise((n,o)=>{const i=t.children,s=[e.$manager.validate()];i.filter(a=>!a.isScope).forEach(a=>{s.push(a.validate())}),Promise.all(s).then(()=>{n(!0),r&&r(!0)}).catch(a=>{o(a),r&&r(a),e.vm.emit("validate-fail",a,{api:t}),e.emitEvent("validate-fail",a,{api:t})})})},validateField(r,n){return new Promise((o,i)=>{const a=typeof r=="object"?K(r):e.getCtx(r);if(!a){o(null),n&&n(null);return}const l=e.subForm[a.id],c=[e.$manager.validateField(a.id)];L(l).filter(f=>!f.isScope).forEach(f=>{c.push(f.validate())}),Promise.all(c).then(()=>{o(null),n&&n(null)}).catch(f=>{i(f),n&&n(f),e.vm.emit("validate-field-fail",f,{field:r,api:t})})})},validateFields(r,n){return new Promise((o,i)=>{Array.isArray(r)||(r=[r]);const s=r.map(a=>t.validateField(a));Promise.all(s).then(()=>{o(null),n&&n(null)}).catch(a=>{i(a),n&&n(a)})})},clearValidateState(r,n=!0){t.helper.tidyFields(r).forEach(o=>{n&&this.clearSubValidateState(o),e.getCtxs(o).forEach(i=>{e.$manager.clearValidateState(i)})})},clearSubValidateState(r){t.helper.tidyFields(r).forEach(n=>{e.getCtxs(n).forEach(o=>{const i=e.subForm[o.id];i&&(Array.isArray(i)?i.forEach(s=>{s.clearValidateState()}):i&&i.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 n=Lt(e.options.submitBtn,!0);w(n,r),e.options.submitBtn=n,t.refreshOptions()},resetBtnProps:(r={})=>{let n=Lt(e.options.resetBtn,!1);w(n,r),e.options.resetBtn=n,t.refreshOptions()},submit(r,n){return new Promise((o,i)=>{(e.options.validateOnSubmit===!1?Promise.resolve():t.validate()).then(()=>{let a=t.formData();e.beforeSubmit(a).then(()=>{m.Function(r)&&k(()=>r(a,t)),m.Function(e.options.onSubmit)&&k(()=>e.options.onSubmit(a,t)),e.vm.emit("submit",a,t),o(a)}).catch(l=>{})}).catch((...a)=>{m.Function(n)&&k(()=>n(t,...a)),i(...a)})})}}}const Ut={name:"required",load(t,e,r){const n=Zn(t.getValue());let o;if(n.required===!1)t.clearProp(),r.clearValidateState([e.field]);else{const i=C({required:!0,validator(a,l,c){s(),m.empty(l)?c(i.message):c()}},n),s=()=>{var l;const a=(l=e.__fc__.refRule.__$title)==null?void 0:l.value;if(o!==a)if(o=a,!n.message)i.message=r.t("required",{title:a})||a+(r.getLocale()==="en"?" is required":"不能为空");else{const c=n.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);c&&(i.message=r.t(c[1],{title:a}))}};s(),t.getProp().validate=[i]}r.sync(e)},watch(...t){Ut.load(...t)}};function Zn(t){return m.Boolean(t)?{required:t}:m.String(t)?{message:t}:m.Undef(t)?{required:!1}:m.Function(t)?{validator:t}:m.Object(t)?t:{}}function ei(t){t.componentAlias(Un),Ir.forEach(e=>{t.component(e.name,e)}),t.register(Ut),Ln.forEach(e=>{t.parser(e)}),Object.keys(ne).forEach(e=>{t.maker[e]=ne[e]}),typeof window!="undefined"&&window.ElementPlus&&t.useApp((e,r)=>{r.use(window.ElementPlus)})}function ti(){return It({ui:"element-ui",version:"3.3.2",manager:xn,extendApi:Xn,install:ei,attrs:{normal:["col","wrap"],array:["className"],key:["title","info"]}})}const We=ti();typeof window!="undefined"&&(window.formCreate=We);const ri=We.maker;I.default=We,I.maker=ri,Object.defineProperties(I,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|