el-descriptions-item-e35ef249.js 4.4 KB

1
  1. import{d as S,aq as R,cR as al,cG as j,aL as q,z as W,aY as x,ci as rl,aJ as M,aK as nl,a as s,o as a,c as m,g as v,F as h,v as E,x as z,f as B,aN as F,ce as il,c3 as ol,b0 as cl,au as pl,M as ul,X as w,aM as G,y as J,t as K,a3 as dl,cS as yl,aO as ml,aS as bl,__tla as vl}from"./index-dbf77a14.js";let L,P,hl=Promise.all([(()=>{try{return vl}catch{}})()]).then(async()=>{const A=Symbol("elDescriptions");var k=S({name:"ElDescriptionsCell",props:{cell:{type:Object},tag:{type:String,default:"td"},type:{type:String}},setup:()=>({descriptions:R(A,{})}),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,D=i.className,O=i.labelClassName,I={width:j(i.width),minWidth:j(i.minWidth)},p=q("descriptions");switch(this.type){case"label":return W(x(this.tag,{style:I,class:[p.e("cell"),p.e("label"),p.is("bordered-label",u),p.is("vertical-label",t),b,O],colSpan:t?y:1},g),l);case"content":return W(x(this.tag,{style:I,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 W(x("td",{style:I,class:[p.e("cell"),f],colSpan:y},[rl(g)?void 0:x("span",{class:[p.e("label"),O]},g),x("span",{class:[p.e("content"),D]},d)]),l)}}});const X=M({row:{type:nl(Array),default:()=>[]}}),Y={key:1},H=S({name:"ElDescriptionsRow"});var Q=F(S({...H,props:X,setup(_){const o=R(A,{});return(e,N)=>s(o).direction==="vertical"?(a(),m(h,{key:0},[v("tr",null,[(a(!0),m(h,null,E(e.row,(r,c)=>(a(),z(s(k),{key:`tr1-${c}`,cell:r,tag:"th",type:"label"},null,8,["cell"]))),128))]),v("tr",null,[(a(!0),m(h,null,E(e.row,(r,c)=>(a(),z(s(k),{key:`tr2-${c}`,cell:r,tag:"td",type:"content"},null,8,["cell"]))),128))])],64)):(a(),m("tr",Y,[(a(!0),m(h,null,E(e.row,(r,c)=>(a(),m(h,{key:`tr3-${c}`},[s(o).border?(a(),m(h,{key:0},[B(s(k),{cell:r,tag:"td",type:"label"},null,8,["cell"]),B(s(k),{cell:r,tag:"td",type:"content"},null,8,["cell"])],64)):(a(),z(s(k),{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 T=M({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=F(S({...U,props:T,setup(_){const o=_,e=q("descriptions"),N=ol(),r=cl();pl(A,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 D=o.column-g%o.column;return n.push($(d,D,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: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"))},[G(l.$slots,"title",{},()=>[J(K(l.title),1)])],2),v("div",{class:w(s(e).e("extra"))},[G(l.$slots,"extra",{},()=>[J(K(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,E(i(),(n,t)=>(a(),z(Q,{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 C;C=S({name:"ElDescriptionsItem",props:M({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:""}})}),P=ml(V,{DescriptionsItem:C}),L=bl(C)});export{L as E,hl as __tla,P as a};