Controls are buttons and inputs in the UI that are not backed by model data, but instead control things like report parameters or provide action buttons. This namespace provides functions to help with UI plugin development, and other functions that reduce the amount of boilerplate data when declaring controls.
A typical control is added to a component by adding a ::control/controls key, which is a map from made-up control key to a control definition map.
(defsc-form Form [this props]
{::control/controls {::new {:type :button
:label "Go"
:action (fn [this] ...)}}})
Render plugins can then expose layout keys that allow you to place the controls. For example as action buttons. See ::form/action-buttons.
Controls are buttons and inputs in the UI that are not backed by model data, but instead control things like report parameters or provide action buttons. This namespace provides functions to help with UI plugin development, and other functions that reduce the amount of boilerplate data when declaring controls. A typical control is added to a component by adding a ::control/controls key, which is a map from made-up control key to a control definition map. ``` (defsc-form Form [this props] {::control/controls {::new {:type :button :label "Go" :action (fn [this] ...)}}}) ``` Render plugins can then expose layout keys that allow you to place the controls. For example as action buttons. See ::form/action-buttons.
(component-controls class-or-instance)
(component-controls class-or-instance recursive?)
Gets all of the controls declared on the given class or instance (e.g. report, container).
If recursive?
(default true) is true, then it will look for non-local controls on all classes contained in the (recursive)
query of that class or instance. Controls appearing in the target class-or-instance
will override any from children,
but any duplicates found in children will be unified by choosing an arbitrary one. Thus, if your component is pulling
unifying inconsistent controls from children you should probably provide a hand-unified control in the parent.
Gets all of the controls declared on the given class or instance (e.g. report, container). If `recursive?` (default true) is true, then it will look for non-local controls on all classes contained in the (recursive) query of that class or instance. Controls appearing in the target `class-or-instance` will override any from children, but any duplicates found in children will be unified by choosing an arbitrary one. Thus, if your component is pulling unifying inconsistent controls from children you should probably provide a hand-unified control in the parent.
A component used for normalizing control state in the app so that reports in containers can share controls.
A component used for normalizing control state in the app so that reports in containers can share controls.
(control-map->controls control-map)
Convert an old-style control map into a vector of controls that can be normalized into state as Control
s.
Convert an old-style control map into a vector of controls that can be normalized into state as `Control`s.
(current-value instance control-key)
Get the current value of a control. If it is normalized, then it will come from the normalized table. If the control is local to the instance, then it will come from there.
Get the current value of a control. If it is normalized, then it will come from the normalized table. If the control is local to the instance, then it will come from there.
(render-control owner control-key)
(render-control owner control-key control)
Render the control defined by control-key
in the ::report/controls option. The control definition in question will be
a (fn [props])
where props
is a map containing:
owner
- The React instance of the mounted component where the controls will be shown.control-key
- The name of the control key being rendered .Render the control defined by `control-key` in the ::report/controls option. The control definition in question will be a `(fn [props])` where `props` is a map containing: * `owner` - The React instance of the mounted component where the controls will be shown. * `control-key` - The name of the control key being rendered .
Run the controlled content with the current values of the controlled parameters.
Run the controlled content with the current values of the controlled parameters.
(set-parameter! instance parameter-name new-value)
Set the given parameter on a report or container.
Set the given parameter on a report or container.
(standard-control-layout class-or-instance)
Returns a map of:
:action-layout
: a simple vector of keywords for the order buttons should appear. The default is the order they
are returned from the control map (which is stable, but not necessarily the order of appearance in the map).:input-layout
: a nested vector of keywords that represents the preferred layout of the controls
on class-or-instance
. This layout can be declared on the class-or-instance, or will default to a
single-row layout based on the entry order in the control map (stable but undefined).Returns a map of: * `:action-layout`: a simple vector of keywords for the order buttons should appear. The default is the order they are returned from the control map (which is stable, but not necessarily the order of appearance in the map). * `:input-layout`: a nested vector of keywords that represents the preferred layout of the controls on `class-or-instance`. This layout can be declared on the class-or-instance, or will default to a single-row layout based on the entry order in the control map (stable but undefined).
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close