@@ -17,24 +17,18 @@ export function init(id) {
1717 toggle ( el , list )
1818 } )
1919
20- if ( ! window . bb_dial_button ) {
21- window . bb_dial_button = true
22-
23- EventHandler . on ( document , 'click' , e => closePopup ( e ) ) ;
24- }
25-
2620 const module = registerBootstrapBlazorModule ( 'DialButton' , {
2721 hooked : false ,
22+ items : [ ] ,
2823 registerClosePopupHandler : function ( ) {
2924 if ( this . hooked === false ) {
3025 this . hooked = true ;
31-
32- EventHandler . on ( document , 'click' , e => closePopup ( e ) ) ;
26+ EventHandler . on ( document , 'click' , closePopup ) ;
3327 }
3428 }
3529 } ) ;
3630 module . registerClosePopupHandler ( ) ;
37-
31+ module . items . push ( id ) ;
3832}
3933
4034export function update ( id ) {
@@ -56,9 +50,17 @@ export function dispose(id) {
5650 Data . remove ( id )
5751
5852 if ( dial ) {
59- EventHandler . off ( dial . button , 'click' )
60- EventHandler . off ( dial . list , 'animationend' )
53+ const { button, list } = dial ;
54+ EventHandler . off ( button , 'click' )
55+ EventHandler . off ( list , 'animationend' )
56+ }
57+
58+ const { DialButton } = window . BootstrapBlazor ;
59+ DialButton . items . pop ( id )
60+ if ( DialButton . items . length === 0 ) {
61+ EventHandler . off ( document , 'click' , closePopup )
6162 }
63+
6264}
6365
6466const toggle = ( el , list ) => {
0 commit comments