Files
kefu/deploy/token-usage-20260917/payload/admin-web/apps/web-antd/dist/js/progress-Br8rQILc.js
T
2026-09-21 10:34:06 +08:00

3 lines
15 KiB
JavaScript

import{D as e,g as t,k as n,o as r,pt as i,vn as a}from"./runtime-core.esm-bundler-DkysjgTd.js";import{r as o}from"./en_US-Cv9hrLhb.js";import{$ as s,G as c,J as l,T as u,Tt as d,U as f,X as p,Y as m,l as h,m as g,q as _,t as v,u as y}from"./useConfigInject-z_xeO0pP.js";import{t as b}from"./initDefaultProps-D8Mki4gM.js";import{t as x}from"./Keyframes-K60KFfv3.js";import{t as S}from"./devWarning-DlchpATv.js";import{t as C}from"./CheckOutlined-Dy5-Q7N5.js";import{t as ee}from"./CloseOutlined-BdX5pn5u.js";import{t as w}from"./CloseCircleFilled-C9x0ZM0q.js";import{t as T}from"./CheckCircleFilled-CvJ3C2gR.js";import{t as E}from"./tooltip-DP9wufYH.js";import{t as te}from"./useRefs-QDevZzkt.js";var D=[`normal`,`exception`,`active`,`success`],O=()=>({prefixCls:String,type:p(),percent:Number,format:_(),status:p(),showInfo:c(),strokeWidth:Number,strokeLinecap:p(),strokeColor:f(),trailColor:String,width:Number,success:l(),gapDegree:Number,gapPosition:p(),size:m([String,Number,Array]),steps:Number,successPercent:Number,title:String,progressStatus:p()});function k(e){return!e||e<0?0:e>100?100:e}function A(e){let{success:t,successPercent:n}=e,r=n;return t&&`progress`in t&&(S(!1,`Progress`,"`success.progress` is deprecated. Please use `success.percent` instead."),r=t.progress),t&&`percent`in t&&(r=t.percent),r}function j(e){let{percent:t,success:n,successPercent:r}=e,i=k(A({success:n,successPercent:r}));return[i,k(k(t)-i)]}function M(e){let{success:t={},strokeColor:n}=e,{strokeColor:r}=t;return[r||u.green,n||null]}var N=(e,t,n)=>{var r,i,a,o;let s=-1,c=-1;if(t===`step`){let t=n.steps,r=n.strokeWidth;typeof e==`string`||e===void 0?(s=e===`small`?2:14,c=r==null?8:r):typeof e==`number`?[s,c]=[e,e]:[s=14,c=8]=e,s*=t}else if(t===`line`){let t=n==null?void 0:n.strokeWidth;typeof e==`string`||e===void 0?c=t||(e===`small`?6:8):typeof e==`number`?[s,c]=[e,e]:[s=-1,c=8]=e}else(t===`circle`||t===`dashboard`)&&(typeof e==`string`||e===void 0?[s,c]=e===`small`?[60,60]:[120,120]:typeof e==`number`?[s,c]=[e,e]:(s=(i=(r=e[0])==null?e[1]:r)==null?120:i,c=(o=(a=e[0])==null?e[1]:a)==null?120:o));return{width:s,height:c}},P=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},F=()=>o(o({},O()),{strokeColor:f(),direction:p()}),I=e=>{let t=[];return Object.keys(e).forEach(n=>{let r=parseFloat(n.replace(/%/g,``));isNaN(r)||t.push({key:r,value:e[n]})}),t=t.sort((e,t)=>e.key-t.key),t.map(e=>{let{key:t,value:n}=e;return`${n} ${t}%`}).join(`, `)},L=(e,t)=>{let{from:n=u.blue,to:r=u.blue,direction:i=t===`rtl`?`to left`:`to right`}=e,a=P(e,[`from`,`to`,`direction`]);return Object.keys(a).length===0?{backgroundImage:`linear-gradient(${i}, ${n}, ${r})`}:{backgroundImage:`linear-gradient(${i}, ${I(a)})`}},R=n({compatConfig:{MODE:3},name:`ProgressLine`,inheritAttrs:!1,props:F(),setup(n,i){let{slots:a,attrs:s}=i,c=t(()=>{let{strokeColor:e,direction:t}=n;return e&&typeof e!=`string`?L(e,t):{backgroundColor:e}}),l=t(()=>n.strokeLinecap===`square`||n.strokeLinecap===`butt`?0:void 0),u=t(()=>n.trailColor?{backgroundColor:n.trailColor}:void 0),f=t(()=>{var e;return(e=n.size)==null?[-1,n.strokeWidth||(n.size===`small`?6:8)]:e}),p=t(()=>N(f.value,`line`,{strokeWidth:n.strokeWidth})),m=t(()=>{let{percent:e}=n;return o({width:`${k(e)}%`,height:`${p.value.height}px`,borderRadius:l.value},c.value)}),h=t(()=>A(n)),g=t(()=>{let{success:e}=n;return{width:`${k(h.value)}%`,height:`${p.value.height}px`,borderRadius:l.value,backgroundColor:e==null?void 0:e.strokeColor}}),_={width:p.value.width<0?`100%`:p.value.width,height:`${p.value.height}px`};return()=>{var t;return e(r,null,[e(`div`,d(d({},s),{},{class:[`${n.prefixCls}-outer`,s.class],style:[s.style,_]}),[e(`div`,{class:`${n.prefixCls}-inner`,style:u.value},[e(`div`,{class:`${n.prefixCls}-bg`,style:m.value},null),h.value===void 0?null:e(`div`,{class:`${n.prefixCls}-success-bg`,style:g.value},null)])]),(t=a.default)==null?void 0:t.call(a)])}}}),z={percent:0,prefixCls:`vc-progress`,strokeColor:`#2db7f5`,strokeLinecap:`round`,strokeWidth:1,trailColor:`#D9D9D9`,trailWidth:1},B=e=>{let t=a(null);return i(()=>{let n=Date.now(),r=!1;e.value.forEach(e=>{let i=(e==null?void 0:e.$el)||e;if(!i)return;r=!0;let a=i.style;a.transitionDuration=`.3s, .3s, .3s, .06s`,t.value&&n-t.value<100&&(a.transitionDuration=`0s, 0s`)}),r&&(t.value=Date.now())}),e},V={gapDegree:Number,gapPosition:{type:String},percent:{type:[Array,Number]},prefixCls:String,strokeColor:{type:[Object,String,Array]},strokeLinecap:{type:String},strokeWidth:Number,trailColor:String,trailWidth:Number,transition:String},H=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},U=0;function W(e){return+e.replace(`%`,``)}function G(e){return Array.isArray(e)?e:[e]}function K(e,t,n,r){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,a=arguments.length>5?arguments[5]:void 0,o=50-r/2,s=0,c=-o,l=0,u=-2*o;switch(a){case`left`:s=-o,c=0,l=2*o,u=0;break;case`right`:s=o,c=0,l=-2*o,u=0;break;case`bottom`:c=o,u=2*o}let d=`M 50,50 m ${s},${c}
a ${o},${o} 0 1 1 ${l},${-u}
a ${o},${o} 0 1 1 ${-l},${u}`,f=Math.PI*2*o;return{pathString:d,pathStyle:{stroke:n,strokeDasharray:`${t/100*(f-i)}px ${f}px`,strokeDashoffset:`-${i/2+e/100*(f-i)}px`,transition:`stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s`}}}var q=n({compatConfig:{MODE:3},name:`VCCircle`,props:b(V,z),setup(n){U+=1;let r=a(U),i=t(()=>G(n.percent)),o=t(()=>G(n.strokeColor)),[s,c]=te();B(c);let l=()=>{let{prefixCls:t,strokeWidth:a,strokeLinecap:c,gapDegree:l,gapPosition:u}=n,f=0;return i.value.map((n,i)=>{let p=o.value[i]||o.value[o.value.length-1],m=Object.prototype.toString.call(p)===`[object Object]`?`url(#${t}-gradient-${r.value})`:``,{pathString:h,pathStyle:g}=K(f,n,p,a,l,u);f+=n;let _={key:i,d:h,stroke:m,"stroke-linecap":c,"stroke-width":a,opacity:n===0?0:1,"fill-opacity":`0`,class:`${t}-circle-path`,style:g};return e(`path`,d({ref:s(i)},_),null)})};return()=>{let{prefixCls:t,strokeWidth:i,trailWidth:a,gapDegree:s,gapPosition:c,trailColor:u,strokeLinecap:f,strokeColor:p}=n,m=H(n,[`prefixCls`,`strokeWidth`,`trailWidth`,`gapDegree`,`gapPosition`,`trailColor`,`strokeLinecap`,`strokeColor`]),{pathString:h,pathStyle:g}=K(0,100,u,i,s,c);delete m.percent;let _=o.value.find(e=>Object.prototype.toString.call(e)===`[object Object]`),v={d:h,stroke:u,"stroke-linecap":f,"stroke-width":a||i,"fill-opacity":`0`,class:`${t}-circle-trail`,style:g};return e(`svg`,d({class:`${t}-circle`,viewBox:`0 0 100 100`},m),[_&&e(`defs`,null,[e(`linearGradient`,{id:`${t}-gradient-${r.value}`,x1:`100%`,y1:`0%`,x2:`0%`,y2:`0%`},[Object.keys(_).sort((e,t)=>W(e)-W(t)).map((t,n)=>e(`stop`,{key:n,offset:t,"stop-color":_[t]},null))])]),e(`path`,v,null),l().reverse()])}}}),J=()=>o(o({},O()),{strokeColor:f()}),Y=3,X=e=>Y/e*100,Z=n({compatConfig:{MODE:3},name:`ProgressCircle`,inheritAttrs:!1,props:b(J(),{trailColor:null}),setup(n,i){let{slots:a,attrs:o}=i,s=t(()=>{var e;return(e=n.width)==null?120:e}),c=t(()=>{var e;return(e=n.size)==null?[s.value,s.value]:e}),l=t(()=>N(c.value,`circle`)),u=t(()=>{if(n.gapDegree||n.gapDegree===0)return n.gapDegree;if(n.type===`dashboard`)return 75}),f=t(()=>({width:`${l.value.width}px`,height:`${l.value.height}px`,fontSize:`${l.value.width*.15+6}px`})),p=t(()=>{var e;return(e=n.strokeWidth)==null?Math.max(X(l.value.width),6):e}),m=t(()=>n.gapPosition||n.type===`dashboard`&&`bottom`||void 0),h=t(()=>j(n)),g=t(()=>Object.prototype.toString.call(n.strokeColor)===`[object Object]`),_=t(()=>M({success:n.success,strokeColor:n.strokeColor})),v=t(()=>({[`${n.prefixCls}-inner`]:!0,[`${n.prefixCls}-circle-gradient`]:g.value}));return()=>{var t;let i=e(q,{percent:h.value,strokeWidth:p.value,trailWidth:p.value,strokeColor:_.value,strokeLinecap:n.strokeLinecap,trailColor:n.trailColor,prefixCls:n.prefixCls,gapDegree:u.value,gapPosition:m.value},null);return e(`div`,d(d({},o),{},{class:[v.value,o.class],style:[o.style,f.value]}),[l.value.width<=20?e(E,null,{default:()=>[e(`span`,null,[i])],title:a.default}):e(r,null,[i,(t=a.default)==null?void 0:t.call(a)])])}}}),Q=n({compatConfig:{MODE:3},name:`Steps`,props:o(o({},O()),{steps:Number,strokeColor:m(),trailColor:String}),setup(n,r){let{slots:i}=r,a=t(()=>Math.round(n.steps*((n.percent||0)/100))),o=t(()=>{var e;return(e=n.size)==null?[n.size===`small`?2:14,n.strokeWidth||8]:e}),s=t(()=>N(o.value,`step`,{steps:n.steps,strokeWidth:n.strokeWidth||8})),c=t(()=>{let{steps:t,strokeColor:r,trailColor:i,prefixCls:o}=n,c=[];for(let n=0;n<t;n+=1){let l=Array.isArray(r)?r[n]:r,u={[`${o}-steps-item`]:!0,[`${o}-steps-item-active`]:n<=a.value-1};c.push(e(`div`,{key:n,class:u,style:{backgroundColor:n<=a.value-1?l:i,width:`${s.value.width/t}px`,height:`${s.value.height}px`}},null))}return c});return()=>{var t;return e(`div`,{class:`${n.prefixCls}-steps-outer`},[c.value,(t=i.default)==null?void 0:t.call(i)])}}}),ne=new x(`antProgressActive`,{"0%":{transform:`translateX(-100%) scaleX(0)`,opacity:.1},"20%":{transform:`translateX(-100%) scaleX(0)`,opacity:.5},to:{transform:`translateX(0) scaleX(1)`,opacity:0}}),re=e=>{let{componentCls:t,iconCls:n}=e;return{[t]:o(o({},g(e)),{display:`inline-block`,"&-rtl":{direction:`rtl`},"&-line":{position:`relative`,width:`100%`,fontSize:e.fontSize,marginInlineEnd:e.marginXS,marginBottom:e.marginXS},[`${t}-outer`]:{display:`inline-block`,width:`100%`},[`&${t}-show-info`]:{[`${t}-outer`]:{marginInlineEnd:`calc(-2em - ${e.marginXS}px)`,paddingInlineEnd:`calc(2em + ${e.paddingXS}px)`}},[`${t}-inner`]:{position:`relative`,display:`inline-block`,width:`100%`,overflow:`hidden`,verticalAlign:`middle`,backgroundColor:e.progressRemainingColor,borderRadius:e.progressLineRadius},[`${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorInfo}},[`${t}-success-bg, ${t}-bg`]:{position:`relative`,backgroundColor:e.colorInfo,borderRadius:e.progressLineRadius,transition:`all ${e.motionDurationSlow} ${e.motionEaseInOutCirc}`},[`${t}-success-bg`]:{position:`absolute`,insetBlockStart:0,insetInlineStart:0,backgroundColor:e.colorSuccess},[`${t}-text`]:{display:`inline-block`,width:`2em`,marginInlineStart:e.marginXS,color:e.progressInfoTextColor,lineHeight:1,whiteSpace:`nowrap`,textAlign:`start`,verticalAlign:`middle`,wordBreak:`normal`,[n]:{fontSize:e.fontSize}},[`&${t}-status-active`]:{[`${t}-bg::before`]:{position:`absolute`,inset:0,backgroundColor:e.colorBgContainer,borderRadius:e.progressLineRadius,opacity:0,animationName:ne,animationDuration:e.progressActiveMotionDuration,animationTimingFunction:e.motionEaseOutQuint,animationIterationCount:`infinite`,content:`""`}},[`&${t}-status-exception`]:{[`${t}-bg`]:{backgroundColor:e.colorError},[`${t}-text`]:{color:e.colorError}},[`&${t}-status-exception ${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorError}},[`&${t}-status-success`]:{[`${t}-bg`]:{backgroundColor:e.colorSuccess},[`${t}-text`]:{color:e.colorSuccess}},[`&${t}-status-success ${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorSuccess}}})}},ie=e=>{let{componentCls:t,iconCls:n}=e;return{[t]:{[`${t}-circle-trail`]:{stroke:e.progressRemainingColor},[`&${t}-circle ${t}-inner`]:{position:`relative`,lineHeight:1,backgroundColor:`transparent`},[`&${t}-circle ${t}-text`]:{position:`absolute`,insetBlockStart:`50%`,insetInlineStart:0,width:`100%`,margin:0,padding:0,color:e.colorText,lineHeight:1,whiteSpace:`normal`,textAlign:`center`,transform:`translateY(-50%)`,[n]:{fontSize:`${e.fontSize/e.fontSizeSM}em`}},[`${t}-circle&-status-exception`]:{[`${t}-text`]:{color:e.colorError}},[`${t}-circle&-status-success`]:{[`${t}-text`]:{color:e.colorSuccess}}},[`${t}-inline-circle`]:{lineHeight:1,[`${t}-inner`]:{verticalAlign:`bottom`}}}},ae=e=>{let{componentCls:t}=e;return{[t]:{[`${t}-steps`]:{display:`inline-block`,"&-outer":{display:`flex`,flexDirection:`row`,alignItems:`center`},"&-item":{flexShrink:0,minWidth:e.progressStepMinWidth,marginInlineEnd:e.progressStepMarginInlineEnd,backgroundColor:e.progressRemainingColor,transition:`all ${e.motionDurationSlow}`,"&-active":{backgroundColor:e.colorInfo}}}}}},oe=e=>{let{componentCls:t,iconCls:n}=e;return{[t]:{[`${t}-small&-line, ${t}-small&-line ${t}-text ${n}`]:{fontSize:e.fontSizeSM}}}},$=y(`Progress`,e=>{let t=e.marginXXS/2,n=h(e,{progressLineRadius:100,progressInfoTextColor:e.colorText,progressDefaultColor:e.colorInfo,progressRemainingColor:e.colorFillSecondary,progressStepMarginInlineEnd:t,progressStepMinWidth:t,progressActiveMotionDuration:`2.4s`});return[re(n),ie(n),ae(n),oe(n)]}),se=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},ce=n({compatConfig:{MODE:3},name:`AProgress`,inheritAttrs:!1,props:b(O(),{type:`line`,percent:0,showInfo:!0,trailColor:null,size:`default`,strokeLinecap:`round`}),slots:Object,setup(n,r){let{slots:i,attrs:a}=r,{prefixCls:o,direction:s}=v(`progress`,n),[c,l]=$(o),u=t(()=>Array.isArray(n.strokeColor)?n.strokeColor[0]:n.strokeColor),f=t(()=>{let{percent:e=0}=n,t=A(n);return parseInt(t===void 0?e.toString():t.toString(),10)}),p=t(()=>{let{status:e}=n;return!D.includes(e)&&f.value>=100?`success`:e||`normal`}),m=t(()=>{let{type:e,showInfo:t,size:r}=n,i=o.value;return{[i]:!0,[`${i}-inline-circle`]:e===`circle`&&N(r,`circle`).width<=20,[`${i}-${e===`dashboard`&&`circle`||e}`]:!0,[`${i}-status-${p.value}`]:!0,[`${i}-show-info`]:t,[`${i}-${r}`]:r,[`${i}-rtl`]:s.value===`rtl`,[l.value]:!0}}),h=t(()=>typeof n.strokeColor==`string`||Array.isArray(n.strokeColor)?n.strokeColor:void 0),g=()=>{let{showInfo:t,format:r,type:a,percent:s,title:c}=n,l=A(n);if(!t)return null;let u,d=r||(i==null?void 0:i.format)||(e=>`${e}%`),f=a===`line`;return r||i!=null&&i.format||p.value!==`exception`&&p.value!==`success`?u=d(k(s),k(l)):p.value===`exception`?u=e(f?w:ee,null,null):p.value===`success`&&(u=e(f?T:C,null,null)),e(`span`,{class:`${o.value}-text`,title:c===void 0&&typeof u==`string`?u:void 0},[u])};return()=>{let{type:t,steps:r,title:i}=n,{class:l}=a,f=se(a,[`class`]),_=g(),v;return t===`line`?v=r?e(Q,d(d({},n),{},{strokeColor:h.value,prefixCls:o.value,steps:r}),{default:()=>[_]}):e(R,d(d({},n),{},{strokeColor:u.value,prefixCls:o.value,direction:s.value}),{default:()=>[_]}):(t===`circle`||t===`dashboard`)&&(v=e(Z,d(d({},n),{},{prefixCls:o.value,strokeColor:u.value,progressStatus:p.value}),{default:()=>[_]})),c(e(`div`,d(d({role:`progressbar`},f),{},{class:[m.value,l],title:i}),[v]))}}}),le=s(ce);export{le as t};