2 lines
1.5 KiB
Java
2 lines
1.5 KiB
Java
var y=(e,n,t)=>new Promise((u,f)=>{var a=l=>{try{r(t.next(l))}catch(o){f(o)}},s=l=>{try{r(t.throw(l))}catch(o){f(o)}},r=l=>l.done?u(l.value):Promise.resolve(l.value).then(a,s);r((t=t.apply(e,n)).next())});import{z as v}from"./index-X7Y8jykP.js";import"./emoji-mart-vue-fast-R0uJEDq-.js";import"./vue-vendor-DNhG1Cve.js";const c=Symbol();function h(e,n,t,u,f){return y(this,null,function*(){if(!(e&&typeof e=="function"))throw`validate 参数需要的是一个方法,而传入的却是${typeof e}`;let a={},s=yield new Promise((l,o)=>{e().then(()=>{for(let i in n)n[i]instanceof Array&&v(u,i)==="string"&&(n[i]=n[i].join(","));l(n)}).catch(({errorFields:i})=>{o({error:c,index:0,errorFields:i})})});Object.assign(a,{formValue:s});let r=yield T(t,f);return a=Object.assign(a,{tablesValue:r}),a})}function T(e,n=!0){if(!(e instanceof Array))throw`'validateTables'函数的'cases'参数需要的是一个数组,而传入的却是${typeof e}`;return new Promise((t,u)=>{let f=[],a=0;(!e||e.length===0)&&t(f),(function s(){let r=e[a];r.value.validateTable().then(l=>{if(!l)f[a]={tableData:r.value.getTableData()},++a===e.length?t(f):s();else{let o,i=p(r.value,"ATabPane");if(i&&(o=i.$.vnode.key,n)){let b=p(i,"Tabs");b&&b.setActiveKey&&b.setActiveKey(o)}u({error:c,index:a,paneKey:o,errMap:l,subIndex:a})}})})()})}function p(e,n){let t=e.$parent;if(t&&t.$options){if(t.$options.name===n)return t;{let u=p(t,n);if(u)return u}}return null}export{c as VALIDATE_FAILED,p as getVmParentByName,h as validateFormModelAndTables,T as validateTables};
|