提交其他文件

This commit is contained in:
2026-03-14 16:20:49 +08:00
parent a227deaecd
commit 0a19b334f8
1385 changed files with 73568 additions and 0 deletions

View File

@ -0,0 +1 @@
var M=Object.defineProperty,T=Object.defineProperties;var F=Object.getOwnPropertyDescriptors;var V=Object.getOwnPropertySymbols;var W=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable;var z=(r,s,t)=>s in r?M(r,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[s]=t,h=(r,s)=>{for(var t in s||(s={}))W.call(s,t)&&z(r,t,s[t]);if(V)for(var t of V(s))j.call(s,t)&&z(r,t,s[t]);return r},b=(r,s)=>T(r,F(s));var S=(r,s,t)=>new Promise((o,p)=>{var v=i=>{try{m(t.next(i))}catch(d){p(d)}},y=i=>{try{m(t.throw(i))}catch(d){p(d)}},m=i=>i.done?o(i.value):Promise.resolve(i.value).then(v,y);m((t=t.apply(r,s)).next())});import{a5 as w,aJ as f,aI as q,a6 as G,d as J,aL as X,r as H,T as L,W as $,c as C,j as g,w as k,p as D,F as K,q as O,l as Q,aa as N,k as P,af as U,_ as B,ak as Y,s as Z,bc as x,x as ee}from"./index-B-O76M86.js";const ae=b(h({},G),{num:q(5),modelValue:{type:[String,Number,null],default:null},readonly:w(!1),size:f("16px"),space:f("4px"),color:f("#E8E8E8"),activeColor:{type:[String,Array],default:"linear-gradient(180deg, rgba(255,238,0,1) 0%,rgba(250,176,21,1) 100%)"},icon:f("star-on"),activeIcon:f("star-on"),disabled:w(!1),disabledColor:f("linear-gradient(315deg, rgba(177,177,177,1) 0%,rgba(199,199,199,1) 100%)"),allowHalf:w(!1)}),te={name:"wd-rate",options:{addGlobalClass:!0,virtualHost:!0,styleIsolation:"shared"}},se=J(b(h({},te),{props:ae,emits:["update:modelValue","change"],setup(r,{emit:s}){const{proxy:t}=X(),o=r,p=s,v=H([]),y=H(""),m=L(()=>`background:${o.color};`),i=L(()=>`background:${o.disabled?o.disabledColor:y.value};`);$(()=>o.activeColor,e=>{Array.isArray(e)&&!e.length&&console.error("activeColor cannot be an empty array"),A()},{immediate:!0,deep:!0}),$([()=>o.num,()=>o.modelValue],()=>{E()},{immediate:!0,deep:!0});const d=e=>e!=="0";function E(){const{modelValue:e,num:c,allowHalf:n}=o;if(e===null||!c)return;if(typeof e!="number"){console.error("[wot ui] error(wd-rate): the value of wd-rate should be a number");return}const a=[],l=Math.floor(e);for(let u=0;u<c;u++)u<l?a.push("100%"):u===l&&n&&e%1!==0?a.push("50%"):a.push("0");v.value=a,A()}function A(){const{activeColor:e,modelValue:c,num:n}=o;let a="";Array.isArray(e)&&e.length?a=Number(c)<=n*.6||!e[1]?e[0]:e[1]:a=e,y.value=a}function _(e,c){if(o.readonly||o.disabled)return;const n=c?e+.5:e+1;p("update:modelValue",n),p("change",{value:n})}function R(e){return S(this,null,function*(){const{clientX:c}=e.touches[0],n=yield x(".wd-rate__item",!0,t),a=Array.from(n).findIndex(l=>c>=l.left&&c<=l.right);if(a!==-1){const l=n[a],u=l.width,I=o.allowHalf&&c-l.left<u/2;(I?a+.5:a+1)>=.5&&_(a,I)}})}return(e,c)=>{const n=Q;return g(),C(n,{class:Z(`wd-rate ${e.customClass}`),style:N(e.customStyle),onTouchmove:R},{default:k(()=>[(g(!0),D(K,null,O(v.value,(a,l)=>(g(),C(n,{key:l,"data-index":l,style:N({"margin-right":l==v.value.length-1?0:e.space}),class:"wd-rate__item"},{default:k(()=>[P(B,{"custom-class":"wd-rate__item-star",name:d(a)?e.activeIcon:e.icon,size:e.size,"custom-style":a==="100%"?i.value:m.value,onClick:u=>_(l,!1)},null,8,["name","size","custom-style","onClick"]),o.allowHalf?(g(),C(n,{key:0,class:"wd-rate__item-half",onClick:Y(u=>_(l,!0),["stop"])},{default:k(()=>[P(B,{"custom-class":"wd-rate__item-star",name:d(a)?e.activeIcon:e.icon,size:e.size,"custom-style":a!=="0"?i.value:m.value},null,8,["name","size","custom-style"])]),_:2},1032,["onClick"])):U("",!0)]),_:2},1032,["data-index","style"]))),128))]),_:1},8,["class","style"])}}})),ne=ee(se,[["__scopeId","data-v-53cc98ad"]]);export{ne as _};