File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -280,3 +280,35 @@ assert_single_selection <- function(x,
280280 }
281281 invisible (TRUE )
282282}
283+
284+ # ' Wrappers around `srv_transform_teal_data` that allows to decorate the data
285+ # ' @inheritParams teal::srv_transform_teal_data
286+ # ' @param expr (`expression`) to evaluate on the output of the decoration.
287+ # ' Must be inline code. See [within()]
288+ # ' Default is `NULL` which won't append any expression.
289+ # ' @details
290+ # ' `srv_decorate_teal_data` is a wrapper around `srv_transform_teal_data` that
291+ # ' allows to decorate the data with additional reactive expressions.
292+ # ' When original `teal_data` object is in error state, it will show that error
293+ # ' first.
294+ # '
295+ # ' @keywords internal
296+ srv_decorate_teal_data <- function (id , data , decorators , expr = NULL ) {
297+ expr_quosure <- rlang :: enexpr(expr )
298+ decorated_output <- srv_transform_teal_data(id , data = data , transformators = decorators )
299+
300+ reactive({
301+ req(data(), decorated_output()) # ensure original errors are displayed
302+ if (is.null(expr_quosure )) {
303+ decorated_output()
304+ } else {
305+ eval_code(decorated_output(), expr_quosure )
306+ }
307+ })
308+ }
309+
310+ # ' @rdname srv_decorate_teal_data
311+ # ' @details
312+ # ' `ui_decorate_teal_data` is a wrapper around `ui_transform_teal_data`.
313+ # ' @keywords internal
314+ ui_decorate_teal_data <- teal :: ui_transform_teal_data
You can’t perform that action at this time.
0 commit comments