el-descriptions-item-2abce27d.js 4.4 KB

1
  1. import{d as S,aP as F,b_ as al,b$ as j,aC as q,x as P,aQ as D,c0 as nl,aA as W,aB as rl,a as s,o as a,c as m,g as h,F as v,q as N,v as A,f as J,aE as K,c1 as il,c2 as ol,aU as cl,aV as pl,K as ul,Z as w,aD as O,n as Q,t as R,P as dl,c3 as yl,aF as ml,aJ as bl,__tla as hl}from"./index-bd9277a1.js";let U,V,vl=Promise.all([(()=>{try{return hl}catch{}})()]).then(async()=>{const C=Symbol("elDescriptions");var k=S({name:"ElDescriptionsCell",props:{cell:{type:Object},tag:{type:String,default:"td"},type:{type:String}},setup:()=>({descriptions:F(C,{})}),render(){var _,o,e,$,n,c,x;const i=al(this.cell),l=(((_=this.cell)==null?void 0:_.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=(x=(c=(n=this.cell)==null?void 0:n.children)==null?void 0:c.default)==null?void 0:x.call(c),y=i.span,f=i.align?`is-${i.align}`:"",b=i.labelAlign?`is-${i.labelAlign}`:f,E=i.className,B=i.labelClassName,I={width:j(i.width),minWidth:j(i.minWidth)},p=q("descriptions");switch(this.type){case"label":return P(D(this.tag,{style:I,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 P(D(this.tag,{style:I,class:[p.e("cell"),p.e("content"),p.is("bordered-content",u),p.is("vertical-content",t),f,E],colSpan:t?y:2*y-1},d),l);default:return P(D("td",{style:I,class:[p.e("cell"),f],colSpan:y},[nl(g)?void 0:D("span",{class:[p.e("label"),B]},g),D("span",{class:[p.e("content"),E]},d)]),l)}}});const Z=W({row:{type:rl(Array),default:()=>[]}}),G={key:1},H=S({name:"ElDescriptionsRow"});var L=K(S({...H,props:Z,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,(n,c)=>(a(),A(s(k),{key:`tr1-${c}`,cell:n,tag:"th",type:"label"},null,8,["cell"]))),128))]),h("tr",null,[(a(!0),m(v,null,N(e.row,(n,c)=>(a(),A(s(k),{key:`tr2-${c}`,cell:n,tag:"td",type:"content"},null,8,["cell"]))),128))])],64)):(a(),m("tr",G,[(a(!0),m(v,null,N(e.row,(n,c)=>(a(),m(v,{key:`tr3-${c}`},[s(o).border?(a(),m(v,{key:0},[J(s(k),{cell:n,tag:"td",type:"label"},null,8,["cell"]),J(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 M=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:""}}),T=S({name:"ElDescriptions"});var X=K(S({...T,props:M,setup(_){const o=_,e=q("descriptions"),$=ol(),n=cl();pl(C,o);const c=ul(()=>[e.b(),e.m($.value)]),x=(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 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 E=o.column-g%o.column;return r.push(x(d,E,t,!0)),void u.push(r)}b<t?(t-=b,r.push(d)):(r.push(x(d,b,t)),u.push(r),t=o.column,r=[])}),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"))},[h("div",{class:w(s(e).e("title"))},[O(l.$slots,"title",{},()=>[Q(R(l.title),1)])],2),h("div",{class:w(s(e).e("extra"))},[O(l.$slots,"extra",{},()=>[Q(R(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),m(v,null,N(i(),(r,t)=>(a(),A(L,{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:""}})}),V=ml(X,{DescriptionsItem:z}),U=bl(z)});export{U as E,vl as __tla,V as a};