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.
2 lines
4.4 KiB
2 lines
4.4 KiB
import{b as I,d as z,R as W,u as O,m as $,c as S,o as m,a as b,w as A,E as G,x as V,n as v,e as a,g as H,I as k,v as C,r as B,z as N,A as P,J,y as g,a9 as X,ag as Z,h as D,a2 as q,al as K,O as h,k as T,ab as F,i as w,H as Q}from"./normalize-040897f0.js";import{T as M,E as _,_ as U,B as ee}from"./base-4c430c4f.js";import{k as te,d as se}from"./config-provider-d42b9336.js";import{P as y,i as Y,a as le}from"./vnode-db119818.js";const ae=["light","dark"],ne=I({title:{type:String,default:""},description:{type:String,default:""},type:{type:String,values:te(M),default:"info"},closable:{type:Boolean,default:!0},closeText:{type:String,default:""},showIcon:Boolean,center:Boolean,effect:{type:String,values:ae,default:"light"}}),oe={close:t=>t instanceof MouseEvent},ie=z({name:"ElAlert"}),re=z({...ie,props:ne,emits:oe,setup(t,{emit:d}){const u=t,{Close:c}=ee,i=W(),l=O("alert"),f=$(!0),s=S(()=>M[u.type]),o=S(()=>[l.e("icon"),{[l.is("big")]:!!u.description||!!i.default}]),r=S(()=>({[l.is("bold")]:u.description||i.default})),n=e=>{f.value=!1,d("close",e)};return(e,p)=>(m(),b(Z,{name:a(l).b("fade"),persisted:""},{default:A(()=>[G(V("div",{class:v([a(l).b(),a(l).m(e.type),a(l).is("center",e.center),a(l).is(e.effect)]),role:"alert"},[e.showIcon&&a(s)?(m(),b(a(_),{key:0,class:v(a(o))},{default:A(()=>[(m(),b(H(a(s))))]),_:1},8,["class"])):k("v-if",!0),V("div",{class:v(a(l).e("content"))},[e.title||e.$slots.title?(m(),C("span",{key:0,class:v([a(l).e("title"),a(r)])},[B(e.$slots,"title",{},()=>[N(P(e.title),1)])],2)):k("v-if",!0),e.$slots.default||e.description?(m(),C("p",{key:1,class:v(a(l).e("description"))},[B(e.$slots,"default",{},()=>[N(P(e.description),1)])],2)):k("v-if",!0),e.closable?(m(),C(J,{key:2},[e.closeText?(m(),C("div",{key:0,class:v([a(l).e("close-btn"),a(l).is("customed")]),onClick:n},P(e.closeText),3)):(m(),b(a(_),{key:1,class:v(a(l).e("close-btn")),onClick:n},{default:A(()=>[g(a(c))]),_:1},8,["class"]))],64)):k("v-if",!0)],2)],2),[[X,f.value]])]),_:3},8,["name"]))}});var ce=U(re,[["__file","/home/runner/work/element-plus/element-plus/packages/components/alert/src/alert.vue"]]);const ge=D(ce),ue=I({prefixCls:{type:String}}),j=z({name:"ElSpaceItem",props:ue,setup(t,{slots:d}){const u=O("space"),c=S(()=>`${t.prefixCls||u.b()}__item`);return()=>q("div",{class:c.value},B(d,"default"))}}),x={small:8,default:12,large:16};function fe(t){const d=O("space"),u=S(()=>[d.b(),d.m(t.direction),t.class]),c=$(0),i=$(0),l=S(()=>{const s=t.wrap||t.fill?{flexWrap:"wrap",marginBottom:`-${i.value}px`}:{},o={alignItems:t.alignment};return[s,o,t.style]}),f=S(()=>{const s={paddingBottom:`${i.value}px`,marginRight:`${c.value}px`},o=t.fill?{flexGrow:1,minWidth:`${t.fillRatio}%`}:{};return[s,o]});return K(()=>{const{size:s="small",wrap:o,direction:r,fill:n}=t;if(h(s)){const[e=0,p=0]=s;c.value=e,i.value=p}else{let e;T(s)?e=s:e=x[s||"small"]||x.small,(o||n)&&r==="horizontal"?c.value=i.value=e:r==="horizontal"?(c.value=e,i.value=0):(i.value=e,c.value=0)}}),{classes:u,containerStyle:l,itemStyle:f}}const pe=I({direction:{type:String,values:["horizontal","vertical"],default:"horizontal"},class:{type:w([String,Object,Array]),default:""},style:{type:w([String,Array,Object]),default:""},alignment:{type:w(String),default:"center"},prefixCls:{type:String},spacer:{type:w([Object,String,Number,Array]),default:null,validator:t=>F(t)||T(t)||Q(t)},wrap:Boolean,fill:Boolean,fillRatio:{type:Number,default:100},size:{type:[String,Array,Number],values:se,validator:t=>T(t)||h(t)&&t.length===2&&t.every(T)}}),de=z({name:"ElSpace",props:pe,setup(t,{slots:d}){const{classes:u,containerStyle:c,itemStyle:i}=fe(t);function l(f,s="",o=[]){const{prefixCls:r}=t;return f.forEach((n,e)=>{Y(n)?h(n.children)&&n.children.forEach((p,E)=>{Y(p)&&h(p.children)?l(p.children,`${s+E}-`,o):o.push(g(j,{style:i.value,prefixCls:r,key:`nested-${s+E}`},{default:()=>[p]},y.PROPS|y.STYLE,["style","prefixCls"]))}):le(n)&&o.push(g(j,{style:i.value,prefixCls:r,key:`LoopKey${s+e}`},{default:()=>[n]},y.PROPS|y.STYLE,["style","prefixCls"]))}),o}return()=>{var f;const{spacer:s,direction:o}=t,r=B(d,"default",{key:0},()=>[]);if(((f=r.children)!=null?f:[]).length===0)return null;if(h(r.children)){let n=l(r.children);if(s){const e=n.length-1;n=n.reduce((p,E,L)=>{const R=[...p,E];return L!==e&&R.push(g("span",{style:[i.value,o==="vertical"?"width: 100%":null],key:L},[F(s)?s:N(s,y.TEXT)],y.STYLE)),R},[])}return g("div",{class:u.value,style:c.value},n,y.STYLE|y.CLASS)}return r.children}}}),he=D(de);export{ge as E,he as a};
|