Files
2026-10-30 10:51:09 +08:00

4 lines
15 KiB
JavaScript

import{o as e}from"./request-xrnk7ZJV.js";import{$n as t,Cr as n,Ct as r,Hn as i,Nn as a,Ot as o,Pr as s,Wn as c,_n as l,en as u,hn as d,jt as f,kt as p,qt as m,wn as h,wt as g}from"./jsx-runtime-OfKoVykY.js";import{t as _}from"./tooltip-DI_m69zk.js";import{t as v}from"./CheckCircleFilled-C08zzZvv.js";import{t as y}from"./CloseCircleFilled-DXDe2bjb.js";import{r as b}from"./PlusOutlined-CKNTdA7h.js";import{h as x}from"./style-CSZsuTOx.js";var S=e(s()),C={percent:0,prefixCls:`rc-progress`,strokeColor:`#2db7f5`,strokeLinecap:`round`,strokeWidth:1,railColor:`#D9D9D9`,railWidth:1,gapPosition:`bottom`,loading:!1},w=()=>{let e=(0,S.useRef)([]),t=(0,S.useRef)(null);return(0,S.useEffect)(()=>{let n=Date.now(),r=!1;e.current.forEach(e=>{if(!e)return;r=!0;let i=e.style;i.transitionDuration=`.3s, .3s, .3s, .06s`,t.current&&n-t.current<100&&(i.transitionDuration=`0s, 0s`)}),r&&(t.current=Date.now())}),e.current},T=({bg:e,children:t})=>S.createElement(`div`,{style:{width:`100%`,height:`100%`,background:e}},t);function E(e,t){return Object.keys(e).map(n=>{let r=`${Math.floor(parseFloat(n)*t)}%`;return`${e[n]} ${r}`})}var D=S.forwardRef((e,t)=>{let{prefixCls:n,color:r,gradientId:i,radius:a,className:o,style:s,ptg:l,strokeLinecap:u,strokeWidth:d,size:f,gapDegree:p}=e,m=r&&typeof r==`object`,h=m?`#FFF`:void 0,g=f/2,_=S.createElement(`circle`,{className:c(`${n}-circle-path`,o),r:a,cx:g,cy:g,stroke:h,strokeLinecap:u,strokeWidth:d,opacity:l===0?0:1,style:s,ref:t});if(!m)return _;let v=`${i}-conic`,y=p?`${180+p/2}deg`:`0deg`,b=E(r,(360-p)/360),x=E(r,1),C=`conic-gradient(from ${y}, ${b.join(`, `)})`,w=`linear-gradient(to ${p?`bottom`:`top`}, ${x.join(`, `)})`;return S.createElement(S.Fragment,null,S.createElement(`mask`,{id:v},_),S.createElement(`foreignObject`,{x:0,y:0,width:f,height:f,mask:`url(#${v})`},S.createElement(T,{bg:w},S.createElement(T,{bg:C}))))}),O=(e,t,n,r,i,a,o,s,c,l,u=0)=>{let d=n/100*360*((360-a)/360),f=a===0?0:{bottom:0,top:180,left:90,right:-90}[o],p=(100-r)/100*t;return c===`round`&&r!==100&&(p+=l/2,p>=t&&(p=t-.01)),{stroke:typeof s==`string`?s:void 0,strokeDasharray:`${t}px ${e}`,strokeDashoffset:p+u,transform:`rotate(${i+d+f}deg)`,transformOrigin:`50px 50px`,transition:`stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s`,fillOpacity:0}},k=(({id:e,loading:t})=>{if(!t)return{indeterminateStyleProps:{},indeterminateStyleAnimation:null};let n=`${e}-indeterminate-animate`;return{indeterminateStyleProps:{transform:`rotate(0deg)`,animation:`${n} 1s linear infinite`},indeterminateStyleAnimation:S.createElement(`style`,null,`@keyframes ${n} {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}`)}});function A(){return A=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},A.apply(this,arguments)}function j(e){let t=e??[];return Array.isArray(t)?t:[t]}var M=e=>{let{id:t,prefixCls:r,classNames:i={},styles:a={},steps:o,strokeWidth:s,railWidth:l,gapDegree:u=0,gapPosition:d,railColor:f,strokeLinecap:p,style:m,className:h,strokeColor:g,percent:_,loading:v,...y}={...C,...e},b=n(t),x=`${b}-gradient`,T=50-s/2,E=Math.PI*2*T,M=u>0?90+u/2:-90,N=E*((360-u)/360),{count:P,gap:F}=typeof o==`object`?o:{count:o,gap:2},I=j(_),L=j(g),R=L.find(e=>e&&typeof e==`object`),z=R&&typeof R==`object`?`butt`:p,{indeterminateStyleProps:B,indeterminateStyleAnimation:V}=k({id:b,loading:v}),H=O(E,N,0,100,M,u,d,f,z,s),U=w(),W=()=>{let e=0;return I.map((t,n)=>{let o=L[n]||L[L.length-1],c=O(E,N,e,t,M,u,d,o,z,s);return e+=t,S.createElement(D,{key:n,color:o,ptg:t,radius:T,prefixCls:r,gradientId:x,className:i.track,style:{...c,...B,...a.track},strokeLinecap:z,strokeWidth:s,gapDegree:u,ref:e=>{U[n]=e},size:100})}).reverse()},G=()=>{let e=Math.round(P*(I[0]/100)),t=100/P,n=0;return Array(P).fill(null).map((o,l)=>{let p=l<=e-1?L[0]:f,m=p&&typeof p==`object`?`url(#${x})`:void 0,h=O(E,N,n,t,M,u,d,p,`butt`,s,F);return n+=(N-h.strokeDashoffset+F)*100/N,S.createElement(`circle`,{key:l,className:c(`${r}-circle-path`,i.track),r:T,cx:50,cy:50,stroke:m,strokeWidth:s,opacity:1,style:{...h,...a.track},ref:e=>{U[l]=e}})})};return S.createElement(`svg`,A({className:c(`${r}-circle`,i.root,h),viewBox:`0 0 100 100`,style:{...a.root,...m},id:t,role:`presentation`},y),!P&&S.createElement(`circle`,{className:c(`${r}-circle-rail`,i.rail),r:T,cx:50,cy:50,stroke:f,strokeLinecap:z,strokeWidth:l||s,style:{...H,...a.rail}}),P?G():W(),V)};function N(e){return!e||e<0?0:e>100?100:e}function P({success:e}){let t;return e&&`percent`in e&&(t=e.percent),t}var F=({percent:e,success:t})=>{let n=N(P({success:t}));return[n,N(N(e)-n)]},I=({success:e={},strokeColor:t})=>{let{strokeColor:n}=e;return[n||d.green,t||null]},L=(e,t,n)=>{let r=-1,i=-1;if(t===`step`){let t=n.steps,a=n.strokeWidth;typeof e==`string`||e===void 0?(r=e===`small`?2:14,i=a??8):o(e)?[r,i]=[e,e]:[r=14,i=8]=Array.isArray(e)?e:[e.width,e.height],r*=t}else if(t===`line`){let t=n?.strokeWidth;typeof e==`string`||e===void 0?i=t||(e===`small`?6:8):o(e)?[r,i]=[e,e]:[r=-1,i=8]=Array.isArray(e)?e:[e.width,e.height]}else(t===`circle`||t===`dashboard`)&&(typeof e==`string`||e===void 0?[r,i]=e===`small`?[60,60]:[120,120]:o(e)?[r,i]=[e,e]:Array.isArray(e)&&(r=e[0]??e[1]??120,i=e[0]??e[1]??120));return[r,i]},R=3,z=e=>R/e*100,B=[`root`,`body`,`indicator`],V=e=>{let{prefixCls:n,classNames:r,styles:a,railColor:o,trailColor:s,strokeLinecap:l=`round`,gapPosition:u,gapPlacement:d,gapDegree:f,width:m=120,type:h,children:g,success:v,size:y=m,steps:b}=e,{direction:x}=i(`progress`),C=o??s,[w,T]=L(y,`circle`),{strokeWidth:E}=e;E===void 0&&(E=Math.max(z(w),6));let D={width:w,height:T,fontSize:w*.15+6},O=S.useMemo(()=>{if(f||f===0)return f;if(h===`dashboard`)return 75},[f,h]),k=F(e),A=S.useMemo(()=>{let e=(d??u)||h===`dashboard`&&`bottom`||void 0,t=x===`rtl`;switch(e){case`start`:return t?`right`:`left`;case`end`:return t?`left`:`right`;default:return e}},[x,d,u,h]),j=p(e.strokeColor),N=I({success:v,strokeColor:e.strokeColor}),P=c(`${n}-body`,{[`${n}-circle-gradient`]:j},r.body),R=S.createElement(M,{steps:b,percent:b?k[1]:k,strokeWidth:E,railWidth:E,strokeColor:b?N[1]:N,strokeLinecap:l,railColor:C,prefixCls:n,gapDegree:O,gapPosition:A,classNames:t(r,B),styles:t(a,B)}),V=w<=20,H=S.createElement(`div`,{className:P,style:{...D,...a.body}},R,!V&&g);return V?S.createElement(_,{title:g},H):H},H=`--progress-line-stroke-color`,U=e=>{let t=e?`100%`:`-100%`;return new a(`antProgress${e?`RTL`:`LTR`}Active`,{"0%":{transform:`translateX(${t}) scaleX(0)`,opacity:.1},"20%":{transform:`translateX(${t}) scaleX(0)`,opacity:.5},to:{transform:`translateX(0) scaleX(1)`,opacity:0}})},W=e=>{let{componentCls:t,iconCls:n}=e;return{[t]:{...u(e),display:`inline-flex`,"&-rtl":{direction:`rtl`},[`${t}-indicator`]:{color:e.colorText,lineHeight:1,whiteSpace:`nowrap`,verticalAlign:`middle`,wordBreak:`normal`,[n]:{fontSize:e.fontSize}},[`&${t}-status-exception`]:{[`${t}-indicator`]:{color:e.colorError}},[`&${t}-status-success`]:{[`${t}-indicator`]:{color:e.colorSuccess}}}}},G=e=>{let{componentCls:t}=e;return{[`${t}-line`]:{position:`relative`,width:`100%`,fontSize:e.fontSize,[`${t}-body`]:{display:`inline-flex`,alignItems:`center`,width:`100%`,gap:e.marginXS},[`${t}-rail`]:{flex:`auto`,background:e.remainingColor,borderRadius:e.lineBorderRadius,position:`relative`,width:`100%`,overflow:`hidden`},[`&${t}-status-active`]:{[`${t}-track:after`]:{content:`""`,position:`absolute`,inset:0,backgroundColor:e.colorBgContainer,borderRadius:`inherit`,opacity:0,animationName:U(),animationDuration:e.progressActiveMotionDuration,animationTimingFunction:e.motionEaseOutQuint,animationIterationCount:`infinite`}},[`${t}-track`]:{position:`absolute`,insetInlineStart:0,insetBlock:0,borderRadius:`inherit`,background:e.defaultColor,transition:`all ${e.motionDurationSlow} ${e.motionEaseInOutCirc}`,minWidth:`max-content`,display:`flex`,alignItems:`center`,"&-success":{background:e.colorSuccess}},[`&${t}-status-exception`]:{[`${t}-track`]:{background:e.colorError}},[`&${t}-status-success`]:{[`${t}-track`]:{background:e.colorSuccess}},[`${t}-indicator-outer`]:{[`&${t}-indicator-start`]:{order:-1}},[`${t}-body-layout-bottom`]:{flexDirection:`column`,alignItems:`center`,gap:e.marginXXS},[`${t}-indicator${t}-indicator-inner`]:{color:e.colorWhite,paddingInline:e.paddingXXS,width:`100%`,display:`flex`,justifyContent:`center`,[`&${t}-indicator-end`]:{justifyContent:`end`},[`&${t}-indicator-start`]:{justifyContent:`start`},[`&${t}-indicator-bright`]:{color:`rgba(0, 0, 0, 0.45)`}}}}},ee=e=>{let{componentCls:t,iconCls:n}=e;return{[`${t}-circle`]:{[`${t}-circle-rail`]:{stroke:e.remainingColor},[`${t}-body:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.defaultColor}},[`${t}-body`]:{position:`relative`,lineHeight:1,backgroundColor:`transparent`},[`${t}-indicator`]:{position:`absolute`,insetBlockStart:`50%`,insetInlineStart:0,width:`100%`,margin:0,padding:0,color:e.circleTextColor,fontSize:e.circleTextFontSize,lineHeight:1,whiteSpace:`normal`,textAlign:`center`,transform:`translateY(-50%)`,[n]:{fontSize:e.circleIconFontSize}},[`&${t}-status-exception`]:{[`${t}-body:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorError}}},[`&${t}-status-success`]:{[`${t}-body:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorSuccess}}}},[`${t}-inline-circle`]:{lineHeight:1,[`${t}-inner`]:{verticalAlign:`bottom`}}}},K=e=>{let{componentCls:t}=e;return{[t]:{[`${t}-steps`]:{display:`inline-block`,"&-body":{display:`flex`,flexDirection:`row`,alignItems:`center`,gap:e.progressStepMarginInlineEnd,[`${t}-indicator`]:{marginInlineStart:e.marginXS}},"&-item":{flexShrink:0,minWidth:e.progressStepMinWidth,backgroundColor:e.remainingColor,transition:`all ${e.motionDurationSlow}`,"&-active":{backgroundColor:e.defaultColor}}}}}},te=e=>{let{componentCls:t,iconCls:n}=e;return{[t]:{[`${t}-small&-line, ${t}-small&-line ${t}-indicator ${n}`]:{fontSize:e.fontSizeSM}}}},ne=m(`Progress`,e=>{let t=e.calc(e.marginXXS).div(2).equal(),n=h(e,{progressStepMarginInlineEnd:t,progressStepMinWidth:t,progressActiveMotionDuration:`2.4s`});return[W(n),G(n),ee(n),K(n),te(n)]},e=>({circleTextColor:e.colorText,defaultColor:e.colorInfo,remainingColor:e.colorFillSecondary,lineBorderRadius:100,circleTextFontSize:`1em`,circleIconFontSize:`${e.fontSize/e.fontSizeSM}em`})),re=e=>{let t=[];return Object.keys(e).forEach(n=>{let r=Number.parseFloat(n.replace(/%/g,``));Number.isNaN(r)||t.push({key:r,value:e[n]})}),t=t.sort((e,t)=>e.key-t.key),t.map(({key:e,value:t})=>`${t} ${e}%`).join(`, `)},ie=(e,t)=>{let{from:n=d.blue,to:r=d.blue,direction:i=t===`rtl`?`to left`:`to right`,...a}=e;if(Object.keys(a).length!==0){let e=`linear-gradient(${i}, ${re(a)})`;return{background:e,[H]:e}}let o=`linear-gradient(${i}, ${n}, ${r})`;return{background:o,[H]:o}},ae=e=>{let{prefixCls:t,classNames:n,styles:r,direction:i,percent:a,size:o,strokeWidth:s,strokeColor:l,strokeLinecap:u=`round`,children:d,railColor:p,trailColor:m,percentPosition:h,success:g}=e,{align:_,type:v}=h,y=p??m,b=u===`square`||u===`butt`?0:void 0,[x,C]=L(o??[-1,s||8],`line`,{strokeWidth:s}),w={backgroundColor:y||void 0,borderRadius:b,height:C},T=`${t}-track`,E=l&&typeof l!=`string`?ie(l,i):{[H]:l,background:l},D={width:`${N(a)}%`,height:C,borderRadius:b,...E},O=P(e),k={width:`${N(O)}%`,height:C,borderRadius:b,backgroundColor:g?.strokeColor};return S.createElement(`div`,{className:c(`${t}-body`,n.body,{[`${t}-body-layout-bottom`]:_===`center`&&v===`outer`}),style:{width:f(x)||x>0?x:`100%`,...r.body}},S.createElement(`div`,{className:c(`${t}-rail`,n.rail),style:{...w,...r.rail}},S.createElement(`div`,{className:c(T,n.track),style:{...D,...r.track}},v===`inner`&&d),O!==void 0&&S.createElement(`div`,{className:c(T,`${T}-success`,n.track),style:{...k,...r.track}})),v===`outer`&&d)},oe=e=>{let{classNames:t,styles:n,size:r,steps:i,rounding:a=Math.round,percent:o=0,strokeWidth:s=8,strokeColor:l,railColor:u,trailColor:d,prefixCls:f,children:p}=e,m=a(o/100*i),[h,g]=L(r??[r===`small`?2:14,s],`step`,{steps:i,strokeWidth:s}),_=h/i,v=Array.from({length:i}),y=u??d;for(let e=0;e<i;e++){let r=Array.isArray(l)?l[e]:l;v[e]=S.createElement(`div`,{key:e,className:c(`${f}-steps-item`,{[`${f}-steps-item-active`]:e<=m-1},t.track),style:{backgroundColor:e<=m-1?r:y,width:_,height:g,...n.track}})}return S.createElement(`div`,{className:c(`${f}-steps-body`,t.body),style:n.body},v,p)},se=[`normal`,`exception`,`active`,`success`],ce=S.forwardRef((e,n)=>{let{prefixCls:a,className:o,rootClassName:s,classNames:u,styles:d,steps:f,strokeColor:m,percent:h=0,size:_=`medium`,showInfo:C=!0,type:w=`line`,status:T,format:E,style:D,percentPosition:O={},...k}=e,{align:A=`end`,type:j=`outer`}=O,M=Array.isArray(m)?m[0]:m,F=typeof m==`string`||Array.isArray(m)?m:void 0,I=S.useMemo(()=>{if(M){let e=typeof M==`string`?M:Object.values(M)[0];return new l(e).isLight()}return!1},[m]),R=S.useMemo(()=>{let t=P(e);return Number.parseInt(t===void 0?(h??0)?.toString():(t??0)?.toString(),10)},[h,e.success]),z=S.useMemo(()=>!se.includes(T)&&R>=100?`success`:T||`normal`,[T,R]),{getPrefixCls:B,direction:H,className:U,style:W,classNames:G,styles:ee}=i(`progress`),K=B(`progress`,a),[te,re]=ne(K),ie={...e,percent:h,type:w,size:_,showInfo:C,percentPosition:O},ce=g(W),le=g(D),[q,J]=r([G,u],[ee,ce,d,le],{props:ie}),Y=w===`line`,X=Y&&!f,Z=S.useMemo(()=>{if(!C)return null;let t=P(e),n,r=E||(e=>`${e}%`),i=Y&&I&&j===`inner`;return j===`inner`||E||z!==`exception`&&z!==`success`?n=r(N(h),N(t)):z===`exception`?n=Y?S.createElement(y,null):S.createElement(b,null):z===`success`&&(n=Y?S.createElement(v,null):S.createElement(x,null)),S.createElement(`span`,{className:c(`${K}-indicator`,{[`${K}-indicator-bright`]:i,[`${K}-indicator-${A}`]:X,[`${K}-indicator-${j}`]:X},q.indicator),style:J.indicator,title:typeof n==`string`?n:void 0},n)},[C,h,R,z,w,K,E,Y,I,j,A,X,q.indicator,J.indicator]),Q={...e,classNames:q,styles:J},$;w===`line`?$=f?S.createElement(oe,{...Q,strokeColor:F,prefixCls:K,steps:p(f)?f.count:f},Z):S.createElement(ae,{...Q,strokeColor:M,prefixCls:K,direction:H,percentPosition:{align:A,type:j}},Z):(w===`circle`||w===`dashboard`)&&($=S.createElement(V,{...Q,strokeColor:M,prefixCls:K,progressStatus:z},Z));let ue=c(K,`${K}-status-${z}`,{[`${K}-${w===`dashboard`&&`circle`||w}`]:w!==`line`,[`${K}-inline-circle`]:w===`circle`&&L(_,`circle`)[0]<=20,[`${K}-line`]:X,[`${K}-line-align-${A}`]:X,[`${K}-line-position-${j}`]:X,[`${K}-steps`]:f,[`${K}-show-info`]:C,[`${K}-small`]:_===`small`,[`${K}-rtl`]:H===`rtl`},U,o,s,q.root,te,re);return S.createElement(`div`,{ref:n,style:J.root,className:ue,role:`progressbar`,"aria-valuenow":N(h),"aria-valuemin":0,"aria-valuemax":100,...t(k,[`railColor`,`trailColor`,`strokeWidth`,`width`,`gapDegree`,`gapPosition`,`gapPlacement`,`strokeLinecap`,`success`])},$)});export{ce as t};