glib-web 4.11.2 → 4.11.4

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: ba91ec7f485c4e3fd58169638ef4df0f0c3551a05f5c15d499aa7ddf92e39e68
4
- data.tar.gz: d7e57423cda38428f94924c030ec51eee77ce6eae84e2e9229401c56f5cd115b
3
+ metadata.gz: c6425e97b504cd239d61b88d1ca636fbb5da75d6ccc9bd72ed75905fb3d3d83f
4
+ data.tar.gz: a93a58d86b0a593a6b7ba5dd8fd9c0156754273317fd1844e182d1f2984ae61a
5
5
  SHA512:
6
- metadata.gz: c7ad39525f828fb8e7c34bffa7f07111ff17cfa123dad66ab30509960a5ea375e3acef4e9b009448d23e1bb25ef4101dff7da2c7fdb04a36e3c8fc67d45f1102
7
- data.tar.gz: 3da0690b3bd9c1e74d02c694ff80e86dba3e0379444976b1f9911012444a593667b1f42b73b8076495699f175063db2feb7b08a664dcc86bb79bf9b807bcb5f2
6
+ metadata.gz: 930d634554a8c80295757893b9eb5996d05469906673860ff3dac26705772bd453c52242c2e89ee37fb4e1565900a18c079ef4e86717828a681d6de42b7177d4
7
+ data.tar.gz: 174d1ec5746418db41d5f419d66147285d772e3f239706593966cbfb802bdb4b5dd855b21758d10ec30b64a898cb4f700cf0904ce880547812167baf29a7cb19
@@ -72,7 +72,7 @@ module Glib::Json::Traversal
72
72
  if (view_spec = current_component_registry[target_id])
73
73
  action.execute(view_spec) if action
74
74
  else
75
- raise "View not found for ID: #{target_id}"
75
+ # raise "View not found for ID: #{target_id}"
76
76
  end
77
77
  end
78
78
 
@@ -69,6 +69,7 @@ module Glib
69
69
  hash :dragData
70
70
 
71
71
  hash :tooltip, required: [:text], optional: [:placement, :position]
72
+ action :onLoad
72
73
 
73
74
  def self.component_name
74
75
  @component_name ||= self.name.sub('Glib::JsonUi::ViewBuilder::', '')
@@ -28,67 +28,74 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
28
28
  template.fields_text width: 'matchParent', name: 'question', label: 'Question', placeholder: 'Question'
29
29
 
30
30
  form.panels_responsive id: 'responsive_{{entry_index}}', childViews: ->(column) do
31
- options = [:rating, :yes_no, :choices]
32
- template.fields_select \
33
- width: 'matchParent',
34
- name: 'type',
35
- label: 'Answer Type',
36
- placeholder: 'Answer Type',
37
- options: options.map { |o| { text: o.to_s.humanize, value: o } },
38
- onChangeAndLoad: ->(action) do
39
- action.runMultiple childActions: ->(multiple) do
40
- multiple.logics_set \
41
- cacheData: true, # This is so that the the new data is retained when the `dynamicGroup` gets re-rendered.
42
- debug: true,
43
- targetId: 'responsive_{{entry_index}}', dataBuilder: ->(set) do
44
- set.panels_responsive width: 'matchParent', accessory: ->(accessory) do
45
- accessory.footer childViews: ->(footer) do
46
- footer.fields_check \
47
- width: 'matchParent',
48
- id: 'check_{{entry_index}}',
49
- name: 'enabled',
50
- label: 'Enable',
51
- checkValue: true
31
+ options = [:rating, :yes_no, :choices]
32
+ template.fields_select \
33
+ width: 'matchParent',
34
+ name: 'type',
35
+ label: 'Answer Type',
36
+ placeholder: 'Answer Type',
37
+ options: options.map { |o| { text: o.to_s.humanize, value: o } },
38
+ onChangeAndLoad: ->(action) do
39
+ action.runMultiple childActions: ->(multiple) do
40
+ multiple.logics_set \
41
+ cacheData: true, # This is so that the the new data is retained when the `dynamicGroup` gets re-rendered.
42
+ debug: true,
43
+ targetId: 'responsive_{{entry_index}}', dataBuilder: ->(set) do
44
+ set.panels_responsive width: 'matchParent', accessory: ->(accessory) do
45
+ accessory.footer childViews: ->(footer) do
46
+ footer.fields_check \
47
+ width: 'matchParent',
48
+ id: 'check_{{entry_index}}',
49
+ name: 'enabled',
50
+ label: 'Enable',
51
+ checkValue: true
52
52
 
53
- footer.panels_split width: 'matchParent', content: ->(split) do
54
- split.right childViews: ->(right) do
55
- right.label text: 'This should be right-aligned'
53
+ footer.panels_split width: 'matchParent', content: ->(split) do
54
+ split.right childViews: ->(right) do
55
+ right.label text: 'This should be right-aligned'
56
+ end
56
57
  end
