Module: HakumiComponents::Concerns::SelectionControl
Instance Method Summary
collapse
Methods included from FormField
#describedby_ids, #error?, #error_message, #form_field_caption, #form_field_contract, #form_field_errors, #form_field_html_options, #form_field_label, #form_field_name, #form_field_required, #form_field_rules, #form_field_standalone, #form_item_attributes, #form_item_classes, #input_id, #render_caption, #render_error, #render_explain, #render_label, #standalone?
#form_field_contract
Instance Method Details
#selection_control_allow_clear ⇒ Object
44
45
46
|
# File 'app/components/hakumi_components/concerns/selection_control.rb', line 44
def selection_control_allow_clear
selection_control_contract.allow_clear
end
|
#selection_control_contract ⇒ Object
16
17
18
19
20
21
|
# File 'app/components/hakumi_components/concerns/selection_control.rb', line 16
def selection_control_contract
contract = T.let(@selection_control_contract, T.nilable(SelectionControlContract))
return contract unless contract.nil?
Kernel.raise "selection_control_contract must be initialized"
end
|
#selection_control_disabled ⇒ Object
39
40
41
|
# File 'app/components/hakumi_components/concerns/selection_control.rb', line 39
def selection_control_disabled
selection_control_contract.disabled
end
|
#selection_control_has_value? ⇒ Boolean
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'app/components/hakumi_components/concerns/selection_control.rb', line 49
def selection_control_has_value?
value = selection_control_value
if value.is_a?(Array)
return value.any? do |item|
next false if item.nil? || item == false
next !item.empty? if item.is_a?(String)
true
end
end
return false if value.nil? || value == false
return !value.empty? if value.is_a?(String)
true
end
|
#selection_control_placeholder ⇒ Object
29
30
31
|
# File 'app/components/hakumi_components/concerns/selection_control.rb', line 29
def selection_control_placeholder
selection_control_contract.placeholder
end
|
#selection_control_size ⇒ Object
34
35
36
|
# File 'app/components/hakumi_components/concerns/selection_control.rb', line 34
def selection_control_size
selection_control_contract.size
end
|
#selection_control_value ⇒ Object
24
25
26
|
# File 'app/components/hakumi_components/concerns/selection_control.rb', line 24
def selection_control_value
selection_control_contract.value
end
|