2 lines
4.2 KiB
JavaScript
2 lines
4.2 KiB
JavaScript
|
import{d as w,ad as F,ao as J,ap as R,ae as O,w as P,ac as k,aq as M,ah as A,ar as Q,e as a,o as l,c as f,t as b,Y as h,Z as C,q as I,k as K,al as T,as as X,at as x,au as ee,af as te,O as se,$ as _,ag as W,y as j,K as q,x as le,av as ae,am as ne,an as re}from"./index-ce293e15.js";const B=Symbol("elDescriptions");var E=w({name:"ElDescriptionsCell",props:{cell:{type:Object},tag:{type:String,default:"td"},type:{type:String}},setup(){return{descriptions:F(B,{})}},render(){var g,o,t,N,n,c,D;const i=J(this.cell),e=(((g=this.cell)==null?void 0:g.dirs)||[]).map(U=>{const{dir:Y,arg:Z,modifiers:G,value:H}=U;return[Y,H,Z,G]}),{border:d,direction:r}=this.descriptions,s=r==="vertical",v=((N=(t=(o=this.cell)==null?void 0:o.children)==null?void 0:t.label)==null?void 0:N.call(t))||i.label,u=(D=(c=(n=this.cell)==null?void 0:n.children)==null?void 0:c.default)==null?void 0:D.call(c),m=i.span,S=i.align?`is-${i.align}`:"",y=i.labelAlign?`is-${i.labelAlign}`:S,$=i.className,V=i.labelClassName,z={width:R(i.width),minWidth:R(i.minWidth)},p=O("descriptions");switch(this.type){case"label":return P(k(this.tag,{style:z,class:[p.e("cell"),p.e("label"),p.is("bordered-label",d),p.is("vertical-label",s),y,V],colSpan:s?m:1},v),e);case"content":return P(k(this.tag,{style:z,class:[p.e("cell"),p.e("content"),p.is("bordered-content",d),p.is("vertical-content",s),S,$],colSpan:s?m:m*2-1},u),e);default:return P(k("td",{style:z,class:[p.e("cell"),S],colSpan:m},[M(v)?void 0:k("span",{class:[p.e("label"),V]},v),k("span",{class:[p.e("content"),$]},u)]),e)}}});const ie=A({row:{type:Q(Array),default:()=>[]}}),oe={key:1},ce=w({name:"ElDescriptionsRow"}),pe=w({...ce,props:ie,setup(g){const o=F(B,{});return(t,N)=>a(o).direction==="vertical"?(l(),f(h,{key:0},[b("tr",null,[(l(!0),f(h,null,C(t.row,(n,c)=>(l(),I(a(E),{key:`tr1-${c}`,cell:n,tag:"th",type:"label"},null,8,["cell"]))),128))]),b("tr",null,[(l(!0),f(h,null,C(t.row,(n,c)=>(l(),I(a(E),{key:`tr2-${c}`,cell:n,tag:"td",type:"content"},null,8,["cell"]))),128))])],64)):(l(),f("tr",oe,[(l(!0),f(h,null,C(t.row,(n,c)=>(l(),f(h,{key:`tr3-${c}`},[a(o).border?(l(),f(h,{key:0},[K(a(E),{cell:n,tag:"td",type:"label"},null,8,["cell"]),K(a(E),{cell:n,tag:"td",type:"content"},null,8,["cell"])],64)):(l(),I(a(E),{key:1,cell:n,tag:"td",type:"both"},null,8,["cell"]))],64))),128))]))}});var de=T(pe,[["__file","descriptions-row.vue"]]);const ue=A({border:{type:Boolean,default:!1},column:{type:Number,default:3},direction:{type:String,values:["horizontal","vertical"],default:"horizontal"},size:X,title:{type:String,default:""},extra:{type:String,default:""}}),me=w({name:"ElDescriptions"}),fe=w({...me,props:ue,setup(g){const o=g,t=O("descriptions"),N=x(),n=ee();te(B,o);const c=se(()=>[t.b(),t.m(N.value)]),D=(e,d,r,s=!1)=>(e.props||(e.props={}),d>r&&(e.props.span=r),s&&(e.props.span=d),e),i=()=>{if(!n.default)return[];const e=ae(n.default()).filter(u=>{var m;return((m=u==null?void 0:u.type)==null?void 0:m.name)==="ElDescriptionsItem"}),d=[];let r=[],s=o.column,v=0;return e.forEach((u,m)=>{var S;const y=((S=u.props)==null?void 0:S.span)||1;if(m<e.length-1&&(v+=y>s?s:y),m===e.length-1){const $=o.column-v%o.column;r.push(D(u,$,s,!0)),d.push(r);return}y<s?(s-=y,r.push(u)):(r.push(D(u,y,s)),d.push(r),s=o.column,r=[])}),d};return(e,d)=>(l(),f("div",{class:_(a(c))},[e.title||e.extra||e.$slots.title||e.$slots.extra?(l(),f("div",{key:0,class:_(a(t).e("header"))},[b("div",{class:_(a(t).e("title"))},[W(e.$slots,"title",{},()=>[j(q(e.title),1)])],2),b("div",{class:_(a(t).e("extra"))},[W(e.$slots,"extra",{},()=>[j(q(e.extra),1)])],2)],2)):le("v-if",!0),b("div",{class:_(a(t).e("body"))},[b("table",{class:_([a(t).e("table"),a(t).is("bordered",e.border)])},[b("tbody",null,[(l(!0),f(h,null,C(i(),(r,s)=>(l(),I(de,{key:s,row:r},null,8,["row"]))),128))])],2)],2)],2))}});var ye=T(fe,[["__file","description.vue"]]);const he=A({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,d
|