Skip to content

Commit 48cb0f5

Browse files
committed
refactor(material/stepper): convert to standalone
Converts `material/stepper` to standalone.
1 parent 85a577c commit 48cb0f5

File tree

10 files changed

+41
-24
lines changed

10 files changed

+41
-24
lines changed

src/material/stepper/step-content.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {Directive, TemplateRef} from '@angular/core';
1313
*/
1414
@Directive({
1515
selector: 'ng-template[matStepContent]',
16+
standalone: true,
1617
})
1718
export class MatStepContent {
1819
constructor(public _template: TemplateRef<any>) {}

src/material/stepper/step-header.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ import {MatStepLabel} from './step-label';
2323
import {MatStepperIntl} from './stepper-intl';
2424
import {MatStepperIconContext} from './stepper-icon';
2525
import {CdkStepHeader, StepState} from '@angular/cdk/stepper';
26-
import {ThemePalette} from '@angular/material/core';
26+
import {MatRipple, ThemePalette} from '@angular/material/core';
27+
import {MatIcon} from '@angular/material/icon';
28+
import {NgTemplateOutlet} from '@angular/common';
2729

2830
@Component({
2931
selector: 'mat-step-header',
@@ -36,6 +38,8 @@ import {ThemePalette} from '@angular/material/core';
3638
},
3739
encapsulation: ViewEncapsulation.None,
3840
changeDetection: ChangeDetectionStrategy.OnPush,
41+
standalone: true,
42+
imports: [MatRipple, NgTemplateOutlet, MatIcon],
3943
})
4044
export class MatStepHeader extends CdkStepHeader implements AfterViewInit, OnDestroy {
4145
private _intlSubscription: Subscription;

src/material/stepper/step-label.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ import {CdkStepLabel} from '@angular/cdk/stepper';
1111

1212
@Directive({
1313
selector: '[matStepLabel]',
14+
standalone: true,
1415
})
1516
export class MatStepLabel extends CdkStepLabel {}

src/material/stepper/stepper-button.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {Directive} from '@angular/core';
1717
'[type]': 'type',
1818
},
1919
inputs: ['type'],
20+
standalone: true,
2021
})
2122
export class MatStepperNext extends CdkStepperNext {}
2223

@@ -28,5 +29,6 @@ export class MatStepperNext extends CdkStepperNext {}
2829
'[type]': 'type',
2930
},
3031
inputs: ['type'],
32+
standalone: true,
3133
})
3234
export class MatStepperPrevious extends CdkStepperPrevious {}

