glib-web 4.14.1 → 4.15.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea3a6a872d72ef4615ceccc100d875a9cbf21bee429fed02c205e0812089abbc
4
- data.tar.gz: 89b39a261fb479cfbf3a764d4c331ba585cfd58537625df9da8ac3cb2151c7cb
3
+ metadata.gz: 4b09283a44453982b74ec17941ae1d9ba3d764beb0e5152671c25309c33b03ce
4
+ data.tar.gz: 67ccedb988fa1241b94224e4c0d452b002eec9056fb7b30cab761be68c59142b
5
5
  SHA512:
6
- metadata.gz: c0e4878546dcc84d715a073f1cbae6bee081b695f80cb880c7eac39fafeef0397c78afa37f61ad32bae15df86a93e871e350aca95f5cb318930be7acef43d2b0
7
- data.tar.gz: 873fde1069443f0b6965f52fa26c6b4503a7995818f60c83857c8e07379748b75b6416fb63487f2e55baa2937e1ab92354cf5ef4456a0961b42c9e1d4a0798bb
6
+ metadata.gz: ce53046753706806f836a5278bd5a94e4ff27ac6b8fc32ee397448ac9fd12f609e58cc9356d0cebad24ba10e273c7512c08d29dce6f9d2ecf9ba1e6c5e18a087
7
+ data.tar.gz: 7f3a889e5a39f51fc79d4b85c396b253546ddd705294b020caaf5c1b820f262d0a690b2e72a764b5398a50ed3842de5c2b347ff62a4a231b1baa7aed0915c29f
@@ -289,7 +289,7 @@ module Glib
289
289
  optional = options[:optional] || []
290
290
 
291
291
  required.each do |req|
292
- raise ArgumentError, "Hash property: '#{req}' is required" if value[req.to_s].blank?
292
+ raise ArgumentError, "Hash property: '#{req}' is required" if value[req.to_s].nil?
293
293
  end
294
294
 
295
295
  if optional.present?
@@ -3,6 +3,8 @@ class Glib::JsonUi::ActionBuilder
3
3
  class Invoke < Action
4
4
  string :name
5
5
  hash :arguments
6
+ action :onTrue
7
+ action :onFalse
6
8
  end
7
9
 
8
10
  class Find < Action
@@ -10,8 +10,8 @@ class Glib::JsonUi::ActionBuilder
10
10
  int :offset
11
11
  int :width
12
12
  bool :persistent
13
- bool :overlay
14
- # singleton_array :styleClass, :styleClasses
13
+ hash :overlay, required: [:closeOnFocus]
14
+ singleton_array :styleClass, :styleClasses
15
15
  end
16
16
 
17
17
  class Close < Action
@@ -3,13 +3,24 @@ class Glib::JsonUi::ActionBuilder
3
3
 
4
4
  class Select < Action
5
5
  string :message
6
- bool :overlay
6
+
7
+ def overlay(value)
8
+ @overlay = value
9
+ end
7
10
 
8
11
  def buttons(block)
9
12
  json.buttons do
10
13
  block.call page.menu_builder
11
14
  end
12
15
  end
16
+
17
+ def created
18
+ if @overlay.nil?
19
+ @overlay = true
20
+ end
21
+
22
+ json.overlay @overlay
23
+ end
13
24
  end
14
25
 
15
26
  end
@@ -169,7 +169,7 @@ module Glib
169
169
 
170
170
  def leftDrawer(options = {})
171
171
  json.leftDrawer do
172
- [:styleClasses, :backgroundColor].each do |name|
172
+ [:styleClasses, :backgroundColor, :drawerWidth].each do |name|
173
173
  if (value = options.delete(name))
174
174
  json.set! name, value
175
175
  end
@@ -12,6 +12,7 @@ class Glib::JsonUi::ViewBuilder
12
12
  action :onChangeAndLoad
13
13
  string :paramNameForFormData
14
14
  string :paramNameForFieldName
15
+ bool :rounded
15
16
 
16
17
  def default_url_options
17
18
  { only_path: true }
