@@ -2,9 +2,12 @@ import * as React from 'react';
2
2
import classNames from 'classnames' ;
3
3
import { useTransitionDuration , defaultProps } from './common' ;
4
4
import type { ProgressProps } from './interface' ;
5
+ import getIndeterminateLine from './utils/getIndeterminateLine' ;
6
+ import useId from './hooks/useId' ;
5
7
6
8
const Line : React . FC < ProgressProps > = ( props ) => {
7
9
const {
10
+ id,
8
11
className,
9
12
percent,
10
13
prefixCls,
@@ -15,12 +18,15 @@ const Line: React.FC<ProgressProps> = (props) => {
15
18
trailColor,
16
19
trailWidth,
17
20
transition,
21
+ loading,
18
22
...restProps
19
23
} = {
20
24
...defaultProps ,
21
25
...props ,
22
26
} ;
23
27
28
+ const mergedId = useId ( id ) ;
29
+
24
30
// eslint-disable-next-line no-param-reassign
25
31
delete restProps . gapPosition ;
26
32
const percentList = Array . isArray ( percent ) ? percent : [ percent ] ;
@@ -34,6 +40,14 @@ const Line: React.FC<ProgressProps> = (props) => {
34
40
L ${ strokeLinecap === 'round' ? right : 100 } ,${ center } ` ;
35
41
const viewBoxString = `0 0 100 ${ strokeWidth } ` ;
36
42
let stackPtg = 0 ;
43
+ const { indeterminateStyleProps, indeterminateStyleAnimation } = getIndeterminateLine ( {
44
+ id : mergedId ,
45
+ loading,
46
+ percent : percentList [ 0 ] ,
47
+ strokeLinecap,
48
+ strokeWidth,
49
+ } ) ;
50
+
37
51
return (
38
52
< svg
39
53
className = { classNames ( `${ prefixCls } -line` , className ) }
@@ -69,6 +83,7 @@ const Line: React.FC<ProgressProps> = (props) => {
69
83
transition :
70
84
transition ||
71
85
'stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear' ,
86
+ ...indeterminateStyleProps ,
72
87
} ;
73
88
const color = strokeColorList [ index ] || strokeColorList [ strokeColorList . length - 1 ] ;
74
89
stackPtg += ptg ;
@@ -93,6 +108,7 @@ const Line: React.FC<ProgressProps> = (props) => {
93
108
/>
94
109
) ;
95
110
} ) }
111
+ { indeterminateStyleAnimation }
96
112
</ svg >
97
113
) ;
98
114
} ;
0 commit comments