UNPKG

vuux

Version:

Vue3 Nuxt3 Nuxt4 组件库

2 lines (1 loc) 3.22 kB
"use strict";const e=require("vue"),d=require("./hook/useProgress.cjs"),r=require("@vuux/icons"),k={key:0,class:"is-animated"},p={key:1,class:"is-text"},m=["width","height"],u=["stroke-width"],h=["stroke-width","stroke","stroke-dasharray","stroke-dashoffset"],y={key:0,transform:"translate(50,50) scale(0.4)"},f={key:1,transform:"translate(50,50) scale(0.4)"},B={key:2,x:"50",y:"50","text-anchor":"middle","dominant-baseline":"central","font-size":"12",fill:"var(--app-text-color)"},g={key:3,class:"is-circle-animated"},_=e.defineComponent({name:"Progress",__name:"index",props:{type:{default:"line"},status:{default:"normal"},percentage:{},strokeWidth:{default:6},circleSize:{default:120},strokeColor:{default:"var(--app-theme)"},animated:{type:Boolean}},setup(s){const t=s,{classNames:n,lineStyle:c,bgColor:l,dashoffset:a,circumference:i}=d.useProgress(t);return(x,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["app-progress",e.unref(n)])},[t.type==="line"?(e.openBlock(),e.createElementBlock("div",{key:0,class:"progress-line",style:e.normalizeStyle({height:t.strokeWidth+"px"})},[e.createElementVNode("div",{class:"is-inner",style:e.normalizeStyle(e.unref(c))},null,4),t.animated?(e.openBlock(),e.createElementBlock("div",k)):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),t.type==="line"?(e.openBlock(),e.createElementBlock("span",p,[t.status==="normal"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(t.percentage)+"%",1)],64)):t.status==="success"?(e.openBlock(),e.createBlock(e.unref(r.Icon),{key:1,name:"Icon1722501",size:14,color:"var(--app-success)"})):t.status==="error"?(e.openBlock(),e.createBlock(e.unref(r.Icon),{key:2,name:"Icon9176904",size:14,color:"var(--app-danger)"})):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),t.type==="circle"?(e.openBlock(),e.createElementBlock("svg",{key:2,class:"progress-circle",viewBox:"0 0 100 100",width:t.circleSize,height:t.circleSize},[e.createElementVNode("circle",{cx:"50",cy:"50",r:"45",fill:"none","stroke-width":t.strokeWidth,stroke:"#f0f0f0"},null,8,u),e.createElementVNode("circle",{cx:"50",cy:"50",r:"45",fill:"none","stroke-width":t.strokeWidth,stroke:e.unref(l),"stroke-dasharray":e.unref(i),"stroke-dashoffset":e.unref(a),"stroke-linecap":"round",transform:"rotate(-90 50 50)"},null,8,h),t.status==="success"?(e.openBlock(),e.createElementBlock("g",y,[...o[0]||(o[0]=[e.createElementVNode("path",{d:"M-10,0 L-2,8 L12,-6",stroke:"var(--app-success)","stroke-width":"3",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):t.status==="error"?(e.openBlock(),e.createElementBlock("g",f,[...o[1]||(o[1]=[e.createElementVNode("line",{x1:"-8",y1:"-8",x2:"8",y2:"8",stroke:"var(--app-danger)","stroke-width":"3","stroke-linecap":"round"},null,-1),e.createElementVNode("line",{x1:"8",y1:"-8",x2:"-8",y2:"8",stroke:"var(--app-danger)","stroke-width":"3","stroke-linecap":"round"},null,-1)])])):(e.openBlock(),e.createElementBlock("text",B,e.toDisplayString(t.percentage)+"%",1))],8,m)):e.createCommentVNode("",!0),t.type==="circle"&&t.animated?(e.openBlock(),e.createElementBlock("div",g)):e.createCommentVNode("",!0)],2))}});module.exports=_;