1 |
- import{d as S,aS as j,b$ as T,bZ as F,aD as O,B as z,bO as E,c0 as U,aB as B,aC as V,a as s,o as a,c as b,k as v,F as h,A,j as C,i as Z,aF as q,c1 as X,bQ as Y,b0 as ll,aq as el,e as tl,Z as k,aE as G,m as K,t as Q,l as sl,c2 as al,aG as nl,aK as rl}from"./index-03f5d926.js";const I=Symbol("elDescriptions");var x=S({name:"ElDescriptionsCell",props:{cell:{type:Object},tag:{type:String,default:"td"},type:{type:String}},setup:()=>({descriptions:j(I,{})}),render(){var w,o,e,$,n,c,D;const i=T(this.cell),l=(((w=this.cell)==null?void 0:w.dirs)||[]).map(H=>{const{dir:J,arg:L,modifiers:M,value:P}=H;return[J,P,L,M]}),{border:u,direction:r}=this.descriptions,t=r==="vertical",g=(($=(e=(o=this.cell)==null?void 0:o.children)==null?void 0:e.label)==null?void 0:$.call(e))||i.label,d=(D=(c=(n=this.cell)==null?void 0:n.children)==null?void 0:c.default)==null?void 0:D.call(c),y=i.span,f=i.align?`is-${i.align}`:"",m=i.labelAlign?`is-${i.labelAlign}`:f,N=i.className,W=i.labelClassName,_={width:F(i.width),minWidth:F(i.minWidth)},p=O("descriptions");switch(this.type){case"label":return z(E(this.tag,{style:_,class:[p.e("cell"),p.e("label"),p.is("bordered-label",u),p.is("vertical-label",t),m,W],colSpan:t?y:1},g),l);case"content":return z(E(this.tag,{style:_,class:[p.e("cell"),p.e("content"),p.is("bordered-content",u),p.is("vertical-content",t),f,N],colSpan:t?y:2*y-1},d),l);default:return z(E("td",{style:_,class:[p.e("cell"),f],colSpan:y},[U(g)?void 0:E("span",{class:[p.e("label"),W]},g),E("span",{class:[p.e("content"),N]},d)]),l)}}});const il=B({row:{type:V(Array),default:()=>[]}}),ol={key:1},cl=S({name:"ElDescriptionsRow"});var pl=q(S({...cl,props:il,setup(w){const o=j(I,{});return(e,$)=>s(o).direction==="vertical"?(a(),b(h,{key:0},[v("tr",null,[(a(!0),b(h,null,A(e.row,(n,c)=>(a(),C(s(x),{key:`tr1-${c}`,cell:n,tag:"th",type:"label"},null,8,["cell"]))),128))]),v("tr",null,[(a(!0),b(h,null,A(e.row,(n,c)=>(a(),C(s(x),{key:`tr2-${c}`,cell:n,tag:"td",type:"content"},null,8,["cell"]))),128))])],64)):(a(),b("tr",ol,[(a(!0),b(h,null,A(e.row,(n,c)=>(a(),b(h,{key:`tr3-${c}`},[s(o).border?(a(),b(h,{key:0},[Z(s(x),{cell:n,tag:"td",type:"label"},null,8,["cell"]),Z(s(x),{cell:n,tag:"td",type:"content"},null,8,["cell"])],64)):(a(),C(s(x),{key:1,cell:n,tag:"td",type:"both"},null,8,["cell"]))],64))),128))]))}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/descriptions/src/descriptions-row.vue"]]);const ul=B({border:{type:Boolean,default:!1},column:{type:Number,default:3},direction:{type:String,values:["horizontal","vertical"],default:"horizontal"},size:X,title:{type:String,default:""},extra:{type:String,default:""}}),dl=S({name:"ElDescriptions"});var yl=q(S({...dl,props:ul,setup(w){const o=w,e=O("descriptions"),$=Y(),n=ll();el(I,o);const c=tl(()=>[e.b(),e.m($.value)]),D=(l,u,r,t=!1)=>(l.props||(l.props={}),u>r&&(l.props.span=r),t&&(l.props.span=u),l),i=()=>{if(!n.default)return[];const l=al(n.default()).filter(d=>{var y;return((y=d==null?void 0:d.type)==null?void 0:y.name)==="ElDescriptionsItem"}),u=[];let r=[],t=o.column,g=0;return l.forEach((d,y)=>{var f;const m=((f=d.props)==null?void 0:f.span)||1;if(y<l.length-1&&(g+=m>t?t:m),y===l.length-1){const N=o.column-g%o.column;return r.push(D(d,N,t,!0)),void u.push(r)}m<t?(t-=m,r.push(d)):(r.push(D(d,m,t)),u.push(r),t=o.column,r=[])}),u};return(l,u)=>(a(),b("div",{class:k(s(c))},[l.title||l.extra||l.$slots.title||l.$slots.extra?(a(),b("div",{key:0,class:k(s(e).e("header"))},[v("div",{class:k(s(e).e("title"))},[G(l.$slots,"title",{},()=>[K(Q(l.title),1)])],2),v("div",{class:k(s(e).e("extra"))},[G(l.$slots,"extra",{},()=>[K(Q(l.extra),1)])],2)],2)):sl("v-if",!0),v("div",{class:k(s(e).e("body"))},[v("table",{class:k([s(e).e("table"),s(e).is("bordered",l.border)])},[v("tbody",null,[(a(!0),b(h,null,A(i(),(r,t)=>(a(),C(pl,{key:t,row:r},null,8,["row"]))),128))])],2)],2)],2))}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/descriptions/src/description.vue"]]);const R=S({name:"ElDescriptionsItem",props:B({label:{type:String,default:""},span:{type:Number,default:1},width:{type:[String,Number],default:""},minWidth:{type:[String,Number],default:""},align:{type:String,default:"left"},labelAlign:{type:String,default:""},className:{type:String,default:""},labelClassName:{type:String,default:""}})}),bl=nl(yl,{DescriptionsItem:R}),ml=rl(R);export{ml as E,bl as a};
|