Class: Primer::OpenProject::TreeView::SubTree

Inherits:
Component
  • Object
show all
Defined in:
app/components/primer/open_project/tree_view/sub_tree.rb

Overview

A ‘TreeView` sub-tree.

This component is part of the <%= link_to_component(Primer::OpenProject::TreeView) %> component and should not be used directly.

Constant Summary

Constants inherited from Component

Component::INVALID_ARIA_LABEL_TAGS

Constants included from Status::Dsl

Status::Dsl::STATUSES

Constants included from ViewHelper

ViewHelper::HELPERS

Constants included from TestSelectorHelper

TestSelectorHelper::TEST_SELECTOR_TAG

Constants included from FetchOrFallbackHelper

FetchOrFallbackHelper::InvalidValueError

Constants included from AttributesHelper

AttributesHelper::PLURAL_ARIA_ATTRIBUTES, AttributesHelper::PLURAL_DATA_ATTRIBUTES

Instance Method Summary collapse

Methods inherited from Component

deprecated?, generate_id

Methods included from JoinStyleArgumentsHelper

#join_style_arguments

Methods included from TestSelectorHelper

#add_test_selector

Methods included from FetchOrFallbackHelper

#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?

Methods included from ClassNameHelper

#class_names

Methods included from AttributesHelper

#aria, #data, #extract_data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes

Methods included from ExperimentalSlotHelpers

included

Methods included from ExperimentalRenderHelpers

included

Constructor Details

#initialize(**system_arguments) ⇒ SubTree

Returns a new instance of SubTree.

Parameters:

  • system_arguments (Hash)

    The arguments accepted by <%= link_to_component(Primer::OpenProject::TreeView::SubTreeContainer) %>.



91
92
93
94
95
96
97
98
# File 'app/components/primer/open_project/tree_view/sub_tree.rb', line 91

def initialize(**system_arguments)
  system_arguments[:data] = merge_data(
    system_arguments,
    { data: { target: "tree-view-sub-tree-node.subTree" } }
  )

  @container = SubTreeContainer.new(**system_arguments)
end

Instance Method Details

#defer?Boolean

Returns:

  • (Boolean)


100
101
102
# File 'app/components/primer/open_project/tree_view/sub_tree.rb', line 100

def defer?
  loader?
end

#with_leaf(**system_arguments, &block) ⇒ Object

Adds an leaf node to the tree. Leaf nodes are nodes that do not have children.

Parameters:

  • component_klass (Class)

    The class to use instead of the default <%= link_to_component(Primer::OpenProject::TreeView::LeafNode) %>

  • system_arguments (Hash)

    These arguments are forwarded to <%= link_to_component(Primer::OpenProject::TreeView::LeafNode) %>, or whatever class is passed as the ‘component_klass` argument.



5
6
# File 'app/components/primer/open_project/tree_view/sub_tree.rb', line 5

def with_leaf(**system_arguments, &block)
end

#with_loading_spinner(**system_arguments, &block) ⇒ Object

Adds a loader to this sub-tree that displays a skeleton animation while nodes are fetched from the server.

Parameters:

  • system_arguments (Hash)

    The arguments accepted by <%= link_to_component(Primer::OpenProject::TreeView::SkeletonLoader) %>.



4
5
# File 'app/components/primer/open_project/tree_view/sub_tree.rb', line 4

def with_loading_spinner(**system_arguments, &block)
end

#with_sub_tree(**system_arguments, &block) ⇒ Object

Adds a sub-tree node to the tree. Sub-trees are nodes that have children, which can be both leaf nodes and other sub-trees.

Parameters:

  • component_klass (Class)

    The class to use instead of the default <%= link_to_component(Primer::OpenProject::TreeView::SubTreeNode) %>

  • system_arguments (Hash)

    These arguments are forwarded to <%= link_to_component(Primer::OpenProject::TreeView::SubTreeNode) %>, or whatever class is passed as the ‘component_klass` argument.



5
6
# File 'app/components/primer/open_project/tree_view/sub_tree.rb', line 5

def with_sub_tree(**system_arguments, &block)
end