@@ -163,7 +164,7 @@ class Glib::JsonUi::ViewBuilder
163
164
  class CheckGroup < AbstractField
164
165
  views :childViews
165
166
  string :uncheckValue
166
- bool :watchNoneOfAbove
167
+ string :valueForDisableAll
167
168
  end
168
169
 
169
170
  class Check < Text
@@ -204,7 +205,7 @@ class Glib::JsonUi::ViewBuilder
204
205
 
205
206
  panels_builder :accessory, :header, :footer
206
207
  bool :clearable
207
- bool :watchNoneOfAbove
208
+ string :valueForDisableAll
208
209
  bool :prependSelectAll
209
210
  # bool :csvMode
210
211
 
@@ -320,6 +320,7 @@ module Glib
320
320
  int :value # from 0 to 100
321
321
  color :color
322
322
  string :text
323
+ bool :indeterminate
323
324
  end
324
325
 
325
326
  class ShareButton < View
@@ -5,7 +5,7 @@ end
5
5
 
6
6
  section.rows builder: ->(template) do
7
7
  template.thumbnail title: 'sheets/select', onClick: ->(action) do
8
- action.sheets_select overlay: true, message: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed rutrum vel nisi in pharetra. Aenean mollis feugiat elementum. Donec tempor arcu fringilla risus finibus cursus. Donec eleifend ex sit amet odio rutrum, vitae ornare nunc congue. In hac habitasse platea dictumst. Curabitur at velit et odio ornare vestibulum sit amet vitae ex. Proin tincidunt rutrum libero vitae tempus.', buttons: ->(menu) do
8
+ action.sheets_select message: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed rutrum vel nisi in pharetra. Aenean mollis feugiat elementum. Donec tempor arcu fringilla risus finibus cursus. Donec eleifend ex sit amet odio rutrum, vitae ornare nunc congue. In hac habitasse platea dictumst. Curabitur at velit et odio ornare vestibulum sit amet vitae ex. Proin tincidunt rutrum libero vitae tempus.', buttons: ->(menu) do
9
9
  menu.button text: 'Option1', onClick: ->(subaction) do
10
10
  subaction.dialogs_alert message: 'Option 1'
11
11
  end
@@ -47,7 +47,7 @@ page.scroll childViews: ->(scroll) do
47
47
  form.spacer height: 20
48
48
  form.h2 text: 'Checkboxes with none_of_above'
49
49
  form.fields_checkGroup \
50
- watchNoneOfAbove: true,
50
+ valueForDisableAll: 'none_of_above',
51
51
  name: 'user[favorite_fruits][]',
52
52
  value: 'grape',
53
53
  uncheckValue: 1,
@@ -16,15 +16,18 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
16
16
  { name: 'question', value: 'Quality of work' },
17
17
  { name: 'type', value: 'rating' },
18
18
  { name: 'enabled', value: '1' },
19
+ { name: 'error_message', value: 'Wrong answer' }
19
20
  ],
20
21
  [
21
22
  { name: 'question', value: 'Satisfied?' },
22
23
  { name: 'type', value: 'yes_no' },
24
+ { name: 'error_message', value: 'Incompatible selection' }
23
25
  ]
24
26
  ]
25
27
  form.fields_dynamicGroup id: 'form_dynamic_group', width: 'matchParent', name: 'user[evaluation]', groupFieldProperties: properties, titlePrefix: 'Entry', content: ->(group) do
26
28
  group.template padding: { left: 32 }, childViews: ->(template) do
27
29
  template.spacer height: 10
30
+ template.fields_hidden name: 'error_message'
28
31
  template.fields_text width: 'matchParent', name: 'question', label: 'Question', placeholder: 'Question'
29
32
 
30
33
  form.panels_responsive id: 'responsive_{{entry_index}}', childViews: ->(column) do
@@ -84,6 +87,19 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
84
87
  end
85
88
  end
86
89
 
