1
1
import {
2
2
AfterViewInit ,
3
+ booleanAttribute ,
3
4
Directive ,
4
5
DoCheck ,
5
6
ElementRef ,
@@ -14,8 +15,6 @@ import {
14
15
} from '@angular/core' ;
15
16
import { AnimationBuilder , AnimationPlayer , useAnimation } from '@angular/animations' ;
16
17
17
- import { BooleanInput , coerceBooleanProperty } from '@angular/cdk/coercion' ;
18
-
19
18
import {
20
19
collapseAnimation ,
21
20
collapseHorizontalAnimation ,
@@ -32,65 +31,40 @@ import {
32
31
} )
33
32
export class CollapseDirective implements OnChanges , OnDestroy , DoCheck , AfterViewInit {
34
33
35
- static ngAcceptInputType_horizontal : BooleanInput ;
36
- static ngAcceptInputType_navbar : BooleanInput ;
37
- static ngAcceptInputType_visible : BooleanInput ;
38
-
39
34
/**
40
35
* @ignore
41
36
*/
42
- @Input ( )
43
- set animate ( value : boolean ) {
44
- this . _animate = value ;
45
- }
46
-
47
- get animate ( ) : boolean {
48
- return this . _animate ;
49
- }
50
-
51
- private _animate = true ;
37
+ @Input ( { transform : booleanAttribute } ) animate : boolean = true ;
52
38
53
39
/**
54
40
* Set horizontal collapsing to transition the width instead of height.
41
+ * @type boolean
42
+ * @default false
55
43
*/
56
- @Input ( )
57
- set horizontal ( value : boolean ) {
58
- this . _horizontal = coerceBooleanProperty ( value ) ;
59
- }
60
-
61
- get horizontal ( ) : boolean {
62
- return this . _horizontal ;
63
- }
64
-
65
- private _horizontal : boolean = false ;
44
+ @Input ( { transform : booleanAttribute } ) horizontal : boolean = false ;
66
45
67
46
/**
68
47
* Toggle the visibility of collapsible element.
48
+ * @type boolean
49
+ * @default false
69
50
*/
70
- @Input ( )
51
+ @Input ( { transform : booleanAttribute } )
71
52
set visible ( value ) {
72
- this . _visible = coerceBooleanProperty ( value ) ;
53
+ this . _visible = value ;
73
54
}
74
55
75
56
get visible ( ) : boolean {
76
57
return this . _visible ;
77
58
}
78
59
79
- private _visible = false ;
60
+ private _visible : boolean = false ;
80
61
81
62
/**
82
63
* Add `navbar` prop for grouping and hiding navbar contents by a parent breakpoint.
64
+ * @type boolean
65
+ * @default false
83
66
*/
84
- @Input ( )
85
- set navbar ( value : boolean ) {
86
- this . _navbar = coerceBooleanProperty ( value ) ;
87
- } ;
88
-
89
- get navbar ( ) {
90
- return this . _navbar ;
91
- }
92
-
93
- private _navbar = false ;
67
+ @Input ( { transform : booleanAttribute } ) navbar : boolean = false ;
94
68
95
69
/**
96
70
* @ignore
0 commit comments