refactor(stepper): remove dependency on @angular/forms (#15134)

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.
This commit is contained in:
Kristiyan Kostadinov
2019-03-05 20:44:36 +01:00
committed by Joey Perrott
parent 9a771648f6
commit f4a59f0349
3 changed files with 12 additions and 4 deletions
-1
View File
@@ -9,7 +9,6 @@ ng_module(
deps = [
"@angular//packages/common",
"@angular//packages/core",
"@angular//packages/forms",
"@rxjs",
"@rxjs//operators",
"//src/cdk/a11y",
+6 -2
View File
@@ -34,7 +34,6 @@ import {
InjectionToken,
} from '@angular/core';
import {DOCUMENT} from '@angular/common';
import {AbstractControl} from '@angular/forms';
import {CdkStepLabel} from './step-label';
import {Observable, Subject, of as obaservableOf} from 'rxjs';
import {startWith, takeUntil} from 'rxjs/operators';
@@ -125,7 +124,12 @@ export class CdkStep implements OnChanges {
@ViewChild(TemplateRef) content: TemplateRef<any>;
/** The top level abstract control of the step. */
@Input() stepControl: AbstractControl;
@Input() stepControl: {
valid: boolean;
invalid: boolean;
pending: boolean;
reset: () => void;
};
/** Whether user has seen the expanded step content or not. */
interacted = false;
+6 -1
View File
@@ -12,7 +12,12 @@ export declare class CdkStep implements OnChanges {
label: string;
optional: boolean;
state: StepState;
stepControl: AbstractControl;
stepControl: {
valid: boolean;
invalid: boolean;
pending: boolean;
reset: () => void;
};
stepLabel: CdkStepLabel;
constructor(_stepper: CdkStepper, stepperOptions?: StepperOptions);
ngOnChanges(): void;