90
+ template.icon \
91
+ id: 'error_icon_{{entry_index}}',
92
+ name: 'error',
93
+ onLoad: ->(action) do
94
+ action.logics_set debug: true, targetId: 'error_icon_{{entry_index}}', conditionalData: {
95
+ displayed: {
96
+ "!!": [
97
+ { 'var': '{{entry_prefix}}[error_message]' }
98
+ ]
99
+ },
100
+ 'tooltip.text': { 'var': '{{entry_prefix}}[error_message]' }
101
+ }
102
+ end
87
103
  template.panels_vertical id: 'choices_panel_{{entry_index}}', childViews: ->(vertical) do
88
104
  (1..5).each do |i|
89
105
  vertical.fields_text \
@@ -53,27 +53,27 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
53
53
  options = languages.map { |k, v| { value: k, text: v } }
54
54
  options << { value: 'none_of_above', text: 'None of the above' }
55
55
  form.fields_select \
56
- watchNoneOfAbove: true,
57
- name: 'user[cities][]',
58
- width: 'matchParent',
59
- label: 'Cities',
60
- options: options,
61
- value: ['melbourne', 'sydney'],
62
- multiple: true,
63
- onChange: ->(action) do
64
- action.dialogs_alert message: 'Options selected'
65
- end
56
+ valueForDisableAll: 'none_of_above',
57
+ name: 'user[cities][]',
58
+ width: 'matchParent',
59
+ label: 'Cities',
60
+ options: options,
61
+ value: ['melbourne', 'sydney'],
62
+ multiple: true,
63
+ onChange: ->(action) do
64
+ action.dialogs_alert message: 'Options selected'
65
+ end
66
66
 
67
67
  form.spacer height: 6
68
68
  form.fields_select \
69
- watchNoneOfAbove: true,
70
- prependSelectAll: true,
71
- name: 'user[cities2][]',
72
- width: 'matchParent',
73
- label: 'Cities',
74
- options: options[0..-2],
75
- value: ['melbourne', 'sydney'],
76
- multiple: true
69
+ valueForDisableAll: 'none_of_above',
70
+ prependSelectAll: true,
71
+ name: 'user[cities2][]',
72
+ width: 'matchParent',
73
+ label: 'Cities',
74
+ options: options[0..-2],
75
+ value: ['melbourne', 'sydney'],
76
+ multiple: true
77
77
 
78
78
  form.spacer height: 20
79
79
  form.h2 text: 'Select fields with grouping'
@@ -126,19 +126,19 @@ page.form \
126
126
  end,
127
127
  childViews: ->(group) do
128
128
  group.panels_responsive width: 'matchParent', childViews: ->(res) do
129
-
130
- res.panels_column width: 'matchParent', lg: { cols: 4 }, childViews: ->(column) do
129
+ res.panels_column width: 'matchParent', height: 'matchParent', lg: { cols: 4, padding: { x: 10 } }, childViews: ->(column) do
131
130
  column.fields_radio\
132
131
  width: 'matchParent',
132
+ height: 'matchParent',
133
133
  value: 'yes', label: 'Yes', icon: { template: 'featured', name: 'edit', size: 40, color: '#d1d1d1' },
134
134
  onClick: ->(action) do
135
135
  action.windows_openWeb url: 'http://www.google.com'
136
136
  end
137
137
  end
138
- res.panels_column width: 'matchParent', lg: { cols: 4 }, childViews: ->(column) do
138
+ res.panels_column width: 'matchParent', lg: { cols: 4, padding: { x: 10 } }, childViews: ->(column) do
139
139
  column.fields_radio\
140
140
  width: 'matchParent',
141
- value: 'no', label: 'No',
141
+ value: 'no', label: 'No (very very very very very very very very very very very long description)',
142
142
  image: { template: 'featured', url: 'https://cdn.pixabay.com/photo/2020/08/05/13/12/eco-5465432_1280.png', width: 80, height: 80 },
143
143
  onClick: ->(action) do
144
144
  action.windows_openWeb url: 'http://www.google.com'
@@ -29,7 +29,7 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
29
29
  header.label text: 'Unordered List'
30
30
  end
31
31
 
32
- items = [1, 2, 3]
32
+ items = [1]
33
33
  section.rows objects: items, builder: ->(row, item, index) do
