@@ -6,17 +6,15 @@ import {
6
6
EventEmitter ,
7
7
Input ,
8
8
NgZone ,
9
- OnInit ,
10
9
Output ,
11
10
Renderer2 ,
12
11
ViewContainerRef ,
13
12
} from '@angular/core' ;
14
- import { takeUntil } from 'rxjs' ;
15
13
16
14
import { BaseTooltip , TooltipTrigger , TooltipType } from '../tooltip' ;
15
+ import { AnimationType } from '../tooltip/animations' ;
17
16
18
17
import { DropdownActiveDirective } from './dropdown-active.directive' ;
19
- import { MenuComponent } from './menu/menu.component' ;
20
18
21
19
@Directive ( {
22
20
selector : '[auiDropdown]' ,
@@ -26,6 +24,8 @@ import { MenuComponent } from './menu/menu.component';
26
24
'disabled:auiDropdownDisabled' ,
27
25
'position:auiDropdownPosition' ,
28
26
'trigger:auiDropdownTrigger' ,
27
+ 'context:auiDropdownContext' ,
28
+ 'content:auiDropdown' ,
29
29
] ,
30
30
providers : [
31
31
{
@@ -35,30 +35,14 @@ import { MenuComponent } from './menu/menu.component';
35
35
] ,
36
36
standalone : true ,
37
37
} )
38
- export class DropdownDirective extends BaseTooltip implements OnInit {
39
- @Input ( 'auiDropdown' )
40
- get menu ( ) {
41
- return this . _menu ;
42
- }
43
-
44
- set menu ( value ) {
45
- if ( value === this . _menu ) {
46
- return ;
47
- }
48
- this . _menu = value ;
49
- this . content = value . template ;
50
- }
51
-
52
- @Input ( 'auiDropdownContext' )
53
- lazyContentContext : any ;
54
-
38
+ export class DropdownDirective extends BaseTooltip {
55
39
@Input ( 'auiDropdownHideOnClick' )
56
40
override hideOnClick = true ;
57
41
58
42
@Output ( 'auiDropdownVisibleChange' )
59
43
override visibleChange = new EventEmitter < boolean > ( ) ;
60
44
61
- private _menu : MenuComponent ;
45
+ override animationType : AnimationType = 'scaleY' ;
62
46
63
47
constructor (
64
48
overlay : Overlay ,
@@ -73,22 +57,5 @@ export class DropdownDirective extends BaseTooltip implements OnInit {
73
57
this . type = TooltipType . Plain ;
74
58
this . position = 'bottom end' ;
75
59
this . trigger = TooltipTrigger . Click ;
76
- this . disableAnimation = false ;
77
- this . animationType = 'scaleY' ;
78
- }
79
-
80
- ngOnInit ( ) {
81
- this . visibleChange . pipe ( takeUntil ( this . destroy$ ) ) . subscribe ( visible => {
82
- if ( this . menu . lazyContent ) {
83
- if ( visible ) {
84
- setTimeout ( ( ) => {
85
- this . menu . lazyContent . attach ( this . lazyContentContext ) ;
86
- this . updatePosition ( ) ;
87
- } ) ;
88
- } else {
89
- this . menu . lazyContent . detach ( ) ;
90
- }
91
- }
92
- } ) ;
93
60
}
94
61
}
0 commit comments