useForm-86d11f60.js
1.67 KB
var t=(m,s,n)=>new Promise((r,c)=>{var l=o=>{try{a(n.next(o))}catch(f){c(f)}},e=o=>{try{a(n.throw(o))}catch(f){c(f)}},a=o=>o.done?r(o.value):Promise.resolve(o.value).then(l,e);a((n=n.apply(m,s)).next())});import{k as d,u as i,w as u,q as h}from"./vue-5a35c3f5.js";import{aP as y,aQ as F,aR as w}from"./index.js";function g(m){const s=d(null),n=d(!1);function r(){return t(this,null,function*(){const e=i(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 h(),e})}function c(e){i(n)&&y()&&e===i(s)||(s.value=e,n.value=!0,u(()=>m,()=>{m&&e.setProps(F(m))},{immediate:!0,deep:!0}))}return[c,{scrollToField:(e,a)=>t(this,null,function*(){(yield r()).scrollToField(e,a)}),setProps:e=>t(this,null,function*(){(yield r()).setProps(e)}),updateSchema:e=>t(this,null,function*(){(yield r()).updateSchema(e)}),resetSchema:e=>t(this,null,function*(){(yield r()).resetSchema(e)}),clearValidate:e=>t(this,null,function*(){(yield r()).clearValidate(e)}),resetFields:()=>t(this,null,function*(){r().then(e=>t(this,null,function*(){yield e.resetFields()}))}),removeSchemaByField:e=>t(this,null,function*(){var a;(a=i(s))==null||a.removeSchemaByField(e)}),getFieldsValue:()=>{var e;return(e=i(s))==null?void 0:e.getFieldsValue()},setFieldsValue:e=>t(this,null,function*(){(yield r()).setFieldsValue(e)}),appendSchemaByField:(e,a,o)=>t(this,null,function*(){(yield r()).appendSchemaByField(e,a,o)}),submit:()=>t(this,null,function*(){return(yield r()).submit()}),validate:e=>t(this,null,function*(){return(yield r()).validate(e)}),validateFields:e=>t(this,null,function*(){return(yield r()).validateFields(e)})}]}export{g as u};