glimmer-dsl-opal 0.3.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +48 -0
- data/README.md +690 -24
- data/VERSION +1 -1
- data/app/assets/images/glimmer/images/calendar.gif +0 -0
- data/app/assets/images/glimmer/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/images/glimmer/images/ui-icons_444444_256x240.png +0 -0
- data/app/assets/images/glimmer/images/ui-icons_555555_256x240.png +0 -0
- data/app/assets/images/glimmer/images/ui-icons_777620_256x240.png +0 -0
- data/app/assets/images/glimmer/images/ui-icons_777777_256x240.png +0 -0
- data/app/assets/images/glimmer/images/ui-icons_cc0000_256x240.png +0 -0
- data/app/assets/images/glimmer/images/ui-icons_ffffff_256x240.png +0 -0
- data/app/assets/stylesheets/glimmer/glimmer.css +15 -0
- data/app/assets/stylesheets/glimmer/jquery-ui.css +1312 -0
- data/app/assets/stylesheets/glimmer/jquery-ui.structure.css +886 -0
- data/app/assets/stylesheets/glimmer/jquery-ui.theme.css +443 -0
- data/app/assets/stylesheets/glimmer/jquery.ui.timepicker.css +57 -0
- data/lib/glimmer-dsl-opal.rb +22 -10
- data/lib/glimmer-dsl-opal/ext/date.rb +38 -3
- data/lib/glimmer-dsl-opal/samples/elaborate/tic_tac_toe.rb +23 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_checkbox.rb +85 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_checkbox_group.rb +68 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_combo.rb +5 -5
- data/lib/glimmer-dsl-opal/samples/hello/hello_custom_widget.rb +3 -3
- data/lib/glimmer-dsl-opal/samples/hello/hello_date_time.rb +63 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_group.rb +104 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_list_single_selection.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_radio.rb +108 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_radio_group.rb +84 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui-timepicker/GPL-LICENSE.txt +278 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui-timepicker/MIT-LICENSE.txt +20 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui-timepicker/jquery.ui.timepicker.css +57 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui-timepicker/jquery.ui.timepicker.js +1496 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/AUTHORS.txt +333 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/LICENSE.txt +43 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_444444_256x240.png +0 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_555555_256x240.png +0 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_777620_256x240.png +0 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_777777_256x240.png +0 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_cc0000_256x240.png +0 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_ffffff_256x240.png +0 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/jquery-ui.min.css +7 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/jquery-ui.min.js +13 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/jquery-ui.structure.min.css +5 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/jquery-ui.theme.min.css +5 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/package.json +74 -0
- data/lib/glimmer-dsl-swt.rb +37 -0
- data/lib/glimmer/data_binding/element_binding.rb +2 -1
- data/lib/glimmer/dsl/opal/async_exec_expression.rb +23 -7
- data/lib/glimmer/dsl/opal/checkbox_group_selection_data_binding_expression.rb +61 -0
- data/lib/glimmer/dsl/opal/custom_widget_expression.rb +33 -16
- data/lib/glimmer/dsl/opal/display_expression.rb +40 -0
- data/lib/glimmer/dsl/opal/dsl.rb +6 -0
- data/lib/glimmer/dsl/opal/exec_expression.rb +55 -0
- data/lib/glimmer/dsl/opal/property_expression.rb +4 -3
- data/lib/glimmer/dsl/opal/radio_group_selection_data_binding_expression.rb +61 -0
- data/lib/glimmer/dsl/opal/shell_expression.rb +7 -1
- data/lib/glimmer/dsl/opal/sync_exec_expression.rb +33 -0
- data/lib/glimmer/dsl/opal/widget_expression.rb +6 -1
- data/lib/glimmer/engine.rb +9 -0
- data/lib/glimmer/swt.rb +3 -3
- data/lib/glimmer/swt/button_proxy.rb +16 -2
- data/lib/glimmer/swt/checkbox_proxy.rb +81 -0
- data/lib/glimmer/swt/color_proxy.rb +45 -45
- data/lib/glimmer/swt/combo_proxy.rb +6 -6
- data/lib/glimmer/swt/composite_proxy.rb +2 -2
- data/lib/glimmer/swt/custom/checkbox_group.rb +142 -0
- data/lib/glimmer/swt/custom/radio_group.rb +143 -0
- data/lib/glimmer/swt/date_time_proxy.rb +145 -0
- data/lib/glimmer/swt/display_proxy.rb +55 -1
- data/lib/glimmer/swt/fill_layout_proxy.rb +3 -3
- data/lib/glimmer/swt/grid_layout_proxy.rb +21 -10
- data/lib/glimmer/swt/group_proxy.rb +38 -0
- data/lib/glimmer/swt/label_proxy.rb +27 -7
- data/lib/glimmer/swt/layout_data_proxy.rb +40 -22
- data/lib/glimmer/swt/layout_proxy.rb +4 -4
- data/lib/glimmer/swt/list_proxy.rb +3 -3
- data/lib/glimmer/swt/make_shift_shell_proxy.rb +38 -0
- data/lib/glimmer/swt/message_box_proxy.rb +8 -7
- data/lib/glimmer/swt/radio_proxy.rb +82 -0
- data/lib/glimmer/swt/row_layout_proxy.rb +35 -12
- data/lib/glimmer/swt/scrolled_composite_proxy.rb +20 -0
- data/lib/glimmer/swt/shell_proxy.rb +23 -9
- data/lib/glimmer/swt/styled_text_proxy.rb +44 -0
- data/lib/glimmer/swt/tab_folder_proxy.rb +5 -5
- data/lib/glimmer/swt/tab_item_proxy.rb +7 -7
- data/lib/glimmer/swt/table_item_proxy.rb +6 -6
- data/lib/glimmer/swt/table_proxy.rb +12 -12
- data/lib/glimmer/swt/text_proxy.rb +2 -2
- data/lib/glimmer/swt/widget_proxy.rb +79 -36
- data/lib/glimmer/ui/custom_shell.rb +2 -1
- data/lib/glimmer/ui/custom_widget.rb +10 -9
- data/lib/{glimmer-dsl-opal/missing/net → net}/http.rb +0 -0
- data/lib/{glimmer-dsl-opal/missing/uri.rb → uri.rb} +2 -2
- metadata +56 -4
@@ -1,30 +1,50 @@
|
|
1
1
|
require 'glimmer/swt/widget_proxy'
|
2
|
+
# require 'glimmer/swt/image_proxy'
|
2
3
|
|
3
4
|
module Glimmer
|
4
5
|
module SWT
|
5
6
|
class LabelProxy < WidgetProxy
|
6
|
-
attr_reader :text
|
7
|
+
attr_reader :text, :background_image, :image, :alignment
|
8
|
+
|
9
|
+
def initialize(parent, args, block)
|
10
|
+
super(parent, args, block)
|
11
|
+
self.alignment = [:left, :center, :right].detect {|align| args.detect { |arg| SWTProxy[align] == arg } }
|
12
|
+
end
|
7
13
|
|
8
14
|
def text=(value)
|
9
15
|
@text = value
|
10
16
|
dom_element.html(value)
|
11
17
|
end
|
12
18
|
|
19
|
+
def background_image=(*image_options)
|
20
|
+
# TODO consider if there is a difference between background_image and image in label and to have one reuse the other
|
21
|
+
# TODO finish implementation
|
22
|
+
# @background_image = Glimmer::SWT::ImageProxy.create(*image_options)
|
23
|
+
# dom_element.css('background-image', @background_image.image_data.dom_element.src)
|
24
|
+
end
|
25
|
+
|
26
|
+
def image=(*image_options)
|
27
|
+
# TODO finish implementation
|
28
|
+
# @image = Glimmer::SWT::ImageProxy.create(*image_options)
|
29
|
+
# dom_element.css('background-image', @image.image_data.dom_element.src)
|
30
|
+
end
|
31
|
+
|
13
32
|
def element
|
14
33
|
'label'
|
15
34
|
end
|
16
|
-
|
17
|
-
def alignment
|
18
|
-
|
35
|
+
|
36
|
+
def alignment=(value)
|
37
|
+
# TODO consider storing swt value in the future instead
|
38
|
+
@alignment = value
|
39
|
+
dom_element.css('text-align', @alignment.to_s)
|
19
40
|
end
|
20
41
|
|
21
|
-
def dom
|
42
|
+
def dom
|
22
43
|
label_text = @text
|
23
44
|
label_id = id
|
24
|
-
label_style = "text-align: #{alignment};"
|
25
45
|
label_class = name
|
26
46
|
@dom ||= html {
|
27
|
-
label(id: label_id,
|
47
|
+
label(id: label_id, class: label_class) {
|
28
48
|
label_text
|
29
49
|
}
|
30
50
|
}.to_s
|
@@ -4,78 +4,96 @@ module Glimmer
|
|
4
4
|
module SWT
|
5
5
|
class LayoutDataProxy
|
6
6
|
include Glimmer::SWT::PropertyOwner
|
7
|
-
attr_reader :parent,
|
8
|
-
:args,
|
9
|
-
:horizontal_alignment,
|
10
|
-
:vertical_alignment,
|
11
|
-
:horizontal_span,
|
12
|
-
:vertical_span,
|
13
|
-
:horizontal_indent,
|
14
|
-
:vertical_indent,
|
7
|
+
attr_reader :parent,
|
8
|
+
:args,
|
9
|
+
:horizontal_alignment,
|
10
|
+
:vertical_alignment,
|
11
|
+
:horizontal_span,
|
12
|
+
:vertical_span,
|
13
|
+
:horizontal_indent,
|
14
|
+
:vertical_indent,
|
15
15
|
:grab_excess_horizontal_space,
|
16
16
|
:grab_excess_vertical_space,
|
17
|
+
:width_hint,
|
17
18
|
:height_hint
|
18
19
|
|
19
20
|
def initialize(parent, args)
|
20
21
|
@parent = parent
|
21
22
|
@args = args
|
22
|
-
|
23
|
+
self.horizontal_alignment = @args[0] if @args[0]
|
24
|
+
self.vertical_alignment = @args[1] if @args[1]
|
25
|
+
self.grab_excess_horizontal_space = @args[2] if @args[2]
|
26
|
+
self.grab_excess_vertical_space = @args[3] if @args[3]
|
27
|
+
# TODO spread args correctly as per SWT LayoutData API
|
23
28
|
# TODO avoid using reapply
|
24
|
-
|
29
|
+
# reapply
|
30
|
+
end
|
31
|
+
|
32
|
+
def width_hint=(width_hint)
|
33
|
+
@width_hint = width_hint
|
34
|
+
@parent.dom_element.css('width', "#{@width_hint}px")
|
35
|
+
# reapply
|
25
36
|
end
|
26
37
|
|
27
38
|
def height_hint=(height_hint)
|
28
39
|
@height_hint = height_hint
|
29
|
-
#
|
30
|
-
|
40
|
+
@parent.dom_element.css('height', "#{@height_hint}px")
|
41
|
+
# reapply
|
31
42
|
end
|
32
43
|
|
33
44
|
def horizontal_alignment=(horizontal_alignment)
|
34
45
|
@horizontal_alignment = horizontal_alignment
|
46
|
+
return if @horizontal_alignment.nil?
|
47
|
+
if @horizontal_alignment == 'fill'
|
48
|
+
@parent.dom_element.css('width', '100%') if width_hint.nil?
|
49
|
+
else
|
50
|
+
@parent.dom_element.css('text-align', @horizontal_alignment)
|
51
|
+
end
|
35
52
|
# TODO
|
36
|
-
|
53
|
+
# reapply
|
37
54
|
end
|
38
55
|
|
39
56
|
def vertical_alignment=(vertical_alignment)
|
40
57
|
@vertical_alignment = vertical_alignment
|
41
58
|
# TODO
|
42
|
-
|
59
|
+
# reapply
|
43
60
|
end
|
44
61
|
|
45
62
|
def horizontal_span=(value)
|
46
63
|
@horizontal_span = value
|
47
64
|
@parent.dom_element.css('grid-column-start', "span #{@horizontal_span}")
|
48
|
-
|
65
|
+
# reapply
|
49
66
|
end
|
50
67
|
|
51
68
|
def vertical_span=(value)
|
52
69
|
@vertical_span = value
|
53
|
-
@parent.dom_element.css('grid-row-start', "span #{@
|
54
|
-
|
70
|
+
@parent.dom_element.css('grid-row-start', "span #{@vertical_span}")
|
71
|
+
# reapply
|
55
72
|
end
|
56
73
|
|
57
74
|
def horizontal_indent=(value)
|
58
75
|
@horizontal_indent = value
|
59
76
|
@parent.dom_element.css('padding-left', @horizontal_indent)
|
60
|
-
|
77
|
+
# reapply
|
61
78
|
end
|
62
79
|
|
63
80
|
def vertical_indent=(value)
|
64
81
|
@vertical_indent = value
|
65
82
|
@parent.dom_element.css('padding-top', @vertical_indent)
|
66
|
-
|
83
|
+
# reapply
|
67
84
|
end
|
68
85
|
|
69
86
|
def grab_excess_horizontal_space=(grab_excess_horizontal_space)
|
70
87
|
@grab_excess_horizontal_space = grab_excess_horizontal_space
|
71
|
-
|
72
|
-
|
88
|
+
@parent.dom_element.css('width', "100%") if @grab_excess_horizontal_space && width_hint.nil?
|
89
|
+
# reapply
|
73
90
|
end
|
74
91
|
|
75
92
|
def grab_excess_vertical_space=(grab_excess_vertical_space)
|
76
93
|
@grab_excess_vertical_space = grab_excess_vertical_space
|
94
|
+
@parent.dom_element.css('height', "100%") if @grab_excess_vertical_space && height_hint.nil?
|
77
95
|
# TODO
|
78
|
-
|
96
|
+
# reapply
|
79
97
|
end
|
80
98
|
|
81
99
|
def reapply
|
@@ -25,21 +25,21 @@ module Glimmer
|
|
25
25
|
def layout_exists?(keyword)
|
26
26
|
!!layout_class(keyword)
|
27
27
|
end
|
28
|
-
end
|
28
|
+
end
|
29
29
|
|
30
30
|
attr_reader :parent, :args
|
31
31
|
|
32
|
-
def initialize(parent, args)
|
32
|
+
def initialize(parent, args)
|
33
33
|
@parent = parent
|
34
34
|
@parent = parent.body_root if @parent.is_a?(Glimmer::UI::CustomWidget)
|
35
35
|
@parent.css_classes.each do |css_class|
|
36
36
|
@parent.remove_css_class(css_class) if css_class.include?('layout')
|
37
37
|
end
|
38
|
-
@args = args
|
38
|
+
@args = args
|
39
39
|
@parent.add_css_class(css_class)
|
40
40
|
@parent.layout = self
|
41
41
|
self.margin_width = 15 if respond_to?(:margin_width=)
|
42
|
-
self.margin_height = 15 if respond_to?(:margin_height=)
|
42
|
+
self.margin_height = 15 if respond_to?(:margin_height=)
|
43
43
|
end
|
44
44
|
|
45
45
|
def css_class
|
@@ -6,8 +6,8 @@ module Glimmer
|
|
6
6
|
ITEM_EMPTY = '_____'
|
7
7
|
attr_reader :items, :selection
|
8
8
|
|
9
|
-
def initialize(parent, args)
|
10
|
-
super(parent, args)
|
9
|
+
def initialize(parent, args, block)
|
10
|
+
super(parent, args, block)
|
11
11
|
@selection = []
|
12
12
|
end
|
13
13
|
|
@@ -62,7 +62,7 @@ module Glimmer
|
|
62
62
|
if event.target.prop('nodeName') == 'LI'
|
63
63
|
selected_item = event.target.text
|
64
64
|
select(index_of(selected_item), event.meta_key)
|
65
|
-
event_listener.call(event)
|
65
|
+
event_listener.call(event)
|
66
66
|
end
|
67
67
|
}
|
68
68
|
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Copyright (c) 2020 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
module Glimmer
|
23
|
+
module SWT
|
24
|
+
class MakeShiftShellProxy < Glimmer::SWT::ShellProxy
|
25
|
+
def initialize(*args, &block)
|
26
|
+
# No Op
|
27
|
+
end
|
28
|
+
|
29
|
+
def post_initialize_child(child)
|
30
|
+
# No Op
|
31
|
+
end
|
32
|
+
|
33
|
+
def open
|
34
|
+
# No Op
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -5,10 +5,11 @@ module Glimmer
|
|
5
5
|
class MessageBoxProxy < WidgetProxy
|
6
6
|
attr_reader :text, :message
|
7
7
|
|
8
|
-
def initialize(parent, args)
|
8
|
+
def initialize(parent, args, block)
|
9
9
|
i = 0
|
10
10
|
@parent = parent
|
11
11
|
@args = args
|
12
|
+
@block = block
|
12
13
|
@children = Set.new
|
13
14
|
@enabled = true
|
14
15
|
content do
|
@@ -37,7 +38,7 @@ module Glimmer
|
|
37
38
|
end
|
38
39
|
|
39
40
|
def open
|
40
|
-
document.
|
41
|
+
document.post_initialize_child(self)
|
41
42
|
end
|
42
43
|
|
43
44
|
def hide
|
@@ -53,11 +54,11 @@ module Glimmer
|
|
53
54
|
end
|
54
55
|
|
55
56
|
def selector
|
56
|
-
super + ' .close'
|
57
|
+
super + ' .close'
|
57
58
|
end
|
58
59
|
|
59
60
|
def listener_path
|
60
|
-
path + ' .close'
|
61
|
+
path + ' .close'
|
61
62
|
end
|
62
63
|
|
63
64
|
def observation_request_to_event_mapping
|
@@ -66,7 +67,7 @@ module Glimmer
|
|
66
67
|
event: 'click'
|
67
68
|
},
|
68
69
|
}
|
69
|
-
end
|
70
|
+
end
|
70
71
|
|
71
72
|
def style_dom_modal_css
|
72
73
|
<<~CSS
|
@@ -119,11 +120,11 @@ module Glimmer
|
|
119
120
|
modal_text = text
|
120
121
|
modal_message = message
|
121
122
|
modal_class = ['modal', name].join(' ')
|
122
|
-
@dom ||= html {
|
123
|
+
@dom ||= html {
|
123
124
|
div(id: modal_id, style: modal_style, class: modal_class) {
|
124
125
|
style(class: 'modal-style') {
|
125
126
|
style_dom_modal_css #.split("\n").map(&:strip).join(' ')
|
126
|
-
}
|
127
|
+
}
|
127
128
|
div(class: 'modal-content') {
|
128
129
|
header(class: 'text') {
|
129
130
|
modal_text
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'glimmer/swt/widget_proxy'
|
2
|
+
|
3
|
+
module Glimmer
|
4
|
+
module SWT
|
5
|
+
class RadioProxy < WidgetProxy
|
6
|
+
# TODO add a create method that ensures passing :radio style in if not there
|
7
|
+
STYLE=<<~CSS
|
8
|
+
.radio {
|
9
|
+
display: inline;
|
10
|
+
}
|
11
|
+
.radio-label {
|
12
|
+
display: inline;
|
13
|
+
}
|
14
|
+
.radio-container {
|
15
|
+
}
|
16
|
+
CSS
|
17
|
+
|
18
|
+
def text
|
19
|
+
label_dom_element.html
|
20
|
+
end
|
21
|
+
|
22
|
+
def text=(value)
|
23
|
+
label_dom_element.html(value)
|
24
|
+
end
|
25
|
+
|
26
|
+
def selection
|
27
|
+
dom_element.prop('checked')
|
28
|
+
end
|
29
|
+
|
30
|
+
def selection=(value)
|
31
|
+
dom_element.prop('checked', value)
|
32
|
+
end
|
33
|
+
|
34
|
+
def element
|
35
|
+
'input'
|
36
|
+
end
|
37
|
+
|
38
|
+
def label_id
|
39
|
+
"#{id}-label"
|
40
|
+
end
|
41
|
+
|
42
|
+
def label_name
|
43
|
+
"#{name}-label"
|
44
|
+
end
|
45
|
+
|
46
|
+
def label_path
|
47
|
+
"#{parent_path} ##{label_id}"
|
48
|
+
end
|
49
|
+
|
50
|
+
def label_dom_element
|
51
|
+
Document.find(label_path)
|
52
|
+
end
|
53
|
+
|
54
|
+
def container_id
|
55
|
+
"#{id}-container"
|
56
|
+
end
|
57
|
+
|
58
|
+
def container_name
|
59
|
+
"#{name}-container"
|
60
|
+
end
|
61
|
+
|
62
|
+
def observation_request_to_event_mapping
|
63
|
+
{
|
64
|
+
'on_widget_selected' => {
|
65
|
+
event: 'change'
|
66
|
+
},
|
67
|
+
}
|
68
|
+
end
|
69
|
+
|
70
|
+
def dom
|
71
|
+
@dom ||= html {
|
72
|
+
span(id: container_id, class: container_name) {
|
73
|
+
input(type: 'radio', id: id, class: name, name: parent&.id)
|
74
|
+
label(id: label_id, class: label_name, for: id) {
|
75
|
+
text
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}.to_s
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -8,18 +8,19 @@ module Glimmer
|
|
8
8
|
STYLE = <<~CSS
|
9
9
|
.row-layout {
|
10
10
|
display: flex;
|
11
|
+
align-items: flex-start;
|
11
12
|
}
|
12
13
|
|
13
|
-
.row-layout-pack {
|
14
|
-
|
14
|
+
.row-layout-pack-false {
|
15
|
+
align-items: stretch;
|
15
16
|
}
|
16
17
|
|
17
18
|
.row-layout-horizontal {
|
18
19
|
flex-direction: row;
|
19
20
|
}
|
20
21
|
|
21
|
-
.row-layout-horizontal.row-layout-pack {
|
22
|
-
flex-direction:
|
22
|
+
.row-layout-horizontal.row-layout-pack-false {
|
23
|
+
flex-direction: unset;
|
23
24
|
}
|
24
25
|
|
25
26
|
.row-layout-vertical {
|
@@ -27,11 +28,11 @@ module Glimmer
|
|
27
28
|
}
|
28
29
|
|
29
30
|
.row-layout-vertical.row-layout-pack {
|
30
|
-
flex-direction: none;
|
31
|
+
flex-direction: none;
|
31
32
|
}
|
32
33
|
CSS
|
33
34
|
|
34
|
-
attr_reader :type, :margin_width, :margin_height, :spacing, :pack
|
35
|
+
attr_reader :type, :margin_width, :margin_height, :margin_top, :margin_right, :margin_bottom, :margin_left, :spacing, :pack
|
35
36
|
|
36
37
|
def initialize(parent, args)
|
37
38
|
super(parent, args)
|
@@ -51,7 +52,7 @@ module Glimmer
|
|
51
52
|
@type == :vertical
|
52
53
|
end
|
53
54
|
|
54
|
-
def dom(widget_dom)
|
55
|
+
def dom(widget_dom)
|
55
56
|
dom_result = widget_dom
|
56
57
|
dom_result += '<br />' if vertical? && @pack
|
57
58
|
dom_result
|
@@ -60,9 +61,9 @@ module Glimmer
|
|
60
61
|
def pack=(value)
|
61
62
|
@pack = value
|
62
63
|
if @pack
|
63
|
-
@parent.dom_element.
|
64
|
+
@parent.dom_element.remove_class('row-layout-pack-false')
|
64
65
|
else
|
65
|
-
@parent.dom_element.
|
66
|
+
@parent.dom_element.add_class('row-layout-pack-false')
|
66
67
|
end
|
67
68
|
end
|
68
69
|
|
@@ -75,8 +76,30 @@ module Glimmer
|
|
75
76
|
|
76
77
|
def margin_height=(pixels)
|
77
78
|
@margin_height = pixels
|
78
|
-
@parent.dom_element.css('
|
79
|
-
@parent.dom_element.css('
|
79
|
+
@parent.dom_element.css('padding-top', @margin_height)
|
80
|
+
@parent.dom_element.css('padding-bottom', @margin_height)
|
81
|
+
end
|
82
|
+
|
83
|
+
def margin_top=(pixels)
|
84
|
+
@margin_top = pixels
|
85
|
+
# Using padding for width since margin-right isn't getting respected with width 100%
|
86
|
+
@parent.dom_element.css('padding-top', @margin_top)
|
87
|
+
end
|
88
|
+
|
89
|
+
def margin_right=(pixels)
|
90
|
+
@margin_right = pixels
|
91
|
+
@parent.dom_element.css('padding-right', @margin_right)
|
92
|
+
end
|
93
|
+
|
94
|
+
def margin_bottom=(pixels)
|
95
|
+
@margin_bottom = pixels
|
96
|
+
# Using padding for width since margin-right isn't getting respected with width 100%
|
97
|
+
@parent.dom_element.css('padding-bottom', @margin_bottom)
|
98
|
+
end
|
99
|
+
|
100
|
+
def margin_left=(pixels)
|
101
|
+
@margin_left = pixels
|
102
|
+
@parent.dom_element.css('padding-left', @margin_left)
|
80
103
|
end
|
81
104
|
|
82
105
|
def spacing=(spacing)
|
@@ -89,7 +112,7 @@ module Glimmer
|
|
89
112
|
elsif vertical?
|
90
113
|
margin_bottom "#{@spacing}px"
|
91
114
|
end
|
92
|
-
}
|
115
|
+
}
|
93
116
|
s("##{@parent.id} > :last-child") {
|
94
117
|
if horizontal?
|
95
118
|
margin_right 0
|