Class: HakumiComponents::InputNumber::Component
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- HakumiComponents::InputNumber::Component
- Extended by:
- T::Sig
- Includes:
- Concerns::InputControl
- Defined in:
- app/components/hakumi_components/input_number/component.rb
Constant Summary collapse
- NumericLike =
T.type_alias { T.any(String, Numeric) }
- FormatterOptions =
T.type_alias { T::Hash[Symbol, T.nilable(T.any(String, Symbol, T::Boolean, Numeric))] }
- VARIANTS =
T.let([ :default, :filled, :borderless ].freeze, T::Array[Symbol])
- STATUSES =
T.let([ :default, :success, :warning, :error ].freeze, T::Array[Symbol])
Constants inherited from BaseComponent
BaseComponent::ControllerOptions, BaseComponent::DateInput, BaseComponent::DateLikeValue, BaseComponent::DimensionInput, BaseComponent::HtmlPayloadInput, BaseComponent::I18nOptionValue, BaseComponent::PresenceArray, BaseComponent::PresenceScalar, BaseComponent::PresenceValue, BaseComponent::RawHtmlInput, BaseComponent::SIZES, BaseComponent::SizeValue, BaseComponent::SymbolInput
Instance Method Summary collapse
Methods included from Concerns::InputControl
#input_control_contract, #input_control_disabled, #input_control_has_value?, #input_control_placeholder, #input_control_readonly, #input_control_size, #input_control_value
Methods included from Concerns::InputControlInterface
#input_control_contract, #input_control_disabled, #input_control_has_value?, #input_control_placeholder, #input_control_readonly, #input_control_size, #input_control_value
Methods included from Concerns::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?
Methods included from Concerns::FormFieldInterface
Methods inherited from BaseComponent
#append_data_token, boolean_html_param, #build_inline_style, cast_boolean, #cast_boolean, #class_names, #component_classes, #data_attributes_from, #dimension_to_css, #ensure_dom_id!, float_html_param, #generate_id, #html_classes, html_param, html_primitive_param, #html_style, #i18n_scope, integer_html_param, #merge_attributes, #render_value, #size_to_pixels, #stimulus_attrs, string_html_param, string_or_symbol_array_html_param, symbol_html_param, #t_default, #translate_with_default, #validate_inclusion!, #validate_required!, #value_present?
Constructor Details
#initialize(name:, label: nil, caption: nil, value: nil, placeholder: nil, min: nil, max: nil, step: 1, precision: nil, size: :default, variant: :default, status: :default, disabled: false, readonly: false, required: false, prefix: nil, suffix: nil, controls: true, keyboard: true, wheel: false, formatter: nil, standalone: true, rules: nil, errors: [], **html_options) ⇒ Component
Returns a new instance of Component.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'app/components/hakumi_components/input_number/component.rb', line 46 def initialize( name:, label: nil, caption: nil, value: nil, placeholder: nil, min: nil, max: nil, step: 1, precision: nil, size: :default, variant: :default, status: :default, disabled: false, readonly: false, required: false, prefix: nil, suffix: nil, controls: true, keyboard: true, wheel: false, formatter: nil, standalone: true, rules: nil, errors: [], ** ) @name = T.let(name, Types::FormFieldName) @label = label @caption = caption @value = value @placeholder = placeholder @min = min @max = max @step = T.let(step, NumericLike) @precision = precision @size = size @variant = variant @status = status @disabled = disabled @readonly = readonly @required = required @prefix = prefix @suffix = suffix @controls = controls @keyboard = keyboard @wheel = wheel @formatter = T.let(formatter, T.nilable(FormatterOptions)) @standalone = standalone @rules = T.let(rules, T.nilable(T::Array[Types::ValidationRule])) @errors = T.let(errors, Types::FormFieldErrors) @html_options = T.let(, Types::HtmlAttributes) initialize_input_control_contract!( name: @name, label: @label, caption: @caption, value: @value, placeholder: @placeholder, size: @size, disabled: @disabled, readonly: @readonly, errors: @errors, standalone: @standalone, required: @required, html_options: @html_options, rules: @rules ) validate_props! end |