ruflet_core 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ruflet/version.rb +1 -1
- data/lib/ruflet_protocol/ruflet/protocol.rb +50 -4
- data/lib/ruflet_ui/ruflet/control.rb +11 -4
- data/lib/ruflet_ui/ruflet/dsl.rb +229 -37
- data/lib/ruflet_ui/ruflet/events/gesture_events.rb +113 -9
- data/lib/ruflet_ui/ruflet/page.rb +820 -145
- data/lib/ruflet_ui/ruflet/types/animation.rb +110 -0
- data/lib/ruflet_ui/ruflet/ui/control_registry.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoactionsheet_control.rb +13 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoactionsheetaction_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoactivityindicator_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoalertdialog_control.rb +17 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoappbar_control.rb +3 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinobottomsheet_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinobutton_control.rb +9 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinocheckbox_control.rb +6 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinocontextmenu_control.rb +11 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinocontextmenuaction_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinodatepicker_control.rb +14 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinodialogaction_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinofilledbutton_control.rb +9 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinolisttile_control.rb +12 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinonavigationbar_control.rb +11 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinopicker_control.rb +18 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoradio_control.rb +6 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinosegmentedbutton_control.rb +2 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoslider_control.rb +7 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoslidingsegmentedbutton_control.rb +3 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoswitch_control.rb +7 -1
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinotextfield_control.rb +7 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinotimerpicker_control.rb +18 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinotintedbutton_control.rb +9 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/alertdialog_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/appbar_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/audio_control.rb +35 -1
- data/lib/ruflet_ui/ruflet/ui/controls/materials/autocomplete_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/autocompletesuggestion_control.rb +26 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/badge_control.rb +7 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/banner_control.rb +11 -1
- data/lib/ruflet_ui/ruflet/ui/controls/materials/bottomappbar_control.rb +2 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/bottomsheet_control.rb +5 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/button_control.rb +2 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/card_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/chip_control.rb +11 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/circleavatar_control.rb +12 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/contextmenu_control.rb +19 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/datacell_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/datacolumn_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/datatable_control.rb +34 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/datepicker_control.rb +18 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/daterangepicker_control.rb +20 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/divider_control.rb +9 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/dropdown_control.rb +11 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/dropdownoption_control.rb +5 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/expansionpanel_control.rb +8 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/expansionpanellist_control.rb +6 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/expansiontile_control.rb +6 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/filledbutton_control.rb +5 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/fillediconbutton_control.rb +8 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/filledtonalbutton_control.rb +5 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/filledtonaliconbutton_control.rb +8 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/floatingactionbutton_control.rb +20 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/iconbutton_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/listtile_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/map_controls.rb +240 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/menubar_control.rb +2 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/menuitembutton_control.rb +6 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/navigationbar_control.rb +11 -1
- data/lib/ruflet_ui/ruflet/ui/controls/materials/navigationbardestination_control.rb +2 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/navigationdrawer_control.rb +12 -1
- data/lib/ruflet_ui/ruflet/ui/controls/materials/navigationdrawerdestination_control.rb +2 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/navigationrail_control.rb +21 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/navigationraildestination_control.rb +2 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/outlinedbutton_control.rb +5 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/outlinediconbutton_control.rb +8 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/popupmenubutton_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/popupmenuitem_control.rb +6 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/progressbar_control.rb +9 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/progressring_control.rb +8 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/rangeslider_control.rb +13 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/ruflet_controls.rb +24 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/searchbar_control.rb +28 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/segment_control.rb +5 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/segmentedbutton_control.rb +19 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/selectionarea_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/snackbar_control.rb +5 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/submenubutton_control.rb +8 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/tab_control.rb +7 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/tabbar_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/tabbarview_control.rb +7 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/tabs_control.rb +6 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/textbutton_control.rb +5 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/verticaldivider_control.rb +9 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/video_control.rb +86 -1
- data/lib/ruflet_ui/ruflet/ui/controls/ruflet_controls.rb +24 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/animatedswitcher_control.rb +10 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/browsercontextmenu_control.rb +12 -1
- data/lib/ruflet_ui/ruflet/ui/controls/shared/canvas_control.rb +14 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/dismissible_control.rb +19 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/draggable_control.rb +9 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/dragtarget_control.rb +6 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/gridview_control.rb +20 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/image_control.rb +19 -1
- data/lib/ruflet_ui/ruflet/ui/controls/shared/interactiveviewer_control.rb +37 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/listview_control.rb +17 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/pageview_control.rb +13 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/placeholder_control.rb +12 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/reorderabledraghandle_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/responsiverow_control.rb +22 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/safearea_control.rb +11 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/semantics_control.rb +2 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/stack_control.rb +3 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/text_control.rb +20 -1
- data/lib/ruflet_ui/ruflet/ui/controls/shared/view_control.rb +8 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/window_control.rb +16 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/windowdragarea_control.rb +6 -0
- data/lib/ruflet_ui/ruflet/ui/cupertino_control_methods.rb +83 -6
- data/lib/ruflet_ui/ruflet/ui/material_control_methods.rb +513 -33
- data/lib/ruflet_ui/ruflet/ui/material_control_registry.rb +2 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/audio_recorder_control.rb +87 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/geolocator_control.rb +85 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/permissionhandler_control.rb +53 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/securestorage_control.rb +89 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/semanticsservice_control.rb +28 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/tester_control.rb +126 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet_services.rb +16 -0
- data/lib/ruflet_ui/ruflet/ui/shared_control_forwarders.rb +230 -38
- data/lib/ruflet_ui.rb +4 -0
- metadata +9 -1
|
@@ -8,16 +8,18 @@ module Ruflet
|
|
|
8
8
|
TYPE = "audio".freeze
|
|
9
9
|
WIRE = "Audio".freeze
|
|
10
10
|
|
|
11
|
-
def initialize(id: nil, autoplay: nil, balance: nil, data: nil, key: nil, opacity: nil, release_mode: nil, rtl: nil, src: nil, tooltip: nil, visible: nil, volume: nil, on_duration_change: nil, on_error: nil, on_loaded: nil, on_position_change: nil, on_seek_complete: nil, on_state_change: nil)
|
|
11
|
+
def initialize(id: nil, autoplay: nil, balance: nil, data: nil, key: nil, opacity: nil, playback_rate: nil, release_mode: nil, rtl: nil, src: nil, src_base64: nil, tooltip: nil, visible: nil, volume: nil, on_duration_change: nil, on_error: nil, on_loaded: nil, on_position_change: nil, on_seek_complete: nil, on_state_change: nil)
|
|
12
12
|
props = {}
|
|
13
13
|
props[:autoplay] = autoplay unless autoplay.nil?
|
|
14
14
|
props[:balance] = balance unless balance.nil?
|
|
15
15
|
props[:data] = data unless data.nil?
|
|
16
16
|
props[:key] = key unless key.nil?
|
|
17
17
|
props[:opacity] = opacity unless opacity.nil?
|
|
18
|
+
props[:playback_rate] = playback_rate unless playback_rate.nil?
|
|
18
19
|
props[:release_mode] = release_mode unless release_mode.nil?
|
|
19
20
|
props[:rtl] = rtl unless rtl.nil?
|
|
20
21
|
props[:src] = src unless src.nil?
|
|
22
|
+
props[:src_base64] = src_base64 unless src_base64.nil?
|
|
21
23
|
props[:tooltip] = tooltip unless tooltip.nil?
|
|
22
24
|
props[:visible] = visible unless visible.nil?
|
|
23
25
|
props[:volume] = volume unless volume.nil?
|
|
@@ -29,6 +31,38 @@ module Ruflet
|
|
|
29
31
|
props[:on_state_change] = on_state_change unless on_state_change.nil?
|
|
30
32
|
super(type: TYPE, id: id, **props)
|
|
31
33
|
end
|
|
34
|
+
|
|
35
|
+
def get_current_position(timeout: 10, on_result: nil)
|
|
36
|
+
runtime_page&.invoke(self, "get_current_position", timeout: timeout, on_result: on_result)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def get_duration(timeout: 10, on_result: nil)
|
|
40
|
+
runtime_page&.invoke(self, "get_duration", timeout: timeout, on_result: on_result)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def pause(timeout: 10, on_result: nil)
|
|
44
|
+
runtime_page&.invoke(self, "pause", timeout: timeout, on_result: on_result)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def play(position: nil, timeout: 10, on_result: nil)
|
|
48
|
+
args = {}
|
|
49
|
+
args["position"] = position unless position.nil?
|
|
50
|
+
runtime_page&.invoke(self, "play", args: args.empty? ? nil : args, timeout: timeout, on_result: on_result)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def release(timeout: 10, on_result: nil)
|
|
54
|
+
runtime_page&.invoke(self, "release", timeout: timeout, on_result: on_result)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def resume(timeout: 10, on_result: nil)
|
|
58
|
+
runtime_page&.invoke(self, "resume", timeout: timeout, on_result: on_result)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def seek(position_milliseconds = nil, timeout: 10, on_result: nil)
|
|
62
|
+
args = {}
|
|
63
|
+
args["position"] = position_milliseconds unless position_milliseconds.nil?
|
|
64
|
+
runtime_page&.invoke(self, "seek", args: args.empty? ? nil : args, timeout: timeout, on_result: on_result)
|
|
65
|
+
end
|
|
32
66
|
end
|
|
33
67
|
end
|
|
34
68
|
end
|
|
@@ -9,6 +9,10 @@ module Ruflet
|
|
|
9
9
|
WIRE = "AutoComplete".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: 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, expand: nil, expand_loose: nil, height: nil, key: nil, left: nil, margin: nil, offset: nil, opacity: nil, right: nil, rotate: nil, rtl: nil, scale: nil, size_change_interval: nil, suggestions: nil, suggestions_max_height: nil, tooltip: nil, top: nil, value: nil, visible: nil, width: nil, on_animation_end: nil, on_change: nil, on_select: nil, on_size_change: nil)
|
|
12
|
+
suggestions = [] if suggestions.nil?
|
|
13
|
+
suggestions_max_height = 200 if suggestions_max_height.nil?
|
|
14
|
+
value = "" if value.nil?
|
|
15
|
+
|
|
12
16
|
props = {}
|
|
13
17
|
props[:align] = align unless align.nil?
|
|
14
18
|
props[:animate_align] = animate_align unless animate_align.nil?
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ruflet
|
|
4
|
+
module UI
|
|
5
|
+
module Controls
|
|
6
|
+
module RufletComponents
|
|
7
|
+
class AutoCompleteSuggestionControl < Ruflet::Control
|
|
8
|
+
TYPE = "autocompletesuggestion".freeze
|
|
9
|
+
WIRE = "AutoCompleteSuggestion".freeze
|
|
10
|
+
|
|
11
|
+
def initialize(id: nil, key: nil, value: nil)
|
|
12
|
+
raise ArgumentError, "auto_complete_suggestion requires key or value" if key.nil? && value.nil?
|
|
13
|
+
|
|
14
|
+
key ||= value
|
|
15
|
+
value ||= key
|
|
16
|
+
|
|
17
|
+
props = {}
|
|
18
|
+
props[:key] = key unless key.nil?
|
|
19
|
+
props[:value] = value unless value.nil?
|
|
20
|
+
super(type: TYPE, id: id, **props)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -9,6 +9,13 @@ module Ruflet
|
|
|
9
9
|
WIRE = "Badge".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, alignment: nil, bgcolor: nil, data: nil, key: nil, label: nil, label_visible: nil, large_size: nil, offset: nil, padding: nil, small_size: nil, text_color: nil, text_style: nil)
|
|
12
|
+
{
|
|
13
|
+
large_size: large_size,
|
|
14
|
+
small_size: small_size
|
|
15
|
+
}.each do |name, value|
|
|
16
|
+
raise ArgumentError, "badge #{name} must be greater than or equal to 0" unless value.nil? || value >= 0
|
|
17
|
+
end
|
|
18
|
+
|
|
12
19
|
props = {}
|
|
13
20
|
props[:alignment] = alignment unless alignment.nil?
|
|
14
21
|
props[:bgcolor] = bgcolor unless bgcolor.nil?
|
|
@@ -8,7 +8,16 @@ module Ruflet
|
|
|
8
8
|
TYPE = "banner".freeze
|
|
9
9
|
WIRE = "Banner".freeze
|
|
10
10
|
|
|
11
|
-
def initialize(id: nil, actions: nil, adaptive: nil, badge: nil, bgcolor: nil, col: nil, content: nil, content_padding: nil, content_text_style: nil, data: nil, disabled: nil, divider_color: nil, elevation: nil, expand: nil, expand_loose: nil, force_actions_below: nil, key: nil, leading: nil, leading_padding: nil, margin: nil, min_action_bar_height: nil, opacity: nil, open: nil, rtl: nil, shadow_color: nil, tooltip: nil, visible: nil, on_dismiss: nil, on_visible: nil)
|
|
11
|
+
def initialize(id: nil, actions: nil, adaptive: nil, badge: nil, bgcolor: nil, col: nil, content: nil, content_padding: nil, content_text_style: nil, data: nil, disabled: nil, divider_color: nil, elevation: nil, expand: nil, expand_loose: nil, force_actions_below: nil, key: nil, leading: nil, leading_padding: nil, margin: nil, min_action_bar_height: nil, opacity: nil, open: nil, rtl: nil, shadow_color: nil, surface_tint_color: nil, tooltip: nil, visible: nil, on_dismiss: nil, on_visible: nil)
|
|
12
|
+
raise ArgumentError, "banner requires content" if content.nil?
|
|
13
|
+
raise ArgumentError, "banner requires at least one actions control" if actions.nil? || actions.empty?
|
|
14
|
+
{
|
|
15
|
+
elevation: elevation,
|
|
16
|
+
min_action_bar_height: min_action_bar_height
|
|
17
|
+
}.each do |name, value|
|
|
18
|
+
raise ArgumentError, "banner #{name} must be greater than or equal to 0" unless value.nil? || value >= 0
|
|
19
|
+
end
|
|
20
|
+
|
|
12
21
|
props = {}
|
|
13
22
|
props[:actions] = actions unless actions.nil?
|
|
14
23
|
props[:adaptive] = adaptive unless adaptive.nil?
|
|
@@ -34,6 +43,7 @@ module Ruflet
|
|
|
34
43
|
props[:open] = open unless open.nil?
|
|
35
44
|
props[:rtl] = rtl unless rtl.nil?
|
|
36
45
|
props[:shadow_color] = shadow_color unless shadow_color.nil?
|
|
46
|
+
props[:surface_tint_color] = surface_tint_color unless surface_tint_color.nil?
|
|
37
47
|
props[:tooltip] = tooltip unless tooltip.nil?
|
|
38
48
|
props[:visible] = visible unless visible.nil?
|
|
39
49
|
props[:on_dismiss] = on_dismiss unless on_dismiss.nil?
|
|
@@ -9,6 +9,8 @@ module Ruflet
|
|
|
9
9
|
WIRE = "BottomAppBar".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: 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, bgcolor: nil, border_radius: nil, bottom: nil, clip_behavior: nil, col: nil, content: nil, data: nil, disabled: nil, elevation: nil, expand: nil, expand_loose: nil, height: nil, key: nil, left: nil, margin: nil, notch_margin: nil, offset: nil, opacity: nil, padding: nil, right: nil, rotate: nil, rtl: nil, scale: nil, shadow_color: nil, shape: nil, size_change_interval: nil, tooltip: nil, top: nil, visible: nil, width: nil, on_animation_end: nil, on_size_change: nil)
|
|
12
|
+
raise ArgumentError, "bottom_app_bar elevation must be greater than or equal to 0" if !elevation.nil? && elevation.negative?
|
|
13
|
+
|
|
12
14
|
props = {}
|
|
13
15
|
props[:align] = align unless align.nil?
|
|
14
16
|
props[:animate_align] = animate_align unless animate_align.nil?
|
|
@@ -9,6 +9,11 @@ module Ruflet
|
|
|
9
9
|
WIRE = "BottomSheet".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, adaptive: nil, animation_style: nil, badge: nil, barrier_color: nil, bgcolor: nil, clip_behavior: nil, col: nil, content: nil, data: nil, disabled: nil, dismissible: nil, draggable: nil, elevation: nil, expand: nil, expand_loose: nil, fullscreen: nil, key: nil, maintain_bottom_view_insets_padding: nil, opacity: nil, open: nil, rtl: nil, scrollable: nil, shape: nil, show_drag_handle: nil, size_constraints: nil, tooltip: nil, use_safe_area: nil, visible: nil, on_dismiss: nil)
|
|
12
|
+
raise ArgumentError, "bottom_sheet requires content" if content.nil?
|
|
13
|
+
unless elevation.nil? || elevation >= 0
|
|
14
|
+
raise ArgumentError, "bottom_sheet elevation must be greater than or equal to 0"
|
|
15
|
+
end
|
|
16
|
+
|
|
12
17
|
props = {}
|
|
13
18
|
props[:adaptive] = adaptive unless adaptive.nil?
|
|
14
19
|
props[:animation_style] = animation_style unless animation_style.nil?
|
|
@@ -9,6 +9,8 @@ module Ruflet
|
|
|
9
9
|
WIRE = "Button".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, adaptive: 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, autofocus: nil, badge: nil, bgcolor: nil, bottom: nil, clip_behavior: nil, col: nil, color: nil, content: nil, data: nil, disabled: nil, elevation: nil, expand: nil, expand_loose: nil, height: nil, icon: nil, icon_color: nil, key: nil, left: nil, margin: nil, offset: nil, opacity: nil, right: nil, rotate: nil, rtl: nil, scale: nil, size_change_interval: nil, style: nil, tooltip: nil, top: nil, url: nil, visible: nil, width: nil, on_animation_end: nil, on_blur: nil, on_click: nil, on_focus: nil, on_hover: nil, on_long_press: nil, on_size_change: nil)
|
|
12
|
+
raise ArgumentError, "button requires content or icon" if content.nil? && icon.nil?
|
|
13
|
+
|
|
12
14
|
props = {}
|
|
13
15
|
props[:adaptive] = adaptive unless adaptive.nil?
|
|
14
16
|
props[:align] = align unless align.nil?
|
|
@@ -9,6 +9,10 @@ module Ruflet
|
|
|
9
9
|
WIRE = "Card".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, adaptive: 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, bgcolor: nil, bottom: nil, clip_behavior: nil, col: nil, content: nil, data: nil, disabled: nil, elevation: nil, expand: nil, expand_loose: nil, height: nil, key: nil, left: nil, margin: nil, offset: nil, opacity: nil, right: nil, rotate: nil, rtl: nil, scale: nil, semantic_container: nil, shadow_color: nil, shape: nil, show_border_on_foreground: nil, size_change_interval: nil, tooltip: nil, top: nil, variant: nil, visible: nil, width: nil, on_animation_end: nil, on_size_change: nil)
|
|
12
|
+
unless elevation.nil? || elevation >= 0
|
|
13
|
+
raise ArgumentError, "card elevation must be greater than or equal to 0"
|
|
14
|
+
end
|
|
15
|
+
|
|
12
16
|
props = {}
|
|
13
17
|
props[:adaptive] = adaptive unless adaptive.nil?
|
|
14
18
|
props[:align] = align unless align.nil?
|
|
@@ -9,6 +9,17 @@ module Ruflet
|
|
|
9
9
|
WIRE = "Chip".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: 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, autofocus: nil, badge: nil, bgcolor: nil, border_side: nil, bottom: nil, check_color: nil, clip_behavior: nil, col: nil, color: nil, data: nil, delete_drawer_animation_style: nil, delete_icon: nil, delete_icon_color: nil, delete_icon_size_constraints: nil, delete_icon_tooltip: nil, disabled: nil, disabled_color: nil, elevation: nil, elevation_on_click: nil, enable_animation_style: nil, expand: nil, expand_loose: nil, height: nil, key: nil, label: nil, label_padding: nil, label_text_style: nil, leading: nil, leading_drawer_animation_style: nil, leading_size_constraints: nil, left: nil, margin: nil, offset: nil, opacity: nil, padding: nil, right: nil, rotate: nil, rtl: nil, scale: nil, select_animation_style: nil, selected: nil, selected_color: nil, selected_shadow_color: nil, shadow_color: nil, shape: nil, show_checkmark: nil, size_change_interval: nil, tooltip: nil, top: nil, visible: nil, visual_density: nil, width: nil, on_animation_end: nil, on_blur: nil, on_click: nil, on_delete: nil, on_focus: nil, on_select: nil, on_size_change: nil)
|
|
12
|
+
if !on_click.nil? && !on_select.nil?
|
|
13
|
+
raise ArgumentError, "chip on_click and on_select cannot both be specified"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
{
|
|
17
|
+
elevation: elevation,
|
|
18
|
+
elevation_on_click: elevation_on_click
|
|
19
|
+
}.each do |name, value|
|
|
20
|
+
raise ArgumentError, "chip #{name} must be greater than or equal to 0" unless value.nil? || value >= 0
|
|
21
|
+
end
|
|
22
|
+
|
|
12
23
|
props = {}
|
|
13
24
|
props[:align] = align unless align.nil?
|
|
14
25
|
props[:animate_align] = animate_align unless animate_align.nil?
|
|
@@ -9,6 +9,18 @@ module Ruflet
|
|
|
9
9
|
WIRE = "CircleAvatar".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: 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, background_image_src: nil, badge: nil, bgcolor: nil, bottom: nil, col: nil, color: nil, content: nil, data: nil, disabled: nil, expand: nil, expand_loose: nil, foreground_image_src: nil, height: nil, key: nil, left: nil, margin: nil, max_radius: nil, min_radius: nil, offset: nil, opacity: nil, radius: nil, right: nil, rotate: nil, rtl: nil, scale: nil, size_change_interval: nil, tooltip: nil, top: nil, visible: nil, width: nil, on_animation_end: nil, on_image_error: nil, on_size_change: nil)
|
|
12
|
+
{
|
|
13
|
+
radius: radius,
|
|
14
|
+
min_radius: min_radius,
|
|
15
|
+
max_radius: max_radius
|
|
16
|
+
}.each do |name, value|
|
|
17
|
+
raise ArgumentError, "circle_avatar #{name} must be greater than or equal to 0" unless value.nil? || value >= 0
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
if !radius.nil? && (!min_radius.nil? || !max_radius.nil?)
|
|
21
|
+
raise ArgumentError, "circle_avatar radius cannot be combined with min_radius or max_radius"
|
|
22
|
+
end
|
|
23
|
+
|
|
12
24
|
props = {}
|
|
13
25
|
props[:align] = align unless align.nil?
|
|
14
26
|
props[:animate_align] = animate_align unless animate_align.nil?
|
|
@@ -9,6 +9,10 @@ module Ruflet
|
|
|
9
9
|
WIRE = "ContextMenu".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: 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, content: nil, data: nil, disabled: nil, expand: nil, expand_loose: nil, height: nil, items: nil, key: nil, left: nil, margin: nil, offset: nil, opacity: nil, primary_items: nil, primary_trigger: nil, right: nil, rotate: nil, rtl: nil, scale: nil, secondary_items: nil, secondary_trigger: nil, size_change_interval: nil, tertiary_items: nil, tertiary_trigger: nil, tooltip: nil, top: nil, visible: nil, width: nil, on_animation_end: nil, on_dismiss: nil, on_select: nil, on_size_change: nil)
|
|
12
|
+
if content.nil? || (content.respond_to?(:props) && content.props["visible"] == false)
|
|
13
|
+
raise ArgumentError, "context_menu requires visible content"
|
|
14
|
+
end
|
|
15
|
+
|
|
12
16
|
props = {}
|
|
13
17
|
props[:align] = align unless align.nil?
|
|
14
18
|
props[:animate_align] = animate_align unless animate_align.nil?
|
|
@@ -56,6 +60,21 @@ module Ruflet
|
|
|
56
60
|
props[:on_size_change] = on_size_change unless on_size_change.nil?
|
|
57
61
|
super(type: TYPE, id: id, **props)
|
|
58
62
|
end
|
|
63
|
+
|
|
64
|
+
def open(position: nil, timeout: 10, on_result: nil)
|
|
65
|
+
args = {}
|
|
66
|
+
args["position"] = stringify_hash_keys(position) unless position.nil?
|
|
67
|
+
runtime_page&.invoke(self, "open", args: args, timeout: timeout, on_result: on_result)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
private
|
|
71
|
+
|
|
72
|
+
def stringify_hash_keys(value)
|
|
73
|
+
return value.map { |item| stringify_hash_keys(item) } if value.is_a?(Array)
|
|
74
|
+
return value.each_with_object({}) { |(key, child), result| result[key.to_s] = stringify_hash_keys(child) } if value.is_a?(Hash)
|
|
75
|
+
|
|
76
|
+
value
|
|
77
|
+
end
|
|
59
78
|
end
|
|
60
79
|
end
|
|
61
80
|
end
|
|
@@ -9,6 +9,10 @@ module Ruflet
|
|
|
9
9
|
WIRE = "DataCell".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, badge: nil, col: nil, content: nil, data: nil, disabled: nil, expand: nil, expand_loose: nil, key: nil, opacity: nil, placeholder: nil, rtl: nil, show_edit_icon: nil, tooltip: nil, visible: nil, on_double_tap: nil, on_long_press: nil, on_tap: nil, on_tap_cancel: nil, on_tap_down: nil)
|
|
12
|
+
if content.nil? || (content.respond_to?(:props) && content.props["visible"] == false)
|
|
13
|
+
raise ArgumentError, "data_cell requires visible content"
|
|
14
|
+
end
|
|
15
|
+
|
|
12
16
|
props = {}
|
|
13
17
|
props[:badge] = badge unless badge.nil?
|
|
14
18
|
props[:col] = col unless col.nil?
|
|
@@ -9,6 +9,10 @@ module Ruflet
|
|
|
9
9
|
WIRE = "DataColumn".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, badge: nil, col: nil, data: nil, disabled: nil, expand: nil, expand_loose: nil, heading_row_alignment: nil, key: nil, label: nil, numeric: nil, opacity: nil, rtl: nil, tooltip: nil, visible: nil, on_sort: nil)
|
|
12
|
+
if label.nil? || (label.respond_to?(:props) && label.props["visible"] == false)
|
|
13
|
+
raise ArgumentError, "data_column requires a visible label"
|
|
14
|
+
end
|
|
15
|
+
|
|
12
16
|
props = {}
|
|
13
17
|
props[:badge] = badge unless badge.nil?
|
|
14
18
|
props[:col] = col unless col.nil?
|
|
@@ -9,6 +9,34 @@ module Ruflet
|
|
|
9
9
|
WIRE = "DataTable".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: 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, bgcolor: nil, border: nil, border_radius: nil, bottom: nil, checkbox_horizontal_margin: nil, clip_behavior: nil, col: nil, column_spacing: nil, columns: nil, data: nil, data_row_color: nil, data_row_max_height: nil, data_row_min_height: nil, data_text_style: nil, disabled: nil, divider_thickness: nil, expand: nil, expand_loose: nil, gradient: nil, heading_row_color: nil, heading_row_height: nil, heading_text_style: nil, height: nil, horizontal_lines: nil, horizontal_margin: nil, key: nil, left: nil, margin: nil, offset: nil, opacity: nil, right: nil, rotate: nil, rows: nil, rtl: nil, scale: nil, show_bottom_border: nil, show_checkbox_column: nil, size_change_interval: nil, sort_ascending: nil, sort_column_index: nil, tooltip: nil, top: nil, vertical_lines: nil, visible: nil, width: nil, on_animation_end: nil, on_select_all: nil, on_size_change: nil)
|
|
12
|
+
visible_columns = visible_controls(columns)
|
|
13
|
+
raise ArgumentError, "data_table requires at least one visible columns control" if visible_columns.empty?
|
|
14
|
+
|
|
15
|
+
visible_rows = visible_controls(rows)
|
|
16
|
+
visible_rows.each do |row|
|
|
17
|
+
next unless row.respond_to?(:props)
|
|
18
|
+
|
|
19
|
+
unless visible_controls(row.props["cells"]).length == visible_columns.length
|
|
20
|
+
raise ArgumentError, "data_table row cells must match visible columns"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
{
|
|
25
|
+
checkbox_horizontal_margin: checkbox_horizontal_margin,
|
|
26
|
+
column_spacing: column_spacing,
|
|
27
|
+
data_row_max_height: data_row_max_height,
|
|
28
|
+
data_row_min_height: data_row_min_height,
|
|
29
|
+
divider_thickness: divider_thickness,
|
|
30
|
+
heading_row_height: heading_row_height,
|
|
31
|
+
horizontal_margin: horizontal_margin
|
|
32
|
+
}.each do |name, value|
|
|
33
|
+
raise ArgumentError, "data_table #{name} must be greater than or equal to 0" unless value.nil? || value >= 0
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
unless data_row_min_height.nil? || data_row_max_height.nil? || data_row_min_height <= data_row_max_height
|
|
37
|
+
raise ArgumentError, "data_table data_row_min_height must be less than or equal to data_row_max_height"
|
|
38
|
+
end
|
|
39
|
+
|
|
12
40
|
props = {}
|
|
13
41
|
props[:align] = align unless align.nil?
|
|
14
42
|
props[:animate_align] = animate_align unless animate_align.nil?
|
|
@@ -71,6 +99,12 @@ module Ruflet
|
|
|
71
99
|
props[:on_size_change] = on_size_change unless on_size_change.nil?
|
|
72
100
|
super(type: TYPE, id: id, **props)
|
|
73
101
|
end
|
|
102
|
+
|
|
103
|
+
private
|
|
104
|
+
|
|
105
|
+
def visible_controls(value)
|
|
106
|
+
Array(value).select { |control| !control.respond_to?(:props) || control.props["visible"] != false }
|
|
107
|
+
end
|
|
74
108
|
end
|
|
75
109
|
end
|
|
76
110
|
end
|
|
@@ -9,6 +9,8 @@ module Ruflet
|
|
|
9
9
|
WIRE = "DatePicker".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, adaptive: nil, badge: nil, barrier_color: nil, cancel_text: nil, col: nil, confirm_text: nil, current_date: nil, data: nil, date_picker_mode: nil, disabled: nil, entry_mode: nil, error_format_text: nil, error_invalid_text: nil, expand: nil, expand_loose: nil, field_hint_text: nil, field_label_text: nil, first_date: nil, help_text: nil, inset_padding: nil, key: nil, keyboard_type: nil, last_date: nil, locale: nil, modal: nil, opacity: nil, open: nil, rtl: nil, switch_to_calendar_icon: nil, switch_to_input_icon: nil, tooltip: nil, value: nil, visible: nil, on_change: nil, on_dismiss: nil, on_entry_mode_change: nil)
|
|
12
|
+
validate_date_range!(first_date, last_date, value)
|
|
13
|
+
|
|
12
14
|
props = {}
|
|
13
15
|
props[:adaptive] = adaptive unless adaptive.nil?
|
|
14
16
|
props[:badge] = badge unless badge.nil?
|
|
@@ -48,6 +50,22 @@ module Ruflet
|
|
|
48
50
|
props[:on_entry_mode_change] = on_entry_mode_change unless on_entry_mode_change.nil?
|
|
49
51
|
super(type: TYPE, id: id, **props)
|
|
50
52
|
end
|
|
53
|
+
|
|
54
|
+
private
|
|
55
|
+
|
|
56
|
+
def validate_date_range!(first_date, last_date, value)
|
|
57
|
+
first = first_date || "1900-01-01"
|
|
58
|
+
last = last_date || "2050-01-01"
|
|
59
|
+
raise ArgumentError, "date_picker first_date must be before or equal to last_date" if date_key(first) > date_key(last)
|
|
60
|
+
return if value.nil?
|
|
61
|
+
|
|
62
|
+
raise ArgumentError, "date_picker value must be on or after first_date" if date_key(value) < date_key(first)
|
|
63
|
+
raise ArgumentError, "date_picker value must be on or before last_date" if date_key(value) > date_key(last)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def date_key(value)
|
|
67
|
+
value.respond_to?(:iso8601) ? value.iso8601 : value.to_s
|
|
68
|
+
end
|
|
51
69
|
end
|
|
52
70
|
end
|
|
53
71
|
end
|
|
@@ -9,6 +9,8 @@ module Ruflet
|
|
|
9
9
|
WIRE = "DateRangePicker".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, adaptive: nil, badge: nil, barrier_color: nil, cancel_text: nil, col: nil, confirm_text: nil, current_date: nil, data: nil, disabled: nil, end_value: nil, entry_mode: nil, error_format_text: nil, error_invalid_range_text: nil, error_invalid_text: nil, expand: nil, expand_loose: nil, field_end_hint_text: nil, field_end_label_text: nil, field_start_hint_text: nil, field_start_label_text: nil, first_date: nil, help_text: nil, key: nil, keyboard_type: nil, last_date: nil, locale: nil, modal: nil, opacity: nil, open: nil, rtl: nil, save_text: nil, start_value: nil, switch_to_calendar_icon: nil, switch_to_input_icon: nil, tooltip: nil, visible: nil, on_change: nil, on_dismiss: nil)
|
|
12
|
+
validate_date_range!(first_date, last_date, start_value, end_value)
|
|
13
|
+
|
|
12
14
|
props = {}
|
|
13
15
|
props[:adaptive] = adaptive unless adaptive.nil?
|
|
14
16
|
props[:badge] = badge unless badge.nil?
|
|
@@ -50,6 +52,24 @@ module Ruflet
|
|
|
50
52
|
props[:on_dismiss] = on_dismiss unless on_dismiss.nil?
|
|
51
53
|
super(type: TYPE, id: id, **props)
|
|
52
54
|
end
|
|
55
|
+
|
|
56
|
+
private
|
|
57
|
+
|
|
58
|
+
def validate_date_range!(first_date, last_date, start_value, end_value)
|
|
59
|
+
first = first_date || "1900-01-01"
|
|
60
|
+
last = last_date || "2050-01-01"
|
|
61
|
+
raise ArgumentError, "date_range_picker first_date must be before or equal to last_date" if date_key(first) > date_key(last)
|
|
62
|
+
raise ArgumentError, "date_range_picker start_value must be on or after first_date" if !start_value.nil? && date_key(start_value) < date_key(first)
|
|
63
|
+
raise ArgumentError, "date_range_picker end_value must be on or before last_date" if !end_value.nil? && date_key(end_value) > date_key(last)
|
|
64
|
+
|
|
65
|
+
unless start_value.nil? || end_value.nil? || date_key(start_value) <= date_key(end_value)
|
|
66
|
+
raise ArgumentError, "date_range_picker start_value must be before or equal to end_value"
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def date_key(value)
|
|
71
|
+
value.respond_to?(:iso8601) ? value.iso8601 : value.to_s
|
|
72
|
+
end
|
|
53
73
|
end
|
|
54
74
|
end
|
|
55
75
|
end
|
|
@@ -9,6 +9,15 @@ module Ruflet
|
|
|
9
9
|
WIRE = "Divider".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, badge: nil, col: nil, color: nil, data: nil, disabled: nil, expand: nil, expand_loose: nil, height: nil, key: nil, leading_indent: nil, opacity: nil, radius: nil, rtl: nil, thickness: nil, tooltip: nil, trailing_indent: nil, visible: nil)
|
|
12
|
+
{
|
|
13
|
+
height: height,
|
|
14
|
+
leading_indent: leading_indent,
|
|
15
|
+
thickness: thickness,
|
|
16
|
+
trailing_indent: trailing_indent
|
|
17
|
+
}.each do |name, value|
|
|
18
|
+
raise ArgumentError, "divider #{name} must be greater than or equal to 0" unless value.nil? || value >= 0
|
|
19
|
+
end
|
|
20
|
+
|
|
12
21
|
props = {}
|
|
13
22
|
props[:badge] = badge unless badge.nil?
|
|
14
23
|
props[:col] = col unless col.nil?
|
|
@@ -9,6 +9,17 @@ module Ruflet
|
|
|
9
9
|
WIRE = "Dropdown".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: 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, autofocus: nil, badge: nil, bgcolor: nil, border: nil, border_color: nil, border_radius: nil, border_width: nil, bottom: nil, capitalization: nil, col: nil, color: nil, content_padding: nil, data: nil, dense: nil, disabled: nil, editable: nil, elevation: nil, enable_filter: nil, enable_search: nil, error_style: nil, error_text: nil, expand: nil, expand_loose: nil, expanded_insets: nil, fill_color: nil, filled: nil, focused_border_color: nil, focused_border_width: nil, height: nil, helper_style: nil, helper_text: nil, hint_style: nil, hint_text: nil, hover_color: nil, input_filter: nil, key: nil, label: nil, label_style: nil, leading_icon: nil, left: nil, margin: nil, menu_height: nil, menu_style: nil, menu_width: nil, offset: nil, opacity: nil, options: nil, right: nil, rotate: nil, rtl: nil, scale: nil, selected_suffix: nil, selected_trailing_icon: nil, size_change_interval: nil, text: nil, text_align: nil, text_size: nil, text_style: nil, tooltip: nil, top: nil, trailing_icon: nil, value: nil, visible: nil, width: nil, on_animation_end: nil, on_blur: nil, on_focus: nil, on_select: nil, on_size_change: nil, on_text_change: nil)
|
|
12
|
+
{
|
|
13
|
+
border_width: border_width,
|
|
14
|
+
elevation: elevation,
|
|
15
|
+
focused_border_width: focused_border_width,
|
|
16
|
+
menu_height: menu_height,
|
|
17
|
+
menu_width: menu_width,
|
|
18
|
+
text_size: text_size
|
|
19
|
+
}.each do |name, numeric_value|
|
|
20
|
+
raise ArgumentError, "dropdown #{name} must be greater than or equal to 0" unless numeric_value.nil? || numeric_value >= 0
|
|
21
|
+
end
|
|
22
|
+
|
|
12
23
|
props = {}
|
|
13
24
|
props[:align] = align unless align.nil?
|
|
14
25
|
props[:animate_align] = animate_align unless animate_align.nil?
|
|
@@ -9,6 +9,11 @@ module Ruflet
|
|
|
9
9
|
WIRE = "DropdownOption".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, badge: nil, col: nil, content: nil, data: nil, disabled: nil, expand: nil, expand_loose: nil, key: nil, leading_icon: nil, opacity: nil, rtl: nil, style: nil, text: nil, tooltip: nil, trailing_icon: nil, visible: nil)
|
|
12
|
+
raise ArgumentError, "dropdown_option requires key or text" if key.nil? && text.nil?
|
|
13
|
+
|
|
14
|
+
key = text if key.nil?
|
|
15
|
+
text = key if text.nil?
|
|
16
|
+
|
|
12
17
|
props = {}
|
|
13
18
|
props[:badge] = badge unless badge.nil?
|
|
14
19
|
props[:col] = col unless col.nil?
|
|
@@ -9,6 +9,14 @@ module Ruflet
|
|
|
9
9
|
WIRE = "ExpansionPanel".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, adaptive: 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, bgcolor: nil, bottom: nil, can_tap_header: nil, col: nil, content: nil, data: nil, disabled: nil, expand: nil, expand_loose: nil, expanded: nil, header: nil, height: nil, highlight_color: nil, key: nil, left: nil, margin: nil, offset: nil, opacity: nil, right: nil, rotate: nil, rtl: nil, scale: nil, size_change_interval: nil, splash_color: nil, tooltip: nil, top: nil, visible: nil, width: nil, on_animation_end: nil, on_size_change: nil)
|
|
12
|
+
if header.nil? || (header.respond_to?(:props) && header.props["visible"] == false)
|
|
13
|
+
raise ArgumentError, "expansion_panel requires a visible header"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
if content.nil? || (content.respond_to?(:props) && content.props["visible"] == false)
|
|
17
|
+
raise ArgumentError, "expansion_panel requires visible content"
|
|
18
|
+
end
|
|
19
|
+
|
|
12
20
|
props = {}
|
|
13
21
|
props[:adaptive] = adaptive unless adaptive.nil?
|
|
14
22
|
props[:align] = align unless align.nil?
|
|
@@ -9,6 +9,12 @@ module Ruflet
|
|
|
9
9
|
WIRE = "ExpansionPanelList".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: 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, controls: nil, data: nil, disabled: nil, divider_color: nil, elevation: nil, expand: nil, expand_icon_color: nil, expand_loose: nil, expanded_header_padding: nil, height: nil, key: nil, left: nil, margin: nil, offset: nil, opacity: nil, right: nil, rotate: nil, rtl: nil, scale: nil, size_change_interval: nil, spacing: nil, tooltip: nil, top: nil, visible: nil, width: nil, on_animation_end: nil, on_change: nil, on_size_change: nil)
|
|
12
|
+
elevation = 2 if elevation.nil?
|
|
13
|
+
|
|
14
|
+
{ elevation: elevation, spacing: spacing }.each do |name, value|
|
|
15
|
+
raise ArgumentError, "expansion_panel_list #{name} must be greater than or equal to 0" unless value.nil? || value >= 0
|
|
16
|
+
end
|
|
17
|
+
|
|
12
18
|
props = {}
|
|
13
19
|
props[:align] = align unless align.nil?
|
|
14
20
|
props[:animate_align] = animate_align unless animate_align.nil?
|
|
@@ -9,6 +9,12 @@ module Ruflet
|
|
|
9
9
|
WIRE = "ExpansionTile".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, adaptive: nil, affinity: 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, animation_style: nil, aspect_ratio: nil, badge: nil, bgcolor: nil, bottom: nil, clip_behavior: nil, col: nil, collapsed_bgcolor: nil, collapsed_icon_color: nil, collapsed_shape: nil, collapsed_text_color: nil, controls: nil, controls_padding: nil, data: nil, dense: nil, disabled: nil, enable_feedback: nil, expand: nil, expand_loose: nil, expanded: nil, expanded_alignment: nil, expanded_cross_axis_alignment: nil, height: nil, icon_color: nil, key: nil, leading: nil, left: nil, maintain_state: nil, margin: nil, min_tile_height: nil, offset: nil, opacity: nil, right: nil, rotate: nil, rtl: nil, scale: nil, shape: nil, show_trailing_icon: nil, size_change_interval: nil, subtitle: nil, text_color: nil, tile_padding: nil, title: nil, tooltip: nil, top: nil, trailing: nil, visible: nil, visual_density: nil, width: nil, on_animation_end: nil, on_change: nil, on_size_change: nil)
|
|
12
|
+
raise ArgumentError, "expansion_tile requires a visible title" if title.nil? || (title.respond_to?(:props) && title.props["visible"] == false)
|
|
13
|
+
raise ArgumentError, "expansion_tile min_tile_height must be greater than or equal to 0" unless min_tile_height.nil? || min_tile_height >= 0
|
|
14
|
+
expanded = false if expanded.nil?
|
|
15
|
+
maintain_state = false if maintain_state.nil?
|
|
16
|
+
show_trailing_icon = true if show_trailing_icon.nil?
|
|
17
|
+
|
|
12
18
|
props = {}
|
|
13
19
|
props[:adaptive] = adaptive unless adaptive.nil?
|
|
14
20
|
props[:affinity] = affinity unless affinity.nil?
|
|
@@ -9,6 +9,11 @@ module Ruflet
|
|
|
9
9
|
WIRE = "FilledButton".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, adaptive: 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, autofocus: nil, badge: nil, bgcolor: nil, bottom: nil, clip_behavior: nil, col: nil, color: nil, content: nil, data: nil, disabled: nil, elevation: nil, expand: nil, expand_loose: nil, height: nil, icon: nil, icon_color: nil, key: nil, left: nil, margin: nil, offset: nil, opacity: nil, right: nil, rotate: nil, rtl: nil, scale: nil, size_change_interval: nil, style: nil, tooltip: nil, top: nil, url: nil, visible: nil, width: nil, on_animation_end: nil, on_blur: nil, on_click: nil, on_focus: nil, on_hover: nil, on_long_press: nil, on_size_change: nil)
|
|
12
|
+
raise ArgumentError, "filled_button requires content or icon" if content.nil? && icon.nil?
|
|
13
|
+
|
|
14
|
+
autofocus = false if autofocus.nil?
|
|
15
|
+
clip_behavior = "none" if clip_behavior.nil?
|
|
16
|
+
|
|
12
17
|
props = {}
|
|
13
18
|
props[:adaptive] = adaptive unless adaptive.nil?
|
|
14
19
|
props[:align] = align unless align.nil?
|
|
@@ -9,6 +9,14 @@ module Ruflet
|
|
|
9
9
|
WIRE = "FilledIconButton".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, adaptive: nil, align: nil, alignment: 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, autofocus: nil, badge: nil, bgcolor: nil, bottom: nil, col: nil, data: nil, disabled: nil, disabled_color: nil, enable_feedback: nil, expand: nil, expand_loose: nil, focus_color: nil, height: nil, highlight_color: nil, hover_color: nil, icon: nil, icon_color: nil, icon_size: nil, key: nil, left: nil, margin: nil, mouse_cursor: nil, offset: nil, opacity: nil, padding: nil, right: nil, rotate: nil, rtl: nil, scale: nil, selected: nil, selected_icon: nil, selected_icon_color: nil, size_change_interval: nil, size_constraints: nil, splash_color: nil, splash_radius: nil, style: nil, tooltip: nil, top: nil, url: nil, visible: nil, visual_density: nil, width: nil, on_animation_end: nil, on_blur: nil, on_click: nil, on_focus: nil, on_hover: nil, on_long_press: nil, on_size_change: nil)
|
|
12
|
+
alignment = "center" if alignment.nil?
|
|
13
|
+
autofocus = false if autofocus.nil?
|
|
14
|
+
icon_size = 24 if icon_size.nil?
|
|
15
|
+
padding = { "all" => 8 } if padding.nil?
|
|
16
|
+
unless splash_radius.nil? || splash_radius.positive?
|
|
17
|
+
raise ArgumentError, "filled_icon_button splash_radius must be greater than 0"
|
|
18
|
+
end
|
|
19
|
+
|
|
12
20
|
props = {}
|
|
13
21
|
props[:adaptive] = adaptive unless adaptive.nil?
|
|
14
22
|
props[:align] = align unless align.nil?
|
|
@@ -9,6 +9,11 @@ module Ruflet
|
|
|
9
9
|
WIRE = "FilledTonalButton".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, adaptive: 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, autofocus: nil, badge: nil, bgcolor: nil, bottom: nil, clip_behavior: nil, col: nil, color: nil, content: nil, data: nil, disabled: nil, elevation: nil, expand: nil, expand_loose: nil, height: nil, icon: nil, icon_color: nil, key: nil, left: nil, margin: nil, offset: nil, opacity: nil, right: nil, rotate: nil, rtl: nil, scale: nil, size_change_interval: nil, style: nil, tooltip: nil, top: nil, url: nil, visible: nil, width: nil, on_animation_end: nil, on_blur: nil, on_click: nil, on_focus: nil, on_hover: nil, on_long_press: nil, on_size_change: nil)
|
|
12
|
+
raise ArgumentError, "filled_tonal_button requires content or icon" if content.nil? && icon.nil?
|
|
13
|
+
|
|
14
|
+
autofocus = false if autofocus.nil?
|
|
15
|
+
clip_behavior = "none" if clip_behavior.nil?
|
|
16
|
+
|
|
12
17
|
props = {}
|
|
13
18
|
props[:adaptive] = adaptive unless adaptive.nil?
|
|
14
19
|
props[:align] = align unless align.nil?
|
|
@@ -9,6 +9,14 @@ module Ruflet
|
|
|
9
9
|
WIRE = "FilledTonalIconButton".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, adaptive: nil, align: nil, alignment: 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, autofocus: nil, badge: nil, bgcolor: nil, bottom: nil, col: nil, data: nil, disabled: nil, disabled_color: nil, enable_feedback: nil, expand: nil, expand_loose: nil, focus_color: nil, height: nil, highlight_color: nil, hover_color: nil, icon: nil, icon_color: nil, icon_size: nil, key: nil, left: nil, margin: nil, mouse_cursor: nil, offset: nil, opacity: nil, padding: nil, right: nil, rotate: nil, rtl: nil, scale: nil, selected: nil, selected_icon: nil, selected_icon_color: nil, size_change_interval: nil, size_constraints: nil, splash_color: nil, splash_radius: nil, style: nil, tooltip: nil, top: nil, url: nil, visible: nil, visual_density: nil, width: nil, on_animation_end: nil, on_blur: nil, on_click: nil, on_focus: nil, on_hover: nil, on_long_press: nil, on_size_change: nil)
|
|
12
|
+
alignment = "center" if alignment.nil?
|
|
13
|
+
autofocus = false if autofocus.nil?
|
|
14
|
+
icon_size = 24 if icon_size.nil?
|
|
15
|
+
padding = { "all" => 8 } if padding.nil?
|
|
16
|
+
unless splash_radius.nil? || splash_radius.positive?
|
|
17
|
+
raise ArgumentError, "filled_tonal_icon_button splash_radius must be greater than 0"
|
|
18
|
+
end
|
|
19
|
+
|
|
12
20
|
props = {}
|
|
13
21
|
props[:adaptive] = adaptive unless adaptive.nil?
|
|
14
22
|
props[:align] = align unless align.nil?
|
|
@@ -9,6 +9,20 @@ module Ruflet
|
|
|
9
9
|
WIRE = "FloatingActionButton".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: 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, autofocus: nil, badge: nil, bgcolor: nil, bottom: nil, clip_behavior: nil, col: nil, content: nil, data: nil, disabled: nil, disabled_elevation: nil, elevation: nil, enable_feedback: nil, expand: nil, expand_loose: nil, focus_color: nil, focus_elevation: nil, foreground_color: nil, height: nil, highlight_elevation: nil, hover_color: nil, hover_elevation: nil, icon: nil, key: nil, left: nil, margin: nil, mini: nil, mouse_cursor: nil, offset: nil, opacity: nil, right: nil, rotate: nil, rtl: nil, scale: nil, shape: nil, size_change_interval: nil, splash_color: nil, tooltip: nil, top: nil, url: nil, visible: nil, width: nil, on_animation_end: nil, on_click: nil, on_size_change: nil)
|
|
12
|
+
if icon.nil? && blank_content?(content)
|
|
13
|
+
raise ArgumentError, "floating_action_button requires icon or non-empty content"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
{
|
|
17
|
+
disabled_elevation: disabled_elevation,
|
|
18
|
+
elevation: elevation,
|
|
19
|
+
focus_elevation: focus_elevation,
|
|
20
|
+
highlight_elevation: highlight_elevation,
|
|
21
|
+
hover_elevation: hover_elevation
|
|
22
|
+
}.each do |name, value|
|
|
23
|
+
raise ArgumentError, "floating_action_button #{name} must be greater than or equal to 0" unless value.nil? || value >= 0
|
|
24
|
+
end
|
|
25
|
+
|
|
12
26
|
props = {}
|
|
13
27
|
props[:align] = align unless align.nil?
|
|
14
28
|
props[:animate_align] = animate_align unless animate_align.nil?
|
|
@@ -66,6 +80,12 @@ module Ruflet
|
|
|
66
80
|
props[:on_size_change] = on_size_change unless on_size_change.nil?
|
|
67
81
|
super(type: TYPE, id: id, **props)
|
|
68
82
|
end
|
|
83
|
+
|
|
84
|
+
private
|
|
85
|
+
|
|
86
|
+
def blank_content?(value)
|
|
87
|
+
value.nil? || (value.respond_to?(:empty?) && value.empty?)
|
|
88
|
+
end
|
|
69
89
|
end
|
|
70
90
|
end
|
|
71
91
|
end
|
|
@@ -9,6 +9,10 @@ module Ruflet
|
|
|
9
9
|
WIRE = "IconButton".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, adaptive: nil, align: nil, alignment: 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, autofocus: nil, badge: nil, bgcolor: nil, bottom: nil, col: nil, data: nil, disabled: nil, disabled_color: nil, enable_feedback: nil, expand: nil, expand_loose: nil, focus_color: nil, height: nil, highlight_color: nil, hover_color: nil, icon: nil, icon_color: nil, icon_size: nil, key: nil, left: nil, margin: nil, mouse_cursor: nil, offset: nil, opacity: nil, padding: nil, right: nil, rotate: nil, rtl: nil, scale: nil, selected: nil, selected_icon: nil, selected_icon_color: nil, size_change_interval: nil, size_constraints: nil, splash_color: nil, splash_radius: nil, style: nil, tooltip: nil, top: nil, url: nil, visible: nil, visual_density: nil, width: nil, on_animation_end: nil, on_blur: nil, on_click: nil, on_focus: nil, on_hover: nil, on_long_press: nil, on_size_change: nil)
|
|
12
|
+
unless splash_radius.nil? || splash_radius >= 0
|
|
13
|
+
raise ArgumentError, "icon_button splash_radius must be greater than or equal to 0"
|
|
14
|
+
end
|
|
15
|
+
|
|
12
16
|
props = {}
|
|
13
17
|
props[:adaptive] = adaptive unless adaptive.nil?
|
|
14
18
|
props[:align] = align unless align.nil?
|
|
@@ -9,6 +9,10 @@ module Ruflet
|
|
|
9
9
|
WIRE = "ListTile".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, adaptive: 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, autofocus: nil, badge: nil, bgcolor: nil, bottom: nil, col: nil, content_padding: nil, data: nil, dense: nil, disabled: nil, enable_feedback: nil, expand: nil, expand_loose: nil, height: nil, horizontal_spacing: nil, hover_color: nil, icon_color: nil, is_three_line: nil, key: nil, leading: nil, leading_and_trailing_text_style: nil, left: nil, margin: nil, min_height: nil, min_leading_width: nil, min_vertical_padding: nil, mouse_cursor: nil, offset: nil, opacity: nil, right: nil, rotate: nil, rtl: nil, scale: nil, selected: nil, selected_color: nil, selected_tile_color: nil, shape: nil, size_change_interval: nil, splash_color: nil, style: nil, subtitle: nil, subtitle_text_style: nil, text_color: nil, title: nil, title_alignment: nil, title_text_style: nil, toggle_inputs: nil, tooltip: nil, top: nil, trailing: nil, url: nil, visible: nil, visual_density: nil, width: nil, on_animation_end: nil, on_click: nil, on_long_press: nil, on_size_change: nil)
|
|
12
|
+
if is_three_line == true && subtitle.nil?
|
|
13
|
+
raise ArgumentError, "list_tile subtitle is required when is_three_line is true"
|
|
14
|
+
end
|
|
15
|
+
|
|
12
16
|
props = {}
|
|
13
17
|
props[:adaptive] = adaptive unless adaptive.nil?
|
|
14
18
|
props[:align] = align unless align.nil?
|