Files
qhmes/web-dist/js/useForm-D61zovon.js
2026-06-16 18:19:57 +08:00

2 lines
2.0 KiB
Java

var r=(i,s,n)=>new Promise((o,f)=>{var u=t=>{try{a(n.next(t))}catch(m){f(m)}},e=t=>{try{a(n.throw(t))}catch(m){f(m)}},a=t=>t.done?o(t.value):Promise.resolve(t.value).then(u,e);a((n=n.apply(i,s)).next())});import{h}from"./BasicForm-ClUSoD_-.js";import{b as p,a2 as F,e as w,a0 as g}from"./index-X7Y8jykP.js";import{d as v,r as y,u as c,h as b,n as S}from"./vue-vendor-DNhG1Cve.js";function O(i){const s=y(null),n=y(!1);function o(){return r(this,null,function*(){const e=c(s);return e||w("The form instance has not been obtained, please make sure that the form has been rendered when performing the form operation!"),yield S(),e})}function f(e){v(()=>{s.value=null,n.value=null}),!(c(n)&&p()&&e===c(s))&&(s.value=e,n.value=!0,b(()=>i,()=>{i&&e.setProps(g(i))},{immediate:!0,deep:!0}))}return[f,{scrollToField:(e,a)=>r(null,null,function*(){(yield o()).scrollToField(e,a)}),setProps:e=>r(null,null,function*(){(yield o()).setProps(e)}),updateSchema:e=>r(null,null,function*(){(yield o()).updateSchema(e)}),resetSchema:e=>r(null,null,function*(){(yield o()).resetSchema(e)}),clearValidate:e=>r(null,null,function*(){(yield o()).clearValidate(e)}),resetFields:()=>r(null,null,function*(){o().then(e=>r(null,null,function*(){yield e.resetFields()}))}),removeSchemaByFiled:e=>r(null,null,function*(){var a;(a=c(s))==null||a.removeSchemaByFiled(e)}),getFieldsValue:()=>{var a;let e=(a=c(s))==null?void 0:a.getFieldsValue();return e&&Object.keys(e).map(t=>{e[t]instanceof Array&&(typeof(e[t][0]||"")=="object"||(e[t]=e[t].join(",")))}),e},setFieldsValue:e=>r(null,null,function*(){(yield o()).setFieldsValue(e)}),appendSchemaByField:(e,a,t)=>r(null,null,function*(){(yield o()).appendSchemaByField(e,a,t)}),submit:()=>r(null,null,function*(){return(yield o()).submit()}),validate:e=>r(null,null,function*(){const a=yield o();let t=i||a.getProps;return a.validate(e).then(l=>{for(let d in l)l[d]instanceof Array&&F(a.getSchemaByField(d),a)==="string"&&(l[d]=l[d].join(","));return h(t,l)})}),validateFields:(e,a)=>r(null,null,function*(){return(yield o()).validateFields(e,a)})}]}export{O as u};