@@ -9,7 +9,7 @@ export function init(id, invoke) {
99 const el = document . getElementById ( id )
1010 const menu = el . querySelector ( '.dropdown-menu' )
1111 const input = document . getElementById ( `${ id } _input` )
12- var ac = { el, invoke, menu, input }
12+ const ac = { el, invoke, menu, input }
1313 Data . set ( id , ac )
1414
1515 if ( el . querySelector ( '[data-bs-toggle="bb.dropdown"]' ) ) {
@@ -31,6 +31,12 @@ export function init(id, invoke) {
3131 invoke . invokeMethodAsync ( 'OnKeyUp' , e . code )
3232 } )
3333 }
34+
35+ Input . composition ( input , async v => {
36+ el . classList . add ( 'is-loading' ) ;
37+ await invoke . invokeMethodAsync ( 'TriggerOnChange' , v ) ;
38+ el . classList . remove ( 'is-loading' ) ;
39+ } )
3440}
3541
3642export function autoScroll ( id , index ) {
@@ -47,7 +53,7 @@ export function autoScroll(id, index) {
4753 active . classList . remove ( 'active' )
4854 }
4955
50- var len = menu . children . length
56+ const len = menu . children . length
5157 if ( index < len ) {
5258 menu . children [ index ] . classList . add ( 'active' )
5359 }
@@ -60,14 +66,6 @@ export function autoScroll(id, index) {
6066 }
6167}
6268
63- export function composition ( id ) {
64- const ac = Data . get ( id )
65- if ( ac ) {
66- ac . composition = true
67- Input . composition ( `${ id } _input` , ac . invoke , 'TriggerOnChange' )
68- }
69- }
70-
7169export function triggerFocus ( id ) {
7270 const ac = Data . get ( id )
7371 ac . popover ?. show ( ) ;
@@ -84,10 +82,8 @@ export function dispose(id) {
8482 EventHandler . off ( ac . input , 'focus' )
8583 }
8684 }
87- if ( ac . composition ) {
88- Input . dispose ( `${ id } _input` )
89- }
9085 if ( ac . input ) {
86+ Input . dispose ( ac . input )
9187 EventHandler . off ( ac . input , 'keyup' )
9288 }
9389 }
0 commit comments