13
13
< div class ="mat-horizontal-stepper-wrapper ">
14
14
< div class ="mat-horizontal-stepper-header-container " role ="tablist ">
15
15
@for (step of steps; track step) {
16
- < mat-step-header
17
- class ="mat-horizontal-stepper-header "
18
- role ="tab "
19
- (click) ="step.select() "
20
- (keydown) ="_onKeydown($event) "
21
- [tabIndex] ="_getFocusIndex() === $index ? 0 : -1 "
22
- [id] ="_getStepLabelId($index) "
23
- [attr.aria-posinset] ="$index + 1 "
24
- [attr.aria-setsize] ="steps.length "
25
- [attr.aria-controls] ="_getStepContentId($index) "
26
- [attr.aria-owns] ="_getStepContentId($index) "
27
- [attr.aria-selected] ="selectedIndex == $index "
28
- [attr.aria-label] ="step.ariaLabel || null "
29
- [attr.aria-labelledby] ="(!step.ariaLabel && step.ariaLabelledby) ? step.ariaLabelledby : null "
30
- [attr.aria-disabled] ="_stepIsNavigable($index, step) ? null : true "
31
- [index] ="$index "
32
- [state] ="_getIndicatorType($index, step.state) "
33
- [label] ="step.stepLabel || step.label "
34
- [selected] ="selectedIndex === $index "
35
- [active] ="_stepIsNavigable($index, step) "
36
- [optional] ="step.optional "
37
- [errorMessage] ="step.errorMessage "
38
- [iconOverrides] ="_iconOverrides "
39
- [disableRipple] ="disableRipple || !_stepIsNavigable($index, step) "
40
- [color] ="step.color || color "/>
16
+ < ng-container
17
+ [ngTemplateOutlet] ="stepTemplate "
18
+ [ngTemplateOutletContext] ="{step, i: $index} "/>
41
19
@if (!$last) {
42
20
< div class ="mat-stepper-horizontal-line "> </ div >
43
21
}
65
43
< div class ="mat-vertical-stepper-wrapper " role ="group ">
66
44
@for (step of steps; track step) {
67
45
< div class ="mat-step ">
68
- < mat-step-header
69
- class ="mat-vertical-stepper-header "
70
- role ="button "
71
- (click) ="step.select() "
72
- (keydown) ="_onKeydown($event) "
73
- [tabIndex] ="_getFocusIndex() === $index ? 0 : -1 "
74
- [id] ="_getStepLabelId($index) "
75
- [attr.aria-expanded] ="selectedIndex === $index "
76
- [attr.aria-controls] ="_getStepContentId($index) "
77
- [attr.aria-current] ="selectedIndex == $index "
78
- [attr.aria-label] ="step.ariaLabel || null "
79
- [attr.aria-labelledby] ="(!step.ariaLabel && step.ariaLabelledby) ? step.ariaLabelledby : null "
80
- [attr.aria-disabled] ="_stepIsNavigable($index, step) ? null : true "
81
- [index] ="$index "
82
- [state] ="_getIndicatorType($index, step.state) "
83
- [label] ="step.stepLabel || step.label "
84
- [selected] ="selectedIndex === $index "
85
- [active] ="_stepIsNavigable($index, step) "
86
- [optional] ="step.optional "
87
- [errorMessage] ="step.errorMessage "
88
- [iconOverrides] ="_iconOverrides "
89
- [disableRipple] ="disableRipple || !_stepIsNavigable($index, step) "
90
- [color] ="step.color || color "/>
46
+ < ng-container
47
+ [ngTemplateOutlet] ="stepTemplate "
48
+ [ngTemplateOutletContext] ="{step, i: $index} "/>
91
49
< div
92
50
#animatedContainer
93
51
class ="mat-vertical-content-container "
108
66
</ div >
109
67
}
110
68
}
69
+
70
+ <!-- Common step templating -->
71
+ < ng-template let-step ="step " let-i ="i " #stepTemplate >
72
+ < mat-step-header
73
+ [class.mat-horizontal-stepper-header] ="orientation === 'horizontal' "
74
+ [class.mat-vertical-stepper-header] ="orientation === 'vertical' "
75
+ [attr.role] ="orientation === 'horizontal'? 'tab' : 'button' "
76
+ (click) ="step.select() "
77
+ (keydown) ="_onKeydown($event) "
78
+ [tabIndex] ="_getFocusIndex() === i ? 0 : -1 "
79
+ [id] ="_getStepLabelId(i) "
80
+ [attr.aria-posinset] ="orientation === 'horizontal'? i + 1 : undefined "
81
+ [attr.aria-setsize] ="orientation === 'horizontal'? steps.length : undefined "
82
+ [attr.aria-controls] ="_getStepContentId(i) "
83
+ [attr.aria-selected] ="orientation === 'horizontal' ? selectedIndex == i : undefined "
84
+ [attr.aria-expanded] ="orientation === 'vertical' ? selectedIndex == i : undefined "
85
+ [attr.aria-label] ="step.ariaLabel || null "
86
+ [attr.aria-labelledby] ="(!step.ariaLabel && step.ariaLabelledby) ? step.ariaLabelledby : null "
87
+ [attr.aria-disabled] ="_stepIsNavigable(i, step) ? null : true "
88
+ [attr.aria-owns] ="_getStepContentId(i) "
89
+ [index] ="i "
90
+ [state] ="_getIndicatorType(i, step.state) "
91
+ [label] ="step.stepLabel || step.label "
92
+ [selected] ="selectedIndex === i "
93
+ [active] ="_stepIsNavigable(i, step) "
94
+ [optional] ="step.optional "
95
+ [errorMessage] ="step.errorMessage "
96
+ [iconOverrides] ="_iconOverrides "
97
+ [disableRipple] ="disableRipple || !_stepIsNavigable(i, step) "
98
+ [color] ="step.color || color "/>
99
+ </ ng-template >
0 commit comments