Skip to content

Commit b29e8d1

Browse files
committed
fix: when only 1 ui_decorate, default is the only accepted name in decorator argument
1 parent e7cb0f1 commit b29e8d1

File tree

9 files changed

+33
-28
lines changed

9 files changed

+33
-28
lines changed

R/tm_a_pca.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,13 @@ tm_a_pca <- function(label = "Principal Component Analysis",
166166
checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE)
167167

168168
if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) {
169-
decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", "plot"))) {
169+
decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default"))) {
170170
lapply(decorators, list)
171171
} else {
172172
list(default = decorators)
173173
}
174174
}
175-
assert_decorators(decorators, null.ok = TRUE, names = c("default", "plot"))
175+
assert_decorators(decorators, null.ok = TRUE, names = c("default"))
176176
# End of assertions
177177

178178
# Make UI args
@@ -247,7 +247,7 @@ ui_a_pca <- function(id, ...) {
247247
choices = args$plot_choices,
248248
selected = args$plot_choices[1]
249249
),
250-
ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators))
250+
ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("default", args$decorators))
251251
),
252252
teal.widgets::panel_item(
253253
title = "Pre-processing",
@@ -985,7 +985,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
985985
decorated_output_q <- srv_decorate_teal_data(
986986
id = "decorator",
987987
data = output_q,
988-
decorators = subset_decorators("plot", decorators),
988+
decorators = subset_decorators("default", decorators),
989989
expr = print(plot)
990990
)
991991

R/tm_data_table.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@ tm_data_table <- function(label = "Data Table",
132132
checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE)
133133

134134
if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) {
135-
decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", "table"))) {
135+
decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default"))) {
136136
lapply(decorators, list)
137137
} else {
138138
list(default = decorators)
139139
}
140140
}
141-
assert_decorators(decorators, null.ok = TRUE, names = c("default", "table"))
141+
assert_decorators(decorators, null.ok = TRUE, names = c("default"))
142142
# End of assertions
143143

144144
ans <- module(
@@ -303,7 +303,7 @@ ui_data_table <- function(id,
303303
tagList(
304304
teal.widgets::get_dt_rows(ns("data_table"), ns("dt_rows")),
305305
fluidRow(
306-
ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("table", decorators)),
306+
ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("default", decorators)),
307307
teal.widgets::optionalSelectInput(
308308
ns("variables"),
309309
"Select variables:",

R/tm_g_bivariate.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,13 +277,13 @@ tm_g_bivariate <- function(label = "Bivariate Plots",
277277
checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE)
278278

279279
if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) {
280-
decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", "plot"))) {
280+
decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default"))) {
281281
lapply(decorators, list)
282282
} else {
283283
list(default = decorators)
284284
}
285285
}
286-
assert_decorators(decorators, null.ok = TRUE, names = c("default", "plot"))
286+
assert_decorators(decorators, null.ok = TRUE, names = c("default"))
287287
# End of assertions
288288

289289
# Make UI args
@@ -357,7 +357,7 @@ ui_g_bivariate <- function(id, ...) {
357357
justified = TRUE
358358
)
359359
),
360-
ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)),
360+
ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("default", args$decorators)),
361361
if (!is.null(args$row_facet) || !is.null(args$col_facet)) {
362362
tags$div(
363363
class = "data-extract-box",

R/tm_g_distribution.R

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,16 @@ tm_g_distribution <- function(label = "Distribution Module",
184184
checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE)
185185
checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE)
186186

187-
checkmate::assert_list(decorators, "teal_transform_module", null.ok = TRUE)
187+
available_decorators <- c("default", "plot", "test_table", "summary_table")
188+
if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) {
189+
decorators <- if (checkmate::test_names(names(decorators), subset.of = available_decorators)) {
190+
lapply(decorators, list)
191+
} else {
192+
list(default = decorators)
193+
}
194+
}
195+
assert_decorators(decorators, null.ok = TRUE, names = available_decorators)
196+
188197
# End of assertions
189198

190199
# Make UI args

R/tm_g_response.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,13 @@ tm_g_response <- function(label = "Response Plot",
202202
checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE)
203203

