Class: Maglev::Uikit::Form::ComboboxComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Maglev::Uikit::Form::ComboboxComponent
- Defined in:
- app/components/maglev/uikit/form/combobox_component.rb
Instance Attribute Summary collapse
-
#html_options ⇒ Object
readonly
Returns the value of attribute html_options.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#search_path ⇒ Object
readonly
Returns the value of attribute search_path.
Instance Method Summary collapse
- #clearable? ⇒ Boolean
- #dom_id ⇒ Object
- #error ⇒ Object
- #hint ⇒ Object
-
#initialize(label:, name:, search_path:, options: {}, html_options: {}) ⇒ ComboboxComponent
constructor
options: { value: nil, placeholder: nil, error: nil, selected_label: nil, clearable: false, spread_fields: false } html_options: { data: { attribute: ‘value’ } }.
- #label_name ⇒ Object
- #placeholder ⇒ Object
- #selected_label ⇒ Object
- #spread_fields? ⇒ Boolean
- #turbo_frame_name ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(label:, name:, search_path:, options: {}, html_options: {}) ⇒ ComboboxComponent
options:
value: nil, placeholder: nil, error: nil, selected_label: nil,
clearable: false, spread_fields: false
html_options: { data: { attribute: ‘value’ } }
14 15 16 17 18 19 20 |
# File 'app/components/maglev/uikit/form/combobox_component.rb', line 14 def initialize(label:, name:, search_path:, options: {}, html_options: {}) @label = label @name = name @search_path = search_path @options = @html_options = end |
Instance Attribute Details
#html_options ⇒ Object (readonly)
Returns the value of attribute html_options.
7 8 9 |
# File 'app/components/maglev/uikit/form/combobox_component.rb', line 7 def @html_options end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
7 8 9 |
# File 'app/components/maglev/uikit/form/combobox_component.rb', line 7 def label @label end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'app/components/maglev/uikit/form/combobox_component.rb', line 7 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'app/components/maglev/uikit/form/combobox_component.rb', line 7 def @options end |
#search_path ⇒ Object (readonly)
Returns the value of attribute search_path.
7 8 9 |
# File 'app/components/maglev/uikit/form/combobox_component.rb', line 7 def search_path @search_path end |
Instance Method Details
#clearable? ⇒ Boolean
50 51 52 |
# File 'app/components/maglev/uikit/form/combobox_component.rb', line 50 def clearable? [:clearable] end |
#dom_id ⇒ Object
22 23 24 |
# File 'app/components/maglev/uikit/form/combobox_component.rb', line 22 def dom_id name.to_s.parameterize.underscore end |
#error ⇒ Object
46 47 48 |
# File 'app/components/maglev/uikit/form/combobox_component.rb', line 46 def error [:error] end |
#hint ⇒ Object
34 35 36 |
# File 'app/components/maglev/uikit/form/combobox_component.rb', line 34 def hint [:hint] end |
#label_name ⇒ Object
42 43 44 |
# File 'app/components/maglev/uikit/form/combobox_component.rb', line 42 def label_name [:label_name] end |
#placeholder ⇒ Object
38 39 40 |
# File 'app/components/maglev/uikit/form/combobox_component.rb', line 38 def placeholder [:placeholder] end |
#selected_label ⇒ Object
26 27 28 |
# File 'app/components/maglev/uikit/form/combobox_component.rb', line 26 def selected_label [:selected_label] end |
#spread_fields? ⇒ Boolean
54 55 56 |
# File 'app/components/maglev/uikit/form/combobox_component.rb', line 54 def spread_fields? [:spread_fields] end |
#turbo_frame_name ⇒ Object
58 59 60 |
# File 'app/components/maglev/uikit/form/combobox_component.rb', line 58 def turbo_frame_name "#{dom_id}_combobox" end |
#value ⇒ Object
30 31 32 |
# File 'app/components/maglev/uikit/form/combobox_component.rb', line 30 def value [:value] end |