From 9bf3aac4aca28b4f7a686d06f6b6cd8973145955 Mon Sep 17 00:00:00 2001 From: Esra Ay Date: Fri, 29 Apr 2022 12:02:31 +0300 Subject: [PATCH 01/32] Fix DT tables selected row highlight with updating css --- inst/www/shiny-semantic-DT.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/inst/www/shiny-semantic-DT.css b/inst/www/shiny-semantic-DT.css index fdd9ddf1..7cb92d92 100644 --- a/inst/www/shiny-semantic-DT.css +++ b/inst/www/shiny-semantic-DT.css @@ -16,3 +16,6 @@ -webkit-transition: color .1s ease,border-color .1s ease; transition: color .1s ease,border-color .1s ease; } +table.dataTable tr.selected td, table.dataTable td.selected { + background-color: #95d8f5 !important; +} From f3f90279f2c0a715ba3366b7fc1aedc9df6f0522 Mon Sep 17 00:00:00 2001 From: Esra Ay Date: Wed, 11 May 2022 10:58:59 +0300 Subject: [PATCH 02/32] Fix json conversation of strings with single quote --- R/checkbox.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/checkbox.R b/R/checkbox.R index fce96aaf..0c0108e5 100644 --- a/R/checkbox.R +++ b/R/checkbox.R @@ -197,9 +197,9 @@ multiple_checkbox <- function(input_id, label, choices, choices_value = choices, update_multiple_checkbox <- function(session = getDefaultReactiveDomain(), input_id, choices = NULL, choices_value = choices, selected = NULL, label = NULL) { - if (!is.null(selected)) value <- jsonlite::toJSON(selected) else value <- NULL + if (!is.null(selected)) value <- jsonlite::toJSON(gsub( "'", '"', selected)) else value <- NULL if (!is.null(choices)) { - options <- jsonlite::toJSON(data.frame(name = choices, value = choices_value)) + options <- jsonlite::toJSON(data.frame(name = choices, value = gsub( "'", '"', choices_value))) } else { options <- NULL } From 15304c92769d6315d355382c2da55c1e2dc5e61a Mon Sep 17 00:00:00 2001 From: esraay <36202874+esraay@users.noreply.github.com> Date: Sun, 23 Oct 2022 10:28:53 +0300 Subject: [PATCH 03/32] Update R/checkbox.R Remove whitespace Co-authored-by: Jakub Sobolewski <37193264+jakubsob@users.noreply.github.com> --- R/checkbox.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/checkbox.R b/R/checkbox.R index 0c0108e5..0bbf4263 100644 --- a/R/checkbox.R +++ b/R/checkbox.R @@ -197,7 +197,7 @@ multiple_checkbox <- function(input_id, label, choices, choices_value = choices, update_multiple_checkbox <- function(session = getDefaultReactiveDomain(), input_id, choices = NULL, choices_value = choices, selected = NULL, label = NULL) { - if (!is.null(selected)) value <- jsonlite::toJSON(gsub( "'", '"', selected)) else value <- NULL + if (!is.null(selected)) value <- jsonlite::toJSON(gsub("'", '"', selected)) else value <- NULL if (!is.null(choices)) { options <- jsonlite::toJSON(data.frame(name = choices, value = gsub( "'", '"', choices_value))) } else { From b29b41d93a9856c1852030c441cd2e8cc8dc8494 Mon Sep 17 00:00:00 2001 From: esraay <36202874+esraay@users.noreply.github.com> Date: Sun, 23 Oct 2022 10:29:14 +0300 Subject: [PATCH 04/32] Update R/checkbox.R Co-authored-by: Jakub Sobolewski <37193264+jakubsob@users.noreply.github.com> --- R/checkbox.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/checkbox.R b/R/checkbox.R index 0bbf4263..b8990ea0 100644 --- a/R/checkbox.R +++ b/R/checkbox.R @@ -199,7 +199,7 @@ update_multiple_checkbox <- function(session = getDefaultReactiveDomain(), selected = NULL, label = NULL) { if (!is.null(selected)) value <- jsonlite::toJSON(gsub("'", '"', selected)) else value <- NULL if (!is.null(choices)) { - options <- jsonlite::toJSON(data.frame(name = choices, value = gsub( "'", '"', choices_value))) + options <- jsonlite::toJSON(data.frame(name = choices, value = gsub("'", '"', choices_value))) } else { options <- NULL } From 578408e55b704380e95a3841e920af8a995873c2 Mon Sep 17 00:00:00 2001 From: esraay <36202874+esraay@users.noreply.github.com> Date: Sun, 23 Oct 2022 11:27:37 +0300 Subject: [PATCH 05/32] Add test for multiple checkbox and selected values --- tests/testthat/test_multiple_checkbox.R | 60 +++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 tests/testthat/test_multiple_checkbox.R diff --git a/tests/testthat/test_multiple_checkbox.R b/tests/testthat/test_multiple_checkbox.R new file mode 100644 index 00000000..52de1c6a --- /dev/null +++ b/tests/testthat/test_multiple_checkbox.R @@ -0,0 +1,60 @@ +context("multiple checkbox") + +test_that("test multiple_checkbox input values", { + # type + expect_is(multiple_checkbox( + input_id = "checkboxes", + label = NULL, + choices = "" + ), + "shiny.tag") + # empty input + si_str <- + as.character(multiple_checkbox( + input_id = "checkboxes", + label = NULL, + choices = "" + )) + expect_true(any( + grepl( + "
", + si_str, + fixed = TRUE + ) + )) + # label + si_str <- + as.character(multiple_checkbox( + input_id = "checkboxes", + label = "My Label", + choices = "" + )) + expect_true(any( + grepl("", + si_str, fixed = TRUE) + )) + # selected choices + si_str <- + as.character( + multiple_checkbox( + input_id = "checkboxes", + label = "My Label", + choices = c("A's", "B"), + selected = c("A's", "B") + ) + ) + expect_true(any( + grepl( + "", + si_str, + fixed = TRUE + ) + )) + expect_true(any( + grepl( + "", + si_str, + fixed = TRUE + ) + )) +}) From 0a60378772dbc0fc077e95af3333cd1f4a48cc0a Mon Sep 17 00:00:00 2001 From: esraay <36202874+esraay@users.noreply.github.com> Date: Sun, 23 Oct 2022 15:28:17 +0300 Subject: [PATCH 06/32] Remove unnecessary important property from DT selected row's css --- inst/www/shiny-semantic-DT.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inst/www/shiny-semantic-DT.css b/inst/www/shiny-semantic-DT.css index 7cb92d92..5f0d7410 100644 --- a/inst/www/shiny-semantic-DT.css +++ b/inst/www/shiny-semantic-DT.css @@ -17,5 +17,5 @@ transition: color .1s ease,border-color .1s ease; } table.dataTable tr.selected td, table.dataTable td.selected { - background-color: #95d8f5 !important; + background-color: #95d8f5; } From fd29dbbf9fd70f2e02a0d42e2a7fb12ffe7056d2 Mon Sep 17 00:00:00 2001 From: esraay <36202874+esraay@users.noreply.github.com> Date: Sun, 23 Oct 2022 16:01:58 +0300 Subject: [PATCH 07/32] Add style parameter to semantic_DT --- R/tables.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R/tables.R b/R/tables.R index 963a7e7f..44a53ede 100644 --- a/R/tables.R +++ b/R/tables.R @@ -4,6 +4,7 @@ #' #' @param ... datatable parameters, check \code{?DT::datatable} to learn more. #' @param options datatable options, check \code{?DT::datatable} to learn more. +#' @param style datatable style, check \code{?DT::datatable} to learn more. #' #' @examples #' if (interactive()){ @@ -22,10 +23,10 @@ #' } #' #' @export -semantic_DT <- function(..., options = list()) { +semantic_DT <- function(..., options = list(), style="semanticui") { DT::datatable(..., options = options, class = 'ui small compact table', - style = "semanticui", + style = style, rownames = FALSE) } From 8a771dc12fc5748728f42ab5ddaaf6420fd0720c Mon Sep 17 00:00:00 2001 From: esraay <36202874+esraay@users.noreply.github.com> Date: Sun, 23 Oct 2022 17:03:25 +0300 Subject: [PATCH 08/32] Add class parameter to semantic_DT It gives the ability to use all fomanticUI table classes and use the default class without fomanticUI --- R/tables.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R/tables.R b/R/tables.R index 44a53ede..5b5a8084 100644 --- a/R/tables.R +++ b/R/tables.R @@ -5,6 +5,7 @@ #' @param ... datatable parameters, check \code{?DT::datatable} to learn more. #' @param options datatable options, check \code{?DT::datatable} to learn more. #' @param style datatable style, check \code{?DT::datatable} to learn more. +#' @param class datatable class, check \code{?DT::datatable} to learn more. #' #' @examples #' if (interactive()){ @@ -23,9 +24,9 @@ #' } #' #' @export -semantic_DT <- function(..., options = list(), style="semanticui") { +semantic_DT <- function(..., options = list(), style="semanticui", class = 'ui small compact table') { DT::datatable(..., options = options, - class = 'ui small compact table', + class = class, style = style, rownames = FALSE) } From 4e82adee2229ba89c8a5b8050c2fa0fb51b747fa Mon Sep 17 00:00:00 2001 From: esraay <36202874+esraay@users.noreply.github.com> Date: Mon, 31 Oct 2022 14:41:11 +0300 Subject: [PATCH 09/32] Add a new register input handler for the shiny.vector type --- R/shiny.R | 8 ++++++++ inst/www/shiny-semantic-slider.js | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/R/shiny.R b/R/shiny.R index 09b759ac..30811557 100644 --- a/R/shiny.R +++ b/R/shiny.R @@ -31,6 +31,14 @@ NULL # Add directory for static resources file <- system.file("www", package = "shiny.semantic", mustWork = TRUE) shiny::addResourcePath("shiny.semantic", file) + shiny::registerInputHandler("shiny.vector", function(value, ...) { + if (is.null(value)) { + return(value) + } else { + values <- shiny:::safeFromJSON(value) + return(values) + } + }, force = TRUE) } #' Create universal Shiny input binding diff --git a/inst/www/shiny-semantic-slider.js b/inst/www/shiny-semantic-slider.js index 4376e42b..2bd6d8ff 100644 --- a/inst/www/shiny-semantic-slider.js +++ b/inst/www/shiny-semantic-slider.js @@ -52,14 +52,14 @@ $.extend(semanticSliderBinding, { if ($(el).data('ticks')) { return $(el).data('ticks')[value]; } else { - return value; + return(JSON.stringify(value)) } }, getType: function(el) { if ($(el).data('ticks')) { return false; } else { - return 'shiny.number'; + return 'shiny.vector'; } }, // Given the DOM element for the input, set the value. From f7ac2768fe51107efaaef1d5a8b3a3fc874680d9 Mon Sep 17 00:00:00 2001 From: Jakub Nowicki Date: Wed, 31 Jan 2024 15:46:42 +0100 Subject: [PATCH 10/32] chore: Change handler name. --- R/shiny.R | 2 +- inst/www/shiny-semantic-slider.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/shiny.R b/R/shiny.R index 06ce3858..08f57811 100644 --- a/R/shiny.R +++ b/R/shiny.R @@ -31,7 +31,7 @@ NULL # Add directory for static resources file <- system.file("www", package = "shiny.semantic", mustWork = TRUE) shiny::addResourcePath("shiny.semantic", file) - shiny::registerInputHandler("shiny.vector", function(value, ...) { + shiny::registerInputHandler("shiny.semantic.vector", function(value, ...) { if (is.null(value)) { return(value) } else { diff --git a/inst/www/shiny-semantic-slider.js b/inst/www/shiny-semantic-slider.js index 2bd6d8ff..1a48b009 100644 --- a/inst/www/shiny-semantic-slider.js +++ b/inst/www/shiny-semantic-slider.js @@ -59,7 +59,7 @@ $.extend(semanticSliderBinding, { if ($(el).data('ticks')) { return false; } else { - return 'shiny.vector'; + return 'shiny.semantic.vector'; } }, // Given the DOM element for the input, set the value. From 318495fcde00489d6cfda7c008b91fa278ee7402 Mon Sep 17 00:00:00 2001 From: Jakub Nowicki Date: Wed, 31 Jan 2024 15:46:58 +0100 Subject: [PATCH 11/32] chore: Update DESCRIPTION and NEWS. --- DESCRIPTION | 2 +- NEWS.md | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index af583bb5..55680c89 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: shiny.semantic Title: Semantic UI Support for Shiny -Version: 0.5.0 +Version: 0.5.0.9000 Authors@R: c(person("Filip", "Stachura", email = "filip@appsilon.com", role = "aut"), person("Dominik", "Krzeminski", role = "aut"), person("Krystian", "Igras", role = "aut"), diff --git a/NEWS.md b/NEWS.md index b45cf476..ea82d199 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,8 @@ -# shiny.semantic 0.5.0 +# shiny.semantic (development) + +- Fixed `range_input` now returns both lower and upper bound. + +# [shiny.semantic 0.5.0](https://github.com/Appsilon/shiny.semantic/releases/tag/0.5.0) - `shiny.semantic` no longer uses CDN as the default source of assets. Instead, `semantic.assets` package was introduced. From 3e8abd4e0e21119ae14b5842c0868276e5107607 Mon Sep 17 00:00:00 2001 From: Jakub Nowicki Date: Wed, 31 Jan 2024 16:12:48 +0100 Subject: [PATCH 12/32] chore: Use jsonlite instead of shiny not imported function. --- R/shiny.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/shiny.R b/R/shiny.R index 08f57811..9484ba68 100644 --- a/R/shiny.R +++ b/R/shiny.R @@ -35,7 +35,7 @@ NULL if (is.null(value)) { return(value) } else { - values <- shiny:::safeFromJSON(value) + values <- jsonlite::fromJSON(value) return(values) } }, force = TRUE) From 9055a9660f02be2c390c718e75fe82e16eb621a8 Mon Sep 17 00:00:00 2001 From: Jakub Nowicki Date: Wed, 31 Jan 2024 16:33:42 +0100 Subject: [PATCH 13/32] chore: Update DESCRIPTION and NEWS. --- DESCRIPTION | 2 +- NEWS.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 55680c89..2bcf58b5 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: shiny.semantic Title: Semantic UI Support for Shiny -Version: 0.5.0.9000 +Version: 0.5.0.9001 Authors@R: c(person("Filip", "Stachura", email = "filip@appsilon.com", role = "aut"), person("Dominik", "Krzeminski", role = "aut"), person("Krystian", "Igras", role = "aut"), diff --git a/NEWS.md b/NEWS.md index ea82d199..8594eb80 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,8 @@ - Fixed `range_input` now returns both lower and upper bound. +- Fixed `update_multiple_checkbox` not supporting choices with single quote. + # [shiny.semantic 0.5.0](https://github.com/Appsilon/shiny.semantic/releases/tag/0.5.0) - `shiny.semantic` no longer uses CDN as the default source of assets. Instead, `semantic.assets` package was introduced. From a2d65e2f2816220d13dd5945313a4068fd13fc5b Mon Sep 17 00:00:00 2001 From: Jakub Nowicki Date: Wed, 31 Jan 2024 16:44:21 +0100 Subject: [PATCH 14/32] test: Fix test for empty input. --- tests/testthat/test_multiple_checkbox.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test_multiple_checkbox.R b/tests/testthat/test_multiple_checkbox.R index 52de1c6a..7b42d7e6 100644 --- a/tests/testthat/test_multiple_checkbox.R +++ b/tests/testthat/test_multiple_checkbox.R @@ -17,7 +17,7 @@ test_that("test multiple_checkbox input values", { )) expect_true(any( grepl( - "
", + "
", si_str, fixed = TRUE ) From 58917404a63704bb87305aeb9e86c5eb3973a5f2 Mon Sep 17 00:00:00 2001 From: Alvaro Sanchez <71273913+svalvaro@users.noreply.github.com> Date: Thu, 22 Feb 2024 16:32:03 +0100 Subject: [PATCH 15/32] fix: updated function that was used in an example --- R/dropdown.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/dropdown.R b/R/dropdown.R index fc5dd224..4194fa02 100644 --- a/R/dropdown.R +++ b/R/dropdown.R @@ -173,7 +173,7 @@ selectInput <- function(inputId, label, choices, selected = NULL, multiple = FAL #' output$selected_letter <- renderText(paste(input[["simple_dropdown"]], collapse = ", ")) #' #' observeEvent(input$simple_button, { -#' update_dropdown(session, "simple_dropdown", value = "D") +#' update_dropdown_input(session, "simple_dropdown", value = "D") #' }) #' }) #' From a4b26ae4ddb912be150a4b50544394ae2300d355 Mon Sep 17 00:00:00 2001 From: Jakub Nowicki Date: Wed, 28 Feb 2024 16:00:01 +0100 Subject: [PATCH 16/32] chore: Update NEWS, bump package version, fix code style. --- DESCRIPTION | 2 +- NEWS.md | 2 ++ R/tables.R | 15 +++++++++------ man/semantic_DT.Rd | 11 ++++++++++- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 2bcf58b5..b24b7272 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: shiny.semantic Title: Semantic UI Support for Shiny -Version: 0.5.0.9001 +Version: 0.5.0.9002 Authors@R: c(person("Filip", "Stachura", email = "filip@appsilon.com", role = "aut"), person("Dominik", "Krzeminski", role = "aut"), person("Krystian", "Igras", role = "aut"), diff --git a/NEWS.md b/NEWS.md index 8594eb80..e1f7ee16 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,8 @@ - Fixed `update_multiple_checkbox` not supporting choices with single quote. +- `semantic_DT` now accepts style and class arguments. + # [shiny.semantic 0.5.0](https://github.com/Appsilon/shiny.semantic/releases/tag/0.5.0) - `shiny.semantic` no longer uses CDN as the default source of assets. Instead, `semantic.assets` package was introduced. diff --git a/R/tables.R b/R/tables.R index 5b5a8084..327803bf 100644 --- a/R/tables.R +++ b/R/tables.R @@ -24,11 +24,14 @@ #' } #' #' @export -semantic_DT <- function(..., options = list(), style="semanticui", class = 'ui small compact table') { - DT::datatable(..., options = options, - class = class, - style = style, - rownames = FALSE) +semantic_DT <- function(..., options = list(), style = "semanticui", class = 'ui small compact table') { + DT::datatable( + ..., + options = options, + class = class, + style = style, + rownames = FALSE + ) } #' Semantic DT Output @@ -38,5 +41,5 @@ semantic_DT <- function(..., options = list(), style="semanticui", class = 'ui s #' @return DT Output with semanitc style #' @export semantic_DTOutput <- function(...) { - DT::DTOutput(...) + DT::DTOutput(...) } diff --git a/man/semantic_DT.Rd b/man/semantic_DT.Rd index b6f6b2d2..59fc8f35 100644 --- a/man/semantic_DT.Rd +++ b/man/semantic_DT.Rd @@ -4,12 +4,21 @@ \alias{semantic_DT} \title{Create Semantic DT Table} \usage{ -semantic_DT(..., options = list()) +semantic_DT( + ..., + options = list(), + style = "semanticui", + class = "ui small compact table" +) } \arguments{ \item{...}{datatable parameters, check \code{?DT::datatable} to learn more.} \item{options}{datatable options, check \code{?DT::datatable} to learn more.} + +\item{style}{datatable style, check \code{?DT::datatable} to learn more.} + +\item{class}{datatable class, check \code{?DT::datatable} to learn more.} } \description{ This creates DT table styled with Semantic UI. From 6f2aa5d71ecbede17495b4da8ade0edaaa4eacb0 Mon Sep 17 00:00:00 2001 From: Tymoteusz Makowski Date: Tue, 19 Mar 2024 11:31:52 +0100 Subject: [PATCH 17/32] style: use proper markdown formatting --- .github/pull_request_template.md | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 7344327f..eca81014 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -3,23 +3,13 @@ Short description (with a reference to an issue). **DoD** - [ ] Major project work has a corresponding task. If there’s no task for what you are doing, create it. Each task needs to be well defined and described. - - [ ] Change has been tested (manually or with automated tests), everything runs correctly and works as expected. No existing functionality is broken. - - [ ] No new error or warning messages are introduced. - - [ ] All interaction with a semantic functions, examples and docs are written from the perspective of the person using or receiving it. They are understandable and helpful to this person. - -- [ ] If the change affects code or repo sctructure, README, documentation and code comments should be updated. - +- [ ] If the change affects code or repo structure, README, documentation and code comments should be updated. - [ ] All code has been peer-reviewed before merging into any main branch. - - [ ] All changes have been merged into the main branch we use for development (develop). - - [ ] Continuous integration checks (linter, unit tests) are configured and passed. - - [ ] Unit tests added for all new or changed logic. - - [ ] All task requirements satisfied. The reviewer is responsible to verify each aspect of the task. - - [ ] Any added or touched code follows our style-guide. From b700ca0b49e2af3e5565282418621fe13434cd8b Mon Sep 17 00:00:00 2001 From: Tymoteusz Makowski Date: Tue, 19 Mar 2024 11:38:32 +0100 Subject: [PATCH 18/32] ci: limit number of workflow runs Prior to this change the workflow ran on a push to any of the branches within the repo. Now it will run on: - pushes to master - pushes to develop - PRs - manual trigger --- .github/workflows/main.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d54c80f5..a9e9e52c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,10 @@ -on: push +on: + push: + branches: + - master + - develop + pull_request: + workflow_dispatch: name: R-CMD-check From 8ddabd23dde30b7d83ef7f2a97a5acd7e2516c43 Mon Sep 17 00:00:00 2001 From: Tymoteusz Makowski Date: Tue, 19 Mar 2024 11:59:10 +0100 Subject: [PATCH 19/32] docs: remove deprecated functions from an example --- DESCRIPTION | 2 +- R/dropdown.R | 36 ++++++++++++++-------------------- man/shiny.semantic.Rd | 34 ++++++++++++++++++++++++++++++++ man/update_dropdown_input.Rd | 38 +++++++++++++++--------------------- 4 files changed, 66 insertions(+), 44 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 2bcf58b5..d1ec025b 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -58,4 +58,4 @@ VignetteBuilder: Encoding: UTF-8 Language: en-US LazyData: TRUE -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 diff --git a/R/dropdown.R b/R/dropdown.R index 4194fa02..3f0c4db5 100644 --- a/R/dropdown.R +++ b/R/dropdown.R @@ -153,32 +153,26 @@ selectInput <- function(inputId, label, choices, selected = NULL, multiple = FAL #' #' @examples #' if (interactive()) { +#' library(shiny) +#' library(shiny.semantic) #' -#' library(shiny) -#' library(shiny.semantic) -#' -#' ui <- function() { -#' shinyUI( -#' semanticPage( -#' title = "Dropdown example", -#' dropdown_input("simple_dropdown", LETTERS[1:5], value = "A", type = "selection multiple"), -#' p("Selected letter:"), -#' textOutput("selected_letter"), -#' shiny.semantic::actionButton("simple_button", "Update input to D") -#' ) +#' ui <- semanticPage( +#' title = "Dropdown example", +#' dropdown_input("simple_dropdown", LETTERS[1:5], value = "A", type = "selection multiple"), +#' p("Selected letter:"), +#' textOutput("selected_letter"), +#' shiny.semantic::actionButton("simple_button", "Update input to D") #' ) -#' } #' -#' server <- shinyServer(function(input, output, session) { -#' output$selected_letter <- renderText(paste(input[["simple_dropdown"]], collapse = ", ")) -#' -#' observeEvent(input$simple_button, { -#' update_dropdown_input(session, "simple_dropdown", value = "D") -#' }) -#' }) +#' server <- function(input, output, session) { +#' output$selected_letter <- renderText(paste(input[["simple_dropdown"]], collapse = ", ")) #' -#' shinyApp(ui = ui(), server = server) +#' observeEvent(input$simple_button, { +#' update_dropdown_input(session, "simple_dropdown", value = "D") +#' }) +#' } #' +#' shinyApp(ui, server) #' } #' #' @export diff --git a/man/shiny.semantic.Rd b/man/shiny.semantic.Rd index 5a15270f..c2dd5573 100644 --- a/man/shiny.semantic.Rd +++ b/man/shiny.semantic.Rd @@ -24,3 +24,37 @@ un-minified file.} } } +\seealso{ +Useful links: +\itemize{ + \item \url{https://appsilon.github.io/shiny.semantic/} + \item \url{https://github.com/Appsilon/shiny.semantic} + \item Report bugs at \url{https://github.com/Appsilon/shiny.semantic/issues} +} + +} +\author{ +\strong{Maintainer}: Jakub Nowicki \email{opensource+kuba@appsilon.com} + +Authors: +\itemize{ + \item Filip Stachura \email{filip@appsilon.com} + \item Dominik Krzeminski + \item Krystian Igras + \item Adam Forys + \item Paweł Przytuła \email{pawel@appsilon.com} + \item Jakub Chojna \email{jakub.chojna@appsilon.com} + \item Olga Mierzwa-Sulima \email{olga@appsilon.com} +} + +Other contributors: +\itemize{ + \item Ashley Baldry [contributor] + \item Pedro Manuel Coutinho da Silva \email{pedro@appsilon.com} [contributor] + \item Kamil Żyła \email{kamil@appsilon.com} [contributor] + \item Rabii Bouhestine [contributor] + \item Federico Rivandeira \email{federico@appsilon.com} [contributor] + \item Appsilon Sp. z o.o. [copyright holder] +} + +} diff --git a/man/update_dropdown_input.Rd b/man/update_dropdown_input.Rd index 44ec9e09..17ed4c83 100644 --- a/man/update_dropdown_input.Rd +++ b/man/update_dropdown_input.Rd @@ -28,32 +28,26 @@ Change the value of a \code{\link{dropdown_input}} input on the client. } \examples{ if (interactive()) { - -library(shiny) -library(shiny.semantic) - -ui <- function() { - shinyUI( - semanticPage( - title = "Dropdown example", - dropdown_input("simple_dropdown", LETTERS[1:5], value = "A", type = "selection multiple"), - p("Selected letter:"), - textOutput("selected_letter"), - shiny.semantic::actionButton("simple_button", "Update input to D") - ) + library(shiny) + library(shiny.semantic) + + ui <- semanticPage( + title = "Dropdown example", + dropdown_input("simple_dropdown", LETTERS[1:5], value = "A", type = "selection multiple"), + p("Selected letter:"), + textOutput("selected_letter"), + shiny.semantic::actionButton("simple_button", "Update input to D") ) -} - -server <- shinyServer(function(input, output, session) { - output$selected_letter <- renderText(paste(input[["simple_dropdown"]], collapse = ", ")) - observeEvent(input$simple_button, { - update_dropdown(session, "simple_dropdown", value = "D") - }) -}) + server <- function(input, output, session) { + output$selected_letter <- renderText(paste(input[["simple_dropdown"]], collapse = ", ")) -shinyApp(ui = ui(), server = server) + observeEvent(input$simple_button, { + update_dropdown_input(session, "simple_dropdown", value = "D") + }) + } + shinyApp(ui, server) } } From 6532e8ec3c81f209a7ab6b671f908ad9e011d2fb Mon Sep 17 00:00:00 2001 From: Tymoteusz Makowski Date: Tue, 19 Mar 2024 22:53:53 +0100 Subject: [PATCH 20/32] test: ensure that update_dropdown_input updates values properly --- DESCRIPTION | 1 + tests/testthat/test_dropdown.R | 162 +++++++++++++++++++++++++++++++++ 2 files changed, 163 insertions(+) diff --git a/DESCRIPTION b/DESCRIPTION index f2af28a0..a06dd1ce 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -51,6 +51,7 @@ Suggests: rcmdcheck, rmarkdown, testthat, + shinytest2, tibble, withr VignetteBuilder: diff --git a/tests/testthat/test_dropdown.R b/tests/testthat/test_dropdown.R index e88f9f61..8d4d9596 100644 --- a/tests/testthat/test_dropdown.R +++ b/tests/testthat/test_dropdown.R @@ -17,3 +17,165 @@ test_that("test dropdown_input", { expect_false(any(grepl("
0
", si_str, fixed = TRUE))) }) + +init_driver <- function(app) { + shinytest2::AppDriver$new(app) +} + +test_app <- function(value, initial, multiple, choices = NULL) { + type <- if (multiple) "multiple" else "" + shiny::shinyApp( + ui = semanticPage( + dropdown_input("dropdown", LETTERS, value = initial, type = type), + shiny::actionButton("trigger", "Trigger") + ), + server = function(input, output, session) { + shiny::observeEvent(input$trigger, { + update_dropdown_input(session, "dropdown", value = value, choices = choices) + }) + } + ) +} + +describe("update_dropdown_input", { + skip_on_cran() + local_edition(3) + + it("is a no-op with NULL value", { + # Arrange + initial_value <- "A" + app <- init_driver(test_app(value = NULL, initial = initial_value, multiple = FALSE)) + withr::defer(app$stop()) + + # Act + app$click("trigger") + + # Assert + expect_equal( + app$get_value(input = "dropdown"), + initial_value + ) + }) + + it("updates a single-selection dropdown with a new value", { + # Arrange + value <- "A" + app <- init_driver(test_app(value = value, initial = NULL, multiple = FALSE)) + withr::defer(app$stop()) + + # Act + app$click("trigger") + + # Assert + expect_equal( + app$get_value(input = "dropdown"), + value + ) + }) + + it("updates a multi-selection dropdown with new values", { + # Arrange + value <- c("A", "B") + app <- init_driver(test_app(value = value, initial = NULL, multiple = TRUE)) + withr::defer(app$stop()) + + # Act + app$click("trigger") + + # Assert + expect_equal( + app$get_value(input = "dropdown"), + value + ) + }) + + it("clears a single-selection dropdown with \"\" (empty string)", { + # Arrange + app <- init_driver(test_app(value = "", initial = "A", multiple = FALSE)) + withr::defer(app$stop()) + + # Act + app$click("trigger") + + # Assert + expect_equal( + app$get_value(input = "dropdown"), + "" + ) + }) + + it("clears a multi-selection dropdown with \"\" (empty string)", { + # Arrange + app <- init_driver(test_app(value = "", initial = "A", multiple = TRUE)) + withr::defer(app$stop()) + + # Act + app$click("trigger") + + # Assert + expect_null( + app$get_value(input = "dropdown") + ) + }) + + it("clears a single-selection dropdown with character(0)", { + # Arrange + app <- init_driver(test_app(value = character(0), initial = "A", multiple = FALSE)) + withr::defer(app$stop()) + + # Act + app$click("trigger") + + # Assert + expect_equal( + app$get_value(input = "dropdown"), + "" + ) + }) + + it("clears a multi-selection dropdown with character(0)", { + # Arrange + app <- init_driver(test_app(value = character(0), initial = "A", multiple = TRUE)) + withr::defer(app$stop()) + + # Act + app$click("trigger") + + # Assert + expect_null( + app$get_value(input = "dropdown") + ) + }) + + it("updates choices and selects the first element with value = NULL", { + # Arrange + choices <- c("abc", "xyz") + app <- init_driver(test_app(value = NULL, initial = NULL, multiple = FALSE, choices = choices)) + withr::defer(app$stop()) + + # Act + app$click("trigger") + + # Assert + expect_equal( + app$get_value(input = "dropdown"), + choices[1] + ) + }) + + it("updates choices and clears selection with value = \"\"", { + # Arrange + choices <- c("abc", "xyz") + app <- init_driver(test_app(value = "", initial = NULL, multiple = FALSE, choices = choices)) + withr::defer(app$stop()) + + # Act + app$click("trigger") + + # Assert + expect_equal( + app$get_value(input = "dropdown"), + "" + ) + }) +}) From 3e86016ee16fc26dd2c7e1121ad1c0dd79111384 Mon Sep 17 00:00:00 2001 From: Tymoteusz Makowski Date: Tue, 19 Mar 2024 23:33:04 +0100 Subject: [PATCH 21/32] refactor: simplify update_dropdown_input --- R/dropdown.R | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/R/dropdown.R b/R/dropdown.R index 3f0c4db5..585baa02 100644 --- a/R/dropdown.R +++ b/R/dropdown.R @@ -177,17 +177,14 @@ selectInput <- function(inputId, label, choices, selected = NULL, multiple = FAL #' #' @export update_dropdown_input <- function(session, input_id, choices = NULL, choices_value = choices, value = NULL) { - if (!is.null(value)) value <- paste(as.character(value), collapse = ",") else value <- NULL + msg <- list() + if (!is.null(value)) { + msg$value <- paste(as.character(value), collapse = ",") # NOTE: paste() converts character(0) to "" + } if (!is.null(choices)) { - options <- jsonlite::toJSON(list(values = data.frame(name = choices, text = choices, value = choices_value))) - } else { - options <- NULL + msg$choices <- jsonlite::toJSON(list(values = data.frame(name = choices, text = choices, value = choices_value))) } - - message <- list(choices = options, value = value) - message <- message[!vapply(message, is.null, FUN.VALUE = logical(1))] - - session$sendInputMessage(input_id, message) + session$sendInputMessage(input_id, msg) } #' Change the value of a select input on the client From 44cb306a218fda6c5048e9a90615cb7f11f743cb Mon Sep 17 00:00:00 2001 From: Tymoteusz Makowski Date: Tue, 19 Mar 2024 23:35:42 +0100 Subject: [PATCH 22/32] fix!: clear single-selection dropdown on `character(0)` and `""` Prior to this change only multi-selection dropdown could be cleared. This change makes `update_dropdown_input` behavior analogous to `shiny::updateSelectInput`. Note: this is a breaking change. Prior to this commit updating with `character(0)` or `""` did not have any effect. --- R/dropdown.R | 3 ++- inst/www/shiny-semantic-dropdown.js | 4 ++++ man/update_dropdown_input.Rd | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/R/dropdown.R b/R/dropdown.R index 585baa02..7434869c 100644 --- a/R/dropdown.R +++ b/R/dropdown.R @@ -149,7 +149,8 @@ selectInput <- function(inputId, label, choices, selected = NULL, multiple = FAL #' @param input_id The id of the input object #' @param choices All available options one can select from. If no need to update then leave as \code{NULL} #' @param choices_value What reactive value should be used for corresponding choice. -#' @param value The initially selected value. +#' @param value A value to update dropdown to. \code{character(0)} and \code{""} clear the dropdown. +#' \code{NULL} (the default) does not change selection. #' #' @examples #' if (interactive()) { diff --git a/inst/www/shiny-semantic-dropdown.js b/inst/www/shiny-semantic-dropdown.js index b32988aa..6ea29780 100644 --- a/inst/www/shiny-semantic-dropdown.js +++ b/inst/www/shiny-semantic-dropdown.js @@ -32,6 +32,10 @@ $.extend(semanticDropdownBinding, { // Given the DOM element for the input, set the value. setValue: function(el, value) { + if (value === '') { + $(el).dropdown('clear'); + return; + } if ($(el).hasClass('multiple')) { $(el).dropdown('clear', true); value.split(",").map(v => $(el).dropdown('set selected', v)); diff --git a/man/update_dropdown_input.Rd b/man/update_dropdown_input.Rd index 17ed4c83..4bf5fee4 100644 --- a/man/update_dropdown_input.Rd +++ b/man/update_dropdown_input.Rd @@ -21,7 +21,8 @@ update_dropdown_input( \item{choices_value}{What reactive value should be used for corresponding choice.} -\item{value}{The initially selected value.} +\item{value}{A value to update dropdown to. \code{character(0)} and \code{""} clear the dropdown. +\code{NULL} (the default) does not change selection.} } \description{ Change the value of a \code{\link{dropdown_input}} input on the client. From 0976c232a4418daa1486e8be027eb130d9a70fb6 Mon Sep 17 00:00:00 2001 From: Tymoteusz Makowski Date: Fri, 22 Mar 2024 16:36:38 +0100 Subject: [PATCH 23/32] chore: bump version and update NEWS.md --- DESCRIPTION | 2 +- NEWS.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index a06dd1ce..b28aa45a 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: shiny.semantic Title: Semantic UI Support for Shiny -Version: 0.5.0.9002 +Version: 0.5.0.9003 Authors@R: c(person("Filip", "Stachura", email = "filip@appsilon.com", role = "aut"), person("Dominik", "Krzeminski", role = "aut"), person("Krystian", "Igras", role = "aut"), diff --git a/NEWS.md b/NEWS.md index e1f7ee16..c16308ae 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,6 +6,8 @@ - `semantic_DT` now accepts style and class arguments. +- **Breaking change:** fixed `update_dropdown_input`. It now clears the dropdown on `value = character(0)` and `value = ""`. + # [shiny.semantic 0.5.0](https://github.com/Appsilon/shiny.semantic/releases/tag/0.5.0) - `shiny.semantic` no longer uses CDN as the default source of assets. Instead, `semantic.assets` package was introduced. From 4207467e2179b075fc38c250ad498e7ecd45cbe5 Mon Sep 17 00:00:00 2001 From: Tymoteusz Makowski Date: Tue, 26 Mar 2024 13:21:09 +0100 Subject: [PATCH 24/32] test: define update_dropdown_input behavior Expected `update_dropdown_input` behavior: - choices != NULL and value == NULL changes choices and clears selection - choices != NULL and value != NULL changes choices and sets selection - value == "" and value == character(0) clear the dropdown - Providing a value not present in choices doesn't change the selection The behavior is uniform between a single-selection and a multi-selection variants. Note: - an empty single-selection `dropdown_input` returns "" (no changes) - an empty multi-selection `dropdown_input` returns NULL (no changes) --- tests/testthat/test_dropdown.R | 61 +++++++++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 8 deletions(-) diff --git a/tests/testthat/test_dropdown.R b/tests/testthat/test_dropdown.R index 8d4d9596..b2239082 100644 --- a/tests/testthat/test_dropdown.R +++ b/tests/testthat/test_dropdown.R @@ -57,6 +57,22 @@ describe("update_dropdown_input", { ) }) + it("is a no-op with a value not in choices", { + # Arrange + initial_value <- "A" + app <- init_driver(test_app(value = "asdf", initial = initial_value, multiple = FALSE)) + withr::defer(app$stop()) + + # Act + app$click("trigger") + + # Assert + expect_equal( + app$get_value(input = "dropdown"), + initial_value + ) + }) + it("updates a single-selection dropdown with a new value", { # Arrange value <- "A" @@ -147,10 +163,39 @@ describe("update_dropdown_input", { ) }) - it("updates choices and selects the first element with value = NULL", { + it("updates choices and clears selection in a single-selection dropdown when provided with choices and a NULL value", { + # Arrange + app <- init_driver(test_app(value = NULL, initial = "abc", multiple = FALSE, choices = c("abc", "xyz"))) + withr::defer(app$stop()) + + # Act + app$click("trigger") + + # Assert + expect_equal( + app$get_value(input = "dropdown"), + "" + ) + }) + + it("updates choices and clears selection in a multi-selection dropdown when provided with choices and a NULL value", { + # Arrange + app <- init_driver(test_app(value = NULL, initial = "abc", multiple = TRUE, choices = c("abc", "xyz"))) + withr::defer(app$stop()) + + # Act + app$click("trigger") + + # Assert + expect_null( + app$get_value(input = "dropdown") + ) + }) + + it("updates choices and sets selection in a single-selection dropdown when provided with both choices and a value", { # Arrange - choices <- c("abc", "xyz") - app <- init_driver(test_app(value = NULL, initial = NULL, multiple = FALSE, choices = choices)) + value <- "xyz" + app <- init_driver(test_app(value = value, initial = NULL, multiple = FALSE, choices = c("abc", "xyz"))) withr::defer(app$stop()) # Act @@ -159,14 +204,14 @@ describe("update_dropdown_input", { # Assert expect_equal( app$get_value(input = "dropdown"), - choices[1] + value ) }) - it("updates choices and clears selection with value = \"\"", { + it("updates choices and sets selection in a multi-selection dropdown when provided with both choices and a value", { # Arrange - choices <- c("abc", "xyz") - app <- init_driver(test_app(value = "", initial = NULL, multiple = FALSE, choices = choices)) + value <- c("abc", "xyz") + app <- init_driver(test_app(value = value, initial = NULL, multiple = TRUE, choices = c("abc", "xyz"))) withr::defer(app$stop()) # Act @@ -175,7 +220,7 @@ describe("update_dropdown_input", { # Assert expect_equal( app$get_value(input = "dropdown"), - "" + value ) }) }) From dd0e434fe596a39221b7f5c3eef6410fa8104113 Mon Sep 17 00:00:00 2001 From: Tymoteusz Makowski Date: Tue, 26 Mar 2024 13:54:30 +0100 Subject: [PATCH 25/32] fix: clear input on choices update --- inst/www/shiny-semantic-dropdown.js | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/inst/www/shiny-semantic-dropdown.js b/inst/www/shiny-semantic-dropdown.js index 6ea29780..db465b30 100644 --- a/inst/www/shiny-semantic-dropdown.js +++ b/inst/www/shiny-semantic-dropdown.js @@ -63,22 +63,15 @@ $.extend(semanticDropdownBinding, { }, receiveMessage: function(el, data) { + let value = data.value; if (data.hasOwnProperty('choices')) { // setup menu changes dropdown options without triggering onChange event $(el).dropdown('setup menu', data.choices); - // when no value passed, return null for multiple dropdown and first value for single one - if (!data.hasOwnProperty('value')) { - let value = "" - if (!$(el).hasClass('multiple')) { - value = data.choices.values[0].value - } - this.setValue(el, value); - } + // either keep the value provided or use the fact that an empty string clears the input and triggers a change event + value ||= "" } - if (data.hasOwnProperty('value')) { - this.setValue(el, data.value); - } + this.setValue(el, value); if (data.hasOwnProperty('label')) { $("label[for='" + el.id + "'").html(data.label); From b15888e7334a0a8d5a1ee0debd47c2ab0a8794c0 Mon Sep 17 00:00:00 2001 From: Tymoteusz Makowski Date: Tue, 26 Mar 2024 14:08:52 +0100 Subject: [PATCH 26/32] docs: describe value variants in detail --- R/dropdown.R | 13 +++++++++++-- man/update_dropdown_input.Rd | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/R/dropdown.R b/R/dropdown.R index 7434869c..77a9d29a 100644 --- a/R/dropdown.R +++ b/R/dropdown.R @@ -149,8 +149,17 @@ selectInput <- function(inputId, label, choices, selected = NULL, multiple = FAL #' @param input_id The id of the input object #' @param choices All available options one can select from. If no need to update then leave as \code{NULL} #' @param choices_value What reactive value should be used for corresponding choice. -#' @param value A value to update dropdown to. \code{character(0)} and \code{""} clear the dropdown. -#' \code{NULL} (the default) does not change selection. +#' @param value A value to update dropdown to. Defaults to \code{NULL}. +#' \itemize{ +#' \item a value from \code{choices} updates the selection +#' \item \code{character(0)} and \code{""} clear the selection +#' \item \code{NULL}: +#' \itemize{ +#' \item clears the selection if \code{choices} is provided +#' \item otherwise, \code{NULL} does not change the selection +#' } +#' \item a value not found in \code{choices} does not change the selection +#' } #' #' @examples #' if (interactive()) { diff --git a/man/update_dropdown_input.Rd b/man/update_dropdown_input.Rd index 4bf5fee4..d4a76bb7 100644 --- a/man/update_dropdown_input.Rd +++ b/man/update_dropdown_input.Rd @@ -21,8 +21,17 @@ update_dropdown_input( \item{choices_value}{What reactive value should be used for corresponding choice.} -\item{value}{A value to update dropdown to. \code{character(0)} and \code{""} clear the dropdown. -\code{NULL} (the default) does not change selection.} +\item{value}{A value to update dropdown to. Defaults to \code{NULL}. +\itemize{ + \item a value from \code{choices} updates the selection + \item \code{character(0)} and \code{""} clear the selection + \item \code{NULL}: + \itemize{ + \item clears the selection if \code{choices} is provided + \item otherwise, \code{NULL} does not change the selection + } + \item a value not found in \code{choices} does not change the selection +}} } \description{ Change the value of a \code{\link{dropdown_input}} input on the client. From bf8f611a97978230e5010d7bd73afab40dca72d9 Mon Sep 17 00:00:00 2001 From: Tymoteusz Makowski Date: Tue, 26 Mar 2024 14:11:15 +0100 Subject: [PATCH 27/32] chore: update NEWS.md --- NEWS.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index c16308ae..567dabe6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,7 +6,9 @@ - `semantic_DT` now accepts style and class arguments. -- **Breaking change:** fixed `update_dropdown_input`. It now clears the dropdown on `value = character(0)` and `value = ""`. +- **Breaking change:** fixed `update_dropdown_input`. + - It now clears the dropdown on `value = character(0)` and `value = ""`. + - It now clears the dropdown on `choices` update. # [shiny.semantic 0.5.0](https://github.com/Appsilon/shiny.semantic/releases/tag/0.5.0) From ef44fb902b83d507b5095d1d18897dd4291c1b64 Mon Sep 17 00:00:00 2001 From: Jakub Nowicki Date: Thu, 4 Apr 2024 12:12:43 +0200 Subject: [PATCH 28/32] docs: Update package documentation to follow the roxygen2 7 setup. --- R/shiny.R | 24 ------------------- R/shiny.semantic-package.R | 21 ++++++++++++++++ ....semantic.Rd => shiny.semantic-package.Rd} | 6 +++-- 3 files changed, 25 insertions(+), 26 deletions(-) create mode 100644 R/shiny.semantic-package.R rename man/{shiny.semantic.Rd => shiny.semantic-package.Rd} (91%) diff --git a/R/shiny.R b/R/shiny.R index 9484ba68..1a9f64d7 100644 --- a/R/shiny.R +++ b/R/shiny.R @@ -1,27 +1,3 @@ -#' Semantic UI wrapper for Shiny -#' -#' -#' @description With this library it’s easy to wrap Shiny with Semantic UI -#' components. Add a few simple lines of code and some CSS classes to give -#' your UI a fresh, modern and highly interactive look. -#' -#' @section Options: -#' There are a number of global options that affect shiny.semantic as well as -#' Shiny behavior.The options can be set globally with `options()` -#' \describe{ -#' \item{shiny.custom.semantic.cdn (defaults to `NULL`)}{This controls from where the css -#' and javascripts will be downloaded.} -#' \item{shiny.custom.semantic (defaults to `NULL`)}{This allows to set custom local path -#' to semantic dependencies.} -#' \item{shiny.minified (defaults to `TRUE`)}{Defines including JavaScript as a minified or -#' un-minified file.} -#' } -#' -#' @docType package -#' @name shiny.semantic -#' @aliases shiny.semantic-package -NULL - #' Internal function that expose javascript bindings to Shiny app. #' #' @param libname library name diff --git a/R/shiny.semantic-package.R b/R/shiny.semantic-package.R new file mode 100644 index 00000000..fc7552bb --- /dev/null +++ b/R/shiny.semantic-package.R @@ -0,0 +1,21 @@ +#' Semantic UI wrapper for Shiny +#' +#' +#' @description With this library it’s easy to wrap Shiny with Semantic UI +#' components. Add a few simple lines of code and some CSS classes to give +#' your UI a fresh, modern and highly interactive look. +#' +#' @section Options: +#' There are a number of global options that affect shiny.semantic as well as +#' Shiny behavior.The options can be set globally with `options()` +#' \describe{ +#' \item{shiny.custom.semantic.cdn (defaults to `NULL`)}{This controls from where the css +#' and javascripts will be downloaded.} +#' \item{shiny.custom.semantic (defaults to `NULL`)}{This allows to set custom local path +#' to semantic dependencies.} +#' \item{shiny.minified (defaults to `TRUE`)}{Defines including JavaScript as a minified or +#' un-minified file.} +#' } +#' +#' @keywords internal +"_PACKAGE" diff --git a/man/shiny.semantic.Rd b/man/shiny.semantic-package.Rd similarity index 91% rename from man/shiny.semantic.Rd rename to man/shiny.semantic-package.Rd index c2dd5573..0f937582 100644 --- a/man/shiny.semantic.Rd +++ b/man/shiny.semantic-package.Rd @@ -1,7 +1,7 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/shiny.R +% Please edit documentation in R/shiny.semantic-package.R \docType{package} -\name{shiny.semantic} +\name{shiny.semantic-package} \alias{shiny.semantic} \alias{shiny.semantic-package} \title{Semantic UI wrapper for Shiny} @@ -45,6 +45,7 @@ Authors: \item Paweł Przytuła \email{pawel@appsilon.com} \item Jakub Chojna \email{jakub.chojna@appsilon.com} \item Olga Mierzwa-Sulima \email{olga@appsilon.com} + \item Tymoteusz Makowski \email{tymoteusz.makowski@appsilon.com} } Other contributors: @@ -58,3 +59,4 @@ Other contributors: } } +\keyword{internal} From cc8b4d6526723eaaf46dc6d6fad564d80103a86d Mon Sep 17 00:00:00 2001 From: Jakub Nowicki Date: Thu, 4 Apr 2024 12:13:09 +0200 Subject: [PATCH 29/32] test: Disable Crashpad for shinytest2. --- tests/testthat/setup-disable-crashpad.R | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/testthat/setup-disable-crashpad.R diff --git a/tests/testthat/setup-disable-crashpad.R b/tests/testthat/setup-disable-crashpad.R new file mode 100644 index 00000000..73e56ee6 --- /dev/null +++ b/tests/testthat/setup-disable-crashpad.R @@ -0,0 +1,30 @@ +# ❯ checking for detritus in the temp directory ... NOTE +# Found the following files/directories: +# ‘Crashpad’ +# +# 0 errors ✔ | 0 warnings ✔ | 1 note ✖ +# Error: Error: R CMD check found NOTEs +# Flavors: ubuntu-22.04 (devel), ubuntu-22.04 (release), ubuntu-22.04 (oldrel) + +# References (shinytest2 github): +# 1. https://github.com/rstudio/shinytest2/blob/main/cran-comments.md +# 2. https://github.com/rstudio/shinytest2/blob/main/tests/testthat/setup-disable-crashpad.R + +# Disable crash reporting on CRAN machines. (Can't get the report anyways) +chromote::set_chrome_args(c( + # https://peter.sh/experiments/chromium-command-line-switches/#disable-crash-reporter + #> Disable crash reporter for headless. It is enabled by default in official builds + "--disable-crash-reporter", + chromote::default_chrome_args() +)) + +# Make sure the temp folder is removed when testing is complete +withr::defer({ + + # Clean up chromote sessions + gc() # Run R6 finalizer methods + Sys.sleep(2) # Wait for any supervisors to exit + + # Delete the Crashpad folder if it exists + unlink(file.path(tempdir(), "Crashpad"), recursive = TRUE) +}, envir = testthat::teardown_env()) From f852789ce9d6d1233c4227ef27f57b4e9f46ae2e Mon Sep 17 00:00:00 2001 From: Jakub Nowicki Date: Thu, 4 Apr 2024 12:13:35 +0200 Subject: [PATCH 30/32] chore: Bump package version and update authors. --- DESCRIPTION | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index b28aa45a..842cfb02 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: shiny.semantic Title: Semantic UI Support for Shiny -Version: 0.5.0.9003 +Version: 0.5.1 Authors@R: c(person("Filip", "Stachura", email = "filip@appsilon.com", role = "aut"), person("Dominik", "Krzeminski", role = "aut"), person("Krystian", "Igras", role = "aut"), @@ -10,6 +10,7 @@ Authors@R: c(person("Filip", "Stachura", email = "filip@appsilon.com", role = "a person("Jakub", "Chojna", email = "jakub.chojna@appsilon.com", role = "aut"), person("Olga", "Mierzwa-Sulima", email = "olga@appsilon.com", role = "aut"), person("Jakub", "Nowicki", email = "opensource+kuba@appsilon.com", role = c("aut", "cre")), + person("Tymoteusz", "Makowski", email = "tymoteusz.makowski@appsilon.com", role = "aut"), person("Ashley", "Baldry", role = "ctb"), person("Pedro", "Manuel Coutinho da Silva", email = "pedro@appsilon.com", role = "ctb"), person("Kamil", "Żyła", email = "kamil@appsilon.com", role = "ctb"), @@ -39,6 +40,7 @@ Imports: stats Suggests: covr, + chromote, dplyr, DT, gapminder, From 29dc55c6671ffafe9353dbccf5fa1c2fafcfe24c Mon Sep 17 00:00:00 2001 From: Tymoteusz Makowski Date: Fri, 5 Apr 2024 09:31:27 +0200 Subject: [PATCH 31/32] chore: remove project-specific PR template Upon removal, an organization-wide template will be used. The template is stored in Appsilon/.github repository. --- .github/pull_request_template.md | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index eca81014..00000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,15 +0,0 @@ -Short description (with a reference to an issue). - -**DoD** - -- [ ] Major project work has a corresponding task. If there’s no task for what you are doing, create it. Each task needs to be well defined and described. -- [ ] Change has been tested (manually or with automated tests), everything runs correctly and works as expected. No existing functionality is broken. -- [ ] No new error or warning messages are introduced. -- [ ] All interaction with a semantic functions, examples and docs are written from the perspective of the person using or receiving it. They are understandable and helpful to this person. -- [ ] If the change affects code or repo structure, README, documentation and code comments should be updated. -- [ ] All code has been peer-reviewed before merging into any main branch. -- [ ] All changes have been merged into the main branch we use for development (develop). -- [ ] Continuous integration checks (linter, unit tests) are configured and passed. -- [ ] Unit tests added for all new or changed logic. -- [ ] All task requirements satisfied. The reviewer is responsible to verify each aspect of the task. -- [ ] Any added or touched code follows our style-guide. From 97103a918c48dda8aa188941069408c95d4a1b6d Mon Sep 17 00:00:00 2001 From: Jakub Nowicki Date: Tue, 9 Apr 2024 09:07:45 +0200 Subject: [PATCH 32/32] chore: Change version in NEWS. --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index 567dabe6..ba06644a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # shiny.semantic (development) +# [shiny.semantic 0.5.1](https://github.com/Appsilon/shiny.semantic/releases/tag/0.5.1) + - Fixed `range_input` now returns both lower and upper bound. - Fixed `update_multiple_checkbox` not supporting choices with single quote.