1- import type { App , ExtractPropTypes , PropType } from 'vue' ;
1+ import type { App , ExtractPropTypes } from 'vue' ;
22import { computed , defineComponent } from 'vue' ;
33import CloseOutlined from '@ant-design/icons-vue/CloseOutlined' ;
44import CheckOutlined from '@ant-design/icons-vue/CheckOutlined' ;
@@ -13,35 +13,40 @@ import omit from '../_util/omit';
1313import { VcStepProps } from '../vc-steps/Step' ;
1414import type { ProgressDotRender } from '../vc-steps/Steps' ;
1515import type { MouseEventHandler } from '../_util/EventInterface' ;
16+ import { booleanType , stringType , functionType , someType } from '../_util/type' ;
17+
18+ // CSSINJS
19+ import useStyle from './style' ;
20+ import { useToken } from '../theme/internal' ;
1621
1722export const stepsProps = ( ) => ( {
1823 prefixCls : String ,
1924 iconPrefix : String ,
2025 current : Number ,
2126 initial : Number ,
2227 percent : Number ,
23- responsive : { type : Boolean , default : undefined } ,
24- labelPlacement : String as PropType < 'horizontal' | 'vertical' > ,
25- status : String as PropType < 'wait' | 'process' | 'finish' | 'error' > ,
26- size : String as PropType < 'default' | 'small' > ,
27- direction : String as PropType < 'horizontal' | 'vertical' > ,
28- progressDot : {
29- type : [ Boolean , Function ] as PropType < boolean | ProgressDotRender > ,
30- default : undefined as boolean | ProgressDotRender ,
31- } ,
32- type : String as PropType < 'default' | 'navigation' > ,
33- onChange : Function as PropType < ( current : number ) => void > ,
34- 'onUpdate:current' : Function as PropType < ( current : number ) => void > ,
28+ responsive : booleanType ( ) ,
29+ labelPlacement : stringType < 'horizontal' | 'vertical' > ( ) ,
30+ status : stringType < 'wait' | 'process' | 'finish' | 'error' > ( ) ,
31+ size : stringType < 'default' | 'small' > ( ) ,
32+ direction : stringType < 'horizontal' | 'vertical' > ( ) ,
33+ progressDot : someType < boolean | ProgressDotRender > (
34+ [ Boolean , Function ] ,
35+ undefined as boolean | ProgressDotRender ,
36+ ) ,
37+ type : stringType < 'default' | 'navigation' > ( ) ,
38+ onChange : functionType < ( current : number ) => void > ( ) ,
39+ 'onUpdate:current' : functionType < ( current : number ) => void > ( ) ,
3540} ) ;
3641
3742export const stepProps = ( ) => ( {
3843 description : PropTypes . any ,
3944 icon : PropTypes . any ,
40- status : String as PropType < 'wait' | 'process' | 'finish' | 'error' > ,
41- disabled : { type : Boolean , default : undefined } ,
45+ status : stringType < 'wait' | 'process' | 'finish' | 'error' > ( ) ,
46+ disabled : booleanType ( ) ,
4247 title : PropTypes . any ,
4348 subTitle : PropTypes . any ,
44- onClick : Function as PropType < MouseEventHandler > ,
49+ onClick : functionType < MouseEventHandler > ( ) ,
4550} ) ;
4651
4752export type StepsProps = Partial < ExtractPropTypes < ReturnType < typeof stepsProps > > > ;
@@ -61,6 +66,13 @@ const Steps = defineComponent({
6166 // emits: ['update:current', 'change'],
6267 setup ( props , { attrs, slots, emit } ) {
6368 const { prefixCls, direction : rtlDirection , configProvider } = useConfigInject ( 'steps' , props ) ;
69+
70+ // 接入换肤
71+ const [ , token ] = useToken ( ) ;
72+
73+ // style
74+ const [ wrapSSR , hashId ] = useStyle ( prefixCls ) ;
75+
6476 const screens = useBreakpoint ( ) ;
6577 const direction = computed ( ( ) =>
6678 props . responsive && screens . value . xs ? 'vertical' : props . direction ,
@@ -84,11 +96,12 @@ const Steps = defineComponent({
8496 // currently it's hard-coded, since we can't easily read the actually width of icon
8597 const progressWidth = props . size === 'small' ? 32 : 40 ;
8698 const iconWithProgress = (
87- < div class = { `${ prefixCls } -progress-icon` } >
99+ < div class = { `${ prefixCls . value } -progress-icon` } >
88100 < Progress
89101 type = "circle"
90102 percent = { props . percent }
91103 width = { progressWidth }
104+ strokeColor = { token . value . colorPrimary }
92105 strokeWidth = { 4 }
93106 format = { ( ) => null }
94107 />
@@ -106,22 +119,24 @@ const Steps = defineComponent({
106119 [ `${ prefixCls . value } -with-progress` ] : props . percent !== undefined ,
107120 } ,
108121 attrs . class ,
122+ hashId . value ,
109123 ) ;
110124 const icons = {
111125 finish : < CheckOutlined class = { `${ prefixCls } -finish-icon` } /> ,
112126 error : < CloseOutlined class = { `${ prefixCls } -error-icon` } /> ,
113127 } ;
114- return (
128+ return wrapSSR (
115129 < VcSteps
116130 icons = { icons }
131+ { ...attrs }
117132 { ...omit ( props , [ 'percent' , 'responsive' ] ) }
118133 direction = { direction . value }
119134 prefixCls = { prefixCls . value }
120135 iconPrefix = { iconPrefix . value }
121136 class = { stepsClassName }
122137 onChange = { handleChange }
123138 v-slots = { { ...slots , stepIcon : stepIconRender } }
124- />
139+ /> ,
125140 ) ;
126141 } ;
127142 } ,
0 commit comments