Logic including a modal-based UI for board actions such as "append block"
or "edit stack" can be specified using action objects, which essentially
are classed functions that can either be called to return a shiny module
as_module = TRUE or a function as_module = FALSE which injects code
(passed as expr) into a shiny server context.
new_action(func)is_action(x)
is_action_module(x)
is_action_function(x)
add_block_action(trigger, as_module = TRUE)
append_block_action(trigger, as_module = TRUE)
remove_block_action(trigger, as_module = TRUE)
add_link_action(trigger, as_module = TRUE)
remove_link_action(trigger, as_module = TRUE)
add_stack_action(trigger, as_module = TRUE)
edit_stack_action(trigger, as_module = TRUE)
remove_stack_action(trigger, as_module = TRUE)
block_input_select(
block = NULL,
block_id = NULL,
links = NULL,
mode = c("create", "update", "inputs"),
...
)
block_registry_selectize(id, blocks = list_blocks())
board_select(id, blocks, selected = NULL, ...)
The constructor new_action returns a classed function that
inherits from action. Inheritance can be checked with functions
is_action(), is_action_module() and is_action_function(), which all
return scalar logicals.
For utilities block_input_select(), block_registry_selectize()
and board_select, see the respective sections.
A function which will be evaluated (with modified formals) in a shiny server context
Object
A string, function or shiny::reactive()
Logical flag controlling the return type
Block object
Block ID
Links object
Switch for determining the return object
Forwarded to other methods
Input ID
Character vector of block registry IDs
Character vector of pre-selected block (registry) IDs
Determine input options for a block by removing inputs that are already used
and also takes into account some edge-cases, such as variadic blocks. If
mode is set as "inputs", this will return a character vector, for
"create", the return value of a shiny::selectizeInput() call and for
"update", the return value of a shiny::updateSelectizeInput() call.
This creates UI for a block registry selector via shiny::selectizeInput()
and returns an object that inherits from shiny.tag.
Block selection UI, enumerating all blocks in a board is available as
board_select(). An object that inherits from shiny.tag is returned, which
contains the result from a shiny::selectizeInput() call.
An action is a function that can be called with arguments trigger and
as_module to return another function. The action trigger may either be a
string (referring to an input), a function (that will be called with a
single argument input) or a shiny::reactive() object. The flag
as_module controls the behavior of the returned function: if TRUE, it
is a function (inheriting from action_module) with arguments board,
update, ... and domain, which, when called, again returns a function
with arguments input, output and session, suitable as argument to
shiny::moduleServer(). If FALSE is passed instead, a function
(inheriting from action_function) with arguments board, update, ...
and domain is returned.
The expression expr, passed when instantiating an action object will be
evaluated in a context, where the following bindings exist: board,
update, domain, input, output and session. In the case of
as_module = FALSE, domain is an alias for session.