|
1 | 1 | #' Show report previewer button module |
2 | 2 | #' |
3 | 3 | #' @description `r lifecycle::badge("experimental")` |
4 | | -#' |
5 | 4 | #' Provides a button that triggers showing the report preview in a modal. |
6 | 5 | #' |
7 | 6 | #' For more details see the vignette: `vignette("previewerReporter", "teal.reporter")`. |
|
15 | 14 | #' @return `NULL`. |
16 | 15 | NULL |
17 | 16 |
|
18 | | -#' Report previewer module |
19 | | -#' |
20 | | -#' @description `r lifecycle::badge("deprecated")` |
21 | | -#' |
22 | | -#' Module offers functionalities to visualize, manipulate, |
23 | | -#' and interact with report cards that have been added to a report. |
24 | | -#' It includes a previewer interface to see the cards and options to modify the report before downloading. |
25 | | -#' |
26 | | -#' Cards are saved by the `shiny` bookmarking mechanism. |
27 | | -#' |
28 | | -#' For more details see the vignette: `vignette("previewerReporter", "teal.reporter")`. |
29 | | -#' |
30 | | -#' This function is deprecated and will be removed in the next release. |
31 | | -#' Please use `preview_report_button_ui()` and `preview_report_button_srv()` |
32 | | -#' to create a preview button that opens a modal with the report preview. |
33 | | -#' |
34 | | -#' @details `r global_knitr_details()` |
35 | | -#' |
36 | | -#' @name reporter_previewer_deprecated |
37 | | -#' |
38 | | -#' @param id (`character(1)`) `shiny` module instance id. |
39 | | -#' @param reporter (`Reporter`) instance. |
40 | | -#' @param global_knitr (`list`) of `knitr` parameters (passed to `knitr::opts_chunk$set`) |
41 | | -#' for customizing the rendering process. |
42 | | -#' @param previewer_buttons (`character`) set of modules to include with `c("download", "load", "reset")` possible |
43 | | -#' values and `"download"` is required. |
44 | | -#' Default `c("download", "load", "reset")` |
45 | | -#' @inheritParams reporter_download_inputs |
46 | | -#' |
47 | | -#' @return `NULL`. |
48 | | -NULL |
49 | | - |
50 | 17 | #' @rdname reporter_previewer |
51 | 18 | #' @export |
52 | 19 | preview_report_button_ui <- function(id, label = "Preview Report") { |
@@ -111,12 +78,48 @@ preview_report_button_srv <- function(id, reporter) { |
111 | 78 | }) |
112 | 79 | } |
113 | 80 |
|
| 81 | + |
| 82 | +# deprecated ------------------------------------------------------------------------------------------------------ |
| 83 | + |
| 84 | + |
| 85 | +#' Report previewer module |
| 86 | +#' |
| 87 | +#' @description `r lifecycle::badge("deprecated")` |
| 88 | +#' |
| 89 | +#' Module offers functionalities to visualize, manipulate, |
| 90 | +#' and interact with report cards that have been added to a report. |
| 91 | +#' It includes a previewer interface to see the cards and options to modify the report before downloading. |
| 92 | +#' |
| 93 | +#' Cards are saved by the `shiny` bookmarking mechanism. |
| 94 | +#' |
| 95 | +#' For more details see the vignette: `vignette("previewerReporter", "teal.reporter")`. |
| 96 | +#' |
| 97 | +#' This function is deprecated and will be removed in the next release. |
| 98 | +#' Please use `preview_report_button_ui()` and `preview_report_button_srv()` |
| 99 | +#' to create a preview button that opens a modal with the report preview. |
| 100 | +#' |
| 101 | +#' @details `r global_knitr_details()` |
| 102 | +#' |
| 103 | +#' @name reporter_previewer_deprecated |
| 104 | +#' |
| 105 | +#' @param id (`character(1)`) `shiny` module instance id. |
| 106 | +#' @param reporter (`Reporter`) instance. |
| 107 | +#' @param global_knitr (`list`) of `knitr` parameters (passed to `knitr::opts_chunk$set`) |
| 108 | +#' for customizing the rendering process. |
| 109 | +#' @param previewer_buttons (`character`) set of modules to include with `c("download", "load", "reset")` possible |
| 110 | +#' values and `"download"` is required. |
| 111 | +#' Default `c("download", "load", "reset")` |
| 112 | +#' @inheritParams reporter_download_inputs |
| 113 | +#' |
| 114 | +#' @return `NULL`. |
| 115 | +NULL |
| 116 | + |
114 | 117 | #' @rdname reporter_previewer_deprecated |
115 | 118 | #' @export |
116 | 119 | reporter_previewer_ui <- function(id) { |
117 | 120 | ns <- shiny::NS(id) |
118 | 121 | lifecycle::deprecate_soft( |
119 | | - when = "", |
| 122 | + when = "0.4.1", |
120 | 123 | what = "reporter_previewer_ui()", |
121 | 124 | details = paste( |
122 | 125 | "Calling `reporter_previewer_ui()` is deprecated and will be removed in the next release.\n", |
@@ -152,7 +155,7 @@ reporter_previewer_srv <- function(id, |
152 | 155 | rmd_yaml_args = getOption("teal.reporter.rmd_yaml_args"), |
153 | 156 | previewer_buttons = c("download", "load", "reset")) { |
154 | 157 | lifecycle::deprecate_soft( |
155 | | - when = "", |
| 158 | + when = "0.4.1", |
156 | 159 | what = "reporter_previewer_srv()", |
157 | 160 | details = paste( |
158 | 161 | "Calling `reporter_previewer_srv()` is deprecated and will be removed in the next release.\n", |
@@ -200,6 +203,9 @@ reporter_previewer_srv <- function(id, |
200 | 203 | }) |
201 | 204 | } |
202 | 205 |
|
| 206 | + |
| 207 | +# reporter_previewer_content -------------------------------------------------------------------------------------- |
| 208 | + |
203 | 209 | #' @keywords internal |
204 | 210 | reporter_previewer_content_ui <- function(id) { |
205 | 211 | shiny::uiOutput(shiny::NS(id, "pcards")) |
@@ -322,29 +328,3 @@ block_to_html <- function(b) { |
322 | 328 | stop("Unknown block class") |
323 | 329 | } |
324 | 330 | } |
325 | | - |
326 | | -#' @noRd |
327 | | -#' @keywords internal |
328 | | -previewer_collapse_item <- function(idx, card_name, card_blocks) { |
329 | | - htmltools::tagAppendChildren( |
330 | | - tag = bslib::accordion_panel( |
331 | | - title = paste0("Card ", idx, ": ", card_name), |
332 | | - shiny::tags$div( |
333 | | - id = paste0("card", idx), |
334 | | - lapply( |
335 | | - card_blocks, |
336 | | - function(b) { |
337 | | - block_to_html(b) |
338 | | - } |
339 | | - ) |
340 | | - ) |
341 | | - ), |
342 | | - .cssSelector = ".accordion-header", |
343 | | - shiny::actionButton( |
344 | | - inputId = paste0("card_remove_id_", idx), |
345 | | - label = "Remove card", |
346 | | - class = "card_remove_id", |
347 | | - `data-cardid` = idx |
348 | | - ) |
349 | | - ) |
350 | | -} |
0 commit comments