User settings at the board level are managed by a board_options object.
This can be constructed via new_board_options() and in case the set of
user options is to be extended, the constructor is designed with sub-classing
in mind. Consequently, the associated validator validate_board_options()
is available as S3 generic. Inheritance checking is available as
is_board_options() and coercion as as_board_options().
board_ctor(x)new_board_option(
id,
default,
ui,
server = function(board, ..., session) {
},
update_trigger = id,
transform = identity,
category = NULL,
ctor = sys.parent(),
pkg = NULL
)
is_board_option(x)
validate_board_option(x)
as_board_option(x, ...)
# S3 method for board_option
as_board_option(x, ...)
board_option_id(x)
board_option_trigger(x)
board_option_default(x)
board_option_category(x)
board_option_ui(x, id = NULL)
board_option_server(x, ...)
board_option_transform(x)
board_option_value(x, value = board_option_default(x))
board_option_ctor(x)
# S3 method for default
validate_board_option(x)
new_board_name_option(value = NULL, category = "Board options", ...)
new_n_rows_option(
value = blockr_option("n_rows", 50L),
category = "Table options",
...
)
new_page_size_option(
value = blockr_option("page_size", 5L),
category = "Table options",
...
)
new_filter_rows_option(
value = blockr_option("filter_rows", FALSE),
category = "Table options",
...
)
new_thematic_option(
value = blockr_option("thematic", NULL),
category = "Theme options",
...
)
new_dark_mode_option(
value = blockr_option("dark_mode", NULL),
category = "Theme options",
...
)
new_show_conditions_option(
value = blockr_option("show_conditions", c("warning", "error")),
category = "Board options",
...
)
new_llm_model_option(value = NULL, category = "Board options", ...)
new_board_options(...)
default_board_options(...)
is_board_options(x)
as_board_options(x)
# S3 method for board_options
as_board_options(x)
# S3 method for board_option
as_board_options(x)
# S3 method for list
as_board_options(x)
# S3 method for board
as_board_options(x)
validate_board_options(x)
board_option_values(x)
get_board_option_value(opt, session = get_session())
set_board_option_value(opt, val, session = get_session())
get_board_option_or_default(
opt,
opts = default_board_options(),
session = get_session()
)
get_board_option_or_null(opt, session = get_session())
get_board_option_values(
...,
opts = default_board_options(),
if_not_found = c("error", "default", "null"),
session = get_session()
)
combine_board_options(...)
All of new_board_options() and as_board_options() return a
board_options object, as does the validator validate_board_options(),
which is typically called for side effects of throwing errors is validation
does not pass. Inheritance checking as is_board_options() returns a scalar
logical, while board_option_values() returns a named list of option values.
Board options object
Board option ID
Default value
Option UI
(Optional) option server
Shiny input entry/entries that trigger an update
(Optional) transform function
(Optional) string-valued category
Constructor information (used for serialization)
Options passed as individual arguments
Option value
Option name
Shiny session
New value
Board options
Behavior in case an option is not found
opt <- new_board_options(
new_board_name_option(),
new_page_size_option()
)
is_board_options(opt)
names(opt)
opt[["page_size"]]
Run the code above in your browser using DataLab