No flags found
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
b6ae8a0
... +5 ...
874a04c
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
21 | 21 | #' |
|
22 | 22 | #' |
|
23 | 23 | #' @importFrom shiny restoreInput |
|
24 | - | #' @importFrom htmltools tags validateCssUnit |
|
24 | + | #' @importFrom htmltools tags validateCssUnit attachDependencies findDependencies |
|
25 | 25 | #' |
|
26 | 26 | #' @export |
|
27 | 27 | #' |
48 | 48 | #' } |
|
49 | 49 | #' shinyApp(ui, server) |
|
50 | 50 | #' } |
|
51 | - | switchInput <- function(inputId, label = NULL, value = FALSE, onLabel = 'ON', offLabel = 'OFF', |
|
52 | - | onStatus = NULL, offStatus = NULL, size = "default", labelWidth = "auto", |
|
53 | - | handleWidth = "auto", disabled = FALSE, inline = FALSE, width = NULL) { |
|
51 | + | switchInput <- function(inputId, |
|
52 | + | label = NULL, |
|
53 | + | value = FALSE, |
|
54 | + | onLabel = "ON", |
|
55 | + | offLabel = "OFF", |
|
56 | + | onStatus = NULL, |
|
57 | + | offStatus = NULL, |
|
58 | + | size = "default", |
|
59 | + | labelWidth = "auto", |
|
60 | + | handleWidth = "auto", |
|
61 | + | disabled = FALSE, |
|
62 | + | inline = FALSE, |
|
63 | + | width = NULL) { |
|
54 | 64 | value <- shiny::restoreInput(id = inputId, default = value) |
|
55 | 65 | size <- match.arg(arg = size, choices = c('default', 'mini', 'small', 'normal', 'large')) |
|
56 | 66 | switchProps <- dropNulls( |
|
57 | 67 | list( |
|
58 | - | id = inputId, type = "checkbox", class = "sw-switchInput", `data-input-id` = inputId, |
|
59 | - | `data-on-text` = onLabel, `data-off-text` = offLabel, `data-label-text` = label, |
|
60 | - | `data-on-color` = onStatus, `data-off-color` = offStatus, #`data-state` = value, |
|
61 | - | `data-label-width` = labelWidth, `data-handle-width` = handleWidth, |
|
68 | + | id = inputId, |
|
69 | + | type = "checkbox", |
|
70 | + | class = "sw-switchInput", |
|
71 | + | `data-input-id` = inputId, |
|
72 | + | `data-on-text` = onLabel, |
|
73 | + | `data-off-text` = offLabel, |
|
74 | + | `data-label-text` = label, |
|
75 | + | `data-on-color` = onStatus, |
|
76 | + | `data-off-color` = offStatus, |
|
77 | + | #`data-state` = value, |
|
78 | + | `data-label-width` = labelWidth, |
|
79 | + | `data-handle-width` = handleWidth, |
|
62 | 80 | `disabled` = if (!disabled) NULL else disabled, |
|
63 | 81 | `data-size` = if (size == "default") "" else size |
|
64 | 82 | ) |
80 | 98 | style = if (!is.null(width)) paste0("width: ", htmltools::validateCssUnit(width), ";"), |
|
81 | 99 | inputTag |
|
82 | 100 | ) |
|
83 | - | # Dep |
|
101 | + | # Dependencies |
|
102 | + | switchInputTag <- attachDependencies( |
|
103 | + | switchInputTag, |
|
104 | + | htmltools::findDependencies(tagList(label, offLabel, onLabel)) |
|
105 | + | ) |
|
84 | 106 | attachShinyWidgetsDep(switchInputTag, "bsswitch") |
|
85 | 107 | } |
|
86 | 108 |
65 | 65 | # create custom css background for each slider |
|
66 | 66 | # selected by the user |
|
67 | 67 | sliderCol <- lapply(sliderId, FUN = function(i) { |
|
68 | - | paste0(".js-irs-", i, " .irs-single,", |
|
69 | - | " .js-irs-", i, " .irs-from,", |
|
70 | - | " .js-irs-", i, " .irs-to,", |
|
71 | - | " .js-irs-", i, " .irs-bar-edge,", |
|
72 | - | " .js-irs-", i, " .irs-bar{ |
|
73 | - | background: ", color[i+1], "; |
|
74 | - | }" |
|
68 | + | paste0( |
|
69 | + | ".js-irs-", i, " .irs-single,", |
|
70 | + | " .js-irs-", i, " .irs-from,", |
|
71 | + | " .js-irs-", i, " .irs-to,", |
|
72 | + | " .js-irs-", i, " .irs-bar-edge,", |
|
73 | + | " .js-irs-", i, |
|
74 | + | " .irs-bar{background: ", color[i+1], |
|
75 | + | "; border-top: 1px solid ", color[i+1], |
|
76 | + | "; border-bottom: 1px solid ", color[i+1], |
|
77 | + | ";}" |
|
75 | 78 | ) |
|
76 | 79 | }) |
|
77 | 80 |
65 | 65 | class = "shiny-numeric-range-input form-group shiny-input-container", |
|
66 | 66 | style = if (!is.null(width)) paste0("width: ", htmltools::validateCssUnit(width), ";"), |
|
67 | 67 | ||
68 | - | controlLabel(inputId, label), |
|
68 | + | tags$label( |
|
69 | + | class = "control-label", |
|
70 | + | `for` = inputId, |
|
71 | + | label, |
|
72 | + | class = if (is.null(label)) "shiny-label-null" |
|
73 | + | ), |
|
69 | 74 | # input-daterange class is needed for dropdown behavior |
|
70 | 75 | htmltools::tags$div( |
|
71 | 76 | class = "input-numeric-range input-group", |
376 | 376 | options$minDate <- to_ms(options$minDate) |
|
377 | 377 | options$maxDate <- to_ms(options$maxDate) |
|
378 | 378 | } |
|
379 | + | if (!is.null(options$disabledDates)) { |
|
380 | + | options$disabledDates <- list1(options$disabledDates) |
|
381 | + | } |
|
382 | + | if (!is.null(options$highlightedDates)) { |
|
383 | + | options$highlightedDates <- list1(options$highlightedDates) |
|
384 | + | } |
|
379 | 385 | message <- dropNulls(list( |
|
380 | 386 | id = session$ns(inputId), |
|
381 | 387 | label = label, |
|
382 | 388 | value = value, |
|
383 | 389 | clear = isTRUE(clear), |
|
384 | - | options = options, |
|
390 | + | options = dropNulls(options), |
|
385 | 391 | show = isTRUE(show), |
|
386 | 392 | hide = isTRUE(hide) |
|
387 | 393 | )) |
96 | 96 | } |
|
97 | 97 | ||
98 | 98 | ||
99 | - | `%AND%` <- function(x, y) { |
|
100 | - | if (!is.null(x) && !anyNA(x)) |
|
101 | - | if (!is.null(y) && !anyNA(y)) |
|
102 | - | return(y) |
|
103 | - | return(NULL) |
|
104 | - | } |
|
105 | - | ||
106 | 99 | ||
107 | 100 | `%||%` <- function(x, y) { |
|
108 | 101 | if (!is.null(x)) x else y |
|
109 | 102 | } |
|
110 | 103 | ||
111 | - | escape_jquery <- function(string) { |
|
112 | - | gsub(x = string, pattern = "(\\W)", replacement = "\\\\\\\\\\1") |
|
113 | - | } |
|
114 | - | ||
115 | 104 | ||
116 | 105 | ||
117 | 106 | ||
118 | - | firstChoice <- function(choices) |
|
119 | - | { |
|
107 | + | firstChoice <- function(choices) { |
|
120 | 108 | if (length(choices) == 0L) |
|
121 | 109 | return() |
|
122 | 110 | choice <- choices[[1]] |
183 | 171 | } |
|
184 | 172 | } |
|
185 | 173 | ||
186 | - | controlLabel <- function(controlName, label) { |
|
187 | - | label %AND% htmltools::tags$label(class = "control-label", `for` = controlName, label) |
|
188 | - | } |
|
174 | + | ||
189 | 175 | ||
190 | 176 | formatNoSci <- function(x) { |
|
191 | 177 | if (is.null(x)) return(NULL) |
874a04c
5d6548e
5b2e679
6b5c25b
270d279
d9314d8
b6ae8a0