| 1 |
- var I=Object.defineProperty,P=Object.defineProperties;var j=Object.getOwnPropertyDescriptors;var _=Object.getOwnPropertySymbols;var z=Object.prototype.hasOwnProperty,B=Object.prototype.propertyIsEnumerable;var f=(a,s,e)=>s in a?I(a,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[s]=e,u=(a,s)=>{for(var e in s||(s={}))z.call(s,e)&&f(a,e,s[e]);if(_)for(var e of _(s))B.call(s,e)&&f(a,e,s[e]);return a},d=(a,s)=>P(a,j(s));import{c as O,a9 as R,m as G,d as H,r as L,e as w,b4 as N,am as q,w as E,f as c,o as n,g as p,j as F,G as k,H as x,I as C,n as v,a2 as b,k as M,q as U}from"./index-CZIX6ZiI.js";const D={theme:G("text"),rowCol:R(),loading:O(!0),animation:{type:String,default:""},customClass:{type:[String,Array,Object],default:""},customStyle:{type:Object,default(){return{}}}},J={name:"wd-skeleton",options:{virtualHost:!0,addGlobalClass:!0,styleIsolation:"shared"}},K=H(d(u({},J),{props:D,setup(a){const s={avatar:[{type:"circle",height:"64px",width:"64px"}],image:[{type:"rect",height:"64px",width:"64px"}],text:[1,[{width:"24%",height:"16px",marginRight:"16px"},{width:"76%",height:"16px"}]],paragraph:[1,1,1,{width:"55%"}]},e=a,y=L([]),S=w(()=>y.value.map(t=>{if(N(t))return[{class:m({type:"text"}),style:{}}];if(Array.isArray(t))return t.map(r=>d(u({},r),{class:m(r),style:h(r)}));const o=t;return[d(u({},o),{class:m(o),style:h(o)})]}));function m(t){return["wd-skeleton__col",`wd-skeleton--type-${t.type||"text"}`,{[`wd-skeleton--animation-${e.animation}`]:e.animation}]}function h(t){const o={},r=["size","width","height","margin","background","marginLeft","marginRight","borderRadius","backgroundColor"];for(const l of r)if(Object.prototype.hasOwnProperty.call(t,l)){const i=q(t[l]);l==="size"?(o.width=i,o.height=i):o[l]=i}return o}E(()=>e.rowCol,t=>{y.value=[...Array.isArray(t)&&t.length?e.rowCol:s[e.theme]]},{immediate:!0});const $=w(()=>e.loading==null||e.loading===!0);return(t,o)=>{const r=F;return n(),c(r,{class:b(`wd-skeleton ${t.customClass}`),style:v(t.customStyle)},{default:p(()=>[$.value?(n(),c(r,{key:0,class:"wd-skeleton__content"},{default:p(()=>[(n(!0),k(x,null,C(S.value,(l,i)=>(n(),c(r,{class:"wd-skeleton__row",key:`row-${i}`},{default:p(()=>[(n(!0),k(x,null,C(l,(g,A)=>(n(),c(r,{key:`col-${A}`,class:b(g.class),style:v(g.style)},null,8,["class","style"]))),128))]),_:2},1024))),128))]),_:1})):(n(),c(r,{key:1},{default:p(()=>[M(t.$slots,"default",{},void 0,!0)]),_:3}))]),_:3},8,["class","style"])}}})),V=U(K,[["__scopeId","data-v-b8dcf6c8"]]);export{V as _};
|