1
1
import {
2
+ booleanAttribute ,
2
3
ChangeDetectorRef ,
3
4
Component ,
4
5
ElementRef ,
5
6
EventEmitter ,
6
7
HostBinding ,
7
8
HostListener ,
8
9
Input ,
10
+ numberAttribute ,
9
11
OnDestroy ,
10
12
OnInit ,
11
13
Output ,
12
14
Renderer2
13
15
} from '@angular/core' ;
14
16
15
17
import { animate , state , style , transition , trigger } from '@angular/animations' ;
16
- import { BooleanInput , coerceBooleanProperty } from '@angular/cdk/coercion' ;
17
18
18
19
import { Colors } from '../../coreui.types' ;
19
20
import { ToasterService } from '../toaster/toaster.service' ;
@@ -23,7 +24,7 @@ type AnimateType = ('hide' | 'show');
23
24
24
25
@Component ( {
25
26
selector : 'c-toast' ,
26
- template : '<ng-content></ng-content >' ,
27
+ template : '<ng-content / >' ,
27
28
styleUrls : [ './toast.component.scss' ] ,
28
29
exportAs : 'cToast' ,
29
30
standalone : true ,
@@ -51,8 +52,6 @@ type AnimateType = ('hide' | 'show');
51
52
} )
52
53
export class ToastComponent implements OnInit , OnDestroy {
53
54
54
- static ngAcceptInputType_visible : BooleanInput ;
55
-
56
55
public dynamic ! : boolean ;
57
56
public placement ! : TToasterPlacement ;
58
57
@@ -79,7 +78,7 @@ export class ToastComponent implements OnInit, OnDestroy {
79
78
* Delay hiding the toast (ms).
80
79
* @type number
81
80
*/
82
- @Input ( ) delay : number = 5000 ;
81
+ @Input ( { transform : numberAttribute } ) delay : number = 5000 ;
83
82
84
83
/**
85
84
* Apply fade transition to the toast.
@@ -91,9 +90,9 @@ export class ToastComponent implements OnInit, OnDestroy {
91
90
* Toggle the visibility of component.
92
91
* @type boolean
93
92
*/
94
- @Input ( )
93
+ @Input ( { transform : booleanAttribute } )
95
94
set visible ( value : boolean ) {
96
- const newValue = coerceBooleanProperty ( value ) ;
95
+ const newValue = value ;
97
96
if ( this . _visible !== newValue ) {
98
97
this . _visible = newValue ;
99
98
newValue ? this . setTimer ( ) : this . clearTimer ( ) ;
@@ -111,7 +110,7 @@ export class ToastComponent implements OnInit, OnDestroy {
111
110
/**
112
111
* @ignore
113
112
*/
114
- @Input ( ) index ?: number ;
113
+ @Input ( { transform : numberAttribute } ) index ?: number ;
115
114
116
115
/**
117
116
* Event emitted on visibility change. [docs]
0 commit comments