物管理前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

166 lines
13 KiB

  1. import{b as P,c as o,d as b,u as L,f as W,g as I,h as M}from"./light-Cua7cqmF.js";import{f as C}from"./format-length-B-p6aW7q.js";import{N as q}from"./Icon-Ck7Ij_E6.js";import{S as O,E as T,W as A,I as _}from"./Warning-WCOp46KX.js";import{d as z,c as x,G as r}from"./index-bVOhw2NF.js";import{p as G}from"./light-DH15IGTV.js";const X=P([o("progress",{display:"inline-block"},[o("progress-icon",`
  2. color: var(--n-icon-color);
  3. transition: color .3s var(--n-bezier);
  4. `),b("line",`
  5. width: 100%;
  6. display: block;
  7. `,[o("progress-content",`
  8. display: flex;
  9. align-items: center;
  10. `,[o("progress-graph",{flex:1})]),o("progress-custom-content",{marginLeft:"14px"}),o("progress-icon",`
  11. width: 30px;
  12. padding-left: 14px;
  13. height: var(--n-icon-size-line);
  14. line-height: var(--n-icon-size-line);
  15. font-size: var(--n-icon-size-line);
  16. `,[b("as-text",`
  17. color: var(--n-text-color-line-outer);
  18. text-align: center;
  19. width: 40px;
  20. font-size: var(--n-font-size);
  21. padding-left: 4px;
  22. transition: color .3s var(--n-bezier);
  23. `)])]),b("circle, dashboard",{width:"120px"},[o("progress-custom-content",`
  24. position: absolute;
  25. left: 50%;
  26. top: 50%;
  27. transform: translateX(-50%) translateY(-50%);
  28. display: flex;
  29. align-items: center;
  30. justify-content: center;
  31. `),o("progress-text",`
  32. position: absolute;
  33. left: 50%;
  34. top: 50%;
  35. transform: translateX(-50%) translateY(-50%);
  36. display: flex;
  37. align-items: center;
  38. color: inherit;
  39. font-size: var(--n-font-size-circle);
  40. color: var(--n-text-color-circle);
  41. font-weight: var(--n-font-weight-circle);
  42. transition: color .3s var(--n-bezier);
  43. white-space: nowrap;
  44. `),o("progress-icon",`
  45. position: absolute;
  46. left: 50%;
  47. top: 50%;
  48. transform: translateX(-50%) translateY(-50%);
  49. display: flex;
  50. align-items: center;
  51. color: var(--n-icon-color);
  52. font-size: var(--n-icon-size-circle);
  53. `)]),b("multiple-circle",`
  54. width: 200px;
  55. color: inherit;
  56. `,[o("progress-text",`
  57. font-weight: var(--n-font-weight-circle);
  58. color: var(--n-text-color-circle);
  59. position: absolute;
  60. left: 50%;
  61. top: 50%;
  62. transform: translateX(-50%) translateY(-50%);
  63. display: flex;
  64. align-items: center;
  65. justify-content: center;
  66. transition: color .3s var(--n-bezier);
  67. `)]),o("progress-content",{position:"relative"}),o("progress-graph",{position:"relative"},[o("progress-graph-circle",[P("svg",{verticalAlign:"bottom"}),o("progress-graph-circle-fill",`
  68. stroke: var(--n-fill-color);
  69. transition:
  70. opacity .3s var(--n-bezier),
  71. stroke .3s var(--n-bezier),
  72. stroke-dasharray .3s var(--n-bezier);
  73. `,[b("empty",{opacity:0})]),o("progress-graph-circle-rail",`
  74. transition: stroke .3s var(--n-bezier);
  75. overflow: hidden;
  76. stroke: var(--n-rail-color);
  77. `)]),o("progress-graph-line",[b("indicator-inside",[o("progress-graph-line-rail",`
  78. height: 16px;
  79. line-height: 16px;
  80. border-radius: 10px;
  81. `,[o("progress-graph-line-fill",`
  82. height: inherit;
  83. border-radius: 10px;
  84. `),o("progress-graph-line-indicator",`
  85. background: #0000;
  86. white-space: nowrap;
  87. text-align: right;
  88. margin-left: 14px;
  89. margin-right: 14px;
  90. height: inherit;
  91. font-size: 12px;
  92. color: var(--n-text-color-line-inner);
  93. transition: color .3s var(--n-bezier);
  94. `)])]),b("indicator-inside-label",`
  95. height: 16px;
  96. display: flex;
  97. align-items: center;
  98. `,[o("progress-graph-line-rail",`
  99. flex: 1;
  100. transition: background-color .3s var(--n-bezier);
  101. `),o("progress-graph-line-indicator",`
  102. background: var(--n-fill-color);
  103. font-size: 12px;
  104. transform: translateZ(0);
  105. display: flex;
  106. vertical-align: middle;
  107. height: 16px;
  108. line-height: 16px;
  109. padding: 0 10px;
  110. border-radius: 10px;
  111. position: absolute;
  112. white-space: nowrap;
  113. color: var(--n-text-color-line-inner);
  114. transition:
  115. right .2s var(--n-bezier),
  116. color .3s var(--n-bezier),
  117. background-color .3s var(--n-bezier);
  118. `)]),o("progress-graph-line-rail",`
  119. position: relative;
  120. overflow: hidden;
  121. height: var(--n-rail-height);
  122. border-radius: 5px;
  123. background-color: var(--n-rail-color);
  124. transition: background-color .3s var(--n-bezier);
  125. `,[o("progress-graph-line-fill",`
  126. background: var(--n-fill-color);
  127. position: relative;
  128. border-radius: 5px;
  129. height: inherit;
  130. width: 100%;
  131. max-width: 0%;
  132. transition:
  133. background-color .3s var(--n-bezier),
  134. max-width .2s var(--n-bezier);
  135. `,[b("processing",[P("&::after",`
  136. content: "";
  137. background-image: var(--n-line-bg-processing);
  138. animation: progress-processing-animation 2s var(--n-bezier) infinite;
  139. `)])])])])])]),P("@keyframes progress-processing-animation",`
  140. 0% {
  141. position: absolute;
  142. left: 0;
  143. top: 0;
  144. bottom: 0;
  145. right: 100%;
  146. opacity: 1;
  147. }
  148. 66% {
  149. position: absolute;
  150. left: 0;
  151. top: 0;
  152. bottom: 0;
  153. right: 0;
  154. opacity: 0;
  155. }
  156. 100% {
  157. position: absolute;
  158. left: 0;
  159. top: 0;
  160. bottom: 0;
  161. right: 0;
  162. opacity: 0;
  163. }
  164. `)]),j={success:r(O,null),error:r(T,null),warning:r(A,null),info:r(_,null)},Y=z({name:"ProgressLine",props:{clsPrefix:{type:String,required:!0},percentage:{type:Number,default:0},railColor:String,railStyle:[String,Object],fillColor:String,status:{type:String,required:!0},indicatorPlacement:{type:String,required:!0},indicatorTextColor:String,unit:{type:String,default:"%"},processing:{type:Boolean,required:!0},showIndicator:{type:Boolean,required:!0},height:[String,Number],railBorderRadius:[String,Number],fillBorderRadius:[String,Number]},setup(e,{slots:p}){const u=x(()=>C(e.height)),a=x(()=>e.railBorderRadius!==void 0?C(e.railBorderRadius):e.height!==void 0?C(e.height,{c:.5}):""),i=x(()=>e.fillBorderRadius!==void 0?C(e.fillBorderRadius):e.railBorderRadius!==void 0?C(e.railBorderRadius):e.height!==void 0?C(e.height,{c:.5}):"");return()=>{const{indicatorPlacement:n,railColor:f,railStyle:l,percentage:d,unit:c,indicatorTextColor:h,status:g,showIndicator:m,fillColor:t,processing:v,clsPrefix:s}=e;return r("div",{class:`${s}-progress-content`,role:"none"},r("div",{class:`${s}-progress-graph`,"aria-hidden":!0},r("div",{class:[`${s}-progress-graph-line`,{[`${s}-progress-graph-line--indicator-${n}`]:!0}]},r("div",{class:`${s}-progress-graph-line-rail`,style:[{backgroundColor:f,height:u.value,borderRadius:a.value},l]},r("div",{class:[`${s}-progress-graph-line-fill`,v&&`${s}-progress-graph-line-fill--processing`],style:{maxWidth:`${e.percentage}%`,backgroundColor:t,height:u.value,lineHeight:u.value,borderRadius:i.value}},n==="inside"?r("div",{class:`${s}-progress-graph-line-indicator`,style:{color:h}},p.default?p.default():`${d}${c}`):null)))),m&&n==="outside"?r("div",null,p.default?r("div",{class:`${s}-progress-custom-content`,style:{color:h},role:"none"},p.default()):g==="default"?r("div",{role:"none",class:`${s}-progress-icon ${s}-progress-icon--as-text`,style:{color:h}},d,c):r("div",{class:`${s}-progress-icon`,"aria-hidden":!0},r(q,{clsPrefix:s},{default:()=>j[g]}))):null)}}}),H={success:r(O,null),error:r(T,null),warning:r(A,null),info:r(_,null)},E=z({name:"ProgressCircle",props:{clsPrefix:{type:String,required:!0},status:{type:String,required:!0},strokeWidth:{type:Number,required:!0},fillColor:String,railColor:String,railStyle:[String,Object],percentage:{type:Number,default:0},offsetDegree:{type:Number,default:0},showIndicator:{type:Boolean,required:!0},indicatorTextColor:String,unit:String,viewBoxWidth:{type:Number,required:!0},gapDegree:{type:Number,required:!0},gapOffsetDegree:{type:Number,default:0}},setup(e,{slots:p}){function u(a,i,n){const{gapDegree:f,viewBoxWidth:l,strokeWidth:d}=e,c=50,h=0,g=c,m=0,t=2*c,v=50+d/2,s=`M ${v},${v} m ${h},${g}
  165. a ${c},${c} 0 1 1 ${m},${-t}
  166. a ${c},${c} 0 1 1 ${-m},${t}`,$=Math.PI*2*c,S={stroke:n,strokeDasharray:`${a/100*($-f)}px ${l*8}px`,strokeDashoffset:`-${f/2}px`,transformOrigin:i?"center":void 0,transform:i?`rotate(${i}deg)`:void 0};return{pathString:s,pathStyle:S}}return()=>{const{fillColor:a,railColor:i,strokeWidth:n,offsetDegree:f,status:l,percentage:d,showIndicator:c,indicatorTextColor:h,unit:g,gapOffsetDegree:m,clsPrefix:t}=e,{pathString:v,pathStyle:s}=u(100,0,i),{pathString:$,pathStyle:S}=u(d,f,a),y=100+n;return r("div",{class:`${t}-progress-content`,role:"none"},r("div",{class:`${t}-progress-graph`,"aria-hidden":!0},r("div",{class:`${t}-progress-graph-circle`,style:{transform:m?`rotate(${m}deg)`:void 0}},r("svg",{viewBox:`0 0 ${y} ${y}`},r("g",null,r("path",{class:`${t}-progress-graph-circle-rail`,d:v,"stroke-width":n,"stroke-linecap":"round",fill:"none",style:s})),r("g",null,r("path",{class:[`${t}-progress-graph-circle-fill`,d===0&&`${t}-progress-graph-circle-fill--empty`],d:$,"stroke-width":n,"stroke-linecap":"round",fill:"none",style:S}))))),c?r("div",null,p.default?r("div",{class:`${t}-progress-custom-content`,role:"none"},p.default()):l!=="default"?r("div",{class:`${t}-progress-icon`,"aria-hidden":!0},r(q,{clsPrefix:t},{default:()=>H[l]})):r("div",{class:`${t}-progress-text`,style:{color:h},role:"none"},r("span",{class:`${t}-progress-text__percentage`},d),r("span",{class:`${t}-progress-text__unit`},g))):null)}}});function N(e,p,u=100){return`m ${u/2} ${u/2-e} a ${e} ${e} 0 1 1 0 ${2*e} a ${e} ${e} 0 1 1 0 -${2*e}`}const V=z({name:"ProgressMultipleCircle",props:{clsPrefix:{type:String,required:!0},viewBoxWidth:{type:Number,required:!0},percentage:{type:Array,default:[0]},strokeWidth:{type:Number,required:!0},circleGap:{type:Number,required:!0},showIndicator:{type:Boolean,required:!0},fillColor:{type:Array,default:()=>[]},railColor:{type:Array,default:()=>[]},railStyle:{type:Array,default:()=>[]}},setup(e,{slots:p}){const u=x(()=>e.percentage.map((i,n)=>`${Math.PI*i/100*(e.viewBoxWidth/2-e.strokeWidth/2*(1+2*n)-e.circleGap*n)*2}, ${e.viewBoxWidth*8}`));return()=>{const{viewBoxWidth:a,strokeWidth:i,circleGap:n,showIndicator:f,fillColor:l,railColor:d,railStyle:c,percentage:h,clsPrefix:g}=e;return r("div",{class:`${g}-progress-content`,role:"none"},r("div",{class:`${g}-progress-graph`,"aria-hidden":!0},r("div",{class:`${g}-progress-graph-circle`},r("svg",{viewBox:`0 0 ${a} ${a}`},h.map((m,t)=>r("g",{key:t},r("path",{class:`${g}-progress-graph-circle-rail`,d:N(a/2-i/2*(1+2*t)-n*t,i,a),"stroke-width":i,"stroke-linecap":"round",fill:"none",style:[{strokeDashoffset:0,stroke:d[t]},c[t]]}),r("path",{class:[`${g}-progress-graph-circle-fill`,m===0&&`${g}-progress-graph-circle-fill--empty`],d:N(a/2-i/2*(1+2*t)-n*t,i,a),"stroke-width":i,"stroke-linecap":"round",fill:"none",style:{strokeDasharray:u.value[t],strokeDashoffset:0,stroke:l[t]}})))))),f&&p.default?r("div",null,r("div",{class:`${g}-progress-text`},p.default())):null)}}}),F=Object.assign(Object.assign({},W.props),{processing:Boolean,type:{type:String,default:"line"},gapDegree:Number,gapOffsetDegree:Number,status:{type:String,default:"default"},railColor:[String,Array],railStyle:[String,Array],color:[String,Array],viewBoxWidth:{type:Number,default:100},strokeWidth:{type:Number,default:7},percentage:[Number,Array],unit:{type:String,default:"%"},showIndicator:{type:Boolean,default:!0},indicatorPosition:{type:String,default:"outside"},indicatorPlacement:{type:String,default:"outside"},indicatorTextColor:String,circleGap:{type:Number,default:1},height:Number,borderRadius:[String,Number],fillBorderRadius:[String,Number],offsetDegree:Number}),re=z({name:"Progress",props:F,setup(e){const p=x(()=>e.indicatorPlacement||e.indicatorPosition),u=x(()=>{if(e.gapDegree||e.gapDegree===0)return e.gapDegree;if(e.type==="dashboard")return 75}),{mergedClsPrefixRef:a,inlineThemeDisabled:i}=L(e),n=W("Progress","-progress",X,G,e,a),f=x(()=>{const{status:d}=e,{common:{cubicBezierEaseInOut:c},self:{fontSize:h,fontSizeCircle:g,railColor:m,railHeight:t,iconSizeCircle:v,iconSizeLine:s,textColorCircle:$,textColorLineInn