Skip to content

Commit dac9ae2

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 505c0d1 commit dac9ae2

File tree

8 files changed

+22
-97
lines changed

8 files changed

+22
-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,
@@ -337,21 +336,11 @@ export class CdkStepper implements AfterContentInit, AfterViewInit, OnDestroy {
337336
this._keyManager.withVerticalOrientation(value === 'vertical');
338337
}
339338
}
340-
341-
/**
342-
* @deprecated To be turned into a private property. Use `orientation` instead.
343-
* @breaking-change 13.0.0
344-
*/
345-
protected _orientation: StepperOrientation = 'horizontal';
339+
private _orientation: StepperOrientation = 'horizontal';
346340

347341
constructor(
348342
@Optional() private _dir: Directionality, private _changeDetectorRef: ChangeDetectorRef,
349-
private _elementRef: ElementRef<HTMLElement>,
350-
/**
351-
* @deprecated No longer in use, to be removed.
352-
* @breaking-change 13.0.0
353-
*/
354-
@Inject(DOCUMENT) _document: any) {
343+
private _elementRef: ElementRef<HTMLElement>) {
355344
this._groupId = nextId++;
356345
}
357346

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ export const constructorChecks: VersionChanges<ConstructorChecksUpgradeData> = {
2222
{
2323
pr: 'https://github.com/angular/components/pull/23573',
2424
changes: ['MatDatepicker', 'MatDateRangePicker']
25+
},
26+
{
27+
pr: 'https://github.com/angular/components/pull/23328',
28+
changes: ['MatStepper']
2529
}
2630
],
2731
[TargetVersion.V12]: [

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';
@@ -879,13 +879,6 @@ describe('MatStepper', () => {
879879
});
880880

881881
describe('vertical stepper', () => {
882-
it('should be able to use the legacy classes in queries', () => {
883-
const fixture = createComponent(SimpleMatVerticalStepperApp);
884-
fixture.detectChanges();
885-
886-
expect(fixture.componentInstance.legacyTokenStepper).toBeTruthy();
887-
});
888-
889882
it('should set the aria-orientation to "vertical"', () => {
890883
const fixture = createComponent(SimpleMatVerticalStepperApp);
891884
fixture.detectChanges();
@@ -987,13 +980,6 @@ describe('MatStepper', () => {
987980
});
988981

989982
describe('horizontal stepper', () => {
990-
it('should be able to use the legacy classes in queries', () => {
991-
const fixture = createComponent(SimpleMatHorizontalStepperApp);
992-
fixture.detectChanges();
993-
994-
expect(fixture.componentInstance.legacyTokenStepper).toBeTruthy();
995-
});
996-
997983
it('should set the aria-orientation to "horizontal"', () => {
998984
const fixture = createComponent(SimpleMatHorizontalStepperApp);
999985
fixture.detectChanges();
@@ -1720,7 +1706,6 @@ class MatHorizontalStepperWithErrorsApp implements OnInit {
17201706
`
17211707
})
17221708
class SimpleMatHorizontalStepperApp {
1723-
@ViewChild(MatHorizontalStepper) legacyTokenStepper: MatHorizontalStepper;
17241709
inputLabel = 'Step 3';
17251710
disableRipple = false;
17261711
stepperTheme: ThemePalette;
@@ -1757,7 +1742,6 @@ class SimpleMatHorizontalStepperApp {
17571742
`
17581743
})
17591744
class SimpleMatVerticalStepperApp {
1760-
@ViewChild(MatVerticalStepper) legacyTokenStepper: MatVerticalStepper;
17611745
inputLabel = 'Step 3';
17621746
showStepTwo = true;
17631747
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)