el-descriptions-item-994dee79.js 4.4 KB

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