Skip to content

Commit 99fdc87

Browse files
committed
Merge remote-tracking branch 'origin/main' into poc3@spotfire_poc2
# Conflicts: # R/tm_g_scatterplot.R # R/utils.R
2 parents f9f5bf9 + 28ce726 commit 99fdc87

22 files changed

+748
-731
lines changed

.pre-commit-config.yaml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ default_language_version:
66
python: python3
77
repos:
88
- repo: https://github.com/lorenzwalthert/precommit
9-
rev: v0.4.3.9013
9+
rev: v0.4.3.9014
1010
hooks:
1111
- id: style-files
1212
name: Style code with `styler`
@@ -18,33 +18,45 @@ repos:
1818
- ggmosaic
1919
- ggplot2
2020
- shiny
21+
- insightsengineering/teal
22+
- insightsengineering/teal.transform
23+
- bslib
2124
- checkmate
25+
- colourpicker
2226
- dplyr
2327
- DT
2428
- forcats
29+
- ggExtra
30+
- ggpmisc
31+
- ggpp
32+
- ggrepel
33+
- goftest
2534
- grid
26-
- logger
35+
- gridExtra
36+
- htmlwidgets
37+
- jsonlite
38+
- lattice
39+
- lifecycle
40+
- MASS
41+
- rtables
2742
- scales
2843
- shinyjs
2944
- shinyTree
3045
- shinyvalidate
3146
- shinyWidgets
47+
- sparkline
3248
- stats
3349
- stringr
34-
- insightsengineering/roxy.shinylive
35-
- insightsengineering/teal
36-
- insightsengineering/teal.transform
3750
- insightsengineering/teal.code
3851
- insightsengineering/teal.data
3952
- insightsengineering/teal.logger
4053
- insightsengineering/teal.reporter
41-
- insightsengineering/teal.slice
4254
- insightsengineering/teal.widgets
4355
- tern
4456
- tibble
4557
- tidyr
46-
- utils
47-
58+
- insightsengineering/teal.slice
59+
- insightsengineering/roxy.shinylive
4860
- id: spell-check
4961
name: Check spelling with `spelling`
5062
exclude: >

