Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
Merge branch 'main' into 130-composant-implementation-de-fileinput

# Conflicts:
#	NAMESPACE
#	inst/v1.9.3/table_correspondance_shiny_dsfr.csv
  • Loading branch information
jengelaere committed Jul 26, 2023
2 parents 3d2ee39 + 330c7cb commit 3c8dad5
Show file tree
Hide file tree
Showing 35 changed files with 1,379 additions and 161 deletions.
14 changes: 7 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: shinygouv
Title: Implement the DSFR for your shiny applications
Version: 1.0.0
Version: 1.0.2
Authors@R: c(
person("Juliette", "ENGELARE-LEFEBVRE", , "juliette.engelaere-lefebvre@developpement-durable.gouv.fr", role = c("aut", "cre")),
person("Sébastien", "Rochette", , "sebastien@thinkr.fr", role = "aut",
Expand All @@ -18,7 +18,7 @@ Authors@R: c(
Description: Components and tools to build or transform shiny applications
with the Design System of France.
License: EUPL (>= 1.2) | file LICENSE
Imports:
Imports:
assertthat (>= 0.2.1),
attempt (>= 0.3.1),
config (>= 0.3.1),
Expand All @@ -27,26 +27,26 @@ Imports:
golem (>= 0.3.2),
htmltools (>= 0.5.2),
janitor (>= 2.2.0),
lifecycle,
lifecycle (>= 1.0.3),
magrittr (>= 2.0.3),
purrr (>= 0.3.4),
shiny (>= 1.7.1),
stringr (>= 1.4.0),
tools,
utils,
XML (>= 3.99.0.10)
Suggests:
Suggests:
desc (>= 1.4.1),
DT (>= 0.23),
knitr (>= 1.39),
readxl (>= 1.4.0),
rmarkdown (>= 2.14),
testthat (>= 3.0.0),
tibble (>= 3.1.7),
withr
VignetteBuilder:
withr (>= 2.5.0)
VignetteBuilder:
knitr
Config/fusen/version: 0.5.0.9008
Config/fusen/version: 0.5.0.9001
Config/testthat/edition: 3
Encoding: UTF-8
LazyData: true
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export(checkboxInput_dsfr)
export(column_dsfr)
export(convert_to_dsfr)
export(fileInput_dsfr)
export(dateRangeInput_dsfr)
export(fluidPage_dsfr)
export(fluidRow_dsfr)
export(get_dsfr_version)
Expand All @@ -30,6 +31,7 @@ export(tabsetPanel_dsfr)
export(toggleSwitch_dsfr)
export(updateCheckboxGroupInput_dsfr)
export(updateCheckboxInput_dsfr)
export(updateDateRangeInput_dsfr)
export(updateNumericInput_dsfr)
export(updateRadioButtons_dsfr)
export(updateRadioGroupButtons_dsfr)
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# shinygouv 1.0.2

## fix

* Correction de la classe du `fluidPage_dsfr()`

# shinygouv 1.0.0

## chore
Expand All @@ -8,6 +14,7 @@

## feat

* Ajout de `dateRangeInput_dsfr()` et `updateDateRangeInput_dsfr()`
* Ajout de `numericInput_dsfr()` et `updateNumericInput_dsfr()`
* Ajout de `navbarPage_dsfr()` et `navbarPanel_dsfr()`
* Ajout de `radioButtons_dsfr()` et `updateRadioButtons_dsfr()`
Expand Down
84 changes: 84 additions & 0 deletions R/daterangeinput_dsfr.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# WARNING - Generated by {fusen} from /dev/flat_composants/flat_dateRangeInput.Rmd: do not edit by hand

#' dateRangeInput_dsfr
#'
#' @param inputId inputId
#' @param label label
#' @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
#'
#' @export
#'
#' @examples
#' ## Only run examples in interactive R sessions
#' if (interactive()) {
#' library(shiny)
#' library(shinygouv)
#'
#' ui <- fluidPage_dsfr(
#' header = header_dsfr(
#' intitule = "Intitule",
#' officiel = "Officiel",
#' nom_site_service = "Nom du site / service",
#' baseline = "baseline - precisions sur l organisation",
#' class = "fr-m-1w"
#' ),
#' title = "Exemple",
#' fluidRow_dsfr(
#' # sans vecteur nommé
#' dateRangeInput_dsfr(inputId = "daterange1",
#' label = "Date range:", start = "2001-01-01",separator = "à")
#' )
#' )
#' server <- function(input, output, session) {
#'
#' observeEvent(input$daterange1, {
#' print(input$daterange1)
#' })
#'
#' }
#'
#'
#' shinyApp(ui, server)
#' }
dateRangeInput_dsfr <- function(
inputId,
label,
start = NULL,
end = NULL,
separator = "to"
) {
# check les params
assertthat::assert_that(is.character(inputId))
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,
start = start,
end = end,
separator = separator
) #%>%
#parse_html()


}
38 changes: 38 additions & 0 deletions R/daterangeinput_dsfr_template.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# WARNING - Generated by {fusen} from /dev/flat_composants/flat_dateRangeInput.Rmd: do not edit by hand

#' dateRangeInput_dsfr_template
#'
#' @param inputId inputId
#' @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 label label
#' @param separator character Chaîne à afficher entre les zones de saisie de début et de fin de dates.
#'
#' @importFrom htmltools htmlTemplate
#' @importFrom purrr pmap
#' @return html
#' @noRd
dateRangeInput_dsfr_template <- function(
inputId,
label,
start,
end,
separator
) {


htmltools::htmlTemplate(
filename = system.file(
get_dsfr_version(with_v = TRUE),
"composant",
"dateRangeInput.html",
package = "shinygouv"
),
inputId = inputId,
label = label,
start = start,
end = end,
separator = separator
)

}
9 changes: 6 additions & 3 deletions R/fluidpage_dsfr.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#'
#' @param ... element a inclure dans la page
#' @param header l entete de la page (voir `header_dsfr()`)
#' @param footer contenu du pied de page
#' @param theme pas implemente
#' @param lang pas implemente
#' @param title titre de la page
Expand All @@ -16,7 +17,7 @@
#'
#' @examples
#' if (interactive()) {
#'
#'
#' library(shiny)
#' my_page <- fluidPage_dsfr(
#' header = header_dsfr(
Expand All @@ -25,7 +26,7 @@
#' title = "Gouv",
#' htmltools::div("test")
#' )
#'
#'
#' shiny::shinyApp(
#' my_page,
#' server = function(input, output) {}
Expand All @@ -35,6 +36,7 @@ fluidPage_dsfr <- function(
...,
header = NULL,
title = NULL,
footer = NULL,
theme = NULL,
lang = NULL
) {
Expand All @@ -45,7 +47,8 @@ fluidPage_dsfr <- function(
title = tagList(title),
body = tagList(
...
)
),
footer = footer
) %>%
# parse_html(zone = "/html") %>%
add_dsfr_deps()
Expand Down
12 changes: 10 additions & 2 deletions R/fluidpage_dsfr_template.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
#' @param header entete de la page
#' @param title titre de la page
#' @param body body
#' @param footer footer de la page
#' @param class class du container principal
#'
#' @importFrom htmltools htmlTemplate
#' @return html
#' @noRd
fluidPage_dsfr_template <- function(
header,
title,
body
body,
footer = NULL,
class = "fr-container"
) {
htmltools::htmlTemplate(
filename = system.file(
Expand All @@ -22,6 +26,10 @@ fluidPage_dsfr_template <- function(
),
header = header,
title = title,
body = body
body = tags$div(
class = class,
body
),
footer = footer
)
}
Loading

0 comments on commit 3c8dad5

Please sign in to comment.