4 lines
15 KiB
JavaScript
4 lines
15 KiB
JavaScript
import{aR as w,aS as X,aU as H,aT as A,aQ as K,aP as U,cS as V,cW as j,d as I,aG as x,k as u,C as g,a1 as F,aO as $,r as B,bU as Y,aI as E,ba as z,bb as Q,bc as q,bd as J,aJ as Z,b2 as ee,cC as te,bu as re,c9 as oe}from"./CwKn53hw.js";import{C as se}from"./BV82VG60.js";import{u as ne}from"./5FrA0FWU.js";import{_ as le}from"./pXk2senR.js";const ie=["normal","exception","active","success"],_=()=>({prefixCls:String,type:w(),percent:Number,format:U(),status:w(),showInfo:K(),strokeWidth:Number,strokeLinecap:w(),strokeColor:A(),trailColor:String,width:Number,success:H(),gapDegree:Number,gapPosition:w(),size:X([String,Number,Array]),steps:Number,successPercent:Number,title:String,progressStatus:w()});function P(e){return!e||e<0?0:e>100?100:e}function D(e){let{success:t,successPercent:o}=e,r=o;return t&&"progress"in t&&(V(!1,"Progress","`success.progress` is deprecated. Please use `success.percent` instead."),r=t.progress),t&&"percent"in t&&(r=t.percent),r}function ae(e){let{percent:t,success:o,successPercent:r}=e;const s=P(D({success:o,successPercent:r}));return[s,P(P(t)-s)]}function ce(e){let{success:t={},strokeColor:o}=e;const{strokeColor:r}=t;return[r||j.green,o||null]}const W=(e,t,o)=>{var r,s,p,l;let n=-1,i=-1;if(t==="step"){const h=o.steps,d=o.strokeWidth;typeof e=="string"||typeof e>"u"?(n=e==="small"?2:14,i=d??8):typeof e=="number"?[n,i]=[e,e]:[n=14,i=8]=e,n*=h}else if(t==="line"){const h=o==null?void 0:o.strokeWidth;typeof e=="string"||typeof e>"u"?i=h||(e==="small"?6:8):typeof e=="number"?[n,i]=[e,e]:[n=-1,i=8]=e}else(t==="circle"||t==="dashboard")&&(typeof e=="string"||typeof e>"u"?[n,i]=e==="small"?[60,60]:[120,120]:typeof e=="number"?[n,i]=[e,e]:(n=(s=(r=e[0])!==null&&r!==void 0?r:e[1])!==null&&s!==void 0?s:120,i=(l=(p=e[0])!==null&&p!==void 0?p:e[1])!==null&&l!==void 0?l:120));return{width:n,height:i}};var ue=function(e,t){var o={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(o[r[s]]=e[r[s]]);return o};const de=()=>x(x({},_()),{strokeColor:A(),direction:w()}),ge=e=>{let t=[];return Object.keys(e).forEach(o=>{const r=parseFloat(o.replace(/%/g,""));isNaN(r)||t.push({key:r,value:e[o]})}),t=t.sort((o,r)=>o.key-r.key),t.map(o=>{let{key:r,value:s}=o;return`${s} ${r}%`}).join(", ")},fe=(e,t)=>{const{from:o=j.blue,to:r=j.blue,direction:s=t==="rtl"?"to left":"to right"}=e,p=ue(e,["from","to","direction"]);if(Object.keys(p).length!==0){const l=ge(p);return{backgroundImage:`linear-gradient(${s}, ${l})`}}return{backgroundImage:`linear-gradient(${s}, ${o}, ${r})`}},pe=I({compatConfig:{MODE:3},name:"ProgressLine",inheritAttrs:!1,props:de(),setup(e,t){let{slots:o,attrs:r}=t;const s=u(()=>{const{strokeColor:a,direction:f}=e;return a&&typeof a!="string"?fe(a,f):{backgroundColor:a}}),p=u(()=>e.strokeLinecap==="square"||e.strokeLinecap==="butt"?0:void 0),l=u(()=>e.trailColor?{backgroundColor:e.trailColor}:void 0),n=u(()=>{var a;return(a=e.size)!==null&&a!==void 0?a:[-1,e.strokeWidth||(e.size==="small"?6:8)]}),i=u(()=>W(n.value,"line",{strokeWidth:e.strokeWidth})),h=u(()=>{const{percent:a}=e;return x({width:`${P(a)}%`,height:`${i.value.height}px`,borderRadius:p.value},s.value)}),d=u(()=>D(e)),y=u(()=>{const{success:a}=e;return{width:`${P(d.value)}%`,height:`${i.value.height}px`,borderRadius:p.value,backgroundColor:a==null?void 0:a.strokeColor}}),v={width:i.value.width<0?"100%":i.value.width,height:`${i.value.height}px`};return()=>{var a;return g(F,null,[g("div",$($({},r),{},{class:[`${e.prefixCls}-outer`,r.class],style:[r.style,v]}),[g("div",{class:`${e.prefixCls}-inner`,style:l.value},[g("div",{class:`${e.prefixCls}-bg`,style:h.value},null),d.value!==void 0?g("div",{class:`${e.prefixCls}-success-bg`,style:y.value},null):null])]),(a=o.default)===null||a===void 0?void 0:a.call(o)])}}}),ve={percent:0,prefixCls:"vc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,trailColor:"#D9D9D9",tra
|
|||
|
|
a ${l},${l} 0 1 1 ${h},${-d}
|
||
|
|
a ${l},${l} 0 1 1 ${-h},${d}`,v=Math.PI*2*l,a={stroke:o,strokeDasharray:`${t/100*(v-s)}px ${v}px`,strokeDashoffset:`-${s/2+e/100*(v-s)}px`,transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s"};return{pathString:y,pathStyle:a}}const ye=I({compatConfig:{MODE:3},name:"VCCircle",props:E(me,ve),setup(e){R+=1;const t=B(R),o=u(()=>T(e.percent)),r=u(()=>T(e.strokeColor)),[s,p]=ne();he(p);const l=()=>{const{prefixCls:n,strokeWidth:i,strokeLinecap:h,gapDegree:d,gapPosition:y}=e;let v=0;return o.value.map((a,f)=>{const c=r.value[f]||r.value[r.value.length-1],b=Object.prototype.toString.call(c)==="[object Object]"?`url(#${n}-gradient-${t.value})`:"",{pathString:C,pathStyle:S}=M(v,a,c,i,d,y);v+=a;const k={key:f,d:C,stroke:b,"stroke-linecap":h,"stroke-width":i,opacity:a===0?0:1,"fill-opacity":"0",class:`${n}-circle-path`,style:S};return g("path",$({ref:s(f)},k),null)})};return()=>{const{prefixCls:n,strokeWidth:i,trailWidth:h,gapDegree:d,gapPosition:y,trailColor:v,strokeLinecap:a,strokeColor:f}=e,c=Ce(e,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","strokeColor"]),{pathString:b,pathStyle:C}=M(0,100,v,i,d,y);delete c.percent;const S=r.value.find(m=>Object.prototype.toString.call(m)==="[object Object]"),k={d:b,stroke:v,"stroke-linecap":a,"stroke-width":h||i,"fill-opacity":"0",class:`${n}-circle-trail`,style:C};return g("svg",$({class:`${n}-circle`,viewBox:"0 0 100 100"},c),[S&&g("defs",null,[g("linearGradient",{id:`${n}-gradient-${t.value}`,x1:"100%",y1:"0%",x2:"0%",y2:"0%"},[Object.keys(S).sort((m,O)=>N(m)-N(O)).map((m,O)=>g("stop",{key:O,offset:m,"stop-color":S[m]},null))])]),g("path",k,null),l().reverse()])}}}),be=()=>x(x({},_()),{strokeColor:A()}),$e=3,Se=e=>$e/e*100,ke=I({compatConfig:{MODE:3},name:"ProgressCircle",inheritAttrs:!1,props:E(be(),{trailColor:null}),setup(e,t){let{slots:o,attrs:r}=t;const s=u(()=>{var c;return(c=e.width)!==null&&c!==void 0?c:120}),p=u(()=>{var c;return(c=e.size)!==null&&c!==void 0?c:[s.value,s.value]}),l=u(()=>W(p.value,"circle")),n=u(()=>{if(e.gapDegree||e.gapDegree===0)return e.gapDegree;if(e.type==="dashboard")return 75}),i=u(()=>({width:`${l.value.width}px`,height:`${l.value.height}px`,fontSize:`${l.value.width*.15+6}px`})),h=u(()=>{var c;return(c=e.strokeWidth)!==null&&c!==void 0?c:Math.max(Se(l.value.width),6)}),d=u(()=>e.gapPosition||e.type==="dashboard"&&"bottom"||void 0),y=u(()=>ae(e)),v=u(()=>Object.prototype.toString.call(e.strokeColor)==="[object Object]"),a=u(()=>ce({success:e.success,strokeColor:e.strokeColor})),f=u(()=>({[`${e.prefixCls}-inner`]:!0,[`${e.prefixCls}-circle-gradient`]:v.value}));return()=>{var c;const b=g(ye,{percent:y.value,strokeWidth:h.value,trailWidth:h.value,strokeColor:a.value,strokeLinecap:e.strokeLinecap,trailColor:e.trailColor,prefixCls:e.prefixCls,gapDegree:n.value,gapPosition:d.value},null);return g("div",$($({},r),{},{class:[f.value,r.class],style:[r.style,i.value]}),[l.value.width<=20?g(le,null,{default:()=>[g("span",null,[b])],title:o.default}):g(F,null,[b,(c=o.default)===null||c===void 0?void 0:c.call(o)])])}}}),xe=()=>x(x({},_()),{steps:Number,strokeColor:X(),trailColor:String}),Pe=I({compatConfig:{MODE:3},name:"Steps",props:xe(),setup(e,t){let{slots:o}=t;const r=u(()=>Math.round(e.steps*((e.percent||0)/100))),s=u(()=>{var n;return(n=e.size)!==null&&n!==void 0?n:[e.size==="small"?2:14,e.strokeWidth||8]}),p=u(()=>W(s.value,"step",{steps:e.steps,strokeWidth:e.strokeWidth||8})),l=u(()=>{const{steps:n,strokeColor:i,trailColor:h,prefixCls:d}=e,y=[];for(let v=0;v<n;v+=1){const a=Array.isArray(i)?i[v]:i,f={[`${d}-steps-item`]:!0,[`${d}-steps-item-active`]:v<=r.value-1};y.push(g("div",{key:v,class:f,style:{backgroundColor:v<=r.value-1?a:h,width:`${p.value.width/n}px`,height:`${p.value.height}px`}},null))}return y});return()=>{var n;return g("div",{class:`${e.prefixCls}-steps-outer`},[l.value,(n=o.default)===null||n===void 0?void 0:n.call(o)])}}}),we=new J("antProgressActive",{"0%":{transform:"translateX(-100%) scaleX(0)",opacity:.1},"
|