Class: Ruflet::UI::Controls::RufletComponents::TimePickerControl

Inherits:
Control
  • Object
show all
Defined in:
lib/ruflet_ui/ruflet/ui/controls/materials/timepicker_control.rb

Constant Summary collapse

TYPE =
"timepicker".freeze
WIRE =
"TimePicker".freeze
KEYWORDS =
[:adaptive, :badge, :barrier_color, :cancel_text, :col, :confirm_text, :data, :disabled, :entry_mode, :error_invalid_text, :expand, :expand_loose, :help_text, :hour_format, :hour_label_text, :key, :locale, :minute_label_text, :modal, :opacity, :open, :orientation, :rtl, :switch_to_input_icon, :switch_to_timer_icon, :tooltip, :value, :visible, :on_change, :on_dismiss, :on_entry_mode_change].freeze

Constants inherited from Control

Control::HOST_EXPANDED_TYPES, Control::SCHEMA_METADATA_CACHE

Instance Attribute Summary

Attributes inherited from Control

#children, #id, #props, #runtime_page, #type, #wire_id

Instance Method Summary collapse

Methods inherited from Control

#attach_handler, #emit, generate_id, #has_handler?, #merge_props, #on, #to_patch

Constructor Details

#initialize(id: nil, **props) ⇒ TimePickerControl

Returns a new instance of TimePickerControl.



13
14
15
16
17
18
19
20
21
# File 'lib/ruflet_ui/ruflet/ui/controls/materials/timepicker_control.rb', line 13

def initialize(id: nil, **props)
  compact = {}
  props.each do |key, value|
    raise ArgumentError, "unknown keyword: :#{key}" unless KEYWORDS.include?(key)
    value = Ruflet::Protocol.time_of_day(value) if key == :value
    compact[key] = value unless value.nil?
  end
  super(type: TYPE, id: id, **compact)
end