Skip to content

Commit 040f0e0

Browse files
Fixes plot settings that did not have an accordion wrapper (#1436)
# Pull Request <!--- Replace `#nnn` with your issue link for reference. --> - Fixes insightsengineering/teal.modules.general#937 Companion PR: - #1436 - insightsengineering/teal.modules.general#939 ### Note to reviewer :information_source: Please check each example app of the affected module ### Changes description - [x] Adds `bslib::accordion` wrapper to plot settings that were missing - [x] Check other modules / encoding if there are any that have the same problem --------- Co-authored-by: Lluís Revilla <[email protected]>
1 parent fad1372 commit 040f0e0

File tree

8 files changed

+176
-157
lines changed

8 files changed

+176
-157
lines changed

R/tm_g_pp_adverse_events.R

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -428,14 +428,16 @@ ui_g_adverse_events <- function(id, ...) {
428428
)
429429
),
430430
ui_decorate_teal_data(ns("d_plot"), decorators = select_decorators(ui_args$decorators, "plot")),
431-
bslib::accordion_panel(
432-
title = "Plot settings",
431+
bslib::accordion(
433432
open = TRUE,
434-
teal.widgets::optionalSliderInputValMinMax(
435-
ns("font_size"),
436-
"Font Size",
437-
ui_args$font_size,
438-
ticks = FALSE, step = 1
433+
bslib::accordion_panel(
434+
title = "Plot settings",
435+
teal.widgets::optionalSliderInputValMinMax(
436+
ns("font_size"),
437+
"Font Size",
438+
ui_args$font_size,
439+
ticks = FALSE, step = 1
440+
)
439441
)
440442
)
441443
),
@@ -631,7 +633,7 @@ srv_g_adverse_events <- function(id,
631633
output$table <- DT::renderDataTable(table_r()[["html"]])
632634

633635
decorated_all_q <- reactive(
634-
# warning because of https://github.com/insightsengineering/teal.modules.clinical/issues/1427 # nolint: line_length_linter.
636+
suppressWarnings(c(table_q(), decorated_all_q_plot())) # warning because of https://github.com/insightsengineering/teal.modules.clinical/issues/1427 # nolint: line_length_linter.
635637
)
636638

637639
set_chunk_dims(pws, decorated_all_q)

R/tm_g_pp_patient_timeline.R

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -701,15 +701,17 @@ ui_g_patient_timeline <- function(id, ...) {
701701
)
702702
),
703703
ui_decorate_teal_data(ns("decorator"), decorators = select_decorators(ui_args$decorators, "plot")),
704-
bslib::accordion_panel(
705-
title = "Plot settings",
704+
bslib::accordion(
706705
open = TRUE,
707-
teal.widgets::optionalSliderInputValMinMax(
708-
ns("font_size"),
709-
"Font Size",
710-
ui_args$font_size,
711-
ticks = FALSE,
712-
step = 1
706+
bslib::accordion_panel(
707+
title = "Plot settings",
708+
teal.widgets::optionalSliderInputValMinMax(
709+
ns("font_size"),
710+
"Font Size",
711+
ui_args$font_size,
712+
ticks = FALSE,
713+
step = 1
714+
)
713715
)
714716
)
715717
),

R/tm_g_pp_therapy.R

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -530,15 +530,17 @@ ui_g_therapy <- function(id, ...) {
530530
is_single_dataset = is_single_dataset_value
531531
),
532532
ui_decorate_teal_data(ns("d_plot"), decorators = select_decorators(ui_args$decorators, "plot")),
533-
bslib::accordion_panel(
534-
title = "Plot settings",
533+
bslib::accordion(
535534
open = TRUE,
536-
teal.widgets::optionalSliderInputValMinMax(
537-
ns("font_size"),
538-
"Font Size",
539-
ui_args$font_size,
540-
ticks = FALSE,
541-
step = 1
535+
bslib::accordion_panel(
536+
title = "Plot settings",
537+
teal.widgets::optionalSliderInputValMinMax(
538+
ns("font_size"),
539+
"Font Size",
540+
ui_args$font_size,
541+
ticks = FALSE,
542+
step = 1
543+
)
542544
)
543545
)
544546
),

R/tm_g_pp_vitals.R

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -394,12 +394,14 @@ ui_g_vitals <- function(id, ...) {
394394
is_single_dataset = is_single_dataset_value
395395
),
396396
ui_decorate_teal_data(ns("decorator"), decorators = select_decorators(ui_args$decorators, "plot")),
397-
bslib::accordion_panel(
398-
title = "Plot settings",
397+
bslib::accordion(
399398
open = TRUE,
400-
teal.widgets::optionalSliderInputValMinMax(
401-
ns("font_size"), "Font Size", ui_args$font_size,
402-
ticks = FALSE, step = 1
399+
bslib::accordion_panel(
400+
title = "Plot settings",
401+
teal.widgets::optionalSliderInputValMinMax(
402+
ns("font_size"), "Font Size", ui_args$font_size,
403+
ticks = FALSE, step = 1
404+
)
403405
)
404406
)
405407
),

R/tm_t_binary_outcome.R

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -721,44 +721,46 @@ ui_t_binary_outcome <- function(id, ...) {
721721
checkboxInput(ns("add_total"), "Add All Patients column", value = a$add_total)
722722
),
723723
ui_decorate_teal_data(ns("decorator"), decorators = select_decorators(a$decorators, "table")),
724-
bslib::accordion_panel(
725-
"Additional table settings",
724+
bslib::accordion(
726725
open = TRUE,
727-
teal.widgets::optionalSelectInput(
728-
inputId = ns("prop_ci_method"),
729-
label = "Method for Proportion CI",
730-
choices = c(
731-
"Wald, without correction" = "wald",
732-
"Wald, with correction" = "waldcc",
733-
"Clopper-Pearson" = "clopper-pearson",
734-
"Wilson" = "wilson",
735-
"Wilson, with correction" = "wilsonc",
736-
"Jeffreys" = "jeffreys",
737-
"Agresti-Coull" = "agresti-coull"
726+
bslib::accordion_panel(
727+
"Additional table settings",
728+
teal.widgets::optionalSelectInput(
729+
inputId = ns("prop_ci_method"),
730+
label = "Method for Proportion CI",
731+
choices = c(
732+
"Wald, without correction" = "wald",
733+
"Wald, with correction" = "waldcc",
734+
"Clopper-Pearson" = "clopper-pearson",
735+
"Wilson" = "wilson",
736+
"Wilson, with correction" = "wilsonc",
737+
"Jeffreys" = "jeffreys",
738+
"Agresti-Coull" = "agresti-coull"
739+
),
740+
selected = a$control$global$method,
741+
multiple = FALSE,
742+
fixed = FALSE
738743
),
739-
selected = a$control$global$method,
740-
multiple = FALSE,
741-
fixed = FALSE
742-
),
743-
teal.widgets::optionalSelectInput(
744-
inputId = ns("conf_level"),
745-
label = "Confidence Level",
746-
a$conf_level$choices,
747-
a$conf_level$selected,
748-
multiple = FALSE,
749-
fixed = a$conf_level$fixed
744+
teal.widgets::optionalSelectInput(
745+
inputId = ns("conf_level"),
746+
label = "Confidence Level",
747+
a$conf_level$choices,
748+
a$conf_level$selected,
749+
multiple = FALSE,
750+
fixed = a$conf_level$fixed
751+
),
752+
bslib::input_switch(
753+
id = ns("show_rsp_cat"),
754+
label = "Show All Response Categories",
755+
value = ifelse(a$rsp_table, TRUE, FALSE)
756+
)
750757
),
751-
bslib::input_switch(
752-
id = ns("show_rsp_cat"),
753-
label = "Show All Response Categories",
754-
value = ifelse(a$rsp_table, TRUE, FALSE)
758+
teal.transform::data_extract_ui(
759+
id = ns("aval_var"),
760+
label = "Analysis Variable",
761+
data_extract_spec = a$aval_var,
762+
is_single_dataset = is_single_dataset_value
755763
)
756-
),
757-
teal.transform::data_extract_ui(
758-
id = ns("aval_var"),
759-
label = "Analysis Variable",
760-
data_extract_spec = a$aval_var,
761-
is_single_dataset = is_single_dataset_value
762764
)
763765
),
764766
pre_output = a$pre_output,

R/tm_t_events.R

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -636,42 +636,44 @@ ui_t_events_byterm <- function(id, ...) {
636636
),
637637
checkboxInput(ns("add_total"), "Add All Patients columns", value = a$add_total),
638638
ui_decorate_teal_data(ns("decorator"), decorators = select_decorators(a$decorators, "table")),
639-
bslib::accordion_panel(
640-
"Additional table settings",
639+
bslib::accordion(
641640
open = TRUE,
642-
checkboxInput(
643-
ns("drop_arm_levels"),
644-
label = "Drop columns not in filtered analysis dataset",
645-
value = a$drop_arm_levels
646-
),
647-
selectInput(
648-
inputId = ns("sort_criteria"),
649-
label = "Sort Criteria",
650-
choices = c(
651-
"Decreasing frequency" = "freq_desc",
652-
"Alphabetically" = "alpha"
641+
bslib::accordion_panel(
642+
"Additional table settings",
643+
checkboxInput(
644+
ns("drop_arm_levels"),
645+
label = "Drop columns not in filtered analysis dataset",
646+
value = a$drop_arm_levels
653647
),
654-
selected = a$sort_criteria,
655-
multiple = FALSE
656-
),
657-
helpText(tags$strong("Pruning Options:")),
658-
numericInput(
659-
inputId = ns("prune_freq"),
660-
label = "Minimum Incidence Rate(%) in any of the treatment groups",
661-
value = a$prune_freq,
662-
min = 0,
663-
max = 100,
664-
step = 1,
665-
width = "100%"
666-
),
667-
numericInput(
668-
inputId = ns("prune_diff"),
669-
label = "Minimum Difference Rate(%) between any of the treatment groups",
670-
value = a$prune_diff,
671-
min = 0,
672-
max = 100,
673-
step = 1,
674-
width = "100%"
648+
selectInput(
649+
inputId = ns("sort_criteria"),
650+
label = "Sort Criteria",
651+
choices = c(
652+
"Decreasing frequency" = "freq_desc",
653+
"Alphabetically" = "alpha"
654+
),
655+
selected = a$sort_criteria,
656+
multiple = FALSE
657+
),
658+
helpText(tags$strong("Pruning Options:")),
659+
numericInput(
660+
inputId = ns("prune_freq"),
661+
label = "Minimum Incidence Rate(%) in any of the treatment groups",
662+
value = a$prune_freq,
663+
min = 0,
664+
max = 100,
665+
step = 1,
666+
width = "100%"
667+
),
668+
numericInput(
669+
inputId = ns("prune_diff"),
670+
label = "Minimum Difference Rate(%) between any of the treatment groups",
671+
value = a$prune_diff,
672+
min = 0,
673+
max = 100,
674+
step = 1,
675+
width = "100%"
676+
)
675677
)
676678
)
677679
),

R/tm_t_glm_counts.R

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -211,17 +211,21 @@ ui_t_glm_counts <- function(id, ...) {
211211
)
212212
)
213213

214-
table_settings <- bslib::accordion_panel(
215-
"Additional table settings",
216-
teal.widgets::optionalSelectInput(
217-
inputId = ns("conf_level"),
218-
label = "Confidence Level",
219-
choices = c(0.8, 0.9, 0.95),
220-
selected = 0.95,
221-
multiple = FALSE,
222-
fixed = FALSE
223-
),
214+
table_settings <- shiny::tagList(
224215
ui_decorate_teal_data(ns("decorator"), decorators = select_decorators(a$decorators, "table")),
216+
bslib::accordion(
217+
bslib::accordion_panel(
218+
"Additional table settings",
219+
teal.widgets::optionalSelectInput(
220+
inputId = ns("conf_level"),
221+
label = "Confidence Level",
222+
choices = c(0.8, 0.9, 0.95),
223+
selected = 0.95,
224+
multiple = FALSE,
225+
fixed = FALSE
226+
),
227+
)
228+
)
225229
)
226230

227231
teal.widgets::standard_layout(
@@ -269,7 +273,7 @@ ui_t_glm_counts <- function(id, ...) {
269273
"Rate method",
270274
choices = a$rate_mean_method
271275
),
272-
table_settings,
276+
table_settings
273277
),
274278
pre_output = a$pre_output,
275279
post_output = a$post_output

0 commit comments

Comments
 (0)