diff --git a/DESCRIPTION b/DESCRIPTION index 41185bd..95a171e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: tfrmtbuilder Title: Shiny app companion to the tfrmt package -Version: 0.0.2 +Version: 0.0.3 Authors@R: c(person(given = "Becca", family = "Krouse", @@ -52,4 +52,3 @@ Imports: pkgload, shinyFeedback, fontawesome - diff --git a/NEWS.md b/NEWS.md index 883d513..f1c001f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# tfrmtbuilder 0.0.3 + +* Bug fixes: + - Allow param-level formatting in `body_plan()` + - Fix issue where user is unable to select `frmt` buttons in `body_plan()` via installed package + - fix navbar warnings about extra content # tfrmtbuilder 0.0.2 diff --git a/R/mod_body_plan_edit.R b/R/mod_body_plan_edit.R index 9f2ec5c..c847977 100644 --- a/R/mod_body_plan_edit.R +++ b/R/mod_body_plan_edit.R @@ -33,7 +33,7 @@ body_plan_edit_server <- function(id, data, tfrmt_app, selected){ # TODO - no allow_create for the uploaded data collected_filters <- filters_server("filters", data, tfrmt_app, selected, - include = c("group", "label"), + include = c("group", "label", "param"), allow_create = reactive(TRUE), null_to_default = TRUE) @@ -46,9 +46,16 @@ body_plan_edit_server <- function(id, data, tfrmt_app, selected){ req(length(collected_filters())>0) req(!is.null(frmt_out())) - frmt_structure(group_val = collected_filters()$group_val, - label_val = collected_filters()$label_val, - frmt_out()) + frmt_out_ready <- list(frmt_out()) + + if (!all(collected_filters()$param_val==".default") && + length(collected_filters()$param_val)==1){ + frmt_out_ready <- setNames(frmt_out_ready, collected_filters()$param_val) + } + + do.call("frmt_structure", args = c(list(group_val = collected_filters()$group_val, + label_val = collected_filters()$label_val), + frmt_out_ready)) }) diff --git a/R/mod_body_plan_edit_frmts.R b/R/mod_body_plan_edit_frmts.R index 15ba8b9..288ff89 100644 --- a/R/mod_body_plan_edit_frmts.R +++ b/R/mod_body_plan_edit_frmts.R @@ -71,7 +71,7 @@ body_plan_edit_frmts_server <- function(id, selected){ observeEvent(input[[paste0("pst_", x)]],{ - dummy_fun <- match.fun(paste0("dummy_", x)) + dummy_fun <- get(paste0("dummy_", x), envir = asNamespace("tfrmtbuilder")) updateAceEditor(session, editorId = "frmt", value = paste0(input$frmt, dummy_fun())) diff --git a/R/mod_table_view.R b/R/mod_table_view.R index 6fbe8cd..12ad880 100644 --- a/R/mod_table_view.R +++ b/R/mod_table_view.R @@ -153,7 +153,7 @@ table_view_server <- function(id, tab_selected, data, tfrmt_app_out, settings){ tab_options( table.align = "left" ) - )) + , inline_css = FALSE)) }) diff --git a/R/tfrmtbuilder.R b/R/tfrmtbuilder.R index fc268d6..eb14330 100644 --- a/R/tfrmtbuilder.R +++ b/R/tfrmtbuilder.R @@ -15,7 +15,8 @@ tfrmtbuilder <- function(run = TRUE){ if (run){ runApp(app, launch.browser = TRUE) + } else { + app } - app } diff --git a/R/tfrmtbuilder_ui.R b/R/tfrmtbuilder_ui.R index 3604a43..bd54bc1 100644 --- a/R/tfrmtbuilder_ui.R +++ b/R/tfrmtbuilder_ui.R @@ -85,7 +85,7 @@ tfrmtbuilder_ui <- function(id){ ) ) , tabPanel("Export", export_ui(ns("export"))), - tags$script(HTML(paste0("var header = $('.navbar> .container-fluid');", + header = tags$script(HTML(paste0("var header = $('.navbar> .container-fluid');", "header.append('
", "
", "
", diff --git a/R/utils_app.R b/R/utils_app.R index 9f95546..9419b44 100644 --- a/R/utils_app.R +++ b/R/utils_app.R @@ -18,10 +18,10 @@ create_filter_select <- function(ns, type, data, existing_filters, var_vec, if (is.list(x)){ x - } else if (is.null(x) || x==".default"){ + } else if (is.null(x) || all(x==".default")){ x } else { - as.list(x) %>% setNames(var_vec) + list(x) %>% setNames(var_vec) } }) %>% list_flatten(name_spec = "{inner}") %>% diff --git a/R/utils_tfrmt.R b/R/utils_tfrmt.R index d018507..b145290 100644 --- a/R/utils_tfrmt.R +++ b/R/utils_tfrmt.R @@ -246,6 +246,7 @@ cols_to_dat <- function(data, tfrmt, mock){ columns <- tfrmt$column %>% map_chr(as_label) columns_lowest <- columns %>% last() %>% sym() + tfrmt$big_n <- NULL col_plan_vars <- attr(tfrmt:::apply_tfrmt(data, tfrmt, mock), ".col_plan_vars") allcols <- col_plan_vars %>% map_chr(as_label)