From b06eb6c21c2c9d30c15bf5816cb801d7ad0e6f3d Mon Sep 17 00:00:00 2001 From: pvictor Date: Thu, 24 Nov 2022 16:06:41 +0100 Subject: [PATCH] Allow `esquisse_server()` to be initialized with NULL without forcing the import module to appear using `import_from = NULL`, fix #232 --- DESCRIPTION | 2 +- NEWS.md | 5 +++++ R/esquisse-server.R | 4 ++-- man/dropInput.Rd | 18 +++++++++--------- man/updateDropInput.Rd | 30 +++++++++++++++--------------- 5 files changed, 32 insertions(+), 27 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index b604d46d..b64236c6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: esquisse Type: Package Title: Explore and Visualize Your Data Interactively -Version: 1.1.2.9010 +Version: 1.1.2.9100 Authors@R: c(person("Fanny", "Meyer", role = c("aut")), person("Victor", "Perrier", email = "victor.perrier@dreamrs.fr", role = c("aut", "cre")), person("Ian", "Carroll", comment = "Faceting support", role = "ctb"), diff --git a/NEWS.md b/NEWS.md index b504bd0d..01149385 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +# esquisse 1.2.0 + +* Allow `esquisse_server()` to be initialized with NULL without forcing the import module to appear using `import_from = NULL` [#232](https://github.com/dreamRs/esquisse/issues/232) + + # esquisse 1.1.2 * i18n: new translations added: diff --git a/R/esquisse-server.R b/R/esquisse-server.R index d0580190..c1acd283 100644 --- a/R/esquisse-server.R +++ b/R/esquisse-server.R @@ -4,7 +4,7 @@ #' @param default_aes Default aesthetics to be used, can be a `character` #' vector or `reactive` function returning one. #' @param import_from From where to import data, argument passed -#' to \code{\link[datamods:import-modal]{datamods::import_ui}}. +#' to [datamods::import_server()]. #' #' @export #' @@ -85,7 +85,7 @@ esquisse_server <- function(id, }, ignoreInit = FALSE) # Launch import modal if no data at start - if (is.null(isolate(data_rv$data))) { + if (!is.null(import_from) && is.null(isolate(data_rv$data))) { datamods::import_modal( id = ns("import-data"), from = import_from, diff --git a/man/dropInput.Rd b/man/dropInput.Rd index 127b7fea..012ade68 100644 --- a/man/dropInput.Rd +++ b/man/dropInput.Rd @@ -46,37 +46,37 @@ A dropdown menu for selecting a value. } \examples{ if (interactive()) { - + library(shiny) library(esquisse) - + ui <- fluidPage( tags$h2("Drop Input"), dropInput( inputId = "mydrop", choicesNames = tagList( - list(icon("home"), style = "width: 100px;"), + list(icon("home"), style = "width: 100px;"), list(icon("flash"), style = "width: 100px;"), list(icon("cogs"), style = "width: 100px;"), - list(icon("fire"), style = "width: 100px;"), - list(icon("users"), style = "width: 100px;"), + list(icon("fire"), style = "width: 100px;"), + list(icon("users"), style = "width: 100px;"), list(icon("info"), style = "width: 100px;") - ), + ), choicesValues = c("home", "flash", "cogs", "fire", "users", "info"), dropWidth = "220px" ), verbatimTextOutput(outputId = "res") ) - + server <- function(input, output, session) { output$res <- renderPrint({ input$mydrop }) } - + shinyApp(ui, server) - + } } \seealso{ diff --git a/man/updateDropInput.Rd b/man/updateDropInput.Rd index 46bd3133..563bbffc 100644 --- a/man/updateDropInput.Rd +++ b/man/updateDropInput.Rd @@ -20,20 +20,20 @@ Change the value of a drop input on the client } \examples{ if (interactive()) { - + library(shiny) library(esquisse) - + myChoices <- tagList( - list(icon("home"), style = "width: 100px;"), + list(icon("home"), style = "width: 100px;"), list(icon("flash"), style = "width: 100px;"), list(icon("cogs"), style = "width: 100px;"), - list(icon("fire"), style = "width: 100px;"), - list(icon("users"), style = "width: 100px;"), + list(icon("fire"), style = "width: 100px;"), + list(icon("users"), style = "width: 100px;"), list(icon("info"), style = "width: 100px;") ) - - + + ui <- fluidPage( tags$h2("Update Drop Input"), fluidRow( @@ -41,12 +41,12 @@ if (interactive()) { width = 6, dropInput( inputId = "mydrop", - choicesNames = myChoices, + choicesNames = myChoices, choicesValues = c("home", "flash", "cogs", "fire", "users", "info"), dropWidth = "220px" ), verbatimTextOutput(outputId = "res") - ), + ), column( width = 6, actionButton("home", "Select home"), @@ -64,13 +64,13 @@ if (interactive()) { ) ) ) - + server <- function(input, output, session) { - + output$res <- renderPrint({ input$mydrop }) - + observeEvent(input$home, { updateDropInput(session, "mydrop", "home") }) @@ -89,7 +89,7 @@ if (interactive()) { observeEvent(input$info, { updateDropInput(session, "mydrop", "info") }) - + observeEvent(input$disable, { if (!is.null(input$disabled)) { updateDropInput(session, "mydrop", disabled = input$disabled) @@ -98,9 +98,9 @@ if (interactive()) { } }) } - + shinyApp(ui, server) - + } } \seealso{