Class: Ruflet::UI::Controls::RufletComponents::TextControl

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

Constant Summary collapse

TYPE =
"text".freeze
WIRE =
"Text".freeze
KEYWORDS =
[:alignment, :bgcolor, :color, :data, :ellipsis, :enable_interactive_selection, :font_family, :font_family_fallback, :italic, :key, :max_lines, :max_width, :no_wrap, :overflow, :rotate, :selectable, :selection_cursor_color, :selection_cursor_height, :selection_cursor_width, :semantics_label, :show_selection_cursor, :size, :spans, :style, :text_align, :theme_style, :value, :weight, :x, :y, :on_selection_change, :on_tap].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) ⇒ TextControl

Returns a new instance of TextControl.



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

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