var h=(m,s,a)=>new Promise((u,d)=>{var f=r=>{try{n(a.next(r))}catch(l){d(l)}},t=r=>{try{n(a.throw(r))}catch(l){d(l)}},n=r=>r.done?u(r.value):Promise.resolve(r.value).then(f,t);n((a=a.apply(m,s)).next())});import{h as T}from"./index-B_2CoVdl.js";import{f as g,u as D}from"./vue-vendor-CxLCUzY4.js";import{validateFormModelAndTables as w,VALIDATE_FAILED as F}from"./vxeUtils-Ck0LG0y-.js";import"./antd-vue-vendor-CDWW6V_M.js";import"./vxe-table-vendor-B5h3MVdD.js";function k(m,s,a,u,d,f){const t=g();function n(e,o,c,v){c.loading=!0,T.get({url:e,params:o},{isTransformResponse:!1}).then(p=>{let{result:A}=p;p.success&&A&&(Array.isArray(A)?c.dataSource=A:Array.isArray(A.records)&&(c.dataSource=A.records)),typeof v=="function"&&v(p)}).finally(()=>{c.loading=!1})}function r(e){var o,c;(c=(o=a[e])==null?void 0:o.value)==null||c.resetScrollTop(0)}function l(){let e=Object.values(a);return Promise.all(e)}function y(){l().then(e=>{let o=t.value.getFieldsValue();return w(t.value.validate,o,e,t.value.getProps,!1)}).then(e=>f&&typeof f=="function"?f(e):i(e)).then(e=>{if(typeof s!="function")throw b("classifyIntoFormData");let o=s(e);return m(o)}).catch(e=>{e.error===F&&(e.paneKey?u.value=e.paneKey:u.value=e.subIndex==null?e.index==null?D(u):d.value[e.index]:Object.keys(a)[e.subIndex])})}function i(e){return new Promise(o=>{o(e)})}function b(e){return`${e} 未定义或不是一个函数`}function j(e){return`${e} 未定义或不是一个数组`}return[r,y,n,t]}function E(m,s){function a(){return h(this,null,function*(){let t={},n=Object.keys(s),r="";for(let l=0;l<n.length;l++){r=n[l];let y=s[r].value;if(y.isForm){let i=yield f(y,r);i&&(t[r+"List"]=[i])}else{let i=yield d(y,r);i&&i.length>0&&(t[r+"List"]=i)}}return t})}function u(t){return t&&Object.keys(t).map(n=>{t[n]instanceof Array&&(t[n]=t[n].join(","))}),t}function d(t,n){return h(this,null,function*(){return(yield t.validateTable())?(m.value=n,t.resetScrollTop(0),Promise.reject(1)):t.getTableData()})}function f(t,n){return h(this,null,function*(){try{let r=yield t.getFormData();return u(r),r}catch(r){return m.value=n,Promise.reject(r)}})}return{getSubFormAndTableData:a,transformData:u}}export{k as useJvxeMethod,E as useValidateAntFormAndTable};
