Skip to content

Commit

Permalink
Merge branch 'main' into register_handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelru authored Mar 20, 2024
2 parents 655dd14 + 1fc1653 commit 657f3dd
Show file tree
Hide file tree
Showing 21 changed files with 127 additions and 106 deletions.
9 changes: 5 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Type: Package
Package: teal.modules.general
Title: General Modules for 'teal' Applications
Version: 0.3.0.9000
Date: 2024-03-05
Version: 0.3.0.9003
Date: 2024-03-18
Authors@R: c(
person("Dawid", "Kaledkowski", , "[email protected]", role = c("aut", "cre")),
person("Pawel", "Rucki", , "[email protected]", role = "aut"),
Expand Down Expand Up @@ -71,7 +71,8 @@ Suggests:
rlang (>= 1.0.0),
rtables (>= 0.6.6),
sparkline,
testthat (>= 3.0.4)
testthat (>= 3.0.4),
withr (>= 2.0.0)
VignetteBuilder:
knitr
Config/Needs/verdepcheck: haleyjeppson/ggmosaic, tidyverse/ggplot2,
Expand All @@ -89,7 +90,7 @@ Config/Needs/verdepcheck: haleyjeppson/ggmosaic, tidyverse/ggplot2,
jeroen/jsonlite, yihui/knitr, deepayan/lattice, daroczig/logger, MASS,
insightsengineering/nestcolor, r-lib/rlang,
insightsengineering/rtables, sparkline, insightsengineering/teal.data,
r-lib/testthat
r-lib/testthat, r-lib/withr
Config/Needs/website: insightsengineering/nesttemplate
Encoding: UTF-8
Language: en-US
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# teal.modules.general 0.3.0.9000
# teal.modules.general 0.3.0.9003

# teal.modules.general 0.3.0

Expand Down
12 changes: 6 additions & 6 deletions R/tm_a_pca.R
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,13 @@ ui_a_pca <- function(id, ...) {
color_selector[[i]]$select$selected <- NULL
}

shiny::tagList(
tagList(
include_css_files("custom"),
teal.widgets::standard_layout(
output = teal.widgets::white_small_well(
uiOutput(ns("all_plots"))
),
encoding = div(
encoding = tags$div(
### Reporter
teal.reporter::simple_reporter_ui(ns("simple_reporter")),
###
Expand Down Expand Up @@ -986,11 +986,11 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl

output$tbl_importance_ui <- renderUI({
req("importance" %in% input$tables_display)
div(
tags$div(
align = "center",
tags$h4("Principal components importance"),
tableOutput(session$ns("tbl_importance")),
hr()
tags$hr()
)
})

Expand All @@ -1006,11 +1006,11 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl

output$tbl_eigenvector_ui <- renderUI({
req("eigenvector" %in% input$tables_display)
div(
tags$div(
align = "center",
tags$h4("Eigenvectors"),
tableOutput(session$ns("tbl_eigenvector")),
hr()
tags$hr()
)
})

Expand Down
10 changes: 5 additions & 5 deletions R/tm_a_regression.R
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ ui_a_regression <- function(id, ...) {
teal.widgets::plot_with_settings_ui(id = ns("myplot")),
tags$div(verbatimTextOutput(ns("text")))
)),
encoding = div(
encoding = tags$div(
### Reporter
teal.reporter::simple_reporter_ui(ns("simple_reporter")),
###
Expand Down Expand Up @@ -284,12 +284,12 @@ ui_a_regression <- function(id, ...) {
ns = ns,
teal.widgets::optionalSliderInput(
ns("outlier"),
div(
tags$div(
class = "teal-tooltip",
tagList(
"Outlier definition:",
icon("circle-info"),
span(
tags$span(
class = "tooltiptext",
paste(
"Use the slider to choose the cut-off value to define outliers.",
Expand All @@ -314,12 +314,12 @@ ui_a_regression <- function(id, ...) {
teal.widgets::optionalSliderInputValMinMax(ns("size"), "Points size:", args$size, ticks = FALSE),
teal.widgets::optionalSliderInputValMinMax(
inputId = ns("label_min_segment"),
label = div(
label = tags$div(
class = "teal-tooltip",
tagList(
"Label min. segment:",
icon("circle-info"),
span(
tags$span(
class = "tooltiptext",
paste(
"Use the slider to choose the cut-off value to define minimum distance between label and point",
Expand Down
4 changes: 2 additions & 2 deletions R/tm_data_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ ui_page_data_table <- function(id,
post_output = NULL) {
ns <- NS(id)

shiny::tagList(
tagList(
include_css_files("custom"),
teal.widgets::standard_layout(
output = teal.widgets::white_small_well(
Expand Down Expand Up @@ -220,7 +220,7 @@ srv_page_data_table <- function(id,
title = x,
column(
width = 12,
div(
tags$div(
class = "mt-4",
ui_data_table(
id = session$ns(x),
Expand Down
6 changes: 3 additions & 3 deletions R/tm_file_viewer.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ ui_viewer <- function(id, ...) {
args <- list(...)
ns <- NS(id)

shiny::tagList(
tagList(
include_css_files("custom"),
teal.widgets::standard_layout(
output = div(
output = tags$div(
uiOutput(ns("output"))
),
encoding = div(
encoding = tags$div(
class = "file_viewer_encoding",
tags$label("Encodings", class = "text-primary"),
shinyTree::shinyTree(
Expand Down
6 changes: 3 additions & 3 deletions R/tm_g_association.R
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ ui_tm_g_association <- function(id, ...) {
tags$br(),
teal.widgets::plot_with_settings_ui(id = ns("myplot"))
),
encoding = div(
encoding = tags$div(
### Reporter
teal.reporter::simple_reporter_ui(ns("simple_reporter")),
###
Expand Down Expand Up @@ -488,8 +488,8 @@ srv_tm_g_association <- function(id,
)
})

plot_r <- shiny::reactive({
shiny::req(iv_r()$is_valid())
plot_r <- reactive({
req(iv_r()$is_valid())
output_q()[["p"]]
})

Expand Down
14 changes: 7 additions & 7 deletions R/tm_g_bivariate.R
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ ui_g_bivariate <- function(id, ...) {
output = teal.widgets::white_small_well(
tags$div(teal.widgets::plot_with_settings_ui(id = ns("myplot")))
),
encoding = div(
encoding = tags$div(
### Reporter
teal.reporter::simple_reporter_ui(ns("simple_reporter")),
###
Expand Down Expand Up @@ -344,13 +344,13 @@ ui_g_bivariate <- function(id, ...) {
)
),
if (!is.null(args$row_facet) || !is.null(args$col_facet)) {
div(
tags$div(
class = "data-extract-box",
tags$label("Facetting"),
shinyWidgets::switchInput(inputId = ns("facetting"), value = args$facet, size = "mini"),
conditionalPanel(
condition = paste0("input['", ns("facetting"), "']"),
div(
tags$div(
if (!is.null(args$row_facet)) {
teal.transform::data_extract_ui(
id = ns("row_facet"),
Expand All @@ -375,13 +375,13 @@ ui_g_bivariate <- function(id, ...) {
},
if (args$color_settings) {
# Put a grey border around the coloring settings
div(
tags$div(
class = "data-extract-box",
tags$label("Color settings"),
shinyWidgets::switchInput(inputId = ns("coloring"), value = TRUE, size = "mini"),
conditionalPanel(
condition = paste0("input['", ns("coloring"), "']"),
div(
tags$div(
teal.transform::data_extract_ui(
id = ns("color"),
label = "Outline color by variable",
Expand All @@ -394,7 +394,7 @@ ui_g_bivariate <- function(id, ...) {
data_extract_spec = args$fill,
is_single_dataset = is_single_dataset_value
),
div(
tags$div(
id = ns("size_settings"),
teal.transform::data_extract_ui(
id = ns("size"),
Expand Down Expand Up @@ -674,7 +674,7 @@ srv_g_bivariate <- function(id,
teal.code::eval_code(print_call)
})

plot_r <- shiny::reactive({
plot_r <- reactive({
output_q()[["p"]]
})

Expand Down
12 changes: 6 additions & 6 deletions R/tm_g_distribution.R
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,12 @@ ui_distribution <- function(id, ...) {
tabPanel("Histogram", teal.widgets::plot_with_settings_ui(id = ns("hist_plot"))),
tabPanel("QQplot", teal.widgets::plot_with_settings_ui(id = ns("qq_plot")))
),
h3("Statistics Table"),
tags$h3("Statistics Table"),
DT::dataTableOutput(ns("summary_table")),
h3("Tests"),
tags$h3("Tests"),
DT::dataTableOutput(ns("t_stats"))
),
encoding = div(
encoding = tags$div(
### Reporter
teal.reporter::simple_reporter_ui(ns("simple_reporter")),
###
Expand Down Expand Up @@ -274,12 +274,12 @@ ui_distribution <- function(id, ...) {
"Theoretical Distribution",
teal.widgets::optionalSelectInput(
ns("t_dist"),
div(
tags$div(
class = "teal-tooltip",
tagList(
"Distribution:",
icon("circle-info"),
span(
tags$span(
class = "tooltiptext",
"Default parameters are optimized with MASS::fitdistr function."
)
Expand All @@ -291,7 +291,7 @@ ui_distribution <- function(id, ...) {
),
numericInput(ns("dist_param1"), label = "param1", value = NULL),
numericInput(ns("dist_param2"), label = "param2", value = NULL),
span(actionButton(ns("params_reset"), "Reset params")),
tags$span(actionButton(ns("params_reset"), "Reset params")),
collapsed = FALSE
)
)
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_response.R
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ ui_g_response <- function(id, ...) {
output = teal.widgets::white_small_well(
teal.widgets::plot_with_settings_ui(id = ns("myplot"))
),
encoding = div(
encoding = tags$div(
### Reporter
teal.reporter::simple_reporter_ui(ns("simple_reporter")),
###
Expand Down
16 changes: 8 additions & 8 deletions R/tm_g_scatterplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ ui_g_scatterplot <- function(id, ...) {
args$x, args$y, args$color_by, args$size_by, args$row_facet, args$col_facet
)

shiny::tagList(
tagList(
include_css_files("custom"),
teal.widgets::standard_layout(
output = teal.widgets::white_small_well(
Expand All @@ -338,7 +338,7 @@ ui_g_scatterplot <- function(id, ...) {
teal.widgets::get_dt_rows(ns("data_table"), ns("data_table_rows")),
DT::dataTableOutput(ns("data_table"), width = "100%")
),
encoding = div(
encoding = tags$div(
### Reporter
teal.reporter::simple_reporter_ui(ns("simple_reporter")),
###
Expand Down Expand Up @@ -432,19 +432,19 @@ ui_g_scatterplot <- function(id, ...) {
shinyjs::hidden(checkboxInput(ns("show_form"), "Show formula", value = TRUE)),
shinyjs::hidden(checkboxInput(ns("show_r2"), "Show adj-R Squared", value = TRUE)),
uiOutput(ns("num_na_removed")),
div(
tags$div(
id = ns("label_pos"),
div(strong("Stats position")),
div(class = "inline-block w-10", helpText("Left")),
div(
tags$div(tags$strong("Stats position")),
tags$div(class = "inline-block w-10", helpText("Left")),
tags$div(
class = "inline-block w-70",
teal.widgets::optionalSliderInput(
ns("pos"),
label = NULL,
min = 0, max = 1, value = .99, ticks = FALSE, step = .01
)
),
div(class = "inline-block w-10", helpText("Right"))
tags$div(class = "inline-block w-10", helpText("Right"))
),
teal.widgets::optionalSliderInput(
ns("label_size"), "Stats font size",
Expand Down Expand Up @@ -599,7 +599,7 @@ srv_g_scatterplot <- function(id,
x_var <- as.vector(merged$anl_input_r()$columns_source$x)
y_var <- as.vector(merged$anl_input_r()$columns_source$y)
if ((num_total_na <- nrow(ANL) - nrow(stats::na.omit(ANL[, c(x_var, y_var)]))) > 0) {
shiny::tags$div(paste(num_total_na, "row(s) with missing values were removed"), shiny::tags$hr())
tags$div(paste(num_total_na, "row(s) with missing values were removed"), tags$hr())
}
}
})
Expand Down
8 changes: 4 additions & 4 deletions R/tm_g_scatterplotmatrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,10 @@ ui_g_scatterplotmatrix <- function(id, ...) {
teal.widgets::standard_layout(
output = teal.widgets::white_small_well(
textOutput(ns("message")),
br(),
tags$br(),
teal.widgets::plot_with_settings_ui(id = ns("myplot"))
),
encoding = div(
encoding = tags$div(
### Reporter
teal.reporter::simple_reporter_ui(ns("simple_reporter")),
###
Expand All @@ -224,7 +224,7 @@ ui_g_scatterplotmatrix <- function(id, ...) {
data_extract_spec = args$variables,
is_single_dataset = is_single_dataset_value
),
hr(),
tags$hr(),
teal.widgets::panel_group(
teal.widgets::panel_item(
title = "Plot settings",
Expand Down Expand Up @@ -419,7 +419,7 @@ srv_g_scatterplotmatrix <- function(id, data, reporter, filter_panel_api, variab

# show a message if conversion to factors took place
output$message <- renderText({
shiny::req(iv_r()$is_valid())
req(iv_r()$is_valid())
req(selector_list()$variables())
ANL <- merged$anl_q_r()[["ANL"]]
cols_names <- unique(unname(do.call(c, merged$anl_input_r()$columns_source)))
Expand Down
Loading

0 comments on commit 657f3dd

Please sign in to comment.