Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Small updates and minor changes

Parimal Satyal09a35872a732
diff --git a/lookbook/docs/components/tree-view.md.erb b/lookbook/docs/components/tree-view.md.erb
index 9f5788af742..097f2c5b81d 100644
--- a/lookbook/docs/components/tree-view.md.erb
+++ b/lookbook/docs/components/tree-view.md.erb
@@ -1,4 +1,4 @@
-This component is currently an own implementation for OpenProject. It follows as strict as possible the requirements that Primer has set up for their [(react) TreeView](https://primer.style/product/components/tree-view/).
+This TreeView component is currently an internal implementation for OpenProject. It nevertheless follows the requirements that Primer has set up for their [(react) TreeView](https://primer.style/product/components/tree-view/) as closely as possible.
## Overview
@@ -10,26 +10,26 @@ This component is currently an own implementation for OpenProject. It follows as
Basically, we follow Primer's specification of a TreeView:
-1. Parent node: Expands/collapses to show/hide child nodes.
+1. Parent node: Expands/collapses to show/hide child nodes
2. End node: A node with no children (internally called "leaf")
-3. Chevron: Expands/collapses a parent node and indicates expanded/collapsed state.
+3. Chevron: Expands/collapses a parent node and indicates expanded/collapsed state
4. Nesting level indicator lines: Each line represents a level of nesting depth
-5. Leading action (optional): An IconButton to allow interaction with the node besides activating or expanding.
+5. Leading action (optional): An IconButton to allow interaction with the node besides activating or expanding
6. Leading visual (optional): A visual cue for additional context
-7. Node label: The text label for the node
-8. Trailing visual (optional): Same as a leading visual, but at the end
+7. Node label: The text label for the node or leaf
+8. Trailing visual (optional): Same as a leading visual, but placed to the right of all other element
### Multi-select
In addition to Primer's guidelines, we introduced an option called `select_variant` which can either be
* `none` (default)
-* `multiple`: Whe `multiple` is chosen, there is a checkbox rendered between the leading action and the leading visual.
+* `multiple`: Whe `multiple` is chosen, there is a checkbox rendered between the leading action and the leading visual to afford multi-selection
-Further, a `selection_strategy` can be configured. This influences the behaviour when selecting a parent node.
+Further, in multi-select mode, a `selection_strategy` can also be configured. This influences the influence checking a parent has on its children:
-* `descendants` (default): Selecting a parent, will automatically select all children. Deselecting the children, will leave the parent in a so called "mixed" state
-* `self`: Selecting a parent, does not affect the children
+* `descendants` (default): Checking a parent will automatically select all children. Subsequently deselecting any child will then leave the parent in a so called "mixed" state
+* `self`: Checking a parent does not affect the children (and vice-versa); every or leaf node behaves independently of others
<%= embed OpenProject::Common::TreeViewPreview, :multi_select, panels: %i[params] %>
@@ -38,25 +38,29 @@ Further, a `selection_strategy` can be configured. This influences the behaviour
We support two loading strategies:
* static (default): All items are loaded when the component is rendered
-* dynamic: Items are loaded from the server as soon as the parents are expanded
+* dynamic: Sub-nodes are loaded from the server as soon as a node is expanded
For more examples have a look [here](../../inspect/primer/open_project/file_tree_view/loading_skeleton).
### FileTreeView
-There is a special component called `FileTreeView` which is a pre-configured `TreeView` for the use case of showing a file hierarchy. For detailed examples have a look [here](../../inspect/primer/open_project/file_tree_view/default).
+There is a special component called `FileTreeView` which is a pre-configured `TreeView` for the use case of showing a file hierarchy. For more information, have a look at the [detailed examples here](../../inspect/primer/open_project/file_tree_view/default).
<%= embed OpenProject::Common::TreeViewPreview, :file_tree, panels: %i[params source] %>
## Best practices
**Do**
+- Use the simplest component as far possible ('self' selection strategy, static loading strategy)
+- Before using a basic TreeView with multi-select, check if related components like FilterableTreeView are more suited to your use case
**Don't**
+- Don't use multi-select mode dynamic loading; multi-select requires static loading
+
## Used in
-* the details view of a hierarchy CustomField
+* The details view of a hierarchy CustomField
## Examples