mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
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:
committed by
Joey Perrott
parent
9a771648f6
commit
f4a59f0349
@@ -9,7 +9,6 @@ ng_module(
|
||||
deps = [
|
||||
"@angular//packages/common",
|
||||
"@angular//packages/core",
|
||||
"@angular//packages/forms",
|
||||
"@rxjs",
|
||||
"@rxjs//operators",
|
||||
"//src/cdk/a11y",
|
||||
|
||||
@@ -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
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user