DESCRIPTION

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Type: Package
22
Package: teal.modules.general
33
Title: General Modules for 'teal' Applications
4-
Version: 0.4.1.9020
5-
Date: 2025-08-20
4+
Version: 0.5.0.9001
5+
Date: 2025-09-09
66
Authors@R: c(
77
person("Dawid", "Kaledkowski", , "[email protected]", role = c("aut", "cre")),
88
person("Pawel", "Rucki", , "[email protected]", role = "aut"),
@@ -27,8 +27,8 @@ Depends:
2727
ggplot2 (>= 3.4.0),
2828
R (>= 4.1),
2929
shiny (>= 1.8.1),
30-
teal (>= 0.16.0.9008),
31-
teal.transform (>= 0.6.0.9002)
30+
teal (>= 1.0.0.9003),
31+
teal.transform (>= 0.7.0)
3232
Imports:
3333
bslib (>= 0.8.0),
3434
checkmate (>= 2.1.0),
@@ -67,10 +67,10 @@ Imports:
6767
stats,
6868
stringr (>= 1.4.1),
6969
teal.code (>= 0.7.0),
70-
teal.data (>= 0.7.0),
70+
teal.data (>= 0.8.0),
7171
teal.logger (>= 0.4.0),
72-
teal.reporter (>= 0.5.0),
73-
teal.widgets (>= 0.4.3.9005),
72+
teal.reporter (>= 0.5.0.9001),
73+
teal.widgets (>= 0.5.0),
7474
tern (>= 0.9.7),
7575
tibble (>= 2.0.0),
7676
tidyr (>= 0.8.3),
@@ -90,9 +90,8 @@ VignetteBuilder:
9090
knitr,
9191
rmarkdown
9292
Remotes:
93-
insightsengineering/teal.transform@main,
94-
insightsengineering/teal.widgets@main,
95-
insightsengineering/teal@main
93+
insightsengineering/teal,
94+
insightsengineering/teal.reporter
9695
Config/Needs/verdepcheck: haleyjeppson/ggmosaic, tidyverse/ggplot2,
9796
rstudio/shiny, insightsengineering/teal,
9897
insightsengineering/teal.transform, mllg/checkmate, tidyverse/dplyr,
@@ -115,4 +114,4 @@ Encoding: UTF-8
115114
Language: en-US
116115
LazyData: true
117116
Roxygen: list(markdown = TRUE, packages = c("roxy.shinylive"))
118-
RoxygenNote: 7.3.2
117+
RoxygenNote: 7.3.3

NEWS.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# teal.modules.general 0.4.1.9020
1+
# teal.modules.general 0.5.0.9001
2+
3+
# teal.modules.general 0.5.0
24

35
### Breaking changes
46

@@ -8,19 +10,20 @@
810
### Bug fixes
911

1012
- Fixed "Add to Report" functionality in `tm_outliers`, `tm_missing_data` and `tm_g_distribution` modules (#899 and #897).
13+
- Fixes a bug in `tm_outliers` that fails when data has no join keys (#650).
1114

12-
### Miscellaneous
15+
### Enhancements
1316

17+
- Improved the layout and appearance of the app using `bslib` components.
1418
- Fixed deprecation warning for `tern::stack_grobs` in `tm_g_association` (#903).
19+
- Allow search feature in `tm_file_viewer` (#152).
20+
- Added `remove_zero_columns` to `tm_t_crosstable` to add an option to remove empty columns (#890)
1521

1622
# teal.modules.general 0.4.1
1723

1824
### Bug fixes
1925
* Fixes output is not updated when filter is added for the modules: `tm_a_pca`, `tm_a_regression`, `tm_g_scatterplot`, `tm_g_association`, `tm_g_bivariate`, `tm_g_distribution`, `tm_g_response`, `tm_t_crosstable` (#870)
2026

21-
### Enhancements
22-
* Added `remove_zero_columns` to `tm_t_crosstable` to add an option to remove empty columns (#890)
23-
2427
# teal.modules.general 0.4.0
2528

2629
### Enhancements

R/tm_a_pca.R

Lines changed: 26 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
#' To learn more please refer to the vignette
4848
#' `vignette("transform-module-output", package = "teal")` or the [`teal::teal_transform_module()`] documentation.
4949
#'
50+
#' @inheritSection teal::example_module Reporting
51+
#'
5052
#' @examplesShinylive
5153
#' library(teal.modules.general)
5254
#' interactive <- function() TRUE
@@ -234,10 +236,6 @@ ui_a_pca <- function(id, ...) {
234236
uiOutput(ns("all_plots"))
235237
),
236238
encoding = tags$div(
237-
### Reporter
238-
teal.reporter::add_card_button_ui(ns("add_reporter"), label = "Add Report Card"),
239-
tags$br(), tags$br(),
240-
###
241239
tags$label("Encodings", class = "text-primary"),
242240
teal.transform::datanames_input(args["dat"]),
243241
teal.transform::data_extract_ui(
@@ -353,9 +351,7 @@ ui_a_pca <- function(id, ...) {
353351
}
354352

355353
# Server function for the PCA module
356-
srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, plot_width, ggplot2_args, decorators) {
357-
with_reporter <- !missing(reporter) && inherits(reporter, "Reporter")
358-
with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI")
354+
srv_a_pca <- function(id, data, dat, plot_height, plot_width, ggplot2_args, decorators) {
359355
checkmate::assert_class(data, "reactive")
360356
checkmate::assert_class(isolate(data()), "teal_data")
361357
moduleServer(id, function(input, output, session) {
@@ -436,9 +432,16 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
436432
selector_list = selector_list,
437433
datasets = data
438434
)
439-
qenv <- reactive(
440-
teal.code::eval_code(data(), 'library("ggplot2");library("dplyr");library("tidyr")') # nolint quotes
441-
)
435+
qenv <- reactive({
436+
obj <- data()
437+
teal.reporter::teal_card(obj) <-
438+
c(
439+
teal.reporter::teal_card("# Principal Component Analysis"),
440+
teal.reporter::teal_card(obj),
441+
teal.reporter::teal_card("## Module's code")
442+
)
443+
teal.code::eval_code(obj, 'library("ggplot2");library("dplyr");library("tidyr")') # nolint: quotes
444+
})
442445
anl_merged_q <- reactive({
443446
req(anl_merged_input())
444447
qenv() %>%
@@ -514,6 +517,8 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
514517
)
515518
)
516519

520+
teal.reporter::teal_card(qenv) <- c(teal.reporter::teal_card(qenv), "## Principal Components Table")
521+
517522
qenv <- teal.code::eval_code(
518523
qenv,
519524
quote({
@@ -522,6 +527,8 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
522527
})
523528
)
524529

530+
teal.reporter::teal_card(qenv) <- c(teal.reporter::teal_card(qenv), "## Eigenvectors Table")
531+
525532
teal.code::eval_code(
526533
qenv,
527534
quote({
@@ -602,7 +609,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
602609
),
603610
ggtheme = ggtheme
604611
)
605-
612+
teal.reporter::teal_card(base_q) <- c(teal.reporter::teal_card(base_q), "## Elbow plot")
606613
teal.code::eval_code(
607614
base_q,
608615
substitute(
@@ -679,6 +686,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
679686
ggtheme = ggtheme
680687
)
681688

689+
teal.reporter::teal_card(base_q) <- c(teal.reporter::teal_card(base_q), "## Circle plot")
682690
teal.code::eval_code(
683691
base_q,
684692
substitute(
@@ -737,6 +745,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
737745
size <- input$size
738746
font_size <- input$font_size
739747

748+
teal.reporter::teal_card(base_q) <- c(teal.reporter::teal_card(base_q), "## Biplot")
740749
qenv <- teal.code::eval_code(
741750
qenv,
742751
substitute(
@@ -997,6 +1006,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
9971006
parsed_ggplot2_args$theme
9981007
)
9991008

1009+
teal.reporter::teal_card(base_q) <- c(teal.reporter::teal_card(base_q), "## Eigenvector plot")
10001010
teal.code::eval_code(
10011011
base_q,
10021012
substitute(
@@ -1038,9 +1048,8 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
10381048
data = q,
10391049
decorators = select_decorators(decorators, obj_name),
10401050
expr = reactive({
1041-
substitute(print(.plot), env = list(.plot = as.name(obj_name)))
1042-
}),
1043-
expr_is_reactive = TRUE
1051+
substitute(.plot, env = list(.plot = as.name(obj_name)))
1052+
})
10441053
)
10451054
},
10461055
names(output_q),
@@ -1071,6 +1080,8 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
10711080
graph_align = "center"
10721081
)
10731082

1083+
decorated_output_dims_q <- set_chunk_dims(pws, decorated_output_q)
1084+
10741085
# tables ----
10751086
output$tbl_importance <- renderTable(
10761087
expr = {
@@ -1132,31 +1143,6 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
11321143
verbatim_content = source_code_r,
11331144
title = "R Code for PCA"
11341145
)
1135-
1136-
### REPORTER
1137-
if (with_reporter) {
1138-
card_fun <- function(comment, label) {
1139-
card <- teal::report_card_template(
1140-
title = "Principal Component Analysis Plot",
1141-
label = label,
1142-
with_filter = with_filter,
1143-
filter_panel_api = filter_panel_api
1144-
)
1145-
card$append_text("Principal Components Table", "header3")
1146-
card$append_table(computation()[["tbl_importance"]])
1147-
card$append_text("Eigenvectors Table", "header3")
1148-
card$append_table(computation()[["tbl_eigenvector"]])
1149-
card$append_text("Plot", "header3")
1150-
card$append_plot(plot_r(), dim = pws$dim())
1151-
if (!comment == "") {
1152-
card$append_text("Comment", "header3")
1153-
card$append_text(comment)
1154-
}
1155-
card$append_src(source_code_r())
1156-
card
1157-
}
1158-
teal.reporter::add_card_button_srv("add_reporter", reporter = reporter, card_fun = card_fun)
1159-
}
1160-
###
1146+
decorated_output_dims_q
11611147
})
11621148
}

0 commit comments

Comments
 (0)