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