@@ -299,8 +299,109 @@ shinyjs = function() {
299299 inputValue = null ,
300300 inputId = null ;
301301
302+ // --- {shinyWidgets} inputs ---
303+
304+ // calendarProInput
305+ if ( input . children ( ".calendar-pro-element" ) . length > 0 ) {
306+ input = input . children ( "input" ) ;
307+ inputType = "CalendarPro" ;
308+ inputId = inputContainer . attr ( 'id' ) ;
309+ }
310+ // colorPickr
311+ else if ( input . children ( ".pickr-color-container" ) . length > 0 ) {
312+ input = input . children ( ".pickr-color-container" ) ;
313+ inputType = "ColorPickr" ;
314+ inputValue = JSON . parse ( input . children ( "script" ) [ 0 ] . textContent ) . options . default ;
315+ }
316+ // knobInput
317+ else if ( input . children ( ".knob-input" ) . length > 0 ) {
318+ input = input . children ( ".knob-input" ) ;
319+ inputType = "Knob" ;
320+ inputValue = input . data ( 'value' ) ;
321+ }
322+ // noUiSliderInput
323+ else if ( input . find ( ".sw-no-ui-slider" ) . length > 0 ) {
324+ input = input . find ( ".sw-no-ui-slider" ) ;
325+ inputType = "NoUiSlider" ;
326+ inputValue = JSON . parse ( inputContainer . find ( "script" ) [ 0 ] . textContent ) . start ;
327+ }
328+ // numericInputIcon
329+ else if ( input . find ( '.numeric-input-icon' ) . length > 0 ) {
330+ input = input . find ( '.numeric-input-icon' ) ;
331+ inputType = "Numeric" ;
332+ }
333+ // numericRangeInput
334+ else if ( input . hasClass ( "shiny-numeric-range-input" ) ) {
335+ inputType = "NumericRange" ;
336+ inputValue = Array . from ( input . find ( "input[type=number" ) ) . map (
337+ input => parseFloat ( input . value ) ) ;
338+ }
339+ // radioGroupButtons
340+ else if ( input . hasClass ( "shiny-input-radiogroup" ) &&
341+ input . find ( '.btn-group-container-sw' ) . length > 0 &&
342+ input . find ( '.radio-group-buttons' ) . length > 0 ) {
343+ input = input . find ( '.radio-group-buttons' ) ;
344+ inputType = "RadioGroupButtons" ;
345+ inputValue = input . find ( "input[type='radio']:checked" ) . val ( ) ;
346+ }
347+ // searchInput
348+ else if ( input . find ( ".search-text" ) . length > 0 ) {
349+ input = input . find ( ".search-text input[type='text']" ) ;
350+ inputType = "Text" ;
351+ }
352+ // sliderTextInput
353+ else if ( input . children ( ".js-range-slider.sw-slider-text" ) . length > 0 ) {
354+ input = input . children ( ".js-range-slider.sw-slider-text" ) ;
355+ inputType = "SliderText" ;
356+ let allVals = input . data ( 'swvalues' ) ;
357+ inputValue = allVals [ input . data ( 'from' ) ] ;
358+ if ( typeof input . data ( 'to' ) !== "undefined" ) {
359+ inputValue = inputValue + "," + allVals [ input . data ( 'to' ) ] ;
360+ }
361+ }
362+ // slimSelectInput
363+ else if ( input . children ( ".slim-select" ) . length > 0 ) {
364+ input = input . children ( ".slim-select" ) ;
365+ inputType = "SlimSelect" ;
366+ let values = JSON . parse ( input . children ( "script" ) [ 0 ] . textContent ) . selected ;
367+ if ( values . length <= 1 ) {
368+ inputValue = values ;
369+ } else {
370+ inputValue = values . join ( "," ) ;
371+ }
372+ }
373+ // spectrumInput
374+ else if ( input . children ( ".sw-spectrum" ) . length > 0 ) {
375+ input = input . children ( ".sw-spectrum" ) ;
376+ inputType = "Spectrum"
377+ inputValue = input . data ( 'color' ) ;
378+ }
379+ // textInputIcon
380+ else if ( input . find ( ".text-input-icon" ) . length > 0 ) {
381+ input = input . find ( "input[type='text'].text-input-icon" ) ;
382+ inputType = "Text" ;
383+ }
384+ // timeInput
385+ else if ( input . children ( ".sw-time-input" ) . length > 0 ) {
386+ input = input . children ( ".sw-time-input" ) ;
387+ inputType = "Time" ;
388+ }
389+ // virtualSelectInput
390+ else if ( input . children ( ".virtual-select" ) . length > 0 ) {
391+ input = input . children ( ".virtual-select" ) ;
392+ inputType = "VirtualSelect" ;
393+ let initParams = JSON . parse ( inputContainer . find ( "script" ) [ 0 ] . textContent ) ;
394+ if ( typeof initParams . config . selectedValue === "undefined" ) {
395+ inputValue = initParams . options . choices [ 0 ] ;
396+ } else {
397+ inputValue = initParams . config . selectedValue ;
398+ }
399+ }
400+
401+ // --- Native shiny inputs ---
402+
302403 // dateInput
303- if ( input . hasClass ( "shiny-date-input" ) ) {
404+ else if ( input . hasClass ( "shiny-date-input" ) ) {
304405 input = input . children ( "input" ) ;
305406 inputType = "Date" ;
306407 inputValue = _getInputDate ( input ) ;
@@ -390,6 +491,7 @@ shinyjs = function() {
390491 input = input . find ( "input[type='file']" ) ;
391492 inputType = "File"
392493 }
494+
393495 // if none of the above, no supported Shiny input was found
394496 else {
395497 foundInput = false ;
0 commit comments