(function(u,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(u=typeof globalThis<"u"?globalThis:u||self,n(u.index={},u.Vue))})(this,function(u,n){"use strict";const g={modelValue:{type:Number,default:0},readOnly:{type:Boolean,default:!1},count:{type:Number,default:5},color:{type:String,default:""},allowHalf:{type:Boolean,default:!1},onChange:{type:Function,default:void 0},onTouched:{type:Function,default:void 0}},V=()=>n.createVNode("svg",{class:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"1389",width:"16px",height:"16px"},[n.createVNode("path",{d:"M979.444 404.205c-3.597-11.189-13.188-18.681-23.977-20.28l-288.119-41.76L538.674 81.022c-4.895-9.89-14.985-16.584-26.674-16.584-11.788 0-21.779 6.793-26.674 16.584L356.652 342.166l-288.219 41.76c-10.79 1.598-20.38 9.19-23.976 20.28-3.697 11.188-0.3 22.877 7.492 30.47l208.397 203.4-49.152 286.92c-1.798 10.69 2.298 22.179 11.788 28.972s21.68 7.293 31.37 2.198L512.1 820.798l257.648 135.168c9.79 5.095 21.779 4.596 31.27-2.197a29.5 29.5 0 0 0 11.788-28.972l-49.252-286.92 208.397-203.201a29.663 29.663 0 0 0 7.493-30.47z","p-id":"1390"},null)]),M="",v="g";function p(t,s,a){let c=t;return s&&(c+=`__${s}`),a&&(c+=`--${a}`),c}function N(t,s=!1){const a=s?`.${v}-${t}`:`${v}-${t}`;return{b:()=>p(a),e:l=>l?p(a,l):"",m:l=>l?p(a,"",l):"",em:(l,h)=>l&&h?p(a,l,h):""}}const C="G",r=n.defineComponent({name:`${C}Rate`,props:g,emits:["change","update:modelValue"],setup(t,{emit:s,slots:a}){const c=N("rate"),d=n.ref(t.modelValue),f=n.ref(new Array(t.count).fill({width:"0%"})),m=o=>{const e=o%1>0,i=e?o-.5:o-1;f.value.map((L,y)=>{i>=y?f.value[y]={width:e&&i===y?"50%":"100%"}:f.value[y]={width:0}})};m(d.value);const l=o=>{const e=o.target;return t.allowHalf&&o.offsetX*2<=e.clientWidth},h=(o,e)=>{t.readOnly||(e=l(o)?e+.5:e+1,m(e))},S=(o,e)=>{t.readOnly||(e=l(o)?e+.5:e+1,m(e),d.value=e,s("update:modelValue",e),s("change",e))},w=n.computed(()=>a.default?a.default():V()),$=()=>f.value.map((o,e)=>n.createVNode("div",{class:c.e("icon"),onMousemove:i=>{h(i,e)},onClick:i=>{S(i,e)}},[n.createVNode("span",null,[w.value]),n.createVNode("span",{class:c.m("active"),style:{width:o.width,color:t.color,fill:t.color}},[w.value])])),b=n.computed(()=>({[c.b()]:!0,[c.m("read-only")]:t.readOnly}));return()=>n.createVNode("div",{class:b.value,onMouseleave:()=>{m(d.value)}},[$(),n.createVNode("div",{class:c.e("info")},[a.info&&a.info(d.value)])])}});r.install=function(t,s){t.component(s||r.name,r)};const O={title:"Rate 评分",category:"数据描述",status:"100%",install(t){t.component(r.name,r)}};u.Rate=r,u.default=O,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
