9
9
import { FocusableOption , FocusKeyManager } from '@angular/cdk/a11y' ;
10
10
import { Direction , Directionality } from '@angular/cdk/bidi' ;
11
11
import { coerceBooleanProperty , coerceNumberProperty } from '@angular/cdk/coercion' ;
12
- import { END , ENTER , HOME , SPACE , hasModifierKey } from '@angular/cdk/keycodes' ;
12
+ import { END , ENTER , hasModifierKey , HOME , SPACE } from '@angular/cdk/keycodes' ;
13
+ import { DOCUMENT } from '@angular/common' ;
13
14
import {
14
15
AfterViewInit ,
15
16
ChangeDetectionStrategy ,
@@ -18,10 +19,11 @@ import {
18
19
ContentChild ,
19
20
ContentChildren ,
20
21
Directive ,
21
- EventEmitter ,
22
22
ElementRef ,
23
+ EventEmitter ,
23
24
forwardRef ,
24
25
Inject ,
26
+ InjectionToken ,
25
27
Input ,
26
28
OnChanges ,
27
29
OnDestroy ,
@@ -31,13 +33,11 @@ import {
31
33
TemplateRef ,
32
34
ViewChild ,
33
35
ViewEncapsulation ,
34
- InjectionToken ,
35
36
} from '@angular/core' ;
36
- import { DOCUMENT } from '@angular/common' ;
37
- import { CdkStepLabel } from './step-label' ;
38
- import { Observable , Subject , of as obaservableOf } from 'rxjs' ;
37
+ import { Observable , of as obaservableOf , Subject } from 'rxjs' ;
39
38
import { startWith , takeUntil } from 'rxjs/operators' ;
40
39
import { CdkStepHeader } from './step-header' ;
40
+ import { CdkStepLabel } from './step-label' ;
41
41
42
42
/** Used to generate unique ID for each stepper component. */
43
43
let nextId = 0 ;
@@ -124,7 +124,7 @@ export class CdkStep implements OnChanges {
124
124
@ViewChild ( TemplateRef , { static : true } ) content : TemplateRef < any > ;
125
125
126
126
/** The top level abstract control of the step. */
127
- @Input ( ) stepControl : FormControlLike ;
127
+ @Input ( ) stepControl : AbstractControlLike ;
128
128
129
129
/** Whether user has seen the expanded step content or not. */
130
130
interacted = false ;
@@ -512,14 +512,13 @@ export class CdkStepper implements AfterViewInit, OnDestroy {
512
512
}
513
513
}
514
514
515
-
516
515
/**
517
- * Simplified representation of a FormControl from @angular/forms.
516
+ * Simplified representation of an "AbstractControl" from @angular/forms.
518
517
* Used to avoid having to bring in @angular/forms for a single optional interface.
519
518
* @docs -private
520
519
*/
521
- interface FormControlLike {
522
- asyncValidator : ( ) => any | null ;
520
+ interface AbstractControlLike {
521
+ asyncValidator : ( ( c : AbstractControlLike ) => any ) | null ;
523
522
dirty : boolean ;
524
523
disabled : boolean ;
525
524
enabled : boolean ;
@@ -528,21 +527,21 @@ interface FormControlLike {
528
527
parent : any ;
529
528
pending : boolean ;
530
529
pristine : boolean ;
531
- root : FormControlLike ;
530
+ root : AbstractControlLike ;
532
531
status : string ;
533
532
statusChanges : Observable < any > ;
534
533
touched : boolean ;
535
534
untouched : boolean ;
536
535
updateOn : any ;
537
536
valid : boolean ;
538
- validator : ( ) => any | null ;
537
+ validator : ( ( c : AbstractControlLike ) => any ) | null ;
539
538
value : any ;
540
539
valueChanges : Observable < any > ;
541
540
clearAsyncValidators ( ) : void ;
542
541
clearValidators ( ) : void ;
543
542
disable ( opts ?: any ) : void ;
544
543
enable ( opts ?: any ) : void ;
545
- get ( path : ( string | number ) [ ] | string ) : FormControlLike | null ;
544
+ get ( path : ( string | number ) [ ] | string ) : AbstractControlLike | null ;
546
545
getError ( errorCode : string , path ?: ( string | number ) [ ] | string ) : any ;
547
546
hasError ( errorCode : string , path ?: ( string | number ) [ ] | string ) : boolean ;
548
547
markAllAsTouched ( ) : void ;
@@ -553,15 +552,15 @@ interface FormControlLike {
553
552
markAsUntouched ( opts ?: any ) : void ;
554
553
patchValue ( value : any , options ?: Object ) : void ;
555
554
reset ( value ?: any , options ?: Object ) : void ;
556
- setAsyncValidators ( newValidator : ( ) => any | ( ( ) => any ) [ ] | null ) : void ;
555
+ setAsyncValidators ( newValidator : ( c : AbstractControlLike ) => any |
556
+ ( ( c : AbstractControlLike ) => any ) [ ] | null ) : void ;
557
557
setErrors ( errors : { [ key : string ] : any } | null , opts ?: any ) : void ;
558
558
setParent ( parent : any ) : void ;
559
- setValidators ( newValidator : ( ) => any | ( ( ) => any ) [ ] | null ) : void ;
559
+ setValidators ( newValidator : ( c : AbstractControlLike ) => any |
560
+ ( ( c : AbstractControlLike ) => any ) [ ] | null ) : void ;
560
561
setValue ( value : any , options ?: Object ) : void ;
561
562
updateValueAndValidity ( opts ?: any ) : void ;
562
563
patchValue ( value : any , options ?: any ) : void ;
563
- registerOnChange ( fn : Function ) : void ;
564
- registerOnDisabledChange ( fn : ( isDisabled : boolean ) => void ) : void ;
565
564
reset ( formState ?: any , options ?: any ) : void ;
566
565
setValue ( value : any , options ?: any ) : void ;
567
566
}
0 commit comments