CodeCoupler Costa Components Launcher
Visualizes a Component Registry and can trigger loading the components defined in the registry.
It creates a list of the components in the form:
The manifest name is by default initially hidden. The user can click on an expand button to show the names. Otherwise the names will be shown in tooltips.
Groups will be displayed in popovers.
The overall inner structure of the component consists of the ul list shown above and two
additional div elements that provide buttons to show and hide the names:
Depending on its state, the root element can have the class collapsed. The div elements with the
classes toggler-collapse and toggler-expand are shown and hidden in turn.
The root element gets the class empty if no li element exists or all elements are not visible to
the current user because of authentication restrictions. The two toggle elements are hidden if the
root element has the empty class.
Authentication
The identity parameter can be used to pass a reactive object from an authentication module. This
object is monitored for changes. Any li elements that the user does not have access to are
assigned the restricted class and are hidden by default:
Styling
The component provides only the bare minimum of styling. It simply ensures that names are shown and hidden, that the correct toggle button is displayed (or both hidden if empty), and that the mouse pointer changes when you hover over the list items or the toggle button. You will need to style it yourself to display it as desired.
CSS Classes
The internal HTML structure can be accessed as follows:
Example Vertical List Styling
Here's an example of how to display the list vertically, which you could use for example in a
sidebar. We use here SCSS by defining it in a placeholder (%) that is inserted in two places using
@extend to avoid redundancy.
Popover
The popovers will be rendered into the body of the document. For this reason, in addition to the
popover class, you can assign an additional class to the popovers using the popoverClasses prop
to target it more precisely.
Use this class in conjunction with the popover class to access the inner HTML elements. Otherwise,
Bootstrap's predefined styles may override yours if the Bootstrap stylesheet is loaded after your
own:
Popovers contains specific inner elements.
Header:
Body:
Colorizing using Bootstrap variables (example):
Colorizing arrow depending on placement using plain CSS:
List inside body:
Essentially, the same ul list structure is used here as in the component itself (see the previous
chapter). If possible, this should be handled in SCSS by defining it in a placeholder (%) that is
inserted in both places using @extend to avoid redundancy. See example above.
Tooltips
The tooltips will be rendered into the body of the document. For this reason, in addition to the
tootip class, you can assign an additional class to the popovers using the tooltipClasses prop
to target it more precisely.
Use this class in conjunction with the tooltip class to access the inner HTML elements. Otherwise,
Bootstrap's predefined styles may override yours if the Bootstrap stylesheet is loaded after your
own:
Tooltips contains specific inner elements.
Body:
Colorizing using Bootstrap variables (example):
Colorizing arrow depending on placement using plain CSS:
Reference
Options
identity-
Reactive identity object aof an authentication module. This identity will be used to check restrictions. If a component have restrictions that do not match the identity, the component will not be shown.
registry-
The registry to visualize
popoverClassesandtooltipClasses-
The popoivers and tooltips will be rendered into the
bodyof the document. For this reason, you can assign an additional classes to the popver and tooltip elements to target them more precisely. loadOverrides-
Override for every start definition object that will be used to load a component.
defaultGroupManifest: { name: String, iconHtml: String }-
The default name and icon for groups.
collapsed-
Is by default
true. If set tofalsethe list will be shown expanded initaially. toggler: { enabled: Boolean, collapse: String, expand: String }-
enabledis by defaulttrue. If set tofalsethe toggle button to expand/collapse the list will be hidden.With the properties
collapseandexpandyou can specify the icons of the toggler which are by default SVG graphics. hookIdentificationChange-
It can be a function that is called every time the identity changes. This function receives one object as an argument with the following properties:
- launcher: Instance of the launcher component.
- rootListEmptyBefore:
trueif the list was empty before the identity change. - rootListEmpty:
trueif the list is empty after the identity change. - toFinalState: A function that can be called to set all classes to the final state after the identity change.
- toInitialState: A function that reverts the class changes to the state before the identity change.
debug-
If set to true the tooltips will open on click (not hover) and will never close. Popvers will never close. Useful for debuging styling.
Instance Getter
toggleCollapse,toggleExpand,rootUl-
Points to the main elements
<ul>and the both divs of the toggler. allListElement-
Array of all
<li>elemnts. Each element has an attached data object namedmeta, which can be retrieved using thedatafunction of the@codecoupler/js-bundlepackage.The data object have the following properties:
- isGroup:
trueif it is an element with subgroups. - selfRestrictedBefore:
trueif the element was restricted before the last identity change. - selfRestricted:
trueif the element is currently restricted. - restrictions: The restriction object that will be used.
- parent: Points to the parent element if it is in a subgroup, otherwise it is set to
null. - position: Position within a group.
- isGroup: