el-descriptions-item-a8de8e03.js 4.4 KB

1
  1. import{d as S,aQ as R,d0 as al,cR as X,aZ as j,y as W,b8 as N,cu as rl,aX as q,aY as nl,a as s,o as a,c as b,g as h,F as v,q as E,v as A,f as F,a_ as O,cq as il,bU as ol,bb as cl,bc as pl,X as ul,S as w,aB as Q,x as U,t as Y,$ as dl,d1 as yl,a$ as bl,b2 as ml,__tla as hl}from"./index-b9aa3289.js";let P,Z,vl=Promise.all([(()=>{try{return hl}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:R(z,{})}),render(){var _,o,e,$,r,c,x;const i=al(this.cell),l=(((_=this.cell)==null?void 0:_.dirs)||[]).map(V=>{const{dir:ll,arg:el,modifiers:tl,value:sl}=V;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=(x=(c=(r=this.cell)==null?void 0:r.children)==null?void 0:c.default)==null?void 0:x.call(c),y=i.span,f=i.align?`is-${i.align}`:"",m=i.labelAlign?`is-${i.labelAlign}`:f,D=i.className,B=i.labelClassName,I={width:X(i.width),minWidth:X(i.minWidth)},p=j("descriptions");switch(this.type){case"label":return W(N(this.tag,{style:I,class:[p.e("cell"),p.e("label"),p.is("bordered-label",u),p.is("vertical-label",t),m,B],colSpan:t?y:1},g),l);case"content":return W(N(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(N("td",{style:I,class:[p.e("cell"),f],colSpan:y},[rl(g)?void 0:N("span",{class:[p.e("label"),B]},g),N("span",{class:[p.e("content"),D]},d)]),l)}}});const G=q({row:{type:nl(Array),default:()=>[]}}),H={key:1},J=S({name:"ElDescriptionsRow"});var K=O(S({...J,props:G,setup(_){const o=R(z,{});return(e,$)=>s(o).direction==="vertical"?(a(),b(v,{key:0},[h("tr",null,[(a(!0),b(v,null,E(e.row,(r,c)=>(a(),A(s(k),{key:`tr1-${c}`,cell:r,tag:"th",type:"label"},null,8,["cell"]))),128))]),h("tr",null,[(a(!0),b(v,null,E(e.row,(r,c)=>(a(),A(s(k),{key:`tr2-${c}`,cell:r,tag:"td",type:"content"},null,8,["cell"]))),128))])],64)):(a(),b("tr",H,[(a(!0),b(v,null,E(e.row,(r,c)=>(a(),b(v,{key:`tr3-${c}`},[s(o).border?(a(),b(v,{key:0},[F(s(k),{cell:r,tag:"td",type:"label"},null,8,["cell"]),F(s(k),{cell:r,tag:"td",type:"content"},null,8,["cell"])],64)):(a(),A(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 L=q({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:""}}),M=S({name:"ElDescriptions"});var T=O(S({...M,props:L,setup(_){const o=_,e=j("descriptions"),$=ol(),r=cl();pl(z,o);const c=ul(()=>[e.b(),e.m($.value)]),x=(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 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 n.push(x(d,D,t,!0)),void u.push(n)}m<t?(t-=m,n.push(d)):(n.push(x(d,m,t)),u.push(n),t=o.column,n=[])}),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",{},()=>[U(Y(l.title),1)])],2),h("div",{class:w(s(e).e("extra"))},[Q(l.$slots,"extra",{},()=>[U(Y(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(),(n,t)=>(a(),A(K,{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:q({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:""}})}),Z=bl(T,{DescriptionsItem:C}),P=ml(C)});export{P as E,vl as __tla,Z as a};