Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

145 améliorer laide des fonctions lien vers doc shiny #153

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions R/actionbutton_dsfr.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
#' @param class des classes a ajouter si necessaire
#'
#' @return html
#'
#' @seealso [actionButton()] Pour en savoir plus sur la création de boutons d'action avec Shiny. [Documentation externe](https://shiny.posit.co/r/reference/shiny/latest/actionbutton)
#' @export
#'
#' @examples
#' if (interactive()) {
#' library(shiny)
#' library(shinygouv)
#'
#'
#' ui <- fluidPage_dsfr(
#' header = header_dsfr(
#' intitule = "Intitule",
Expand All @@ -38,7 +38,7 @@
#' paste("Vous avez cliqu\u00e9", input$test, "fois sur le bouton")
#' })
#' }
#'
#'
#' shinyApp(ui, server)
#' }
actionButton_dsfr <- function(
Expand Down
14 changes: 8 additions & 6 deletions R/checkboxgroupinput_dsfr.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,39 @@
#' @param selected Valeurs préselectionnées
#' @param inline Si TRUE, positionne les choix en ligne (c'est-à-dire horizontalement).
#' @return html
#' @seealso [checkboxGroupInput()] Pour en savoir plus sur la fonction originelle de Shiny.
#' [Documentation externe](https://shiny.posit.co/r/reference/shiny/latest/checkboxgroupinput)
#'
#' @export
#'
#' @examples
#' if (interactive()) {
#'
#'
#' library(shiny)
#'
#'
#' ui <- fluidPage_dsfr(
#' checkboxGroupInput_dsfr("checkboxes", "Variables to show:",
#' c("Cylinders" = "cyl",
#' "Transmission" = "am",
#' "Gears" = "gear"), inline = TRUE)
#' )
#'
#'
#' server <- function(input, output, session) {
#' observeEvent(input$checkboxes, {
#' print(input$checkboxes)
#' })
#' }
#'
#'
#' shinyApp(ui, server)
#' }
checkboxGroupInput_dsfr <- function(inputId,
label, choices = NULL, selected = NULL, inline = FALSE) {

# check les params
assertthat::assert_that(is.character(inputId))
assertthat::assert_that(is.character(label))
assertthat::assert_that(is.logical(inline))

# if choices is null then choices_value and choice_names must be not empty with the same length
# assertthat::assert_that(!is.null(choices) | (length(choice_values) > 0 & length(choice_values) == length(choice_names)))
#
Expand Down
6 changes: 4 additions & 2 deletions R/checkboxinput_dsfr.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#' @param label id de l'input sans indexation
#'
#' @return html
#' @seealso [checkboxInput()] Pour en savoir plus sur la fonction Shiny originelle,
#' consultez [checkboxInput()](https://shiny.posit.co/r/reference/shiny/latest/checkboxinput).
#'
#' @export
#'
Expand All @@ -21,12 +23,12 @@
checkboxInput_dsfr <- function(inputId,
label,
value = FALSE) {

# check les params
assertthat::assert_that(is.character(inputId))
assertthat::assert_that(is.character(label))
assertthat::assert_that(is.logical(value))

checkboxInput_dsfr_template(
inputId,
label = label,
Expand Down
4 changes: 3 additions & 1 deletion R/column_dsfr.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
#' @param extra_class ajout de class pour la column_dsfr (voir la page officiel du CSS)
#'
#' @return shiny.tag.list
#'
#' @seealso [column()] Pour en savoir plus sur la fonction originelle de Shiny.
#' [Documentation externe](https://shiny.posit.co/r/reference/shiny/latest/column.html)

#' @importFrom htmltools tagList
#'
#' @export
Expand Down
22 changes: 11 additions & 11 deletions R/daterangeinput_dsfr.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
#' @param start character La date de début au format aaaa-mm-jj. Si NULL (valeur par défaut), la date utilisée est la date du jour.
#' @param end character La date de fin au format aaaa-mm-jj. Si NULL (valeur par défaut), la date utilisée est la date du jour.
#' @param separator character Chaîne à afficher entre les zones de saisie de début et de fin de dates.
#'
#'
#' @importFrom assertthat assert_that
#' @importFrom purrr map
#' @return html
#'
#' @seealso [daterangeinput() in Shiny](https://shiny.posit.co/r/reference/shiny/latest/daterangeinput)
#' @export
#'
#' @examples
#' ## Only run examples in interactive R sessions
#' if (interactive()) {
#' library(shiny)
#' library(shinygouv)
#'
#'
#' ui <- fluidPage_dsfr(
#' header = header_dsfr(
#' intitule = "Intitule",
Expand All @@ -36,14 +36,14 @@
#' )
#' )
#' server <- function(input, output, session) {
#'
#'
#' observeEvent(input$daterange1, {
#' print(input$daterange1)
#' })
#'
#' })
#'
#' }
#'
#'
#'
#'
#' shinyApp(ui, server)
#' }
dateRangeInput_dsfr <- function(
Expand All @@ -58,19 +58,19 @@ dateRangeInput_dsfr <- function(
assertthat::assert_that(is.character(separator))
assertthat::assert_that(is.character(label))


if (isTRUE(is.null(start))) {
start <- Sys.Date()
} else {
assertthat::assert_that(is.character(start))
}

if (isTRUE(is.null(end))) {
end <- Sys.Date()
} else {
assertthat::assert_that(is.character(end))
}

dateRangeInput_dsfr_template(
inputId = inputId,
label = label,
Expand Down
19 changes: 10 additions & 9 deletions R/fileinput_dsfr.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
#' @return html
#' @importFrom assertthat assert_that
#' @export
#'
#' @seealso [fileInput()] Pour en savoir plus sur la fonction originelle de Shiny.
#' [Documentation externe](https://shiny.posit.co/r/reference/shiny/latest/fileinput)
#' @examples
#'
#'
#' if (interactive()) {
#' ui <- fluidPage_dsfr(
#' fluidRow_dsfr(
#' column_dsfr(width = 4,
#' column_dsfr(width = 4,
#' fileInput_dsfr(inputId = "file1", label = "Importez vos données", message = "seul le format csv est pris en charge"),
#' br(),
#' checkboxInput_dsfr(inputId = "header", label = "Utiliser les en-tetes du fichier")
Expand All @@ -26,23 +27,23 @@
#' )
#' )
#' )
#'
#'
#' server <- function(input, output) {
#' output$contenu <- renderTable({
#' file <- input$file1
#' ext <- tools::file_ext(file$datapath)
#'
#'
#' req(file)
#' validate(need(ext == "csv", "Veuillez choisir un fichier csv svp"))
#'
#'
#' read.csv2(file$datapath, header = input$header, nrows = 12)
#' })
#' }
#'
#'
#' shinyApp(ui, server)
#' }
#'
#'
#'
#'
fileInput_dsfr <- function(
inputId,
label,
Expand Down
2 changes: 1 addition & 1 deletion R/fluidpage_dsfr.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' @return html
#'
#' @importFrom htmltools tagList
#'
#' @seealso [fluidPage](https://shiny.posit.co/r/reference/shiny/latest/fluidpage)
#' @export
#'
#' @examples
Expand Down
2 changes: 1 addition & 1 deletion R/fluidrow_dsfr.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#'
#' @return shiny.tag.list
#' @importFrom htmltools tagList
#'
#' @seealso [fluidPage](https://shiny.posit.co/r/reference/shiny/latest/fluidpage)
#' @export
#' @examples
#' if (interactive()) {
Expand Down
6 changes: 3 additions & 3 deletions R/modaldialog_dsfr.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#' @param title titre du modal
#' @param footer footer du modal
#' @return html
#'
#' @seealso [modaldialog() in Shiny](https://shiny.posit.co/r/reference/shiny/latest/modaldialog)
#' @export
#' @importFrom htmltools tagList
#' @examples
Expand Down Expand Up @@ -63,7 +63,7 @@ modalDialog_dsfr <- function(
#' @param ui TODO
#' @param inputId TODO
#' @param session TODO
#'
#' @seealso [showmodal() in Shiny](https://shiny.posit.co/r/reference/shiny/latest/showmodal)
#' @export
showModal_dsfr <- function(
ui,
Expand All @@ -84,7 +84,7 @@ showModal_dsfr <- function(
#'
#' @param inputId TODO
#' @param session TODO
#'
#' @seealso [removemodal() in Shiny](https://shiny.posit.co/r/reference/shiny/latest/showmodal)
#' @export
removeModal_dsfr <- function(
inputId = "fr-modal-1",
Expand Down
3 changes: 1 addition & 2 deletions R/navbarpage_dsfr.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
#' Page avec navbar
#'
#' @return html
#'
#' @seealso [navbarPage() in Shiny](https://shiny.posit.co/r/reference/shiny/latest/navbarpage).
#' @export
#' @param ... Une list de navbarPanel_dsfr
#' @param title Titre de l'application (Attention, différent de shiny::navbarPage)
#' @param id Id de la navbar
#' @param header header_dsfr()
#' @param footer pied de page
#'
#' @examples
#' library(shiny)
#' # Define UI
Expand Down
2 changes: 1 addition & 1 deletion R/numericinput_dsfr.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' @param step pas utilisé entre 2 valeurs
#'
#' @return html
#'
#' @seealso [numericInput() in Shiny](https://shiny.posit.co/r/reference/shiny/latest/numericinput)
#' @export
#'
#' @examples
Expand Down
3 changes: 1 addition & 2 deletions R/radiobuttons_dsfr.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
#' @param inline Si TRUE, positionne les choix en ligne (c'est-à-dire horizontalement).
#' @param class des classes a ajouter si necessaire
#' @return html
#'
#' @seealso [radioButtons](https://shiny.posit.co/r/reference/shiny/latest/radiobuttons)
#' @export
#'
#' @examples
#' radioButtons_dsfr(
#' inputId = "test", label = "Test", choices = c("A", "B"), class = NULL
Expand Down
2 changes: 1 addition & 1 deletion R/radiogroupbuttons_dsfr.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#' @param selected Element sélectionné (NULL par défaut)
#' @param inline Si TRUE, positionne les choix en ligne (c'est-à-dire horizontalement).
#' @return html
#'
#' @seealso [radioGroupButtons() in Shiny](https://rdrr.io/cran/shinyWidgets/man/radioGroupButtons.html)
#' @export
#'
#' @examples
Expand Down
4 changes: 2 additions & 2 deletions R/selectinput_dsfr.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#' @importFrom assertthat assert_that
#' @importFrom purrr map
#' @return html
#'
#' @seealso [selectInput() in Shiny](https://shiny.posit.co/r/reference/shiny/latest/selectinput)
#' @export
#'
#' @examples
Expand Down Expand Up @@ -50,7 +50,7 @@
#' ),
#' selected = "gear"
#' )
#'
#'
#' )
#'
#' )
Expand Down
2 changes: 2 additions & 0 deletions R/sliderinput_dsfr.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#'
#' @inherit shiny::sliderInput
#' @inherit shiny::updateSliderInput
#' @seealso [selectInput() in Shiny](https://shiny.posit.co/r/reference/shiny/latest/sliderinput)
#' @export
sliderInput_dsfr <- shiny::sliderInput
updateSliderInput_dsfr <- shiny::updateSliderInput

4 changes: 2 additions & 2 deletions R/tableoutput_dsfr.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
#'
#' @param outputId nom d'output a partir duquel lire la table
#' @return html
#'
#' @seealso [tableoutput() in Shiny](https://shiny.posit.co/r/reference/shiny/latest/rendertable)
#' @export
#'
#' @examples
#'
#'
#' if (interactive()) {
#' # table example
#' shinyApp(
Expand Down
4 changes: 1 addition & 3 deletions R/tabpanel.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
#' @param ... liste de tabPanel_dsfr
#' @param title titre du tabset
#' @param content contenu du tabset
#'
#' @seealso [tabsetpanel() in Shiny](https://shiny.posit.co/r/reference/shiny/latest/tabsetpanel)
#' @return html
#'
#' @export
#' @rdname tabPanel
#'
#' @examples
#' if (interactive()){
#' library(shiny)
Expand Down
Loading
Loading