Skip to content

Commit

Permalink
Merge branch 'main' into olivroy-ellipsis
Browse files Browse the repository at this point in the history
  • Loading branch information
andrie committed Sep 5, 2024
2 parents 54ba7c7 + 487b5d4 commit 42df2e9
Show file tree
Hide file tree
Showing 12 changed files with 206 additions and 32 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ inst/tutorials/*/*.html
/Meta/

revdep/*

/.quarto/
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ VignetteBuilder:
knitr
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Language: en-US
Config/testthat/edition: 3
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export(sortable_js_capture_input)
export(sortable_options)
export(sortable_output)
export(update_bucket_list)
export(update_rank_list)
importFrom(assertthat,"on_failure<-")
importFrom(assertthat,assert_that)
importFrom(assertthat,is.string)
Expand Down
8 changes: 7 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# sortable 0.5
# sortable 0.5.0.9000

## Updates

* Update `Sortable.js` to version 1.15.3

# sortable 0.5.0

## Enhancements

Expand Down
1 change: 1 addition & 0 deletions R/rank_list.R
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ dropNulls <- function(x) {
#' `shinyServer`.
#' @seealso [rank_list]
#' @export
#' @examples
#' ## Example of a shiny app that updates a bucket list and rank list
#' if (interactive()) {
#' app <- system.file(
Expand Down
8 changes: 2 additions & 6 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,11 @@ knitr::opts_chunk$set(
# sortable <img src='man/figures/logo.png' align="right" height="139" />

<!-- badges: start -->
[![CRAN version](http://www.r-pkg.org/badges/version/sortable)](https://cran.r-project.org/package=sortable)
[![CRAN status](https://www.r-pkg.org/badges/version/sortable)](https://CRAN.R-project.org/package=sortable)
[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/sortable)](https://www.r-pkg.org/pkg/sortable)
[![R build status](https://github.com/rstudio/sortable/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/rstudio/sortable/actions)
[![sortable downloads per month](http://cranlogs.r-pkg.org/badges/sortable)](http://www.rpackages.io/package/sortable)
[![Codecov test coverage](https://codecov.io/gh/rstudio/sortable/branch/main/graph/badge.svg)](https://codecov.io/gh/rstudio/sortable?branch=main)
[![Lifecycle: maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
[![RStudio Community: Teaching](https://img.shields.io/badge/Community%20Support-Teaching-75aadb.svg?style=popout&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDIyLjEuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiCgkgdmlld0JveD0iMCAwIDYyNS45IDYyNS45IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA2MjUuOSA2MjUuOTsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLnN0MHtmaWxsOiM3NUFBREI7fQoJLnN0MXtmaWxsOiM0RDRENEQ7fQoJLnN0MntmaWxsOiNGRkZGRkY7fQoJLnN0M3tmaWxsOnVybCgjU1ZHSURfMV8pO30KCS5zdDR7Zmls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go8ZyBpZD0iV2hpdGVfTGV0dGVycyI+CjwvZz4KPGcgaWQ9IlJfQmFsbCI+CjwvZz4KPC9zdmc+)](https://community.rstudio.com/new-topic?title=&category_id=13&tags=sortable&body=%0A%0A%0A%20%20--------%0A%20%20%0A%20%20%3Csup%3EReferred%20here%20by%20%60sortable%60%27s%20GitHub%3C/sup%3E%0A&u=barret)

[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
<!-- badges: end -->

The `sortable` package enables drag-and-drop behaviour in your Shiny apps. It does this by exposing the functionality of the [SortableJS](https://sortablejs.github.io/Sortable/) JavaScript library as an [htmlwidget](http://www.htmlwidgets.org) in R, so you can use this in Shiny apps and widgets, `learnr` tutorials as well as R Markdown. In addition, provides a custom `learnr` question type - `question_rank()` that allows ranking questions with drag-and-drop.
Expand Down
187 changes: 169 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@


<!-- README.md is generated from README.Rmd. Please edit that file -->

# sortable <img src='man/figures/logo.png' align="right" height="139" />

<!-- badges: start -->

[![CRAN
version](http://www.r-pkg.org/badges/version/sortable)](https://cran.r-project.org/package=sortable)
status](https://www.r-pkg.org/badges/version/sortable)](https://CRAN.R-project.org/package=sortable)
[![CRAN RStudio mirror
downloads](https://cranlogs.r-pkg.org/badges/sortable)](https://www.r-pkg.org/pkg/sortable)
[![R build
status](https://github.com/rstudio/sortable/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/rstudio/sortable/actions)
[![sortable downloads per
month](http://cranlogs.r-pkg.org/badges/sortable)](http://www.rpackages.io/package/sortable)
[![Codecov test
coverage](https://codecov.io/gh/rstudio/sortable/branch/main/graph/badge.svg)](https://codecov.io/gh/rstudio/sortable?branch=main)
[![Lifecycle:
maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
[![RStudio Community:
Teaching](https://img.shields.io/badge/Community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fQoJLnN0MTR7b3BhY2l0eTowLjM7fQo8L3N0eWxlPgo8ZyBpZD0iR3JheV9Mb2dvIj4KPC9nPgo8ZyBpZD0iQmxhY2tfTGV0dGVycyI+CjwvZz4KPGcgaWQ9IkJsdWVfR3JhZGllbnRfTGV0dGVycyI+Cgk8Zz4KCgkJCTxlbGxpcHNlIHRyYW5zZm9ybT0ibWF0cml4KDAuNzA3MSAtMC43MDcxIDAuNzA3MSAwLjcwNzEgLTEyNy45MjY1IDMxNy4wMzE3KSIgY2xhc3M9InN0MCIgY3g9IjMxOC43IiBjeT0iMzEyLjkiIHJ4PSIzMDkuOCIgcnk9IjMwOS44Ii8+CgkJPGc+CgkJCTxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik00MjQuNyw0MTEuOGgzMy42djI2LjFoLTUxLjNMMzIyLDMxMC41aC00NS4zdjEwMS4zaDQ0LjN2MjYuMUgyMDkuNXYtMjYuMWgzOC4zVjE4Ny4zbC0zOC4zLTQuN3YtMjQuNwoJCQkJYzE0LjUsMy4zLDI3LjEsNS42LDQyLjksNS42YzIzLjgsMCw0OC4xLTUuNiw3MS45LTUuNmM0Ni4yLDAsODkuMSwyMSw4OS4xLDcyLjNjMCwzOS43LTIzLjgsNjQuOS02MC43LDc1LjZMNDI0LjcsNDExLjh6CgkJCQkgTTI3Ni43LDI4NS4zbDI0LjMsMC41YzU5LjMsMC45LDgyLjEtMjEuOSw4Mi4xLTUyLjNjMC0zNS41LTI1LjctNDkuNS01OC4zLTQ5LjVjLTE1LjQsMC0zMS4zLDEuNC00OC4xLDMuM1YyODUuM3oiLz4KCQk8L2c+Cgk8L2c+CjwvZz4KPGcgaWQ9IldoaXRlX0xldHRlcnMiPgo8L2c+CjxnIGlkPSJSX0JhbGwiPgo8L2c+Cjwvc3ZnPg==)](https://community.rstudio.com/c/teaching)
[![RStudio Ask a question:
sortable](https://img.shields.io/badge/Ask%20a%20question-sortable-75aadb.svg?style=popout&logo=data:image/svg+xml;base64,PHN2ZyB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XgoMC43MDcxIC0wLjcwNzEgMC43MDcxIDAuNzA3MSAtMTI3LjkyNjUgMzE3LjAzMTcpIiBjbGFzcz0ic3QwIiBjeD0iMzE4LjciIGN5PSIzMTIuOSIgcng9IjMwOS44IiByeT0iMzA5LjgiLz4KCQk8Zz4KCQkJPHBhdGggY2xhc3M9InN0MiIgZD0iTTQyNC43LDQxMS44aDMzLjZ2MjYuMWgtNTEuM0wzMjIsMzEwLjVoLTQ1LjN2MTAxLjNoNDQuM3YyNi4xSDIwOS41di0yNi4xaDM4LjNWMTg3LjNsLTM4LjMtNC43di0yNC43ICAgICBjMTQuNSwzLjMsMjcuMSw1LjYsNDIuOSw1LjZjMjMuOCwwLDQ4LjEtNS42LDcxLjktNS42YzQ2LjIsMCw4OS4xLDIxLDg5LjEsNzIuM2MwLDM5LjctMjMuOCw2NC45LTYwLjcsNzUuNkw0MjQuNyw0MTEuOHogICAgICBNMjc2LjcsMjg1LjNsMjQuMywwLjVjNTkuMywwLjksODIuMS0yMS45LDgyLjEtNTIuM2MwLTM1LjUtMjUuNy00OS41LTU4LjMtNDkuNWMtMTUuNCwwLTMxLjMsMS40LTQ4LjEsMy4zVjI4NS4zeiIvPgoJCTwvZz4KCTwvZz4KPC9nPgo8ZyBpZD0iV2hpdGVfTGV0dGVycyI+CjwvZz4KPGcgaWQ9IlJfQmFsbCI+CjwvZz4KPC9zdmc+)](https://community.rstudio.com/new-topic?title=&category_id=13&tags=sortable&body=%0A%0A%0A%20%20--------%0A%20%20%0A%20%20%3Csup%3EReferred%20here%20by%20%60sortable%60%27s%20GitHub%3C/sup%3E%0A&u=barret)

stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
<!-- badges: end -->

The `sortable` package enables drag-and-drop behaviour in your Shiny
Expand Down Expand Up @@ -61,10 +53,93 @@ You can create a drag-and-drop input object in Shiny, using the
<img src="man/figures/rank_list_shiny.gif" style = 'width:500px;'></img>
</center>

#> Warning in file(con, "r"): file("") only supports open = "w+" and open = "w+b":
#> using the former
#> Warning in knitr::read_chunk(system.file("shiny-examples/rank_list/app.R", :
#> code is empty
``` r
## Example shiny app with rank list

library(shiny)
library(sortable)

labels <- list(
"one",
"two",
"three",
htmltools::tags$div(
htmltools::em("Complex"), " html tag without a name"
),
"five" = htmltools::tags$div(
htmltools::em("Complex"), " html tag with name: 'five'"
)
)

rank_list_basic <- rank_list(
text = "Drag the items in any desired order",
labels = labels,
input_id = "rank_list_basic"
)

rank_list_swap <- rank_list(
text = "Notice that dragging causes items to swap",
labels = labels,
input_id = "rank_list_swap",
options = sortable_options(swap = TRUE)
)

rank_list_multi <- rank_list(
text = "You can select multiple items, then drag as a group",
labels = labels,
input_id = "rank_list_multi",
options = sortable_options(multiDrag = TRUE)
)



ui <- fluidPage(
fluidRow(
column(
width = 12,
tags$h2("Default, multi-drag and swapping behaviour"),
tabsetPanel(
type = "tabs",
tabPanel(
"Default",
tags$b("Exercise"),
rank_list_basic,
tags$b("Result"),
verbatimTextOutput("results_basic")
),
tabPanel(
"Multi-drag",
tags$b("Exercise"),
rank_list_multi,
tags$b("Result"),
verbatimTextOutput("results_multi")
),
tabPanel(
"Swap",
tags$b("Exercise"),
rank_list_swap,
tags$b("Result"),
verbatimTextOutput("results_swap")
)
)
)
)
)

server <- function(input, output) {
output$results_basic <- renderPrint({
input$rank_list_basic # This matches the input_id of the rank list
})
output$results_multi <- renderPrint({
input$rank_list_multi # This matches the input_id of the rank list
})
output$results_swap <- renderPrint({
input$rank_list_swap # This matches the input_id of the rank list
})
}

shinyApp(ui, server)
```

### Bucket list

Expand All @@ -76,10 +151,86 @@ students to classify objects into multiple categories.
<img src="man/figures/bucket_list_shiny.gif" style = 'width:500px;'></img>
</center>

#> Warning in file(con, "r"): file("") only supports open = "w+" and open = "w+b":
#> using the former
#> Warning in knitr::read_chunk(system.file("shiny-examples/bucket_list/app.R", :
#> code is empty
``` r
## Example shiny app with bucket list

library(shiny)
library(sortable)


ui <- fluidPage(
tags$head(
tags$style(HTML(".bucket-list-container {min-height: 350px;}"))
),
fluidRow(
column(
tags$b("Exercise"),
width = 12,
bucket_list(
header = "Drag the items in any desired bucket",
group_name = "bucket_list_group",
orientation = "horizontal",
add_rank_list(
text = "Drag from here",
labels = list(
"one",
"two",
"three",
htmltools::tags$div(
htmltools::em("Complex"), " html tag without a name"
),
"five" = htmltools::tags$div(
htmltools::em("Complex"), " html tag with name: 'five'"
)
),
input_id = "rank_list_1"
),
add_rank_list(
text = "to here",
labels = NULL,
input_id = "rank_list_2"
)
)
)
),
fluidRow(
column(
width = 12,
tags$b("Result"),
column(
width = 12,

tags$p("input$rank_list_1"),
verbatimTextOutput("results_1"),

tags$p("input$rank_list_2"),
verbatimTextOutput("results_2"),

tags$p("input$bucket_list_group"),
verbatimTextOutput("results_3")
)
)
)
)

server <- function(input,output) {
output$results_1 <-
renderPrint(
input$rank_list_1 # This matches the input_id of the first rank list
)
output$results_2 <-
renderPrint(
input$rank_list_2 # This matches the input_id of the second rank list
)
output$results_3 <-
renderPrint(
input$bucket_list_group # Matches the group_name of the bucket list
)
}


shinyApp(ui, server)
```

### Add drag-and-drop to any HTML element

Expand Down
4 changes: 2 additions & 2 deletions inst/htmlwidgets/lib/sortable/sortable.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/htmlwidgets/sortable.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dependencies:
- name: SortableJS
version: 1.15.0
version: 1.15.3
src: htmlwidgets/lib/sortable
script: sortable.js
1 change: 0 additions & 1 deletion man/sortable.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions man/update_rank_list.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions scripts/download_sortablejs.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@

get_new_sortable_version <- function() {
x <- readLines("https://unpkg.com/sortablejs", n = 1)
# sub("^.* Sortable (.*?) - MIT.*$", "\\1", x)
sub(".*(\\d+\\.\\d+\\.\\d+).*", "\\1", x)
}
get_new_sortable_version()

sortable_version <- "1.15.0"
yaml_version <- "1.15.0"
sortable_version <- "1.15.3"
yaml_version <- sortable_version


writeLines(
Expand All @@ -13,3 +19,5 @@ sortable_yaml_file <- file.path("inst", "htmlwidgets", "sortable.yaml")
config <- yaml::read_yaml(sortable_yaml_file)
config$dependencies[[1]]$version <- yaml_version
yaml::write_yaml(config, sortable_yaml_file)


0 comments on commit 42df2e9

Please sign in to comment.