Class: Ruflet::UI::Controls::RufletComponents::RangeSliderControl

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

Constant Summary collapse

TYPE =
"rangeslider".freeze
WIRE =
"RangeSlider".freeze

Constants inherited from Control

Control::HOST_EXPANDED_TYPES

Instance Attribute Summary

Attributes inherited from Control

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

Instance Method Summary collapse

Methods inherited from Control

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

Constructor Details

#initialize(id: nil, active_color: nil, align: nil, animate_align: nil, animate_margin: nil, animate_offset: nil, animate_opacity: nil, animate_position: nil, animate_rotation: nil, animate_scale: nil, animate_size: nil, aspect_ratio: nil, badge: nil, bottom: nil, col: nil, data: nil, disabled: nil, divisions: nil, end_value: nil, expand: nil, expand_loose: nil, height: nil, inactive_color: nil, key: nil, label: nil, left: nil, margin: nil, max: nil, min: nil, mouse_cursor: nil, offset: nil, opacity: nil, overlay_color: nil, right: nil, rotate: nil, round: nil, rtl: nil, scale: nil, size_change_interval: nil, start_value: nil, tooltip: nil, top: nil, visible: nil, width: nil, on_animation_end: nil, on_change: nil, on_change_end: nil, on_change_start: nil, on_size_change: nil) ⇒ RangeSliderControl

Returns a new instance of RangeSliderControl.

Raises:

  • (ArgumentError)


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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
# File 'lib/ruflet_ui/ruflet/ui/controls/materials/rangeslider_control.rb', line 11

def initialize(id: nil, active_color: nil, align: nil, animate_align: nil, animate_margin: nil, animate_offset: nil, animate_opacity: nil, animate_position: nil, animate_rotation: nil, animate_scale: nil, animate_size: nil, aspect_ratio: nil, badge: nil, bottom: nil, col: nil, data: nil, disabled: nil, divisions: nil, end_value: nil, expand: nil, expand_loose: nil, height: nil, inactive_color: nil, key: nil, label: nil, left: nil, margin: nil, max: nil, min: nil, mouse_cursor: nil, offset: nil, opacity: nil, overlay_color: nil, right: nil, rotate: nil, round: nil, rtl: nil, scale: nil, size_change_interval: nil, start_value: nil, tooltip: nil, top: nil, visible: nil, width: nil, on_animation_end: nil, on_change: nil, on_change_end: nil, on_change_start: nil, on_size_change: nil)
  min_value = min.nil? ? 0.0 : min
  max_value = max.nil? ? 1.0 : max

  raise ArgumentError, "range_slider min must be less than or equal to max" if min_value > max_value
  raise ArgumentError, "range_slider divisions must be greater than 0" unless divisions.nil? || divisions > 0
  raise ArgumentError, "range_slider round must be between 0 and 20" unless round.nil? || (0..20).cover?(round)
  raise ArgumentError, "range_slider start_value must be greater than or equal to min" unless start_value.nil? || start_value >= min_value
  raise ArgumentError, "range_slider end_value must be less than or equal to max" unless end_value.nil? || end_value <= max_value

  unless start_value.nil? || end_value.nil? || start_value <= end_value
    raise ArgumentError, "range_slider start_value must be less than or equal to end_value"
  end

  props = {}
  props[:active_color] = active_color unless active_color.nil?
  props[:align] = align unless align.nil?
  props[:animate_align] = animate_align unless animate_align.nil?
  props[:animate_margin] = animate_margin unless animate_margin.nil?
  props[:animate_offset] = animate_offset unless animate_offset.nil?
  props[:animate_opacity] = animate_opacity unless animate_opacity.nil?
  props[:animate_position] = animate_position unless animate_position.nil?
  props[:animate_rotation] = animate_rotation unless animate_rotation.nil?
  props[:animate_scale] = animate_scale unless animate_scale.nil?
  props[:animate_size] = animate_size unless animate_size.nil?
  props[:aspect_ratio] = aspect_ratio unless aspect_ratio.nil?
  props[:badge] = badge unless badge.nil?
  props[:bottom] = bottom unless bottom.nil?
  props[:col] = col unless col.nil?
  props[:data] = data unless data.nil?
  props[:disabled] = disabled unless disabled.nil?
  props[:divisions] = divisions unless divisions.nil?
  props[:end_value] = end_value unless end_value.nil?
  props[:expand] = expand unless expand.nil?
  props[:expand_loose] = expand_loose unless expand_loose.nil?
  props[:height] = height unless height.nil?
  props[:inactive_color] = inactive_color unless inactive_color.nil?
  props[:key] = key unless key.nil?
  props[:label] = label unless label.nil?
  props[:left] = left unless left.nil?
  props[:margin] = margin unless margin.nil?
  props[:max] = max unless max.nil?
  props[:min] = min unless min.nil?
  props[:mouse_cursor] = mouse_cursor unless mouse_cursor.nil?
  props[:offset] = offset unless offset.nil?
  props[:opacity] = opacity unless opacity.nil?
  props[:overlay_color] = overlay_color unless overlay_color.nil?
  props[:right] = right unless right.nil?
  props[:rotate] = rotate unless rotate.nil?
  props[:round] = round unless round.nil?
  props[:rtl] = rtl unless rtl.nil?
  props[:scale] = scale unless scale.nil?
  props[:size_change_interval] = size_change_interval unless size_change_interval.nil?
  props[:start_value] = start_value unless start_value.nil?
  props[:tooltip] = tooltip unless tooltip.nil?
  props[:top] = top unless top.nil?
  props[:visible] = visible unless visible.nil?
  props[:width] = width unless width.nil?
  props[:on_animation_end] = on_animation_end unless on_animation_end.nil?
  props[:on_change] = on_change unless on_change.nil?
  props[:on_change_end] = on_change_end unless on_change_end.nil?
  props[:on_change_start] = on_change_start unless on_change_start.nil?
  props[:on_size_change] = on_size_change unless on_size_change.nil?
  super(type: TYPE, id: id, **props)
end