1
- import type { CSSProperties , ExtractPropTypes , PropType } from 'vue' ;
1
+ import type { CSSProperties , ExtractPropTypes } from 'vue' ;
2
2
import { presetPrimaryColors } from '@ant-design/colors' ;
3
3
import { computed , defineComponent } from 'vue' ;
4
4
import type { Direction } from '../config-provider' ;
5
5
import type { StringGradients , ProgressGradient , ProgressSize } from './props' ;
6
6
import { progressProps } from './props' ;
7
7
import { getSize , getSuccessPercent , validProgress } from './utils' ;
8
8
import devWarning from '../vc-util/devWarning' ;
9
- import { anyType } from '../_util/type' ;
9
+ import { anyType , stringType } from '../_util/type' ;
10
10
11
11
export const lineProps = ( ) => ( {
12
12
...progressProps ( ) ,
13
13
strokeColor : anyType < string | ProgressGradient > ( ) ,
14
- direction : {
15
- type : String as PropType < Direction > ,
16
- } ,
14
+ direction : stringType < Direction > ( ) ,
17
15
} ) ;
18
16
19
17
export type LineProps = Partial < ExtractPropTypes < ReturnType < typeof lineProps > > > ;
@@ -86,8 +84,9 @@ export default defineComponent({
86
84
backgroundColor : strokeColor as string ,
87
85
} ;
88
86
} ) ;
89
- const borderRadius =
90
- props . strokeLinecap === 'square' || props . strokeLinecap === 'butt' ? 0 : undefined ;
87
+ const borderRadius = computed ( ( ) =>
88
+ props . strokeLinecap === 'square' || props . strokeLinecap === 'butt' ? 0 : undefined ,
89
+ ) ;
91
90
92
91
const trailStyle = computed < CSSProperties > ( ( ) =>
93
92
props . trailColor
@@ -118,7 +117,7 @@ export default defineComponent({
118
117
return {
119
118
width : `${ validProgress ( percent ) } %` ,
120
119
height : `${ sizeRef . value . height } px` ,
121
- borderRadius,
120
+ borderRadius : borderRadius . value ,
122
121
...backgroundProps . value ,
123
122
} ;
124
123
} ) ;
@@ -131,7 +130,7 @@ export default defineComponent({
131
130
return {
132
131
width : `${ validProgress ( successPercent . value ) } %` ,
133
132
height : `${ sizeRef . value . height } px` ,
134
- borderRadius,
133
+ borderRadius : borderRadius . value ,
135
134
backgroundColor : success ?. strokeColor ,
136
135
} ;
137
136
} ) ;
@@ -143,7 +142,11 @@ export default defineComponent({
143
142
144
143
return ( ) => (
145
144
< >
146
- < div { ...attrs } class = { [ `${ props . prefixCls } -outer` , attrs . class ] } style = { outerStyle } >
145
+ < div
146
+ { ...attrs }
147
+ class = { [ `${ props . prefixCls } -outer` , attrs . class ] }
148
+ style = { [ attrs . style as CSSProperties , outerStyle ] }
149
+ >
147
150
< div class = { `${ props . prefixCls } -inner` } style = { trailStyle . value } >
148
151
< div class = { `${ props . prefixCls } -bg` } style = { percentStyle . value } />
149
152
{ successPercent . value !== undefined ? (
0 commit comments