@@ -10,7 +10,6 @@ import {
1010 ChangeDetectorRef ,
1111 Component ,
1212 ContentChildren ,
13- ElementRef ,
1413 EventEmitter ,
1514 Input ,
1615 NgZone ,
@@ -19,7 +18,6 @@ import {
1918 Optional ,
2019 Output ,
2120 QueryList ,
22- Renderer2 ,
2321 SimpleChanges ,
2422 TemplateRef ,
2523 ViewEncapsulation
@@ -79,14 +77,13 @@ export class NzStepsComponent implements OnChanges, OnInit, AfterContentInit {
7977 private indexChangeSubscription = Subscription . EMPTY ;
8078
8179 showProcessDot = false ;
80+ showProgress = false ;
8281 customProcessDotTemplate ?: TemplateRef < { $implicit : TemplateRef < void > ; status : string ; index : number } > ;
8382 classMap : NgClassType = { } ;
8483 dir : Direction = 'ltr' ;
8584
8685 constructor (
8786 private ngZone : NgZone ,
88- private elementRef : ElementRef ,
89- private renderer : Renderer2 ,
9087 private cdr : ChangeDetectorRef ,
9188 @Optional ( ) private directionality : Directionality ,
9289 private destroy$ : NzDestroyService
@@ -95,7 +92,7 @@ export class NzStepsComponent implements OnChanges, OnInit, AfterContentInit {
9592 }
9693
9794 ngOnChanges ( changes : SimpleChanges ) : void {
98- if ( changes . nzStartIndex || changes . nzDirection || changes . nzStatus || changes . nzCurrent ) {
95+ if ( changes . nzStartIndex || changes . nzDirection || changes . nzStatus || changes . nzCurrent || changes . nzSize ) {
9996 this . updateChildrenSteps ( ) ;
10097 }
10198 if ( changes . nzDirection || changes . nzProgressDot || changes . nzLabelPlacement || changes . nzSize ) {
@@ -126,14 +123,8 @@ export class NzStepsComponent implements OnChanges, OnInit, AfterContentInit {
126123
127124 private updateHostProgressClass ( ) : void {
128125 if ( this . steps && ! this . showProcessDot ) {
129- const hasPercent = ! ! this . steps . toArray ( ) . find ( step => step . nzPercentage !== null ) ;
130- const className = 'ant-steps-with-progress' ;
131- const hasClass = this . elementRef . nativeElement . classList . contains ( className ) ;
132- if ( hasPercent && ! hasClass ) {
133- this . renderer . addClass ( this . elementRef . nativeElement , className ) ;
134- } else if ( ! hasPercent && hasClass ) {
135- this . renderer . removeClass ( this . elementRef . nativeElement , className ) ;
136- }
126+ this . showProgress = ! ! this . steps . toArray ( ) . find ( step => step . nzPercentage !== null ) ;
127+ this . setClassMap ( ) ;
137128 }
138129 }
139130
@@ -142,6 +133,7 @@ export class NzStepsComponent implements OnChanges, OnInit, AfterContentInit {
142133 const length = this . steps . length ;
143134 this . steps . toArray ( ) . forEach ( ( step , index ) => {
144135 Promise . resolve ( ) . then ( ( ) => {
136+ step . nzSize = this . nzSize ;
145137 step . outStatus = this . nzStatus ;
146138 step . showProcessDot = this . showProcessDot ;
147139 if ( this . customProcessDotTemplate ) {
@@ -175,7 +167,8 @@ export class NzStepsComponent implements OnChanges, OnInit, AfterContentInit {
175167 [ `ant-steps-dot` ] : this . showProcessDot ,
176168 [ 'ant-steps-small' ] : this . nzSize === 'small' ,
177169 [ 'ant-steps-navigation' ] : this . nzType === 'navigation' ,
178- [ 'ant-steps-rtl' ] : this . dir === 'rtl'
170+ [ 'ant-steps-rtl' ] : this . dir === 'rtl' ,
171+ [ 'ant-steps-with-progress' ] : this . showProgress
179172 } ;
180173 }
181174}
0 commit comments