Class: HakumiComponents::SelectionControl::TreeNode
- Inherits:
-
Object
- Object
- HakumiComponents::SelectionControl::TreeNode
- Extended by:
- T::Sig
- Defined in:
- app/components/hakumi_components/selection_control/tree_node.rb
Constant Summary collapse
- RawValue =
T.type_alias do T.nilable(T.any(String, Symbol, Numeric, T::Boolean, T::Array[T.untyped], T::Hash[Types::HtmlKey, T.untyped])) end
- InputHash =
T.type_alias { T::Hash[Types::HtmlKey, RawValue] }
- Input =
T.type_alias { T.any(TreeNode, InputHash) }
- Payload =
T.type_alias { T::Hash[Symbol, T.nilable(T.any(String, Symbol, Numeric, T::Boolean, T::Array[T.untyped]))] }
Instance Attribute Summary collapse
-
#async ⇒ Object
readonly
Returns the value of attribute async.
-
#checkable ⇒ Object
readonly
Returns the value of attribute checkable.
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#disable_checkbox ⇒ Object
readonly
Returns the value of attribute disable_checkbox.
-
#disabled ⇒ Object
readonly
Returns the value of attribute disabled.
-
#icon ⇒ Object
readonly
Returns the value of attribute icon.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#loading ⇒ Object
readonly
Returns the value of attribute loading.
-
#selectable ⇒ Object
readonly
Returns the value of attribute selectable.
-
#switcher_icon ⇒ Object
readonly
Returns the value of attribute switcher_icon.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(label:, value:, children: [], disabled: false, selectable: true, checkable: true, disable_checkbox: false, icon: nil, switcher_icon: nil, async: false, loading: false) ⇒ TreeNode
constructor
A new instance of TreeNode.
- #string_value ⇒ Object
- #to_cascader_option ⇒ Object
- #to_tree_node ⇒ Object
Constructor Details
#initialize(label:, value:, children: [], disabled: false, selectable: true, checkable: true, disable_checkbox: false, icon: nil, switcher_icon: nil, async: false, loading: false) ⇒ TreeNode
Returns a new instance of TreeNode.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/components/hakumi_components/selection_control/tree_node.rb', line 31 def initialize( label:, value:, children: [], disabled: false, selectable: true, checkable: true, disable_checkbox: false, icon: nil, switcher_icon: nil, async: false, loading: false ) @label = label @value = value @children = children @disabled = disabled @selectable = selectable @checkable = checkable @disable_checkbox = disable_checkbox @icon = icon @switcher_icon = switcher_icon @async = async @loading = loading end |
Instance Attribute Details
#async ⇒ Object (readonly)
Returns the value of attribute async.
85 86 87 |
# File 'app/components/hakumi_components/selection_control/tree_node.rb', line 85 def async @async end |
#checkable ⇒ Object (readonly)
Returns the value of attribute checkable.
73 74 75 |
# File 'app/components/hakumi_components/selection_control/tree_node.rb', line 73 def checkable @checkable end |
#children ⇒ Object (readonly)
Returns the value of attribute children.
64 65 66 |
# File 'app/components/hakumi_components/selection_control/tree_node.rb', line 64 def children @children end |
#disable_checkbox ⇒ Object (readonly)
Returns the value of attribute disable_checkbox.
76 77 78 |
# File 'app/components/hakumi_components/selection_control/tree_node.rb', line 76 def disable_checkbox @disable_checkbox end |
#disabled ⇒ Object (readonly)
Returns the value of attribute disabled.
67 68 69 |
# File 'app/components/hakumi_components/selection_control/tree_node.rb', line 67 def disabled @disabled end |
#icon ⇒ Object (readonly)
Returns the value of attribute icon.
79 80 81 |
# File 'app/components/hakumi_components/selection_control/tree_node.rb', line 79 def icon @icon end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
58 59 60 |
# File 'app/components/hakumi_components/selection_control/tree_node.rb', line 58 def label @label end |
#loading ⇒ Object (readonly)
Returns the value of attribute loading.
88 89 90 |
# File 'app/components/hakumi_components/selection_control/tree_node.rb', line 88 def loading @loading end |
#selectable ⇒ Object (readonly)
Returns the value of attribute selectable.
70 71 72 |
# File 'app/components/hakumi_components/selection_control/tree_node.rb', line 70 def selectable @selectable end |
#switcher_icon ⇒ Object (readonly)
Returns the value of attribute switcher_icon.
82 83 84 |
# File 'app/components/hakumi_components/selection_control/tree_node.rb', line 82 def switcher_icon @switcher_icon end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
61 62 63 |
# File 'app/components/hakumi_components/selection_control/tree_node.rb', line 61 def value @value end |
Instance Method Details
#string_value ⇒ Object
91 92 93 |
# File 'app/components/hakumi_components/selection_control/tree_node.rb', line 91 def string_value @value.to_s end |
#to_cascader_option ⇒ Object
113 114 115 116 117 118 119 120 |
# File 'app/components/hakumi_components/selection_control/tree_node.rb', line 113 def to_cascader_option { value: @value, label: @label, disabled: @disabled, children: @children.map(&:to_cascader_option) }.compact end |
#to_tree_node ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'app/components/hakumi_components/selection_control/tree_node.rb', line 96 def to_tree_node { key: string_value, title: @label, children: @children.map(&:to_tree_node), disabled: @disabled, selectable: @selectable, checkable: @checkable, disable_checkbox: @disable_checkbox, icon: @icon, switcher_icon: @switcher_icon, async: @async, loading: @loading }.compact end |