el-descriptions-item-ea4ff715.js 4.4 KB

1
  1. import{d as S,aS as F,c2 as al,c0 as O,aF as R,C as W,bO as E,c3 as rl,aD as j,aE as nl,a as s,o as a,c as m,j as h,F as v,B as N,k as A,i as G,aH as H,c4 as il,bQ as ol,b0 as cl,as as pl,e as ul,a0 as k,aG as M,l as Q,t as q,R as dl,c5 as yl,aI as ml,aM as bl,__tla as hl}from"./index-bf46fda2.js";let P,J,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:F(C,{})}),render(){var _,o,e,$,r,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:n}=this.descriptions,t=n==="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=(r=this.cell)==null?void 0:r.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,z={width:O(i.width),minWidth:O(i.minWidth)},p=R("descriptions");switch(this.type){case"label":return W(E(this.tag,{style:z,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 W(E(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(E("td",{style:z,class:[p.e("cell"),f],colSpan:y},[rl(g)?void 0:E("span",{class:[p.e("label"),B]},g),E("span",{class:[p.e("content"),x]},d)]),l)}}});const K=j({row:{type:nl(Array),default:()=>[]}}),L={key:1},T=S({name:"ElDescriptionsRow"});var U=H(S({...T,props:K,setup(_){const o=F(C,{});return(e,$)=>s(o).direction==="vertical"?(a(),m(v,{key:0},[h("tr",null,[(a(!0),m(v,null,N(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,N(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",L,[(a(!0),m(v,null,N(e.row,(r,c)=>(a(),m(v,{key:`tr3-${c}`},[s(o).border?(a(),m(v,{key:0},[G(s(w),{cell:r,tag:"td",type:"label"},null,8,["cell"]),G(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=H(S({...X,props:V,setup(_){const o=_,e=R("descriptions"),$=ol(),r=cl();pl(C,o);const c=ul(()=>[e.b(),e.m($.value)]),D=(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(d,x,t,!0)),void u.push(n)}b<t?(t-=b,n.push(d)):(n.push(D(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"))},[M(l.$slots,"title",{},()=>[Q(q(l.title),1)])],2),h("div",{class:k(s(e).e("extra"))},[M(l.$slots,"extra",{},()=>[Q(q(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,N(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:""}})}),J=ml(Y,{DescriptionsItem:I}),P=bl(I)});export{P as E,vl as __tla,J as a};