1 |
- System.register(["./index-legacy.eb062188.js"],(function(e){"use strict";var t,r,n,a,o,l,i,s,u,d;return{setters:[function(e){t=e.t,r=e.z,n=e.v,a=e.d,o=e.x,l=e.S,i=e.W,s=e.c,u=e.a4,d=e.D}],execute:function(){const[c,m]=t("form"),g={colon:Boolean,disabled:Boolean,readonly:Boolean,showError:Boolean,labelWidth:r,labelAlign:String,inputAlign:String,scrollToError:Boolean,validateFirst:Boolean,submitOnEnter:n,showErrorMessage:n,errorMessageAlign:String,validateTrigger:{type:[String,Array],default:"onBlur"}};var f=a({name:c,props:g,emits:["submit","failed"],setup(e,{emit:t,slots:r}){const{children:n,linkChildren:a}=o(l),d=e=>e?n.filter((t=>e.includes(t.name))):n,c=t=>{return"string"==typeof t?(e=>{const t=n.find((t=>t.name===e));return t?new Promise(((e,r)=>{t.validate().then((t=>{t?r(t):e()}))})):Promise.reject()})(t):e.validateFirst?(r=t,new Promise(((e,t)=>{const n=[];d(r).reduce(((e,t)=>e.then((()=>{if(!n.length)return t.validate().then((e=>{e&&n.push(e)}))}))),Promise.resolve()).then((()=>{n.length?t(n):e()}))}))):(e=>new Promise(((t,r)=>{const n=d(e);Promise.all(n.map((e=>e.validate()))).then((e=>{(e=e.filter(Boolean)).length?r(e):t()}))})))(t);var r},g=(e,t)=>{n.some((r=>r.name===e&&(r.$el.scrollIntoView(t),!0)))},f=()=>n.reduce(((e,t)=>(void 0!==t.name&&(e[t.name]=t.formValue.value),e)),{}),h=()=>{const r=f();c().then((()=>t("submit",r))).catch((n=>{t("failed",{values:r,errors:n}),e.scrollToError&&n[0].name&&g(n[0].name)}))},v=e=>{u(e),h()};return a({props:e}),i({submit:h,validate:c,getValues:f,scrollToField:g,resetValidation:e=>{"string"==typeof e&&(e=[e]),d(e).forEach((e=>{e.resetValidation()}))},getValidationStatus:()=>n.reduce(((e,t)=>(e[t.name]=t.getValidationStatus(),e)),{})}),()=>{var e;return s("form",{class:m(),onSubmit:v},[null==(e=r.default)?void 0:e.call(r)])}}});e("F",d(f))}}}));
|