全栈小学生 b4d1350cf3 update admin
2023-07-01 16:28:06 +08:00

2 lines
4.1 KiB
JavaScript

import{g as T,f as U}from"./index-cd1661d3.js";import{g as w,U as W,l as V,h as j,a8 as D,b as K,u as n,m as l,n as m,q as g,I as b,J as C,D as z,F as A,_ as F,ae as q,ag as J,W as O,V as G,j as H,v as S,t as B,K as P,L as R,T as M,y as Q,a7 as X}from"./base-45eb5090.js";const I="elDescriptions";var E=w({name:"ElDescriptionsCell",props:{cell:{type:Object},tag:{type:String},type:{type:String}},setup(){return{descriptions:W(I,{})}},render(){var v,o,t,N,s,d;const a=T(this.cell),{border:$,direction:e}=this.descriptions,c=e==="vertical",u=((t=(o=(v=this.cell)==null?void 0:v.children)==null?void 0:o.label)==null?void 0:t.call(o))||a.label,r=(d=(s=(N=this.cell)==null?void 0:N.children)==null?void 0:s.default)==null?void 0:d.call(s),p=a.span,_=a.align?`is-${a.align}`:"",f=a.labelAlign?`is-${a.labelAlign}`:_,h=a.className,k=a.labelClassName,y={width:V(a.width),minWidth:V(a.minWidth)},i=j("descriptions");switch(this.type){case"label":return D(this.tag,{style:y,class:[i.e("cell"),i.e("label"),i.is("bordered-label",$),i.is("vertical-label",c),f,k],colSpan:c?p:1},u);case"content":return D(this.tag,{style:y,class:[i.e("cell"),i.e("content"),i.is("bordered-content",$),i.is("vertical-content",c),_,h],colSpan:c?p:p*2-1},r);default:return D("td",{style:y,class:[i.e("cell"),_],colSpan:p},[D("span",{class:[i.e("label"),k]},u),D("span",{class:[i.e("content"),h]},r)])}}});const Y=K({row:{type:Array,default:()=>[]}}),Z={key:1},x=w({name:"ElDescriptionsRow"}),ee=w({...x,props:Y,setup(v){const o=W(I,{});return(t,N)=>n(o).direction==="vertical"?(l(),m(b,{key:0},[g("tr",null,[(l(!0),m(b,null,C(t.row,(s,d)=>(l(),z(n(E),{key:`tr1-${d}`,cell:s,tag:"th",type:"label"},null,8,["cell"]))),128))]),g("tr",null,[(l(!0),m(b,null,C(t.row,(s,d)=>(l(),z(n(E),{key:`tr2-${d}`,cell:s,tag:"td",type:"content"},null,8,["cell"]))),128))])],64)):(l(),m("tr",Z,[(l(!0),m(b,null,C(t.row,(s,d)=>(l(),m(b,{key:`tr3-${d}`},[n(o).border?(l(),m(b,{key:0},[A(n(E),{cell:s,tag:"td",type:"label"},null,8,["cell"]),A(n(E),{cell:s,tag:"td",type:"content"},null,8,["cell"])],64)):(l(),z(n(E),{key:1,cell:s,tag:"td",type:"both"},null,8,["cell"]))],64))),128))]))}});var te=F(ee,[["__file","/home/runner/work/element-plus/element-plus/packages/components/descriptions/src/descriptions-row.vue"]]);const se=K({border:{type:Boolean,default:!1},column:{type:Number,default:3},direction:{type:String,values:["horizontal","vertical"],default:"horizontal"},size:q,title:{type:String,default:""},extra:{type:String,default:""}}),le=w({name:"ElDescriptions"}),ne=w({...le,props:se,setup(v){const o=v,t=j("descriptions"),N=J(),s=O();G(I,o);const d=H(()=>[t.b(),t.m(N.value)]),a=(e,c,u,r=!1)=>(e.props||(e.props={}),c>u&&(e.props.span=u),r&&(e.props.span=c),e),$=()=>{var e;const c=U((e=s.default)==null?void 0:e.call(s)).filter(f=>{var h;return((h=f==null?void 0:f.type)==null?void 0:h.name)==="ElDescriptionsItem"}),u=[];let r=[],p=o.column,_=0;return c.forEach((f,h)=>{var k;const y=((k=f.props)==null?void 0:k.span)||1;if(h<c.length-1&&(_+=y>p?p:y),h===c.length-1){const i=o.column-_%o.column;r.push(a(f,i,p,!0)),u.push(r);return}y<p?(p-=y,r.push(f)):(r.push(a(f,y,p)),u.push(r),p=o.column,r=[])}),u};return(e,c)=>(l(),m("div",{class:S(n(d))},[e.title||e.extra||e.$slots.title||e.$slots.extra?(l(),m("div",{key:0,class:S(n(t).e("header"))},[g("div",{class:S(n(t).e("title"))},[B(e.$slots,"title",{},()=>[P(R(e.title),1)])],2),g("div",{class:S(n(t).e("extra"))},[B(e.$slots,"extra",{},()=>[P(R(e.extra),1)])],2)],2)):M("v-if",!0),g("div",{class:S(n(t).e("body"))},[g("table",{class:S([n(t).e("table"),n(t).is("bordered",e.border)])},[g("tbody",null,[(l(!0),m(b,null,C($(),(u,r)=>(l(),z(te,{key:r,row:u},null,8,["row"]))),128))])],2)],2)],2))}});var ae=F(ne,[["__file","/home/runner/work/element-plus/element-plus/packages/components/descriptions/src/description.vue"]]),L=w({name:"ElDescriptionsItem",props:{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:""}}});const oe=Q(ae,{DescriptionsItem:L}),ce=X(L);export{oe as E,ce as a};