diff --git a/src/cdk/stepper/stepper.ts b/src/cdk/stepper/stepper.ts index 1a7d7851965e..54ef4bb0b5f3 100644 --- a/src/cdk/stepper/stepper.ts +++ b/src/cdk/stepper/stepper.ts @@ -35,6 +35,7 @@ import { booleanAttribute, numberAttribute, } from '@angular/core'; +import {type AbstractControl} from '@angular/forms'; import {_getFocusedElementPierceShadowDom} from '@angular/cdk/platform'; import {Observable, of as observableOf, Subject} from 'rxjs'; import {startWith, takeUntil} from 'rxjs/operators'; @@ -118,7 +119,7 @@ export class CdkStep implements OnChanges { @ViewChild(TemplateRef, {static: true}) content: TemplateRef; /** The top level abstract control of the step. */ - @Input() stepControl: AbstractControlLike; + @Input() stepControl: AbstractControl; /** Whether user has attempted to move away from the step. */ interacted = false; @@ -558,54 +559,3 @@ export class CdkStepper implements AfterContentInit, AfterViewInit, OnDestroy { return index > -1 && (!this.steps || index < this.steps.length); } } - -/** - * Simplified representation of an "AbstractControl" from @angular/forms. - * Used to avoid having to bring in @angular/forms for a single optional interface. - * @docs-private - */ -interface AbstractControlLike { - asyncValidator: ((control: any) => any) | null; - dirty: boolean; - disabled: boolean; - enabled: boolean; - errors: {[key: string]: any} | null; - invalid: boolean; - parent: any; - pending: boolean; - pristine: boolean; - root: AbstractControlLike; - status: string; - readonly statusChanges: Observable; - touched: boolean; - untouched: boolean; - updateOn: any; - valid: boolean; - validator: ((control: any) => any) | null; - value: any; - readonly valueChanges: Observable; - clearAsyncValidators(): void; - clearValidators(): void; - disable(opts?: any): void; - enable(opts?: any): void; - get(path: (string | number)[] | string): AbstractControlLike | null; - getError(errorCode: string, path?: (string | number)[] | string): any; - hasError(errorCode: string, path?: (string | number)[] | string): boolean; - markAllAsTouched(): void; - markAsDirty(opts?: any): void; - markAsPending(opts?: any): void; - markAsPristine(opts?: any): void; - markAsTouched(opts?: any): void; - markAsUntouched(opts?: any): void; - patchValue(value: any, options?: Object): void; - reset(value?: any, options?: Object): void; - setAsyncValidators(newValidator: (control: any) => any | ((control: any) => any)[] | null): void; - setErrors(errors: {[key: string]: any} | null, opts?: any): void; - setParent(parent: any): void; - setValidators(newValidator: (control: any) => any | ((control: any) => any)[] | null): void; - setValue(value: any, options?: Object): void; - updateValueAndValidity(opts?: any): void; - patchValue(value: any, options?: any): void; - reset(formState?: any, options?: any): void; - setValue(value: any, options?: any): void; -} diff --git a/tools/public_api_guard/cdk/stepper.md b/tools/public_api_guard/cdk/stepper.md index 170e87b77fa1..c93b611dc1c9 100644 --- a/tools/public_api_guard/cdk/stepper.md +++ b/tools/public_api_guard/cdk/stepper.md @@ -4,6 +4,7 @@ ```ts +import { AbstractControl } from '@angular/forms'; import { AfterContentInit } from '@angular/core'; import { AfterViewInit } from '@angular/core'; import { ChangeDetectorRef } from '@angular/core'; @@ -14,7 +15,6 @@ import { FocusableOption } from '@angular/cdk/a11y'; import * as i0 from '@angular/core'; import * as i1 from '@angular/cdk/bidi'; import { InjectionToken } from '@angular/core'; -import { Observable } from 'rxjs'; import { OnChanges } from '@angular/core'; import { OnDestroy } from '@angular/core'; import { QueryList } from '@angular/core'; @@ -57,7 +57,7 @@ export class CdkStep implements OnChanges { select(): void; _showError(): boolean; state: StepState; - stepControl: AbstractControlLike; + stepControl: AbstractControl; stepLabel: CdkStepLabel; // (undocumented) _stepper: CdkStepper;