11import EventHandler from '../../modules/event-handler.js'
22
3- export function init ( id ) {
3+ export function init ( id , invoke , method ) {
44 const el = document . getElementById ( id ) ;
55 const skipKeys = [ 'Enter' , 'Tab' , 'Shift' , 'Control' , 'Alt' ] ;
66 EventHandler . on ( el , 'input' , '.bb-opt-item' , e => {
@@ -10,7 +10,7 @@ export function init(id) {
1010 e . target . value = e . target . value . slice ( 1 , 2 ) ;
1111 }
1212 }
13- setValue ( el ) ;
13+ setValue ( el , invoke , method ) ;
1414 } ) ;
1515 EventHandler . on ( el , 'keydown' , '.bb-opt-item' , e => {
1616 if ( e . ctrlKey ) {
@@ -63,13 +63,14 @@ export function init(id) {
6363 }
6464 }
6565 e . target . blur ( ) ;
66- setValue ( el ) ;
66+ setValue ( el , invoke , method ) ;
6767 } ) ;
6868}
6969
70- const setValue = el => {
71- const input = el . querySelector ( '.bb-opt-input-val' ) ;
72- input . value = [ ...el . querySelectorAll ( '.bb-opt-item' ) ] . map ( input => input . value ) . join ( '' ) ;
70+ const setValue = ( el , invoke , method ) => {
71+ const val = [ ...el . querySelectorAll ( '.bb-opt-item' ) ] . map ( input => input . value ) . join ( '' ) ;
72+ console . log ( val ) ;
73+ invoke . invokeMethodAsync ( method , val ) ;
7374}
7475
7576const setPrevFocus = ( el , target ) => {
0 commit comments