Skip to content

Commit

Permalink
Merge pull request #42 from eodaGmbH/prepare-cran-release-re-submit
Browse files Browse the repository at this point in the history
Prepare cran release re submit
  • Loading branch information
crazycapivara authored Sep 22, 2024
2 parents 9f7949d + f0e580c commit db51758
Show file tree
Hide file tree
Showing 25 changed files with 65 additions and 55 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ _NAMESPACE
images/
^vignettes/articles$
^cran-comments\.md$
^CRAN-SUBMISSION$
3 changes: 3 additions & 0 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version: 0.1.2
Date: 2024-09-20 09:54:46 UTC
SHA: 9f7949def2b1079e140042cee48c201d7f92e1d7
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: rtabulator
Type: Package
Title: R Bindings for Tabulator JS
Title: R Bindings for 'Tabulator JS'
Version: 0.1.2
Date: 2024-09-20
Date: 2024-09-22
Authors@R: c(
person("Stefan", "Kuethe", email = "[email protected]", role = c("aut", "cre", "cph")),
person("Nico", "Friess", email = "[email protected]", role = "aut"),
Expand All @@ -11,8 +11,8 @@ Authors@R: c(
)
Maintainer: Stefan Kuethe <[email protected]>
Description: Provides R bindings for 'Tabulator JS' <https://tabulator.info/>.
Makes it a breeze to create highly customizable interactive tables in markdown documents
and Shiny applications. It includes filtering, grouping, editing, input validation,
Makes it a breeze to create highly customizable interactive tables in 'rmarkdown' documents
and 'shiny' applications. It includes filtering, grouping, editing, input validation,
history recording, column formatters, packaged themes and more.
URL:
https://github.com/eodaGmbH/rtabulator
Expand Down
4 changes: 3 additions & 1 deletion R/columns.R
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,9 @@ set_column_defaults <- function(
#' @param precision (integer) The number of decimals to display.
#' Set to \code{FALSE} to display all decimals.
#' @param pos (character): Position at which calculated values are displayed.
#' @example examples/data_url.R
#' @examples
#' tabulator(iris) |>
#' set_calculation("Sepal_Length", "avg")
#' @export
set_calculation <- function(
widget,
Expand Down
19 changes: 10 additions & 9 deletions R/context_calls.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,24 @@
#' @param file_name File name. Set to `"data.{type}"` if `file_name = NULL`.
#' @returns A [tabulatorContext()] object
#' @examples
#' \dontrun{
#' \donttest{
#' tabulatorContext("table") |>
#' trigger_download("csv", "table-data.csv")
#' }
#' @export
trigger_download <- function(ctx, type = c("csv", "json", "xlsx"), file_name = NULL) {
type <- match.arg(type)
if (is.null(file_name)) {
file_name <- glue::glue("data.{type}")
}

invoke_method(ctx, "download", match.arg(type), file_name)
invoke_method(ctx, "download", type, file_name)
}

#' Submit data to R
#' @inherit trigger_download params return
#' @examples
#' \dontrun{
#' \donttest{
#' tabulatorContext("table") |>
#' trigger_get_data()
#' }
Expand All @@ -37,7 +38,7 @@ trigger_get_data <- function(ctx) {
#' @inherit trigger_download params return
#' @param row (list): row data or \code{NULL} to add an empty row
#' @examples
#' \dontrun{
#' \donttest{
#' tabulatorContext("table") |>
#' add_row()
#' }
Expand All @@ -49,7 +50,7 @@ add_row <- function(ctx, row = NULL) {
#' Delete selected rows from table
#' @inherit trigger_download params return
#' @examples
#' \dontrun{
#' \donttest{
#' tabulatorContext("table") |>
#' delete_selected_rows()
#' }
Expand All @@ -60,14 +61,14 @@ delete_selected_rows <- function(ctx) {

# TODO: Test bindings
delete_row <- function(ctx) {
print("Not implemented yet")
message("Not implemented yet")
return(ctx)
}

#' Undo changes
#' @inherit trigger_download params return
#' @examples
#' \dontrun{
#' \donttest{
#' tabulatorContext("table") |>
#' undo()
#' }
Expand All @@ -79,7 +80,7 @@ undo <- function(ctx) {
#' Redo changes
#' @inherit trigger_download params return
#' @examples
#' \dontrun{
#' \donttest{
#' tabulatorContext("table") |>
#' redo()
#' }
Expand All @@ -91,7 +92,7 @@ redo <- function(ctx) {
#' Submit sheet data to R
#' @inherit trigger_download params return
#' @examples
#' \dontrun{
#' \donttest{
#' tabulatorContext("table") |>
#' trigger_get_sheet_data()
#' }
Expand Down
6 changes: 6 additions & 0 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
#' Titanic data set
#' @param col_select (character vector): Columns to select.
#' @returns data frame
#' @examples
#' \donttest{
#' titanic(c("PassengerId", "Age", "Pclass", "Fare")) |>
#' head()
#' }
#'
#' @export
titanic <- function(col_select = NULL) {
titanic_data_url <- "https://raw.githubusercontent.com/eodaGmbH/rtabulator/main/data-raw/titanic.csv"
Expand Down
8 changes: 0 additions & 8 deletions R/input_handlers.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# https://book.javascript-for-r.com/shiny-complete.html
input_handler_data <- function(value, ...) {
if (debug_mode()) {
print("custom input handler data")
}

if (getOption("rtabulator.raw_data", FALSE)) {
return(value)
}
Expand All @@ -14,10 +10,6 @@ input_handler_data <- function(value, ...) {
}

input_handler_sheet_data <- function(value, ...) {
if (debug_mode()) {
print("custom input handler data")
}

if (getOption("rtabulator.raw_data", FALSE)) {
return(value)
}
Expand Down
3 changes: 1 addition & 2 deletions R/tabulator_context.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ invoke_method <- function(widget, method_name, ...) {
#' @param session A shiny session object.
#' @returns A context object that can be used to interact with a [tabulator()] HTML widget
#' @examples
#' \dontrun{
#' \donttest{
#' tabulatorContext("table") |>
#' trigger_download("csv")
#' }
Expand All @@ -38,7 +38,6 @@ tabulatorContext <- function(output_id, session = shiny::getDefaultReactiveDomai

send_tabulator_calls <- function(ctx) {
handler_name <- glue::glue("tabulator-{id}", id = ctx$id)
print(handler_name)
payload <- list(
id = ctx$id,
calls = ctx$x$calls
Expand Down
9 changes: 9 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## Release Summary

This is a re-submission.

* Added single quotes to package and software names in DESCRIPTION
* Removed 'print()' statements
* Changed `\dontrun` to `\donttest` for runable `tabulatorContext()` examples
* Added `\donttest` to examples that download data

## R CMD check results

0 errors | 0 warnings | 1 note
Expand Down
4 changes: 2 additions & 2 deletions examples/shiny/advanced_app/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ server <- function(input, output) {
trigger_get_data()
})

observeEvent(input$titanic_get_data, {
print(input$titanic_get_data)
observeEvent(input$titanic_data, {
print(head(input$titanic_data))
# print(head(tabulator_data_as_data_frame(input$titanic_get_data$data)))
# print(list_to_data_frame(input$table_data$data))
})
Expand Down
4 changes: 2 additions & 2 deletions examples/shiny/getting_started/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ server <- function(input, output) {
})

observeEvent(input$table_data, {
# print(input$table_data)
print(list_to_data_frame(input$table_data$data))
print(input$table_data)
# print(list_to_data_frame(input$table_data$data))
})
}

Expand Down
4 changes: 2 additions & 2 deletions examples/shiny/spreadsheet/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ server <- function(input, output) {

observe({
print("get_sheet_data")
print(input$spreadsheet_get_sheet_data)
print(input$spreadsheet_sheet_data)
# browser()
}) |> bindEvent(input$spreadsheet_get_sheet_data)
}) |> bindEvent(input$spreadsheet_sheet_data)
}

shinyApp(ui = ui, server = server)
4 changes: 2 additions & 2 deletions examples/shiny/titanic/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ server <- function(input, output) {
trigger_get_data()
})

observeEvent(input$titanic_get_data, {
observeEvent(input$titanic_data, {
print("Got data. Thanx!")
print(head(input$titanic_get_data))
print(head(input$titanic_data))
})
}

Expand Down
2 changes: 1 addition & 1 deletion inst/htmlwidgets/rtabulator.js

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

2 changes: 1 addition & 1 deletion man/add_row.Rd

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

2 changes: 1 addition & 1 deletion man/delete_selected_rows.Rd

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

2 changes: 1 addition & 1 deletion man/redo.Rd

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

14 changes: 2 additions & 12 deletions man/set_calculation.Rd

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

2 changes: 1 addition & 1 deletion man/tabulatorContext.Rd

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

7 changes: 7 additions & 0 deletions man/titanic.Rd

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

2 changes: 1 addition & 1 deletion man/trigger_download.Rd

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

2 changes: 1 addition & 1 deletion man/trigger_get_data.Rd

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

2 changes: 1 addition & 1 deletion man/trigger_get_sheet_data.Rd

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

2 changes: 1 addition & 1 deletion man/undo.Rd

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

4 changes: 2 additions & 2 deletions vignettes/articles/shiny.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ shinyApp(ui = ui, server = server)
- `{OUTPUT_ID}_rows_selected`
- `{OUTPUT_ID}_data_filtered`
- `{OUTPUT_ID}_cell_edited`
- `{OUTPUT_ID}_get_data`
- `{OUTPUT_ID}_get_sheet_data`
- `{OUTPUT_ID}_data`: Must be triggered with `trigger_get_data()`
- `{OUTPUT_ID}_sheet_data`: Must be triggered with `trigger_get_sheet_data()`

Use `tabulatorContext()` in conjunction with the trigger functions:

Expand Down

0 comments on commit db51758

Please sign in to comment.