Skip to content

Commit 5014a46

Browse files
committed
refactor(stepper): remove dependency on @angular/forms
While looking at #15085, I noticed that the only place in the CDK where we use `@angular/forms` is to type an optional input in the stepper. These changes replace the typing with a partial representation of the `AbstractControl` so that we can drop the dependency.
1 parent 57aadc2 commit 5014a46

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/cdk/stepper/stepper.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import {
3434
InjectionToken,
3535
} from '@angular/core';
3636
import {DOCUMENT} from '@angular/common';
37-
import {AbstractControl} from '@angular/forms';
3837
import {CdkStepLabel} from './step-label';
3938
import {Observable, Subject, of as obaservableOf} from 'rxjs';
4039
import {startWith, takeUntil} from 'rxjs/operators';
@@ -125,7 +124,12 @@ export class CdkStep implements OnChanges {
125124
@ViewChild(TemplateRef) content: TemplateRef<any>;
126125

127126
/** The top level abstract control of the step. */
128-
@Input() stepControl: AbstractControl;
127+
@Input() stepControl: {
128+
valid: boolean;
129+
invalid: boolean;
130+
pending: boolean;
131+
reset: () => void;
132+
};
129133

130134
/** Whether user has seen the expanded step content or not. */
131135
interacted = false;

tools/public_api_guard/cdk/stepper.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ export declare class CdkStep implements OnChanges {
1212
label: string;
1313
optional: boolean;
1414
state: StepState;
15-
stepControl: AbstractControl;
15+
stepControl: {
16+
valid: boolean;
17+
invalid: boolean;
18+
pending: boolean;
19+
reset: () => void;
20+
};
1621
stepLabel: CdkStepLabel;
1722
constructor(_stepper: CdkStepper, stepperOptions?: StepperOptions);
1823
ngOnChanges(): void;

0 commit comments

Comments
 (0)