el-descriptions-item-123c95bd.js 4.4 KB

1
  1. import{d as S,aT as B,c3 as al,c1 as G,aG as H,D as W,bS as D,c4 as rl,aE as j,aF as nl,a as s,o as a,c as m,j as h,F as v,C as E,k as A,i as J,aI as K,c5 as il,bK as ol,b1 as cl,at as pl,e as ul,a1 as k,aH as O,l as R,t as T,S as dl,c6 as yl,aJ as ml,aN as bl,__tla as hl}from"./index-e8ea4cae.js";let P,q,vl=Promise.all([(()=>{try{return hl}catch{}})()]).then(async()=>{const C=Symbol("elDescriptions");var w=S({name:"ElDescriptionsCell",props:{cell:{type:Object},tag:{type:String,default:"td"},type:{type:String}},setup:()=>({descriptions:B(C,{})}),render(){var _,o,e,N,r,c,$;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:n}=this.descriptions,t=n==="vertical",g=((N=(e=(o=this.cell)==null?void 0:o.children)==null?void 0:e.label)==null?void 0:N.call(e))||i.label,d=($=(c=(r=this.cell)==null?void 0:r.children)==null?void 0:c.default)==null?void 0:$.call(c),y=i.span,f=i.align?`is-${i.align}`:"",b=i.labelAlign?`is-${i.labelAlign}`:f,x=i.className,F=i.labelClassName,z={width:G(i.width),minWidth:G(i.minWidth)},p=H("descriptions");switch(this.type){case"label":return W(D(this.tag,{style:z,class:[p.e("cell"),p.e("label"),p.is("bordered-label",u),p.is("vertical-label",t),b,F],colSpan:t?y:1},g),l);case"content":return W(D(this.tag,{style:z,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 W(D("td",{style:z,class:[p.e("cell"),f],colSpan:y},[rl(g)?void 0:D("span",{class:[p.e("label"),F]},g),D("span",{class:[p.e("content"),x]},d)]),l)}}});const L=j({row:{type:nl(Array),default:()=>[]}}),M={key:1},Q=S({name:"ElDescriptionsRow"});var U=K(S({...Q,props:L,setup(_){const o=B(C,{});return(e,N)=>s(o).direction==="vertical"?(a(),m(v,{key:0},[h("tr",null,[(a(!0),m(v,null,E(e.row,(r,c)=>(a(),A(s(w),{key:`tr1-${c}`,cell:r,tag:"th",type:"label"},null,8,["cell"]))),128))]),h("tr",null,[(a(!0),m(v,null,E(e.row,(r,c)=>(a(),A(s(w),{key:`tr2-${c}`,cell:r,tag:"td",type:"content"},null,8,["cell"]))),128))])],64)):(a(),m("tr",M,[(a(!0),m(v,null,E(e.row,(r,c)=>(a(),m(v,{key:`tr3-${c}`},[s(o).border?(a(),m(v,{key:0},[J(s(w),{cell:r,tag:"td",type:"label"},null,8,["cell"]),J(s(w),{cell:r,tag:"td",type:"content"},null,8,["cell"])],64)):(a(),A(s(w),{key:1,cell:r,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 V=j({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:""}}),X=S({name:"ElDescriptions"});var Y=K(S({...X,props:V,setup(_){const o=_,e=H("descriptions"),N=ol(),r=cl();pl(C,o);const c=ul(()=>[e.b(),e.m(N.value)]),$=(l,u,n,t=!1)=>(l.props||(l.props={}),u>n&&(l.props.span=n),t&&(l.props.span=u),l),i=()=>{if(!r.default)return[];const l=yl(r.default()).filter(d=>{var y;return((y=d==null?void 0:d.type)==null?void 0:y.name)==="ElDescriptionsItem"}),u=[];let n=[],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 n.push($(d,x,t,!0)),void u.push(n)}b<t?(t-=b,n.push(d)):(n.push($(d,b,t)),u.push(n),t=o.column,n=[])}),u};return(l,u)=>(a(),m("div",{class:k(s(c))},[l.title||l.extra||l.$slots.title||l.$slots.extra?(a(),m("div",{key:0,class:k(s(e).e("header"))},[h("div",{class:k(s(e).e("title"))},[O(l.$slots,"title",{},()=>[R(T(l.title),1)])],2),h("div",{class:k(s(e).e("extra"))},[O(l.$slots,"extra",{},()=>[R(T(l.extra),1)])],2)],2)):dl("v-if",!0),h("div",{class:k(s(e).e("body"))},[h("table",{class:k([s(e).e("table"),s(e).is("bordered",l.border)])},[h("tbody",null,[(a(!0),m(v,null,E(i(),(n,t)=>(a(),A(U,{key:t,row:n},null,8,["row"]))),128))])],2)],2)],2))}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/descriptions/src/description.vue"]]);let I;I=S({name:"ElDescriptionsItem",props:j({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:""}})}),q=ml(Y,{DescriptionsItem:I}),P=bl(I)});export{P as E,vl as __tla,q as a};