Class: Ruflet::UI::Controls::RufletComponents::DatePickerControl
- Defined in:
- lib/ruflet_ui/ruflet/ui/controls/materials/datepicker_control.rb
Constant Summary collapse
- TYPE =
"datepicker".freeze
- WIRE =
"DatePicker".freeze
- KEYWORDS =
[:adaptive, :badge, :barrier_color, :cancel_text, :col, :confirm_text, :current_date, :data, :date_picker_mode, :disabled, :entry_mode, :error_format_text, :error_invalid_text, :expand, :expand_loose, :field_hint_text, :field_label_text, :first_date, :help_text, :inset_padding, :key, :keyboard_type, :last_date, :locale, :modal, :opacity, :open, :rtl, :switch_to_calendar_icon, :switch_to_input_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
-
#initialize(id: nil, **props) ⇒ DatePickerControl
constructor
A new instance of DatePickerControl.
Methods inherited from Control
#attach_handler, #emit, generate_id, #has_handler?, #merge_props, #on, #to_patch
Constructor Details
#initialize(id: nil, **props) ⇒ DatePickerControl
Returns a new instance of DatePickerControl.
13 14 15 16 17 18 19 20 21 |
# File 'lib/ruflet_ui/ruflet/ui/controls/materials/datepicker_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.date_time(value) if %i[value first_date last_date current_date].include?(key) compact[key] = value unless value.nil? end super(type: TYPE, id: id, **compact) end |