Skip to content

Commit

Permalink
Merge pull request #425 from Appsilon/esra-upper-value-for-range_inpu…
Browse files Browse the repository at this point in the history
…t-missing

Add a new register input handler for the shiny.vector type
  • Loading branch information
jakubnowicki committed Jan 31, 2024
2 parents 5734cdd + 3e8abd4 commit 1f3e98d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
@@ -1,7 +1,7 @@
Type: Package
Package: shiny.semantic
Title: Semantic UI Support for Shiny
Version: 0.5.0
Version: 0.5.0.9000
Authors@R: c(person("Filip", "Stachura", email = "filip@appsilon.com", role = "aut"),
person("Dominik", "Krzeminski", role = "aut"),
person("Krystian", "Igras", role = "aut"),
Expand Down
6 changes: 5 additions & 1 deletion NEWS.md
@@ -1,4 +1,8 @@
# shiny.semantic 0.5.0
# shiny.semantic (development)

- Fixed `range_input` now returns both lower and upper bound.

# [shiny.semantic 0.5.0](https://github.com/Appsilon/shiny.semantic/releases/tag/0.5.0)

- `shiny.semantic` no longer uses CDN as the default source of assets. Instead, `semantic.assets` package was introduced.

Expand Down
8 changes: 8 additions & 0 deletions R/shiny.R
Expand Up @@ -31,6 +31,14 @@ NULL
# Add directory for static resources
file <- system.file("www", package = "shiny.semantic", mustWork = TRUE)
shiny::addResourcePath("shiny.semantic", file)
shiny::registerInputHandler("shiny.semantic.vector", function(value, ...) {
if (is.null(value)) {
return(value)
} else {
values <- jsonlite::fromJSON(value)
return(values)
}
}, force = TRUE)
}

#' Create universal Shiny input binding
Expand Down
4 changes: 2 additions & 2 deletions inst/www/shiny-semantic-slider.js
Expand Up @@ -52,14 +52,14 @@ $.extend(semanticSliderBinding, {
if ($(el).data('ticks')) {
return $(el).data('ticks')[value];
} else {
return value;
return(JSON.stringify(value))
}
},
getType: function(el) {
if ($(el).data('ticks')) {
return false;
} else {
return 'shiny.number';
return 'shiny.semantic.vector';
}
},
// Given the DOM element for the input, set the value.
Expand Down

0 comments on commit 1f3e98d

Please sign in to comment.