From ef6123cc668d417b50af95742dd47cb9aa313302 Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Thu, 19 Sep 2024 00:03:33 +0200 Subject: [PATCH] Add returns section to func docs --- R/columns.R | 61 +++++++++++++++++++++++------- R/context_calls.R | 15 ++++++-- R/data.R | 2 +- R/experimental.R | 2 +- R/input_handlers.R | 3 -- R/spreadsheet.R | 4 +- R/tabulator.R | 1 + R/tabulator_context.R | 1 + R/tabulator_options.R | 11 ++++-- R/utils.R | 2 + R/zzz.R | 2 +- man/add_row.Rd | 7 +++- man/delete_selected_rows.Rd | 7 +++- man/for_each_col.Rd | 3 ++ man/redo.Rd | 3 ++ man/set_calculation.Rd | 3 ++ man/set_column_defaults.Rd | 3 ++ man/set_editor.Rd | 3 ++ man/set_formatter_color.Rd | 3 ++ man/set_formatter_datetime.Rd | 15 +++++++- man/set_formatter_html.Rd | 3 ++ man/set_formatter_image.Rd | 3 ++ man/set_formatter_link.Rd | 3 ++ man/set_formatter_money.Rd | 3 ++ man/set_formatter_plaintext.Rd | 3 ++ man/set_formatter_progress.Rd | 15 +++++--- man/set_formatter_star.Rd | 3 ++ man/set_formatter_textarea.Rd | 3 ++ man/set_formatter_tick_cross.Rd | 7 +++- man/set_formatter_toggle_switch.Rd | 5 ++- man/set_formatter_traffic_light.Rd | 7 +++- man/set_header_filter.Rd | 3 ++ man/set_multi_column_header.Rd | 3 ++ man/set_options_group_by.Rd | 3 ++ man/set_options_pagination.Rd | 3 ++ man/set_tooltip.Rd | 3 ++ man/spreadsheet_def.Rd | 3 ++ man/tabulator.Rd | 3 ++ man/tabulatorContext.Rd | 3 ++ man/tabulator_options.Rd | 9 +++-- man/titanic.Rd | 3 ++ man/trigger_download.Rd | 6 ++- man/trigger_get_data.Rd | 3 ++ man/trigger_get_sheet_data.Rd | 3 ++ man/undo.Rd | 3 ++ 45 files changed, 210 insertions(+), 47 deletions(-) diff --git a/R/columns.R b/R/columns.R index 7ccb95d..429467d 100644 --- a/R/columns.R +++ b/R/columns.R @@ -71,6 +71,7 @@ add_filter_to_columns <- function(columns) { #' If set to \code{NULL} it is applied to all columns. #' @param .f (function): The column setter function that updates the column settings. #' @param ... Arguments that are passed to \code{.f}. +#' @returns tabulator htmlwidget #' @example examples/for_each_col.R #' @export for_each_col <- function(widget, columns = NULL, .f, ...) { @@ -91,6 +92,7 @@ for_each_col <- function(widget, columns = NULL, .f, ...) { #' @param widget (\code{\link{tabulator}}) A tabulator widget. #' @param column (character): The column the formatter is applied to. #' @param hoz_align (character): The horizontal alignment of the column. +#' @returns tabulator htmlwidget #' @example examples/formatters/formatter_html.R #' @export set_formatter_html <- function(widget, column, hoz_align = c("left", "center", "right")) { @@ -100,6 +102,7 @@ set_formatter_html <- function(widget, column, hoz_align = c("left", "center", " #' Set plain text formatter #' @inheritParams set_formatter_html +#' @returns tabulator htmlwidget #' @export # TODO: Add example set_formatter_plaintext <- function(widget, column, hoz_align = "left") { @@ -110,6 +113,7 @@ set_formatter_plaintext <- function(widget, column, hoz_align = "left") { #' Set textarea formatter #' @inheritParams set_formatter_html #' @example examples/formatters/formatter_textarea.R +#' @returns tabulator htmlwidget #' @export set_formatter_textarea <- function(widget, column, hoz_align = "left") { col_update <- list(formatter = "textarea", hozAlign = hoz_align) @@ -128,6 +132,7 @@ set_formatter_textarea <- function(widget, column, hoz_align = "left") { #' which is the standard style for negative numbers in accounting. #' @param precision (integer, bool): The number of decimals to display. #' Set to \code{FALSE} to display all decimals that are provided. +#' @returns tabulator htmlwidget #' @example examples/formatters/formatter_money.R #' @export set_formatter_money <- function( @@ -164,6 +169,7 @@ set_formatter_money <- function( #' when generating the image src url. #' @param url_suffix (character): String to add to the end of the cell value #' when generating the image src url. +#' @returns tabulator htmlwidget #' @example examples/formatters/formatter_image.R #' @export set_formatter_image <- function( @@ -174,6 +180,7 @@ set_formatter_image <- function( url_prefix = NULL, url_suffix = NULL, hoz_align = "center") { + # Body col_update <- list( formatter = "image", formatterParams = compact(list( @@ -195,6 +202,7 @@ set_formatter_image <- function( #' The cell is passed to the function as its first argument. #' Use \link[htmlwidgets]{JS} to pass JS code. #' @param target (character): Target attribute of the anchor tag. +#' @returns tabulator htmlwidget #' @example examples/formatters/formatter_link.R #' @export set_formatter_link <- function( @@ -213,7 +221,8 @@ set_formatter_link <- function( urlPrefix = url_prefix, url = url, target = target - )) + )), + hozAlign = hoz_align ) modify_col_def(widget, column, col_update) } @@ -222,6 +231,7 @@ set_formatter_link <- function( #' @inheritParams set_formatter_html #' @param number_of_stars The maximum number of stars to be displayed. #' If set to \code{NA}, the maximum value of the column is used. +#' @returns tabulator htmlwidget #' @example examples/formatters/formatter_star.R #' @export set_formatter_star <- function(widget, column, number_of_stars = NA, hoz_align = "center") { @@ -240,16 +250,17 @@ set_formatter_star <- function(widget, column, number_of_stars = NA, hoz_align = #' Set progress formatter #' @inheritParams set_formatter_html #' @param min (numeric): The minimum value for progress bar. -#' If set to \code{NA} the minimum value of the column is used. +#' If set to \code{NA}, the minimum value of the column is used. #' @param max (numeric): The maximum value for progress bar. -#' If set to \code{NA} the maximum value of the column is used. +#' If set to \code{NA}, the maximum value of the column is used. #' @param color (character): Either a single color or a vector of colors -#' @param legend (character, \code{TRUE}, JavaScript function): If set to \code{TRUE} the value of the cell is displayed. -#' Set to \code{NA} to display no value at all. -#' Use \link[htmlwidgets]{JS} to pass a JS function as legend. -#' The cell value is passed to the function as its first argument. +#' @param legend (character, \code{TRUE}, JavaScript function): If set to \code{TRUE}, +#' the value of the cell is displayed. Set to \code{NA} to display no value at all. +#' Use \link[htmlwidgets]{JS} to pass a JavaScript function as legend. +#' In this case, the cell value is passed to the function as its first argument. #' @param legend_color (character): The text color of the legend. #' @param legend_align (character): The text alignment of the legend. +#' @returns tabulator htmlwidget #' @example examples/formatters/formatter_progress.R #' @export set_formatter_progress <- function( @@ -262,6 +273,7 @@ set_formatter_progress <- function( legend_color = "#000000", legend_align = c("center", "left", "right", "justify"), hoz_align = "left") { + # Body if (is.na(min)) { min <- min(widget$x$data[column]) } @@ -288,9 +300,10 @@ set_formatter_progress <- function( #' Set tick cross formatter #' @inheritParams set_formatter_html #' @example examples/formatters/formatter_tick_cross.R +#' @returns tabulator htmlwidget #' @export -set_formatter_tick_cross <- function(widget, column) { - col_update <- list(formatter = "tickCross") +set_formatter_tick_cross <- function(widget, column, hoz_align = "center") { + col_update <- list(formatter = "tickCross", hozAlign = hoz_align) modify_col_def(widget, column, col_update) } @@ -299,10 +312,11 @@ set_formatter_tick_cross <- function(widget, column) { #' @param size (numeric): The size of the switch in pixels. #' @param on_value (character): The value of the cell for the switch to be on. #' @param off_value (character) The value of the cell for the switch to be off. -#' @param on_truthy (bool): TODO: ??? +#' @param on_truthy (bool): Whether to show the switch as on if the value of the cell is truthy. #' @param on_color (character): The color of the switch if it is on. #' @param off_color (character): The color of the switch if it is off. #' @param clickable (bool): Enable switch functionality to toggle the cell value on click. +#' @returns tabulator htmlwidget #' @example examples/formatters/formatter_toggle_switch.R #' @export set_formatter_toggle_switch <- function( @@ -332,11 +346,17 @@ set_formatter_toggle_switch <- function( } #' Set datetime formatter +#' +#' @details +#' To use this formatter, you need to include the luxon html dependency +#' when creating a tabulator widget. #' @inheritParams set_formatter_html #' @param input_format (character): The datetime input format. #' @param output_format (character): The datetime output format. -#' @param invalid_placeholder (character): The value to be displayed if an invalid datetime is provided. +#' @param invalid_placeholder (character): The value to be displayed +#' if an invalid datetime is provided. #' @param timezone (character): The timezone of the datetime. +#' @returns tabulator htmlwidget #' @example examples/formatters/formatter_datetime.R #' @export set_formatter_datetime <- function( @@ -345,7 +365,8 @@ set_formatter_datetime <- function( input_format = "yyyy-MM-dd hh:ss:mm", output_format = "yy/MM/dd", invalid_placeholder = "(invalid datetime)", - timezone = NA) { + timezone = NA, + hoz_align = "left") { # Body col_update <- list( formatter = "datetime", @@ -354,13 +375,15 @@ set_formatter_datetime <- function( outputFormat = output_format, invalidPlaceholder = invalid_placeholder, timezone = timezone - ) + ), + hozAlign = hoz_align ) modify_col_def(widget, column, col_update) } #' Set color formatter #' @inheritParams set_formatter_html +#' @returns tabulator htmlwidget #' @example examples/formatters/formatter_color.R #' @export set_formatter_color <- function(widget, column) { @@ -370,6 +393,7 @@ set_formatter_color <- function(widget, column) { #' Set traffic light formatter #' @inheritParams set_formatter_progress +#' @returns tabulator htmlwidget #' @example examples/formatters/formatter_traffic_light.R #' @export set_formatter_traffic_light <- function( @@ -418,6 +442,7 @@ set_column_editor <- function(widget, columns, type = c("input", "number")) { #' @param editor (character): The editor type. #' @param validator (character vector): One or more validators to validate user input. #' @param ... Optional editor parameters depending on the selected editor. +#' @returns tabulator htmlwidget #' @seealso #' * \url{https://tabulator.info/docs/6.2/edit} for available editors #' * \url{https://tabulator.info/docs/6.2/validate} for available validators @@ -450,12 +475,16 @@ set_editor <- function( #' @param func (character): The filter function. #' @param clearable (bool): Whether to display a cross to clear the filter. #' @param placeholder (character): Text that is displayed when no filter is set. +#' @returns tabulator htmlwidget #' @example examples/misc/header_filter.R #' @export +# TODO: Rename to params that they match params used by Tabulator JS set_header_filter <- function( widget, column, + # TODO: Rename to 'filter_type' or just 'filter' or 'header_filter'? type = c("input", "number", "list", "tickCross"), + # TODO: Rename to 'filter_func'? func = c("like", "=", ">", ">=", "<", "<="), values_lookup = TRUE, clearable = TRUE, @@ -482,6 +511,7 @@ set_header_filter <- function( #' Set tooltip #' @inheritParams set_formatter_html +#' @returns tabulator htmlwidget #' @example examples/misc/tooltip.R #' @export set_tooltip <- function(widget, column) { @@ -499,6 +529,7 @@ set_tooltip <- function(widget, column) { #' @param tooltip (bool): Whether to show tooltips displaying the cell value. #' @param width (integer): Fixed width of columns. #' @param ... Additional settings. +#' @returns tabulator htmlwidget #' @seealso \url{https://tabulator.info/docs/6.2/columns#defaults} #' @example examples/column_defaults.R #' @export @@ -510,6 +541,7 @@ set_column_defaults <- function( tooltip = TRUE, width = NULL, ...) { + # Body widget$x$options$columnDefaults <- compact(list( editor = editor, headerFilter = header_filter, @@ -529,12 +561,13 @@ 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. +#' @returns tabulator htmlwidget #' @example examples/data_url.R #' @export set_calculation <- function( widget, column, - func = c("avg", "max", "min", "sum", "count", "unique"), + func = c("avg", "max", "min", "sum", "count", "unique"), # Rename to 'calc'? precision = 2, pos = c("top", "bottom")) { # Body diff --git a/R/context_calls.R b/R/context_calls.R index 63936d7..6a88183 100644 --- a/R/context_calls.R +++ b/R/context_calls.R @@ -1,7 +1,9 @@ #' Download table data #' @param ctx (\code{\link{tabulatorContext}}): tabulator context object #' @param type (character): csv, json or xlsx (needs sheetjs: \code{tabulator(..., sheetjs = TRUE)}) -#' @param file_name (character): file name +#' @param file_name (character, \code{NULL}): File name. +#' @returns tabulator context object +#' If \code{NULL}, it is set to \code{"data.{type}"}. #' @export trigger_download <- function(ctx, type = c("csv", "json", "xlsx"), file_name = NULL) { if (is.null(file_name)) { @@ -13,26 +15,30 @@ trigger_download <- function(ctx, type = c("csv", "json", "xlsx"), file_name = N #' Submit data to R #' @inheritParams trigger_download +#' @returns tabulator context object #' @export trigger_get_data <- function(ctx) { invoke_method(ctx, "getData") } -#' Add a row to a table +#' Add row to table #' @inheritParams trigger_download #' @param row (list | NULL): row data or \code{NULL} to add an empty row +#' @returns tabulator context object #' @export add_row <- function(ctx, row = NULL) { invoke_method(ctx, "addRow", row) } -#' Delete selected rows from a table +#' Delete selected rows from table #' @inheritParams trigger_download +#' @returns tabulator context object #' @export delete_selected_rows <- function(ctx) { invoke_method(ctx, "deleteSelectedRows") } +# TODO: Test bindings delete_row <- function(ctx) { print("Not implemented yet") return(ctx) @@ -40,6 +46,7 @@ delete_row <- function(ctx) { #' Undo changes #' @inheritParams trigger_download +#' @returns tabulator context object #' @export undo <- function(ctx) { invoke_method(ctx, "undo") @@ -47,6 +54,7 @@ undo <- function(ctx) { #' Redo changes #' @inheritParams trigger_download +#' @returns tabulator context object #' @export redo <- function(ctx) { invoke_method(ctx, "redo") @@ -54,6 +62,7 @@ redo <- function(ctx) { #' Submit sheet data to R #' @inheritParams trigger_download +#' @returns tabulator context object #' @export trigger_get_sheet_data <- function(ctx) { invoke_method(ctx, "getSheetData") diff --git a/R/data.R b/R/data.R index c6df733..d0c5c39 100644 --- a/R/data.R +++ b/R/data.R @@ -2,9 +2,9 @@ #' Titanic data set #' @param col_select (character vector): Columns to select. +#' @returns data frame #' @export titanic <- function(col_select = NULL) { titanic_data_url <- "https://raw.githubusercontent.com/eodaGmbH/rtabulator/main/data-raw/titanic.csv" - readr::read_csv(titanic_data_url, col_select = !!col_select, show_col_types = FALSE) } diff --git a/R/experimental.R b/R/experimental.R index 95e05bb..c31907f 100644 --- a/R/experimental.R +++ b/R/experimental.R @@ -2,6 +2,7 @@ #' Set multi column header #' @inheritParams set_formatter_html #' @param multi_columns (list): Multi column definitions. +#' @returns tabulator htmlwidget #' @example examples/experimental/multi_column_header.R #' @export set_multi_column_header <- function(widget, multi_columns) { @@ -18,7 +19,6 @@ set_multi_column_header <- function(widget, multi_columns) { if (!column_name %in% used_cols) res <- append(res, list(find_column(widget, column_name))) } - # return(res) widget$x$options$columns <- res return(widget) } diff --git a/R/input_handlers.R b/R/input_handlers.R index f424188..62faf2c 100644 --- a/R/input_handlers.R +++ b/R/input_handlers.R @@ -13,7 +13,6 @@ input_handler_data <- function(value, ...) { return(data) } -# TODO: Not used at the moment input_handler_sheet_data <- function(value, ...) { if (debug_mode()) { print("custom input handler data") @@ -24,13 +23,11 @@ input_handler_sheet_data <- function(value, ...) { } data <- value$data - # try(data <- jsonlite::fromJSON(jsonlite::toJSON(value$data, auto_unbox = TRUE))) try(data <- sheet_data_to_matrix(data), silent = TRUE) return(data) } sheet_data_to_matrix <- function(data) { vec <- unlist(purrr::map(data, ~ as_vec(.x))) - # try({vec <- as.numeric(vec)}) return(matrix(vec, nrow = length(data), byrow = TRUE)) } diff --git a/R/spreadsheet.R b/R/spreadsheet.R index 99c6f1e..0f73ce4 100644 --- a/R/spreadsheet.R +++ b/R/spreadsheet.R @@ -3,13 +3,15 @@ #' @param key (character): Optional unique key of the spreadsheet. #' @param data (list): The initial data of the spreadsheet. #' Set to \code{NULL} to create an empty spreadsheet. +#' @returns list #' @export spreadsheet_def <- function(title, key = NULL, data = NULL) { return(compact(as.list(environment()))) } ## #' @export -# TODO: Is this useful? +# TODO: Is this useful? Yes, but rename to 'set_options_spreadsheet' +# and use 'modify_tabulator_options' set_spreadsheet_mode <- function( widget, spreadsheet_rows = NULL, diff --git a/R/tabulator.R b/R/tabulator.R index 2c78b44..fe03523 100644 --- a/R/tabulator.R +++ b/R/tabulator.R @@ -17,6 +17,7 @@ #' @param height Height of the widget. #' @param element_id The unique ID of the widget. #' @param ... Named arguments that are appended to the \code{options} parameter. +#' @returns tabulator htmlwidget #' @example examples/multiple_spreadsheets.R #' @import htmlwidgets #' @export diff --git a/R/tabulator_context.R b/R/tabulator_context.R index 1284d46..d390588 100644 --- a/R/tabulator_context.R +++ b/R/tabulator_context.R @@ -20,6 +20,7 @@ invoke_method <- function(widget, method_name, ...) { #' A \code{tabulatorContext} object makes it possible to update your widget in a Shiny application. #' @param output_id (character): A tabulator output id. #' @param session A shiny session object. +#' @returns tabulator context object #' @export tabulatorContext <- function(output_id, session = shiny::getDefaultReactiveDomain()) { ctx <- list( diff --git a/R/tabulator_options.R b/R/tabulator_options.R index 32780ff..264535f 100644 --- a/R/tabulator_options.R +++ b/R/tabulator_options.R @@ -2,7 +2,7 @@ #' @param height (character) The height of the table in px. #' @param history (bool): Enable user interaction history functionality. #' @param columns (list): Column definitions. -#' If set to \code{NULL} definitions are auto generated from table data. +#' If set to \code{NULL}, definitions are auto generated from table data. #' @param layout (character): Layout mode of the table columns. #' @param responsive_layout (bool): Automatically hide and show columns to fit #' the width of the Tabulator element. @@ -22,8 +22,8 @@ #' Set to \code{FALSE} to disable toggling at all. #' @param edit_trigger_event (character): Event that triggers a cell edit. #' @param selectable_rows (character, bool, integer) Set to \code{FALSE} to disble row selection. -#' If set to \code{TRUE} you can select as many rows as you want. -#' If set to \code{"highlight"} rows are just highlighted but do not change state when clicked. +#' If set to \code{TRUE}, you can select as many rows as you want. +#' If set to \code{"highlight"}, rows are just highlighted but do not change state when clicked. #' An integer value sets the maximum number of rows that can be selected. #' @param pagination (bool): Whether to enable pagination. #' @param pagination_size (integer): Number of rows on each page. @@ -36,6 +36,7 @@ #' @param spreadsheet_sheets (list): List of sheet definitions. #' @param spreadsheet_sheet_tabs (bool): Whether to show sheet tabs in the footer. #' @param ... Further options. +#' @returns list #' @seealso \url{https://tabulator.info/docs/6.2/options} #' @example examples/tabulator_setup.R #' @export @@ -53,6 +54,7 @@ tabulator_options <- function( row_height = NULL, add_row_pos = c("bottom", "top"), movable_rows = FALSE, + # TODO: Add movable rows params # --- # movable_rows_connected_tables = NULL, # movable_rows_receiver = NULL, @@ -83,6 +85,7 @@ tabulator_options <- function( spreadsheet_sheets = NULL, spreadsheet_sheet_tabs = NULL, ...) { + # Body params <- as.list(environment()) params$layout <- match.arg(layout) params$add_row_pos <- match.arg(add_row_pos) @@ -104,6 +107,7 @@ default_spreadsheet_options <- list( #' Set pagination options #' @inheritParams set_formatter_html #' @inheritParams tabulator_options +#' @returns tabulator htmlwidget #' @example examples/options/pagination_options.R #' @export set_options_pagination <- function( @@ -127,6 +131,7 @@ set_options_pagination <- function( #' Set group by options #' @inheritParams set_formatter_html #' @inheritParams tabulator_options +#' @returns tabulator htmlwidget #' @export set_options_group_by <- function( widget, diff --git a/R/utils.R b/R/utils.R index a257409..4fd19e1 100644 --- a/R/utils.R +++ b/R/utils.R @@ -7,11 +7,13 @@ keys_to_camel_case <- function(x) { } # Drop NULL values from list +# TODO: Use 'purrr:compact()' compact <- function(x) { x[!sapply(x, is.null)] } # Convert list of named lists to data frame +# TODO: obsolete!? list_to_data_frame <- function(x) { # jsonlite::toJSON(x, auto_unbox = TRUE) |> jsonlite::fromJSON() return(do.call(rbind.data.frame, x)) diff --git a/R/zzz.R b/R/zzz.R index 9ec5b8c..43cb5f6 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -1,5 +1,5 @@ .onLoad <- function(libname, pkgname) { - # For devtools::load_all() we need to remove to handler if it is already registered + # For devtools::load_all() we need to remove handlers if it is already registered try(shiny::removeInputHandler("rtabulator.data"), silent = FALSE) try(shiny::removeInputHandler("rtabulator.sheet_data"), silent = FALSE) diff --git a/man/add_row.Rd b/man/add_row.Rd index 65c682a..e4edbab 100644 --- a/man/add_row.Rd +++ b/man/add_row.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/context_calls.R \name{add_row} \alias{add_row} -\title{Add a row to a table} +\title{Add row to table} \usage{ add_row(ctx, row = NULL) } @@ -11,6 +11,9 @@ add_row(ctx, row = NULL) \item{row}{(list | NULL): row data or \code{NULL} to add an empty row} } +\value{ +tabulator context object +} \description{ -Add a row to a table +Add row to table } diff --git a/man/delete_selected_rows.Rd b/man/delete_selected_rows.Rd index 85989e4..d335b6b 100644 --- a/man/delete_selected_rows.Rd +++ b/man/delete_selected_rows.Rd @@ -2,13 +2,16 @@ % Please edit documentation in R/context_calls.R \name{delete_selected_rows} \alias{delete_selected_rows} -\title{Delete selected rows from a table} +\title{Delete selected rows from table} \usage{ delete_selected_rows(ctx) } \arguments{ \item{ctx}{(\code{\link{tabulatorContext}}): tabulator context object} } +\value{ +tabulator context object +} \description{ -Delete selected rows from a table +Delete selected rows from table } diff --git a/man/for_each_col.Rd b/man/for_each_col.Rd index 13a27db..5db3755 100644 --- a/man/for_each_col.Rd +++ b/man/for_each_col.Rd @@ -16,6 +16,9 @@ If set to \code{NULL} it is applied to all columns.} \item{...}{Arguments that are passed to \code{.f}.} } +\value{ +tabulator htmlwidget +} \description{ Apply a column setter function to multiple columns } diff --git a/man/redo.Rd b/man/redo.Rd index 5ed186f..dafff08 100644 --- a/man/redo.Rd +++ b/man/redo.Rd @@ -9,6 +9,9 @@ redo(ctx) \arguments{ \item{ctx}{(\code{\link{tabulatorContext}}): tabulator context object} } +\value{ +tabulator context object +} \description{ Redo changes } diff --git a/man/set_calculation.Rd b/man/set_calculation.Rd index 1b091c2..8722a2c 100644 --- a/man/set_calculation.Rd +++ b/man/set_calculation.Rd @@ -25,6 +25,9 @@ Set to \code{FALSE} to display all decimals.} \item{pos}{(character): Position at which calculated values are displayed.} } +\value{ +tabulator htmlwidget +} \description{ Set calculation } diff --git a/man/set_column_defaults.Rd b/man/set_column_defaults.Rd index ee1fe55..4e37437 100644 --- a/man/set_column_defaults.Rd +++ b/man/set_column_defaults.Rd @@ -31,6 +31,9 @@ Set to \code{FALSE} to disable header filters.} \item{...}{Additional settings.} } +\value{ +tabulator htmlwidget +} \description{ Set column defaults } diff --git a/man/set_editor.Rd b/man/set_editor.Rd index d96959a..08ffdfd 100644 --- a/man/set_editor.Rd +++ b/man/set_editor.Rd @@ -24,6 +24,9 @@ set_editor( \item{...}{Optional editor parameters depending on the selected editor.} } +\value{ +tabulator htmlwidget +} \description{ Set editor } diff --git a/man/set_formatter_color.Rd b/man/set_formatter_color.Rd index bbe0fff..8c4c5b3 100644 --- a/man/set_formatter_color.Rd +++ b/man/set_formatter_color.Rd @@ -11,6 +11,9 @@ set_formatter_color(widget, column) \item{column}{(character): The column the formatter is applied to.} } +\value{ +tabulator htmlwidget +} \description{ Set color formatter } diff --git a/man/set_formatter_datetime.Rd b/man/set_formatter_datetime.Rd index 685dd5d..5831573 100644 --- a/man/set_formatter_datetime.Rd +++ b/man/set_formatter_datetime.Rd @@ -10,7 +10,8 @@ set_formatter_datetime( input_format = "yyyy-MM-dd hh:ss:mm", output_format = "yy/MM/dd", invalid_placeholder = "(invalid datetime)", - timezone = NA + timezone = NA, + hoz_align = "left" ) } \arguments{ @@ -22,13 +23,23 @@ set_formatter_datetime( \item{output_format}{(character): The datetime output format.} -\item{invalid_placeholder}{(character): The value to be displayed if an invalid datetime is provided.} +\item{invalid_placeholder}{(character): The value to be displayed +if an invalid datetime is provided.} \item{timezone}{(character): The timezone of the datetime.} + +\item{hoz_align}{(character): The horizontal alignment of the column.} +} +\value{ +tabulator htmlwidget } \description{ Set datetime formatter } +\details{ +To use this formatter, you need to include the luxon html dependency +when creating a tabulator widget. +} \examples{ data <- data.frame( Person = c("Franz", "Ferdinand"), diff --git a/man/set_formatter_html.Rd b/man/set_formatter_html.Rd index cdca52e..a8d3c4d 100644 --- a/man/set_formatter_html.Rd +++ b/man/set_formatter_html.Rd @@ -13,6 +13,9 @@ set_formatter_html(widget, column, hoz_align = c("left", "center", "right")) \item{hoz_align}{(character): The horizontal alignment of the column.} } +\value{ +tabulator htmlwidget +} \description{ Set HTML formatter } diff --git a/man/set_formatter_image.Rd b/man/set_formatter_image.Rd index e4b7a9f..a99fcb8 100644 --- a/man/set_formatter_image.Rd +++ b/man/set_formatter_image.Rd @@ -31,6 +31,9 @@ when generating the image src url.} \item{hoz_align}{(character): The horizontal alignment of the column.} } +\value{ +tabulator htmlwidget +} \description{ Set image formatter } diff --git a/man/set_formatter_link.Rd b/man/set_formatter_link.Rd index e705b54..0f5f3ef 100644 --- a/man/set_formatter_link.Rd +++ b/man/set_formatter_link.Rd @@ -31,6 +31,9 @@ Use \link[htmlwidgets]{JS} to pass JS code.} \item{hoz_align}{(character): The horizontal alignment of the column.} } +\value{ +tabulator htmlwidget +} \description{ Set link formatter } diff --git a/man/set_formatter_money.Rd b/man/set_formatter_money.Rd index 555e843..77a3649 100644 --- a/man/set_formatter_money.Rd +++ b/man/set_formatter_money.Rd @@ -39,6 +39,9 @@ Set to \code{FALSE} to display all decimals that are provided.} \item{hoz_align}{(character): The horizontal alignment of the column.} } +\value{ +tabulator htmlwidget +} \description{ Set money formatter } diff --git a/man/set_formatter_plaintext.Rd b/man/set_formatter_plaintext.Rd index e8a1702..07f887c 100644 --- a/man/set_formatter_plaintext.Rd +++ b/man/set_formatter_plaintext.Rd @@ -13,6 +13,9 @@ set_formatter_plaintext(widget, column, hoz_align = "left") \item{hoz_align}{(character): The horizontal alignment of the column.} } +\value{ +tabulator htmlwidget +} \description{ Set plain text formatter } diff --git a/man/set_formatter_progress.Rd b/man/set_formatter_progress.Rd index 34c65ea..52796aa 100644 --- a/man/set_formatter_progress.Rd +++ b/man/set_formatter_progress.Rd @@ -22,17 +22,17 @@ set_formatter_progress( \item{column}{(character): The column the formatter is applied to.} \item{min}{(numeric): The minimum value for progress bar. -If set to \code{NA} the minimum value of the column is used.} +If set to \code{NA}, the minimum value of the column is used.} \item{max}{(numeric): The maximum value for progress bar. -If set to \code{NA} the maximum value of the column is used.} +If set to \code{NA}, the maximum value of the column is used.} \item{color}{(character): Either a single color or a vector of colors} -\item{legend}{(character, \code{TRUE}, JavaScript function): If set to \code{TRUE} the value of the cell is displayed. -Set to \code{NA} to display no value at all. -Use \link[htmlwidgets]{JS} to pass a JS function as legend. -The cell value is passed to the function as its first argument.} +\item{legend}{(character, \code{TRUE}, JavaScript function): If set to \code{TRUE}, +the value of the cell is displayed. Set to \code{NA} to display no value at all. +Use \link[htmlwidgets]{JS} to pass a JavaScript function as legend. +In this case, the cell value is passed to the function as its first argument.} \item{legend_color}{(character): The text color of the legend.} @@ -40,6 +40,9 @@ The cell value is passed to the function as its first argument.} \item{hoz_align}{(character): The horizontal alignment of the column.} } +\value{ +tabulator htmlwidget +} \description{ Set progress formatter } diff --git a/man/set_formatter_star.Rd b/man/set_formatter_star.Rd index e74c9cc..538891f 100644 --- a/man/set_formatter_star.Rd +++ b/man/set_formatter_star.Rd @@ -16,6 +16,9 @@ If set to \code{NA}, the maximum value of the column is used.} \item{hoz_align}{(character): The horizontal alignment of the column.} } +\value{ +tabulator htmlwidget +} \description{ Set star rating formatter } diff --git a/man/set_formatter_textarea.Rd b/man/set_formatter_textarea.Rd index 66ca710..1130fbe 100644 --- a/man/set_formatter_textarea.Rd +++ b/man/set_formatter_textarea.Rd @@ -13,6 +13,9 @@ set_formatter_textarea(widget, column, hoz_align = "left") \item{hoz_align}{(character): The horizontal alignment of the column.} } +\value{ +tabulator htmlwidget +} \description{ Set textarea formatter } diff --git a/man/set_formatter_tick_cross.Rd b/man/set_formatter_tick_cross.Rd index 6485159..25a75a1 100644 --- a/man/set_formatter_tick_cross.Rd +++ b/man/set_formatter_tick_cross.Rd @@ -4,12 +4,17 @@ \alias{set_formatter_tick_cross} \title{Set tick cross formatter} \usage{ -set_formatter_tick_cross(widget, column) +set_formatter_tick_cross(widget, column, hoz_align = "center") } \arguments{ \item{widget}{(\code{\link{tabulator}}) A tabulator widget.} \item{column}{(character): The column the formatter is applied to.} + +\item{hoz_align}{(character): The horizontal alignment of the column.} +} +\value{ +tabulator htmlwidget } \description{ Set tick cross formatter diff --git a/man/set_formatter_toggle_switch.Rd b/man/set_formatter_toggle_switch.Rd index d0f13bd..5cd7563 100644 --- a/man/set_formatter_toggle_switch.Rd +++ b/man/set_formatter_toggle_switch.Rd @@ -27,7 +27,7 @@ set_formatter_toggle_switch( \item{off_value}{(character) The value of the cell for the switch to be off.} -\item{on_truthy}{(bool): TODO: ???} +\item{on_truthy}{(bool): Whether to show the switch as on if the value of the cell is truthy.} \item{on_color}{(character): The color of the switch if it is on.} @@ -35,6 +35,9 @@ set_formatter_toggle_switch( \item{clickable}{(bool): Enable switch functionality to toggle the cell value on click.} } +\value{ +tabulator htmlwidget +} \description{ Set toggle switch formatter } diff --git a/man/set_formatter_traffic_light.Rd b/man/set_formatter_traffic_light.Rd index dfb235f..09a45e4 100644 --- a/man/set_formatter_traffic_light.Rd +++ b/man/set_formatter_traffic_light.Rd @@ -19,15 +19,18 @@ set_formatter_traffic_light( \item{column}{(character): The column the formatter is applied to.} \item{min}{(numeric): The minimum value for progress bar. -If set to \code{NA} the minimum value of the column is used.} +If set to \code{NA}, the minimum value of the column is used.} \item{max}{(numeric): The maximum value for progress bar. -If set to \code{NA} the maximum value of the column is used.} +If set to \code{NA}, the maximum value of the column is used.} \item{color}{(character): Either a single color or a vector of colors} \item{hoz_align}{(character): The horizontal alignment of the column.} } +\value{ +tabulator htmlwidget +} \description{ Set traffic light formatter } diff --git a/man/set_header_filter.Rd b/man/set_header_filter.Rd index 0e7792b..18639b8 100644 --- a/man/set_header_filter.Rd +++ b/man/set_header_filter.Rd @@ -29,6 +29,9 @@ set_header_filter( \item{placeholder}{(character): Text that is displayed when no filter is set.} } +\value{ +tabulator htmlwidget +} \description{ Set header filter } diff --git a/man/set_multi_column_header.Rd b/man/set_multi_column_header.Rd index 72af914..d89fec1 100644 --- a/man/set_multi_column_header.Rd +++ b/man/set_multi_column_header.Rd @@ -11,6 +11,9 @@ set_multi_column_header(widget, multi_columns) \item{multi_columns}{(list): Multi column definitions.} } +\value{ +tabulator htmlwidget +} \description{ Set multi column header } diff --git a/man/set_options_group_by.Rd b/man/set_options_group_by.Rd index 116d789..1b16175 100644 --- a/man/set_options_group_by.Rd +++ b/man/set_options_group_by.Rd @@ -26,6 +26,9 @@ Set to \code{FALSE} to disable toggling at all.} \item{...}{Further options.} } +\value{ +tabulator htmlwidget +} \description{ Set group by options } diff --git a/man/set_options_pagination.Rd b/man/set_options_pagination.Rd index 6e59cd9..ca369cf 100644 --- a/man/set_options_pagination.Rd +++ b/man/set_options_pagination.Rd @@ -26,6 +26,9 @@ set_options_pagination( \item{...}{Further options.} } +\value{ +tabulator htmlwidget +} \description{ Set pagination options } diff --git a/man/set_tooltip.Rd b/man/set_tooltip.Rd index fe44ee2..5ce5661 100644 --- a/man/set_tooltip.Rd +++ b/man/set_tooltip.Rd @@ -11,6 +11,9 @@ set_tooltip(widget, column) \item{column}{(character): The column the formatter is applied to.} } +\value{ +tabulator htmlwidget +} \description{ Set tooltip } diff --git a/man/spreadsheet_def.Rd b/man/spreadsheet_def.Rd index 705480f..a928c0f 100644 --- a/man/spreadsheet_def.Rd +++ b/man/spreadsheet_def.Rd @@ -14,6 +14,9 @@ spreadsheet_def(title, key = NULL, data = NULL) \item{data}{(list): The initial data of the spreadsheet. Set to \code{NULL} to create an empty spreadsheet.} } +\value{ +list +} \description{ Create a spreadsheet definition } diff --git a/man/tabulator.Rd b/man/tabulator.Rd index 285a4d1..16faa85 100644 --- a/man/tabulator.Rd +++ b/man/tabulator.Rd @@ -46,6 +46,9 @@ Passed to \code{\link[readr]{read_csv}} if \code{data} is a file name.} \item{...}{Named arguments that are appended to the \code{options} parameter.} } +\value{ +tabulator htmlwidget +} \description{ Create a tabulator widget } diff --git a/man/tabulatorContext.Rd b/man/tabulatorContext.Rd index 04ac6af..683fe92 100644 --- a/man/tabulatorContext.Rd +++ b/man/tabulatorContext.Rd @@ -11,6 +11,9 @@ tabulatorContext(output_id, session = shiny::getDefaultReactiveDomain()) \item{session}{A shiny session object.} } +\value{ +tabulator context object +} \description{ Create a tabulator context object } diff --git a/man/tabulator_options.Rd b/man/tabulator_options.Rd index b0a2ad8..3d5eb4d 100644 --- a/man/tabulator_options.Rd +++ b/man/tabulator_options.Rd @@ -42,7 +42,7 @@ tabulator_options( \item{history}{(bool): Enable user interaction history functionality.} \item{columns}{(list): Column definitions. -If set to \code{NULL} definitions are auto generated from table data.} +If set to \code{NULL}, definitions are auto generated from table data.} \item{layout}{(character): Layout mode of the table columns.} @@ -77,8 +77,8 @@ Set to \code{FALSE} to disable toggling at all.} \item{edit_trigger_event}{(character): Event that triggers a cell edit.} \item{selectable_rows}{(character, bool, integer) Set to \code{FALSE} to disble row selection. -If set to \code{TRUE} you can select as many rows as you want. -If set to \code{"highlight"} rows are just highlighted but do not change state when clicked. +If set to \code{TRUE}, you can select as many rows as you want. +If set to \code{"highlight"}, rows are just highlighted but do not change state when clicked. An integer value sets the maximum number of rows that can be selected.} \item{pagination}{(bool): Whether to enable pagination.} @@ -103,6 +103,9 @@ An integer value sets the maximum number of rows that can be selected.} \item{...}{Further options.} } +\value{ +list +} \description{ Create a tabulator options object } diff --git a/man/titanic.Rd b/man/titanic.Rd index 6fee7de..47795be 100644 --- a/man/titanic.Rd +++ b/man/titanic.Rd @@ -9,6 +9,9 @@ titanic(col_select = NULL) \arguments{ \item{col_select}{(character vector): Columns to select.} } +\value{ +data frame +} \description{ Titanic data set } diff --git a/man/trigger_download.Rd b/man/trigger_download.Rd index 5ecaea5..2bb8211 100644 --- a/man/trigger_download.Rd +++ b/man/trigger_download.Rd @@ -11,7 +11,11 @@ trigger_download(ctx, type = c("csv", "json", "xlsx"), file_name = NULL) \item{type}{(character): csv, json or xlsx (needs sheetjs: \code{tabulator(..., sheetjs = TRUE)})} -\item{file_name}{(character): file name} +\item{file_name}{(character, \code{NULL}): File name.} +} +\value{ +tabulator context object + If \code{NULL}, it is set to \code{"data.{type}"}. } \description{ Download table data diff --git a/man/trigger_get_data.Rd b/man/trigger_get_data.Rd index dd0ccd8..9c02214 100644 --- a/man/trigger_get_data.Rd +++ b/man/trigger_get_data.Rd @@ -9,6 +9,9 @@ trigger_get_data(ctx) \arguments{ \item{ctx}{(\code{\link{tabulatorContext}}): tabulator context object} } +\value{ +tabulator context object +} \description{ Submit data to R } diff --git a/man/trigger_get_sheet_data.Rd b/man/trigger_get_sheet_data.Rd index 1dc783b..a312048 100644 --- a/man/trigger_get_sheet_data.Rd +++ b/man/trigger_get_sheet_data.Rd @@ -9,6 +9,9 @@ trigger_get_sheet_data(ctx) \arguments{ \item{ctx}{(\code{\link{tabulatorContext}}): tabulator context object} } +\value{ +tabulator context object +} \description{ Submit sheet data to R } diff --git a/man/undo.Rd b/man/undo.Rd index 41185c7..08b9a9c 100644 --- a/man/undo.Rd +++ b/man/undo.Rd @@ -9,6 +9,9 @@ undo(ctx) \arguments{ \item{ctx}{(\code{\link{tabulatorContext}}): tabulator context object} } +\value{ +tabulator context object +} \description{ Undo changes }