@form-create/vant
Version:
VantUI版本低代码表单|FormCreate 是一个可以通过 JSON 生成具有动态渲染、数据收集、验证和提交功能的低代码表单生成组件。支持6个UI框架,适配移动端,并且支持生成任何 Vue 组件。内置20种常用表单组件和自定义组件,再复杂的表单都可以轻松搞定。
7 lines • 131 kB
JavaScript
/*!
* @form-create/vant v3.2.28
* (c) 2018-2025 xaboy
* Github https://github.com/xaboy/form-create
* Released under the MIT License.
*/
import{defineComponent as e,reactive as t,markRaw as n,nextTick as r,createVNode as i,ref as a,toRef as o,watch as u,computed as l,resolveComponent as c,mergeProps as s,isVNode as f,openBlock as d,createElementBlock as p,createElementVNode as h,getCurrentInstance as v,provide as m,inject as g,toRefs as y,onBeforeMount as b,watchEffect as $,onMounted as _,onBeforeUnmount as x,onUpdated as w,withDirectives as S,resolveDirective as O,createApp as C,h as k}from"vue";import{showNotify as D,Field as V}from"vant";var j=e({name:"fcSubForm",props:{rule:Array,options:{type:Object,default:function(){return t({submitBtn:!1,resetBtn:!1})}},modelValue:{type:Object,default:function(){return{}}},disabled:{type:Boolean,default:!1},syncDisabled:{type:Boolean,default:!0},formCreateInject:Object},data:function(){return{cacheValue:{},subApi:{},form:n(this.formCreateInject.form.$form())}},emits:["fc:subform","update:modelValue","change","itemMounted"],watch:{modelValue:function(e){this.setValue(e)}},methods:{formData:function(e){this.cacheValue=JSON.stringify(e),this.$emit("update:modelValue",e),this.$emit("change",e)},setValue:function(e){var t=JSON.stringify(e);this.cacheValue!==t&&(this.cacheValue=t,this.subApi.coverValue(e||{}))},add$f:function(e){var t=this;this.subApi=e,r((function(){t.$emit("itemMounted",e)}))}},render:function(){var e=this.form;return i(e,{disabled:this.disabled,"onUpdate:modelValue":this.formData,modelValue:this.modelValue,"onEmit-event":this.$emit,"onUpdate:api":this.add$f,rule:this.rule,option:this.options,extendOption:!0},null)}});function F(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function E(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?F(Object(n),!0).forEach((function(t){P(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function R(e){return R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},R(e)}function A(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function N(e){return N=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},N(e)}function I(e,t){return I=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},I(e,t)}function T(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function B(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=N(e);if(t){var i=N(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return T(this,n)}}function M(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,a=[],o=!0,u=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){u=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(u)throw i}}return a}(e,t)||U(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function L(e){return function(e){if(Array.isArray(e))return q(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||U(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function U(e,t){if(e){if("string"==typeof e)return q(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?q(e,t):void 0}}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var H={type:function(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"},Undef:function(e){return null==e},Element:function(e){return"object"===R(e)&&null!==e&&1===e.nodeType&&!H.Object(e)},trueArray:function(e){return Array.isArray(e)&&e.length>0},Function:function(e){var t=this.getType(e);return"Function"===t||"AsyncFunction"===t},getType:function(e){var t=Object.prototype.toString.call(e);return/^\[object (.*)\]$/.exec(t)[1]},empty:function(e){return null==e||(!(!Array.isArray(e)||!Array.isArray(e)||e.length)||"string"==typeof e&&!e)}};function J(e,t){return{}.hasOwnProperty.call(e,t)}["Date","Object","String","Boolean","Array","Number"].forEach((function(e){H[e]=function(t){return H.type(t,e)}}));"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var W={exports:{}},z=W.exports=function(){var e=1e3,t=6e4,n=36e5,r="millisecond",i="second",a="minute",o="hour",u="day",l="week",c="month",s="quarter",f="year",d="date",p="Invalid Date",h=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,v=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,m={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},g=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},y={s:g,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?"+":"-")+g(r,2,"0")+":"+g(i,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,c),a=n-i<0,o=t.clone().add(r+(a?-1:1),c);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:c,y:f,w:l,d:u,D:d,h:o,m:a,s:i,ms:r,Q:s}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},b="en",$={};$[b]=m;var _="$isDayjsObject",x=function(e){return e instanceof C||!(!e||!e[_])},w=function e(t,n,r){var i;if(!t)return b;if("string"==typeof t){var a=t.toLowerCase();$[a]&&(i=a),n&&($[a]=n,i=a);var o=t.split("-");if(!i&&o.length>1)return e(o[0])}else{var u=t.name;$[u]=t,i=u}return!r&&i&&(b=i),i||!r&&b},S=function(e,t){if(x(e))return e.clone();var n="object"==R(t)?t:{};return n.date=e,n.args=arguments,new C(n)},O=y;O.l=w,O.i=x,O.w=function(e,t){return S(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var C=function(){function m(e){this.$L=w(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[_]=!0}var g=m.prototype;return g.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(O.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(h);if(r){var i=r[2]-1||0,a=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},g.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},g.$utils=function(){return O},g.isValid=function(){return!(this.$d.toString()===p)},g.isSame=function(e,t){var n=S(e);return this.startOf(t)<=n&&n<=this.endOf(t)},g.isAfter=function(e,t){return S(e)<this.startOf(t)},g.isBefore=function(e,t){return this.endOf(t)<S(e)},g.$g=function(e,t,n){return O.u(e)?this[t]:this.set(n,e)},g.unix=function(){return Math.floor(this.valueOf()/1e3)},g.valueOf=function(){return this.$d.getTime()},g.startOf=function(e,t){var n=this,r=!!O.u(t)||t,s=O.p(e),p=function(e,t){var i=O.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(u)},h=function(e,t){return O.w(n.toDate()[e].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},v=this.$W,m=this.$M,g=this.$D,y="set"+(this.$u?"UTC":"");switch(s){case f:return r?p(1,0):p(31,11);case c:return r?p(1,m):p(0,m+1);case l:var b=this.$locale().weekStart||0,$=(v<b?v+7:v)-b;return p(r?g-$:g+(6-$),m);case u:case d:return h(y+"Hours",0);case o:return h(y+"Minutes",1);case a:return h(y+"Seconds",2);case i:return h(y+"Milliseconds",3);default:return this.clone()}},g.endOf=function(e){return this.startOf(e,!1)},g.$set=function(e,t){var n,l=O.p(e),s="set"+(this.$u?"UTC":""),p=(n={},n[u]=s+"Date",n[d]=s+"Date",n[c]=s+"Month",n[f]=s+"FullYear",n[o]=s+"Hours",n[a]=s+"Minutes",n[i]=s+"Seconds",n[r]=s+"Milliseconds",n)[l],h=l===u?this.$D+(t-this.$W):t;if(l===c||l===f){var v=this.clone().set(d,1);v.$d[p](h),v.init(),this.$d=v.set(d,Math.min(this.$D,v.daysInMonth())).$d}else p&&this.$d[p](h);return this.init(),this},g.set=function(e,t){return this.clone().$set(e,t)},g.get=function(e){return this[O.p(e)]()},g.add=function(r,s){var d,p=this;r=Number(r);var h=O.p(s),v=function(e){var t=S(p);return O.w(t.date(t.date()+Math.round(e*r)),p)};if(h===c)return this.set(c,this.$M+r);if(h===f)return this.set(f,this.$y+r);if(h===u)return v(1);if(h===l)return v(7);var m=(d={},d[a]=t,d[o]=n,d[i]=e,d)[h]||1,g=this.$d.getTime()+r*m;return O.w(g,this)},g.subtract=function(e,t){return this.add(-1*e,t)},g.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),a=this.$H,o=this.$m,u=this.$M,l=n.weekdays,c=n.months,s=n.meridiem,f=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},d=function(e){return O.s(a%12||12,e,"0")},h=s||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(v,(function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return O.s(t.$y,4,"0");case"M":return u+1;case"MM":return O.s(u+1,2,"0");case"MMM":return f(n.monthsShort,u,c,3);case"MMMM":return f(c,u);case"D":return t.$D;case"DD":return O.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return f(n.weekdaysMin,t.$W,l,2);case"ddd":return f(n.weekdaysShort,t.$W,l,3);case"dddd":return l[t.$W];case"H":return String(a);case"HH":return O.s(a,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return h(a,o,!0);case"A":return h(a,o,!1);case"m":return String(o);case"mm":return O.s(o,2,"0");case"s":return String(t.$s);case"ss":return O.s(t.$s,2,"0");case"SSS":return O.s(t.$ms,3,"0");case"Z":return i}return null}(e)||i.replace(":","")}))},g.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},g.diff=function(r,d,p){var h,v=this,m=O.p(d),g=S(r),y=(g.utcOffset()-this.utcOffset())*t,b=this-g,$=function(){return O.m(v,g)};switch(m){case f:h=$()/12;break;case c:h=$();break;case s:h=$()/3;break;case l:h=(b-y)/6048e5;break;case u:h=(b-y)/864e5;break;case o:h=b/n;break;case a:h=b/t;break;case i:h=b/e;break;default:h=b}return p?h:O.a(h)},g.daysInMonth=function(){return this.endOf(c).$D},g.$locale=function(){return $[this.$L]},g.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=w(e,t,!0);return r&&(n.$L=r),n},g.clone=function(){return O.w(this.$d,this)},g.toDate=function(){return new Date(this.valueOf())},g.toJSON=function(){return this.isValid()?this.toISOString():null},g.toISOString=function(){return this.$d.toISOString()},g.toString=function(){return this.$d.toUTCString()},m}(),k=C.prototype;return S.prototype=k,[["$ms",r],["$s",i],["$m",a],["$H",o],["$W",u],["$M",c],["$y",f],["$D",d]].forEach((function(e){k[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),S.extend=function(e,t){return e.$i||(e(t,C,S),e.$i=!0),S},S.locale=w,S.isDayjs=x,S.unix=function(e){return S(1e3*e)},S.en=$[b],S.Ls=$,S.p={},S}(),G=e({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:function(e,t){var n=a(!1),r=o(e,"modelValue"),i=o(e,"formCreateInject"),c=a(r.value);u((function(){return r.value}),(function(e){c.value=e}));var s=function(e){return z(e).format("YYYY-MM-DD")},f=function(e){return z(e).toDate()},d=l((function(){var e=r.value;return Array.isArray(e)?e.map(f):e?f(e):null})),p=l((function(){return{minDate:e.minDate?z(e.minDate).toDate():void 0,maxDate:e.maxDate?z(e.maxDate).toDate():void 0}})),h=function(e){Array.isArray(e)?c.value=e.map(s):c.value=e?s(e):e},v=function(){t.emit("update:modelValue",c.value),t.emit("change",c.value)},m={range:function(){return c.value.length?c.value.join(" - "):""},multiple:function(){return c.value.length?i.value.t("selectedData",{length:c.value.length})||"选择了 ".concat(c.value.length," 个日期"):""}};return{show:n,inputValue:c,defaultDate:d,dateRange:p,open:function(){e.disabled||(n.value=!0)},confirm:function(e){h(e),n.value=!1,v()},getStrValue:function(){return c.value?J(m,e.type)?m[e.type]():c.value||"":""},clear:function(e){e.stopPropagation();var t=Array.isArray(c.value)?[]:"";h(t),v()}}},render:function(){var e=this;return i("div",{class:"_fc-calendar"},[i(c("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":function(){return e.$props.clearable&&!H.empty(e.inputValue)?i("i",{class:"van-badge__wrapper van-icon van-icon-clear van-field__clear",onClick:e.clear},null):void 0}}),i(c("van-calendar"),s(E(E({},this.$attrs),this.dateRange),{show:this.show,"onUpdate:show":function(t){return e.show=t},type:this.type,onConfirm:this.confirm,defaultDate:this.defaultDate}),null)])},mounted:function(){this.$emit("fc.el",this.$refs.el)}}),Y=e({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:function(e,t){var n=a(!1),r=o(e,"modelValue"),i=o(e,"options"),l=o(e,"fieldNames",{}),c=function e(t,n,r){for(var i=0;i<t.length;i++){if(t[i][l.value.value||"value"]===n)return[].concat(L(r),[t[i]]);if(t[i][l.value.children||"children"]){var a=e(t[i][l.value.children||"children"],n,[].concat(L(r),[t[i]]));if(a)return a}}},s=function(e){if(null==e||""===e)return"";var t=c(i.value,e,[]);return t?t.map((function(e){return e[l.value.text||"text"]})).join(" / "):e},f=a(s(r.value));u((function(){return r.value}),(function(e){f.value=s(e)})),u((function(){return i.value}),(function(){null!=r.value&&""!==r.value&&(f.value=s(r.value))}),{deep:!0});var d=function(e){t.emit("update:modelValue",e),t.emit("change",e)};return{show:n,inputValue:f,options:i,open:function(){e.disabled||(n.value=!0)},confirm:function(e){var t=e.selectedOptions,r=e.value;f.value=t.map((function(e){return e[l.value.text||"text"]})).join(" / "),n.value=!1,d(r)},clear:function(e){e.stopPropagation(),f.value="",d("")}}},render:function(){var e=this;return i("div",{class:"_fc-cascader"},[i(c("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":function(){return e.$props.clearable&&e.inputValue?i("i",{class:"van-badge__wrapper van-icon van-icon-clear van-field__clear",onClick:e.clear},null):void 0}}),i(c("van-popup"),{show:this.show,"onUpdate:show":function(t){return e.show=t},round:!0,position:"bottom"},{default:function(){return[i(c("van-cascader"),s(e.$attrs,{modelValue:e.modelValue,fieldNames:e.fieldNames,options:e.options,onClose:function(){return e.show=!1},onFinish:e.confirm}),null)]}})])},mounted:function(){this.$emit("fc.el",this.$refs.el)}});var K=e({name:"fcCheckbox",inheritAttrs:!1,props:{modelValue:Array,options:Array},emits:["update:modelValue","change"],setup:function(e,t){var n=o(e,"modelValue",[]);return{options:o(e,"options"),modelValue:n,onInput:function(e){t.emit("update:modelValue",e),t.emit("change",e)}}},render:function(){var e,t;return i(c("van-checkbox-group"),s({direction:"horizontal"},this.$attrs,{modelValue:Array.isArray(this.modelValue)?this.modelValue:[],"onUpdate:modelValue":this.onInput}),"function"==typeof(t=e=(this.options||[]).map((function(e){var t=E({},e),n=e.text,r=e.value;return delete t.text,delete t.value,i(c("van-checkbox"),s({name:r,shape:"square"},t),{default:function(){return[n||e.label||r]}})})))||"[object Object]"===Object.prototype.toString.call(t)&&!f(t)?e:{default:function(){return[e]}})}}),Z=e({name:"fcSelect",inheritAttrs:!1,props:{disabled:Boolean,placeholder:String,columnsFieldNames:Object,modelValue:[String,Number],options:Array},emits:["update:modelValue","fc.el","change"],setup:function(e,t){var n=a(!1),r=o(e,"modelValue"),i=o(e,"options"),u=o(e,"columnsFieldNames",{}),c=l((function(){if(null==r.value||""===r.value)return"";for(var e=0;e<(i.value||[]).length;e++)if(i.value[e][u.value.value||"value"]===r.value)return i.value[e][u.value.text||"text"];return r.value}));return{show:n,inputValue:c,options:i,open:function(){e.disabled||(n.value=!0)},confirm:function(e){var r,i=e.selectedValues;r=i[0],t.emit("update:modelValue",r),t.emit("change",r),n.value=!1}}},render:function(){var e=this;return i("div",{class:"_fc-select"},[i(c("van-field"),{ref:"el",placeholder:this.placeholder,readonly:!0,disabled:this.$props.disabled,onClick:this.open,"model-value":this.inputValue,isLink:!0},null),i(c("van-popup"),{show:this.show,"onUpdate:show":function(t){return e.show=t},round:!0,position:"bottom"},{default:function(){return[i(c("van-picker"),s(e.$attrs,{modelValue:[e.modelValue],columnsFieldNames:e.columnsFieldNames,columns:e.options,onCancel:function(){return e.show=!1},onConfirm:e.confirm}),null)]}})])},mounted:function(){this.$emit("fc.el",this.$refs.el)}});function X(e){return Array.isArray(e)?e:[null,void 0,""].indexOf(e)>-1?[]:[e]}function Q(e,t){return"object"===R(e)?e:{url:e,is_string:!0,name:te(e),uid:t}}function ee(e){return E(E({},e),{},{file:e,value:e})}function te(e){return(""+e).split("/").pop()}var ne=e({name:"fcUploader",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:function(e,t){var n=o(e,"afterRead"),r=o(e,"modelValue",[]),i=a(X(r.value).map(Q).map(ee));u((function(){return r.value}),(function(e){i.value=X(e).map(Q).map(ee)}));var l=function(){var n=i.value.map((function(e){return e.is_string?e.url:e.value||e.url})).filter((function(e){return void 0!==e}));t.emit("update:modelValue",1===e.maxCount?n[0]||"":n)};return{fileList:i,modelValue:r,onDelete:function(e){l(),t.emit("delete",e)},uploadFile:function(t){var r=this;if(t.status="uploading",n.value)return n.value(t);var i=e.data||{};i[e.uploadName||"file"]=t.file,e.formCreateInject.api.fetch({action:e.action,dataType:"formData",source:"upload",headers:e.headers||{},method:e.method||"post",data:i}).then((function(n){t.status="success",e.onSuccess&&e.onSuccess(n,t),l()})).catch((function(n){t.status="failed",t.message=r.formCreateInject.t("uploadFail")||"上传失败",e.onError&&e.onError(n,t)}))}}},render:function(){var e=this;return i(c("van-uploader"),s(this.$attrs,{"model-value":this.fileList,maxCount:this.maxCount,"onUpdate:model-value":function(t){return e.fileList=t},afterRead:this.uploadFile,onDelete:this.onDelete}),this.$slots)}});var re=e({name:"fcRadio",inheritAttrs:!1,props:{modelValue:[String,Number],options:Array},emits:["update:modelValue","change"],setup:function(e,t){var n=o(e,"modelValue",[]);return{options:o(e,"options"),modelValue:n,onInput:function(e){t.emit("update:modelValue",e),t.emit("change",e)}}},render:function(){var e,t;return i(c("van-radio-group"),s({direction:"horizontal"},this.$attrs,{modelValue:this.modelValue,"onUpdate:modelValue":this.onInput}),"function"==typeof(t=e=(this.options||[]).map((function(e){var t=E({},e),n=e.text,r=e.value;return delete t.text,delete t.value,i(c("van-radio"),s({name:r},t),{default:function(){return[n||e.label||r]}})})))||"[object Object]"===Object.prototype.toString.call(t)&&!f(t)?e:{default:function(){return[e]}})}}),ie=e({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:function(e,t){var n=a(!1),r=o(e,"modelValue"),i=l((function(){return null==r.value||""===r.value?[]:r.value.split("-")})),u=l((function(){return{minDate:e.minDate?z(e.minDate).toDate():void 0,maxDate:e.maxDate?z(e.maxDate).toDate():void 0}})),c=function(e){t.emit("update:modelValue",e),t.emit("change",e)};return{show:n,formValue:i,dateRange:u,open:function(){e.disabled||(n.value=!0)},confirm:function(e){var t=e.selectedValues;c(t.join("-")),n.value=!1},clear:function(e){e.stopPropagation(),c("")}}},render:function(){var e=this;return i("div",{class:"_fc-date-picker"},[i(c("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":function(){return e.$props.clearable&&e.modelValue?i("i",{class:"van-badge__wrapper van-icon van-icon-clear van-field__clear",onClick:e.clear},null):void 0}}),i(c("van-popup"),{show:this.show,"onUpdate:show":function(t){return e.show=t},round:!0,position:"bottom"},{default:function(){return[i(c("van-date-picker"),s({columnsType:["year","month","day"]},E(E({},e.$attrs),e.dateRange),{modelValue:e.formValue,onConfirm:e.confirm,onCancel:function(){return e.show=!1}}),null)]}})])},mounted:function(){this.$emit("fc.el",this.$refs.el)}}),ae=e({name:"fcTimePicker",inheritAttrs:!1,props:{disabled:Boolean,clearable:Boolean,placeholder:String,modelValue:[String,Number]},emits:["update:modelValue","fc.el","change"],setup:function(e,t){var n=a(!1),r=o(e,"modelValue"),i=l((function(){return null==r.value||""===r.value?[]:r.value.split(":")})),u=function(e){t.emit("update:modelValue",e),t.emit("change",e)};return{show:n,formValue:i,open:function(){e.disabled||(n.value=!0)},confirm:function(e){var t=e.selectedValues;u(t.join(":")),n.value=!1},clear:function(e){e.stopPropagation(),u("")}}},render:function(){var e=this;return i("div",{class:"_fc-time-picker"},[i(c("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":function(){return e.$props.clearable&&e.modelValue?i("i",{class:"van-badge__wrapper van-icon van-icon-clear van-field__clear",onClick:e.clear},null):void 0}}),i(c("van-popup"),{show:this.show,"onUpdate:show":function(t){return e.show=t},round:!0,position:"bottom"},{default:function(){return[i(c("van-time-picker"),s({columnsType:["hour","minute"]},e.$attrs,{modelValue:e.formValue,onConfirm:e.confirm,onCancel:function(){return e.show=!1}}),null)]}})])},mounted:function(){this.$emit("fc.el",this.$refs.el)}});function oe(e,t,n){e[t]=n}function ue(e,t){delete e[t]}function le(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=!1;for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var a=t[i];if((r=Array.isArray(a))||H.Object(a)){var o=void 0===e[i];if(r)r=!1,o&&oe(e,i,[]);else if(a._clone&&void 0!==n){if(!n){oe(e,i,a._clone());continue}a=a.getRule(),o&&oe(e,i,{})}else o&&oe(e,i,{});e[i]=le(e[i],a,n)}else oe(e,i,a),H.Undef(a)||(H.Undef(a.__json)||(e[i].__json=a.__json),H.Undef(a.__origin)||(e[i].__origin=a.__origin))}return void 0!==n&&Array.isArray(e)?e.filter((function(e){return!e||!e.__ctrl})):e}function ce(e){return le({},{value:e}).value}var se=Object.assign||function(e){for(var t,n=1;n<arguments.length;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&oe(e,r,t[r]);return e};function fe(){return se.apply(this,arguments)}function de(e){return"object"!==R(e)||null===e?e:e instanceof Array?L(e):E({},e)}var pe=e({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:function(){return[]}},defaultValue:Object,sortBtn:{type:Boolean,default:!1},disabled:{type:Boolean,default:void 0},onBeforeRemove:{type:Function,default:function(){}},onBeforeAdd:{type:Function,default:function(){}},formCreateInject:Object,parse:Function},data:function(){return{len:0,cacheRule:{},cacheValue:{},sort:[],form:n(this.formCreateInject.form.$form())}},emits:["update:modelValue","change","itemMounted","remove","add"],watch:{rule:{handler:function(e,t){var n=this;Object.keys(this.cacheRule).forEach((function(r){var i=n.cacheRule[r];if(i.$f){var a=i.$f.formData();if(e===t)i.$f.deferSyncValue((function(){le(i.rule,e),i.$f.setValue(a)}),!0);else{var o=i.$f.formData();i.$f.once("reloading",(function(){i.$f.setValue(o)})),i.rule=ce(e)}}}))},deep:!0},expand:function(e){var t=e-this.modelValue.length;t>0&&this.expandRule(t)},modelValue:{handler:function(e){var t=this;e=e||[];var n=this.sort,r=n.length,i=r-e.length;if(i<0){for(var a=i;a<0;a++)this.addRule(e.length+a,!0);for(var o=0;o<r;o++)this.setValue(n[o],e[o])}else{if(i>0)for(var u=0;u<i;u++)this.removeRule(n[r-u-1]);e.forEach((function(r,i){t.setValue(n[i],e[i])}))}},deep:!0}},methods:{_value:function(e){return e&&J(e,this.field)?e[this.field]:e},cache:function(e,t){this.cacheValue[e]=JSON.stringify(t)},input:function(e){this.$emit("update:modelValue",e),this.$emit("change",e)},formData:function(e,t){var n=this,r=this.cacheRule,i=this.sort;if(i.filter((function(e){return r[e]&&r[e].$f})).length===i.length){var a=i.map((function(r){var i=e===r?t:E({},n.cacheRule[r].$f.form),a=n.field?i[n.field]||null:i;return n.cache(r,a),a}));this.input(a)}},setValue:function(e,t){var n=this.field;n&&(t=P({},n,this._value(t))),this.cacheValue[e]!==JSON.stringify(n?t[n]:t)&&(this.cacheRule[e].$f&&this.cacheRule[e].$f.coverValue(t),this.cache(e,t))},addRule:function(e,t){var n=this,i=this.formCreateInject.form.copyRules(this.rule||[]),a=this.options?E({},this.options):{submitBtn:!1,resetBtn:!1};if(this.defaultValue){a.formData||(a.formData={});var o=ce(this.defaultValue);fe(a.formData,this.field?P({},this.field,o):o)}this.parse&&this.parse({rule:i,options:a,index:this.sort.length}),this.cacheRule[++this.len]={rule:i,options:a},this.sort=Object.keys(this.cacheRule),t&&r((function(){return n.$emit("add",i,Object.keys(n.cacheRule).length-1)}))},add$f:function(e,t,n){var i=this;this.cacheRule[t].$f=n,r((function(){i.$emit("itemMounted",n,Object.keys(i.cacheRule).indexOf(t))}))},removeRule:function(e,t){var n=this,i=Object.keys(this.cacheRule).indexOf(e);delete this.cacheRule[e],delete this.cacheValue[e],this.sort=Object.keys(this.cacheRule),t&&r((function(){return n.$emit("remove",i)}))},add:function(e){if(!this.disabled&&!1!==this.onBeforeAdd(this.modelValue)){var t=L(this.modelValue);t.push(this.defaultValue?ce(this.defaultValue):this.field?null:{}),this.input(t)}},del:function(e,t){if(!this.disabled&&!1!==this.onBeforeRemove(this.modelValue,e)){this.removeRule(t,!0);var n=L(this.modelValue);n.splice(e,1),this.input(n)}},addIcon:function(e){return i("div",{class:"_fc-m-group-btn _fc-m-group-plus-minus",onClick:this.add},null)},delIcon:function(e,t){var n=this;return i("div",{class:"_fc-m-group-btn _fc-m-group-plus-minus _fc-m-group-minus",onClick:function(){return n.del(e,t)}},null)},sortUpIcon:function(e){var t=this;return i("div",{class:"_fc-m-group-btn _fc-m-group-arrow _fc-m-group-up",onClick:function(){return t.changeSort(e,-1)}},null)},sortDownIcon:function(e){var t=this;return i("div",{class:"_fc-m-group-btn _fc-m-group-arrow _fc-m-group-down",onClick:function(){return t.changeSort(e,1)}},null)},changeSort:function(e,t){var n=this,r=this.sort[e];this.sort[e]=this.sort[e+t],this.sort[e+t]=r,this.formCreateInject.subForm(this.sort.map((function(e){return n.cacheRule[e].$f}))),this.formData(0)},makeIcon:function(e,t,n){var r=this;if(this.$slots.button)return this.$slots.button({total:e,index:t,vm:this,key:n,del:function(){return r.del(t,n)},add:this.add});var i=[];return(!this.max||e<this.max)&&e===t+1&&i.push(this.addIcon(n)),e>this.min&&i.push(this.delIcon(t,n)),this.sortBtn&&t&&i.push(this.sortUpIcon(t)),this.sortBtn&&t!==e-1&&i.push(this.sortDownIcon(t)),i},emitEvent:function(e,t,n,r){this.$emit.apply(this,[e].concat(L(t),[this.cacheRule[r].$f,n]))},expandRule:function(e){for(var t=0;t<e;t++)this.addRule(t)}},created:function(){for(var e=(this.expand||0)-this.modelValue.length,t=0;t<this.modelValue.length;t++)this.addRule(t);e>0&&this.expandRule(e)},render:function(){var e=this,t=this.sort,n=this.button,r=this.form,a=this.disabled,o=0===t.length?this.$slots.default?this.$slots.default({vm:this,add:this.add}):i("div",{key:"a_def",class:"_fc-m-group-plus-minus _fc-m-group-add fc-clock",onClick:this.add},null):t.map((function(o,u){var l=e.cacheRule[o],c=l.rule,f=l.options,d=n&&!a?e.makeIcon(t.length,u,o):[];return i("div",{class:"_fc-m-group-container",key:o},[i(r,s({key:o},{disabled:a,"onUpdate:modelValue":function(t){return e.formData(o,t)},"onEmit-event":function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return e.emitEvent(t,r,u,o)},"onUpdate:api":function(t){return e.add$f(u,o,t)},inFor:!0,modelValue:e.field?P({},e.field,e._value(e.modelValue[u])):e.modelValue[u],rule:c,option:f,extendOption:!0}),null),i("div",{class:"_fc-m-group-idx"},[u+1]),d.length?i("div",{class:"_fc-m-group-handle fc-clock"},[d]):null])}));return i("div",{key:"con",class:"_fc-m-group "+(a?"_fc-m-group-disabled":"")},[o])}}),he={name:"IconWarning"},ve={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},me=[h("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)];he.render=function(e,t,n,r,i,a){return d(),p("svg",ve,me)};var ge=[j,he,G,Y,K,re,Z,ie,ae,pe,ne];function ye(e,t){var n=null;return function(){for(var r=this,i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];null!==n&&clearTimeout(n),n=setTimeout((function(){return e.call.apply(e,[r].concat(a))}),t)}}function be(e){var t=e.replace(/([A-Z])/g,"-$1").toLocaleLowerCase();return 0===t.indexOf("-")&&(t=t.substr(1)),t}function $e(e){return e.replace(e[0],e[0].toLocaleUpperCase())}var _e=["props"],xe=["class","style","directives"],we=["on","hook"],Se=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=[].concat(_e,L(r.normal||[])),a=[].concat(xe,L(r.array||[])),o=[].concat(we,L(r.functional||[])),u=r.props||[];return t.reduce((function(t,n){for(var r in n)if(t[r])if(u.indexOf(r)>-1)t[r]=e([n[r]],t[r]);else if(i.indexOf(r)>-1)t[r]=E(E({},t[r]),n[r]);else if(a.indexOf(r)>-1){var l=t[r]instanceof Array?t[r]:[t[r]],c=n[r]instanceof Array?n[r]:[n[r]];t[r]=[].concat(L(l),L(c))}else if(o.indexOf(r)>-1)for(var s in n[r])if(t[r][s]){var f=t[r][s]instanceof Array?t[r][s]:[t[r][s]],d=n[r][s]instanceof Array?n[r][s]:[n[r][s]];t[r][s]=[].concat(L(f),L(d))}else t[r][s]=n[r][s];else if("hook"===r)for(var p in n[r])t[r][p]?t[r][p]=Oe(t[r][p],n[r][p]):t[r][p]=n[r][p];else t[r]=n[r];else i.indexOf(r)>-1||o.indexOf(r)>-1||u.indexOf(r)>-1?t[r]=E({},n[r]):a.indexOf(r)>-1?t[r]=n[r]instanceof Array?L(n[r]):"object"===R(n[r])?E({},n[r]):n[r]:t[r]=n[r];return t}),n)},Oe=function(e,t){return function(){e&&e.apply(this,arguments),t&&t.apply(this,arguments)}},Ce=["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"],ke=["validate","children","control"],De=["effect","deep","renderSlots"];function Ve(){return[].concat(Ce,L(_e),L(xe),L(we),ke,De)}function je(e,t,n){return"[form-create ".concat(e,"]: ").concat(t)+(n?"\n\nrule: "+JSON.stringify(n.getRule?n.getRule():n):"")}function Fe(e,t){console.error(je("err",e,t))}function Ee(e){return Re(e.replace(/(-[a-z])/g,(function(e){return e.replace("-","").toLocaleUpperCase()})))}function Re(e){return e.replace(e[0],e[0].toLowerCase())}var Ae="[[FORM-CREATE-PREFIX-",Pe="-FORM-CREATE-SUFFIX]]";function Ne(e,t){return JSON.stringify(le(Array.isArray(e)?[]:{},e,!0),(function(e,t){if(!t||!0!==t._isVue){if("function"!=typeof t)return t;if(t.__json)return t.__json;if(t.__origin&&(t=t.__origin),!t.__emit)return Ae+t+Pe}}),t)}function Ie(e){return new Function("return "+e)()}function Te(e,t){if(e&&H.String(e)&&e.length>4){var n=e.trim(),r=!1;try{if(n.indexOf(Pe)>0&&0===n.indexOf(Ae))n=n.replace(Pe,"").replace(Ae,""),r=!0;else if(0===n.indexOf("$FN:"))n=n.substring(4),r=!0;else if(0===n.indexOf("$EXEC:"))n=n.substring(6),r=!0;else{if(0===n.indexOf("$GLOBAL:")){var i=n.substring(8);return n=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t[0].api.getGlobalEvent(i);if(r)return r.call.apply(r,[this].concat(t))},n.__json=e,n.__inject=!0,n}if(0===n.indexOf("$FNX:"))return(n=Ie("function($inject){\n"+n.substring(5)+"\n}")).__json=e,n.__inject=!0,n;(t||0!==n.indexOf("function ")||"function "===n)&&(t||0!==n.indexOf("function(")||"function("===n)||(r=!0)}if(!r)return e;var a;try{a=Ie(n)}catch(e){a=Ie("function "+n)}return a.__json=e,a}catch(e){return void Fe("解析失败:".concat(n,"\n\nerr: ").concat(e))}}return e}function Be(e,t){return JSON.parse(e,(function(e,n){return H.Undef(n)||!n.indexOf?n:Te(n,t)}))}function Me(e,t){return{value:e,enumerable:!1,configurable:!1,writable:!!t}}function Le(e,t){return Ue([e],t||!1)[0]}function Ue(e,t){return le([],L(e),t||!1)}function qe(e,t){return Se(Array.isArray(t)?t:[t],e,{array:ke,normal:De}),e}function He(e){var t=H.Function(e.getRule)?e.getRule():e;return t.type||(t.type="input"),t}function Je(e,t){Object.defineProperties(e,Object.keys(t).reduce((function(e,n){return e[n]={get:function(){return t[n]()}},e}),{}))}function We(e){return e.__fc__||(e.__origin__?e.__origin__.__fc__:null)}function ze(e,t){try{t=e()}catch(e){!function(e){Fe(e.toString()),console.error(e)}(e)}return t}function Ge(){var e={},t=function(e){return e||"default"};return{setSlot:function(n,r){n=t(n),!r||Array.isArray(r)&&r.length||(e[n]||(e[n]=[]),e[n].push(r))},getSlot:function(n,r){n=t(n);var i=[];return(e[n]||[]).forEach((function(e){if(Array.isArray(e))i.push.apply(i,L(e));else if(H.Function(e)){var t=e.apply(void 0,L(r||[]));Array.isArray(t)?i.push.apply(i,L(t)):i.push(t)}else H.Undef(e)||i.push(e)})),i},getSlots:function(){var t=this,n={};return Object.keys(e).forEach((function(e){n[e]=function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.getSlot(e,r)}})),n},slotLen:function(n){return n=t(n),e[n]?e[n].length:0},mergeBag:function(e){var t=this;if(!e)return this;var n=H.Function(e.getSlots)?e.getSlots():e;return Array.isArray(e)||f(e)?this.setSlot(void 0,(function(){return e})):Object.keys(n).forEach((function(e){t.setSlot(e,n[e])})),this}}}function Ye(e){var t=E({},e.props||{});return Object.keys(e.on||{}).forEach((function(n){n.indexOf("-")>0&&(n=Ee(n));var r="on".concat($e(n));Array.isArray(t[r])?t[r]=[].concat(L(t[r]),[e.on[n]]):t[r]?t[r]=[t[r],e.on[n]]:t[r]=e.on[n]})),t.key=e.key,t.ref=e.ref,t.class=e.class,t.id=e.id,t.style=e.style,t.slot&&delete t.slot,t}function Ke(e,t){return Object.setPrototypeOf(e,t),e}var Ze=function(e,t){return"string"==typeof e?String(t):"number"==typeof e?Number(t):t},Xe={"==":function(e,t){return JSON.stringify(e)===JSON.stringify(Ze(e,t))},"!=":function(e,t){return!Xe["=="](e,t)},">":function(e,t){return e>t},">=":function(e,t){return e>=t},"<":function(e,t){return e<t},"<=":function(e,t){return e<=t},on:function(e,t){return e&&e.indexOf&&e.indexOf(Ze(e[0],t))>-1},notOn:function(e,t){return!Xe.on(e,t)},in:function(e,t){return t&&t.indexOf&&t.indexOf(e)>-1},notIn:function(e,t){return!Xe.in(e,t)},between:function(e,t){return e>t[0]&&e<t[1]},notBetween:function(e,t){return e<t[0]||e>t[1]},empty:function(e){return H.empty(e)},notEmpty:function(e){return!H.empty(e)},pattern:function(e,t){return new RegExp(t,"g").test(e)}};function Qe(e,t){return(Array.isArray(t)?t:(t||"").split(".")).forEach((function(t){null!=e&&(e=e[t])})),e}function et(e){var t=e.split("."),n=[],r="";return t.forEach((function(e,t){0===t?r=e:r+="."+e,n.push(r)})),n.join(" && ")}function tt(e){for(var t=[],n="",r=0,i=0;i<e.length;i++){var a=e[i];"["===a?(0===r&&n&&(t.push({type:"key",value:n}),n=""),r++,n+=a):"]"===a?(n+=a,0===--r&&(t.push({type:"bracket",value:tt(n.slice(1,-1))}),n="")):"."===a&&0===r?n&&(t.push({type:"key",value:n}),n=""):n+=a}return n&&t.push({type:"key",value:n}),t.map((function(e){return"key"===e.type?{key:e.value}:{children:e.value}}))}var nt=function(e,t){if(e&&e!==t)return e.props.formCreateInject?e.props.formCreateInject:e.parent?nt(e.parent,t):void 0};function rt(i,a,o){return e({name:"FormCreate"+(i.isMobile?"Mobile":""),components:a,directives:o,props:{rule:{type:Array,required:!0,default:function(){return[]}},option:{type:Object,default:function(){return{}}},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","submit","reset","change","emit-event","control","remove-rule","remove-field","sync","reload","repeat-field","update","validate-field-fail","validate-fail","created"],render:function(){return this.fc.render()},setup:function(e){var a=v();m("parentFC",a);var o=g("parentFC",null),l=o;if(o)for(;l.setupState.parent;)l=l.setupState.parent;else l=a;var c=y(e),s=c.rule,f=c.modelValue,d=c.subForm,p=c.inFor,h=t({ctxInject:{},destroyed:!1,isShow:!0,unique:1,renderRule:L(s.value||[]),updateValue:JSON.stringify(f.value||{})}),S=new i(a),O=S.api(),C=p.value,k=null;b((function(){$((function(){var t="",n=e.option&&e.option.globalClass||{};Object.keys(n).forEach((function(e){var r="";n[e].style&&Object.keys(n[e].style).forEach((function(t){r+=be(t)+":"+n[e].style[t]+";"})),n[e].content&&(r+=n[e].content+";"),r&&(t+=".".concat(e,"{").concat(r,"}"))})),e.option&&e.option.style&&(t+=e.option.style),k||((k=document.createElement("style")).type="text/css",document.head.appendChild(k)),k.innerHTML=t||""}))}));var D=ye((function(){S.bus.$emit("$loadData.$topForm")}),100),V=ye((function(){S.bus.$emit("$loadData.$scopeForm")}),100),j=ye((function(){S.bus.$emit("$loadData.$form")}),100),F=function(e){S.bus.$emit("change-$form."+e)};return _((function(){o&&(O.top.bus.$on("$loadData.$form",D),O.top.bus.$on("change",F)),O!==O.scope&&O.scope.bus.$on("$loadData.$scopeForm",V),S.mounted()})),x((function(){o&&(O.top.bus.$off("$loadData.$form",D),O.top.bus.$off("change",F)),O!==O.scope&&O.scope.bus.$off("$loadData.$scopeForm",V),function(){var e=nt(a,o);if(e)if(C){var t=X(e.getSubForm()),n=t.indexOf(O);n>-1&&t.splice(n,1)}else e.subForm()}(),h.destroyed=!0,S.unmount(),k&&(k.parentNode||k.parentElement)&&document.head.removeChild(k)})),w((function(){S.updated()})),function(){if(o){var e,t=nt(a,o);if(t)C?(e=X(t.getSubForm())).push(O):e=O,t.subForm(e)}}(),u((function(){return e.option}),(function(){S.initOptions(),O.refresh()}),{deep:!0,flush:"sync"}),u((function(){return L(s.value)}),(function(e){S.$handle.isBreakWatch()||e.length===h.renderRule.length&&e.every((function(e){return h.renderRule.indexOf(e)>-1}))||(S.$handle.updateAppendData(),S.$handle.reloadRule(s.value),a.setupState.renderRule())})),u((function(){return[e.disabled,e.preview]}),(function(){O.refresh()})),u(f,(function(e){Ne(e||{})!==h.updateValue&&(O.config.forceCoverValue?O.coverValue(e||{}):O.setValue(e||{}))}),{deep:!0,flush:"post"}),u((function(){return e.index}),(function(){O.coverValue({}),S.$handle.updateAppendData(),r((function(){r((function(){O.clearValidateState()}))}))}),{flush:"sync"}),E(E({fc:n(S),parent:o?n(o):o,top:n(l),fapi:n(O)},y(h)),{},{getGroupInject:function(){return nt(a,o)},refresh:function(){++h.unique},renderRule:function(){h.renderRule=L(s.value||[])},updateValue:function(e){if(!h.destroyed){var t=Ne(e);h.updateValue!==t&&(h.updateValue=t,a.emit("update:modelValue",e),r((function(){j(),o?d.value||V():(D(),V())})))}}})},created:function(){var e=v();e.emit("update:api",e.setupState.fapi),e.setupState.fc.init()}})}function it(e,t){return function(n,r,i){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=new at(e,n,r,i,a);return t&&(H.Function(t)?t(o):o.props(t)),o}}function at(e,t,n,r,i){this._data=fe({props:{},on:{},options:[],children:[],hidden:!1,display:!0,value:void 0},{type:e,title:t,field:n,value:r,props:i||{}}),this.event=this.on}function ot(e){e.forEach((function(e){at.prototype[e]=function(t){return qe(this._data,P({},e,arguments.length<2?t:P({},t,arguments[1]))),this}}))}fe(at.prototype,{getRule:function(){return this._data},setProp:function(e,t){return oe(this._data,e,t),this},modelField:function(e){return this._data.modelField=e,this},_clone:function(){var e=new this.constructor;return e._data=Le(this._data),e}}),ot(Ve());var ut=it("");function lt(e,t,n){var r=ut("",t);return r._data.type=e,r._data.title=n,r}function ct(){return{create:lt,factory:it}}function st(e){var t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch(e){return t}}function ft(e){if("undefined"!=typeof XMLHttpRequest){var t,n=new XMLHttpRequest,r=e.action||"";if(n.upload&&e.onProgress&&n.upload.addEventListener("progress",(function(t){t.percent=t.total>0?t.loaded/t.total*100:0,e.onProgress(t)})),e.query){var i=new URLSearchParams(e.query).toString();i&&(r.includes("?")?r+="&".concat(i):r+="?".concat(i))}n.onerror=function(t){e.onError(t)},n.onload=function(){if(n.status<200||n.status>=300)return e.onError(function(e,t,n){var r="fail to ".concat(e," ").concat(n.status,"'"),i=new Error(r);return i.status=n.status,i.url=e,i}(r,0,n),st(n));e.onSuccess(st(n))},n.open(e.method||"get",r,!0),(e.data||e.file)&&(e.file||"json"!==(e.dataType||"").toLowerCase()?(t=new FormData,Object.keys(e.data||{}).map((function(n){t.append(n,e.data[n])}))):(t=JSON.stringify(e.data||{}),n.setRequestHeader("content-type","application/json"))),e.file&&t.append(e.filename,e.file,e.file.name),e.withCredentials&&"withCredentials"in n&&(n.withCredentials=!0);var a=e.headers||{};Object.keys(a).forEach((function(e){null!=a[e]&&n.setRequestHeader(e,a[e])})),n.send(t)}}function dt(e,t,n){return new Promise((function(r,i){(t||ft)(E(E({},e),{},{onSuccess:function(t){var i=function(e){return e},a=Te(e.parse);H.Function(a)?i=a:a&&H.String(a)&&(i=function(e){return Qe(e,a)}),r(i(t,void 0,n))},onError:function(e){i(e)}}))}))}function pt(e){return ce(e)}var ht=0;function vt(){var e=370+ ++ht;return"F"+Math.random().toString(36).substr(3,3)+Number("".concat(Date.now())).toString(36)+e.toString(36)+"c"}function mt(e,t,n){var r,i=e;return(t||"").split(".").forEach((function(e){r&&(i[r]&&"object"==R(i[r])||(i[r]={}),i=i[r]),r=e})),i[r]=n,i}var gt=1;function yt(e){fe(this,{$handle:e,fc:e.fc,vm:e.vm,$manager:e.$manager,vNode:new e.fc.CreateNode(e.vm),force:!1,tmpInput:null,id:gt++}),Je(this,{options:function(){return e.options},sort:function(){return e.sort}}),this.initCache(),this.initRender()}!function(e){fe(e.prototype,{initCache:function(){this.clearCacheAll()},clearCache:function(e){e.rule.cache||(this.cache[e.id]?((!0===this.cache[e.id].use||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):e.parent&&this.clearCache(e.parent))},clearCacheAll:function(){this.cache={}},setCache:function(e,t,n){this.cache[e.id]={vnode:t,use:!1,parent:n,slot:e.rule.slot}},getCache:function(e){var t=this.cache[e.id];if(t)return t.use=!0,t.vnode}})}(yt),function(e){fe(e.prototype,{initRender:function(){this.cacheConfig={}},getTypeSlot:function(e){return function t(n){if(n){var r=void 0;return e.rule.field&&(r=n.slots["field-"+be(e.rule.field)]||n.slots["field-"+e.rule.field]),r||(r=n.slots["type-"+be(e.type)]||n.slots["type-"+e.type]),r||t(n.setupState.parent)}}(this.vm)},render:function(){var e=this;if(this.vm.setupState.isShow){this.$manager.beforeRender();var t=Ge();return this.sort.forEach((function(n){e.renderSlot(t,e.$handle.ctxs[n])})),this.$manager.render(t)}},renderSlot:function(e,t,n){if(this.isFragment(t)){t.initProp(),this.mergeGlobal(t),t.initNone();var r=this.renderChildren(t.loadChildrenPending(),t),i=r.default;i&&e.setSlot(t.rule.slot,(function(){return i()})),delete r.default,e.mergeBag(r)}else e.setSlot(t.rule.slot,this.renderCtx(t,n))},mergeGlobal:function(e){var t=this;this.$handle.options.global&&(this.cacheConfig[e.trueType]||(this.cacheConfig[e.trueType]=l((function(){var n=t.$handle.options.global;return qe({},[n["*"]||n.default||{},n[e.originType]||n[e.type]||n[e.type]||{}])}))),e.prop=qe({},[this.cacheConfig[e.trueType].value,e.prop]))},setOptions:function(e){var t=e.loadPending({key:"options",origin:e.prop.options,def:[]});e.prop.options=t,e.prop.optionsTo&&t&&mt(e.prop,e.prop.optionsTo,t)},deepSet:function(e){var t=e.rule.deep;t&&Object.keys(t).sort((function(e,t){return e.length<t.length?-1:1})).forEach((function(n){mt(e.prop,n,t[n])}))},parseSide:function(e,t){return H.Object(e)?qe({props:{formCreateInject:t.prop.props.formCreateInject}},e):e},renderSides:function(e,t,n){var r=t[n?"rule":"prop"];return[this.renderRule(this.parseSide(r.prefix,t)),e,this.renderRule(this.parseSide(r.suffix,t))]},renderId:function(e,t){var n=this,r=this.$handle["field"===t?"fieldCtx":"nameCtx"][e];return r?r.map((function(e){return n.renderCtx(e,e.parent)})):void 0},renderCtx:function(e,t){var n=this;try{if("hidden"===e.type)return;var r=e.rule;if(this.force||!this.cache[e.id]||this.cache[e.id].slot!==r.slot){var i;e.initProp(),this.mergeGlobal(e),e.initNone(),this.$manager.tidyRule(e),this.deepSet(e),this.setOptions(e),this.ctxProp(e);var a=e.prop;a.preview=!!(null!=a.preview?a.preview:this.$handle.preview),a.props.formCreateInject=this.injectProp(e);var o=!1!==a.cache,u=a.preview;if(a.hidden)return void this.setCache(e,void 0,t);i=function(){for(var i=arguments.length,l=new Array(i),c=0;c<i;c++)l[c]=arguments[c];var s={rule:r,prop:a,preview:u,api:n.$handle.api,model:a.model||{},slotValue:l};l.length&&r.slotUpdate&&ze((function(){return r.slotUpdate(s)}));var f={},d=e.loadChildrenPending();e.parser.renderChildren?f=e.parser.renderChildren(d,e):!1!==e.parser.loadChildren&&(f=n.renderChildren(d,e)),Object.keys(a.renderSlots||{}).forEach((function(t){f[t]=function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];if(H.Function(a.renderSlots[t]))return ze((function(){var e;return(e=a.renderSlots)[t].apply(e,i)}));var u=n.parseSide(a.renderSlots[t],e);return n.renderRule(u)}}));var p,h=n.getTypeSlot(e);return h?(s.children=f,p=h(s)):p=u?e.parser.preview(de(f),e):e.parser.render(de(f),e),p=n.renderSides(p,e),!e.input&&H.Undef(a.native)||!0===a.native||(n.fc.targetFormDriver("updateWrap",e),p=n.$manager.makeWrap(e,p)),e.none&&(p=Array.isArray(p)?p.map((function(e){return e&&e.__v_isVNode?n.none(e):e})):n.none(p)),o&&n.setCache(e,(function(){return n.stable(p)}),t),p},this.setCache(e,i,t)}return function(){var t=n.getCache(e);if(t)return t.apply(void 0,arguments);if(!n.cache[e.id]){var r=n.renderCtx(e,e.parent);return r?r():void 0}}}catch(e){return void console.error(e)}},none:function(e){if(e)return e.props.class=this.mergeClass(e.props.class,"fc-none"),e},mergeClass:function(e,t){return Array.isArray(e)?(e.push(t),e):e?[e,t]:t},stable:function(e){var t=this;return(Array.isArray(e)?e:[e]).forEach((function(e){e&&e.__v_isVNode&&e.children&&"object"===R(e.children)&&(e.children.$stable=!0,t.stable(e.children))})),e},getModelField:function(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:function(e){return"fragment"===e.type||"template"===e.type},injectProp:function(e){var t=this,n=this.vm.setupState;n.ctxInject[e.id]||(n.ctxInject[e.id]={api:this.$handle.api,form:this.fc.create,subForm:function(n){t.$handle.addSubForm(e,n)},getSubForm:function(){return t.$handle.subForm[e.id]},slots:function(){return t.vm.setupState.top.slots},getWrap:function(){return t.vm.refs[e.wrapRef]},options:[],children:[],preview:!1,id:e.id,field:e.field,rule:e.rule,input:e.input,t:function(){var e;return(