yifengyide/public/dist/assets/index-c8f3c6f2.js

2 lines
3.3 KiB
JavaScript

import{p as A,d as x,v as _,q as j,C as E,b as $,j as S,f as b,k as C,A as D,t as k,z as F,m as z,F as I,y as N,c as V,x as q,u as B,ae as a,aD as J,r as K,aE as M,aF as O}from"./index-7b3f5fdc.js";const P=A(x({name:"LayDescriptionsItem",__name:"descriptionsItem",props:{label:{},span:{default:1},align:{default:"left"},labelAlign:{default:"left"},style:{},class:{},labelStyle:{},labelClass:{}},setup:r=>()=>{}})),w=Symbol("LayDescriptions"),h=x({name:"LayDescriptionsCell",props:{cell:{type:Object,default:()=>({})},tag:{type:String,default:""},type:{type:String,default:""}},setup:()=>({descriptionsContext:B(w,{})}),render(){var r,t,p,i;const{border:f,direction:L}=this.descriptionsContext,e=this.cell.props||{},o=((t=(r=this.cell.children)==null?void 0:r.label)==null?void 0:t.call(r))||e.label,n=(i=(p=this.cell.children)==null?void 0:p.default)==null?void 0:i.call(p),l=e.span,c=e.align?`is-${e.align}`:"",u=e.labelAlign?`is-${e.labelAlign}`:"",s=e.style,y=e.labelStyle,m=e.class,d=e.labelClass,v=L==="vertical",g=this.type==="label";switch(this.type){case"label":case"content":return a(this.tag,{style:g?y:s,class:["layui-descriptions-cell",`layui-descriptions-${this.type}`,g?`${d} ${u}`:`${m} ${c}`,,{[`is-border-${this.type}`]:f,[`is-vertical-${this.type}`]:v}],colSpan:v?l:g?1:2*l-1},g?o:n);default:return a("td",{class:["layui-descriptions-cell"],colSpan:l},[O(o)?void 0:a("span",{style:y,class:["layui-descriptions-label",d,u]},o),a("span",{style:s,class:["layui-descriptions-content",m,c]},n)])}}}),Q=x({name:"LayDescriptionsRow",props:{row:{type:Array,default:()=>[]}},setup(r){const{direction:t,border:p}=B(w,{});return()=>t==="vertical"?[a("tr",r.row.map(i=>a(h,{cell:i,tag:"th",type:"label"}))),a("tr",r.row.map(i=>a(h,{cell:i,tag:"td",type:"content"})))]:a("tr",r.row.map(i=>p?[a(h,{cell:i,tag:"td",type:"label"}),a(h,{cell:i,tag:"td",type:"content"})]:a(h,{cell:i,tag:"td",type:"item"})))}}),R={key:0,class:"layui-descriptions-header"},T={class:"layui-descriptions-header-title"},Z={class:"layui-descriptions-header-extra"},G={class:"layui-descriptions-body"},U=A(x({name:"LayDescriptions",__name:"descriptions",props:{dataList:{},title:{},extra:{},border:{type:Boolean,default:!1},column:{default:3},direction:{default:"horizontal"},size:{default:"md"}},setup(r){const t=r,p=_(),i=j(()=>["layui-descriptions",`layui-descriptions-${t.size}`]),f=(e,o,n,l=!1)=>(e.props||(e.props={}),o>n&&(e.props.span=n),l&&(e.props.span=o),e),L=()=>{let e=[];var o;t.dataList&&t.dataList.length?(o=t.dataList,e=o.map(s=>a(P,{...J(K(s),"label","content")},{default:()=>s.content,label:()=>s.label}))):p!=null&&p.default&&(e=M(p.default()).filter(s=>s.type.name==="LayDescriptionsItem"));const n=[];let l=[],c=t.column,u=0;return e.forEach((s,y)=>{var m;const d=((m=s.props)==null?void 0:m.span)||1;if(y<e.length-1&&(u+=d>c?c:d),y===e.length-1){const v=t.column-u%t.column;return l.push(f(s,v,c,!0)),void n.push(l)}d<c?(c-=d,l.push(s)):(l.push(f(s,d,c)),n.push(l),c=t.column,l=[])}),n};return E(w,{...t}),(e,o)=>($(),S("div",{class:z(i.value)},[e.title||e.extra?($(),S("div",R,[b("div",T,[C(e.$slots,"title",{},()=>[D(k(e.title),1)])]),b("div",Z,[C(e.$slots,"extra",{},()=>[D(k(e.extra),1)])])])):F("",!0),b("div",G,[b("table",{class:z({"is-border":e.border})},[b("tbody",null,[($(!0),S(I,null,N(L(),(n,l)=>($(),V(q(Q),{key:l,row:n},null,8,["row"]))),128))])],2)])],2))}}));export{U as Z,P as n};