src/material/stepper/stepper-icon.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export interface MatStepperIconContext {
2424
*/
2525
@Directive({
2626
selector: 'ng-template[matStepperIcon]',
27+
standalone: true,
2728
})
2829
export class MatStepperIcon {
2930
/** Name of the icon to be overridden. */

src/material/stepper/stepper-module.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ import {MatStepContent} from './step-content';
2828
CdkStepperModule,
2929
MatIconModule,
3030
MatRippleModule,
31-
],
32-
exports: [
33-
MatCommonModule,
3431
MatStep,
3532
MatStepLabel,
3633
MatStepper,
@@ -40,7 +37,8 @@ import {MatStepContent} from './step-content';
4037
MatStepperIcon,
4138
MatStepContent,
4239
],
43-
declarations: [
40+
exports: [
41+
MatCommonModule,
4442
MatStep,
4543
MatStepLabel,
4644
MatStepper,

src/material/stepper/stepper.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ import {
1515
STEP_STATE,
1616
CdkStep,
1717
} from '@angular/cdk/stepper';
18-
import {dispatchKeyboardEvent, createKeyboardEvent, dispatchEvent} from '../../cdk/testing/private';
18+
import {
19+
dispatchKeyboardEvent,
20+
createKeyboardEvent,
21+
dispatchEvent,
22+
} from '@angular/cdk/testing/private';
1923
import {
2024
Component,
2125
DebugElement,
@@ -1791,8 +1795,8 @@ function createComponent<T>(
17911795
): ComponentFixture<T> {
17921796
TestBed.configureTestingModule({
17931797
imports: [MatStepperModule, NoopAnimationsModule, ReactiveFormsModule, ...imports],
1794-
declarations: [component],
17951798
providers: [{provide: Directionality, useFactory: () => dir}, ...providers],
1799+
declarations: [component],
17961800
});
17971801

17981802
if (encapsulation != null) {

src/material/stepper/stepper.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import {
3939
} from '@angular/core';
4040
import {AbstractControl, FormGroupDirective, NgForm} from '@angular/forms';
4141
import {ErrorStateMatcher, ThemePalette} from '@angular/material/core';
42-
import {TemplatePortal} from '@angular/cdk/portal';
42+
import {CdkPortalOutlet, TemplatePortal} from '@angular/cdk/portal';
4343
import {Subject, Subscription} from 'rxjs';
4444
import {takeUntil, distinctUntilChanged, map, startWith, switchMap} from 'rxjs/operators';
4545

@@ -52,6 +52,7 @@ import {
5252
} from './stepper-animations';
5353
import {MatStepperIcon, MatStepperIconContext} from './stepper-icon';
5454
import {MatStepContent} from './step-content';
55+
import {NgTemplateOutlet} from '@angular/common';
5556

5657
@Component({
5758
selector: 'mat-step',
@@ -63,6 +64,8 @@ import {MatStepContent} from './step-content';
6364
encapsulation: ViewEncapsulation.None,
6465
exportAs: 'matStep',
6566
changeDetection: ChangeDetectionStrategy.OnPush,
67+
standalone: true,
68+
imports: [CdkPortalOutlet],
6669
})
6770
export class MatStep extends CdkStep implements ErrorStateMatcher, AfterContentInit, OnDestroy {
6871
private _isSelected = Subscription.EMPTY;
@@ -148,6 +151,8 @@ export class MatStep extends CdkStep implements ErrorStateMatcher, AfterContentI
148151
providers: [{provide: CdkStepper, useExisting: MatStepper}],
149152
encapsulation: ViewEncapsulation.None,
150153
changeDetection: ChangeDetectionStrategy.OnPush,
154+
standalone: true,
155+
imports: [NgTemplateOutlet, MatStepHeader],
151156
})
152157
export class MatStepper extends CdkStepper implements AfterContentInit {
153158
/** The list of step headers of the steps in the stepper. */

src/material/stepper/testing/stepper-harness.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ describe('MatStepperHarness', () => {
1616

1717
beforeEach(async () => {
1818
await TestBed.configureTestingModule({
19-
imports: [MatStepperModule, NoopAnimationsModule, ReactiveFormsModule],
20-
declarations: [StepperHarnessTest],
19+
imports: [MatStepperModule, NoopAnimationsModule, ReactiveFormsModule, StepperHarnessTest],
2120
providers: [
2221
{
2322
provide: STEPPER_GLOBAL_OPTIONS,
@@ -302,6 +301,8 @@ describe('MatStepperHarness', () => {
302301
</mat-step>
303302
</mat-stepper>
304303
`,
304+
standalone: true,
305+
imports: [MatStepperModule, ReactiveFormsModule],
305306
})
306307
class StepperHarnessTest {
307308
oneGroup = new FormGroup({

tools/public_api_guard/material/stepper.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ import { FocusMonitor } from '@angular/cdk/a11y';
2424
import { FocusOrigin } from '@angular/cdk/a11y';
2525
import { FormGroupDirective } from '@angular/forms';
2626
import * as i0 from '@angular/core';
27-
import * as i10 from '@angular/cdk/stepper';
28-
import * as i11 from '@angular/material/icon';
29-
import * as i7 from '@angular/material/core';
30-
import * as i8 from '@angular/common';
31-
import * as i9 from '@angular/cdk/portal';
27+
import * as i1 from '@angular/material/core';
28+
import * as i2 from '@angular/common';
29+
import * as i3 from '@angular/cdk/portal';
30+
import * as i4 from '@angular/cdk/stepper';
31+
import * as i5 from '@angular/material/icon';
3232
import { NgForm } from '@angular/forms';
3333
import { OnDestroy } from '@angular/core';
3434
import { Optional } from '@angular/core';
@@ -65,7 +65,7 @@ export class MatStep extends CdkStep implements ErrorStateMatcher, AfterContentI
6565
_portal: TemplatePortal;
6666
stepLabel: MatStepLabel;
6767
// (undocumented)
68-
static ɵcmp: i0.ɵɵComponentDeclaration<MatStep, "mat-step", ["matStep"], { "color": { "alias": "color"; "required": false; }; }, {}, ["stepLabel", "_lazyContent"], ["*"], false, never>;
68+
static ɵcmp: i0.ɵɵComponentDeclaration<MatStep, "mat-step", ["matStep"], { "color": { "alias": "color"; "required": false; }; }, {}, ["stepLabel", "_lazyContent"], ["*"], true, never>;
6969
// (undocumented)
7070
static ɵfac: i0.ɵɵFactoryDeclaration<MatStep, [null, { skipSelf: true; }, null, { optional: true; }]>;
7171
}
@@ -76,7 +76,7 @@ export class MatStepContent {
7676
// (undocumented)
7777
_template: TemplateRef<any>;
7878
// (undocumented)
79-
static ɵdir: i0.ɵɵDirectiveDeclaration<MatStepContent, "ng-template[matStepContent]", never, {}, {}, never, never, false, never>;
79+
static ɵdir: i0.ɵɵDirectiveDeclaration<MatStepContent, "ng-template[matStepContent]", never, {}, {}, never, never, true, never>;
8080
// (undocumented)
8181
static ɵfac: i0.ɵɵFactoryDeclaration<MatStepContent, never>;
8282
}
@@ -110,15 +110,15 @@ export class MatStepHeader extends CdkStepHeader implements AfterViewInit, OnDes
110110
_stringLabel(): string | null;
111111
_templateLabel(): MatStepLabel | null;
112112
// (undocumented)
113-
static ɵcmp: i0.ɵɵComponentDeclaration<MatStepHeader, "mat-step-header", never, { "state": { "alias": "state"; "required": false; }; "label": { "alias": "label"; "required": false; }; "errorMessage": { "alias": "errorMessage"; "required": false; }; "iconOverrides": { "alias": "iconOverrides"; "required": false; }; "index": { "alias": "index"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; "active": { "alias": "active"; "required": false; }; "optional": { "alias": "optional"; "required": false; }; "disableRipple": { "alias": "disableRipple"; "required": false; }; "color": { "alias": "color"; "required": false; }; }, {}, never, never, false, never>;
113+
static ɵcmp: i0.ɵɵComponentDeclaration<MatStepHeader, "mat-step-header", never, { "state": { "alias": "state"; "required": false; }; "label": { "alias": "label"; "required": false; }; "errorMessage": { "alias": "errorMessage"; "required": false; }; "iconOverrides": { "alias": "iconOverrides"; "required": false; }; "index": { "alias": "index"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; "active": { "alias": "active"; "required": false; }; "optional": { "alias": "optional"; "required": false; }; "disableRipple": { "alias": "disableRipple"; "required": false; }; "color": { "alias": "color"; "required": false; }; }, {}, never, never, true, never>;
114114
// (undocumented)
115115
static ɵfac: i0.ɵɵFactoryDeclaration<MatStepHeader, never>;
116116
}
117117

118118
// @public (undocumented)
119119
export class MatStepLabel extends CdkStepLabel {
120120
// (undocumented)
121-
static ɵdir: i0.ɵɵDirectiveDeclaration<MatStepLabel, "[matStepLabel]", never, {}, {}, never, never, false, never>;
121+
static ɵdir: i0.ɵɵDirectiveDeclaration<MatStepLabel, "[matStepLabel]", never, {}, {}, never, never, true, never>;
122122
// (undocumented)
123123
static ɵfac: i0.ɵɵFactoryDeclaration<MatStepLabel, never>;
124124
}
@@ -146,7 +146,7 @@ export class MatStepper extends CdkStepper implements AfterContentInit {
146146
readonly steps: QueryList<MatStep>;
147147
_steps: QueryList<MatStep>;
148148
// (undocumented)
149-
static ɵcmp: i0.ɵɵComponentDeclaration<MatStepper, "mat-stepper, mat-vertical-stepper, mat-horizontal-stepper, [matStepper]", ["matStepper", "matVerticalStepper", "matHorizontalStepper"], { "selectedIndex": { "alias": "selectedIndex"; "required": false; }; "disableRipple": { "alias": "disableRipple"; "required": false; }; "color": { "alias": "color"; "required": false; }; "labelPosition": { "alias": "labelPosition"; "required": false; }; "headerPosition": { "alias": "headerPosition"; "required": false; }; "animationDuration": { "alias": "animationDuration"; "required": false; }; }, { "animationDone": "animationDone"; }, ["_steps", "_icons"], never, false, never>;
149+
static ɵcmp: i0.ɵɵComponentDeclaration<MatStepper, "mat-stepper, mat-vertical-stepper, mat-horizontal-stepper, [matStepper]", ["matStepper", "matVerticalStepper", "matHorizontalStepper"], { "selectedIndex": { "alias": "selectedIndex"; "required": false; }; "disableRipple": { "alias": "disableRipple"; "required": false; }; "color": { "alias": "color"; "required": false; }; "labelPosition": { "alias": "labelPosition"; "required": false; }; "headerPosition": { "alias": "headerPosition"; "required": false; }; "animationDuration": { "alias": "animationDuration"; "required": false; }; }, { "animationDone": "animationDone"; }, ["_steps", "_icons"], never, true, never>;
150150
// (undocumented)
151151
static ɵfac: i0.ɵɵFactoryDeclaration<MatStepper, [{ optional: true; }, null, null]>;
152152
}
@@ -164,7 +164,7 @@ export class MatStepperIcon {
164164
// (undocumented)
165165
templateRef: TemplateRef<MatStepperIconContext>;
166166
// (undocumented)
167-
static ɵdir: i0.ɵɵDirectiveDeclaration<MatStepperIcon, "ng-template[matStepperIcon]", never, { "name": { "alias": "matStepperIcon"; "required": false; }; }, {}, never, never, false, never>;
167+
static ɵdir: i0.ɵɵDirectiveDeclaration<MatStepperIcon, "ng-template[matStepperIcon]", never, { "name": { "alias": "matStepperIcon"; "required": false; }; }, {}, never, never, true, never>;
168168
// (undocumented)
169169
static ɵfac: i0.ɵɵFactoryDeclaration<MatStepperIcon, never>;
170170
}
@@ -195,21 +195,21 @@ export class MatStepperModule {
195195
// (undocumented)
196196
static ɵinj: i0.ɵɵInjectorDeclaration<MatStepperModule>;
197197
// (undocumented)
198-
static ɵmod: i0.ɵɵNgModuleDeclaration<MatStepperModule, [typeof i1.MatStep, typeof i2.MatStepLabel, typeof i1.MatStepper, typeof i3.MatStepperNext, typeof i3.MatStepperPrevious, typeof i4.MatStepHeader, typeof i5.MatStepperIcon, typeof i6.MatStepContent], [typeof i7.MatCommonModule, typeof i8.CommonModule, typeof i9.PortalModule, typeof i10.CdkStepperModule, typeof i11.MatIconModule, typeof i7.MatRippleModule], [typeof i7.MatCommonModule, typeof i1.MatStep, typeof i2.MatStepLabel, typeof i1.MatStepper, typeof i3.MatStepperNext, typeof i3.MatStepperPrevious, typeof i4.MatStepHeader, typeof i5.MatStepperIcon, typeof i6.MatStepContent]>;
198+
static ɵmod: i0.ɵɵNgModuleDeclaration<MatStepperModule, never, [typeof i1.MatCommonModule, typeof i2.CommonModule, typeof i3.PortalModule, typeof i4.CdkStepperModule, typeof i5.MatIconModule, typeof i1.MatRippleModule, typeof i6.MatStep, typeof i7.MatStepLabel, typeof i6.MatStepper, typeof i8.MatStepperNext, typeof i8.MatStepperPrevious, typeof i9.MatStepHeader, typeof i10.MatStepperIcon, typeof i11.MatStepContent], [typeof i1.MatCommonModule, typeof i6.MatStep, typeof i7.MatStepLabel, typeof i6.MatStepper, typeof i8.MatStepperNext, typeof i8.MatStepperPrevious, typeof i9.MatStepHeader, typeof i10.MatStepperIcon, typeof i11.MatStepContent]>;
199199
}
200200

201201
// @public
202202
export class MatStepperNext extends CdkStepperNext {
203203
// (undocumented)
204-
static ɵdir: i0.ɵɵDirectiveDeclaration<MatStepperNext, "button[matStepperNext]", never, { "type": { "alias": "type"; "required": false; }; }, {}, never, never, false, never>;
204+
static ɵdir: i0.ɵɵDirectiveDeclaration<MatStepperNext, "button[matStepperNext]", never, { "type": { "alias": "type"; "required": false; }; }, {}, never, never, true, never>;
205205
// (undocumented)
206206
static ɵfac: i0.ɵɵFactoryDeclaration<MatStepperNext, never>;
207207
}
208208

209209
// @public
210210
export class MatStepperPrevious extends CdkStepperPrevious {
211211
// (undocumented)
212-
static ɵdir: i0.ɵɵDirectiveDeclaration<MatStepperPrevious, "button[matStepperPrevious]", never, { "type": { "alias": "type"; "required": false; }; }, {}, never, never, false, never>;
212+
static ɵdir: i0.ɵɵDirectiveDeclaration<MatStepperPrevious, "button[matStepperPrevious]", never, { "type": { "alias": "type"; "required": false; }; }, {}, never, never, true, never>;
213213
// (undocumented)
214214
static ɵfac: i0.ɵɵFactoryDeclaration<MatStepperPrevious, never>;
215215
}

0 commit comments

Comments
 (0)