Socket
Socket
Sign inDemoInstall

@form-create/core

Package Overview
Dependencies
22
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.1.29 to 3.1.30

4

dist/index.esm.min.js
/*!
* @form-create/core v3.1.29
* @form-create/core v3.1.30
* (c) 2018-2024 xaboy

@@ -7,2 +7,2 @@ * Github https://github.com/xaboy/form-create

*/
import{defineComponent as e,getCurrentInstance as t,provide as n,inject as r,toRefs as i,reactive as o,onMounted as a,onBeforeUnmount as u,onUpdated as c,watch as f,markRaw as s,isVNode as l,computed as d,nextTick as p,toRef as h,createVNode as v,resolveComponent as m,withDirectives as y,resolveDirective as g,createApp as b,h as _,ref as x}from"vue";function C(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 O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?C(Object(n),!0).forEach((function(t){E(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function $(e){return $="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},$(e)}function S(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function E(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j(e){return j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},j(e)}function F(e,t){return F=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},F(e,t)}function R(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 A(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=j(e);if(t){var i=j(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return R(this,n)}}function w(e){return function(e){if(Array.isArray(e))return k(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return k(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return k(e,t)}(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 k(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}function P(e){return Array.isArray(e)?e:[null,void 0,""].indexOf(e)>-1?[]:[e]}var D=function e(t,n){if(t&&t!==n)return t.props.formCreateInject?t.props.formCreateInject:t.parent?e(t.parent,n):void 0};function V(l,d,p){return e({name:"FormCreate",components:d,directives:p,props:{rule:{type:Array,required:!0,default:function(){return[]}},option:{type:Object,default:function(){return{}}},extendOption:Boolean,modelValue:Object,disabled:Boolean,api:Object,name:String,subForm:{type:Boolean,default:!0},inFor:Boolean},emits:["update:api","update:modelValue","mounted","submit","change","emit-event","control","remove-rule","remove-field","sync","reload","repeat-field","update","validate-field-fail","validate-fail"],render:function(){return this.fc.render()},setup:function(e){var d=t();n("parentFC",d);var p=r("parentFC",null),h=i(e),v=h.rule,m=h.modelValue,y=h.subForm,g=h.inFor,b=o({ctxInject:{},destroyed:!1,isShow:!0,unique:1,renderRule:w(v.value||[]),updateValue:JSON.stringify(m.value||{})}),_=new l(d),x=_.api(),C=g.value,$=function(){var e=D(d,p);if(e)if(C){var t=P(e.getSubForm()),n=t.indexOf(x);n>-1&&t.splice(n,1)}else e.subForm()};return a((function(){_.mounted()})),u((function(){$(),b.destroyed=!0,_.unmount()})),c((function(){_.updated()})),f(y,(function(e){e?function(){if(p){var e,t=D(d,p);t&&(C?(e=P(t.getSubForm())).push(x):e=x,t.subForm(e))}}():$()}),{immediate:!0}),f((function(){return w(v.value)}),(function(e){_.$handle.isBreakWatch()||e.length===b.renderRule.length&&e.every((function(e){return b.renderRule.indexOf(e)>-1}))||(_.$handle.reloadRule(v.value),d.setupState.renderRule())})),f((function(){return e.option}),(function(){_.initOptions(),x.refresh()}),{deep:!0}),f(m,(function(e){JSON.stringify(e||{})!==b.updateValue&&(x.config.forceCoverValue?x.coverValue(e||{}):x.setValue(e||{}))}),{deep:!0}),f((function(){return e.disabled}),(function(e){x.disabled(!!e)})),O(O({fc:s(_),parent:p?s(p):p,fapi:s(x)},i(b)),{},{refresh:function(){++b.unique},renderRule:function(){b.renderRule=w(v.value||[])},updateValue:function(e){b.destroyed||(b.updateValue=JSON.stringify(e),d.emit("update:modelValue",e))}})},created:function(){var e=t();e.setupState.fc.init(),e.emit("update:api",e.setupState.fapi),e.props.disabled&&e.setupState.fapi.disabled(!0)}})}function T(e,t,n){e[t]=n}function N(e,t){delete e[t]}var I=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)&&T(e,r,t[r]);return e};function L(){return I.apply(this,arguments)}function M(e){return"object"!==$(e)||null===e?e:e instanceof Array?w(e):O({},e)}var U={type:function(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"},Undef:function(e){return null==e},Element:function(e){return"object"===$(e)&&null!==e&&1===e.nodeType&&!U.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 B(e,t){return{}.hasOwnProperty.call(e,t)}["Date","Object","String","Boolean","Array","Number"].forEach((function(e){U[e]=function(t){return U.type(t,e)}}));var q=["props"],J=["class","style","directives"],G=["on"],W=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(q,w(r.normal||[])),o=[].concat(J,w(r.array||[])),a=[].concat(G,w(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]=O(O({},t[r]),n[r]);else if(o.indexOf(r)>-1){var c=t[r]instanceof Array?t[r]:[t[r]],f=n[r]instanceof Array?n[r]:[n[r]];t[r]=[].concat(w(c),w(f))}else if(a.indexOf(r)>-1)for(var s in n[r])if(t[r][s]){var l=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(w(l),w(d))}else t[r][s]=n[r][s];else if("hook"===r)for(var p in n[r])t[r][p]?t[r][p]=H(t[r][p],n[r][p]):t[r][p]=n[r][p];else t[r]=n[r];else i.indexOf(r)>-1||a.indexOf(r)>-1||u.indexOf(r)>-1?t[r]=O({},n[r]):o.indexOf(r)>-1?t[r]=n[r]instanceof Array?w(n[r]):"object"===$(n[r])?O({},n[r]):n[r]:t[r]=n[r];return t}),n)},H=function(e,t){return function(){e&&e.apply(this,arguments),t&&t.apply(this,arguments)}},X=["type","slot","emitPrefix","value","name","native","hidden","display","inject","options","emit","link","prefix","suffix","update","sync","optionsTo","key","slotUpdate","computed","preview","component","cache","modelEmit"],K=["validate","children","control"],Q=["effect"];function z(){return[].concat(X,w(q),w(J),w(G),K,Q)}function Z(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 o=t[i];if((r=Array.isArray(o))||U.Object(o)){var a=void 0===e[i];if(r)r=!1,a&&T(e,i,[]);else if(o._clone&&void 0!==n){if(!n){T(e,i,o._clone());continue}o=o.getRule(),a&&T(e,i,{})}else a&&T(e,i,{});e[i]=Z(e[i],o,n)}else T(e,i,o),U.Undef(o)||(U.Undef(o.__json)||(e[i].__json=o.__json),U.Undef(o.__origin)||(e[i].__origin=o.__origin))}return void 0!==n&&Array.isArray(e)?e.filter((function(e){return!e||!e.__ctrl})):e}function Y(e){return Z({},{value:e}).value}function ee(e,t,n){return"[form-create ".concat(e,"]: ").concat(t)+(n?"\n\nrule: "+JSON.stringify(n.getRule?n.getRule():n):"")}function te(e,t){console.error(ee("err",e,t))}function ne(e){var t=e.replace(/([A-Z])/g,"-$1").toLocaleLowerCase();return 0===t.indexOf("-")&&(t=t.substr(1)),t}var re="[[FORM-CREATE-PREFIX-",ie="-FORM-CREATE-SUFFIX]]";function oe(e,t){return JSON.stringify(Z([],e,!0),(function(e,t){if(!t||!0!==t._isVue){if("function"!==$(t))return t;if(t.__json)return t.__json;if(t.__origin&&(t=t.__origin),!t.__emit)return re+t+ie}}),t)}function ae(e){return new Function("return "+e)()}function ue(e,t){if(e&&U.String(e)&&e.length>4){var n=e.trim(),r=!1;try{if(n.indexOf(ie)>0&&0===n.indexOf(re))n=n.replace(ie,"").replace(re,""),r=!0;else if(0===n.indexOf("$FN:"))n=n.replace("$FN:",""),r=!0;else{if(0===n.indexOf("$GLOBAL:")){var i=n.replace("$GLOBAL:","");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=ae("function($inject){"+n.replace("$FNX:","")+"}")).__json=e,n.__inject=!0,n;t||0!==n.indexOf("function")||"function"===n||(r=!0)}if(!r)return e;var o=ae(-1===n.indexOf("function")&&0!==n.indexOf("(")?"function "+n:n);return o.__json=e,o}catch(e){return void te("解析失败:".concat(n,"\n\nerr: ").concat(e))}}return e}function ce(e,t){return JSON.parse(e,(function(e,n){return U.Undef(n)||!n.indexOf?n:ue(n,t)}))}function fe(e,t){return{value:e,enumerable:!1,configurable:!1,writable:!!t}}function se(e,t){return le([e],t||!1)[0]}function le(e,t){return Z([],w(e),t||!1)}function de(e,t){return W(Array.isArray(t)?t:[t],e,{array:K,normal:Q}),e}function pe(e){var t=U.Function(e.getRule)?e.getRule():e;return t.type||(t.type="input"),t}function he(e,t){Object.defineProperties(e,Object.keys(t).reduce((function(e,n){return e[n]={get:function(){return t[n]()}},e}),{}))}function ve(e){return e.__fc__||(e.__origin__?e.__origin__.__fc__:null)}function me(e,t){try{t=e()}catch(e){!function(e){te(e.toString()),console.error(e)}(e)}return t}function ye(){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,w(e));else if(U.Function(e)){var t=e.apply(void 0,w(r||[]));Array.isArray(t)?i.push.apply(i,w(t)):i.push(t)}else U.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=U.Function(e.getSlots)?e.getSlots():e;return Array.isArray(e)||l(e)?this.setSlot(void 0,(function(){return e})):Object.keys(n).forEach((function(e){t.setSlot(e,n[e])})),this}}}function ge(e){var t=O({},e.props||{});return Object.keys(e.on||{}).forEach((function(n){var r,i="on".concat((r=n).replace(r[0],r[0].toLocaleUpperCase()));Array.isArray(t[i])?t[i]=[].concat(w(t[i]),[e.on[n]]):t[i]?t[i]=[t[i],e.on[n]]:t[i]=e.on[n]})),t.key=e.key,t.ref=e.ref,t.class=e.class,t.style=e.style,t.slot&&delete t.slot,t}function be(e,t){return Object.setPrototypeOf(e,t),e}function _e(e,t){return function(n,r,i){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=new xe(e,n,r,i,o);return t&&(U.Function(t)?t(a):a.props(t)),a}}function xe(e,t,n,r,i){this._data=L({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 Ce(e){e.forEach((function(e){xe.prototype[e]=function(t){return de(this._data,E({},e,arguments.length<2?t:E({},t,arguments[1]))),this}}))}L(xe.prototype,{getRule:function(){return this._data},setProp:function(e,t){return T(this._data,e,t),this},modelField:function(e){return this._data.modelField=e,this},_clone:function(){var e=new this.constructor;return e._data=se(this._data),e}}),Ce(z());var Oe=_e("");function $e(e,t,n){var r=Oe("",t);return r._data.type=e,r._data.title=n,r}function Se(){return{create:$e,factory:_e}}function Ee(e){var t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch(e){return t}}function je(e){if("undefined"!=typeof XMLHttpRequest){var t,n=new XMLHttpRequest,r=e.action;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),Ee(n));e.onSuccess(Ee(n))},n.open(e.method||"get",r,!0),e.data&&("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.withCredentials&&"withCredentials"in n&&(n.withCredentials=!0);var i=e.headers||{};Object.keys(i).forEach((function(e){null!==i[e]&&n.setRequestHeader(e,i[e])})),n.send(t)}}function Fe(e){return Y(e)}function Re(e){function t(t){return U.Undef(t)?t=e.fields():Array.isArray(t)||(t=[t]),t}function n(n,r,i){t(n).forEach((function(t){e.getCtxs(t).forEach((function(t){T(t.rule,r,i),e.$render.clearCache(t)}))}))}function r(){var t=e.subForm;return Object.keys(t).reduce((function(e,n){var r=t[n];return r?(Array.isArray(r)?e.push.apply(e,w(r)):e.push(r),e):e}),[])}var i={get config(){return e.options},set config(t){e.fc.options.value=t},get options(){return e.options},set options(t){e.fc.options.value=t},get form(){return e.form},get rule(){return e.rules},get parent(){return e.vm.setupState.parent&&e.vm.setupState.parent.setupState.fapi},get top(){return i.parent?i.parent.top:i},get children(){return r()},formData:function(n){return t(n).reduce((function(t,n){var r=e.getFieldCtx(n);return r?(t[r.field]=Fe(r.rule.value),t):t}),{})},getValue:function(t){var n=e.getFieldCtx(t);if(n)return Fe(n.rule.value)},coverValue:function(t){var n=O({},t||{});e.deferSyncValue((function(){i.fields().forEach((function(r){var i=e.fieldCtx[r];if(i){var o=B(t,r);i.forEach((function(e){e.rule.value=o?t[r]:void 0})),delete n[r]}})),L(e.appendData,n)}))},setValue:function(t){var n=t;arguments.length>=2&&(n=E({},t,arguments[1])),e.deferSyncValue((function(){Object.keys(n).forEach((function(t){var r=e.fieldCtx[t];if(!r)return e.appendData[t]=n[t];r.forEach((function(e){e.rule.value=n[t]}))}))}))},removeField:function(t){var n=e.getCtx(t);return e.deferSyncValue((function(){e.getCtxs(t).forEach((function(e){e.rm()}))}),!0),n?n.origin:void 0},removeRule:function(e){var t=e&&ve(e);if(t)return t.rm(),t.origin},fields:function(){return e.fields()},append:function(t,n,r){var i,o=e.sort.length-1,a=e.getCtx(n);if(a)if(r){if(i=a.getPending("children",a.rule.children),!Array.isArray(i))return;o=a.rule.children.length-1}else o=a.root.indexOf(a.origin),i=a.root;else i=e.rules;i.splice(o+1,0,t)},prepend:function(t,n,r){var i,o=0,a=e.getCtx(n);if(a)if(r){if(i=a.getPending("children",a.rule.children),!Array.isArray(i))return}else o=a.root.indexOf(a.origin),i=a.root;else i=e.rules;i.splice(o,0,t)},hidden:function(t,r){n(r,"hidden",!!t),e.refresh()},hiddenStatus:function(t){var n=e.getCtx(t);if(n)return!!n.rule.hidden},display:function(t,r){n(r,"display",!!t),e.refresh()},displayStatus:function(t){var n=e.getCtx(t);if(n)return!!n.rule.display},disabled:function(n,r){t(r).forEach((function(t){e.getCtxs(t).forEach((function(e){T(e.rule.props,"disabled",!!n)}))})),e.refresh()},all:function(t){return Object.keys(e.ctxs).map((function(n){var r=e.ctxs[n];return t?r.origin:r.rule}))},model:function(t){return e.fields().reduce((function(n,r){var i=e.fieldCtx[r][0];return n[r]=t?i.origin:i.rule,n}),{})},component:function(t){return Object.keys(e.nameCtx).reduce((function(n,r){var i=e.nameCtx[r].map((function(e){return t?e.origin:e.rule}));return n[r]=1===i.length?i[0]:i,n}),{})},bind:function(){return i.form},reload:function(t){e.reloadRule(t)},updateOptions:function(t){e.fc.updateOptions(t),i.refresh()},onSubmit:function(e){i.updateOptions({onSubmit:e})},sync:function(t){if(Array.isArray(t))t.forEach((function(e){return i.sync(e)}));else{var n=U.Object(t)?ve(t):e.getCtxs(t);n&&((n=Array.isArray(n)?n:[n]).forEach((function(t){if(!t.deleted){var n=e.subForm[t.id];n&&(Array.isArray(n)?n.forEach((function(e){e.refresh()})):n&&n.refresh()),e.$render.clearCache(t)}})),e.refresh())}},refresh:function(){r().forEach((function(e){e.refresh()})),e.$render.clearCacheAll(),e.refresh()},refreshOptions:function(){e.$manager.updateOptions(e.options),i.refresh()},hideForm:function(t){e.vm.setupState.isShow=!t},changeStatus:function(){return e.changeStatus},clearChangeStatus:function(){e.changeStatus=!1},updateRule:function(t,n){e.getCtxs(t).forEach((function(e){L(e.rule,n)}))},updateRules:function(e){Object.keys(e).forEach((function(t){i.updateRule(t,e[t])}))},mergeRule:function(t,n){e.getCtxs(t).forEach((function(e){de(e.rule,n)}))},mergeRules:function(e){Object.keys(e).forEach((function(t){i.mergeRule(t,e[t])}))},getRule:function(t,n){var r=e.getCtx(t);if(r)return n?r.origin:r.rule},setEffect:function(t,n,r){var i=e.getCtx(t);i&&n&&("$"===n[0]&&(n=n.substr(1)),B(i.rule,"$"+n)&&T(i.rule,"$"+n,r),B(i.rule,"effect")||(i.rule.effect={}),T(i.rule.effect,n,r))},clearEffectData:function(t,n){var r=e.getCtx(t);r&&(n&&"$"===n[0]&&(n=n.substr(1)),r.clearEffectData(n),i.sync(t))},updateValidate:function(e,t,r){r?i.mergeRule(e,{validate:t}):n(e,"validate",t)},updateValidates:function(e,t){Object.keys(e).forEach((function(n){i.updateValidate(n,e[n],t)}))},refreshValidate:function(){i.refresh()},resetFields:function(n){t(n).forEach((function(t){e.getCtxs(t).forEach((function(t){e.$render.clearCache(t),t.rule.value=Fe(t.defaultValue)}))}))},method:function(e,t){var n=i.el(e);if(!n||!n[t])throw new Error(ee("err","".concat(t,"方法不存在")));return function(){return n[t].apply(n,arguments)}},exec:function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return me((function(){return i.method(e,t).apply(void 0,r)}))},toJson:function(e){return oe(i.rule,e)},trigger:function(e,t){for(var n=i.el(e),r=arguments.length,o=new Array(r>2?r-2:0),a=2;a<r;a++)o[a-2]=arguments[a];n&&n.$emit.apply(n,[t].concat(o))},el:function(t){var n=e.getCtx(t);if(n)return n.el||e.vm.refs[n.ref]},closeModal:function(t){e.bus.$emit("fc:closeModal:"+t)},getSubForm:function(t){var n=e.getCtx(t);return n?e.subForm[n.id]:void 0},getChildrenRuleList:function(t){var n="object"===$(t),r=n?ve(t):e.getCtx(t),o=r?r.rule:n?t:i.getRule(t);if(!o)return[];var a,u=[];return(a=r?r.loadChildrenPending():o.children)&&a.forEach((function(e){"object"===$(e)&&(e.field&&u.push(e),u.push.apply(u,w(i.getChildrenRuleList(e))))})),u},getChildrenFormData:function(e){return i.getChildrenRuleList(e).reduce((function(e,t){return e[t.field]=Fe(t.value),e}),{})},setChildrenFormData:function(e,t,n){i.getChildrenRuleList(e).forEach((function(e){B(t,e.field)?e.value=t[e.field]:n&&(e.value=void 0)}))},getGlobalEvent:function(e){var t=i.options.globalEvent[e];if(t)return"object"===$(t)&&(t=t.handle),ue(t)},getGlobalData:function(t){return new Promise((function(n,r){var o=i.options.globalData[t];o||n(e.fc.loadData[t]),"fetch"===o.type?function(e){return new Promise((function(t,n){je(O(O({},e),{},{onSuccess:function(n){var r=function(e){return e},i=ue(e.parse);U.Function(i)?r=i:i&&U.String(i)&&(r=function(e){return i.split(".").forEach((function(t){e&&(e=e[t])})),e}),t(r(n))},onError:function(e){n(e)}}))}))}(o).then((function(e){n({res:e,config:o})})).catch(r):n(o.data)}))},nextTick:function(t){e.bus.$once("next-tick",t),e.refresh()},nextRefresh:function(t){e.nextRefresh(),t&&me(t)},deferSyncValue:function(t,n){e.deferSyncValue(t,n)},emit:function(t){for(var n,r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];(n=e.vm).emit.apply(n,[t].concat(i))},helper:{tidyFields:t,props:n}};return["on","once","off","set"].forEach((function(t){i[t]=function(){var n;(n=e.bus)["$".concat(t)].apply(n,arguments)}})),i.changeValue=i.changeField=i.setValue,i}function Ae(e){return we(e.replace(/(-[a-z])/g,(function(e){return e.replace("-","").toLocaleUpperCase()})))}function we(e){return e.replace(e[0],e[0].toLowerCase())}var ke=0;function Pe(){var e=370+ ++ke;return"F"+Math.random().toString(36).substr(3,3)+Number("".concat(Date.now())).toString(36)+e.toString(36)+"c"}function De(e,t,n){var r,i=e;return(t||"").split(".").forEach((function(e){r&&(i[r]&&"object"==$(i[r])||(i[r]={}),i=i[r]),r=e})),i[r]=n,i}var Ve=1;function Te(e){L(this,{$handle:e,fc:e.fc,vm:e.vm,$manager:e.$manager,vNode:new e.fc.CreateNode(e.vm),id:Ve++}),he(this,{options:function(){return e.options},sort:function(){return e.sort}}),this.initCache(),this.initRender()}!function(e){L(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]=null)},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}})}(Te),function(e){L(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-"+ne(e.rule.field)]||n.slots["field-"+e.rule.field]),r||(r=n.slots["type-"+ne(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=ye();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]=d((function(){var n=t.$handle.options.global;return de({},[n["*"],n[e.originType]||n[e.type]||n[e.type]||{}])}))),e.prop=de({},[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&&De(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){De(e.prop,n,t[n])}))},parseSide:function(e,t){return U.Object(e)?de({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.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 o=e.prop;o.preview=!!(B(o,"preview")?o.preview:this.options.preview),o.props.formCreateInject=this.injectProp(e);var a=!1!==o.cache,u=o.preview;if(o.hidden)return void this.setCache(e,void 0,t);i=function(){for(var i=arguments.length,c=new Array(i),f=0;f<i;f++)c[f]=arguments[f];var s={rule:r,prop:o,preview:u,api:n.$handle.api,model:o.model||{},slotValue:c};c.length&&r.slotUpdate&&me((function(){return r.slotUpdate(s)}));var l={},d=e.loadChildrenPending();e.parser.renderChildren?l=e.parser.renderChildren(d,e):!1!==e.parser.loadChildren&&(l=n.renderChildren(d,e));var p,h=n.getTypeSlot(e);return h?(s.children=l,p=h(s)):p=u?e.parser.preview(M(l),e):e.parser.render(M(l),e),p=n.renderSides(p,e),!e.input&&U.Undef(o.native)||!0===o.native||(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)),a&&!Object.keys(l).length&&n.setCache(e,(function(){return 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 Array.isArray(e.props.class)?e.props.class.push("fc-none"):e.props.class=[e.props.class,"fc-none"],e},getModelField:function(e){return e.rule.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]},options:[],children:[],preview:!1,id:e.id,field:e.field,rule:e.rule,input:e.input});var r=n.ctxInject[e.id];return L(r,{preview:e.prop.preview,options:e.prop.options,children:e.loadChildrenPending()}),r},ctxProp:function(e,t){var n=this,r=e.ref,i=e.key,o=e.rule;this.$manager.mergeProp(e,t),e.parser.mergeProp(e,t);var a=[{ref:r,key:o.key||"".concat(i,"fc"),slot:void 0,on:{vnodeMounted:function(t){t.el.__rule__=e.rule,n.onMounted(e,t.el)},"fc.el":function(t){e.exportEl=t,t&&((t.$el||t).__rule__=e.rule)}}}];if(!t&&e.input){var u=this.getModelField(e),c={callback:function(t){n.onInput(e,t)},value:this.$handle.getFormData(e)};a.push({on:O(E({},"update:".concat(u),c.callback),e.prop.modelEmit?E({},e.prop.modelEmit,(function(){return n.onEmitInput(e)})):{}),props:E({},u,c.value)}),e.prop.model=c}return W(a,e.prop),e.prop},onMounted:function(e,t){e.el=this.vm.refs[e.ref]||t,e.parser.mounted(e),this.$handle.effect(e,"mounted")},onInput:function(e,t){e.prop.modelEmit?this.$handle.onBaseInput(e,t):this.$handle.onInput(e,t)},onEmitInput:function(e){this.$handle.setValue(e,e.parser.toValue(e.modelValue,e),e.modelValue)},renderChildren:function(e,t){var n=this;if(!U.trueArray(e))return{};var r=ye();return e.map((function(i){if(i)return U.String(i)?r.setSlot(null,i):i.__fc__?n.renderSlot(r,i.__fc__,t):void(i.type&&p((function(){n.$handle.loadChildren(e,t),n.$handle.refresh()})))})),r.getSlots()},defaultRender:function(e,t){var n=e.prop;return n.component?this.vNode.makeComponent(n.component,n,t):this.vNode[e.type]?this.vNode[e.type](n,t):this.vNode[e.originType]?this.vNode[e.originType](n,t):this.vNode.make(we(e.originType),n,t)},renderRule:function(e,t,n){var r=this;if(e){if(U.String(e))return e;var i;if(n)i=e.type;else if(i=e.is,e.type){i=Ae(e.type);var o=this.vNode.aliasMap[i];o&&(i=Ae(o))}if(i){var a=ye();U.trueArray(e.children)&&e.children.forEach((function(e){e&&a.setSlot(null==e?void 0:e.slot,(function(){return r.renderRule(e)}))}));var u=O({},e);return delete u.type,delete u.is,this.vNode.make(i,u,a.mergeBag(t).getSlots())}}}})}(Te);var Ne=["hook:updated","hook:mounted"];function Ie(e,t,n){var r,i=Pe(),o=!!t.field;L(this,{id:i,ref:i,wrapRef:i+"fi",rule:t,origin:t.__origin__||t,name:t.name,pending:{},none:!1,watch:[],linkOn:[],root:[],ctrlRule:[],children:[],parent:null,group:t.subRule?this:null,cacheConfig:null,prop:O({},t),computed:{},payload:{},refRule:{},input:o,el:void 0,exportEl:void 0,defaultValue:o?Y(n):void 0,field:t.field||void 0}),this.updateType(),this.updateKey(),r=this,Object.defineProperties(r.origin,{__fc__:fe(s(r),!0)}),this.update(e,!0)}L(Ie.prototype,{getParentGroup:function(){for(var e=this.parent;e;){if(e.group)return e;e=e.parent}},loadChildrenPending:function(){var e=this,t=this.rule.children||[];return Array.isArray(t)?t:this.loadPending({key:"children",origin:t,def:[],onLoad:function(t){e.$handle&&e.$handle.loadChildren(t,e)},onUpdate:function(t,n){e.$handle&&(t===n?e.$handle.loadChildren(t,e):e.$handle.updateChildren(e,t,n))},onReload:function(t){e.$handle?e.$handle.updateChildren(e,[],t):delete e.pending.children}})},loadPending:function(e){var t=this,n=e.key,r=e.origin,i=e.def,o=e.onLoad,a=e.onReload,u=e.onUpdate;if(this.pending[n]&&this.pending[n].origin===r)return this.getPending(n,i);delete this.pending[n];var c=r;if(U.Function(r)){var f=me((function(){return r({rule:t.rule,api:t.$api,update:function(e){var o=e||i,a=t.getPending(n,i);t.setPending(n,r,o),u&&u(o,a)},reload:function(){var e=t.getPending(n,i);delete t.pending[n],a&&a(e),t.$api&&t.$api.sync(t.rule)}})}));f&&U.Function(f.then)?(f.then((function(e){var a=e||i;t.setPending(n,r,a),o&&o(a),t.$api&&t.$api.sync(t.rule)})).catch((function(e){console.error(e)})),c=i,this.setPending(n,r,c)):(c=f||i,this.setPending(n,r,c),o&&o(c))}return c},getPending:function(e,t){return this.pending[e]&&this.pending[e].value||t},setPending:function(e,t,n){this.pending[e]={origin:t,value:o(n)}},effectData:function(e){return this.payload[e]||(this.payload[e]={}),this.payload[e]},clearEffectData:function(e){void 0===e?this.payload={}:delete this.payload[e]},updateKey:function(e){this.key=Pe(),e&&this.parent&&this.parent.updateKey(e)},updateType:function(){this.originType=this.rule.type,this.type=Ae(this.rule.type)},setParser:function(e){this.parser=e,e.init(this)},initProp:function(){var e=this,t=O({},this.rule);delete t.children,this.prop=de({},[t].concat(w(Object.keys(this.payload).map((function(t){return e.payload[t]}))),[this.computed]))},initNone:function(){this.none=!(U.Undef(this.prop.display)||this.prop.display)},check:function(e){return this.vm===e.vm},unwatch:function(){this.watch.forEach((function(e){return e()})),this.watch=[],this.refRule={}},unlink:function(){this.linkOn.forEach((function(e){return e()})),this.linkOn=[]},link:function(){this.unlink(),this.$handle.appendLink(this)},watchTo:function(){this.$handle.watchCtx(this)},delete:function(){var e=void 0;this.unwatch(),this.unlink(),this.rmCtrl(),this.parent&&this.parent.children.splice(this.parent.children.indexOf(this)>>>0,1),L(this,{deleted:!0,prop:O({},this.rule),computed:{},el:e,$handle:e,$render:e,$api:e,vm:e,vNode:e,parent:null,children:[],cacheConfig:null,none:!1})},rmCtrl:function(){this.ctrlRule.forEach((function(e){return e.__fc__&&e.__fc__.rm()})),this.ctrlRule=[]},rm:function(){var e=this,t=function(){var t=e.root.indexOf(e.origin);t>-1&&(e.root.splice(t,1),e.$handle&&e.$handle.refresh())};this.deleted?t():this.$handle.noWatch((function(){e.$handle.deferSyncValue((function(){e.rmCtrl(),t(),e.$handle.rmCtx(e),L(e,{root:[]})}),e.input)}))},update:function(e,t){L(this,{deleted:!1,$handle:e,$render:e.$render,$api:e.api,vm:e.vm,trueType:e.getType(this.originType),vNode:e.$render.vNode,updated:!1,cacheValue:this.rule.value}),!t&&this.unwatch(),this.watchTo(),this.link()}});var Le={"==":function(e){return function(t){return t===e}},"!=":function(e){return function(t){return t!==e}},"<>":function(e){return function(t){return t!==e}},">":function(e){return function(t){return t>e}},">=":function(e){return function(t){return t>=e}},"<":function(e){return function(t){return t<e}},"<=":function(e){return function(t){return t<=e}},in:function(e){return function(t){return e&&e.indexOf&&e.indexOf(t)>-1}},on:function(e){return function(t){return t&&t.indexOf&&t.indexOf(e)>-1}},notIn:function(e){return function(t){return!Le.in(e)(t)}},notOn:function(e){return function(t){return!Le.on(e)(t)}},between:function(e){return function(t){return t>e[0]&&t<e[1]}},notBetween:function(e){return function(t){return t<e[0]||t>e[1]}}};function Me(e,t){for(var n=0;n<e.ctrlRule.length;n++){var r=e.ctrlRule[n];if(r.children===t)return r}}function Ue(e){return!!e.rule.__ctrl}function Be(e,t){return"function"==typeof t?""+t:t}var qe={init:function(e){},toFormValue:function(e,t){return e},toValue:function(e,t){return e},mounted:function(e){},render:function(e,t){return t.$render.defaultRender(t,e)},preview:function(e,t){return this.render(e,t)},mergeProp:function(e){}},Je=["field","value","vm","template","name","config","control","inject","sync","payload","optionsTo","update","slotUpdate","computed","component","cache"];function Ge(e){var t=this;he(this,{options:function(){return e.options.value||{}},bus:function(){return e.bus}}),L(this,{fc:e,vm:e.vm,watching:!1,loading:!1,reloading:!1,noWatchFn:null,deferSyncFn:null,isMounted:!1,formData:o({}),subRuleData:o({}),subForm:{},form:o({}),appendData:{},providers:{},cycleLoad:null,loadedId:1,nextTick:null,changeStatus:!1,pageEnd:!0,nextReload:function(){t.lifecycle("reload")}}),this.initData(e.rules),this.$manager=new e.manager(this),this.$render=new Te(this),this.api=e.extendApi(Re(this),this)}L(Ge.prototype,{initData:function(e){L(this,{ctxs:{},fieldCtx:{},nameCtx:{},sort:[],rules:e})},init:function(){this.appendData=O(O(O({},this.options.formData||{}),this.fc.vm.props.modelValue||{}),this.appendData),this.useProvider(),this.usePage(),this.loadRule(),this.$manager.__init()},isBreakWatch:function(){return this.loading||this.noWatchFn||this.reloading}}),function(e){L(e.prototype,{parseInjectEvent:function(e,t){var n=e.inject||this.options.injectEvent;return this.parseEventLst(e,t,n)},parseEventLst:function(e,t,n,r){var i=this;return Object.keys(t).forEach((function(o){var a=i.parseEvent(e,t[o],n,r);a&&(t[o]=a)})),t},parseEvent:function(e,t,n,r){if(U.Function(t)&&(!1!==n&&!U.Undef(n)||t.__inject))return this.inject(e,t,n);if(!r&&Array.isArray(t)&&t[0]&&(U.String(t[0])||U.Function(t[0])))return this.parseEventLst(e,t,n,!0);if(U.String(t)){var i=ue(t);if(i&&t!==i)return i.__inject?this.parseEvent(e,i,n,!0):i}},parseEmit:function(e){var t=this,n={},r=e.rule,i=r.emitPrefix,o=r.field,a=r.name,u=r.inject,c=r.emit||[];if(U.trueArray(c)){var f=i||o||a;f&&c.forEach((function(e){if(e){var i;U.Object(e)&&(i=e.inject,e=e.name);var o=ne("".concat(f,"-").concat(e)),a=function(){for(var e,n,r,i=arguments.length,a=new Array(i),u=0;u<i;u++)a[u]=arguments[u];(e=t.vm).emit.apply(e,[o].concat(a)),(n=t.vm).emit.apply(n,["emit-event",o].concat(a)),(r=t.bus).$emit.apply(r,[o].concat(a))};if(a.__emit=!0,i||!1!==u){var c=i||u||t.options.injectEvent;n[e]=U.Undef(c)?a:t.inject(r,a,c)}else n[e]=a}}))}return e.computed.on=n,n},getInjectData:function(e,t){var n=this.vm.props,r=n.option,i=n.rule;return{$f:this.api,api:this.api,rule:i,self:e.__origin__,option:r,inject:t}},inject:function(e,t,n){if(t.__origin){if(this.watching&&!this.loading)return t;t=t.__origin}var r=this,i=function(){for(var i=r.getInjectData(e,n),o=arguments.length,a=new Array(o),u=0;u<o;u++)a[u]=arguments[u];return i.args=[].concat(a),a.unshift(i),t.apply(this,a)};return i.__origin=t,i.__json=t.__json,i}})}(Ge),function(e){L(e.prototype,{usePage:function(){var e=this,t=this.options.page;if(t){var n,r=25,i=(n=this.rules).length<31?31:Math.ceil(n.length/3);U.Object(t)&&(t.first&&(r=parseInt(t.first,10)||r),t.limit&&(i=parseInt(t.limit,10)||i)),L(this,{first:r,limit:i,pageEnd:this.rules.length<=r}),this.bus.$on("page-end",(function(){return e.vm.emit("page-end",e.api)})),this.pageLoad()}},pageLoad:function(){var e=this;this.bus.$on(Ne,(function t(){e.pageEnd?(e.bus.$off(Ne,t),e.bus.$emit("page-end")):(e.first+=e.limit,e.pageEnd=e.rules.length<=e.first,e.loadRule(),e.refresh())}))}})}(Ge),function(e){L(e.prototype,{clearNextTick:function(){this.nextTick&&clearTimeout(this.nextTick),this.nextTick=null},bindNextTick:function(e){var t=this;this.clearNextTick(),this.nextTick=setTimeout((function(){e(),t.nextTick=null}),10)},render:function(){return++this.loadedId,this.vm.setupState.unique>0?this.$render.render():(this.vm.setupState.unique=1,[])}})}(Ge),function(e){L(e.prototype,{nextRefresh:function(e){var t=this,n=this.loadedId;p((function(){n===t.loadedId&&(e?e():t.refresh())}))},parseRule:function(e){var t=this,n=pe(e);return Object.defineProperties(n,{__origin__:fe(e,!0)}),function(e){var t={props:{},on:{},options:[],children:[],hidden:!1,display:!0,value:void 0};Object.keys(t).forEach((function(n){B(e,n)||(e[n]=t[n])}))}(n),this.appendValue(n),[n,n.prefix,n.suffix].forEach((function(e){e&&t.loadFn(e,n)})),this.loadCtrl(n),n.update&&(n.update=ue(n.update)),n},loadFn:function(e,t){var n=this;["on","props","deep"].forEach((function(r){e[r]&&n.parseInjectEvent(t,e[r])}))},loadCtrl:function(e){e.control&&e.control.forEach((function(e){e.handle&&(e.handle=ue(e.handle))}))},syncProp:function(e){var t=this,n=e.rule;U.trueArray(n.sync)&&W([{on:n.sync.reduce((function(e,r){return e["update:".concat(r)]=function(e){n.props[r]=e,t.vm.emit("sync",r,e,n,t.fapi)},e}),{})}],e.computed)},loadRule:function(){var e=this;this.cycleLoad=!1,this.loading=!0,this.pageEnd&&this.bus.$emit("load-start"),this.deferSyncValue((function(){if(e._loadRule(e.rules),e.loading=!1,e.cycleLoad&&e.pageEnd)return e.loadRule();e.syncForm(),e.pageEnd&&e.bus.$emit("load-end"),e.vm.setupState.renderRule()}))},loadChildren:function(e,t){if(this.cycleLoad=!1,this.loading=!0,this.bus.$emit("load-start"),this._loadRule(e,t),this.loading=!1,this.cycleLoad)return this.loadRule();this.syncForm(),this.bus.$emit("load-end"),this.$render.clearCache(t)},_loadRule:function(e,t){var n=this,r=function t(r){var i=e[r-1];if(!i||!i.__fc__)return r>0?t(r-1):-1;var o=n.sort.indexOf(i.__fc__.id);return o>-1?o:t(r-1)},i=function(e,t){U.trueArray(e)&&n._loadRule(e,t)},o=e.map((function(o,a){if((!t||U.Object(o))&&(n.pageEnd||t||!(a>=n.first))){if(o.__fc__&&o.__fc__.root===e&&n.ctxs[o.__fc__.id])return i(o.__fc__.loadChildrenPending(),o.__fc__),o.__fc__;var u,c=pe(o),f=function(){return!(!c.field||!n.fieldCtx[c.field]||n.fieldCtx[c.field][0]===o.__fc__)};n.ruleEffect(c,"init",{repeat:f()}),f()&&n.vm.emit("repeat-field",o,n.api);var s=!1,l=!!o.__fc__,d=c.value;if(l){d=(u=o.__fc__).defaultValue;var p=!u.check(n);if(u.deleted){if(p){if(Ue(u))return;u.update(n)}}else if(p){if(Ue(u))return;e[a]=o=o._clone?o._clone():se(o),u=null,s=!0}}if(u)u.originType!==u.rule.type&&(u.updateType(),n.bindParser(u)),n.appendValue(u.rule),u.parent&&u.parent!==t&&n.rmSubRuleData(u);else{var h=n.parseRule(o);u=new Ie(n,h,l?d:h.value),n.bindParser(u)}n.parseEmit(u),n.syncProp(u),u.parent=t||null,u.root=e,n.setCtx(u),!s&&!l&&n.effect(u,"load"),n.effect(u,"created");var v=u.loadChildrenPending();if(!1===u.parser.loadChildren||i(v,u),!t){var m=r(a);m>-1||!a?n.sort.splice(m+1,0,u.id):n.sort.push(u.id)}var y=u.rule;return u.updated||(u.updated=!0,U.Function(y.update)&&n.bus.$once("load-end",(function(){n.refreshUpdate(u,y.value,"init")})),n.effect(u,"loaded")),n.refreshControl(u)&&(n.cycleLoad=!0),u}})).filter((function(e){return!!e}));t&&(t.children=o)},refreshControl:function(e){return e.input&&e.rule.control&&this.useCtrl(e)},useCtrl:function(e){var t=this,n=function(e){var t=e.rule.control||[];return U.Object(t)?[t]:t}(e),r=[],i=this.api;if(!n.length)return!1;for(var o=function(t){var o=n[t],a=o.handle||(Le[o.condition||"=="]||Le["=="])(o.value);if(!U.trueArray(o.rule))return"continue";var u=O(O({},o),{},{valid:me((function(){return a(e.rule.value,i)})),ctrl:Me(e,o.rule),isHidden:U.String(o.rule[0])});if(u.valid&&u.ctrl||!u.valid&&!u.ctrl&&!u.isHidden)return"continue";r.push(u)},a=0;a<n.length;a++)o(a);if(!r.length)return!1;var u=[],c=!1;return this.deferSyncValue((function(){r.reverse().forEach((function(n){var r=n.isHidden,o=n.valid,a=n.rule,f=n.prepend,s=n.append,l=n.child,d=n.ctrl,p=n.method;if(r)return o?e.ctrlRule.push({__ctrl:!0,children:a,valid:o}):e.ctrlRule.splice(e.ctrlRule.indexOf(d),1),void u[o?"push":"unshift"]((function(){"disabled"===p?t.api.disabled(!o,a):"display"===p?t.api.display(o,a):"required"===p?(a.forEach((function(e){t.api.setEffect(e,"required",o)})),o||t.api.clearValidateState(a)):t.api.hidden(!o,a)}));if(o){c=!0;var h={type:"fragment",native:!0,__ctrl:!0,children:a};e.ctrlRule.push(h),t.bus.$once("load-start",(function(){f?i.prepend(h,f,l):s||l?i.append(h,s||e.id,l):e.root.splice(e.root.indexOf(e.origin)+1,0,h)}))}else{e.ctrlRule.splice(e.ctrlRule.indexOf(d),1);var v=ve(d);v&&v.rm()}}))})),u.length&&p((function(){u.forEach((function(e){return e()}))})),this.vm.emit("control",e.origin,this.api),this.effect(e,"control"),c},reloadRule:function(e){return this._reloadRule(e)},_reloadRule:function(e){var t=this;e||(e=this.rules);var n=O({},this.ctxs);this.clearNextTick(),this.initData(e),this.fc.rules=e,this.deferSyncValue((function(){t.bus.$once("load-end",(function(){Object.keys(n).filter((function(e){return void 0===t.ctxs[e]})).forEach((function(e){return t.rmCtx(n[e])})),t.$render.clearCacheAll()})),t.reloading=!0,t.loadRule(),t.reloading=!1,t.refresh(),t.bus.$emit("reloading",t.api)})),this.bus.$off("next-tick",this.nextReload),this.bus.$once("next-tick",this.nextReload),this.bus.$emit("update",this.api)},refresh:function(){this.vm.setupState.refresh()}})}(Ge),function(e){L(e.prototype,{setValue:function(e,t,n,r){e.deleted||(e.rule.value=t,this.changeStatus=!0,this.nextRefresh(),this.$render.clearCache(e),this.setFormData(e,n),this.syncValue(),this.valueChange(e,t),this.vm.emit("change",e.field,t,e.origin,this.api,r||!1),this.effect(e,"value"))},onInput:function(e,t){var n;e.input&&(this.isQuote(e,n=e.parser.toValue(t,e))||this.isChange(e,t))&&this.setValue(e,n,t)},onBaseInput:function(e,t){this.setFormData(e,t),e.modelValue=t,this.nextRefresh(),this.$render.clearCache(e)},setFormData:function(e,t){e.modelValue=t;var n=e.getParentGroup();n&&(this.subRuleData[n.id]||(this.subRuleData[n.id]={}),this.subRuleData[n.id][e.field]=e.rule.value),T(this.formData,e.id,t)},rmSubRuleData:function(e){var t=e.getParentGroup();t&&this.subRuleData[t.id]&&delete this.subRuleData[t.id][e.field]},getFormData:function(e){return this.formData[e.id]},syncForm:function(){var e=this,t=o({});this.fields().reduce((function(t,n){var r=e.getCtx(n);return t[n]=h(r.rule,"value"),t}),t),this.form=t,this.syncValue()},appendValue:function(e){e.field&&B(this.appendData,e.field)&&(e.value=this.appendData[e.field],delete this.appendData[e.field])},addSubForm:function(e,t){this.subForm[e.id]=t},deferSyncValue:function(e,t){this.deferSyncFn||(this.deferSyncFn=e),this.deferSyncFn.sync||(this.deferSyncFn.sync=t),me(e),this.deferSyncFn===e&&(this.deferSyncFn=null,e.sync&&this.syncValue())},syncValue:function(){if(this.deferSyncFn)return this.deferSyncFn.sync=!0;this.vm.setupState.updateValue(O({},this.form))},isChange:function(e,t){return JSON.stringify(this.getFormData(e),Be)!==JSON.stringify(t,Be)},isQuote:function(e,t){return(U.Object(t)||Array.isArray(t))&&t===e.rule.value},refreshUpdate:function(e,t,n){var r=this;if(U.Function(e.rule.update)){var i=me((function(){return e.rule.update(t,e.origin,r.api,{origin:n||"change"})}));if(void 0===i)return;e.rule.hidden=!0===i}},valueChange:function(e,t){this.refreshRule(e,t),this.bus.$emit("change-"+e.field,t)},refreshRule:function(e,t,n){this.refreshControl(e)&&(this.$render.clearCacheAll(),this.loadRule(),this.bus.$emit("update",this.api),this.refresh()),this.refreshUpdate(e,t,n)},appendLink:function(e){var t=this,n=e.rule.link;U.trueArray(n)&&n.forEach((function(n){var r=function(){return t.refreshRule(e,e.rule.value,"link")};t.bus.$on("change-"+n,r),e.linkOn.push((function(){return t.bus.$off("change-"+n,r)}))}))},fields:function(){return Object.keys(this.fieldCtx)}})}(Ge),function(e){L(e.prototype,{getCtx:function(e){return this.getFieldCtx(e)||this.getNameCtx(e)[0]||this.ctxs[e]},getCtxs:function(e){return this.fieldCtx[e]||this.nameCtx[e]||(this.ctxs[e]?[this.ctxs[e]]:[])},setIdCtx:function(e,t,n){var r="".concat(n,"Ctx");this[r][t]?this[r][t].push(e):this[r][t]=[e]},rmIdCtx:function(e,t,n){var r="".concat(n,"Ctx"),i=this[r][t];if(!i)return!1;var o=i.splice(i.indexOf(e)>>>0,1).length>0;return i.length||delete this[r][t],o},getFieldCtx:function(e){return(this.fieldCtx[e]||[])[0]},getNameCtx:function(e){return this.nameCtx[e]||[]},setCtx:function(e){var t=e.id,n=e.field,r=e.name,i=e.rule;this.ctxs[t]=e,r&&this.setIdCtx(e,r,"name"),e.input&&(this.setIdCtx(e,n,"field"),this.setFormData(e,e.parser.toFormValue(i.value,e)),this.isMounted&&!this.reloading&&this.vm.emit("change",e.field,i.value,e.origin,this.api))},getParser:function(e){var t=this.fc.parsers;return t[e.originType]||t[Ae(e.type)]||t[e.trueType]||qe},bindParser:function(e){e.setParser(this.getParser(e))},getType:function(e){var t=this.fc.CreateNode.aliasMap,n=t[e]||t[Ae(e)]||e;return Ae(n)},noWatch:function(e){this.noWatchFn||(this.noWatchFn=e),me(e),this.noWatchFn===e&&(this.noWatchFn=null)},watchCtx:function(e){var t=this;if(z().filter((function(e){return"_"!==e[0]&&"$"!==e[0]&&-1===Je.indexOf(e)})).forEach((function(n){var r=h(e.rule,n),i="children"===n;e.refRule[n]=r,e.watch.push(f(i?function(){return U.Function(r.value)?r.value:w(r.value||[])}:function(){return r.value},(function(o,a){var u=r.value;if(!t.isBreakWatch()){if(i&&!1===e.parser.loadChildren)return t.$render.clearCache(e),void t.nextRefresh();t.watching=!0,"link"!==n?(["props","on","deep"].indexOf(n)>-1?(t.parseInjectEvent(e.rule,u||{}),"props"===n&&e.input&&t.setFormData(e,e.parser.toFormValue(e.rule.value,e))):"emit"===n?t.parseEmit(e):["prefix","suffix"].indexOf(n)>-1?u&&t.loadFn(u,e.rule):"type"===n?(e.updateType(),t.bindParser(e)):i&&(U.Function(a)&&(a=e.getPending("children",[])),U.Function(u)&&(u=e.loadChildrenPending()),t.updateChildren(e,u,a)),t.$render.clearCache(e),t.refresh(),t.watching=!1):e.link()}}),{deep:!i,sync:i}))})),e.input){var n=h(e.rule,"value");e.watch.push(f((function(){return n.value}),(function(){var r=e.parser.toFormValue(n.value,e);t.isChange(e,r)&&t.setValue(e,n.value,r,!0)}))),this.bus.$once("load-end",(function(){var n=e.rule.computed;n&&("object"!==$(n)&&(n={value:n}),Object.keys(n).forEach((function(r){e.watch.push(f((function(){var i=n[r];if(i){var o;if(U.Function(i))o=function(){return i(t.api.form,t.api)};else{var a=e.getParentGroup();o=function(){return new Function("formulas","top","group","with(top){with(this){with(group){with(formulas){ return ".concat(i," }}}}")).call(t.api.form,t.fc.formulas,t.api.top.form,a&&t.subRuleData[a.id]||{})}}return me(o,void 0)}}),(function(t){De(e.rule,r,t)}),{immediate:!0}))})))}))}this.watchEffect(e)},updateChildren:function(e,t,n){var r=this;this.deferSyncValue((function(){n&&n.forEach((function(n){-1===(t||[]).indexOf(n)&&n&&!U.String(n)&&n.__fc__&&n.__fc__.parent===e&&n.__fc__.root!==t&&r.rmCtx(n.__fc__)})),U.trueArray(t)&&(r.loadChildren(t,e),r.bus.$emit("update",r.api))}))},rmSub:function(e){var t=this;U.trueArray(e)&&e.forEach((function(e){e&&e.__fc__&&t.rmCtx(e.__fc__)}))},rmCtx:function(e){var t=this;if(!e.deleted){var n=e.id,r=e.field,i=e.input,o=e.name;N(this.ctxs,n),N(this.formData,n),N(this.subForm,n),N(this.vm.setupState.ctxInject,n);var a=e.getParentGroup();a&&this.subRuleData[a.id]&&N(this.subRuleData[a.id],r),e.group&&N(this.subRuleData,n),i&&this.rmIdCtx(e,r,"field"),o&&this.rmIdCtx(e,o,"name"),i&&!B(this.fieldCtx,r)&&N(this.form,r),this.deferSyncValue((function(){if(!t.reloading){if(!1!==e.parser.loadChildren){var n=e.getPending("children",e.rule.children);U.trueArray(n)&&n.forEach((function(e){return e.__fc__&&t.rmCtx(e.__fc__)}))}e.root===t.rules&&t.vm.setupState.renderRule()}}),i);var u=this.sort.indexOf(n);return u>-1&&this.sort.splice(u,1),this.$render.clearCache(e),e.delete(),this.effect(e,"deleted"),i&&!this.fieldCtx[r]&&this.vm.emit("remove-field",r,e.rule,this.api),e.rule.__ctrl||this.vm.emit("remove-rule",e.rule,this.api),e}}})}(Ge),function(e){L(e.prototype,{mounted:function(){var e=this,t=function(){e.isMounted=!0,e.lifecycle("mounted")};this.pageEnd?t():this.bus.$once("page-end",t)},lifecycle:function(e){var t=this,n=this.options[e];U.Function(n)&&me((function(){return n(t.api)})),this.vm.emit(e,this.api)}})}(Ge),function(e){L(e.prototype,{useProvider:function(){var e=this,t=this.fc.providers;Object.keys(t).forEach((function(n){var r=t[n];U.Function(r)&&(r=r(e.fc)),r._c=function(e){var t=e.components;if(Array.isArray(t)){var n=function(e){return e.filter((function(e,t,n){return n.indexOf(e,0)===t}))}(t.filter((function(e){return"*"!==e})));return!!n.length&&n}return!!U.String(t)&&[t]}(r),e.onEffect(r),e.providers[n]=r}))},onEffect:function(e){var t=this,n=[];(e._c||["*"]).forEach((function(r){var i="*"===r?"*":t.getType(r);n.indexOf(i)>-1||(n.push(i),t.bus.$on("p:".concat(e.name,":").concat(i,":").concat(e.input?1:0),(function(t,n){e[t]&&e[t].apply(e,w(n))})))})),e._used=n},watchEffect:function(e){var t=this,n={required:function(){var t,n;return(B(e.rule,"$required")?e.rule.$required:null===(t=e.rule)||void 0===t||null===(n=t.effect)||void 0===n?void 0:n.required)||!1}};Object.keys(e.rule.effect||{}).forEach((function(t){n[t]=function(){return e.rule.effect[t]}})),Object.keys(e.rule).forEach((function(t){"$"===t[0]&&(n[t.substr(1)]=function(){return e.rule[t]})})),Object.keys(n).forEach((function(r){e.watch.push(f(n[r],(function(n){t.effect(e,"watch",E({},r,n))}),{deep:!0}))}))},ruleEffect:function(e,t,n){this.emitEffect({rule:e,input:!!e.field,type:this.getType(e.type)},t,n)},effect:function(e,t,n){this.emitEffect({rule:e.rule,input:e.input,type:e.trueType,ctx:e,custom:n},t)},getEffect:function(e,t){return B(e,"$"+t)?e["$"+t]:B(e,"effect")&&B(e.effect,t)?e.effect[t]:void 0},emitEffect:function(e,t,n){var r=this,i=e.ctx,o=e.rule,a=e.input,u=e.type,c=e.custom;if(u&&!(["fcFragment","fragment"].indexOf(u)>-1)){var f=c||Object.keys(o).reduce((function(e,t){return"$"===t[0]&&(e[t.substr(1)]=o[t]),e}),O({},o.effect||{}));Object.keys(f).forEach((function(e){var c=r.providers[e];if(c&&(!c.input||a)){var s;if(c._c){if(!(c._used.indexOf(u)>-1))return;s=u}else s="*";var l=O({value:f[e],getValue:function(){return r.getEffect(o,e)}},n||{});i&&(l.getProp=function(){return i.effectData(e)},l.clearProp=function(){return i.clearEffectData(e)},l.mergeProp=function(e){return de(l.getProp(),[e])},l.id=i.id),r.bus.$emit("p:".concat(e,":").concat(s,":").concat(c.input?1:0),t,[l,o,r.api])}}))}}})}(Ge);var We=e({name:"fcFragment",inheritAttrs:!1,props:["vnode"],render:function(){return this.vnode}});function He(e,t){var n=e.directives;return n?(Array.isArray(n)||(n=[n]),y(t,n.reduce((function(e,t){return e.concat(function(e){return Object.keys(e).map((function(t){var n=e[t],r=g(t);if(r)return[r,n.value,n.arg,n.modifiers]})).filter((function(e){return!!e}))}(t))}),[]))):t}function Xe(){var e={};function n(){}return L(n.prototype,{make:function(e,t,n){return He(t,this.h(e,ge(t),n))},makeComponent:function(e,t,n){try{return He(t,v(e,ge(t),n))}catch(e){return console.error(e),v("")}},h:function(e,n,r){var i=t().appContext.config.isNativeTag(e);i&&delete n.formCreateInject;try{return v(i?e:m(e),n,r)}catch(e){return console.error(e),v("")}},aliasMap:e}),L(n,{aliasMap:e,alias:function(t,n){e[t]=n},use:function(e){Object.keys(e).forEach((function(t){var r,i=ne(t),o=(r=t,null==r?"":"object"===$(r)?JSON.stringify(r,null,2):String(r)).toLocaleLowerCase(),a=e[t];[t,i,o].forEach((function(e){n.alias(t,a),n.prototype[e]=function(e,t){return this.make(a,e,t)}}))}))}}),n}function Ke(e){var t=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&F(e,t)}(n,Qe);var t=A(n);function n(){return S(this,n),t.apply(this,arguments)}return n}();return Object.assign(t.prototype,e),t}function Qe(e){L(this,{$handle:e,vm:e.vm,options:{},ref:"fcForm",mergeOptionsRule:{normal:["form","row","info","submitBtn","resetBtn"]}}),this.updateKey(),this.init()}L(Qe.prototype,{__init:function(){var e=this;this.$render=this.$handle.$render,this.$r=function(){var t;return(t=e.$render).renderRule.apply(t,arguments)}},updateKey:function(){this.key=Pe()},init:function(){},update:function(){},beforeRender:function(){},form:function(){return this.vm.refs[this.ref]},getSlot:function(e){return function t(n){if(n){var r=n.slots[e];return r||t(n.setupState.parent)}}(this.vm)},mergeOptions:function(e,t){var n=this;return W(e.map((function(e){return n.tidyOptions(e)})),t,this.mergeOptionsRule)},updateOptions:function(e){this.options=this.mergeOptions([e],this.getDefaultOptions()),this.update()},tidyOptions:function(e){return e},tidyRule:function(e){},mergeProp:function(e){},getDefaultOptions:function(){return{}},render:function(e){}});var ze={name:"componentValidate",load:function(e,t,n){var r=e.getValue();r?e.getProp().validate=[{validator:function(){var i=ve(t);if(i){for(var o=arguments.length,a=new Array(o),u=0;u<o;u++)a[u]=arguments[u];return n.exec.apply(n,[i.id,!0===r?"formCreateValidate":r].concat(a,[{attr:e,rule:t,api:n}]))}}}]:(e.clearProp(),n.clearValidateState([t.field]))},watch:function(){ze.load.apply(ze,arguments)}},Ze={fetch:function(e){function t(t,n,r){var i=t.value;U.Function(i)&&(i=i(n,r)),i=function(e){return U.String(e)&&(e={action:e,to:"options"}),e}(i);var o=function(e){void 0===e?t.clearProp():De(t.getProp(),i.to||"options",e),r.sync(n)};if(i&&(i.action||i.key)){if(i.to||(i.to="options"),i.key){var a=e.$handle.options.globalData[i.key];if(!a)return void o(void 0);if("static"===a.type)return void o(a.data);i=O(O({},i),a)}var u=i.onError,c=function(){if(!t.getValue())return t.clearProp(),r.sync(n),!0},f=O(O({headers:{}},i),{},{onSuccess:function(e,t){if(!c()){var a=function(e){return t?e:e.data},u=ue(i.parse);U.Function(u)?a=u:u&&U.String(u)&&(a=function(e){return u.split(".").forEach((function(t){e&&(e=e[t])})),e}),o(a(e,n,r)),r.sync(n)}},onError:function(e){o(void 0),c()||(u||function(e){return te(e.message||"fetch fail "+i.action)})(e,n,r)}});e.$handle.options.beforeFetch&&me((function(){return e.$handle.options.beforeFetch(f,{rule:n,api:r})})),U.Function(i.action)?i.action(n,r).then((function(e){f.onSuccess(e,!0)})).catch((function(e){f.onError(e)})):me((function(){return e.create.fetch(f,{inject:t,rule:n,api:r})}))}else o(void 0)}return{name:"fetch",loaded:function(){t.apply(void 0,arguments)},watch:function(){t.apply(void 0,arguments)}}},loadData:function(e){var t={name:"loadData",_fn:[],created:function(t,n,r){this.deleted(t);var i=P(t.getValue()),o=[];i.forEach((function(i){if(i){var a=function o(){!1!==i.watch&&(e.bus.$off("p.loadData."+i.attr,o),e.bus.$once("p.loadData."+i.attr,o));var a=void 0;i.attr&&(a=e.loadData[i.attr]||i.default,i.copy&&(a=Y(a))),De(t.getProp(),i.to||"options",a),r.sync(n)};o.push((function(){return e.bus.$off("p.loadData."+i.attr,a)})),a()}})),this._fn[t.id]=o},deleted:function(e){this._fn[e.id]&&this._fn[e.id].forEach((function(e){e()})),e.clearProp()}};return t.watch=t.created,t},componentValidate:ze};function Ye(e){e=e||new Map;var t={$on:function(t,n){var r=e.get(t);r&&r.push(n)||e.set(t,[n])},$once:function(e,n){n._once=!0,t.$on(e,n)},$off:function(t,n){var r=e.get(t);r&&r.splice(r.indexOf(n)>>>0,1)},$emit:function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];(e.get(n)||[]).slice().map((function(e){e._once&&(t.$off(n,e),delete e._once),e.apply(void 0,i)})),(e.get("*")||[]).slice().map((function(e){e(n,i)}))}};return t}var et={name:"html",loadChildren:!1,render:function(e,t){return t.prop.props.innerHTML=e.default(),t.vNode.make(t.prop.props.tag||"div",t.prop)},renderChildren:function(e){return{default:function(){return e.filter((function(e){return U.String(e)})).join("")}}}};function tt(e,t){var n;return 2===arguments.length?t=(n=arguments[1])[e]:n=arguments[2],{id:t,prop:n}}function nt(){return tt.apply(void 0,["name"].concat(Array.prototype.slice.call(arguments)))}var rt=1,it={};function ot(e){var t,n=E({},We.name,We),r={},i={},a={},u=[],c=O({},Ze),s=Se(),l={global:{}},d={},h=Xe(),v={};function m(e){var t=it[e];return Array.isArray(t)?t.map((function(e){return e.api()})):t?t.api():void 0}function y(e){u.push(e)}function g(){var e=nt.apply(void 0,arguments);e.id&&e.prop&&(i[e.id]=e.prop)}function C(){var e=nt.apply(void 0,arguments);e.id&&e.prop&&(c[e.id]=O(O({},e.prop),{},{name:e.id}))}function $(e){h.use(e)}function S(){var e=nt.apply(void 0,arguments);if(!e.id||!e.prop)return qe;var t=Ae(e.id),n=e.prop,i=!0===n.merge?r[t]:void 0;r[t]=be(n,i||qe),s[t]=_e(t),n.maker&&L(s,n.maker)}function j(e,t){var i;if(U.String(e)){if(i=e,void 0===t)return n[i]}else i=e.displayName||e.name,t=e;if(i&&t){var o=Ae(i);n[i]=t,n[o]=t,delete h.aliasMap[i],delete h.aliasMap[o],delete r[i],delete r[o],t.formCreateParser&&S(i,t.formCreateParser)}}function F(){return V(B,n,i)}function R(){return We}function A(e,t){return U.Function(e.install)?e.install(k,t):U.Function(e)&&e(k,t),this}function k(e,t){var n=function(e,t){var n=F();return b({data:function(){return o({rule:e,option:t})},render:function(){return _(n,O({ref:"fc"},this.$data))}})}(e,t||{});u.forEach((function(e){me((function(){return e(k,n)}))}));var r=document.createElement("div");return((null==t?void 0:t.el)||document.body).appendChild(r),n.mount(r).$refs.fc.fapi}function P(t){var o=O({},e);return t?o.inherit={components:n,parsers:r,directives:i,modelFields:a,providers:c,useApps:u,maker:s,formulas:v,loadData:d}:delete o.inherit,ot(o)}function D(e,t){a[e]=t}function T(e,t){v[e]=t}function N(e){Object.keys(it).forEach((function(t){(Array.isArray(it[t])?it[t]:[it[t]]).forEach((function(t){t.bus.$emit("p.loadData."+e)}))}))}function I(e,t){d[e]=t,N(e)}function M(e){delete d[e],N(e)}function B(t){var o=this;L(this,{id:rt++,create:k,vm:t,manager:Ke(e.manager),parsers:r,providers:c,modelFields:a,formulas:v,rules:t.props.rule,name:t.props.name||Pe(),inFor:t.props.inFor,prop:{components:n,directives:i},loadData:d,CreateNode:h,bus:new Ye,unwatch:null,options:x({}),extendApi:e.extendApi||function(e){return e}}),p((function(){f(o.options,(function(){o.$handle.$manager.updateOptions(o.options.value),o.api().refresh()}),{deep:!0})})),L(t.appContext.components,n),L(t.appContext.directives,i),this.$handle=new Ge(this),this.name&&(this.inFor?(it[this.name]||(it[this.name]=[]),it[this.name].push(this)):it[this.name]=this)}function q(t){L(t,{version:e.version,ui:e.ui,setData:I,removeData:M,maker:s,component:j,directive:g,setModelField:D,setFormula:T,register:C,$vnode:R,parser:S,use:A,factory:P,componentAlias:$,copyRule:se,copyRules:le,fetch:je,$form:F,parseFn:ue,parseJson:ce,toJson:oe,useApp:y,getApi:m})}if(function(e){var t=e.key||[],n=e.array||[],r=e.normal||[];X.push.apply(X,w(t)),K.push.apply(K,w(n)),Q.push.apply(Q,w(r)),Ce([].concat(w(t),w(n),w(r)))}(e.attrs||{}),L(B.prototype,{init:function(){var e=this;this.isSub()&&(this.unwatch=f((function(){return e.vm.setupState.parent.setupState.fc.options.value}),(function(){e.initOptions(),e.$handle.api.refresh()}),{deep:!0})),this.initOptions(),this.$handle.init()},isSub:function(){return this.vm.setupState.parent&&this.vm.props.extendOption},initOptions:function(){this.options.value={};var e=O({formData:{},submitBtn:{},resetBtn:{},globalEvent:{},globalData:{}},Y(l));this.isSub()&&(e=this.mergeOptions(e,this.vm.setupState.parent.setupState.fc.options.value||{},!0)),e=this.mergeOptions(e,this.vm.props.option),this.updateOptions(e)},mergeOptions:function(e,t,n){return t=Y(t),n&&["page","onSubmit","mounted","reload","formData","el"].forEach((function(e){delete t[e]})),t.global&&(e.global=function(e,t){return e?(Object.keys(t||{}).forEach((function(n){t[n]&&(e[n]=de(e[n]||{},t[n]))})),e):t}(e.global,t.global),delete t.global),this.$handle.$manager.mergeOptions([t],e),e},updateOptions:function(e){this.options.value=this.mergeOptions(this.options.value,e),this.$handle.$manager.updateOptions(this.options.value)},api:function(){return this.$handle.api},render:function(){return this.$handle.render()},mounted:function(){this.$handle.mounted()},unmount:function(){if(this.name)if(this.inFor){var e=it[this.name].indexOf(this);it[this.name].splice(e,1)}else delete it[this.name];this.unwatch&&this.unwatch(),this.$handle.reloadRule([])},updated:function(){var e=this;this.$handle.bindNextTick((function(){return e.bus.$emit("next-tick",e.$handle.api)}))}}),q(k),L(t=k,{create:k,install:function(e,n){if(l=O(O({},l),n||{}),!0!==e._installedFormCreate){e._installedFormCreate=!0;var r=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return k(e,t)};q(r),e.config.globalProperties.$formCreate=r,e.component("FormCreate",F()),u.forEach((function(n){me((function(){return n(t,e)}))}))}}}),h.use({fragment:"fcFragment"}),e.install&&k.use(e),y((function(e,t){t.mixin({props:["formCreateInject"]})})),S(et),e.inherit){var J=e.inherit;J.components&&L(n,J.components),J.parsers&&L(r,J.parsers),J.directives&&L(i,J.directives),J.modelFields&&L(a,J.modelFields),J.providers&&L(c,J.providers),J.useApps&&L(u,J.useApps),J.maker&&L(s,J.maker),J.loadData&&L(d,J.loadData),J.formulas&&L(v,J.formulas)}return k}export{xe as Creator,Qe as Manager,se as copyRule,le as copyRules,_e as creatorFactory,ot as default,We as fragment,de as mergeRule,ce as parseJson,oe as toJson};
import{defineComponent as e,getCurrentInstance as t,provide as n,inject as r,toRefs as i,reactive as o,onBeforeMount as a,onMounted as u,onBeforeUnmount as c,onUpdated as f,watch as s,markRaw as l,isVNode as d,computed as p,nextTick as h,toRef as v,createVNode as m,resolveComponent as y,withDirectives as g,resolveDirective as b,createApp as _,h as C,ref as x}from"vue";function O(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){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?O(Object(n),!0).forEach((function(t){j(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function E(e){return E="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},E(e)}function S(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function j(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function F(e){return F=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},F(e)}function R(e,t){return R=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},R(e,t)}function A(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 w(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=F(e);if(t){var i=F(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return A(this,n)}}function k(e){return function(e){if(Array.isArray(e))return P(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return P(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return P(e,t)}(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 P(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}function D(e){return Array.isArray(e)?e:[null,void 0,""].indexOf(e)>-1?[]:[e]}function V(e){var t=e.replace(/([A-Z])/g,"-$1").toLocaleLowerCase();return 0===t.indexOf("-")&&(t=t.substr(1)),t}var T={type:function(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"},Undef:function(e){return null==e},Element:function(e){return"object"===E(e)&&null!==e&&1===e.nodeType&&!T.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 N(e,t){return{}.hasOwnProperty.call(e,t)}function I(e,t,n){e[t]=n}function L(e,t){delete e[t]}function M(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 o=t[i];if((r=Array.isArray(o))||T.Object(o)){var a=void 0===e[i];if(r)r=!1,a&&I(e,i,[]);else if(o._clone&&void 0!==n){if(!n){I(e,i,o._clone());continue}o=o.getRule(),a&&I(e,i,{})}else a&&I(e,i,{});e[i]=M(e[i],o,n)}else I(e,i,o),T.Undef(o)||(T.Undef(o.__json)||(e[i].__json=o.__json),T.Undef(o.__origin)||(e[i].__origin=o.__origin))}return void 0!==n&&Array.isArray(e)?e.filter((function(e){return!e||!e.__ctrl})):e}function B(e){return M({},{value:e}).value}["Date","Object","String","Boolean","Array","Number"].forEach((function(e){T[e]=function(t){return T.type(t,e)}}));var U=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)&&I(e,r,t[r]);return e};function q(){return U.apply(this,arguments)}function J(e){return"object"!==E(e)||null===e?e:e instanceof Array?k(e):$({},e)}function G(e,t,n){return"[form-create ".concat(e,"]: ").concat(t)+(n?"\n\nrule: "+JSON.stringify(n.getRule?n.getRule():n):"")}function W(e,t){console.error(G("err",e,t))}var H="[[FORM-CREATE-PREFIX-",X="-FORM-CREATE-SUFFIX]]";function K(e,t){return JSON.stringify(M(Array.isArray(e)?[]:{},e,!0),(function(e,t){if(!t||!0!==t._isVue){if("function"!==E(t))return t;if(t.__json)return t.__json;if(t.__origin&&(t=t.__origin),!t.__emit)return H+t+X}}),t)}function Q(e){return new Function("return "+e)()}function z(e,t){if(e&&T.String(e)&&e.length>4){var n=e.trim(),r=!1;try{if(n.indexOf(X)>0&&0===n.indexOf(H))n=n.replace(X,"").replace(H,""),r=!0;else if(0===n.indexOf("$FN:"))n=n.replace("$FN:",""),r=!0;else{if(0===n.indexOf("$GLOBAL:")){var i=n.replace("$GLOBAL:","");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=Q("function($inject){"+n.replace("$FNX:","")+"}")).__json=e,n.__inject=!0,n;t||0!==n.indexOf("function")||"function"===n||(r=!0)}if(!r)return e;var o=Q(-1===n.indexOf("function")&&0!==n.indexOf("(")?"function "+n:n);return o.__json=e,o}catch(e){return void W("解析失败:".concat(n,"\n\nerr: ").concat(e))}}return e}function Z(e,t){return JSON.parse(e,(function(e,n){return T.Undef(n)||!n.indexOf?n:z(n,t)}))}var Y=0;function ee(){var e=370+ ++Y;return"F"+Math.random().toString(36).substr(3,3)+Number("".concat(Date.now())).toString(36)+e.toString(36)+"c"}function te(e,t,n){var r,i=e;return(t||"").split(".").forEach((function(e){r&&(i[r]&&"object"==E(i[r])||(i[r]={}),i=i[r]),r=e})),i[r]=n,i}var ne=function e(t,n){if(t&&t!==n)return t.props.formCreateInject?t.props.formCreateInject:t.parent?e(t.parent,n):void 0};function re(d,p,h){return e({name:"FormCreate",components:p,directives:h,props:{rule:{type:Array,required:!0,default:function(){return[]}},option:{type:Object,default:function(){return{}}},extendOption:Boolean,modelValue:Object,disabled:{type:Boolean,default:void 0},api:Object,name:String,subForm:{type:Boolean,default:!0},inFor:Boolean},emits:["update:api","update:modelValue","mounted","submit","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 p=t();n("parentFC",p);var h=r("parentFC",null),v=i(e),m=v.rule,y=v.modelValue,g=v.subForm,b=v.inFor,_=o({ctxInject:{},destroyed:!1,isShow:!0,unique:1,renderRule:k(m.value||[]),updateValue:JSON.stringify(y.value||{})}),C=new d(p),x=C.api(),O=b.value,E=function(){var e=ne(p,h);if(e)if(O){var t=D(e.getSubForm()),n=t.indexOf(x);n>-1&&t.splice(n,1)}else e.subForm()},S=null;return a((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+=V(t)+":"+n[e].style[t]+";"})),n[e].content&&(r+=n[e].content+";"),r&&(t+=".".concat(e,"{").concat(r,"}"))})),t&&((S=document.createElement("style")).type="text/css",S.innerHTML=t,document.head.appendChild(S))})),u((function(){C.mounted()})),c((function(){S&&document.head.removeChild(S),E(),_.destroyed=!0,C.unmount()})),f((function(){C.updated()})),s(g,(function(e){e?function(){if(h){var e,t=ne(p,h);t&&(O?(e=D(t.getSubForm())).push(x):e=x,t.subForm(e))}}():E()}),{immediate:!0}),s((function(){return k(m.value)}),(function(e){C.$handle.isBreakWatch()||e.length===_.renderRule.length&&e.every((function(e){return _.renderRule.indexOf(e)>-1}))||(C.$handle.reloadRule(m.value),p.setupState.renderRule())})),s((function(){return e.option}),(function(){C.initOptions(),x.refresh()}),{deep:!0}),s((function(){return e.disabled}),(function(){x.refresh()})),s(y,(function(e){JSON.stringify(e||{})!==_.updateValue&&(x.config.forceCoverValue?x.coverValue(e||{}):x.setValue(e||{}))}),{deep:!0}),$($({fc:l(C),parent:h?l(h):h,fapi:l(x)},i(_)),{},{refresh:function(){++_.unique},renderRule:function(){_.renderRule=k(m.value||[])},updateValue:function(e){if(!_.destroyed){var t=JSON.stringify(e);_.updateValue!==t&&(_.updateValue=t,p.emit("update:modelValue",e))}}})},created:function(){var e=t();e.emit("update:api",e.setupState.fapi),e.setupState.fc.init()}})}var ie=["props"],oe=["class","style","directives"],ae=["on"],ue=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(ie,k(r.normal||[])),o=[].concat(oe,k(r.array||[])),a=[].concat(ae,k(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]=$($({},t[r]),n[r]);else if(o.indexOf(r)>-1){var c=t[r]instanceof Array?t[r]:[t[r]],f=n[r]instanceof Array?n[r]:[n[r]];t[r]=[].concat(k(c),k(f))}else if(a.indexOf(r)>-1)for(var s in n[r])if(t[r][s]){var l=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(k(l),k(d))}else t[r][s]=n[r][s];else if("hook"===r)for(var p in n[r])t[r][p]?t[r][p]=ce(t[r][p],n[r][p]):t[r][p]=n[r][p];else t[r]=n[r];else i.indexOf(r)>-1||a.indexOf(r)>-1||u.indexOf(r)>-1?t[r]=$({},n[r]):o.indexOf(r)>-1?t[r]=n[r]instanceof Array?k(n[r]):"object"===E(n[r])?$({},n[r]):n[r]:t[r]=n[r];return t}),n)},ce=function(e,t){return function(){e&&e.apply(this,arguments),t&&t.apply(this,arguments)}},fe=["type","slot","emitPrefix","value","name","native","hidden","display","inject","options","emit","link","prefix","suffix","update","sync","optionsTo","key","slotUpdate","computed","preview","component","cache","modelEmit"],se=["validate","children","control"],le=["effect"];function de(){return[].concat(fe,k(ie),k(oe),k(ae),se,le)}function pe(e,t){return{value:e,enumerable:!1,configurable:!1,writable:!!t}}function he(e,t){return ve([e],t||!1)[0]}function ve(e,t){return M([],k(e),t||!1)}function me(e,t){return ue(Array.isArray(t)?t:[t],e,{array:se,normal:le}),e}function ye(e){var t=T.Function(e.getRule)?e.getRule():e;return t.type||(t.type="input"),t}function ge(e,t){Object.defineProperties(e,Object.keys(t).reduce((function(e,n){return e[n]={get:function(){return t[n]()}},e}),{}))}function be(e){return e.__fc__||(e.__origin__?e.__origin__.__fc__:null)}function _e(e,t){try{t=e()}catch(e){!function(e){W(e.toString()),console.error(e)}(e)}return t}function Ce(){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,k(e));else if(T.Function(e)){var t=e.apply(void 0,k(r||[]));Array.isArray(t)?i.push.apply(i,k(t)):i.push(t)}else T.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=T.Function(e.getSlots)?e.getSlots():e;return Array.isArray(e)||d(e)?this.setSlot(void 0,(function(){return e})):Object.keys(n).forEach((function(e){t.setSlot(e,n[e])})),this}}}function xe(e){var t=$({},e.props||{});return Object.keys(e.on||{}).forEach((function(n){var r,i="on".concat((r=n).replace(r[0],r[0].toLocaleUpperCase()));Array.isArray(t[i])?t[i]=[].concat(k(t[i]),[e.on[n]]):t[i]?t[i]=[t[i],e.on[n]]:t[i]=e.on[n]})),t.key=e.key,t.ref=e.ref,t.class=e.class,t.style=e.style,t.slot&&delete t.slot,t}function Oe(e,t){return Object.setPrototypeOf(e,t),e}function $e(e,t){return function(n,r,i){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=new Ee(e,n,r,i,o);return t&&(T.Function(t)?t(a):a.props(t)),a}}function Ee(e,t,n,r,i){this._data=q({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 Se(e){e.forEach((function(e){Ee.prototype[e]=function(t){return me(this._data,j({},e,arguments.length<2?t:j({},t,arguments[1]))),this}}))}q(Ee.prototype,{getRule:function(){return this._data},setProp:function(e,t){return I(this._data,e,t),this},modelField:function(e){return this._data.modelField=e,this},_clone:function(){var e=new this.constructor;return e._data=he(this._data),e}}),Se(de());var je=$e("");function Fe(e,t,n){var r=je("",t);return r._data.type=e,r._data.title=n,r}function Re(){return{create:Fe,factory:$e}}function Ae(e){var t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch(e){return t}}function we(e){if("undefined"!=typeof XMLHttpRequest){var t,n=new XMLHttpRequest,r=e.action;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),Ae(n));e.onSuccess(Ae(n))},n.open(e.method||"get",r,!0),e.data&&("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.withCredentials&&"withCredentials"in n&&(n.withCredentials=!0);var i=e.headers||{};Object.keys(i).forEach((function(e){null!==i[e]&&n.setRequestHeader(e,i[e])})),n.send(t)}}function ke(e){return B(e)}function Pe(e){function t(t){return T.Undef(t)?t=e.fields():Array.isArray(t)||(t=[t]),t}function n(n,r,i){t(n).forEach((function(t){e.getCtxs(t).forEach((function(t){I(t.rule,r,i),e.$render.clearCache(t)}))}))}function r(){var t=e.subForm;return Object.keys(t).reduce((function(e,n){var r=t[n];return r?(Array.isArray(r)?e.push.apply(e,k(r)):e.push(r),e):e}),[])}var i={get config(){return e.options},set config(t){e.fc.options.value=t},get options(){return e.options},set options(t){e.fc.options.value=t},get form(){return e.form},get rule(){return e.rules},get parent(){return e.vm.setupState.parent&&e.vm.setupState.parent.setupState.fapi},get top(){return i.parent?i.parent.top:i},get children(){return r()},formData:function(n){return t(n).reduce((function(t,n){var r=e.getFieldCtx(n);return r?(t[r.field]=ke(r.rule.value),t):t}),{})},getValue:function(t){var n=e.getFieldCtx(t);if(n)return ke(n.rule.value)},coverValue:function(t){var n=$({},t||{});e.deferSyncValue((function(){i.fields().forEach((function(r){var i=e.fieldCtx[r];if(i){var o=N(t,r);i.forEach((function(e){e.rule.value=o?t[r]:void 0})),delete n[r]}})),q(e.appendData,n)}))},setValue:function(t){var n=t;arguments.length>=2&&(n=j({},t,arguments[1])),e.deferSyncValue((function(){Object.keys(n).forEach((function(t){var r=e.fieldCtx[t];if(!r)return e.appendData[t]=n[t];r.forEach((function(e){e.rule.value=n[t]}))}))}))},removeField:function(t){var n=e.getCtx(t);return e.deferSyncValue((function(){e.getCtxs(t).forEach((function(e){e.rm()}))}),!0),n?n.origin:void 0},removeRule:function(e){var t=e&&be(e);if(t)return t.rm(),t.origin},fields:function(){return e.fields()},append:function(t,n,r){var i,o=e.sort.length-1,a=e.getCtx(n);if(a)if(r){if(i=a.getPending("children",a.rule.children),!Array.isArray(i))return;o=a.rule.children.length-1}else o=a.root.indexOf(a.origin),i=a.root;else i=e.rules;i.splice(o+1,0,t)},prepend:function(t,n,r){var i,o=0,a=e.getCtx(n);if(a)if(r){if(i=a.getPending("children",a.rule.children),!Array.isArray(i))return}else o=a.root.indexOf(a.origin),i=a.root;else i=e.rules;i.splice(o,0,t)},hidden:function(t,r){n(r,"hidden",!!t),e.refresh()},hiddenStatus:function(t){var n=e.getCtx(t);if(n)return!!n.rule.hidden},display:function(t,r){n(r,"display",!!t),e.refresh()},displayStatus:function(t){var n=e.getCtx(t);if(n)return!!n.rule.display},disabled:function(n,r){t(r).forEach((function(t){e.getCtxs(t).forEach((function(e){I(e.rule.props,"disabled",!!n)}))})),e.refresh()},all:function(t){return Object.keys(e.ctxs).map((function(n){var r=e.ctxs[n];return t?r.origin:r.rule}))},model:function(t){return e.fields().reduce((function(n,r){var i=e.fieldCtx[r][0];return n[r]=t?i.origin:i.rule,n}),{})},component:function(t){return Object.keys(e.nameCtx).reduce((function(n,r){var i=e.nameCtx[r].map((function(e){return t?e.origin:e.rule}));return n[r]=1===i.length?i[0]:i,n}),{})},bind:function(){return i.form},reload:function(t){e.reloadRule(t)},updateOptions:function(t){e.fc.updateOptions(t),i.refresh()},onSubmit:function(e){i.updateOptions({onSubmit:e})},sync:function(t){if(Array.isArray(t))t.forEach((function(e){return i.sync(e)}));else{var n=T.Object(t)?be(t):e.getCtxs(t);n&&((n=Array.isArray(n)?n:[n]).forEach((function(t){if(!t.deleted){var n=e.subForm[t.id];n&&(Array.isArray(n)?n.forEach((function(e){e.refresh()})):n&&n.refresh()),e.$render.clearCache(t)}})),e.refresh())}},refresh:function(){r().forEach((function(e){e.refresh()})),e.$render.clearCacheAll(),e.refresh()},refreshOptions:function(){e.$manager.updateOptions(e.options),i.refresh()},hideForm:function(t){e.vm.setupState.isShow=!t},changeStatus:function(){return e.changeStatus},clearChangeStatus:function(){e.changeStatus=!1},updateRule:function(t,n){e.getCtxs(t).forEach((function(e){q(e.rule,n)}))},updateRules:function(e){Object.keys(e).forEach((function(t){i.updateRule(t,e[t])}))},mergeRule:function(t,n){e.getCtxs(t).forEach((function(e){me(e.rule,n)}))},mergeRules:function(e){Object.keys(e).forEach((function(t){i.mergeRule(t,e[t])}))},getRule:function(t,n){var r=e.getCtx(t);if(r)return n?r.origin:r.rule},getRenderRule:function(t){var n=e.getCtx(t);if(n)return n.prop},getRefRule:function(t){var n=e.getCtxs(t);if(n){var r=n.map((function(e){return e.rule}));return 1===r.length?r[0]:r}},setEffect:function(t,n,r){var i=e.getCtx(t);i&&n&&("$"===n[0]&&(n=n.substr(1)),N(i.rule,"$"+n)&&I(i.rule,"$"+n,r),N(i.rule,"effect")||(i.rule.effect={}),I(i.rule.effect,n,r))},clearEffectData:function(t,n){var r=e.getCtx(t);r&&(n&&"$"===n[0]&&(n=n.substr(1)),r.clearEffectData(n),i.sync(t))},updateValidate:function(e,t,r){r?i.mergeRule(e,{validate:t}):n(e,"validate",t)},updateValidates:function(e,t){Object.keys(e).forEach((function(n){i.updateValidate(n,e[n],t)}))},refreshValidate:function(){i.refresh()},resetFields:function(n){t(n).forEach((function(t){e.getCtxs(t).forEach((function(t){e.$render.clearCache(t),t.rule.value=ke(t.defaultValue)}))}))},method:function(e,t){var n=i.el(e);if(!n||!n[t])throw new Error(G("err","".concat(t,"方法不存在")));return function(){return n[t].apply(n,arguments)}},exec:function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return _e((function(){return i.method(e,t).apply(void 0,r)}))},toJson:function(e){return K(i.rule,e)},trigger:function(e,t){for(var n=i.el(e),r=arguments.length,o=new Array(r>2?r-2:0),a=2;a<r;a++)o[a-2]=arguments[a];n&&n.$emit.apply(n,[t].concat(o))},el:function(t){var n=e.getCtx(t);if(n)return n.el||e.vm.refs[n.ref]},closeModal:function(t){e.bus.$emit("fc:closeModal:"+t)},getSubForm:function(t){var n=e.getCtx(t);return n?e.subForm[n.id]:void 0},getChildrenRuleList:function(t){var n="object"===E(t),r=n?be(t):e.getCtx(t),o=r?r.rule:n?t:i.getRule(t);if(!o)return[];var a,u=[];return(a=r?r.loadChildrenPending():o.children)&&a.forEach((function(e){"object"===E(e)&&(e.field&&u.push(e),u.push.apply(u,k(i.getChildrenRuleList(e))))})),u},getChildrenFormData:function(e){return i.getChildrenRuleList(e).reduce((function(e,t){return e[t.field]=ke(t.value),e}),{})},setChildrenFormData:function(e,t,n){i.getChildrenRuleList(e).forEach((function(e){N(t,e.field)?e.value=t[e.field]:n&&(e.value=void 0)}))},getGlobalEvent:function(e){var t=i.options.globalEvent[e];if(t)return"object"===E(t)&&(t=t.handle),z(t)},getGlobalData:function(t){return new Promise((function(n,r){var o=i.options.globalData[t];o||n(e.fc.loadData[t]),"fetch"===o.type?i.fetch(o).then((function(e){n({res:e,config:o})})).catch(r):n(o.data)}))},nextTick:function(t){e.bus.$once("next-tick",t),e.refresh()},nextRefresh:function(t){e.nextRefresh(),t&&_e(t)},deferSyncValue:function(t,n){e.deferSyncValue(t,n)},emit:function(t){for(var n,r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];(n=e.vm).emit.apply(n,[t].concat(i))},bus:e.bus,fetch:function(t){return e.options.beforeFetch&&_e((function(){return e.options.beforeFetch(t,{api:i})})),n=t,new Promise((function(e,t){we($($({},n),{},{onSuccess:function(t){var r=function(e){return e},i=z(n.parse);T.Function(i)?r=i:i&&T.String(i)&&(r=function(e){return i.split(".").forEach((function(t){e&&(e=e[t])})),e}),e(r(t))},onError:function(e){t(e)}}))}));var n},helper:{tidyFields:t,props:n}};return["on","once","off"].forEach((function(t){i[t]=function(){var n;(n=e.bus)["$".concat(t)].apply(n,arguments)}})),i.changeValue=i.changeField=i.setValue,i}function De(e){return Ve(e.replace(/(-[a-z])/g,(function(e){return e.replace("-","").toLocaleUpperCase()})))}function Ve(e){return e.replace(e[0],e[0].toLowerCase())}var Te=1;function Ne(e){q(this,{$handle:e,fc:e.fc,vm:e.vm,$manager:e.$manager,vNode:new e.fc.CreateNode(e.vm),id:Te++}),ge(this,{options:function(){return e.options},sort:function(){return e.sort}}),this.initCache(),this.initRender()}!function(e){q(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}})}(Ne),function(e){q(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-"+V(e.rule.field)]||n.slots["field-"+e.rule.field]),r||(r=n.slots["type-"+V(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=Ce();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]=p((function(){var n=t.$handle.options.global;return me({},[n["*"],n[e.originType]||n[e.type]||n[e.type]||{}])}))),e.prop=me({},[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&&te(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){te(e.prop,n,t[n])}))},parseSide:function(e,t){return T.Object(e)?me({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.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 o=e.prop;o.preview=!!(N(o,"preview")?o.preview:this.options.preview),o.props.formCreateInject=this.injectProp(e);var a=!1!==o.cache,u=o.preview;if(o.hidden)return void this.setCache(e,void 0,t);i=function(){for(var i=arguments.length,c=new Array(i),f=0;f<i;f++)c[f]=arguments[f];var s={rule:r,prop:o,preview:u,api:n.$handle.api,model:o.model||{},slotValue:c};c.length&&r.slotUpdate&&_e((function(){return r.slotUpdate(s)}));var l={},d=e.loadChildrenPending();e.parser.renderChildren?l=e.parser.renderChildren(d,e):!1!==e.parser.loadChildren&&(l=n.renderChildren(d,e));var p,h=n.getTypeSlot(e);return h?(s.children=l,p=h(s)):p=u?e.parser.preview(J(l),e):e.parser.render(J(l),e),p=n.renderSides(p,e),!e.input&&T.Undef(o.native)||!0===o.native||(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)),a&&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 Array.isArray(e.props.class)?e.props.class.push("fc-none"):e.props.class=e.props.class?[e.props.class,"fc-none"]:"fc-none",e},stable:function(e){var t=this;return(Array.isArray(e)?e:[e]).forEach((function(e){e&&e.__v_isVNode&&e.children&&"object"===E(e.children)&&(e.children.$stable=!0,t.stable(e.children))})),e},getModelField:function(e){return e.rule.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]},options:[],children:[],preview:!1,id:e.id,field:e.field,rule:e.rule,input:e.input});var r=n.ctxInject[e.id];return q(r,{preview:e.prop.preview,options:e.prop.options,children:e.loadChildrenPending()}),r},ctxProp:function(e){var t=this,n=e.ref,r=e.key,i=e.rule;this.$manager.mergeProp(e),e.parser.mergeProp(e);var o=[{ref:n,key:i.key||"".concat(r,"fc"),slot:void 0,on:{vnodeMounted:function(n){n.el.__rule__=e.rule,t.onMounted(e,n.el)},"fc.el":function(t){e.exportEl=t,t&&((t.$el||t).__rule__=e.rule)}}}];if(e.input){void 0!==this.vm.props.disabled&&(e.prop.props.disabled=!!this.vm.props.disabled);var a=this.getModelField(e),u={callback:function(n){t.onInput(e,n)},value:this.$handle.getFormData(e)};o.push({on:$(j({},"update:".concat(a),u.callback),e.prop.modelEmit?j({},e.prop.modelEmit,(function(){return t.onEmitInput(e)})):{}),props:j({},a,u.value)}),e.prop.model=u}return ue(o,e.prop),e.prop},onMounted:function(e,t){e.el=this.vm.refs[e.ref]||t,e.parser.mounted(e),this.$handle.effect(e,"mounted")},onInput:function(e,t){e.prop.modelEmit?this.$handle.onBaseInput(e,t):this.$handle.onInput(e,t)},onEmitInput:function(e){this.$handle.setValue(e,e.parser.toValue(e.modelValue,e),e.modelValue)},renderChildren:function(e,t){var n=this;if(!T.trueArray(e))return{};var r=Ce();return e.map((function(i){if(i)return T.String(i)?r.setSlot(null,i):i.__fc__?n.renderSlot(r,i.__fc__,t):void(i.type&&h((function(){n.$handle.loadChildren(e,t),n.$handle.refresh()})))})),r.getSlots()},defaultRender:function(e,t){var n=e.prop;return n.component?this.vNode.makeComponent(n.component,n,t):this.vNode[e.type]?this.vNode[e.type](n,t):this.vNode[e.originType]?this.vNode[e.originType](n,t):this.vNode.make(Ve(e.originType),n,t)},renderRule:function(e,t,n){var r=this;if(e){if(T.String(e))return e;var i;if(n)i=e.type;else if(i=e.is,e.type){i=De(e.type);var o=this.vNode.aliasMap[i];o&&(i=De(o))}if(i){var a=Ce();T.trueArray(e.children)&&e.children.forEach((function(e){e&&a.setSlot(null==e?void 0:e.slot,(function(){return r.renderRule(e)}))}));var u=$({},e);return delete u.type,delete u.is,this.vNode.make(i,u,a.mergeBag(t).getSlots())}}}})}(Ne);var Ie=["hook:updated","hook:mounted"];function Le(e,t,n){var r,i=ee(),o=!!t.field;q(this,{id:i,ref:i,wrapRef:i+"fi",rule:t,origin:t.__origin__||t,name:t.name,pending:{},none:!1,watch:[],linkOn:[],root:[],ctrlRule:[],children:[],parent:null,group:t.subRule?this:null,cacheConfig:null,prop:$({},t),computed:{},payload:{},refRule:{},input:o,el:void 0,exportEl:void 0,defaultValue:o?B(n):void 0,field:t.field||void 0}),this.updateType(),this.updateKey(),r=this,Object.defineProperties(r.origin,{__fc__:pe(l(r),!0)}),this.update(e,!0)}q(Le.prototype,{getParentGroup:function(){for(var e=this.parent;e;){if(e.group)return e;e=e.parent}},loadChildrenPending:function(){var e=this,t=this.rule.children||[];return Array.isArray(t)?t:this.loadPending({key:"children",origin:t,def:[],onLoad:function(t){e.$handle&&e.$handle.loadChildren(t,e)},onUpdate:function(t,n){e.$handle&&(t===n?e.$handle.loadChildren(t,e):e.$handle.updateChildren(e,t,n))},onReload:function(t){e.$handle?e.$handle.updateChildren(e,[],t):delete e.pending.children}})},loadPending:function(e){var t=this,n=e.key,r=e.origin,i=e.def,o=e.onLoad,a=e.onReload,u=e.onUpdate;if(this.pending[n]&&this.pending[n].origin===r)return this.getPending(n,i);delete this.pending[n];var c=r;if(T.Function(r)){var f=_e((function(){return r({rule:t.rule,api:t.$api,update:function(e){var o=e||i,a=t.getPending(n,i);t.setPending(n,r,o),u&&u(o,a)},reload:function(){var e=t.getPending(n,i);delete t.pending[n],a&&a(e),t.$api&&t.$api.sync(t.rule)}})}));f&&T.Function(f.then)?(f.then((function(e){var a=e||i;t.setPending(n,r,a),o&&o(a),t.$api&&t.$api.sync(t.rule)})).catch((function(e){console.error(e)})),c=i,this.setPending(n,r,c)):(c=f||i,this.setPending(n,r,c),o&&o(c))}return c},getPending:function(e,t){return this.pending[e]&&this.pending[e].value||t},setPending:function(e,t,n){this.pending[e]={origin:t,value:o(n)}},effectData:function(e){return this.payload[e]||(this.payload[e]={}),this.payload[e]},clearEffectData:function(e){void 0===e?this.payload={}:delete this.payload[e]},updateKey:function(e){this.key=ee(),e&&this.parent&&this.parent.updateKey(e)},updateType:function(){this.originType=this.rule.type,this.type=De(this.rule.type)},setParser:function(e){this.parser=e,e.init(this)},initProp:function(){var e=this,t=$({},this.rule);delete t.children,this.prop=me({},[t].concat(k(Object.keys(this.payload).map((function(t){return e.payload[t]}))),[this.computed]))},initNone:function(){this.none=!(T.Undef(this.prop.display)||this.prop.display)},injectValidate:function(){var e=this;return D(this.prop.validate).map((function(t){return $($({},t),{},{inject:{id:e.id,field:e.field,rule:e.rule,api:e.$handle.api}})}))},check:function(e){return this.vm===e.vm},unwatch:function(){this.watch.forEach((function(e){return e()})),this.watch=[],this.refRule={}},unlink:function(){this.linkOn.forEach((function(e){return e()})),this.linkOn=[]},link:function(){this.unlink(),this.$handle.appendLink(this)},watchTo:function(){this.$handle.watchCtx(this)},delete:function(){var e=void 0;this.unwatch(),this.unlink(),this.rmCtrl(),this.parent&&this.parent.children.splice(this.parent.children.indexOf(this)>>>0,1),q(this,{deleted:!0,prop:$({},this.rule),computed:{},el:e,$handle:e,$render:e,$api:e,vm:e,vNode:e,parent:null,children:[],cacheConfig:null,none:!1})},rmCtrl:function(){this.ctrlRule.forEach((function(e){return e.__fc__&&e.__fc__.rm()})),this.ctrlRule=[]},rm:function(){var e=this,t=function(){var t=e.root.indexOf(e.origin);t>-1&&(e.root.splice(t,1),e.$handle&&e.$handle.refresh())};this.deleted?t():this.$handle.noWatch((function(){e.$handle.deferSyncValue((function(){e.rmCtrl(),t(),e.$handle.rmCtx(e),q(e,{root:[]})}),e.input)}))},update:function(e,t){q(this,{deleted:!1,$handle:e,$render:e.$render,$api:e.api,vm:e.vm,trueType:e.getType(this.originType),vNode:e.$render.vNode,updated:!1,cacheValue:this.rule.value}),!t&&this.unwatch(),this.watchTo(),this.link()}});var Me={"==":function(e){return function(t){return t===e}},"!=":function(e){return function(t){return t!==e}},"<>":function(e){return function(t){return t!==e}},">":function(e){return function(t){return t>e}},">=":function(e){return function(t){return t>=e}},"<":function(e){return function(t){return t<e}},"<=":function(e){return function(t){return t<=e}},in:function(e){return function(t){return e&&e.indexOf&&e.indexOf(t)>-1}},on:function(e){return function(t){return t&&t.indexOf&&t.indexOf(e)>-1}},notIn:function(e){return function(t){return!Me.in(e)(t)}},notOn:function(e){return function(t){return!Me.on(e)(t)}},between:function(e){return function(t){return t>e[0]&&t<e[1]}},notBetween:function(e){return function(t){return t<e[0]||t>e[1]}}};function Be(e,t){for(var n=0;n<e.ctrlRule.length;n++){var r=e.ctrlRule[n];if(r.children===t)return r}}function Ue(e){return!!e.rule.__ctrl}function qe(e,t){return"function"==typeof t?""+t:t}var Je={init:function(e){},toFormValue:function(e,t){return e},toValue:function(e,t){return e},mounted:function(e){},render:function(e,t){return t.$render.defaultRender(t,e)},preview:function(e,t){return this.render(e,t)},mergeProp:function(e){}},Ge=["field","value","vm","template","name","config","control","inject","sync","payload","optionsTo","update","slotUpdate","computed","component","cache"];function We(e){var t=this;ge(this,{options:function(){return e.options.value||{}},bus:function(){return e.bus}}),q(this,{fc:e,vm:e.vm,watching:!1,loading:!1,reloading:!1,noWatchFn:null,deferSyncFn:null,isMounted:!1,formData:o({}),subRuleData:o({}),subForm:{},form:o({}),appendData:{},providers:{},cycleLoad:null,loadedId:1,nextTick:null,changeStatus:!1,pageEnd:!0,nextReload:function(){t.lifecycle("reload")}}),this.initData(e.rules),this.$manager=new e.manager(this),this.$render=new Ne(this),this.api=e.extendApi(Pe(this),this)}q(We.prototype,{initData:function(e){q(this,{ctxs:{},fieldCtx:{},nameCtx:{},sort:[],rules:e})},init:function(){this.appendData=$($($({},this.options.formData||{}),this.fc.vm.props.modelValue||{}),this.appendData),this.useProvider(),this.usePage(),this.loadRule(),this.$manager.__init(),this.lifecycle("created")},isBreakWatch:function(){return this.loading||this.noWatchFn||this.reloading}}),function(e){q(e.prototype,{parseInjectEvent:function(e,t){var n=e.inject||this.options.injectEvent;return this.parseEventLst(e,t,n)},parseEventLst:function(e,t,n,r){var i=this;return Object.keys(t).forEach((function(o){var a=i.parseEvent(e,t[o],n,r);a&&(t[o]=a)})),t},parseEvent:function(e,t,n,r){if(T.Function(t)&&(!1!==n&&!T.Undef(n)||t.__inject))return this.inject(e,t,n);if(!r&&Array.isArray(t)&&t[0]&&(T.String(t[0])||T.Function(t[0])))return this.parseEventLst(e,t,n,!0);if(T.String(t)){var i=z(t);if(i&&t!==i)return i.__inject?this.parseEvent(e,i,n,!0):i}},parseEmit:function(e){var t=this,n={},r=e.rule,i=r.emitPrefix,o=r.field,a=r.name,u=r.inject,c=r.emit||[];return T.trueArray(c)&&c.forEach((function(e){if(e){var c,f=i||o||a;if(T.Object(e)&&(c=e.inject,f=(e=e.name).prefix||f),f){var s=V("".concat(f,"-").concat(e)),l=function(){var e,n,r;t.vm.emitsOptions&&(t.vm.emitsOptions[s]=null);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];(e=t.vm).emit.apply(e,[s].concat(o)),(n=t.vm).emit.apply(n,["emit-event",s].concat(o)),(r=t.bus).$emit.apply(r,[s].concat(o))};if(l.__emit=!0,c||!1!==u){var d=c||u||t.options.injectEvent;n[e]=T.Undef(d)?l:t.inject(r,l,d)}else n[e]=l}}})),e.computed.on=n,n},getInjectData:function(e,t){var n=this.vm.props,r=n.option,i=n.rule;return{$f:this.api,api:this.api,rule:i,self:e.__origin__,option:r,inject:t}},inject:function(e,t,n){if(t.__origin){if(this.watching&&!this.loading)return t;t=t.__origin}var r=this,i=function(){for(var i=r.getInjectData(e,n),o=arguments.length,a=new Array(o),u=0;u<o;u++)a[u]=arguments[u];return i.args=[].concat(a),a.unshift(i),t.apply(this,a)};return i.__origin=t,i.__json=t.__json,i}})}(We),function(e){q(e.prototype,{usePage:function(){var e=this,t=this.options.page;if(t){var n,r=25,i=(n=this.rules).length<31?31:Math.ceil(n.length/3);T.Object(t)&&(t.first&&(r=parseInt(t.first,10)||r),t.limit&&(i=parseInt(t.limit,10)||i)),q(this,{first:r,limit:i,pageEnd:this.rules.length<=r}),this.bus.$on("page-end",(function(){return e.vm.emit("page-end",e.api)})),this.pageLoad()}},pageLoad:function(){var e=this;this.bus.$on(Ie,(function t(){e.pageEnd?(e.bus.$off(Ie,t),e.bus.$emit("page-end")):(e.first+=e.limit,e.pageEnd=e.rules.length<=e.first,e.loadRule(),e.refresh())}))}})}(We),function(e){q(e.prototype,{clearNextTick:function(){this.nextTick&&clearTimeout(this.nextTick),this.nextTick=null},bindNextTick:function(e){var t=this;this.clearNextTick(),this.nextTick=setTimeout((function(){e(),t.nextTick=null}),10)},render:function(){return++this.loadedId,this.vm.setupState.unique>0?this.$render.render():(this.vm.setupState.unique=1,[])}})}(We),function(e){q(e.prototype,{nextRefresh:function(e){var t=this,n=this.loadedId;h((function(){n===t.loadedId&&(e?e():t.refresh())}))},parseRule:function(e){var t=this,n=ye(e);return Object.defineProperties(n,{__origin__:pe(e,!0)}),function(e){var t={props:{},on:{},options:[],children:[],hidden:!1,display:!0,value:void 0};Object.keys(t).forEach((function(n){N(e,n)||(e[n]=t[n])}))}(n),this.appendValue(n),[n,n.prefix,n.suffix].forEach((function(e){e&&t.loadFn(e,n)})),this.loadCtrl(n),n.update&&(n.update=z(n.update)),n},loadFn:function(e,t){var n=this;["on","props","deep"].forEach((function(r){e[r]&&n.parseInjectEvent(t,e[r])}))},loadCtrl:function(e){e.control&&e.control.forEach((function(e){e.handle&&(e.handle=z(e.handle))}))},syncProp:function(e){var t=this,n=e.rule;T.trueArray(n.sync)&&ue([{on:n.sync.reduce((function(e,r){return e["update:".concat(r)]=function(e){n.props[r]=e,t.vm.emit("sync",r,e,n,t.fapi)},e}),{})}],e.computed)},loadRule:function(){var e=this;this.cycleLoad=!1,this.loading=!0,this.pageEnd&&this.bus.$emit("load-start"),this.deferSyncValue((function(){if(e._loadRule(e.rules),e.loading=!1,e.cycleLoad&&e.pageEnd)return e.loadRule();e.syncForm(),e.pageEnd&&e.bus.$emit("load-end"),e.vm.setupState.renderRule()}))},loadChildren:function(e,t){if(this.cycleLoad=!1,this.loading=!0,this.bus.$emit("load-start"),this._loadRule(e,t),this.loading=!1,this.cycleLoad)return this.loadRule();this.syncForm(),this.bus.$emit("load-end"),this.$render.clearCache(t)},_loadRule:function(e,t){var n=this,r=function t(r){var i=e[r-1];if(!i||!i.__fc__)return r>0?t(r-1):-1;var o=n.sort.indexOf(i.__fc__.id);return o>-1?o:t(r-1)},i=function(e,t){T.trueArray(e)&&n._loadRule(e,t)},o=e.map((function(o,a){if((!t||T.Object(o))&&(n.pageEnd||t||!(a>=n.first))){if(o.__fc__&&o.__fc__.root===e&&n.ctxs[o.__fc__.id])return i(o.__fc__.loadChildrenPending(),o.__fc__),o.__fc__;var u,c=ye(o),f=function(){return!(!c.field||!n.fieldCtx[c.field]||n.fieldCtx[c.field][0]===o.__fc__)};n.ruleEffect(c,"init",{repeat:f()}),f()&&n.vm.emit("repeat-field",o,n.api);var s=!1,l=!!o.__fc__,d=c.value;if(l){d=(u=o.__fc__).defaultValue;var p=!u.check(n);if(u.deleted){if(p){if(Ue(u))return;u.update(n)}}else if(p){if(Ue(u))return;e[a]=o=o._clone?o._clone():he(o),u=null,s=!0}}if(u)u.originType!==u.rule.type&&(u.updateType(),n.bindParser(u)),n.appendValue(u.rule),u.parent&&u.parent!==t&&n.rmSubRuleData(u);else{var h=n.parseRule(o);u=new Le(n,h,l?d:h.value),n.bindParser(u)}n.parseEmit(u),n.syncProp(u),u.parent=t||null,u.root=e,n.setCtx(u),!s&&!l&&n.effect(u,"load"),n.effect(u,"created");var v=u.loadChildrenPending();if(!1===u.parser.loadChildren||i(v,u),!t){var m=r(a);m>-1||!a?n.sort.splice(m+1,0,u.id):n.sort.push(u.id)}var y=u.rule;return u.updated||(u.updated=!0,T.Function(y.update)&&n.bus.$once("load-end",(function(){n.refreshUpdate(u,y.value,"init")})),n.effect(u,"loaded")),n.refreshControl(u)&&(n.cycleLoad=!0),u}})).filter((function(e){return!!e}));t&&(t.children=o)},refreshControl:function(e){return e.input&&e.rule.control&&this.useCtrl(e)},useCtrl:function(e){var t=this,n=function(e){var t=e.rule.control||[];return T.Object(t)?[t]:t}(e),r=[],i=this.api;if(!n.length)return!1;for(var o=function(t){var o=n[t],a=o.handle||(Me[o.condition||"=="]||Me["=="])(o.value);if(!T.trueArray(o.rule))return"continue";var u=$($({},o),{},{valid:_e((function(){return a(e.rule.value,i)})),ctrl:Be(e,o.rule),isHidden:T.String(o.rule[0])});if(u.valid&&u.ctrl||!u.valid&&!u.ctrl&&!u.isHidden)return"continue";r.push(u)},a=0;a<n.length;a++)o(a);if(!r.length)return!1;var u=[],c=!1;return this.deferSyncValue((function(){r.reverse().forEach((function(n){var r=n.isHidden,o=n.valid,a=n.rule,f=n.prepend,s=n.append,l=n.child,d=n.ctrl,p=n.method;if(r)return o?e.ctrlRule.push({__ctrl:!0,children:a,valid:o}):e.ctrlRule.splice(e.ctrlRule.indexOf(d),1),void u[o?"push":"unshift"]((function(){"disabled"===p?t.api.disabled(!o,a):"display"===p?t.api.display(o,a):"required"===p?(a.forEach((function(e){t.api.setEffect(e,"required",o)})),o||t.api.clearValidateState(a)):t.api.hidden(!o,a)}));if(o){c=!0;var h={type:"fragment",native:!0,__ctrl:!0,children:a};e.ctrlRule.push(h),t.bus.$once("load-start",(function(){f?i.prepend(h,f,l):s||l?i.append(h,s||e.id,l):e.root.splice(e.root.indexOf(e.origin)+1,0,h)}))}else{e.ctrlRule.splice(e.ctrlRule.indexOf(d),1);var v=be(d);v&&v.rm()}}))})),u.length&&h((function(){u.forEach((function(e){return e()}))})),this.vm.emit("control",e.origin,this.api),this.effect(e,"control"),c},reloadRule:function(e){return this._reloadRule(e)},_reloadRule:function(e){var t=this;e||(e=this.rules);var n=$({},this.ctxs);this.clearNextTick(),this.initData(e),this.fc.rules=e,this.deferSyncValue((function(){t.bus.$once("load-end",(function(){Object.keys(n).filter((function(e){return void 0===t.ctxs[e]})).forEach((function(e){return t.rmCtx(n[e])})),t.$render.clearCacheAll()})),t.reloading=!0,t.loadRule(),t.reloading=!1,t.refresh(),t.bus.$emit("reloading",t.api)})),this.bus.$off("next-tick",this.nextReload),this.bus.$once("next-tick",this.nextReload),this.bus.$emit("update",this.api)},refresh:function(){this.vm.setupState.refresh()}})}(We),function(e){q(e.prototype,{setValue:function(e,t,n,r){e.deleted||(e.rule.value=t,this.changeStatus=!0,this.nextRefresh(),this.$render.clearCache(e),this.setFormData(e,n),this.syncValue(),this.valueChange(e,t),this.vm.emit("change",e.field,t,e.origin,this.api,r||!1),this.effect(e,"value"),this.emitEvent("change",e.field,t,{rule:e.origin,api:this.api,setFlag:r||!1}))},onInput:function(e,t){var n;e.input&&(this.isQuote(e,n=e.parser.toValue(t,e))||this.isChange(e,t))&&this.setValue(e,n,t)},onBaseInput:function(e,t){this.setFormData(e,t),e.modelValue=t,this.nextRefresh(),this.$render.clearCache(e)},setFormData:function(e,t){e.modelValue=t;var n=e.getParentGroup();n&&(this.subRuleData[n.id]||(this.subRuleData[n.id]={}),this.subRuleData[n.id][e.field]=e.rule.value),I(this.formData,e.id,t)},rmSubRuleData:function(e){var t=e.getParentGroup();t&&this.subRuleData[t.id]&&delete this.subRuleData[t.id][e.field]},getFormData:function(e){return this.formData[e.id]},syncForm:function(){var e=this,t=o({});this.fields().reduce((function(t,n){var r=e.getCtx(n);return t[n]=v(r.rule,"value"),t}),t),this.form=t,this.syncValue()},appendValue:function(e){e.field&&N(this.appendData,e.field)&&(e.value=this.appendData[e.field],delete this.appendData[e.field])},addSubForm:function(e,t){this.subForm[e.id]=t},deferSyncValue:function(e,t){this.deferSyncFn||(this.deferSyncFn=e),this.deferSyncFn.sync||(this.deferSyncFn.sync=t),_e(e),this.deferSyncFn===e&&(this.deferSyncFn=null,e.sync&&this.syncValue())},syncValue:function(){if(this.deferSyncFn)return this.deferSyncFn.sync=!0;this.vm.setupState.updateValue($({},this.form))},isChange:function(e,t){return JSON.stringify(this.getFormData(e),qe)!==JSON.stringify(t,qe)},isQuote:function(e,t){return(T.Object(t)||Array.isArray(t))&&t===e.rule.value},refreshUpdate:function(e,t,n,r){var i=this;if(T.Function(e.rule.update)){var o=_e((function(){return e.rule.update(t,e.origin,i.api,{origin:n||"change",linkField:r})}));if(void 0===o)return;e.rule.hidden=!0===o}},valueChange:function(e,t){this.refreshRule(e,t),this.bus.$emit("change-"+e.field,t)},refreshRule:function(e,t,n,r){this.refreshControl(e)&&(this.$render.clearCacheAll(),this.loadRule(),this.bus.$emit("update",this.api),this.refresh()),this.refreshUpdate(e,t,n,r)},appendLink:function(e){var t=this,n=e.rule.link;T.trueArray(n)&&n.forEach((function(n){var r=function(){return t.refreshRule(e,e.rule.value,"link",n)};t.bus.$on("change-"+n,r),e.linkOn.push((function(){return t.bus.$off("change-"+n,r)}))}))},fields:function(){return Object.keys(this.fieldCtx)}})}(We),function(e){q(e.prototype,{getCtx:function(e){return this.getFieldCtx(e)||this.getNameCtx(e)[0]||this.ctxs[e]},getCtxs:function(e){return this.fieldCtx[e]||this.nameCtx[e]||(this.ctxs[e]?[this.ctxs[e]]:[])},setIdCtx:function(e,t,n){var r="".concat(n,"Ctx");this[r][t]?this[r][t].push(e):this[r][t]=[e]},rmIdCtx:function(e,t,n){var r="".concat(n,"Ctx"),i=this[r][t];if(!i)return!1;var o=i.splice(i.indexOf(e)>>>0,1).length>0;return i.length||delete this[r][t],o},getFieldCtx:function(e){return(this.fieldCtx[e]||[])[0]},getNameCtx:function(e){return this.nameCtx[e]||[]},setCtx:function(e){var t=e.id,n=e.field,r=e.name,i=e.rule;this.ctxs[t]=e,r&&this.setIdCtx(e,r,"name"),e.input&&(this.setIdCtx(e,n,"field"),this.setFormData(e,e.parser.toFormValue(i.value,e)),this.isMounted&&!this.reloading&&this.vm.emit("change",e.field,i.value,e.origin,this.api))},getParser:function(e){var t=this.fc.parsers;return t[e.originType]||t[De(e.type)]||t[e.trueType]||Je},bindParser:function(e){e.setParser(this.getParser(e))},getType:function(e){var t=this.fc.CreateNode.aliasMap,n=t[e]||t[De(e)]||e;return De(n)},noWatch:function(e){this.noWatchFn||(this.noWatchFn=e),_e(e),this.noWatchFn===e&&(this.noWatchFn=null)},watchCtx:function(e){var t=this;if(de().filter((function(e){return"_"!==e[0]&&"$"!==e[0]&&-1===Ge.indexOf(e)})).forEach((function(n){var r=v(e.rule,n),i="children"===n;e.refRule[n]=r,e.watch.push(s(i?function(){return T.Function(r.value)?r.value:k(r.value||[])}:function(){return r.value},(function(o,a){var u=r.value;if(!t.isBreakWatch()){if(i&&!1===e.parser.loadChildren)return t.$render.clearCache(e),void t.nextRefresh();t.watching=!0,"link"!==n?(["props","on","deep"].indexOf(n)>-1?(t.parseInjectEvent(e.rule,u||{}),"props"===n&&e.input&&t.setFormData(e,e.parser.toFormValue(e.rule.value,e))):"emit"===n?t.parseEmit(e):"hidden"===n&&Boolean(u)!==Boolean(a)?t.$render.clearCacheAll():["prefix","suffix"].indexOf(n)>-1?u&&t.loadFn(u,e.rule):"type"===n?(e.updateType(),t.bindParser(e)):i&&(T.Function(a)&&(a=e.getPending("children",[])),T.Function(u)&&(u=e.loadChildrenPending()),t.updateChildren(e,u,a)),t.$render.clearCache(e),t.refresh(),t.watching=!1):e.link()}}),{deep:!i,sync:i}))})),e.input){var n=v(e.rule,"value");e.watch.push(s((function(){return n.value}),(function(){var r=e.parser.toFormValue(n.value,e);t.isChange(e,r)&&t.setValue(e,n.value,r,!0)})))}this.bus.$once("load-end",(function(){var n=e.rule.computed;n&&("object"!==E(n)&&(n={value:n}),Object.keys(n).forEach((function(r){e.watch.push(s((function(){var i=n[r];if(i){var o;if(T.Function(i))o=function(){return i(t.api.form,t.api)};else{var a=e.getParentGroup();o=function(){return new Function("formulas","top","group","$rule","$api","with(top){with(this){with(group){with(formulas){ return ".concat(i," }}}}")).call(t.api.form,t.fc.formulas,t.api.top.form,a&&t.subRuleData[a.id]||{},e.rule,t.api)}}return _e(o,void 0)}}),(function(n){setTimeout((function(){"value"===r?t.onInput(e,n):"$"===r[0]?t.api.setEffect(e.id,r,n):te(e.rule,r,n)}))}),{immediate:!0}))})))})),this.watchEffect(e)},updateChildren:function(e,t,n){var r=this;this.deferSyncValue((function(){n&&n.forEach((function(n){-1===(t||[]).indexOf(n)&&n&&!T.String(n)&&n.__fc__&&n.__fc__.parent===e&&n.__fc__.root!==t&&r.rmCtx(n.__fc__)})),T.trueArray(t)&&(r.loadChildren(t,e),r.bus.$emit("update",r.api))}))},rmSub:function(e){var t=this;T.trueArray(e)&&e.forEach((function(e){e&&e.__fc__&&t.rmCtx(e.__fc__)}))},rmCtx:function(e){var t=this;if(!e.deleted){var n=e.id,r=e.field,i=e.input,o=e.name;L(this.ctxs,n),L(this.formData,n),L(this.subForm,n),L(this.vm.setupState.ctxInject,n);var a=e.getParentGroup();a&&this.subRuleData[a.id]&&L(this.subRuleData[a.id],r),e.group&&L(this.subRuleData,n),i&&this.rmIdCtx(e,r,"field"),o&&this.rmIdCtx(e,o,"name"),i&&!N(this.fieldCtx,r)&&L(this.form,r),this.deferSyncValue((function(){if(!t.reloading){if(!1!==e.parser.loadChildren){var n=e.getPending("children",e.rule.children);T.trueArray(n)&&n.forEach((function(e){return e.__fc__&&t.rmCtx(e.__fc__)}))}e.root===t.rules&&t.vm.setupState.renderRule()}}),i);var u=this.sort.indexOf(n);return u>-1&&this.sort.splice(u,1),this.$render.clearCache(e),e.delete(),this.effect(e,"deleted"),i&&!this.fieldCtx[r]&&this.vm.emit("remove-field",r,e.rule,this.api),e.rule.__ctrl||this.vm.emit("remove-rule",e.rule,this.api),e}}})}(We),function(e){q(e.prototype,{mounted:function(){var e=this,t=function(){e.isMounted=!0,e.lifecycle("mounted")};this.pageEnd?t():this.bus.$once("page-end",t)},lifecycle:function(e){this.vm.emit(e,this.api),this.emitEvent(e,this.api)},emitEvent:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var o=this.options[e]||this.options[De("on-"+e)];if(o){var a=z(o);T.Function(a)&&_e((function(){return a.apply(void 0,r)}))}(t=this.bus).$emit.apply(t,[e].concat(r))}})}(We),function(e){q(e.prototype,{useProvider:function(){var e=this,t=this.fc.providers;Object.keys(t).forEach((function(n){var r=t[n];T.Function(r)&&(r=r(e.fc)),r._c=function(e){var t=e.components;if(Array.isArray(t)){var n=function(e){return e.filter((function(e,t,n){return n.indexOf(e,0)===t}))}(t.filter((function(e){return"*"!==e})));return!!n.length&&n}return!!T.String(t)&&[t]}(r),e.onEffect(r),e.providers[n]=r}))},onEffect:function(e){var t=this,n=[];(e._c||["*"]).forEach((function(r){var i="*"===r?"*":t.getType(r);n.indexOf(i)>-1||(n.push(i),t.bus.$on("p:".concat(e.name,":").concat(i,":").concat(e.input?1:0),(function(t,n){e[t]&&e[t].apply(e,k(n))})))})),e._used=n},watchEffect:function(e){var t=this,n={required:function(){var t,n;return(N(e.rule,"$required")?e.rule.$required:null===(t=e.rule)||void 0===t||null===(n=t.effect)||void 0===n?void 0:n.required)||!1}};Object.keys(e.rule.effect||{}).forEach((function(t){n[t]=function(){return e.rule.effect[t]}})),Object.keys(e.rule).forEach((function(t){"$"===t[0]&&(n[t.substr(1)]=function(){return e.rule[t]})})),Object.keys(n).forEach((function(r){e.watch.push(s(n[r],(function(n){t.effect(e,"watch",j({},r,n))}),{deep:!0}))}))},ruleEffect:function(e,t,n){this.emitEffect({rule:e,input:!!e.field,type:this.getType(e.type)},t,n)},effect:function(e,t,n){this.emitEffect({rule:e.rule,input:e.input,type:e.trueType,ctx:e,custom:n},t)},getEffect:function(e,t){return N(e,"$"+t)?e["$"+t]:N(e,"effect")&&N(e.effect,t)?e.effect[t]:void 0},emitEffect:function(e,t,n){var r=this,i=e.ctx,o=e.rule,a=e.input,u=e.type,c=e.custom;if(u&&!(["fcFragment","fragment"].indexOf(u)>-1)){var f=c||Object.keys(o).reduce((function(e,t){return"$"===t[0]&&(e[t.substr(1)]=o[t]),e}),$({},o.effect||{}));Object.keys(f).forEach((function(e){var c=r.providers[e];if(c&&(!c.input||a)){var s;if(c._c){if(!(c._used.indexOf(u)>-1))return;s=u}else s="*";var l=$({value:f[e],getValue:function(){return r.getEffect(o,e)}},n||{});i&&(l.getProp=function(){return i.effectData(e)},l.clearProp=function(){return i.clearEffectData(e)},l.mergeProp=function(e){return me(l.getProp(),[e])},l.id=i.id),r.bus.$emit("p:".concat(e,":").concat(s,":").concat(c.input?1:0),t,[l,o,r.api])}}))}}})}(We);var He=e({name:"fcFragment",inheritAttrs:!1,props:["vnode"],render:function(){return this.vnode}});function Xe(e,t){var n=e.directives;return n?(Array.isArray(n)||(n=[n]),g(t,n.reduce((function(e,t){return e.concat(function(e){return Object.keys(e).map((function(t){var n=e[t],r=b(t);if(r)return[r,n.value,n.arg,n.modifiers]})).filter((function(e){return!!e}))}(t))}),[]))):t}function Ke(){var e={};function n(){}return q(n.prototype,{make:function(e,t,n){return Xe(t,this.h(e,xe(t),n))},makeComponent:function(e,t,n){try{return Xe(t,m(e,xe(t),n))}catch(e){return console.error(e),m("")}},h:function(e,n,r){var i=t().appContext.config.isNativeTag(e);i&&delete n.formCreateInject;try{return m(i?e:y(e),n,r)}catch(e){return console.error(e),m("")}},aliasMap:e}),q(n,{aliasMap:e,alias:function(t,n){e[t]=n},use:function(e){Object.keys(e).forEach((function(t){var r,i=V(t),o=(r=t,null==r?"":"object"===E(r)?JSON.stringify(r,null,2):String(r)).toLocaleLowerCase(),a=e[t];[t,i,o].forEach((function(e){n.alias(t,a),n.prototype[e]=function(e,t){return this.make(a,e,t)}}))}))}}),n}function Qe(e){var t=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&R(e,t)}(n,ze);var t=w(n);function n(){return S(this,n),t.apply(this,arguments)}return n}();return Object.assign(t.prototype,e),t}function ze(e){q(this,{$handle:e,vm:e.vm,options:{},ref:"fcForm",mergeOptionsRule:{normal:["form","row","info","submitBtn","resetBtn"]}}),this.updateKey(),this.init()}q(ze.prototype,{__init:function(){var e=this;this.$render=this.$handle.$render,this.$r=function(){var t;return(t=e.$render).renderRule.apply(t,arguments)}},updateKey:function(){this.key=ee()},init:function(){},update:function(){},beforeRender:function(){},form:function(){return this.vm.refs[this.ref]},getSlot:function(e){return function t(n){if(n){var r=n.slots[e];return r||t(n.setupState.parent)}}(this.vm)},mergeOptions:function(e,t){var n=this;return ue(e.map((function(e){return n.tidyOptions(e)})),t,this.mergeOptionsRule)},updateOptions:function(e){this.options=this.mergeOptions([e],this.getDefaultOptions()),this.update()},tidyOptions:function(e){return e},tidyRule:function(e){},mergeProp:function(e){},getDefaultOptions:function(){return{}},render:function(e){}});var Ze={name:"componentValidate",load:function(e,t,n){var r=e.getValue();r?e.getProp().validate=[{validator:function(){var i=be(t);if(i){for(var o=arguments.length,a=new Array(o),u=0;u<o;u++)a[u]=arguments[u];return n.exec.apply(n,[i.id,!0===r?"formCreateValidate":r].concat(a,[{attr:e,rule:t,api:n}]))}}}]:(e.clearProp(),n.clearValidateState([t.field]))},watch:function(){Ze.load.apply(Ze,arguments)}},Ye={fetch:function(e){function t(t,n,r){var i=t.value;T.Function(i)&&(i=i(n,r)),i=function(e){return T.String(e)&&(e={action:e,to:"options"}),e}(i);var o=function(e){void 0===e?t.clearProp():te(t.getProp(),i.to||"options",e),r.sync(n)};if(i&&(i.action||i.key)){if(i.to||(i.to="options"),i.key){var a=e.$handle.options.globalData[i.key];if(!a)return void o(void 0);if("static"===a.type)return void o(a.data);i=$($({},i),a)}var u=i.onError,c=function(){if(!t.getValue())return t.clearProp(),r.sync(n),!0},f=$($({headers:{}},i),{},{onSuccess:function(e,t){if(!c()){var a=function(e){return t?e:e.data},u=z(i.parse);T.Function(u)?a=u:u&&T.String(u)&&(a=function(e){return u.split(".").forEach((function(t){e&&(e=e[t])})),e}),o(a(e,n,r)),r.sync(n)}},onError:function(e){o(void 0),c()||(u||function(e){return W(e.message||"fetch fail "+i.action)})(e,n,r)}});e.$handle.options.beforeFetch&&_e((function(){return e.$handle.options.beforeFetch(f,{rule:n,api:r})})),T.Function(i.action)?i.action(n,r).then((function(e){f.onSuccess(e,!0)})).catch((function(e){f.onError(e)})):_e((function(){return e.create.fetch(f,{inject:t,rule:n,api:r})}))}else o(void 0)}return{name:"fetch",loaded:function(){t.apply(void 0,arguments)},watch:function(){t.apply(void 0,arguments)}}},loadData:function(e){var t={name:"loadData",_fn:[],created:function(t,n,r){this.deleted(t);var i=D(t.getValue()),o=[];i.forEach((function(i){if(i){var a=function o(){!1!==i.watch&&(e.bus.$off("p.loadData."+i.attr,o),e.bus.$once("p.loadData."+i.attr,o));var a=void 0;i.attr&&(a=e.loadData[i.attr]||i.default,i.copy&&(a=B(a))),te(t.getProp(),i.to||"options",a),r.sync(n)};o.push((function(){return e.bus.$off("p.loadData."+i.attr,a)})),a()}})),this._fn[t.id]=o},deleted:function(e){this._fn[e.id]&&this._fn[e.id].forEach((function(e){e()})),e.clearProp()}};return t.watch=t.created,t},componentValidate:Ze};function et(e){e=e||new Map;var t={$on:function(t,n){var r=e.get(t);r&&r.push(n)||e.set(t,[n])},$once:function(e,n){n._once=!0,t.$on(e,n)},$off:function(t,n){var r=e.get(t);r&&r.splice(r.indexOf(n)>>>0,1)},$emit:function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];(e.get(n)||[]).slice().map((function(e){e._once&&(t.$off(n,e),delete e._once),e.apply(void 0,i)})),(e.get("*")||[]).slice().map((function(e){e(n,i)}))}};return t}var tt={name:"html",loadChildren:!1,render:function(e,t){return t.prop.props.innerHTML=e.default(),t.vNode.make(t.prop.props.tag||"div",t.prop)},renderChildren:function(e){return{default:function(){return e.filter((function(e){return T.String(e)})).join("")}}}};function nt(e,t){var n;return 2===arguments.length?t=(n=arguments[1])[e]:n=arguments[2],{id:t,prop:n}}function rt(){return nt.apply(void 0,["name"].concat(Array.prototype.slice.call(arguments)))}var it=1,ot={};function at(e){var t,n=j({},He.name,He),r={},i={},a={},u=[],c=$({},Ye),f=Re(),l={global:{}},d={},p=Ke(),v={};function m(e){var t=ot[e];return Array.isArray(t)?t.map((function(e){return e.api()})):t?t.api():void 0}function y(e){u.push(e)}function g(){var e=rt.apply(void 0,arguments);e.id&&e.prop&&(i[e.id]=e.prop)}function b(){var e=rt.apply(void 0,arguments);e.id&&e.prop&&(c[e.id]=$($({},e.prop),{},{name:e.id}))}function O(e){p.use(e)}function E(){var e=rt.apply(void 0,arguments);if(!e.id||!e.prop)return Je;var t=De(e.id),n=e.prop,i=!0===n.merge?r[t]:void 0;r[t]=Oe(n,i||Je),f[t]=$e(t),n.maker&&q(f,n.maker)}function S(e,t){var i;if(T.String(e)){if(i=e,void 0===t)return n[i]}else i=e.displayName||e.name,t=e;if(i&&t){var o=De(i);n[i]=t,n[o]=t,delete p.aliasMap[i],delete p.aliasMap[o],delete r[i],delete r[o],t.formCreateParser&&E(i,t.formCreateParser)}}function F(){return re(M,n,i)}function R(){return He}function A(e,t){return T.Function(e.install)?e.install(w,t):T.Function(e)&&e(w,t),this}function w(e,t){var n=function(e,t){var n=F();return _({data:function(){return o({rule:e,option:t})},render:function(){return C(n,$({ref:"fc"},this.$data))}})}(e,t||{});u.forEach((function(e){_e((function(){return e(w,n)}))}));var r=document.createElement("div");return((null==t?void 0:t.el)||document.body).appendChild(r),n.mount(r).$refs.fc.fapi}function P(t){var o=$({},e);return t?o.inherit={components:n,parsers:r,directives:i,modelFields:a,providers:c,useApps:u,maker:f,formulas:v,loadData:d}:delete o.inherit,at(o)}function D(e,t){a[e]=t}function V(e,t){v[e]=t}function N(e){Object.keys(ot).forEach((function(t){(Array.isArray(ot[t])?ot[t]:[ot[t]]).forEach((function(t){t.bus.$emit("p.loadData."+e)}))}))}function I(e,t){d[e]=t,N(e)}function L(e){delete d[e],N(e)}function M(t){var o=this;q(this,{id:it++,create:w,vm:t,manager:Qe(e.manager),parsers:r,providers:c,modelFields:a,formulas:v,rules:t.props.rule,name:t.props.name||ee(),inFor:t.props.inFor,prop:{components:n,directives:i},loadData:d,CreateNode:p,bus:new et,unwatch:null,options:x({}),extendApi:e.extendApi||function(e){return e}}),h((function(){s(o.options,(function(){o.$handle.$manager.updateOptions(o.options.value),o.api().refresh()}),{deep:!0})})),q(t.appContext.components,n),q(t.appContext.directives,i),this.$handle=new We(this),this.name&&(this.inFor?(ot[this.name]||(ot[this.name]=[]),ot[this.name].push(this)):ot[this.name]=this)}function U(t){q(t,{version:e.version,ui:e.ui,setData:I,removeData:L,maker:f,component:S,directive:g,setModelField:D,setFormula:V,register:b,$vnode:R,parser:E,use:A,factory:P,componentAlias:O,copyRule:he,copyRules:ve,fetch:we,$form:F,parseFn:z,parseJson:Z,toJson:K,useApp:y,getApi:m})}if(function(e){var t=e.key||[],n=e.array||[],r=e.normal||[];fe.push.apply(fe,k(t)),se.push.apply(se,k(n)),le.push.apply(le,k(r)),Se([].concat(k(t),k(n),k(r)))}(e.attrs||{}),q(M.prototype,{init:function(){var e=this;this.isSub()&&(this.unwatch=s((function(){return e.vm.setupState.parent.setupState.fc.options.value}),(function(){e.initOptions(),e.$handle.api.refresh()}),{deep:!0})),this.initOptions(),this.$handle.init()},isSub:function(){return this.vm.setupState.parent&&this.vm.props.extendOption},initOptions:function(){this.options.value={};var e=$({formData:{},submitBtn:{},resetBtn:{},globalEvent:{},globalData:{}},B(l));this.isSub()&&(e=this.mergeOptions(e,this.vm.setupState.parent.setupState.fc.options.value||{},!0)),e=this.mergeOptions(e,this.vm.props.option),this.updateOptions(e)},mergeOptions:function(e,t,n){return t=B(t),n&&["page","onSubmit","mounted","reload","formData","el","globalClass"].forEach((function(e){delete t[e]})),t.global&&(e.global=function(e,t){return e?(Object.keys(t||{}).forEach((function(n){t[n]&&(e[n]=me(e[n]||{},t[n]))})),e):t}(e.global,t.global),delete t.global),this.$handle.$manager.mergeOptions([t],e),e},updateOptions:function(e){this.options.value=this.mergeOptions(this.options.value,e),this.$handle.$manager.updateOptions(this.options.value)},api:function(){return this.$handle.api},render:function(){return this.$handle.render()},mounted:function(){this.$handle.mounted()},unmount:function(){if(this.name)if(this.inFor){var e=ot[this.name].indexOf(this);ot[this.name].splice(e,1)}else delete ot[this.name];this.unwatch&&this.unwatch(),this.$handle.reloadRule([])},updated:function(){var e=this;this.$handle.bindNextTick((function(){return e.bus.$emit("next-tick",e.$handle.api)}))}}),U(w),q(t=w,{create:w,install:function(e,n){if(l=$($({},l),n||{}),!0!==e._installedFormCreate){e._installedFormCreate=!0;var r=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return w(e,t)};U(r),e.config.globalProperties.$formCreate=r,e.component("FormCreate",F()),u.forEach((function(n){_e((function(){return n(t,e)}))}))}}}),p.use({fragment:"fcFragment"}),e.install&&w.use(e),y((function(e,t){t.mixin({props:["formCreateInject"]})})),E(tt),e.inherit){var J=e.inherit;J.components&&q(n,J.components),J.parsers&&q(r,J.parsers),J.directives&&q(i,J.directives),J.modelFields&&q(a,J.modelFields),J.providers&&q(c,J.providers),J.useApps&&q(u,J.useApps),J.maker&&q(f,J.maker),J.loadData&&q(d,J.loadData),J.formulas&&q(v,J.formulas)}return w}export{Ee as Creator,ze as Manager,he as copyRule,ve as copyRules,$e as creatorFactory,at as default,He as fragment,me as mergeRule,Z as parseJson,K as toJson};
{
"name": "@form-create/core",
"version": "3.1.29",
"version": "3.1.30",
"description": "vue动态表单,助你轻松搞定表单|form-create is a form generation component that can generate dynamic rendering, data collection, verification and submission functions through JSON. Supports 5 UI frameworks, and supports the generation of any Vue components. Built-in 20 kinds of commonly used form components and custom components, no matter how complex forms can be easily handled.",

@@ -47,3 +47,3 @@ "main": "./dist/index.min.js",

"dependencies": {
"@form-create/utils": "^3.1.29"
"@form-create/utils": "^3.1.30"
},

@@ -61,3 +61,3 @@ "publishConfig": {

},
"gitHead": "7771b8ddf4b2d222b3084fcfe89c6a8331f2f3a0"
"gitHead": "fc82d90c58cf0fc00d90b40808e0977af46b19aa"
}

@@ -5,3 +5,3 @@ import {

inject,
markRaw,
markRaw, onBeforeMount,
onBeforeUnmount,

@@ -16,2 +16,3 @@ onMounted,

import toArray from '@form-create/utils/lib/toarray';
import {toLine} from '@form-create/utils';

@@ -49,3 +50,6 @@ const NAME = 'FormCreate';

modelValue: Object,
disabled: Boolean,
disabled: {
type: Boolean,
default: undefined,
},
api: Object,

@@ -59,3 +63,3 @@ name: String,

},
emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync', 'reload', 'repeat-field', 'update', 'validate-field-fail', 'validate-fail'],
emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync', 'reload', 'repeat-field', 'update', 'validate-field-fail', 'validate-fail', 'created'],
render() {

@@ -117,3 +121,27 @@ return this.fc.render();

let styleEl = null;
onBeforeMount(() => {
let content = '';
const globalClass = (props.option && props.option.globalClass) || {};
Object.keys(globalClass).forEach(k => {
let subCss = '';
globalClass[k].style && Object.keys(globalClass[k].style).forEach(key => {
subCss += toLine(key) + ':' + globalClass[k].style[key] + ';';
});
if (globalClass[k].content) {
subCss += globalClass[k].content + ';';
}
if (subCss) {
content += `.${k}{${subCss}}`;
}
});
if (content) {
styleEl = document.createElement('style');
styleEl.type = 'text/css';
styleEl.innerHTML = content;
document.head.appendChild(styleEl);
}
});
onMounted(() => {

@@ -124,2 +152,3 @@ fc.mounted();

onBeforeUnmount(() => {
styleEl && document.head.removeChild(styleEl);
rmSubForm();

@@ -149,2 +178,6 @@ data.destroyed = true;

watch(() => props.disabled, () => {
fapi.refresh();
});
watch(modelValue, (n) => {

@@ -155,6 +188,2 @@ if (JSON.stringify(n || {}) === data.updateValue) return;

watch(() => props.disabled, (n) => {
fapi.disabled(!!n);
});
return {

@@ -173,3 +202,7 @@ fc: markRaw(fc),

if (data.destroyed) return;
data.updateValue = JSON.stringify(value);
const json = JSON.stringify(value);
if (data.updateValue === json) {
return;
}
data.updateValue = json;
vm.emit('update:modelValue', value);

@@ -181,7 +214,6 @@ }

const vm = getCurrentInstance();
vm.emit('update:api', vm.setupState.fapi);
vm.setupState.fc.init();
vm.emit('update:api', vm.setupState.fapi);
vm.props.disabled && vm.setupState.fapi.disabled(true)
},
})
}

@@ -8,2 +8,3 @@ import unique from '@form-create/utils/lib/unique';

import is from '@form-create/utils/lib/type';
import toArray from '@form-create/utils/lib/toarray';

@@ -169,2 +170,14 @@ function bind(ctx) {

},
injectValidate() {
return toArray(this.prop.validate).map(item => {
return {
...item, inject: {
id: this.id,
field: this.field,
rule: this.rule,
api: this.$handle.api,
}
}
});
},
check(handle) {

@@ -171,0 +184,0 @@ return this.vm === handle.vm

@@ -300,2 +300,17 @@ import {byCtx, invoke, mergeRule, parseFn, toJson} from './util';

},
getRenderRule: (id) => {
const ctx = h.getCtx(id);
if (ctx) {
return ctx.prop;
}
},
getRefRule: (id) => {
const ctxs = h.getCtxs(id);
if (ctxs) {
const rules = ctxs.map(ctx => {
return ctx.rule;
})
return rules.length === 1 ? rules[0] : rules;
}
},
setEffect(id, attr, value) {

@@ -434,3 +449,3 @@ const ctx = h.getCtx(id);

if (config.type === 'fetch') {
asyncFetch(config).then(res => {
api.fetch(config).then(res => {
resolve({res, config});

@@ -457,2 +472,7 @@ }).catch(inject);

},
bus: h.bus,
fetch(opt) {
h.options.beforeFetch && invoke(() => h.options.beforeFetch(opt, {api}));
return asyncFetch(opt);
},
helper: {

@@ -463,3 +483,3 @@ tidyFields, props

['on', 'once', 'off', 'set'].forEach(n => {
['on', 'once', 'off'].forEach(n => {
api[n] = function (...args) {

@@ -466,0 +486,0 @@ h.bus[`$${n}`](...args);

@@ -69,3 +69,3 @@ import $FormCreate from '../components/formCreate';

const CreateNode = CreateNodeFactory();
const formulas ={};
const formulas = {};

@@ -282,3 +282,9 @@ exportAttrs(config.attrs || {});

this.options.value = {};
let options = {formData: {}, submitBtn: {}, resetBtn: {}, globalEvent: {}, globalData: {}, ...deepCopy(globalConfig)};
let options = {
formData: {},
submitBtn: {},
resetBtn: {},
globalEvent: {},
globalData: {}, ...deepCopy(globalConfig)
};
if (this.isSub()) {

@@ -292,3 +298,3 @@ options = this.mergeOptions(options, this.vm.setupState.parent.setupState.fc.options.value || {}, true);

opt = deepCopy(opt);
parent && ['page', 'onSubmit', 'mounted', 'reload', 'formData', 'el'].forEach((n) => {
parent && ['page', 'onSubmit', 'mounted', 'reload', 'formData', 'el', 'globalClass'].forEach((n) => {
delete opt[n];

@@ -295,0 +301,0 @@ });

@@ -129,5 +129,7 @@ import extend from '@form-create/utils/lib/extend';

}
} else if (key === 'emit')
} else if (key === 'emit') {
this.parseEmit(ctx);
else if (['prefix', 'suffix'].indexOf(key) > -1)
} else if (key === 'hidden' && Boolean(n) !== Boolean(o)) {
this.$render.clearCacheAll();
} else if (['prefix', 'suffix'].indexOf(key) > -1)
n && this.loadFn(n, ctx.rule);

@@ -159,29 +161,37 @@ else if (key === 'type') {

}));
this.bus.$once('load-end', () => {
let computed = ctx.rule.computed;
if(!computed){
return ;
}
if(typeof computed !== 'object'){
computed = {value: computed}
}
Object.keys(computed).forEach(k => {
ctx.watch.push(watch(() => {
const item = computed[k];
if (!item) return undefined;
let fn;
if (is.Function(item)) {
fn = () => item(this.api.form, this.api);
}
this.bus.$once('load-end', () => {
let computed = ctx.rule.computed;
if (!computed) {
return;
}
if (typeof computed !== 'object') {
computed = {value: computed}
}
Object.keys(computed).forEach(k => {
ctx.watch.push(watch(() => {
const item = computed[k];
if (!item) return undefined;
let fn;
if (is.Function(item)) {
fn = () => item(this.api.form, this.api);
} else {
const group = ctx.getParentGroup();
fn = () => (new Function('formulas', 'top', 'group', '$rule', '$api', `with(top){with(this){with(group){with(formulas){ return ${item} }}}}`)).call(this.api.form, this.fc.formulas, this.api.top.form, group ? (this.subRuleData[group.id] || {}) : {}, ctx.rule, this.api);
}
return invoke(fn, undefined);
}, (n) => {
setTimeout(() => {
if (k === 'value') {
this.onInput(ctx, n);
} else if (k[0] === '$') {
this.api.setEffect(ctx.id, k, n);
} else {
const group = ctx.getParentGroup();
fn = () => (new Function('formulas', 'top', 'group', `with(top){with(this){with(group){with(formulas){ return ${item} }}}}`)).call(this.api.form, this.fc.formulas, this.api.top.form, group ? (this.subRuleData[group.id] || {}) : {});
deepSet(ctx.rule, k, n);
}
return invoke(fn, undefined);
}, (n) => {
deepSet(ctx.rule, k, n);
}, {immediate: true}));
});
});
}, {immediate: true}));
});
});
}
});
this.watchEffect(ctx);

@@ -188,0 +198,0 @@ },

@@ -73,2 +73,3 @@ import Api from '../frame/api';

this.$manager.__init();
this.lifecycle('created');
},

@@ -75,0 +76,0 @@ isBreakWatch() {

@@ -38,13 +38,17 @@ import extend from '@form-create/utils/lib/extend';

if (is.trueArray(emit)) {
let emitKey = emitPrefix || field || name;
if (emitKey) {
emit.forEach(eventName => {
if (!eventName) return;
let eventInject;
if (is.Object(eventName)) {
eventInject = eventName.inject;
eventName = eventName.name;
}
emit.forEach(eventName => {
if (!eventName) return;
let eventInject;
let emitKey = emitPrefix || field || name;
if (is.Object(eventName)) {
eventInject = eventName.inject;
eventName = eventName.name;
emitKey = eventName.prefix || emitKey;
}
if (emitKey) {
const fieldKey = toLine(`${emitKey}-${eventName}`);
const fn = (...arg) => {
if (this.vm.emitsOptions) {
this.vm.emitsOptions[fieldKey] = null;
}
this.vm.emit(fieldKey, ...arg);

@@ -62,5 +66,5 @@ this.vm.emit('emit-event', fieldKey, ...arg);

}
});
}
}
});
}

@@ -67,0 +71,0 @@ ctx.computed.on = event;

@@ -20,2 +20,7 @@ import extend from '@form-create/utils/lib/extend';

this.effect(ctx, 'value');
this.emitEvent('change', ctx.field, value, {
rule: ctx.origin,
api: this.api,
setFlag: setFlag || false
})
},

@@ -28,3 +33,3 @@ onInput(ctx, value) {

},
onBaseInput(ctx, value){
onBaseInput(ctx, value) {
this.setFormData(ctx, value);

@@ -38,4 +43,4 @@ ctx.modelValue = value;

const group = ctx.getParentGroup();
if(group){
if(!this.subRuleData[group.id]) {
if (group) {
if (!this.subRuleData[group.id]) {
this.subRuleData[group.id] = {};

@@ -49,3 +54,3 @@ }

const group = ctx.getParentGroup();
if(group && this.subRuleData[group.id]){
if (group && this.subRuleData[group.id]) {
delete this.subRuleData[group.id][ctx.field];

@@ -102,5 +107,8 @@ }

},
refreshUpdate(ctx, val, origin) {
refreshUpdate(ctx, val, origin, field) {
if (is.Function(ctx.rule.update)) {
const state = invoke(() => ctx.rule.update(val, ctx.origin, this.api, {origin: origin || 'change'}));
const state = invoke(() => ctx.rule.update(val, ctx.origin, this.api, {
origin: origin || 'change',
linkField: field
}));
if (state === undefined) return;

@@ -114,3 +122,3 @@ ctx.rule.hidden = state === true;

},
refreshRule(ctx, val, origin) {
refreshRule(ctx, val, origin, field) {
if (this.refreshControl(ctx)) {

@@ -122,3 +130,3 @@ this.$render.clearCacheAll();

}
this.refreshUpdate(ctx, val, origin);
this.refreshUpdate(ctx, val, origin, field);
},

@@ -128,3 +136,3 @@ appendLink(ctx) {

is.trueArray(link) && link.forEach(field => {
const fn = () => this.refreshRule(ctx, ctx.rule.value, 'link');
const fn = () => this.refreshRule(ctx, ctx.rule.value, 'link', field);

@@ -131,0 +139,0 @@ this.bus.$on('change-' + field, fn);

import extend from '@form-create/utils/lib/extend';
import is from '@form-create/utils/lib/type';
import {invoke} from '../frame/util';
import {invoke, parseFn} from '../frame/util';
import toCase from '@form-create/utils/lib/tocase';

@@ -20,7 +21,14 @@

lifecycle(name) {
const fn = this.options[name];
is.Function(fn) && invoke(() => fn(this.api));
this.vm.emit(name, this.api);
this.emitEvent(name, this.api);
},
emitEvent(name, ...args) {
const _fn = this.options[name] || this.options[toCase('on-' + name)];
if (_fn) {
const fn = parseFn(_fn);
is.Function(fn) && invoke(() => fn(...args));
}
this.bus.$emit(name, ...args);
}
})
}

@@ -9,6 +9,9 @@ import extend from '@form-create/utils/lib/extend';

clearCache(ctx) {
if(ctx.rule.cache){
if (ctx.rule.cache) {
return;
}
if (!this.cache[ctx.id]) {
if (ctx.parent) {
this.clearCache(ctx.parent);
}
return;

@@ -19,2 +22,5 @@ }

}
if (this.cache[ctx.id].parent) {
this.clearCache(this.cache[ctx.id].parent);
}
this.cache[ctx.id] = null;

@@ -35,3 +41,3 @@ },

const cache = this.cache[ctx.id];
if(cache){
if (cache) {
cache.use = true;

@@ -38,0 +44,0 @@ return cache.vnode;

@@ -160,3 +160,5 @@ import extend, {copy} from '@form-create/utils/lib/extend';

}
cacheFlag && (!Object.keys(children).length) && this.setCache(ctx, () => _vn, parent);
cacheFlag && this.setCache(ctx, () => {
return this.stable(_vn);
}, parent);
return _vn

@@ -188,3 +190,3 @@ };

} else {
vn.props.class = [vn.props.class, 'fc-none'];
vn.props.class = vn.props.class ? [vn.props.class, 'fc-none'] : 'fc-none';
}

@@ -194,3 +196,12 @@ return vn;

},
stable(vn) {
const list = Array.isArray(vn) ? vn : [vn];
list.forEach(v => {
if (v && v.__v_isVNode && v.children && typeof v.children === 'object') {
v.children.$stable = true;
this.stable(v.children);
}
});
return vn;
},
getModelField(ctx) {

@@ -231,6 +242,6 @@ return ctx.rule.modelField || ctx.parser.modelField || this.fc.modelFields[this.vNode.aliasMap[ctx.type]] || this.fc.modelFields[ctx.type] || this.fc.modelFields[ctx.originType] || 'modelValue';

},
ctxProp(ctx, custom) {
ctxProp(ctx) {
const {ref, key, rule} = ctx;
this.$manager.mergeProp(ctx, custom);
ctx.parser.mergeProp(ctx, custom);
this.$manager.mergeProp(ctx);
ctx.parser.mergeProp(ctx);
const props = [

@@ -256,3 +267,6 @@ {

if (!custom && ctx.input) {
if (ctx.input) {
if (this.vm.props.disabled !== undefined) {
ctx.prop.props.disabled = !!this.vm.props.disabled;
}
const field = this.getModelField(ctx);

@@ -259,0 +273,0 @@ const model = {

@@ -44,3 +44,61 @@ import {App, Component, VNodeChild} from "vue";

//静态数据
export interface StaticDataItem {
//数据名称
label: string;
//数据类型
type: 'static';
//数据
result: any;
}
//远程数据
export interface FetchDataItem {
//数据名称
label: string;
//数据类型
type: 'fetch';
//请求链接
action: string;
//请求方式
method: 'GET' | 'POST';
//请求头部
headers?: Object;
//附带数据
data?: Object;
//远程数据解析
parse?: string | ((res: any) => any);
//远程异常处理
onError?: string | ((e) => void);
}
//全局数据源
export interface GlobalData {
[id: string]: StaticDataItem | FetchDataItem;
}
//全局事件
export interface GlobalEvent {
[id: string]: {
//数据名称
label: string;
//回调事件
handle: string | (($inject: Object) => void);
}
}
//全局样式
export interface GlobalClass {
[className: string]: {
//数据名称
label: string;
//样式内容
content?: string;
//回调事件
style: {
[name: string]: string;
};
}
}
export interface FormCreateFactoryConfig<MakerAttrs, OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs> {

@@ -217,3 +275,6 @@ manager: {

suffix?: string | VNodeRule;
update?: (value: any, $rule: this, api: Api<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>, arg: {origin: 'change' | 'init' | 'link'}) => Boolean | void;
update?: (value: any, $rule: this, api: Api<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>, arg: {
origin: 'change' | 'init' | 'link';
linkField?: string;
}) => Boolean | void;
options?: RuleOptions<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>;

@@ -237,5 +298,5 @@ optionsTo?: string;

componentValidate?: string | boolean;
required?:boolean | string | object;
loadData?:LoadDataEffectOption | Array<LoadDataEffectOption>
[key: string]: any
required?: boolean | string | object;
loadData?: LoadDataEffectOption | Array<LoadDataEffectOption>;
[key: string]: any;
};

@@ -368,2 +429,12 @@

reload?: (api: Api<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>) => void;
onMounted?: (api: Api<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>) => void;
onReload?: (api: Api<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>) => void;
onChange?: (field: string, value: any, opt: {
rule: Rule<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>;
api: Api<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>;
setFlag: boolean;
}) => void;
globalClass: GlobalClass;
globalEvent: GlobalEvent;
globalData: GlobalData;
}

@@ -485,2 +556,6 @@

getRefRule(name: string): Rule<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs> | Rule<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>[];
getRenderRule(id: string): Rule<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>;
updateValidate(id: string, validate: Object[], merge?: Boolean): Promise<any>;

@@ -512,3 +587,3 @@

setChildrenFormData(field: string | Rule<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>, formData: FormData, cover:boolean): void;
setChildrenFormData(field: string | Rule<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>, formData: FormData, cover: boolean): void;

@@ -527,2 +602,11 @@ getSubForm(field: string): Api<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs> | Api<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>[];

fetch(opt: FetchOption): Promise<any>;
bus: {
$emit(event: string, ...args: any[]): void;
$on(event: string | string[], callback: Function): void;
$once(event: string | string[], callback: Function): void;
$off(event?: string | string[], callback?: Function): void;
}
on(event: string | string[], callback: Function): this;

@@ -548,3 +632,7 @@

components?: string | string[];
init?: (data: { value: any, getValue: () => any; repeat: Boolean; }, rule: Rule<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>, api: Api<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>) => void;
init?: (data: {
value: any,
getValue: () => any;
repeat: Boolean;
}, rule: Rule<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>, api: Api<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>) => void;
load?: (data: EffectValue, rule: Rule<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>, api: Api<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>) => void;

@@ -587,3 +675,3 @@ loaded?: (data: EffectValue, rule: Rule<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>, api: Api<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>) => void;

export interface FetchEffectOption {
action: String | ((rule: object,api: object)=>Promise<any>);
action: String | ((rule: object, api: object) => Promise<any>);
to?: String;

@@ -590,0 +678,0 @@ parse?: String | ((body: any, rule: Object, api: Object) => any);

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc