From d1da719d37f4c7199d2d4500a5d1de90dea3a1b5 Mon Sep 17 00:00:00 2001 From: Bernhard Meindl Date: Wed, 10 Dec 2025 14:41:24 +0100 Subject: [PATCH 1/2] remove shinyBS dependency in `sdcApp` --- DESCRIPTION | 1 - NEWS | 1 + inst/shiny/sdcApp/global.R | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 3371a940..beb8314b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -50,7 +50,6 @@ Imports: haven, rhandsontable, DT, - shinyBS, prettydoc, VIM (>= 4.7.0), httr, diff --git a/NEWS b/NEWS index 9c49b43e..30e08f85 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,6 @@ # 5.7.10 - fix inconsistency in `rankSwap()` Output [Issue #361] +- remove shinyBS dependency in `sdcApp` # 5.7.9 - Improvements for `recordSwap()`: diff --git a/inst/shiny/sdcApp/global.R b/inst/shiny/sdcApp/global.R index 777949d7..0302d972 100755 --- a/inst/shiny/sdcApp/global.R +++ b/inst/shiny/sdcApp/global.R @@ -233,6 +233,40 @@ summaryfn <- function(x) { vv } +# to get rid of the shinyBS dependency +tipify <- function(el, title, placement = "bottom", trigger = "hover", options = NULL) { + # generate a unique ID for the wrapper element and wrap element in span-tag + wrapper_id <- paste0("tip-", round(runif(1, 1e9, 9e9)), "-", as.integer(Sys.time())) + wrapped_el <- tags$span(id = wrapper_id, el) + + # define the JS options, forcing html: true allows to render inline-html code + js_options <- list( + html = TRUE + ) + if (!is.null(options)) { + js_options <- c(js_options, options) + } + + # add req. attributes + wrapped_el <- htmltools::tagAppendAttributes( + wrapped_el, + "data-toggle" = "tooltip", + "data-placement" = placement, + "data-trigger" = trigger + ) + + # the attribute should be treated as html-content + wrapped_el$attribs$title <- htmltools::HTML(title) + + # the js-script to initialize the tooltip using the generated id + init_script <- tags$script(HTML(paste0( + "$(document).ready(function() { $('#", wrapper_id, "').tooltip(", + jsonlite::toJSON(js_options, auto_unbox = TRUE), + ");});" + ))) + return(tagList(wrapped_el, init_script)) +} + # global, reactive data-structure data(testdata, envir = .GlobalEnv) data(testdata2, envir = .GlobalEnv) From 10c8ace886bef0b034e0002485e8b3ec95f18fef Mon Sep 17 00:00:00 2001 From: Bernhard Meindl Date: Wed, 10 Dec 2025 19:18:00 +0100 Subject: [PATCH 2/2] fully remove shinyBS --- NAMESPACE | 1 - R/0classes.r | 1 - inst/shiny/sdcApp/global.R | 1 - 3 files changed, 3 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 6fbed8fa..bec5e53f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -94,7 +94,6 @@ import(methods) import(rhandsontable) import(robustbase) import(shiny) -import(shinyBS) import(tools) import(xtable) importFrom(DT,datatable) diff --git a/R/0classes.r b/R/0classes.r index 427a1306..8f21c5d4 100644 --- a/R/0classes.r +++ b/R/0classes.r @@ -11,7 +11,6 @@ #' @import xtable #' @import data.table #' @import ggplot2 -#' @import shinyBS #' @import shiny #' @import rhandsontable #' @importFrom DT datatable diff --git a/inst/shiny/sdcApp/global.R b/inst/shiny/sdcApp/global.R index 0302d972..8ed0efb1 100755 --- a/inst/shiny/sdcApp/global.R +++ b/inst/shiny/sdcApp/global.R @@ -3,7 +3,6 @@ library(grid) library(sdcMicro) library(rhandsontable) library(haven) -library(shinyBS) library(data.table) if (!getShinyOption("sdcAppInvoked", FALSE)) {### Beginning required code for deployment