From 743ef241540912da6b3cfc30cc38e7d625adfb13 Mon Sep 17 00:00:00 2001 From: perrierv Date: Fri, 25 Oct 2024 13:49:39 +0200 Subject: [PATCH] added virtual select --- inst/assets/js/shinyfeedback.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/inst/assets/js/shinyfeedback.js b/inst/assets/js/shinyfeedback.js index bb443d6..a436404 100644 --- a/inst/assets/js/shinyfeedback.js +++ b/inst/assets/js/shinyfeedback.js @@ -284,6 +284,37 @@ }); + // virtualSelectInput functions + var virtualSelectInputFeedback = $.extend({}, baseInputFeedback, { + "find": function(inputId) { + var input = findInput(inputId); + var label = input.siblings("label"); + var formGroup = input.parent(); + + return { + "input": input, + "label": label, + "formGroup": formGroup + }; + }, + + /* Icon has custom right margin */ + "setIcon": function(inputObject, message) { + if (message.icon) { + + //obj.input.parent().css("padding-right", 0); + + $("" + message.icon + + "").insertBefore(inputObject.input); + } else { + $("#" + message.inputId + "-icon").remove(); + } + } + }); + + // fileInputFeedback functions var fileInputFeedback = $.extend({}, baseInputFeedback, { "find": function(inputId) { @@ -353,6 +384,7 @@ {name: "shiny.textInput", feedback: textInputFeedback}, {name: "shiny.pickerInput", feedback: pickerInputFeedback}, {name: "shinyWidgets.pickerInput", feedback: pickerInputFeedback}, + {name: "shinyWidgets.virtualSelectBinding", feedback: virtualSelectInputFeedback}, {name: "shinyWidgets.autonumericInput", feedback: numericInputFeedback}, {name: "shiny.fileInputBinding", feedback: fileInputFeedback} ];