LiveDebugger.Components.Tree (LiveDebugger v0.1.4)

View Source

Tree component which show nested tree of live view and live components.

Summary

Functions

Calculates the maximum level to be opened in the tree.

Tree component which show nested tree of live view and live components. You need to pass TreeNode struct to render the tree. This component emits select_node event with node_id param to the event_target when a node is clicked. node_id is parsed. To calculate max_opened_node_level it uses max_nesting_level/2 function.

Functions

max_opened_node_level(root_node, max_nodes \\ 20)

@spec max_opened_node_level(
  root_node :: LiveDebugger.Structs.TreeNode.t(),
  max_nodes :: integer()
) ::
  integer()

Calculates the maximum level to be opened in the tree.

tree(assigns)

Tree component which show nested tree of live view and live components. You need to pass TreeNode struct to render the tree. This component emits select_node event with node_id param to the event_target when a node is clicked. node_id is parsed. To calculate max_opened_node_level it uses max_nesting_level/2 function.

Attributes

  • tree_node (:any) (required) - The TreeNode struct to render.
  • title (:string) (required) - The title of the tree.
  • event_target (:any) (required) - The target for the click event.
  • selected_node_id (:string) (required) - The id of the selected node.
  • class (:string) - CSS class. Defaults to nil.
  • max_opened_node_level (:integer) (required) - The maximum level of the tree to be opened.