From 45b8c70f9b263cb39d76615d3b0a971fd98a5f92 Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Tue, 13 Feb 2024 11:20:02 +0100 Subject: [PATCH] update docs of module() server and ui args (#1094) Signed-off-by: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com> --- R/module_snapshot_manager.R | 2 +- R/module_tabs_with_filters.R | 2 +- R/module_teal_with_splash.R | 2 +- R/modules.R | 25 ++++++++++++++++--------- R/validate_inputs.R | 2 +- man/module_tabs_with_filters.Rd | 2 +- man/module_teal_with_splash.Rd | 2 +- man/snapshot_manager_module.Rd | 2 +- man/teal_modules.Rd | 25 ++++++++++++++++--------- man/validate_inputs.Rd | 2 +- 10 files changed, 40 insertions(+), 26 deletions(-) diff --git a/R/module_snapshot_manager.R b/R/module_snapshot_manager.R index ba7693e788..fb92f8919e 100644 --- a/R/module_snapshot_manager.R +++ b/R/module_snapshot_manager.R @@ -1,4 +1,4 @@ -#' Filter state snapshot management. +#' Filter state snapshot management #' #' Capture and restore snapshots of the global (app) filter state. #' diff --git a/R/module_tabs_with_filters.R b/R/module_tabs_with_filters.R index 49e2bea529..4cf2f58fdc 100644 --- a/R/module_tabs_with_filters.R +++ b/R/module_tabs_with_filters.R @@ -1,4 +1,4 @@ -#' Add right filter panel into each of the top-level `teal_modules` UIs. +#' Add right filter panel into each of the top-level `teal_modules` UIs #' #' The [ui_nested_tabs] function returns a nested tabbed UI corresponding #' to the nested modules. diff --git a/R/module_teal_with_splash.R b/R/module_teal_with_splash.R index a87f48fa64..e9cd7b304e 100644 --- a/R/module_teal_with_splash.R +++ b/R/module_teal_with_splash.R @@ -1,6 +1,6 @@ # This file adds a splash screen for delayed data loading on top of teal -#' Add splash screen to `teal` application. +#' Add splash screen to `teal` application #' #' @description `r lifecycle::badge("stable")` #' diff --git a/R/modules.R b/R/modules.R index 73ba64de3c..9db36cd712 100644 --- a/R/modules.R +++ b/R/modules.R @@ -1,4 +1,4 @@ -#' Create `teal_module` and `teal_modules` objects. +#' Create `teal_module` and `teal_modules` objects #' #' @description #' `r lifecycle::badge("stable")` @@ -22,16 +22,23 @@ #' For `modules()` defaults to `"root"`. See `Details`. #' @param server (`function`) `shiny` module with following arguments: #' - `id` - `teal` will set proper `shiny` namespace for this module (see [shiny::moduleServer()]). -#' - `input`, `output`, `session` - (not recommended) then [shiny::callModule()] will be used to call a module. -#' - `data` (optional) module will receive a `teal_data` object, a list of reactive (filtered) data specified in -#' the `filters` argument. -#' - `datasets` (optional) module will receive `FilteredData`. (See [`teal.slice::FilteredData`]). -#' - `reporter` (optional) module will receive `Reporter`. (See [`teal.reporter::Reporter`]). -#' - `filter_panel_api` (optional) module will receive `FilterPanelAPI`. (See [`teal.slice::FilterPanelAPI`]). -#' - `...` (optional) `server_args` elements will be passed to the module named argument or to the `...`. +#' - `input`, `output`, `session` - (optional; not recommended) When provided, then [shiny::callModule()] +#' will be used to call a module. From `shiny` 1.5.0, the recommended way is to use +#' [shiny::moduleServer()] instead which doesn't require these arguments. +#' - `data` (optional) When provided, the module will be called with `teal_data` object (i.e. a list of +#' reactive (filtered) data specified in the `filters` argument) as the value of this argument. +#' - `datasets` (optional) When provided, the module will be called with `FilteredData` object as the +#' value of this argument. (See [`teal.slice::FilteredData`]). +#' - `reporter` (optional) When provided, the module will be called with `Reporter` object as the value +#' of this argument. (See [`teal.reporter::Reporter`]). +#' - `filter_panel_api` (optional) When provided, the module will be called with `FilterPanelAPI` object +#' as the value of this argument. (See [`teal.slice::FilterPanelAPI`]). +#' - `...` (optional) When provided, `server_args` elements will be passed to the module named argument +#' or to the `...`. #' @param ui (`function`) `shiny` UI module function with following arguments: #' - `id` - `teal` will set proper `shiny` namespace for this module. -#' - `...` (optional) `ui_args` elements will be passed to the module named argument or to the `...`. +#' - `...` (optional) When provided, `ui_args` elements will be passed to the module named argument +#' or to the `...`. #' @param filters (`character`) Deprecated. Use `datanames` instead. #' @param datanames (`character`) A vector with `datanames` that are relevant for the item. The #' filter panel will automatically update the shown filters to include only diff --git a/R/validate_inputs.R b/R/validate_inputs.R index b11073af86..c146dc04c6 100644 --- a/R/validate_inputs.R +++ b/R/validate_inputs.R @@ -1,4 +1,4 @@ -#' Send input validation messages to output. +#' Send input validation messages to output #' #' Captures messages from `InputValidator` objects and collates them #' into one message passed to `validate`. diff --git a/man/module_tabs_with_filters.Rd b/man/module_tabs_with_filters.Rd index 46b31dc8fd..5014c415e4 100644 --- a/man/module_tabs_with_filters.Rd +++ b/man/module_tabs_with_filters.Rd @@ -4,7 +4,7 @@ \alias{module_tabs_with_filters} \alias{ui_tabs_with_filters} \alias{srv_tabs_with_filters} -\title{Add right filter panel into each of the top-level \code{teal_modules} UIs.} +\title{Add right filter panel into each of the top-level \code{teal_modules} UIs} \usage{ ui_tabs_with_filters(id, modules, datasets, filter = teal_slices()) diff --git a/man/module_teal_with_splash.Rd b/man/module_teal_with_splash.Rd index edbe3746ff..cc8aa3bc79 100644 --- a/man/module_teal_with_splash.Rd +++ b/man/module_teal_with_splash.Rd @@ -4,7 +4,7 @@ \alias{module_teal_with_splash} \alias{ui_teal_with_splash} \alias{srv_teal_with_splash} -\title{Add splash screen to \code{teal} application.} +\title{Add splash screen to \code{teal} application} \usage{ ui_teal_with_splash( id, diff --git a/man/snapshot_manager_module.Rd b/man/snapshot_manager_module.Rd index 5bf1a6382f..307abaf06a 100644 --- a/man/snapshot_manager_module.Rd +++ b/man/snapshot_manager_module.Rd @@ -6,7 +6,7 @@ \alias{snapshot} \alias{snapshot_manager} \alias{snapshot_manager_srv} -\title{Filter state snapshot management.} +\title{Filter state snapshot management} \usage{ snapshot_manager_ui(id) diff --git a/man/teal_modules.Rd b/man/teal_modules.Rd index e8e0f01fa3..0e5d4aaf77 100644 --- a/man/teal_modules.Rd +++ b/man/teal_modules.Rd @@ -9,7 +9,7 @@ \alias{print.teal_module} \alias{format.teal_modules} \alias{print.teal_modules} -\title{Create \code{teal_module} and \code{teal_modules} objects.} +\title{Create \code{teal_module} and \code{teal_modules} objects} \usage{ module( label = "module", @@ -45,19 +45,26 @@ For \code{modules()} defaults to \code{"root"}. See \code{Details}.} \item{server}{(\code{function}) \code{shiny} module with following arguments: \itemize{ \item \code{id} - \code{teal} will set proper \code{shiny} namespace for this module (see \code{\link[shiny:moduleServer]{shiny::moduleServer()}}). -\item \code{input}, \code{output}, \code{session} - (not recommended) then \code{\link[shiny:callModule]{shiny::callModule()}} will be used to call a module. -\item \code{data} (optional) module will receive a \code{teal_data} object, a list of reactive (filtered) data specified in -the \code{filters} argument. -\item \code{datasets} (optional) module will receive \code{FilteredData}. (See \code{\link[teal.slice:FilteredData]{teal.slice::FilteredData}}). -\item \code{reporter} (optional) module will receive \code{Reporter}. (See \code{\link[teal.reporter:Reporter]{teal.reporter::Reporter}}). -\item \code{filter_panel_api} (optional) module will receive \code{FilterPanelAPI}. (See \code{\link[teal.slice:FilterPanelAPI]{teal.slice::FilterPanelAPI}}). -\item \code{...} (optional) \code{server_args} elements will be passed to the module named argument or to the \code{...}. +\item \code{input}, \code{output}, \code{session} - (optional; not recommended) When provided, then \code{\link[shiny:callModule]{shiny::callModule()}} +will be used to call a module. From \code{shiny} 1.5.0, the recommended way is to use +\code{\link[shiny:moduleServer]{shiny::moduleServer()}} instead which doesn't require these arguments. +\item \code{data} (optional) When provided, the module will be called with \code{teal_data} object (i.e. a list of +reactive (filtered) data specified in the \code{filters} argument) as the value of this argument. +\item \code{datasets} (optional) When provided, the module will be called with \code{FilteredData} object as the +value of this argument. (See \code{\link[teal.slice:FilteredData]{teal.slice::FilteredData}}). +\item \code{reporter} (optional) When provided, the module will be called with \code{Reporter} object as the value +of this argument. (See \code{\link[teal.reporter:Reporter]{teal.reporter::Reporter}}). +\item \code{filter_panel_api} (optional) When provided, the module will be called with \code{FilterPanelAPI} object +as the value of this argument. (See \code{\link[teal.slice:FilterPanelAPI]{teal.slice::FilterPanelAPI}}). +\item \code{...} (optional) When provided, \code{server_args} elements will be passed to the module named argument +or to the \code{...}. }} \item{ui}{(\code{function}) \code{shiny} UI module function with following arguments: \itemize{ \item \code{id} - \code{teal} will set proper \code{shiny} namespace for this module. -\item \code{...} (optional) \code{ui_args} elements will be passed to the module named argument or to the \code{...}. +\item \code{...} (optional) When provided, \code{ui_args} elements will be passed to the module named argument +or to the \code{...}. }} \item{filters}{(\code{character}) Deprecated. Use \code{datanames} instead.} diff --git a/man/validate_inputs.Rd b/man/validate_inputs.Rd index 64d63638fb..50ae876d0e 100644 --- a/man/validate_inputs.Rd +++ b/man/validate_inputs.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/validate_inputs.R \name{validate_inputs} \alias{validate_inputs} -\title{Send input validation messages to output.} +\title{Send input validation messages to output} \usage{ validate_inputs(..., header = "Some inputs require attention") }