34
34
  row.default colStyles: [{ width: 200, backgroundColor: '#eeeeee' }], cellViews: ->(cell) do
35
35
  cell.panels_horizontal childViews: ->(horizontal) do
@@ -4,7 +4,7 @@ page = json_ui_page json
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page
5
5
 
6
6
  page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
7
- scroll.h2 text: 'Button'
7
+ scroll.h2 text: 'Button', id: 'button'
8
8
  scroll.spacer height: 20
9
9
 
10
10
  scroll.button text: 'Button', onClick: ->(action) do
@@ -34,10 +34,13 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
34
34
 
35
35
  action.popovers_show \
36
36
  key: 'menu',
37
- overlay: true,
37
+ targetId: '_self',
38
+ overlay: { closeOnFocus: false },
38
39
  placement: 'left',
40
+ styleClass: 'popover-container',
41
+ offset: 24,
39
42
  content: ->(dialog) do
40
- dialog.body padding: glib_json_padding_body, childViews: ->(view) do
43
+ dialog.body childViews: ->(view) do
41
44
  view.panels_responsive styleClass: 'popover-menu', width: 200, childViews: ->(res) do
42
45
  res.label text: 'Item 1', styleClass: 'popover-menu-item', onClick: ->(saction) do
43
46
  saction.windows_open url: json_ui_garage_url(path: 'pages/index')
@@ -45,7 +48,7 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
45
48
  res.label text: 'Item 2', styleClass: 'popover-menu-item', onClick: ->(saction) do
46
49
  saction.windows_open url: json_ui_garage_url(path: 'home/blank')
47
50
  end
48
- res.label text: 'Item 3', styleClass: 'popover-menu-item', onClick: ->(saction) do
51
+ res.label text: 'close', styleClass: 'popover-menu-item', onClick: ->(saction) do
49
52
  saction.popovers_close key: 'menu'
50
53
  end
51
54
  end
@@ -59,20 +62,19 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
59
62
  tooltip: { text: 'Tooltip 1' },
60
63
  onClick: ->(action) do
61
64
  action.popovers_show \
62
- key: 'menu',
65
+ key: 'menu2',
63
66
  placement: 'bottom-start',
64
- overlay: true,
65
67
  width: 200,
66
68
  content: ->(dialog) do
67
69
  dialog.body styleClass: 'popover-menu', padding: glib_json_padding_body, childViews: ->(res) do
68
70
  res.label text: 'Item 1', styleClass: 'popover-menu-item', onClick: ->(saction) do
69
- saction.popovers_close key: 'menu'
71
+ saction.popovers_close key: 'menu2'
70
72
  end
71
73
  res.label text: 'Item 2', styleClass: 'popover-menu-item', onClick: ->(saction) do
72
- saction.popovers_close key: 'menu'
74
+ saction.popovers_close key: 'menu2'
73
75
  end
74
76
  res.label text: 'Item 3 with very very very very very long name', styleClass: 'popover-menu-item', onClick: ->(saction) do
75
- saction.popovers_close key: 'menu'
77
+ saction.popovers_close key: 'menu2'
76
78
  end
77
79
  end
78
80
  end
@@ -127,5 +129,21 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
127
129
  onDisabled: ->(action) do
128
130
  action.dialogs_alert message: 'Disabled'
129
131
  end
132
+ scroll.spacer height: 20
133
+
134
+ scroll.h2 text: 'Highlight'
135
+ scroll.button text: 'Highlight', onClick: ->(action) do
136
+ action.popovers_show \
137
+ targetId: 'button',
138
+ key: 'menu',
139
+ placement: 'right',
140
+ offset: 24,
141
+ overlay: { closeOnFocus: true },
142
+ content: ->(dialog) do
143
+ dialog.body padding: glib_json_padding_body, styleClass: 'popover-menu', childViews: ->(res) do
144
+ res.label text: 'Hello world'
145
+ end
146
+ end
147
+ end
130
148
 
131
149
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.14.1
4
+ version: 4.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''