Skip to content

Commit 0a3a37a

Browse files
committed
refactor(material/stepper): remove deprecated APIs for version 13
Removes all the stepper APIs that were marked as deprecated for version 13. BREAKING CHANGE: * `CdkStepper._orientation` has been removed. Use `CdkStepper.orientation` instead. * The `_document` parameter from the `CdkStepper` constructor has been removed. * The `_document` parameter from the `MatStepper` constructor has been removed. * `MatVerticalStepper` has been removed. Use `MatStepper` instead. * `MatHorizontalStepper` has been removed. Use `MatStepper` instead.
1 parent c03d8ac commit 0a3a37a

File tree

8 files changed

+24
-97
lines changed

8 files changed

+24
-97
lines changed

src/cdk/schematics/ng-update/data/constructor-checks.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ export type ConstructorChecksUpgradeData = string;
1717
* automatically through type checking.
1818
*/
1919
export const constructorChecks: VersionChanges<ConstructorChecksUpgradeData> = {
20+
[TargetVersion.V13]: [
21+
{
22+
pr: 'https://github.com/angular/components/pull/23328',
23+
changes: ['CdkStepper']
24+
}
25+
],
2026
[TargetVersion.V12]: [
2127
{
2228
pr: 'https://github.com/angular/components/pull/21876',

src/cdk/stepper/stepper.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
NumberInput
1616
} from '@angular/cdk/coercion';
1717
import {ENTER, hasModifierKey, SPACE} from '@angular/cdk/keycodes';
18-
import {DOCUMENT} from '@angular/common';
1918
import {
2019
AfterViewInit,
2120
ChangeDetectionStrategy,
@@ -334,21 +333,11 @@ export class CdkStepper implements AfterContentInit, AfterViewInit, OnDestroy {
334333
this._keyManager.withVerticalOrientation(value === 'vertical');
335334
}
336335
}
337-
338-
/**
339-
* @deprecated To be turned into a private property. Use `orientation` instead.
340-
* @breaking-change 13.0.0
341-
*/
342-
protected _orientation: StepperOrientation = 'horizontal';
336+
private _orientation: StepperOrientation = 'horizontal';
343337

344338
constructor(
345339
@Optional() private _dir: Directionality, private _changeDetectorRef: ChangeDetectorRef,
346-
private _elementRef: ElementRef<HTMLElement>,
347-
/**
348-
* @deprecated No longer in use, to be removed.
349-
* @breaking-change 13.0.0
350-
*/
351-
@Inject(DOCUMENT) _document: any) {
340+
private _elementRef: ElementRef<HTMLElement>) {
352341
this._groupId = nextId++;
353342
}
354343

src/material/schematics/ng-update/data/constructor-checks.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ import {ConstructorChecksUpgradeData, TargetVersion, VersionChanges} from '@angu
1414
* automatically through type checking.
1515
*/
1616
export const constructorChecks: VersionChanges<ConstructorChecksUpgradeData> = {
17+
[TargetVersion.V13]: [
18+
{
19+
pr: 'https://github.com/angular/components/pull/23328',
20+
changes: ['MatStepper']
21+
}
22+
],
1723
[TargetVersion.V12]: [
1824
{
1925
pr: 'https://github.com/angular/components/pull/21897',

src/material/stepper/stepper-module.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {ErrorStateMatcher, MatCommonModule, MatRippleModule} from '@angular/mate
1515
import {MatIconModule} from '@angular/material/icon';
1616
import {MatStepHeader} from './step-header';
1717
import {MatStepLabel} from './step-label';
18-
import {MatHorizontalStepper, MatStep, MatStepper, MatVerticalStepper} from './stepper';
18+
import {MatStep, MatStepper} from './stepper';
1919
import {MatStepperNext, MatStepperPrevious} from './stepper-button';
2020
import {MatStepperIcon} from './stepper-icon';
2121
import {MAT_STEPPER_INTL_PROVIDER} from './stepper-intl';
@@ -44,8 +44,6 @@ import {MatStepContent} from './step-content';
4444
MatStepContent,
4545
],
4646
declarations: [
47-
MatHorizontalStepper,
48-
MatVerticalStepper,
4947
MatStep,
5048
MatStepLabel,
5149
MatStepper,

src/material/stepper/stepper.spec.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ import {_supportsShadowDom} from '@angular/cdk/platform';
5050
import {merge, Observable, Subject} from 'rxjs';
5151
import {map, take} from 'rxjs/operators';
5252
import {MatStepHeader, MatStepperModule} from './index';
53-
import {MatHorizontalStepper, MatStep, MatStepper, MatVerticalStepper} from './stepper';
53+
import {MatStep, MatStepper} from './stepper';
5454
import {MatStepperNext, MatStepperPrevious} from './stepper-button';
5555
import {MatStepperIntl} from './stepper-intl';
5656
import {MatFormFieldModule} from '@angular/material/form-field';
@@ -874,13 +874,6 @@ describe('MatStepper', () => {
874874
});
875875

876876
describe('vertical stepper', () => {
877-
it('should be able to use the legacy classes in queries', () => {
878-
const fixture = createComponent(SimpleMatVerticalStepperApp);
879-
fixture.detectChanges();
880-
881-
expect(fixture.componentInstance.legacyTokenStepper).toBeTruthy();
882-
});
883-
884877
it('should set the aria-orientation to "vertical"', () => {
885878
const fixture = createComponent(SimpleMatVerticalStepperApp);
886879
fixture.detectChanges();
@@ -982,13 +975,6 @@ describe('MatStepper', () => {
982975
});
983976

984977
describe('horizontal stepper', () => {
985-
it('should be able to use the legacy classes in queries', () => {
986-
const fixture = createComponent(SimpleMatHorizontalStepperApp);
987-
fixture.detectChanges();
988-
989-
expect(fixture.componentInstance.legacyTokenStepper).toBeTruthy();
990-
});
991-
992978
it('should set the aria-orientation to "horizontal"', () => {
993979
const fixture = createComponent(SimpleMatHorizontalStepperApp);
994980
fixture.detectChanges();
@@ -1693,7 +1679,6 @@ class MatHorizontalStepperWithErrorsApp implements OnInit {
16931679
`
16941680
})
16951681
class SimpleMatHorizontalStepperApp {
1696-
@ViewChild(MatHorizontalStepper) legacyTokenStepper: MatHorizontalStepper;
16971682
inputLabel = 'Step 3';
16981683
disableRipple = false;
16991684
stepperTheme: ThemePalette;
@@ -1730,7 +1715,6 @@ class SimpleMatHorizontalStepperApp {
17301715
`
17311716
})
17321717
class SimpleMatVerticalStepperApp {
1733-
@ViewChild(MatVerticalStepper) legacyTokenStepper: MatVerticalStepper;
17341718
inputLabel = 'Step 3';
17351719
showStepTwo = true;
17361720
disableRipple = false;

src/material/stepper/stepper.ts

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
Component,
2323
ContentChild,
2424
ContentChildren,
25-
Directive,
2625
ElementRef,
2726
EventEmitter,
2827
forwardRef,
@@ -39,7 +38,6 @@ import {
3938
ViewEncapsulation,
4039
} from '@angular/core';
4140
import {FormControl, FormGroupDirective, NgForm} from '@angular/forms';
42-
import {DOCUMENT} from '@angular/common';
4341
import {ErrorStateMatcher, ThemePalette} from '@angular/material/core';
4442
import {TemplatePortal} from '@angular/cdk/portal';
4543
import {Subject, Subscription} from 'rxjs';
@@ -114,36 +112,6 @@ export class MatStep extends CdkStep implements ErrorStateMatcher, AfterContentI
114112
}
115113
}
116114

117-
/**
118-
* Proxies the public APIs from `MatStepper` to the deprecated `MatHorizontalStepper` and
119-
* `MatVerticalStepper`.
120-
* @deprecated Use `MatStepper` instead.
121-
* @breaking-change 13.0.0
122-
* @docs-private
123-
*/
124-
@Directive()
125-
abstract class _MatProxyStepperBase extends CdkStepper {
126-
override readonly steps: QueryList<MatStep>;
127-
readonly animationDone: EventEmitter<void>;
128-
disableRipple: boolean;
129-
color: ThemePalette;
130-
labelPosition: 'bottom' | 'end';
131-
}
132-
133-
/**
134-
* @deprecated Use `MatStepper` instead.
135-
* @breaking-change 13.0.0
136-
*/
137-
@Directive({selector: 'mat-horizontal-stepper'})
138-
export class MatHorizontalStepper extends _MatProxyStepperBase {}
139-
140-
/**
141-
* @deprecated Use `MatStepper` instead.
142-
* @breaking-change 13.0.0
143-
*/
144-
@Directive({selector: 'mat-vertical-stepper'})
145-
export class MatVerticalStepper extends _MatProxyStepperBase {}
146-
147115

148116
@Component({
149117
selector: 'mat-stepper, mat-vertical-stepper, mat-horizontal-stepper, [matStepper]',
@@ -165,11 +133,7 @@ export class MatVerticalStepper extends _MatProxyStepperBase {}
165133
matStepperAnimations.horizontalStepTransition,
166134
matStepperAnimations.verticalStepTransition,
167135
],
168-
providers: [
169-
{provide: CdkStepper, useExisting: MatStepper},
170-
{provide: MatHorizontalStepper, useExisting: MatStepper},
171-
{provide: MatVerticalStepper, useExisting: MatStepper},
172-
],
136+
providers: [{provide: CdkStepper, useExisting: MatStepper}],
173137
encapsulation: ViewEncapsulation.None,
174138
changeDetection: ChangeDetectionStrategy.OnPush,
175139
})
@@ -211,9 +175,8 @@ export class MatStepper extends CdkStepper implements AfterContentInit {
211175
constructor(
212176
@Optional() dir: Directionality,
213177
changeDetectorRef: ChangeDetectorRef,
214-
elementRef: ElementRef<HTMLElement>,
215-
@Inject(DOCUMENT) _document: any) {
216-
super(dir, changeDetectorRef, elementRef, _document);
178+
elementRef: ElementRef<HTMLElement>) {
179+
super(dir, changeDetectorRef, elementRef);
217180
const nodeName = elementRef.nativeElement.nodeName.toLowerCase();
218181
this.orientation = nodeName === 'mat-vertical-stepper' ? 'vertical' : 'horizontal';
219182
}

tools/public_api_guard/cdk/stepper.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ export class CdkStepLabel {
9696

9797
// @public (undocumented)
9898
export class CdkStepper implements AfterContentInit, AfterViewInit, OnDestroy {
99-
constructor(_dir: Directionality, _changeDetectorRef: ChangeDetectorRef, _elementRef: ElementRef<HTMLElement>,
100-
_document: any);
99+
constructor(_dir: Directionality, _changeDetectorRef: ChangeDetectorRef, _elementRef: ElementRef<HTMLElement>);
101100
protected readonly _destroyed: Subject<void>;
102101
_getAnimationDirection(index: number): StepContentPositionState;
103102
_getFocusIndex(): number | null;
@@ -130,8 +129,6 @@ export class CdkStepper implements AfterContentInit, AfterViewInit, OnDestroy {
130129
_onKeydown(event: KeyboardEvent): void;
131130
get orientation(): StepperOrientation;
132131
set orientation(value: StepperOrientation);
133-
// @deprecated (undocumented)
134-
protected _orientation: StepperOrientation;
135132
previous(): void;
136133
reset(): void;
137134
get selected(): CdkStep | undefined;
@@ -146,7 +143,7 @@ export class CdkStepper implements AfterContentInit, AfterViewInit, OnDestroy {
146143
// (undocumented)
147144
static ɵdir: i0.ɵɵDirectiveDeclaration<CdkStepper, "[cdkStepper]", ["cdkStepper"], { "linear": "linear"; "selectedIndex": "selectedIndex"; "selected": "selected"; "orientation": "orientation"; }, { "selectionChange": "selectionChange"; }, ["_steps", "_stepHeader"]>;
148145
// (undocumented)
149-
static ɵfac: i0.ɵɵFactoryDeclaration<CdkStepper, [{ optional: true; }, null, null, null]>;
146+
static ɵfac: i0.ɵɵFactoryDeclaration<CdkStepper, [{ optional: true; }, null, null]>;
150147
}
151148

152149
// @public (undocumented)

tools/public_api_guard/material/stepper.md

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,6 @@ export const MAT_STEPPER_INTL_PROVIDER: {
5555
// @public
5656
export function MAT_STEPPER_INTL_PROVIDER_FACTORY(parentIntl: MatStepperIntl): MatStepperIntl;
5757

58-
// @public @deprecated (undocumented)
59-
export class MatHorizontalStepper extends _MatProxyStepperBase {
60-
// (undocumented)
61-
static ɵdir: i0.ɵɵDirectiveDeclaration<MatHorizontalStepper, "mat-horizontal-stepper", never, {}, {}, never>;
62-
// (undocumented)
63-
static ɵfac: i0.ɵɵFactoryDeclaration<MatHorizontalStepper, never>;
64-
}
65-
6658
// @public (undocumented)
6759
export class MatStep extends CdkStep implements ErrorStateMatcher, AfterContentInit, OnDestroy {
6860
constructor(stepper: MatStepper, _errorStateMatcher: ErrorStateMatcher, _viewContainerRef: ViewContainerRef, stepperOptions?: StepperOptions);
@@ -135,7 +127,7 @@ export class MatStepLabel extends CdkStepLabel {
135127

136128
// @public (undocumented)
137129
export class MatStepper extends CdkStepper implements AfterContentInit {
138-
constructor(dir: Directionality, changeDetectorRef: ChangeDetectorRef, elementRef: ElementRef<HTMLElement>, _document: any);
130+
constructor(dir: Directionality, changeDetectorRef: ChangeDetectorRef, elementRef: ElementRef<HTMLElement>);
139131
readonly animationDone: EventEmitter<void>;
140132
readonly _animationDone: Subject<AnimationEvent_2>;
141133
color: ThemePalette;
@@ -153,7 +145,7 @@ export class MatStepper extends CdkStepper implements AfterContentInit {
153145
// (undocumented)
154146
static ɵcmp: i0.ɵɵComponentDeclaration<MatStepper, "mat-stepper, mat-vertical-stepper, mat-horizontal-stepper, [matStepper]", ["matStepper", "matVerticalStepper", "matHorizontalStepper"], { "selectedIndex": "selectedIndex"; "disableRipple": "disableRipple"; "color": "color"; "labelPosition": "labelPosition"; }, { "animationDone": "animationDone"; }, ["_steps", "_icons"], never>;
155147
// (undocumented)
156-
static ɵfac: i0.ɵɵFactoryDeclaration<MatStepper, [{ optional: true; }, null, null, null]>;
148+
static ɵfac: i0.ɵɵFactoryDeclaration<MatStepper, [{ optional: true; }, null, null]>;
157149
}
158150

159151
// @public
@@ -198,7 +190,7 @@ export class MatStepperModule {
198190
// (undocumented)
199191
static ɵinj: i0.ɵɵInjectorDeclaration<MatStepperModule>;
200192
// (undocumented)
201-
static ɵmod: i0.ɵɵNgModuleDeclaration<MatStepperModule, [typeof i1.MatHorizontalStepper, typeof i1.MatVerticalStepper, 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.MatButtonModule, typeof i11.CdkStepperModule, typeof i12.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]>;
193+
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.MatButtonModule, typeof i11.CdkStepperModule, typeof i12.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]>;
202194
}
203195

204196
// @public
@@ -217,14 +209,6 @@ export class MatStepperPrevious extends CdkStepperPrevious {
217209
static ɵfac: i0.ɵɵFactoryDeclaration<MatStepperPrevious, never>;
218210
}
219211

220-
// @public @deprecated (undocumented)
221-
export class MatVerticalStepper extends _MatProxyStepperBase {
222-
// (undocumented)
223-
static ɵdir: i0.ɵɵDirectiveDeclaration<MatVerticalStepper, "mat-vertical-stepper", never, {}, {}, never>;
224-
// (undocumented)
225-
static ɵfac: i0.ɵɵFactoryDeclaration<MatVerticalStepper, never>;
226-
}
227-
228212
export { StepperOrientation }
229213

230214
export { StepState }

0 commit comments

Comments
 (0)