In the previous API, we relied on
input$<dock_id>_state to perform checks on panel ids
but this was no reliable. For instance, calling add_panel()
in an observeEvent(), the state was not up to date as you
had to wait for the next reactive flush to get an update of the input.
This lead to unconvenient workarounds when manipulating the dock from
the server. Now, checks are performed UI side an raise JS warnings in
the console and optionally Shiny notification when
options(dockViewR.mode = "dev").
dock_view_proxy() to create a reactive proxy to a
dock instance.add_panel() dock_id parameter is changed
to dock. It now expects a dock proxy created with
dock_view_proxy(). This is to be more consistent with other
htmlwidgets. Same applies for remove_panel(),
select_panel() and move_panel().dock_state() and all related functions also expect a
dock proxy created with dock_view_proxy().update_dock_view() also relies on
dock_view_proxy().We reworked the infrastructure around adding and removing tabs using
new_add_tab_plugin() and
new_remove_tab_plugin(). See the updated documentation for
more details. This also impacts the way add_tab and
remove parameters are used in dock_view() and
panel() respectively, which weren’t very safe in the
previous API.
set_panel_title() to change the title of a panel
from the server of a Shiny app.input[["<dock_ID>_n-panels"]],
input[["<dock_ID>_n-groups"]],input[["<dock_ID>_active-panel"]],
input[["<dock_ID>_active-group"]] as subset of
input[["<dock_ID>_state"]]. Priority is normal so any
observer listening to those input won’t trigger when there is no change
in the layout.input[["<dock_ID>_restored"]] as a
callback when the dock get restored after calling
restore_dock().get_active_views()], a convenience function that
returns the active view in each group and
get_active_panel()], another convenience function that
returns the active panel in the active group.list()).input[["<dock_ID>_initialized"]] within an
onRender callback. Allows to track when the dock is ready
to perform actions server side.add_panel(): if no referencePanel or
referenceGroup is provided, the panel is added relative to
the container.get_groups_ids() now correctly returns all group
ids (nested groups were not returned).add_tab parameter in dock_view(). By
default, there is a default_add_tab_callback() that sets
input[["<dock_ID>_panel-to-add"]], so you can create
observers with custom logic, including removing the panel with
add_panel(). An example of usage is available at https://github.com/cynkra/dockViewR/blob/main/inst/examples/add_panel/app.R.abyss-spaced theme caused the theme not to
be applied.... were not passed to the dockview JS
constructor. (:clown:)style parameter to panel(). This
allows to customize the style of the panel container. It expects a named
list with CSS properties and values. We kept old default values for
backward compatibility, but you can now overwrite them.update_dock_view() to update a dock instance from
the server of a Shiny app.input[["<dock_ID>_added-panel"]] to track
which panel has been added. This can be useful in a shiny app
context.input[["<dock_ID>_removed-panel"]] to track
which panel has been removed. This can be useful in a shiny app
context.select_panel() function to select a specific panel
by id from the server.remove parameter to add_panel() to
allow panels to be removable or not. It expects a list with two fields:
enable and mode. Enable is a boolean (default to FALSE) and mode is one
of manual, auto (default to auto). In auto
mode, dockview JS removes the panel when it is closed and all its
content. If you need more control over the panel removal, set it to
manual. Doing so, clicking on remove triggers a custom input on the
server side, input[["<dock_ID>_panel-to-remove"]], so
you can create observers with custom logic, including removing the panel
with remove_panel(). An example of usage is available at https://github.com/cynkra/dockViewR/blob/main/inst/examples/add_panel/app.R.add_tab parameter to dock_view() to
allow controlling the add tab behavior. By default, it is disabled. You
can activate it by passing list(enable = TRUE). By default,
a JS callback inserts a panel into the dock with instructions on how to
overwrite it by content created from the server of a Shiny app. This
control is global, that is, you can’t have panel for which add_tab is
enabled and another for which it is disabled due to constraints imposed
by the JS api.