Skip to content

Commit db126b5

Browse files
authored
refactor(material/stepper): remove deprecated APIs for version 13 (#23328)
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 bab3b98 commit db126b5

File tree

8 files changed

+20
-95
lines changed

8 files changed

+20
-95
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: 1 addition & 12 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,
@@ -338,22 +337,12 @@ export class CdkStepper implements AfterContentInit, AfterViewInit, OnDestroy {
338337
this._keyManager.withVerticalOrientation(value === 'vertical');
339338
}
340339
}
341-
342-
/**
343-
* @deprecated To be turned into a private property. Use `orientation` instead.
344-
* @breaking-change 13.0.0
345-
*/
346-
protected _orientation: StepperOrientation = 'horizontal';
340+
private _orientation: StepperOrientation = 'horizontal';
347341

348342
constructor(
349343
@Optional() private _dir: Directionality,
350344
private _changeDetectorRef: ChangeDetectorRef,
351345
private _elementRef: ElementRef<HTMLElement>,
352-
/**
353-
* @deprecated No longer in use, to be removed.
354-
* @breaking-change 13.0.0
355-
*/
356-
@Inject(DOCUMENT) _document: any,
357346
) {
358347
this._groupId = nextId++;
359348
}

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

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

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';
@@ -43,8 +43,6 @@ import {MatStepContent} from './step-content';
4343
MatStepContent,
4444
],
4545
declarations: [
46-
MatHorizontalStepper,
47-
MatVerticalStepper,
4846
MatStep,
4947
MatStepLabel,
5048
MatStepper,

src/material/stepper/stepper.spec.ts

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

981981
describe('vertical stepper', () => {
982-
it('should be able to use the legacy classes in queries', () => {
983-
const fixture = createComponent(SimpleMatVerticalStepperApp);
984-
fixture.detectChanges();
985-
986-
expect(fixture.componentInstance.legacyTokenStepper).toBeTruthy();
987-
});
988-
989982
it('should set the aria-orientation to "vertical"', () => {
990983
const fixture = createComponent(SimpleMatVerticalStepperApp);
991984
fixture.detectChanges();
@@ -1090,13 +1083,6 @@ describe('MatStepper', () => {
10901083
});
10911084

10921085
describe('horizontal stepper', () => {
1093-
it('should be able to use the legacy classes in queries', () => {
1094-
const fixture = createComponent(SimpleMatHorizontalStepperApp);
1095-
fixture.detectChanges();
1096-
1097-
expect(fixture.componentInstance.legacyTokenStepper).toBeTruthy();
1098-
});
1099-
11001086
it('should set the aria-orientation to "horizontal"', () => {
11011087
const fixture = createComponent(SimpleMatHorizontalStepperApp);
11021088
fixture.detectChanges();
@@ -1857,7 +1843,6 @@ class MatHorizontalStepperWithErrorsApp implements OnInit {
18571843
`,
18581844
})
18591845
class SimpleMatHorizontalStepperApp {
1860-
@ViewChild(MatHorizontalStepper) legacyTokenStepper: MatHorizontalStepper;
18611846
inputLabel = 'Step 3';
18621847
disableRipple = false;
18631848
stepperTheme: ThemePalette;
@@ -1894,7 +1879,6 @@ class SimpleMatHorizontalStepperApp {
18941879
`,
18951880
})
18961881
class SimpleMatVerticalStepperApp {
1897-
@ViewChild(MatVerticalStepper) legacyTokenStepper: MatVerticalStepper;
18981882
inputLabel = 'Step 3';
18991883
showStepTwo = true;
19001884
disableRipple = false;

src/material/stepper/stepper.ts

Lines changed: 2 additions & 39 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';
@@ -120,36 +118,6 @@ export class MatStep extends CdkStep implements ErrorStateMatcher, AfterContentI
120118
}
121119
}
122120

123-
/**
124-
* Proxies the public APIs from `MatStepper` to the deprecated `MatHorizontalStepper` and
125-
* `MatVerticalStepper`.
126-
* @deprecated Use `MatStepper` instead.
127-
* @breaking-change 13.0.0
128-
* @docs-private
129-
*/
130-
@Directive()
131-
abstract class _MatProxyStepperBase extends CdkStepper {
132-
override readonly steps: QueryList<MatStep>;
133-
readonly animationDone: EventEmitter<void>;
134-
disableRipple: boolean;
135-
color: ThemePalette;
136-
labelPosition: 'bottom' | 'end';
137-
}
138-
139-
/**
140-
* @deprecated Use `MatStepper` instead.
141-
* @breaking-change 13.0.0
142-
*/
143-
@Directive({selector: 'mat-horizontal-stepper'})
144-
export class MatHorizontalStepper extends _MatProxyStepperBase {}
145-
146-
/**
147-
* @deprecated Use `MatStepper` instead.
148-
* @breaking-change 13.0.0
149-
*/
150-
@Directive({selector: 'mat-vertical-stepper'})
151-
export class MatVerticalStepper extends _MatProxyStepperBase {}
152-
153121
@Component({
154122
selector: 'mat-stepper, mat-vertical-stepper, mat-horizontal-stepper, [matStepper]',
155123
exportAs: 'matStepper, matVerticalStepper, matHorizontalStepper',
@@ -170,11 +138,7 @@ export class MatVerticalStepper extends _MatProxyStepperBase {}
170138
matStepperAnimations.horizontalStepTransition,
171139
matStepperAnimations.verticalStepTransition,
172140
],
173-
providers: [
174-
{provide: CdkStepper, useExisting: MatStepper},
175-
{provide: MatHorizontalStepper, useExisting: MatStepper},
176-
{provide: MatVerticalStepper, useExisting: MatStepper},
177-
],
141+
providers: [{provide: CdkStepper, useExisting: MatStepper}],
178142
encapsulation: ViewEncapsulation.None,
179143
changeDetection: ChangeDetectionStrategy.OnPush,
180144
})
@@ -217,9 +181,8 @@ export class MatStepper extends CdkStepper implements AfterContentInit {
217181
@Optional() dir: Directionality,
218182
changeDetectorRef: ChangeDetectorRef,
219183
elementRef: ElementRef<HTMLElement>,
220-
@Inject(DOCUMENT) _document: any,
221184
) {
222-
super(dir, changeDetectorRef, elementRef, _document);
185+
super(dir, changeDetectorRef, elementRef);
223186
const nodeName = elementRef.nativeElement.nodeName.toLowerCase();
224187
this.orientation = nodeName === 'mat-vertical-stepper' ? 'vertical' : 'horizontal';
225188
}

tools/public_api_guard/cdk/stepper.md

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

8989
// @public (undocumented)
9090
export class CdkStepper implements AfterContentInit, AfterViewInit, OnDestroy {
91-
constructor(_dir: Directionality, _changeDetectorRef: ChangeDetectorRef, _elementRef: ElementRef<HTMLElement>,
92-
_document: any);
91+
constructor(_dir: Directionality, _changeDetectorRef: ChangeDetectorRef, _elementRef: ElementRef<HTMLElement>);
9392
protected readonly _destroyed: Subject<void>;
9493
_getAnimationDirection(index: number): StepContentPositionState;
9594
_getFocusIndex(): number | null;
@@ -110,8 +109,6 @@ export class CdkStepper implements AfterContentInit, AfterViewInit, OnDestroy {
110109
_onKeydown(event: KeyboardEvent): void;
111110
get orientation(): StepperOrientation;
112111
set orientation(value: StepperOrientation);
113-
// @deprecated (undocumented)
114-
protected _orientation: StepperOrientation;
115112
previous(): void;
116113
reset(): void;
117114
get selected(): CdkStep | undefined;
@@ -126,7 +123,7 @@ export class CdkStepper implements AfterContentInit, AfterViewInit, OnDestroy {
126123
// (undocumented)
127124
static ɵdir: i0.ɵɵDirectiveDeclaration<CdkStepper, "[cdkStepper]", ["cdkStepper"], { "linear": "linear"; "selectedIndex": "selectedIndex"; "selected": "selected"; "orientation": "orientation"; }, { "selectionChange": "selectionChange"; }, ["_steps", "_stepHeader"]>;
128125
// (undocumented)
129-
static ɵfac: i0.ɵɵFactoryDeclaration<CdkStepper, [{ optional: true; }, null, null, null]>;
126+
static ɵfac: i0.ɵɵFactoryDeclaration<CdkStepper, [{ optional: true; }, null, null]>;
130127
}
131128

132129
// @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
@@ -200,7 +192,7 @@ export class MatStepperModule {
200192
// (undocumented)
201193
static ɵinj: i0.ɵɵInjectorDeclaration<MatStepperModule>;
202194
// (undocumented)
203-
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]>;
195+
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]>;
204196
}
205197

206198
// @public
@@ -219,14 +211,6 @@ export class MatStepperPrevious extends CdkStepperPrevious {
219211
static ɵfac: i0.ɵɵFactoryDeclaration<MatStepperPrevious, never>;
220212
}
221213

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

232216
export { StepState }

0 commit comments

Comments
 (0)