diff --git a/src/cdk/schematics/ng-update/data/constructor-checks.ts b/src/cdk/schematics/ng-update/data/constructor-checks.ts index 2b63816788bc..b0fe6eee6eb8 100644 --- a/src/cdk/schematics/ng-update/data/constructor-checks.ts +++ b/src/cdk/schematics/ng-update/data/constructor-checks.ts @@ -17,6 +17,12 @@ export type ConstructorChecksUpgradeData = string; * automatically through type checking. */ export const constructorChecks: VersionChanges = { + [TargetVersion.V13]: [ + { + pr: 'https://github.com/angular/components/pull/23328', + changes: ['CdkStepper'] + } + ], [TargetVersion.V12]: [ { pr: 'https://github.com/angular/components/pull/21876', diff --git a/src/cdk/stepper/stepper.ts b/src/cdk/stepper/stepper.ts index b2a0193e257a..eb7c444f1f10 100644 --- a/src/cdk/stepper/stepper.ts +++ b/src/cdk/stepper/stepper.ts @@ -15,7 +15,6 @@ import { NumberInput, } from '@angular/cdk/coercion'; import {ENTER, hasModifierKey, SPACE} from '@angular/cdk/keycodes'; -import {DOCUMENT} from '@angular/common'; import { AfterViewInit, ChangeDetectionStrategy, @@ -338,22 +337,12 @@ export class CdkStepper implements AfterContentInit, AfterViewInit, OnDestroy { this._keyManager.withVerticalOrientation(value === 'vertical'); } } - - /** - * @deprecated To be turned into a private property. Use `orientation` instead. - * @breaking-change 13.0.0 - */ - protected _orientation: StepperOrientation = 'horizontal'; + private _orientation: StepperOrientation = 'horizontal'; constructor( @Optional() private _dir: Directionality, private _changeDetectorRef: ChangeDetectorRef, private _elementRef: ElementRef, - /** - * @deprecated No longer in use, to be removed. - * @breaking-change 13.0.0 - */ - @Inject(DOCUMENT) _document: any, ) { this._groupId = nextId++; } diff --git a/src/material/schematics/ng-update/data/constructor-checks.ts b/src/material/schematics/ng-update/data/constructor-checks.ts index 4ef8770a232f..dd0133621358 100644 --- a/src/material/schematics/ng-update/data/constructor-checks.ts +++ b/src/material/schematics/ng-update/data/constructor-checks.ts @@ -23,6 +23,10 @@ export const constructorChecks: VersionChanges = { pr: 'https://github.com/angular/components/pull/23573', changes: ['MatDatepicker', 'MatDateRangePicker'], }, + { + pr: 'https://github.com/angular/components/pull/23328', + changes: ['MatStepper'], + }, ], [TargetVersion.V12]: [ { diff --git a/src/material/stepper/stepper-module.ts b/src/material/stepper/stepper-module.ts index 7618e4776fda..f56f0546d7b2 100644 --- a/src/material/stepper/stepper-module.ts +++ b/src/material/stepper/stepper-module.ts @@ -15,7 +15,7 @@ import {ErrorStateMatcher, MatCommonModule, MatRippleModule} from '@angular/mate import {MatIconModule} from '@angular/material/icon'; import {MatStepHeader} from './step-header'; import {MatStepLabel} from './step-label'; -import {MatHorizontalStepper, MatStep, MatStepper, MatVerticalStepper} from './stepper'; +import {MatStep, MatStepper} from './stepper'; import {MatStepperNext, MatStepperPrevious} from './stepper-button'; import {MatStepperIcon} from './stepper-icon'; import {MAT_STEPPER_INTL_PROVIDER} from './stepper-intl'; @@ -43,8 +43,6 @@ import {MatStepContent} from './step-content'; MatStepContent, ], declarations: [ - MatHorizontalStepper, - MatVerticalStepper, MatStep, MatStepLabel, MatStepper, diff --git a/src/material/stepper/stepper.spec.ts b/src/material/stepper/stepper.spec.ts index d01c71c9ab20..b627a1e79f5a 100644 --- a/src/material/stepper/stepper.spec.ts +++ b/src/material/stepper/stepper.spec.ts @@ -46,7 +46,7 @@ import {_supportsShadowDom} from '@angular/cdk/platform'; import {merge, Observable, Subject} from 'rxjs'; import {map, take} from 'rxjs/operators'; import {MatStepHeader, MatStepperModule} from './index'; -import {MatHorizontalStepper, MatStep, MatStepper, MatVerticalStepper} from './stepper'; +import {MatStep, MatStepper} from './stepper'; import {MatStepperNext, MatStepperPrevious} from './stepper-button'; import {MatStepperIntl} from './stepper-intl'; import {MatFormFieldModule} from '@angular/material/form-field'; @@ -979,13 +979,6 @@ describe('MatStepper', () => { }); describe('vertical stepper', () => { - it('should be able to use the legacy classes in queries', () => { - const fixture = createComponent(SimpleMatVerticalStepperApp); - fixture.detectChanges(); - - expect(fixture.componentInstance.legacyTokenStepper).toBeTruthy(); - }); - it('should set the aria-orientation to "vertical"', () => { const fixture = createComponent(SimpleMatVerticalStepperApp); fixture.detectChanges(); @@ -1090,13 +1083,6 @@ describe('MatStepper', () => { }); describe('horizontal stepper', () => { - it('should be able to use the legacy classes in queries', () => { - const fixture = createComponent(SimpleMatHorizontalStepperApp); - fixture.detectChanges(); - - expect(fixture.componentInstance.legacyTokenStepper).toBeTruthy(); - }); - it('should set the aria-orientation to "horizontal"', () => { const fixture = createComponent(SimpleMatHorizontalStepperApp); fixture.detectChanges(); @@ -1857,7 +1843,6 @@ class MatHorizontalStepperWithErrorsApp implements OnInit { `, }) class SimpleMatHorizontalStepperApp { - @ViewChild(MatHorizontalStepper) legacyTokenStepper: MatHorizontalStepper; inputLabel = 'Step 3'; disableRipple = false; stepperTheme: ThemePalette; @@ -1894,7 +1879,6 @@ class SimpleMatHorizontalStepperApp { `, }) class SimpleMatVerticalStepperApp { - @ViewChild(MatVerticalStepper) legacyTokenStepper: MatVerticalStepper; inputLabel = 'Step 3'; showStepTwo = true; disableRipple = false; diff --git a/src/material/stepper/stepper.ts b/src/material/stepper/stepper.ts index d6e05c314825..55e8b6d155cb 100644 --- a/src/material/stepper/stepper.ts +++ b/src/material/stepper/stepper.ts @@ -22,7 +22,6 @@ import { Component, ContentChild, ContentChildren, - Directive, ElementRef, EventEmitter, forwardRef, @@ -39,7 +38,6 @@ import { ViewEncapsulation, } from '@angular/core'; import {FormControl, FormGroupDirective, NgForm} from '@angular/forms'; -import {DOCUMENT} from '@angular/common'; import {ErrorStateMatcher, ThemePalette} from '@angular/material/core'; import {TemplatePortal} from '@angular/cdk/portal'; import {Subject, Subscription} from 'rxjs'; @@ -120,36 +118,6 @@ export class MatStep extends CdkStep implements ErrorStateMatcher, AfterContentI } } -/** - * Proxies the public APIs from `MatStepper` to the deprecated `MatHorizontalStepper` and - * `MatVerticalStepper`. - * @deprecated Use `MatStepper` instead. - * @breaking-change 13.0.0 - * @docs-private - */ -@Directive() -abstract class _MatProxyStepperBase extends CdkStepper { - override readonly steps: QueryList; - readonly animationDone: EventEmitter; - disableRipple: boolean; - color: ThemePalette; - labelPosition: 'bottom' | 'end'; -} - -/** - * @deprecated Use `MatStepper` instead. - * @breaking-change 13.0.0 - */ -@Directive({selector: 'mat-horizontal-stepper'}) -export class MatHorizontalStepper extends _MatProxyStepperBase {} - -/** - * @deprecated Use `MatStepper` instead. - * @breaking-change 13.0.0 - */ -@Directive({selector: 'mat-vertical-stepper'}) -export class MatVerticalStepper extends _MatProxyStepperBase {} - @Component({ selector: 'mat-stepper, mat-vertical-stepper, mat-horizontal-stepper, [matStepper]', exportAs: 'matStepper, matVerticalStepper, matHorizontalStepper', @@ -170,11 +138,7 @@ export class MatVerticalStepper extends _MatProxyStepperBase {} matStepperAnimations.horizontalStepTransition, matStepperAnimations.verticalStepTransition, ], - providers: [ - {provide: CdkStepper, useExisting: MatStepper}, - {provide: MatHorizontalStepper, useExisting: MatStepper}, - {provide: MatVerticalStepper, useExisting: MatStepper}, - ], + providers: [{provide: CdkStepper, useExisting: MatStepper}], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, }) @@ -217,9 +181,8 @@ export class MatStepper extends CdkStepper implements AfterContentInit { @Optional() dir: Directionality, changeDetectorRef: ChangeDetectorRef, elementRef: ElementRef, - @Inject(DOCUMENT) _document: any, ) { - super(dir, changeDetectorRef, elementRef, _document); + super(dir, changeDetectorRef, elementRef); const nodeName = elementRef.nativeElement.nodeName.toLowerCase(); this.orientation = nodeName === 'mat-vertical-stepper' ? 'vertical' : 'horizontal'; } diff --git a/tools/public_api_guard/cdk/stepper.md b/tools/public_api_guard/cdk/stepper.md index 43248b6c63d9..f2e64fc9c161 100644 --- a/tools/public_api_guard/cdk/stepper.md +++ b/tools/public_api_guard/cdk/stepper.md @@ -88,8 +88,7 @@ export class CdkStepLabel { // @public (undocumented) export class CdkStepper implements AfterContentInit, AfterViewInit, OnDestroy { - constructor(_dir: Directionality, _changeDetectorRef: ChangeDetectorRef, _elementRef: ElementRef, - _document: any); + constructor(_dir: Directionality, _changeDetectorRef: ChangeDetectorRef, _elementRef: ElementRef); protected readonly _destroyed: Subject; _getAnimationDirection(index: number): StepContentPositionState; _getFocusIndex(): number | null; @@ -110,8 +109,6 @@ export class CdkStepper implements AfterContentInit, AfterViewInit, OnDestroy { _onKeydown(event: KeyboardEvent): void; get orientation(): StepperOrientation; set orientation(value: StepperOrientation); - // @deprecated (undocumented) - protected _orientation: StepperOrientation; previous(): void; reset(): void; get selected(): CdkStep | undefined; @@ -126,7 +123,7 @@ export class CdkStepper implements AfterContentInit, AfterViewInit, OnDestroy { // (undocumented) static ɵdir: i0.ɵɵDirectiveDeclaration; // (undocumented) - static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵfac: i0.ɵɵFactoryDeclaration; } // @public (undocumented) diff --git a/tools/public_api_guard/material/stepper.md b/tools/public_api_guard/material/stepper.md index 2b3e2ead66fb..9bd7ba21bae9 100644 --- a/tools/public_api_guard/material/stepper.md +++ b/tools/public_api_guard/material/stepper.md @@ -55,14 +55,6 @@ export const MAT_STEPPER_INTL_PROVIDER: { // @public export function MAT_STEPPER_INTL_PROVIDER_FACTORY(parentIntl: MatStepperIntl): MatStepperIntl; -// @public @deprecated (undocumented) -export class MatHorizontalStepper extends _MatProxyStepperBase { - // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration; - // (undocumented) - static ɵfac: i0.ɵɵFactoryDeclaration; -} - // @public (undocumented) export class MatStep extends CdkStep implements ErrorStateMatcher, AfterContentInit, OnDestroy { constructor(stepper: MatStepper, _errorStateMatcher: ErrorStateMatcher, _viewContainerRef: ViewContainerRef, stepperOptions?: StepperOptions); @@ -135,7 +127,7 @@ export class MatStepLabel extends CdkStepLabel { // @public (undocumented) export class MatStepper extends CdkStepper implements AfterContentInit { - constructor(dir: Directionality, changeDetectorRef: ChangeDetectorRef, elementRef: ElementRef, _document: any); + constructor(dir: Directionality, changeDetectorRef: ChangeDetectorRef, elementRef: ElementRef); readonly animationDone: EventEmitter; readonly _animationDone: Subject; color: ThemePalette; @@ -153,7 +145,7 @@ export class MatStepper extends CdkStepper implements AfterContentInit { // (undocumented) static ɵcmp: i0.ɵɵComponentDeclaration; // (undocumented) - static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵfac: i0.ɵɵFactoryDeclaration; } // @public @@ -200,7 +192,7 @@ export class MatStepperModule { // (undocumented) static ɵinj: i0.ɵɵInjectorDeclaration; // (undocumented) - static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; } // @public @@ -219,14 +211,6 @@ export class MatStepperPrevious extends CdkStepperPrevious { static ɵfac: i0.ɵɵFactoryDeclaration; } -// @public @deprecated (undocumented) -export class MatVerticalStepper extends _MatProxyStepperBase { - // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration; - // (undocumented) - static ɵfac: i0.ɵɵFactoryDeclaration; -} - export { StepperOrientation } export { StepState }