204204
if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) {
205-
decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", "plot"))) {
205+
decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default"))) {
206206
lapply(decorators, list)
207207
} else {
208208
list(default = decorators)
209209
}
210210
}
211-
assert_decorators(decorators, null.ok = TRUE, names = c("default", "plot"))
211+
assert_decorators(decorators, null.ok = TRUE, names = c("default"))
212212
# End of assertions
213213

214214
# Make UI args
@@ -292,7 +292,7 @@ ui_g_response <- function(id, ...) {
292292
selected = ifelse(args$freq, "frequency", "density"),
293293
justified = TRUE
294294
),
295-
ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)),
295+
ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("default", args$decorators)),
296296
teal.widgets::panel_group(
297297
teal.widgets::panel_item(
298298
title = "Plot settings",

R/tm_g_scatterplot.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,13 +309,13 @@ tm_g_scatterplot <- function(label = "Scatterplot",
309309
checkmate::assert_class(ggplot2_args, "ggplot2_args")
310310

311311
if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) {
312-
decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", "plot"))) {
312+
decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default"))) {
313313
lapply(decorators, list)
314314
} else {
315315
list(default = decorators)
316316
}
317317
}
318-
assert_decorators(decorators, null.ok = TRUE, names = c("default", "plot"))
318+
assert_decorators(decorators, null.ok = TRUE, names = c("default"))
319319

320320
# End of assertions
321321

@@ -439,7 +439,7 @@ ui_g_scatterplot <- function(id, ...) {
439439
is_single_dataset = is_single_dataset_value
440440
)
441441
},
442-
ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)),
442+
ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("default", args$decorators)),
443443
teal.widgets::panel_group(
444444
teal.widgets::panel_item(
445445
title = "Plot settings",

R/tm_g_scatterplotmatrix.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,13 @@ tm_g_scatterplotmatrix <- function(label = "Scatterplot Matrix",
204204
checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE)
205205

206206
if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) {
207-
decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", "plot"))) {
207+
decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default"))) {
208208
lapply(decorators, list)
209209
} else {
210210
list(default = decorators)
211211
}
212212
}
213-
assert_decorators(decorators, null.ok = TRUE, names = c("default", "plot"))
213+
assert_decorators(decorators, null.ok = TRUE, names = c("default"))
214214
# End of assertions
215215

216216
# Make UI args
@@ -257,7 +257,7 @@ ui_g_scatterplotmatrix <- function(id, ...) {
257257
is_single_dataset = is_single_dataset_value
258258
),
259259
tags$hr(),
260-
ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)),
260+
ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("default", args$decorators)),
261261
teal.widgets::panel_group(
262262
teal.widgets::panel_item(
263263
title = "Plot settings",

R/tm_t_crosstable.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,13 @@ tm_t_crosstable <- function(label = "Cross Table",
169169
checkmate::assert_class(basic_table_args, classes = "basic_table_args")
170170

171171
if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) {
172-
decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", "table"))) {
172+
decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default"))) {
173173
lapply(decorators, list)
174174
} else {
175175
list(default = decorators)
176176
}
177177
}
178-
assert_decorators(decorators, null.ok = TRUE, names = c("default", "table"))
178+
assert_decorators(decorators, null.ok = TRUE, names = c("default"))
179179
# End of assertions
180180

181181
# Make UI args
@@ -242,7 +242,7 @@ ui_t_crosstable <- function(id, x, y, show_percentage, show_total, pre_output, p
242242
checkboxInput(ns("show_total"), "Show total column", value = show_total)
243243
)
244244
),
245-
ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("table", args$decorators))
245+
ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("default", args$decorators))
246246
),
247247
forms = tagList(
248248
teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code")
@@ -418,7 +418,7 @@ srv_t_crosstable <- function(id, data, reporter, filter_panel_api, label, x, y,
418418
decorated_output_q <- srv_decorate_teal_data(
419419
id = "decorator",
420420
data = output_q,
421-
decorators = subset_decorators("table", decorators),
421+
decorators = subset_decorators("default", decorators),
422422
expr = table
423423
)
424424

man/srv_decorate_teal_data.Rd

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)