Просмотр исходного кода

Adjust style of RegEx tab

- Fixed min-height for inputs and controls
- Inputs, controls and outputs won't overlap
- Build out HTML instead of using fillCol()
- Modified textInputCode() to allow additional items into input-group for library button
- Use input-group instead of form-group for textInputCode()
pull/21/head
Garrick Aden-Buie 7 лет назад
Родитель
Сommit
68fde36a12
3 измененных файлов: 36 добавлений и 17 удалений
  1. +22
    -13
      R/gadget_ui.R
  2. +4
    -3
      R/shiny_modified_inputs.R
  3. +10
    -1
      inst/styles/gadget.css

+ 22
- 13
R/gadget_ui.R Просмотреть файл

miniTabPanel( miniTabPanel(
"RegEx", icon = icon('terminal'), "RegEx", icon = icon('terminal'),
miniContentPanel( miniContentPanel(
fillCol(
flex = c(1, 3),
fillCol(
flex = c(1, 1),
fillRow(
flex = c(6, 1),
textInputCode('pattern', 'RegEx', width = "100%",
value = pattern,
placeholder = "Standard RegEx, e.g. \\w+_\\d{2,4}\\s+"),
tags$div(style = "margin-top: 23px; margin-left:6px;",
actionButton("library_show", "Library", class = "btn-success"))
),
tags$div(
id = "regexPage",
class = "container-fluid",
style = "height: 90%",
fluidRow(
id = "regexInput",
tags$div(
class = "col-12",
textInputCode(
'pattern', 'RegEx', width = "100%",
value = pattern,
placeholder = "Standard RegEx, e.g. \\w+_\\d{2,4}\\s+",
tags$span(class = "input-group-btn",
actionButton("library_show", "Library", class = "btn-primary")
)
)
)
),
fluidRow(
id = "regexOptions",
checkboxGroupInput( checkboxGroupInput(
'regex_options', 'regex_options',
label = HTML( label = HTML(
) )
), ),
tags$div( tags$div(
id = "regexResult",
class = "gadget-result", class = "gadget-result",
style = "overflow-y: scroll; height: 100%;",
style = "overflow-y: scroll; height: 100%; max-height: calc(100% - 90px);",
htmlOutput('result') htmlOutput('result')
) )
) )

+ 4
- 3
R/shiny_modified_inputs.R Просмотреть файл

#' @param width Width of `shiny-input-container` div. #' @param width Width of `shiny-input-container` div.
#' @family modified shiny inputs #' @family modified shiny inputs
textInputCode <- function(inputId, label, value = "", width = NULL, textInputCode <- function(inputId, label, value = "", width = NULL,
placeholder = NULL) {
placeholder = NULL, ...) {
`%AND%` <- getFromNamespace("%AND%", "shiny") `%AND%` <- getFromNamespace("%AND%", "shiny")
value <- shiny::restoreInput(id = inputId, default = value) value <- shiny::restoreInput(id = inputId, default = value)


shiny::div(class = "form-group shiny-input-container",
shiny::div(class = "input-group shiny-input-container",
style = if (!is.null(width)) paste0("width: ", shiny::validateCssUnit(width), ";"), style = if (!is.null(width)) paste0("width: ", shiny::validateCssUnit(width), ";"),
label %AND% shiny::tags$label(label, `for` = inputId), label %AND% shiny::tags$label(label, `for` = inputId),
shiny::tags$input(id = inputId, type="text", class="form-control", value=value, shiny::tags$input(id = inputId, type="text", class="form-control", value=value,
style = 'font-family: "Monaco", "Inconsolata", monospace;', style = 'font-family: "Monaco", "Inconsolata", monospace;',
autocomplete = "off", autocorrect = "off", autocomplete = "off", autocorrect = "off",
autocapitalize = "off", spellcheck = "false", autocapitalize = "off", spellcheck = "false",
placeholder = placeholder)
placeholder = placeholder),
...
) )
} }

+ 10
- 1
inst/styles/gadget.css Просмотреть файл

#help_text_selected > h3 { #help_text_selected > h3 {
margin-top: 0px; margin-top: 0px;
} }

#regexOptions {
padding-left: 15px;
}
#regexInput {
padding: 0 15px 15px 10px;
}
#library_show {
margin-top: 25px;
padding-left: 10px;
}
.gadget-result { .gadget-result {
border: 1px solid #ccc; border: 1px solid #ccc;
border-radius: 0.5rem; border-radius: 0.5rem;

Загрузка…
Отмена
Сохранить