el-descriptions-item-fd42286f.js 4.4 KB

1
  1. import{d as S,aO as P,b$ as al,c0 as j,aB as q,v as O,aP as E,c1 as nl,az as W,aA as rl,a as s,o as a,c as m,g as v,F as h,n as N,q as A,f as F,aD as J,c2 as il,bD as ol,aT as cl,aU as pl,J as ul,Y as w,aC as R,m as T,t as U,O as dl,c3 as yl,aE as ml,aI as bl,__tla as vl}from"./index-2eab2d23.js";let Y,G,hl=Promise.all([(()=>{try{return vl}catch{}})()]).then(async()=>{const z=Symbol("elDescriptions");var k=S({name:"ElDescriptionsCell",props:{cell:{type:Object},tag:{type:String,default:"td"},type:{type:String}},setup:()=>({descriptions:P(z,{})}),render(){var _,o,e,$,n,c,D;const i=al(this.cell),l=(((_=this.cell)==null?void 0:_.dirs)||[]).map(Z=>{const{dir:ll,arg:el,modifiers:tl,value:sl}=Z;return[ll,sl,el,tl]}),{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}`:"",b=i.labelAlign?`is-${i.labelAlign}`:f,x=i.className,B=i.labelClassName,I={width:j(i.width),minWidth:j(i.minWidth)},p=q("descriptions");switch(this.type){case"label":return O(E(this.tag,{style:I,class:[p.e("cell"),p.e("label"),p.is("bordered-label",u),p.is("vertical-label",t),b,B],colSpan:t?y:1},g),l);case"content":return O(E(this.tag,{style:I,class:[p.e("cell"),p.e("content"),p.is("bordered-content",u),p.is("vertical-content",t),f,x],colSpan:t?y:2*y-1},d),l);default:return O(E("td",{style:I,class:[p.e("cell"),f],colSpan:y},[nl(g)?void 0:E("span",{class:[p.e("label"),B]},g),E("span",{class:[p.e("content"),x]},d)]),l)}}});const H=W({row:{type:rl(Array),default:()=>[]}}),K={key:1},L=S({name:"ElDescriptionsRow"});var M=J(S({...L,props:H,setup(_){const o=P(z,{});return(e,$)=>s(o).direction==="vertical"?(a(),m(h,{key:0},[v("tr",null,[(a(!0),m(h,null,N(e.row,(n,c)=>(a(),A(s(k),{key:`tr1-${c}`,cell:n,tag:"th",type:"label"},null,8,["cell"]))),128))]),v("tr",null,[(a(!0),m(h,null,N(e.row,(n,c)=>(a(),A(s(k),{key:`tr2-${c}`,cell:n,tag:"td",type:"content"},null,8,["cell"]))),128))])],64)):(a(),m("tr",K,[(a(!0),m(h,null,N(e.row,(n,c)=>(a(),m(h,{key:`tr3-${c}`},[s(o).border?(a(),m(h,{key:0},[F(s(k),{cell:n,tag:"td",type:"label"},null,8,["cell"]),F(s(k),{cell:n,tag:"td",type:"content"},null,8,["cell"])],64)):(a(),A(s(k),{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 Q=W({border:{type:Boolean,default:!1},column:{type:Number,default:3},direction:{type:String,values:["horizontal","vertical"],default:"horizontal"},size:il,title:{type:String,default:""},extra:{type:String,default:""}}),V=S({name:"ElDescriptions"});var X=J(S({...V,props:Q,setup(_){const o=_,e=q("descriptions"),$=ol(),n=cl();pl(z,o);const c=ul(()=>[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=yl(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 b=((f=d.props)==null?void 0:f.span)||1;if(y<l.length-1&&(g+=b>t?t:b),y===l.length-1){const x=o.column-g%o.column;return r.push(D(d,x,t,!0)),void u.push(r)}b<t?(t-=b,r.push(d)):(r.push(D(d,b,t)),u.push(r),t=o.column,r=[])}),u};return(l,u)=>(a(),m("div",{class:w(s(c))},[l.title||l.extra||l.$slots.title||l.$slots.extra?(a(),m("div",{key:0,class:w(s(e).e("header"))},[v("div",{class:w(s(e).e("title"))},[R(l.$slots,"title",{},()=>[T(U(l.title),1)])],2),v("div",{class:w(s(e).e("extra"))},[R(l.$slots,"extra",{},()=>[T(U(l.extra),1)])],2)],2)):dl("v-if",!0),v("div",{class:w(s(e).e("body"))},[v("table",{class:w([s(e).e("table"),s(e).is("bordered",l.border)])},[v("tbody",null,[(a(!0),m(h,null,N(i(),(r,t)=>(a(),A(M,{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"]]);let C;C=S({name:"ElDescriptionsItem",props:W({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:""}})}),G=ml(X,{DescriptionsItem:C}),Y=bl(C)});export{Y as E,hl as __tla,G as a};