57
58
  end
58
59
  end
59
- end
60
- end, onSet: ->(subaction) do
61
- subaction.logics_set \
62
- targetId: 'check_{{entry_index}}',
63
- conditionalData: {
64
- value: {
65
- "==": [{ "var": 'user[evaluation][{{entry_index}}][type]' }, 'rating']
60
+ end, onSet: ->(subaction) do
61
+ subaction.logics_set \
62
+ targetId: 'check_{{entry_index}}',
63
+ conditionalData: {
64
+ value: {
65
+ "==": [{ "var": 'user[evaluation][{{entry_index}}][type]' }, 'rating']
66
+ }
66
67
  }
67
- }
68
- end
68
+ end
69
69
 
70
- multiple.logics_set \
71
- targetId: 'choices_panel',
72
- debug: true,
73
- conditionalData: {
74
- displayed: {
75
- "==": [{ "var": 'user[evaluation][{{entry_index}}][type]' }, 'choices']
70
+ multiple.logics_set \
71
+ targetId: 'choices_panel_{{entry_index}}',
72
+ debug: true,
73
+ conditionalData: {
74
+ displayed: {
75
+ "==": [{ "var": 'user[evaluation][{{entry_index}}][type]' }, 'choices']
76
+ }
76
77
  }
77
- }
78
+ end
78
79
  end
79
- end
80
80
  end, accessory: ->(accessory) do
81
81
  accessory.footer childViews: ->(footer) do
82
82
 
83
83
  end
84
84
  end
85
85
 
86
- template.panels_vertical id: 'choices_panel', childViews: ->(vertical) do
86
+ template.panels_vertical id: 'choices_panel_{{entry_index}}', childViews: ->(vertical) do
87
87
  (1..5).each do |i|
88
88
  vertical.fields_text \
89
+ id: "input_choice_{{entry_index}}_#{i}",
89
90
  width: 'matchParent',
90
- name: "choices[#{i}]",
91
- label: "Choice #{i}"
91
+ name: "choices_#{i}",
92
+ label: "Choice #{i}",
93
+ displayed: i <= 1,
94
+ onChange: ->(action) do
95
+ action.logics_set targetId: "input_choice_{{entry_index}}_#{i + 1}", conditionalData: {
96
+ displayed: { "isPresent": [{ "var": "user[evaluation][{{entry_index}}][choices_#{i}]" }] }
97
+ }
98
+ end
92
99
  end
93
100
  end
94
101
 
@@ -3,14 +3,28 @@ json.title 'Views'
3
3
  page = json_ui_page json
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page
5
5
 
6
- page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
6
+ page.form padding: glib_json_padding_body, childViews: ->(scroll) do
7
7
  scroll.h2 text: 'Icon'
8
8
  # scroll.icon spec: { name: 'home' }
9
9
  scroll.icon name: 'home'
10
10
 
11
11
  scroll.spacer height: 20
12
12
  scroll.h2 text: 'Icon with color'
13
- scroll.icon name: 'home', color: '#9370DB'
13
+ scroll.fields_select \
14
+ name: 'input_icon',
15
+ value: 'verified',
16
+ options: ['pending', 'verified', 'cancel'].map { |icon_name| { text: icon_name, value: icon_name } }
17
+ scroll.button text: 'update', onClick: ->(action) do
18
+ action.logics_set \
19
+ targetId: 'icon1',
20
+ conditionalData: {
21
+ 'material.name': { "var": 'input_icon' }
22
+ },
23
+ data: {
24
+ 'tooltip.text': 'TEST123'
25
+ }
26
+ end
27
+ scroll.icon id: 'icon1', name: 'home', color: '#9370DB'
14
28
  scroll.icon name: 'home', color: '#9370DB80'
15
29
 
16
30
  scroll.spacer height: 20
@@ -19,5 +33,19 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
19
33
 
20
34
  scroll.spacer height: 20
21
35
  scroll.h2 text: 'Icon with styleClasses'
22
- scroll.icon name: 'home', styleClasses: ['small']
36
+ scroll.icon id: 'icon2', name: 'home', styleClasses: ['small']
37
+
38
+ scroll.button text: 'Hide icon', onClick: ->(action) do
39
+ action.logics_set targetId: 'icon2', data: {
40
+ displayed: false
41
+ }
42
+ end
43
+
44
+ scroll.spacer height: 20
45
+ scroll.h2 text: 'Icon with onLoad'
46
+ scroll.icon id: 'icon3', name: 'home', onLoad: ->(action) do
47
+ action.logics_set targetId: 'icon3', data: {
48
+ 'material.name': 'info'
49
+ }
50
+ end
23
51
  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.11.2
4
+ version: 4.11.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''