UNPKG

@form-create/vant

Version:

Vant 版本(移动端)低代码表单 | FormCreate 是一个可以通过 JSON 生成具有动态渲染、数据收集、验证和提交功能的低代码表单生成组件。

14 lines (13 loc) 121 kB
/*! * FormCreate 低代码表单渲染器 * @form-create/vant v3.3.0 * (c) 2018-2026 xaboy * Github https://github.com/xaboy/form-create * Site https://form-create.com/ * Released under the MIT License. */ (function(){"use strict";try{if(typeof document!="undefined"){var r=document.createElement("style");r.appendChild(document.createTextNode('.form-create-m{width:100%}.form-create-m.is-preview .fc-clock,.form-create-m .fc-none{display:none!important}.form-create-m .fc-form-item:after{content:" "!important;display:block!important}.form-create-m .fc-form-item .van-cell:not(.fc-form-item):after{display:none!important}.form-create-m .fc-form-item .van-cell:not(.fc-form-item){padding:0}.form-create-m .fc-form-item .fc-form-item{padding-left:0;padding-right:0;--van-padding-md: 0}.form-create-m .fc-reset-btn{margin-top:12px}.form-create-m .fc-form-title{display:inline-flex;align-items:center}.form-create-m.is-preview .van-field__label--required:before{display:none}._fc-m-group{display:flex;align-items:flex-end;min-height:38px;justify-content:center;flex-direction:column;width:100%}._fc-m-group-disabled ._fc-m-group-btn,._fc-m-group-disabled ._fc-m-group-add{cursor:not-allowed}._fc-m-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;transform:scale(1.1)}._fc-m-group-btn{cursor:pointer}._fc-m-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-m-group-handle ._fc-m-group-btn+._fc-m-group-btn{margin-left:7px}._fc-m-group-container{position:relative;display:flex;flex-direction:column;border:1px dashed #d9d9d9;border-radius:5px;margin-bottom:25px;padding:5px 5px 25px;width:100%;box-sizing:border-box}._fc-m-group-arrow{position:relative;width:20px;height:20px}._fc-m-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-m-group-arrow:before{transform:rotate(45deg)}._fc-m-group-arrow._fc-m-group-down{transform:rotate(180deg)}._fc-m-group-plus-minus{width:20px;height:20px;position:relative;cursor:pointer}._fc-m-group-plus-minus:before,._fc-m-group-plus-minus:after{content:"";position:absolute;top:50%;left:50%;width:60%;height:2px;background-color:#409eff;transform:translate(-50%,-50%)}._fc-m-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-m-group-plus-minus._fc-m-group-minus:before{display:none}._fc-m-group-plus-minus._fc-m-group-minus:after{background-color:#f56c6c}._fc-m-group-add{cursor:pointer;width:25px;height:25px;border:1px solid rgb(64 158 255 / 50%);border-radius:15px;transform:scale(1.1)}._fc-m-group-add._fc-m-group-plus-minus:before,._fc-m-group-add._fc-m-group-plus-minus:after{width:50%}._fc-m-group._fc-m-group-card{display:flex;flex-direction:column;width:100%;gap:16px}._fc-m-group._fc-m-group-card._fc-m-group-disabled ._fc-m-group-btn,._fc-m-group._fc-m-group-card._fc-m-group-disabled ._fc-m-group-add{cursor:not-allowed;opacity:.5}._fc-m-group._fc-m-group-card ._fc-m-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-m-group._fc-m-group-card ._fc-m-group-header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px 12px;border-bottom:1px solid #f0f0f0;background:#fafafa}._fc-m-group._fc-m-group-card ._fc-m-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-m-group._fc-m-group-card ._fc-m-group-title{flex:1;font-size:14px;font-weight:500;color:#000000d9;line-height:1.5715;text-align:left}._fc-m-group._fc-m-group-card ._fc-m-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;transform:none}._fc-m-group._fc-m-group-card ._fc-m-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-m-group._fc-m-group-card ._fc-m-group-btn:hover{color:#1890ff;border-color:#1890ff;background:#f0f8ff}._fc-m-group._fc-m-group-card ._fc-m-group-btn:active{color:#096dd9;border-color:#096dd9}._fc-m-group._fc-m-group-card ._fc-m-group-arrow{position:relative}._fc-m-group._fc-m-group-card ._fc-m-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-m-group._fc-m-group-card ._fc-m-group-arrow._fc-m-group-down{transform:rotate(180deg)}._fc-m-group._fc-m-group-card ._fc-m-group-sort{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;height:24px}._fc-m-group._fc-m-group-card ._fc-m-group-sort:before,._fc-m-group._fc-m-group-card ._fc-m-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-m-group._fc-m-group-card ._fc-m-group-sort:before{top:6px;transform:translate(-50%) rotate(45deg)}._fc-m-group._fc-m-group-card ._fc-m-group-sort:after{bottom:6px;transform:translate(-50%) rotate(225deg)}._fc-m-group._fc-m-group-card ._fc-m-group-sort-up,._fc-m-group._fc-m-group-card ._fc-m-group-sort-down{position:absolute;left:0;right:0;height:12px;cursor:pointer;z-index:1}._fc-m-group._fc-m-group-card ._fc-m-group-sort-up{top:0}._fc-m-group._fc-m-group-card ._fc-m-group-sort-down{bottom:0}._fc-m-group._fc-m-group-card ._fc-m-group-sort-up:hover,._fc-m-group._fc-m-group-card ._fc-m-group-sort-down:hover{background:#1890ff1a}._fc-m-group._fc-m-group-card ._fc-m-group-plus-minus{position:relative;background:#409eff;border-color:#409eff;color:#fff;width:24px;height:24px;border-radius:4px}._fc-m-group._fc-m-group-card ._fc-m-group-plus-minus:hover{background:#66b1ff;border-color:#66b1ff;color:#fff}._fc-m-group._fc-m-group-card ._fc-m-group-plus-minus:before,._fc-m-group._fc-m-group-card ._fc-m-group-plus-minus:after{content:"";position:absolute;top:50%;left:50%;width:8px;height:1px;background-color:currentColor;transform:translate(-50%,-50%)}._fc-m-group._fc-m-group-card ._fc-m-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-m-group._fc-m-group-card ._fc-m-group-plus-minus._fc-m-group-minus{background:#f56c6c;border-color:#f56c6c}._fc-m-group._fc-m-group-card ._fc-m-group-plus-minus._fc-m-group-minus:hover{background:#f78989;border-color:#f78989}._fc-m-group._fc-m-group-card ._fc-m-group-plus-minus._fc-m-group-minus:before{display:none}._fc-m-group._fc-m-group-card ._fc-m-group-content{padding:20px}._fc-m-group._fc-m-group-card ._fc-m-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;transform:none}._fc-m-group._fc-m-group-card ._fc-m-group-add:hover{color:#409eff;border-color:#409eff;background:#f0f8ff}._fc-m-group._fc-m-group-card ._fc-m-group-add._fc-m-group-plus-minus{width:24px;height:24px;background:#409eff;border-color:#409eff;color:#fff}._fc-m-group._fc-m-group-card ._fc-m-group-add._fc-m-group-plus-minus:hover{background:#66b1ff;border-color:#66b1ff;color:#fff}._fc-m-group._fc-m-group-card ._fc-m-group-add._fc-m-group-plus-minus:before,._fc-m-group._fc-m-group-card ._fc-m-group-add._fc-m-group-plus-minus:after{content:"";position:absolute;top:50%;left:50%;width:8px;height:1px;background-color:currentColor;transform:translate(-50%,-50%)}._fc-m-group._fc-m-group-card ._fc-m-group-add._fc-m-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-m-group._fc-m-group-card ._fc-m-group-empty{text-align:center;padding:40px 20px;color:#00000073;font-size:14px}@media (max-width: 768px){._fc-m-group._fc-m-group-card ._fc-m-group-container{margin:0 -8px;border-radius:0;border-left:none;border-right:none}._fc-m-group._fc-m-group-card ._fc-m-group-header{padding:12px 16px 8px}._fc-m-group._fc-m-group-card ._fc-m-group-content{padding:16px}._fc-m-group._fc-m-group-card ._fc-m-group-handle{gap:2px}._fc-m-group._fc-m-group-card ._fc-m-group-btn{width:22px;height:22px}}')),document.head.appendChild(r)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})(); (function(A,c){typeof exports=="object"&&typeof module!="undefined"?c(exports,require("vue"),require("dayjs"),require("vant")):typeof define=="function"&&define.amd?define(["exports","vue","dayjs","vant"],c):(A=typeof globalThis!="undefined"?globalThis:A||self,c(A.formCreateMobile={},A.Vue,A.dayjs,A.vant))})(this,function(A,c,j,De){"use strict";var $n=Object.defineProperty,_n=Object.defineProperties;var Cn=Object.getOwnPropertyDescriptors;var Pt=Object.getOwnPropertySymbols;var Vn=Object.prototype.hasOwnProperty,wn=Object.prototype.propertyIsEnumerable;var Nt=(A,c,j)=>c in A?$n(A,c,{enumerable:!0,configurable:!0,writable:!0,value:j}):A[c]=j,C=(A,c)=>{for(var j in c||(c={}))Vn.call(c,j)&&Nt(A,j,c[j]);if(Pt)for(var j of Pt(c))wn.call(c,j)&&Nt(A,j,c[j]);return A},x=(A,c)=>_n(A,Cn(c));const It=c.defineComponent({name:"fcSubForm",props:{rule:Array,options:{type:Object,default:()=>c.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:c.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,c.nextTick(()=>{this.$emit("itemMounted",t)})}},render(){const t=this.form;return c.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)}}),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 F(t,e){return{}.hasOwnProperty.call(t,e)}const Tt=c.defineComponent({name:"fcCalendar",inheritAttrs:!1,props:{placeholder:String,formCreateInject:Object,disabled:Boolean,clearable:Boolean,type:String,modelValue:[String,Array],minDate:[String,Date],maxDate:[String,Date]},emits:["update:modelValue","change","fc.el"],setup(t,e){const r=c.ref(!1),n=c.toRef(t,"modelValue"),s=c.toRef(t,"formCreateInject"),i=c.ref(n.value);c.watch(()=>n.value,h=>{i.value=h});const o=h=>j(h).format("YYYY-MM-DD"),a=h=>j(h).toDate(),l=c.computed(()=>{const h=n.value;return Array.isArray(h)?h.map(a):h?a(h):null}),u=c.computed(()=>({minDate:t.minDate?j(t.minDate).toDate():void 0,maxDate:t.maxDate?j(t.maxDate).toDate():void 0})),f=h=>{Array.isArray(h)?i.value=h.map(o):h?i.value=o(h):i.value=h},p=()=>{e.emit("update:modelValue",i.value),e.emit("change",i.value)},m={range(){return i.value.length?i.value.join(" - "):""},multiple(){return i.value.length?s.value.t("selectedData",{length:i.value.length})||`选择了 ${i.value.length} 个日期`:""}};return{show:r,inputValue:i,defaultDate:l,dateRange:u,open(){t.disabled||(r.value=!0)},confirm(h){f(h),r.value=!1,p()},getStrValue(){return i.value?F(m,t.type)?m[t.type]():i.value||"":""},clear(h){h.stopPropagation();const _=Array.isArray(i.value)?[]:"";f(_),p()}}},render(){const t=()=>this.$props.clearable&&!g.empty(this.inputValue)?c.createVNode("i",{class:"van-badge__wrapper van-icon van-icon-clear van-field__clear",onClick:this.clear},null):void 0;return c.createVNode("div",{class:"_fc-calendar"},[c.createVNode(c.resolveComponent("van-field"),{ref:"el",placeholder:this.placeholder,readonly:!0,disabled:this.$props.disabled,onClick:this.open,"model-value":this.getStrValue(),isLink:!0,border:!1},{"right-icon":t}),c.createVNode(c.resolveComponent("van-calendar"),c.mergeProps(C(C({},this.$attrs),this.dateRange),{show:this.show,"onUpdate:show":e=>this.show=e,type:this.type,onConfirm:this.confirm,defaultDate:this.defaultDate}),null)])},mounted(){this.$emit("fc.el",this.$refs.el)}}),Ee=t=>!t||!Array.isArray(t)?[]:t.map(e=>{const r=C({},e);return r.label!==void 0&&r.text===void 0&&(r.text=r.label),r.children&&Array.isArray(r.children)&&(r.children=Ee(r.children)),r}),Bt=c.defineComponent({name:"fcCascader",inheritAttrs:!1,props:{placeholder:String,disabled:Boolean,clearable:Boolean,fieldNames:Object,modelValue:[String,Number],options:Array,minDate:[String,Date],maxDate:[String,Date]},emits:["update:modelValue","fc.el","change"],setup(t,e){const r=c.ref(!1),n=c.toRef(t,"modelValue"),s=c.toRef(t,"fieldNames",{}),i=c.computed(()=>{var f;return(f=s==null?void 0:s.value)!=null&&f.text?t.options||[]:Ee(t.options||[])}),o=(f,p,m)=>{for(let h=0;h<f.length;h++){if(f[h][s.value.value||"value"]===p)return[...m,f[h]];if(f[h][s.value.children||"children"]){const _=o(f[h][s.value.children||"children"],p,[...m,f[h]]);if(_)return _}}},a=f=>{if(f==null||f==="")return"";const p=o(i.value,f,[]);return p?p.map(m=>m[s.value.text||"text"]).join(" / "):f},l=c.ref(a(n.value));c.watch(()=>n.value,f=>{l.value=a(f)}),c.watch(()=>i.value,()=>{n.value!=null&&n.value!==""&&(l.value=a(n.value))},{deep:!0});const u=f=>{e.emit("update:modelValue",f),e.emit("change",f)};return{show:r,inputValue:l,options:i,open(){t.disabled||(r.value=!0)},confirm({selectedOptions:f,value:p}){l.value=f.map(m=>m[s.value.text||"text"]).join(" / "),r.value=!1,u(p)},clear(f){f.stopPropagation(),l.value="",u("")}}},render(){const t=()=>this.$props.clearable&&this.inputValue?c.createVNode("i",{class:"van-badge__wrapper van-icon van-icon-clear van-field__clear",onClick:this.clear},null):void 0;return c.createVNode("div",{class:"_fc-cascader"},[c.createVNode(c.resolveComponent("van-field"),{ref:"el",placeholder:this.placeholder,readonly:!0,disabled:this.$props.disabled,onClick:this.open,"model-value":this.inputValue,border:!1,isLink:!0},{"right-icon":t}),c.createVNode(c.resolveComponent("van-popup"),{show:this.show,"onUpdate:show":e=>this.show=e,round:!0,position:"bottom"},{default:()=>[c.createVNode(c.resolveComponent("van-cascader"),c.mergeProps(this.$attrs,{modelValue:this.modelValue,fieldNames:this.fieldNames,options:this.options,onClose:()=>this.show=!1,onFinish:this.confirm}),null)]})])},mounted(){this.$emit("fc.el",this.$refs.el)}});function Mt(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!c.isVNode(t)}const Lt=c.defineComponent({name:"fcCheckbox",inheritAttrs:!1,props:{modelValue:Array,options:Array},emits:["update:modelValue","change"],setup(t,e){const r=c.toRef(t,"modelValue",[]);return{options:c.toRef(t,"options"),modelValue:r,onInput(s){e.emit("update:modelValue",s),e.emit("change",s)}}},render(){let t;return c.createVNode(c.resolveComponent("van-checkbox-group"),c.mergeProps({direction:"horizontal"},this.$attrs,{modelValue:Array.isArray(this.modelValue)?this.modelValue:[],"onUpdate:modelValue":this.onInput}),Mt(t=(this.options||[]).map(e=>{const r=C({},e),{text:n,value:s}=e;return delete r.text,delete r.value,c.createVNode(c.resolveComponent("van-checkbox"),c.mergeProps({name:s,shape:"square"},r),{default:()=>[n||e.label||s]})}))?t:{default:()=>[t]})}}),Ut=c.defineComponent({name:"fcSelect",inheritAttrs:!1,props:{disabled:Boolean,placeholder:String,columnsFieldNames:Object,modelValue:[String,Number,Boolean],options:Array},emits:["update:modelValue","fc.el","change"],setup(t,e){const r=c.ref(!1),n=c.toRef(t,"modelValue"),s=c.toRef(t,"columnsFieldNames",{}),i=c.computed(()=>{var l;return(l=s==null?void 0:s.value)!=null&&l.text?t.options||[]:Ee(t.options||[])}),o=c.computed(()=>{if(n.value==null||n.value==="")return"";for(let l=0;l<(i.value||[]).length;l++)if(i.value[l][s.value.value||"value"]===n.value)return i.value[l][s.value.text||"text"];return n.value}),a=l=>{e.emit("update:modelValue",l),e.emit("change",l)};return{show:r,inputValue:o,options:i,open(){t.disabled||(r.value=!0)},confirm({selectedValues:l}){a(l[0]),r.value=!1}}},render(){return c.createVNode("div",{class:"_fc-select"},[c.createVNode(c.resolveComponent("van-field"),{ref:"el",placeholder:this.placeholder,readonly:!0,disabled:this.$props.disabled,onClick:this.open,"model-value":this.inputValue,isLink:!0},null),c.createVNode(c.resolveComponent("van-popup"),{show:this.show,"onUpdate:show":t=>this.show=t,round:!0,position:"bottom"},{default:()=>[c.createVNode(c.resolveComponent("van-picker"),c.mergeProps(this.$attrs,{modelValue:[this.modelValue],columnsFieldNames:this.columnsFieldNames,columns:this.options,onCancel:()=>this.show=!1,onConfirm:this.confirm}),null)]})])},mounted(){this.$emit("fc.el",this.$refs.el)}});function ne(t){return Array.isArray(t)?t:[null,void 0,""].indexOf(t)>-1?[]:[t]}const qt="fcUploader";function Ke(t,e){return typeof t=="object"?t:{url:t,is_string:!0,name:xt(t),uid:e}}function Xe(t){return x(C({},t),{file:t,value:t})}function xt(t){return(""+t).split("/").pop()}const Gt=c.defineComponent({name:qt,inheritAttrs:!1,props:{formCreateInject:Object,modelValue:[Array,String,Object],afterRead:Function,action:String,headers:Object,method:String,data:Object,uploadName:String,onSuccess:Function,onError:Function,maxCount:Number},emits:["update:modelValue","delete"],setup(t,e){const r=c.toRef(t,"afterRead"),n=c.toRef(t,"modelValue",[]),s=c.ref(ne(n.value).map(Ke).map(Xe));c.watch(()=>n.value,a=>{s.value=ne(a).map(Ke).map(Xe)});const i=()=>{let a=s.value.map(l=>l.is_string?l.url:l.value||l.url).filter(l=>l!==void 0);e.emit("update:modelValue",t.maxCount===1?a[0]||"":a)},o=(a,l)=>{if(a.status="uploading",r.value)return r.value(a);{const u=C({},t.data||{});u[t.uploadName||"file"]=a.file,t.formCreateInject.api.fetch({action:t.action,dataType:"formData",source:"upload",headers:t.headers||{},method:t.method||"post",data:u}).then(f=>{a.status="success",t.onSuccess&&t.onSuccess(f,a),l(!0)}).catch(f=>{l(!1),a.status="failed",a.message=t.formCreateInject.t("uploadFail")||"上传失败",t.onError&&t.onError(f,a)})}};return{fileList:s,modelValue:n,onDelete(a){i(),e.emit("delete",a)},uploadFiles(a){const l=Array.isArray(a)?a:[a];Promise.all(l.map(u=>new Promise(f=>{o(u,f)}))).then(u=>{u.filter(f=>!!f).length>0&&i()})},uploadFile:o}},render(){return c.createVNode(c.resolveComponent("van-uploader"),c.mergeProps(this.$attrs,{"model-value":this.fileList,maxCount:this.maxCount,"onUpdate:model-value":t=>this.fileList=t,afterRead:this.uploadFiles,onDelete:this.onDelete}),this.$slots)}});function Ht(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!c.isVNode(t)}const Jt=c.defineComponent({name:"fcRadio",inheritAttrs:!1,props:{modelValue:[String,Number,Boolean],options:Array},emits:["update:modelValue","change"],setup(t,e){const r=c.toRef(t,"modelValue",[]);return{options:c.toRef(t,"options"),modelValue:r,onInput(s){e.emit("update:modelValue",s),e.emit("change",s)}}},render(){let t;return c.createVNode(c.resolveComponent("van-radio-group"),c.mergeProps({direction:"horizontal"},this.$attrs,{modelValue:this.modelValue,"onUpdate:modelValue":this.onInput}),Ht(t=(this.options||[]).map(e=>{const r=C({},e),{text:n,value:s}=e;return delete r.text,delete r.value,c.createVNode(c.resolveComponent("van-radio"),c.mergeProps({name:s},r),{default:()=>[n||e.label||s]})}))?t:{default:()=>[t]})}}),zt=c.defineComponent({name:"fcDatePicker",inheritAttrs:!1,props:{disabled:Boolean,clearable:Boolean,placeholder:String,modelValue:[String,Number],minDate:[String,Date],maxDate:[String,Date]},emits:["update:modelValue","fc.el","change"],setup(t,e){const r=c.ref(!1),n=c.toRef(t,"modelValue"),s=c.computed(()=>n.value==null||n.value===""?[]:n.value.split("-")),i=c.computed(()=>({minDate:t.minDate?j(t.minDate).toDate():void 0,maxDate:t.maxDate?j(t.maxDate).toDate():void 0})),o=a=>{e.emit("update:modelValue",a),e.emit("change",a)};return{show:r,formValue:s,dateRange:i,open(){t.disabled||(r.value=!0)},confirm({selectedValues:a}){o(a.join("-")),r.value=!1},clear(a){a.stopPropagation(),o("")}}},render(){const t=()=>this.$props.clearable&&this.modelValue?c.createVNode("i",{class:"van-badge__wrapper van-icon van-icon-clear van-field__clear",onClick:this.clear},null):void 0;return c.createVNode("div",{class:"_fc-date-picker"},[c.createVNode(c.resolveComponent("van-field"),{ref:"el",placeholder:this.placeholder,readonly:!0,disabled:this.$props.disabled,onClick:this.open,"model-value":this.modelValue,border:!1,isLink:!0},{"right-icon":t}),c.createVNode(c.resolveComponent("van-popup"),{show:this.show,"onUpdate:show":e=>this.show=e,round:!0,position:"bottom"},{default:()=>[c.createVNode(c.resolveComponent("van-date-picker"),c.mergeProps({columnsType:["year","month","day"]},C(C({},this.$attrs),this.dateRange),{modelValue:this.formValue,onConfirm:this.confirm,onCancel:()=>this.show=!1}),null)]})])},mounted(){this.$emit("fc.el",this.$refs.el)}}),Wt=c.defineComponent({name:"fcTimePicker",inheritAttrs:!1,props:{disabled:Boolean,clearable:Boolean,placeholder:String,modelValue:[String,Number]},emits:["update:modelValue","fc.el","change"],setup(t,e){const r=c.ref(!1),n=c.toRef(t,"modelValue"),s=c.computed(()=>n.value==null||n.value===""?[]:n.value.split(":")),i=o=>{e.emit("update:modelValue",o),e.emit("change",o)};return{show:r,formValue:s,open(){t.disabled||(r.value=!0)},confirm({selectedValues:o}){i(o.join(":")),r.value=!1},clear(o){o.stopPropagation(),i("")}}},render(){const t=()=>this.$props.clearable&&this.modelValue?c.createVNode("i",{class:"van-badge__wrapper van-icon van-icon-clear van-field__clear",onClick:this.clear},null):void 0;return c.createVNode("div",{class:"_fc-time-picker"},[c.createVNode(c.resolveComponent("van-field"),{ref:"el",placeholder:this.placeholder,readonly:!0,disabled:this.$props.disabled,onClick:this.open,"model-value":this.modelValue,border:!1,isLink:!0},{"right-icon":t}),c.createVNode(c.resolveComponent("van-popup"),{show:this.show,"onUpdate:show":e=>this.show=e,round:!0,position:"bottom"},{default:()=>[c.createVNode(c.resolveComponent("van-time-picker"),c.mergeProps({columnsType:["hour","minute"]},this.$attrs,{modelValue:this.formValue,onConfirm:this.confirm,onCancel:()=>this.show=!1}),null)]})])},mounted(){this.$emit("fc.el",this.$refs.el)}});function U(t,e,r){t[e]=r}function ie(t,e){delete t[e]}function de(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&&U(t,s,[]);else if(i._clone&&r!==void 0)if(r)i=i.getRule(),o&&U(t,s,{});else{U(t,s,i._clone());continue}else o&&U(t,s,{});t[s]=de(t[s],i,r)}else U(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 de({},{value:t}).value}const Kt=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)&&U(t,n,e[n]);return t};function V(){return Kt.apply(this,arguments)}function ke(t){return typeof t!="object"||t===null?t:t instanceof Array?[...t]:C({},t)}function Y(t,e){var r=null;return function(...n){r!==null&&clearTimeout(r),r=setTimeout(()=>t.call(this,...n),e)}}function Xt(t){return t==null?"":typeof t=="object"?JSON.stringify(t,null,2):String(t)}function Yt(t){return t&&typeof t=="object"&&typeof t.then=="function"}function be(t){return Yt(t)?t:Promise.resolve(t)}function he(t){let e=t.replace(/([A-Z])/g,"-$1").toLocaleLowerCase();return e.indexOf("-")===0&&(e=e.substr(1)),e}function Ye(t){return t.replace(t[0],t[0].toLocaleUpperCase())}function Ze(t,e,r){return`[form-create ${t}]: ${e}`}function Ae(t,e){console.error(Ze("err",t))}function Zt(t){Ae(t.toString()),console.error(t)}const je="[[FORM-CREATE-PREFIX-",Pe="-FORM-CREATE-SUFFIX]]";function pe(t,e){return JSON.stringify(de(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+Pe}},e)}function Ne(t){return new Function("return "+t)()}function H(t,e){if(t&&g.String(t)&&t.length>4){let r=t.trim(),n=!1;try{if(r.indexOf(Pe)>0&&r.indexOf(je)===0)r=r.replace(Pe,"").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=Ne(`function($inject){ `+r.substring(5)+` }`),r.__json=t,r.__inject=!0,r;(!e&&r.indexOf("function ")===0&&r!=="function "||!e&&r.indexOf("function(")===0&&r!=="function(")&&(n=!0)}if(!n)return t;let s;try{s=Ne(r)}catch(i){s=Ne("function "+r)}return s.__json=t,s}catch(s){Ae(`解析失败:${r} err: ${s}`);return}}return t}function Qe(t,e){return JSON.parse(t,function(r,n){return g.Undef(n)||!n.indexOf?n:H(n,e)})}let Qt=0;function $e(){const t=370+ ++Qt;return"F"+Math.random().toString(36).substr(3,3)+(+`${Date.now()}`).toString(36)+t.toString(36)+"c"}function Z(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=c.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:!1},disabled:{type:Boolean,default:void 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:c.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(()=>{de(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&&F(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);V(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&&c.nextTick(()=>this.$emit("add",r,Object.keys(this.cacheRule).length-1))},add$f(t,e,r){this.cacheRule[e].$f=r,c.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&&c.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)};be(this.onBeforeRemove(this.modelValue,t)).then(n=>{n!==!1&&r()})},addIcon(t){return c.createVNode("div",{class:"_fc-m-group-btn _fc-m-group-plus-minus",onClick:this.add},null)},delIcon(t,e){return c.createVNode("div",{class:"_fc-m-group-btn _fc-m-group-plus-minus _fc-m-group-minus",onClick:()=>this.del(t,e)},null)},sortUpIcon(t){return c.createVNode("div",{class:"_fc-m-group-btn _fc-m-group-arrow _fc-m-group-up",onClick:()=>this.changeSort(t,-1)},null)},sortDownIcon(t){return c.createVNode("div",{class:"_fc-m-group-btn _fc-m-group-arrow _fc-m-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(c.createVNode("div",{class:"_fc-group-btn _fc-group-sort"},[c.createVNode("div",{class:" _fc-group-sort-up",onClick:()=>this.changeSort(t,-1)},null),c.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}):c.createVNode("div",{key:"a_def",class:"_fc-m-group-plus-minus _fc-m-group-add fc-clock",onClick:this.add},null):t.map((o,a)=>{const{rule:l,options:u}=this.cacheRule[o],f=e&&!n?this.makeIcon(t.length,a,o):[],p=this.getTitle(a,o);return s?c.createVNode("div",{class:"_fc-m-group-container",key:o},[c.createVNode("div",{class:"_fc-m-group-header"},[p===!1?c.createVNode("div",{class:"_fc-m-group-idx"},[a+1]):null,p!==!1?c.createVNode("div",{class:"_fc-m-group-title"},[p]):null,c.createVNode("div",{class:"_fc-m-group-handle fc-clock"},[f.length?f:null])]),c.createVNode("div",{class:"_fc-m-group-content"},[c.createVNode(r,c.mergeProps({key:o},{disabled:n,"onUpdate:modelValue":m=>this.formData(o,m),"onUpdate:api":m=>this.add$f(a,o,m),inFor:!0,modelValue:this.field?{[this.field]:this._value(this.modelValue[a])}:this.modelValue[a],rule:l,option:u,extendOption:!0}),null)])]):c.createVNode("div",{class:"_fc-m-group-container",key:o},[c.createVNode(r,c.mergeProps({key:o},{disabled:n,"onUpdate:modelValue":m=>this.formData(o,m),"onUpdate:api":m=>this.add$f(a,o,m),inFor:!0,modelValue:this.field?{[this.field]:this._value(this.modelValue[a])}:this.modelValue[a],rule:l,option:u,extendOption:!0}),null),c.createVNode("div",{class:"_fc-m-group-idx"},[a+1]),f.length?c.createVNode("div",{class:"_fc-m-group-handle fc-clock"},[f]):null])});return c.createVNode("div",{key:"con",class:"_fc-m-group "+(n?"_fc-m-group-disabled":"")+(s?" _fc-m-group-card":"")},[i])}}),tr=(t,e)=>{const r=t.__vccOpts||t;for(const[n,s]of e)r[n]=s;return r},rr={name:"IconWarning"},nr={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"};function ir(t,e,r,n,s,i){return c.openBlock(),c.createElementBlock("svg",nr,[...e[0]||(e[0]=[c.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 sr=[It,tr(rr,[["render",ir]]),Tt,Bt,Lt,Jt,Ut,zt,Wt,er,Gt],et=["props"],tt=["class","style","directives"],rt=["on","hook"],Q=(t,e={},r={})=>{const n=[...et,...r.normal||[]],s=[...tt,...r.array||[]],i=[...rt,...r.functional||[]],o=r.props||[];return t.reduce((a,l)=>{for(const u in l)if(a[u])if(o.indexOf(u)>-1)a[u]=Q([l[u]],a[u]);else if(n.indexOf(u)>-1)a[u]=C(C({},a[u]),l[u]);else if(s.indexOf(u)>-1){const f=a[u]instanceof Array?a[u]:[a[u]],p=l[u]instanceof Array?l[u]:[l[u]];a[u]=[...f,...p]}else if(i.indexOf(u)>-1)for(const f in l[u])if(a[u][f]){const p=a[u][f]instanceof Array?a[u][f]:[a[u][f]],m=l[u][f]instanceof Array?l[u][f]:[l[u][f]];a[u][f]=[...p,...m]}else a[u][f]=l[u][f];else if(u==="hook")for(let f in l[u])a[u][f]?a[u][f]=or(a[u][f],l[u][f]):a[u][f]=l[u][f];else a[u]=l[u];else n.indexOf(u)>-1||i.indexOf(u)>-1||o.indexOf(u)>-1?a[u]=C({},l[u]):s.indexOf(u)>-1?a[u]=l[u]instanceof Array?[...l[u]]:typeof l[u]=="object"?C({},l[u]):l[u]:a[u]=l[u];return a},e)},or=(t,e)=>function(){t&&t.apply(this,arguments),e&&e.apply(this,arguments)},nt=["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"],Ie=["validate","children","control"],Te=["effect","deep","renderSlots"];function it(){return[...nt,...et,...tt,...rt,...Ie,...Te]}function B(t){const e=t.replace(/(-[a-z])/g,function(r){return r.replace("-","").toLocaleUpperCase()});return st(e)}function st(t){return t.replace(t[0],t[0].toLowerCase())}function Be(t,e){return{value:t,enumerable:!1,configurable:!1,writable:!0}}function ot(t,e){return at([t],e||!1)[0]}function at(t,e){return de([],[...t],e||!1)}function K(t,e){return Q(Array.isArray(e)?e:[e],t,{array:Ie,normal:Te}),t}function lt(t){const e=g.Function(t.getRule)?t.getRule():t;return e.type||(e.type="input"),e}function ar(t,e){return t?(Object.keys(e||{}).forEach(r=>{e[r]&&(t[r]=K(t[r]||{},e[r]))}),t):e}function ut(t,e){Object.defineProperties(t,Object.keys(e).reduce((r,n)=>(r[n]={get(){return e[n]()}},r),{}))}function J(t){return t.__fc__||(t.__origin__?t.__origin__.__fc__:null)}function v(t,e){try{e=t()}catch(r){Zt(r)}return e}function _e(){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)||c.isVNode(r)?this.setSlot(void 0,()=>r):Object.keys(n).forEach(s=>{this.setSlot(s,n[s])}),this}}}function ct(t){const e=C({},t.props||{});return Object.keys(t.on||{}).forEach(r=>{r.indexOf("-")>0&&(r=B(r));const n=`on${Ye(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 Ce(t,e){return Object.setPrototypeOf(t,e),t}const ft=(t,e)=>typeof t=="string"?String(e):typeof t=="number"?Number(e):e,se={"==":(t,e)=>JSON.stringify(t)===JSON.stringify(ft(t,e)),"!=":(t,e)=>!se["=="](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(ft(t[0],e))>-1},notOn(t,e){return!se.on(t,e)},in(t,e){return e&&e.indexOf&&e.indexOf(t)>-1},notIn(t,e){return!se.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 lr(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 dt(t){let e=t.split("."),r=[],n="";return e.forEach((s,i)=>{i===0?n=s:n+="."+s,r.push(n)}),r.join(" && ")}function ht(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:ht(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 Ve=(t,e)=>{if(!(!t||t===e)){if(t.props.formCreateInject)return t.props.formCreateInject;if(t.parent)return Ve(t.parent,e)}};function ur(t,e,r){return c.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=c.getCurrentInstance();c.provide("parentFC",s);const i=c.inject("parentFC",null);let o=i;if(i)for(;o.setupState.parent;)o=o.setupState.parent;else o=s;const{rule:a,modelValue:l,subForm:u,inFor:f}=c.toRefs(n),p=c.reactive({ctxInject:{},destroyed:!1,isShow:!0,unique:1,renderRule:[...a.value||[]],updateValue:JSON.stringify(l.value||{})}),m=new t(s),h=m.api(),_=f.value,w=()=>{if(i){const R=Ve(s,i);if(R){let E;_?(E=ne(R.getSubForm()),E.push(h)):E=h,R.subForm(E)}}},O=()=>{const R=Ve(s,i);if(R)if(_){const E=ne(R.getSubForm()),L=E.indexOf(h);L>-1&&E.splice(L,1)}else R.subForm()};let P=null;c.onBeforeMount(()=>{c.watchEffect(()=>{let R="";const E=n.option&&n.option.globalClass||{};Object.keys(E).forEach(L=>{let fe="";E[L].style&&Object.keys(E[L].style).forEach(ve=>{fe+=he(ve)+":"+E[L].style[ve]+";"}),E[L].content&&(fe+=E[L].content+";"),fe&&(R+=`.${L}{${fe}}`)}),n.option&&n.option.style&&(R+=n.option.style),P||(P=document.createElement("style"),P.type="text/css",document.head.appendChild(P)),P.innerHTML=R||""})});const M=Y(()=>{m.bus.$emit("$loadData.$topForm")},100),T=Y(function(){m.bus.$emit("$loadData.$scopeForm")},100),Je=Y(()=>{m.bus.$emit("$loadData.$form")},100),Se=R=>{m.bus.$emit("change-$form."+R)};return c.onMounted(()=>{i&&(h.top.bus.$on("$loadData.$form",M),h.top.bus.$on("change",Se)),h!==h.scope&&h.scope.bus.$on("$loadData.$scopeForm",T),m.mounted()}),c.onBeforeUnmount(()=>{i&&(h.top.bus.$off("$loadData.$form",M),h.top.bus.$off("change",Se)),h!==h.scope&&h.scope.bus.$off("$loadData.$scopeForm",T),O(),p.destroyed=!0,m.unmount(),P&&(P.parentNode||P.parentElement)&&document.head.removeChild(P)}),c.onUpdated(()=>{m.updated()}),w(),c.watch(()=>n.option,()=>{m.initOptions(),h.refresh()},{deep:!0,flush:"sync"}),c.watch(()=>[...a.value],R=>{m.$handle.isBreakWatch()||R.length===p.renderRule.length&&R.every(E=>p.renderRule.indexOf(E)>-1)||(m.$handle.updateAppendData(),m.$handle.reloadRule(a.value),s.setupState.renderRule())}),c.watch(()=>[n.disabled,n.preview],()=>{h.refresh()}),c.watch(l,R=>{pe(R||{})!==p.updateValue&&(h.config.forceCoverValue?h.coverValue(R||{}):h.setValue(R||{}))},{deep:!0,flush:"post"}),c.watch(()=>n.index,()=>{h.coverValue({}),m.$handle.updateAppendData(),c.nextTick(()=>{c.nextTick(()=>{h.clearValidateState()})})},{flush:"sync"}),x(C({fc:c.markRaw(m),parent:i&&c.markRaw(i),top:c.markRaw(o),fapi:c.markRaw(h)},c.toRefs(p)),{getGroupInject:()=>Ve(s,i),refresh(){++p.unique},renderRule(){p.renderRule=[...a.value||[]]},updateValue(R){if(p.destroyed)return;const E=pe(R);p.updateValue!==E&&(p.updateValue=E,s.emit("update:modelValue",R),c.nextTick(()=>{Je(),i?u.value||T():(M(),T())}))}})},created(){const n=c.getCurrentInstance();n.emit("update:api",n.setupState.fapi),n.setupState.fc.init()}})}function pt(){return{props:{},on:{},options:[],children:[],hidden:!1,display:!0,value:void 0}}function we(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=V(pt(),{type:t,title:e,field:r,value:n,props:s||{}}),this.event=this.on}V(Me.prototype,{getRule(){return this._data},setProp(t,e){return U(this._data,t,e),this},modelField(t){return this._data.modelField=t,this},_clone(){const t=new this.constructor;return t._data=ot(this._data),t}});function mt(t){t.forEach(e=>{Me.prototype[e]=function(r){return K(this._data,{[e]:arguments.length<2?r:{[r]:arguments[1]}}),this}})}mt(it());const cr=we("");function fr(t,e,r){let n=cr("",e);return n._data.type=t,n._data.title=r,n}function dr(){return{create:fr,factory:we}}function hr(t,e,r){const n=`fail to ${t} ${r.status}'`,s=new Error(n);return s.status=r.status,s.url=t,s}function gt(t){const e=t.responseText||t.response;if(!e)return e;try{return JSON.parse(e)}catch(r){return e}}function yt(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,l)=>(a[l]=t.query[l]===null||t.query[l]===void 0?"":t.query[l],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(hr(r,t,e),gt(e));t.onSuccess(gt(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 bt(t,e,r){return new Promise((n,s)=>{(e||yt)(x(C({},t),{onSuccess(i){let o=l=>l;const a=H(t.parse);g.Function(a)?o=a:a&&g.String(a)&&(o=l=>N(l,a)),be(o(i,t.targetRule,r)).then(l=>{n(l)})},onError(i){s(i)}}))})}function me(t){return G(t)}function pr(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(l=>{const u=t.fieldCtx[l]||t.nameCtx[l];u&&u.forEach(f=>{U(f.rule,o,a),t.$render.clearCache(f)})})}function n(){const i=t.subForm;return Object.keys(i).reduce((o,a)=>{const l=i[a];return l&&(Array.isArray(l)?o.push(...l):o.push(l)),o},[])}const s={get isScope(){return t.vm.props.subForm===!1},get isPreview(){return t.preview},get config(){return t.options},set config(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]=me(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?me(o.rule.value):t.options.appendValue!==!1&&F(t.appendData,i)?me(t.appendData[i]):void 0},coverValue(i){const o=C({},i||{});t.deferSyncValue(()=>{t.appendData={},s.fields().forEach(a=>{const l=t.fieldCtx[a];if(l){const u=F(i,a);l.forEach(f=>{f.rule.value=u?i[a]:void 0}),delete o[a]}}),V(t.appendData,o)},!0)},setValue(i){let o=i;arguments.length>=2&&(o={[i]:arguments[1]}),t.deferSyncValue(()=>{Object.keys(o).forEach(a=>{const l=t.fieldCtx[a];if(!l)return t.appendData[a]=o[a];l.forEach(u=>{u.rule.value=o[a]})})},!0)},removeField(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&&J(i);if(o)return o.rm(),o.origin},fields:()=>t.fields(),append:(i,o,a)=>{let l=t.sort.length-1,u;const f=t.getCtx(o);if(f)if(a){if(u=f.getPending("children",f.rule.children),!Array.isArray(u))return;l=f.rule.children.length-1}else l=f.root.indexOf(f.origin),u=f.root;else u=t.rules;u.splice(l+1,0,i)},prepend:(i,o,a)=>{let l=0,u;const f=t.getCtx(o);if(f)if(a){if(u=f.getPending("children",f.rule.children),!Array.isArray(u))return}else l=f.root.indexOf(f.origin),u=f.root;else u=t.rules;u.splice(l,0,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(l=>{U(l.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 l=t.fieldCtx[a][0];return o[a]=i?l.origin:l.rule,o},{})},component(i){return Object.keys(t.nameCtx).reduce((o,a)=>{const l=t.nameCtx[a].map(u=>i?u.origin:u.rule);return o[a]=l.length===1?l[0]:l,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)?J(i):t.getCtxs(i);o&&(o=Array.isArray(o)?o:[o],o.forEach(a=>{if(!a.deleted){const l=t.subForm[a.id];l&&(Array.isArray(l)?l.forEach(u=>{u.refresh()}):l&&l.refresh()),t.$render.clearCache(a)}}),t.refresh())},refresh:()=>{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=>{V(a.rule,o)})},updateRules(i){Object.keys(i).forEach(o=>{s.updateRule(o,i[o])})},mergeRule:(i,o)=>{t.getCtxs(i).forEach(a=>{K(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(l=>{const u=t.ctxs[l];u.rule.type===i&&(a=o?u.origin:u.rule)}),a},findTypes(i,o){let a=[];return Object.keys(t.ctxs).forEach(l=>{const u=t.ctxs[l];u.rule.type===i&&a.push(o?u.origin:u.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(l=>l.rule);return a.length===1?a[0]:a}},setEffect(i,o,a){const l=t.getCtx(i);l&&o&&(o[0]==="$"&&(o=o.substr(1)),F(l.rule,"$"+o)&&U(l.rule,"$"+o,a),F(l.rule,"effect")||(l.rule.effect={}),U(l.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=me(a.defaultValue)})}),c.nextTick(()=>{c.nextTick(()=>{c.nextTick(()=>{s.clearValidateState(i)})})}),i==null&&(g.Function(t.options.onReset)&&v(()=>t.options.onReset(s)),t.vm.emit("reset",s))},method(i,o){const a=s.el(i);if(!a||!a[o])throw new Error(Ze("err",`${o} 方法不存在`));return(...l)=>a[o](...l)},exec(i,o,...a){return v(()=>s.method(i,o)(...a))},toJson(i){return pe(s.rule,i)},trigger(i,o,...a){const l=s.el(i);l&&l.$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 l=a.$el!==void 0?a.$el:a;if(!l)return;const u=l.nodeType===1?l:l.firstElementChild;u&&typeof u.scrollIntoView=="function"&&u.