You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
7 lines
2.1 KiB
7 lines
2.1 KiB
import{e as b,f as I,c as w,b as x}from"./light-0dfdc1ad.js";import{f as v,a as j,b as M}from"./context-3585cc4b.js";import{u as S}from"./use-config-816d55a6.js";import{k as g}from"./keysOf-5d5107c5.js";import{d as O,r as P,p as y,a8 as B}from"./index-f4658ae7.js";const C=b("form",[I("inline",`
|
|
width: 100%;
|
|
display: inline-flex;
|
|
align-items: flex-start;
|
|
align-content: space-around;
|
|
`,[b("form-item",{width:"auto",marginRight:"18px"},[w("&:last-child",{marginRight:0})])])]);var F=globalThis&&globalThis.__awaiter||function(n,c,o,r){function u(s){return s instanceof o?s:new o(function(a){a(s)})}return new(o||(o=Promise))(function(s,a){function h(t){try{i(r.next(t))}catch(m){a(m)}}function e(t){try{i(r.throw(t))}catch(m){a(m)}}function i(t){t.done?s(t.value):u(t.value).then(h,e)}i((r=r.apply(n,c||[])).next())})};const L=Object.assign(Object.assign({},x.props),{inline:Boolean,labelWidth:[Number,String],labelAlign:String,labelPlacement:{type:String,default:"top"},model:{type:Object,default:()=>{}},rules:Object,disabled:Boolean,size:String,showRequireMark:{type:Boolean,default:void 0},requireMarkPlacement:String,showFeedback:{type:Boolean,default:!0},onSubmit:{type:Function,default:n=>{n.preventDefault()}},showLabel:{type:Boolean,default:void 0},validateMessages:Object}),T=O({name:"Form",props:L,setup(n){const{mergedClsPrefixRef:c}=S(n);x("Form","-form",C,M,n,c);const o={},r=P(void 0),u=e=>{const i=r.value;(i===void 0||e>=i)&&(r.value=e)};function s(e,i=()=>!0){return F(this,void 0,void 0,function*(){yield new Promise((t,m)=>{const p=[];for(const d of g(o)){const f=o[d];for(const l of f)l.path&&p.push(l.internalValidate(null,i))}Promise.all(p).then(d=>{if(d.some(f=>!f.valid)){const f=d.filter(l=>l.errors).map(l=>l.errors);e&&e(f),m(f)}else e&&e(),t()})})})}function a(){for(const e of g(o)){const i=o[e];for(const t of i)t.restoreValidation()}}return y(v,{props:n,maxChildLabelWidthRef:r,deriveMaxChildLabelWidth:u}),y(j,{formItems:o}),Object.assign({validate:s,restoreValidation:a},{mergedClsPrefix:c})},render(){const{mergedClsPrefix:n}=this;return B("form",{class:[`${n}-form`,this.inline&&`${n}-form--inline`],onSubmit:this.onSubmit},this.$slots)}});export{T as N};
|