glib-web 4.19.0 → 4.20.0

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: fd3946cf75cadd5f6f32d275a56a4bc85ff7307c04ff1d0f248ac1c0ede0c27c
4
- data.tar.gz: 7ad4f360ee40e2aecc4275fe05043a0b6619cada5f28e24df4cd8d6f769de7d3
3
+ metadata.gz: 68c288de9bf1bf340b92dfd31c6559da13ee0cb6030b907cbd6a86828c989313
4
+ data.tar.gz: 835b1a957ff4c0c72bff64bf9129219c1b806e2a1427bd043c36d1393c1c3c12
5
5
  SHA512:
6
- metadata.gz: 44b6456d03446e3fb7861270734da74f7fc4fe9e291043c92979ee583773868b42d0db1b98223c1076789c999be46e7eef4063cf5f9db95baacbdb8af5e812fb
7
- data.tar.gz: c3256ce2d75b5608aacd6f986bd3e8a44c396882100909547e6a7540db8dfa8c4e4521b4e68b7eefa6cfeb440660c777076748a43b951dc2a3936e40fb4e46c2
6
+ metadata.gz: ff195da76449fe7a87dfa795e5a7434da1b32692f4d7535e979558bd4b2869648ca27b522af95809a2a72950a77d735f0ec4bcdaf34bebdbd574e2ecc0497827
7
+ data.tar.gz: d5a35ec75ffe680c2f34483fab42c60ef2c2eaf02f8ce83b07080b24f9dd0a204c83565a293a971e79f18aa660b70b485b4d04d0a453efe425ca968b2c282fec
@@ -145,6 +145,7 @@ module Glib
145
145
  module Lists
146
146
  class Append < Action
147
147
  hash :row
148
+ action :onAppend
148
149
  end
149
150
  end
150
151
 
@@ -28,6 +28,9 @@ module Glib
28
28
  end
29
29
 
30
30
  class Standard < AbstractTemplate
31
+ badgeable
32
+
33
+ string :id
31
34
  string :recordId
32
35
  string :title
33
36
  string :subtitle
@@ -36,7 +39,8 @@ module Glib
36
39
  action :onClick
37
40
  action :onLongPress
38
41
  icon :icon
39
- bool :avatar
42
+ # bool :avatar
43
+ hash :avatar, optional: [:url, :initials]
40
44
  # action :onReorder
41
45
  string :paramNameForFormData
42
46
  string :paramNameForNewAbsoluteIndex
@@ -30,11 +30,11 @@ page.form \
30
30
  form.h2 text: 'Button Date'
31
31
  form.label text: 'Plus 30 days'
32
32
  form.spacer height: 6
33
- form.fields_date name: 'user[date_start1]', label: 'Add start date', value: '2024-12-12', buttonTemplate: true, onChange: ->(action) do
33
+ form.fields_date width: 150, name: 'user[date_start1]', label: 'Add start date', value: '2024-12-12', template: { type: 'text' }, onChange: ->(action) do
34
34
  action.logics_set targetId: 'date3', conditionalData: { value: { "sum_date": [{ "var": 'user[date_start1]' }, { value: 86400 * 30, format: 'date' }] } }
35
35
  end
36
36
  form.spacer height: 6
37
- form.fields_date id: 'date3', name: 'user[date_end1]', label: 'End date', buttonTemplate: true
37
+ form.fields_date id: 'date3', name: 'user[date_end1]', label: 'End date', template: { type: 'plain' }
38
38
 
39
39
 
40
40
  form.spacer height: 20
@@ -81,19 +81,21 @@ page.form \
81
81
  end
82
82
 
83
83
  form.spacer height: 8
84
- form.fields_date \
84
+ form.fields_datetime \
85
85
  name: 'user[due_date]',
86
86
  label: 'Add due date',
87
- buttonTemplate: true,
88
87
  min: '2024-11-01',
89
- max: '2024-12-31'
88
+ max: '2024-12-31',
89
+ template: { type: 'plain' },
90
+ validation: { required: { message: 'Required' } }
90
91
  form.spacer height: 8
91
92
 
92
93
  form.spacer height: 8
93
94
  form.fields_datetime \
94
95
  name: 'user[due_date1]',
95
96
  label: 'Add due datetime',
96
- buttonTemplate: true
97
+ width: 200,
98
+ template: { type: 'text' }
97
99
  form.spacer height: 8
98
100
 
99
101
  form.spacer height: 20
@@ -72,6 +72,19 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
72
72
  end
73
73
  end
74
74
 
75
+ scroll.spacer height: 32
76
+ scroll.hr color: '#F5F5F5', width: 'matchParent'
77
+ scroll.spacer height: 32
78
+ scroll.h2 text: 'mdAndDown (Hide true)'
79
+ scroll.spacer height: 16
80
+ scroll.panels_responsive width: 'matchParent', childViews: ->(res) do
81
+ 12.times do |index|
82
+ res.panels_column lg: { cols: 1 }, mdAndDown: { hide: true }, styleClasses: ['card'], childViews: ->(col) do
83
+ col.p text: "Col #{index + 1}"
84
+ end
85
+ end
86
+ end
87
+
75
88
 
76
89
  scroll.spacer height: 32
77
90
  scroll.h4 text: 'With more than 12 columns'
@@ -14,6 +14,9 @@ page.list firstSection: ->(section) do
14
14
  template.thumbnail title: 'Horizontal Scroll', onClick: ->(action) do
15
15
  action.windows_open url: json_ui_garage_url(path: 'tables/horizontal_scroll')
16
16
  end
17
+ template.thumbnail title: 'Pagination', onClick: ->(action) do
18
+ action.windows_open url: json_ui_garage_url(path: 'tables/pagination')
19
+ end
17
20
  template.thumbnail title: 'Autoload as Needed', onClick: ->(action) do
18
21
  action.windows_open url: json_ui_garage_url(path: 'tables/autoload_as_needed')
19
22
  end
@@ -0,0 +1,50 @@
1
+ # column_indexes = (1..3)
2
+
3
+ json.title 'Tables'
4
+
5
+ page = json_ui_page json
6
+ render "#{@path_prefix}/nav_menu", json: json, page: page
7
+
8
+ per_page = 20
9
+ page_index = params[:page]&.to_i || 1
10
+
11
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
12
+ scroll.panels_table firstSection: ->(section) do
13
+ section.header cellViews: ->(header) do
14
+ header.label text: "Name"
15
+ header.label text: "Status"
16
+ end
17
+
18
+ items = (1..per_page).map do |index|
19
+ (per_page * (page_index - 1)) + index
20
+ end
21
+
22
+ # raise "I1: #{items}"
23
+
24
+ section.rows objects: items, builder: ->(row, item, index) do
25
+ row.default colStyles: [{ width: 200, backgroundColor: '#eeeeee' }], cellViews: ->(cell) do
26
+ # column_indexes.each do |i|
27
+ # cell.label text: "Data #{item}"
28
+ # end
29
+
30
+ cell.label text: "Data #{item}"
31
+ if item % 6 == 0
32
+ cell.chip text: "Status #{item}", tooltip: {
33
+ text: "Explanation #{item}"
34
+ }
35
+ else
36
+ cell.label text: ''
37
+ end
38
+ end
39
+ end
40
+ end
41
+
42
+ scroll.panels_pagination \
43
+ width: 'matchParent',
44
+ styleClass: 'compact',
45
+ length: 5,
46
+ value: page_index,
47
+ onChange: ->(action) do
48
+ action.windows_open fieldName: 'page', url: json_ui_garage_current_url
49
+ end
50
+ end
@@ -1,4 +1,4 @@
1
- navs = ['form', 'dialog', 'form_dynamic', 'auto_validate', 'multiupload', 'dirty_state']
1
+ navs = ['form', 'dialog', 'form_dynamic', 'auto_validate', 'multiupload', 'dirty_state', 'window']
2
2
 
3
3
  view.panels_flow innerPadding: { bottom: 0 }, styleClass: 'align-right', width: 'matchParent', childViews: ->(res) do
4
4
  navs.each_with_index do |nav, index|
@@ -28,6 +28,11 @@ page.body childViews: ->(body) do
28
28
  form.fields_check name: 'user[check][]', checkValue: 'choice2', label: 'choice2'
29
29
  form.fields_check name: 'user[check][]', checkValue: 'choice2', label: 'choice3', value: 'choice2'
30
30
 
31
+ form.spacer height: 14
32
+ form.button text: 'navigate', onClick: ->(action) do
33
+ action.windows_open updateExisting: true, url: json_ui_garage_url(path: 'test_page/multiupload')
34
+ end
35
+
31
36
  form.spacer height: 24
32
37
  form.panels_split width: 'matchParent', content: ->(split) do
33
38
  split.left childViews: ->(left) do
@@ -22,40 +22,128 @@ page.body childViews: ->(body) do
22
22
  { name: 'question', value: 'Quality of work' },
23
23
  { name: 'type', value: 'rating' },
24
24
  { name: 'enabled', value: '1' },
25
+ { name: 'error_message', value: 'Wrong answer' }
25
26
  ],
26
27
  [
27
28
  { name: 'question', value: 'Satisfied?' },
28
29
  { name: 'type', value: 'yes_no' },
30
+ { name: 'error_message', value: 'Incompatible selection' }
29
31
  ]
30
32
  ]
31
- validation = { required: { message: 'Required' } }
32
- form.fields_dynamicGroup width: 'matchParent', name: 'user[evaluation]', groupFieldProperties: properties, titlePrefix: 'Entry', content: ->(group) do
33
+ form.fields_dynamicGroup id: 'form_dynamic_group', width: 'matchParent', name: 'user[evaluation]', groupFieldProperties: properties, titlePrefix: 'Entry', content: ->(group) do
33
34
  group.template padding: { left: 32 }, childViews: ->(template) do
34
35
  template.spacer height: 10
35
- template.fields_text width: 'matchParent', name: 'question', label: 'Question', placeholder: 'Question', validation: validation
36
-
37
- options = [ :rating, :yes_no ]
38
- template.fields_select \
39
- width: 'matchParent',
40
- name: 'type',
41
- label: 'Answer Type',
42
- placeholder: 'Answer Type',
43
- options: options.map { |o| { text: o.to_s.humanize, value: o } },
44
- validation: validation
45
-
46
- template.fields_check \
47
- width: 'matchParent',
48
- name: 'enabled',
49
- label: 'Enable',
50
- checkValue: '1',
51
- showIf: { "==": [{ "var": 'user[evaluation][{{index}}][type]' }, 'rating'] }
36
+ template.fields_hidden name: 'error_message'
37
+ template.fields_text width: 'matchParent', name: 'question', label: 'Question', placeholder: 'Question', styleClass: 'question'
38
+
39
+ form.panels_responsive id: 'responsive_{{entry_index}}', childViews: ->(column) do
40
+ options = [:rating, :yes_no, :choices]
41
+ template.fields_select \
42
+ width: 'matchParent',
43
+ name: 'type',
44
+ label: 'Answer Type',
45
+ placeholder: 'Answer Type',
46
+ value: 'rating',
47
+ styleClass: 'answer_type',
48
+ options: options.map { |o| { text: o.to_s.humanize, value: o } },
49
+ onChangeAndLoad: ->(action) do
50
+ action.runMultiple childActions: ->(multiple) do
51
+ multiple.logics_set \
52
+ cacheData: true, # This is so that the the new data is retained when the `dynamicGroup` gets re-rendered.
53
+ debug: true,
54
+ targetId: 'responsive_{{entry_index}}', dataBuilder: ->(set) do
55
+ set.panels_responsive width: 'matchParent', accessory: ->(accessory) do
56
+ accessory.footer childViews: ->(footer) do
57
+ footer.fields_check \
58
+ width: 'matchParent',
59
+ id: 'check_{{entry_index}}',
60
+ name: 'enabled',
61
+ label: 'Enable',
62
+ styleClass: 'enable',
63
+ checkValue: true
64
+
65
+ footer.panels_split width: 'matchParent', content: ->(split) do
66
+ split.right childViews: ->(right) do
67
+ right.label text: 'This should be right-aligned'
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end, onSet: ->(subaction) do
73
+ subaction.logics_set \
74
+ targetId: 'check_{{entry_index}}',
75
+ conditionalData: {
76
+ value: {
77
+ "==": [{ "var": 'user[evaluation][{{entry_index}}][type]' }, 'rating']
78
+ }
79
+ }
80
+ end
81
+
82
+ multiple.logics_set \
83
+ targetId: 'choices_panel_{{entry_index}}',
84
+ debug: true,
85
+ conditionalData: {
86
+ displayed: {
87
+ "==": [{ "var": 'user[evaluation][{{entry_index}}][type]' }, 'choices']
88
+ }
89
+ }
90
+ end
91
+ end
92
+ end, accessory: ->(accessory) do
93
+ accessory.footer childViews: ->(footer) do
94
+
95
+ end
96
+ end
97
+
98
+ template.icon \
99
+ id: 'error_icon_{{entry_index}}',
100
+ name: 'error',
101
+ onLoad: ->(action) do
102
+ action.logics_set debug: true, targetId: 'error_icon_{{entry_index}}', conditionalData: {
103
+ displayed: {
104
+ "!!": [
105
+ { 'var': '{{entry_prefix}}[error_message]' }
106
+ ]
107
+ },
108
+ 'tooltip.text': { 'var': '{{entry_prefix}}[error_message]' }
109
+ }
110
+ end
111
+ template.panels_vertical id: 'choices_panel_{{entry_index}}', childViews: ->(vertical) do
112
+ (1..5).each do |i|
113
+ vertical.fields_text \
114
+ id: "input_choice_{{entry_index}}_#{i}",
115
+ width: 'matchParent',
116
+ name: "choices_#{i}",
117
+ label: "Choice #{i}",
118
+ displayed: i <= 1,
119
+ onChange: ->(action) do
120
+ action.logics_set targetId: "input_choice_{{entry_index}}_#{i + 1}", conditionalData: {
121
+ displayed: { "isPresent": [{ "var": "user[evaluation][{{entry_index}}][choices_#{i}]" }] }
122
+ }
123
+ end
124
+ end
125
+ end
52
126
 
53
127
  template.spacer height: 14
54
128
  end
55
129
  end
56
- form.fields_submit text: 'submit'
57
- form.spacer height: 2
58
- form.fields_submit text: 'submit (if form valid)', disableIfFormInvalid: true
130
+
131
+ form.panels_horizontal \
132
+ align: 'middle',
133
+ childViews: ->(horizontal) do
134
+ horizontal.icon \
135
+ name: 'add_circle',
136
+ styleClasses: ['success']
137
+
138
+ horizontal.spacer width: 10
139
+ horizontal.h4 text: 'Add item'
140
+ end,
141
+ onClick: ->(action) do
142
+ action.components_invoke targetId: 'form_dynamic_group', name: 'addGroupEntry'
143
+ end
144
+
145
+ form.spacer height: 20
146
+ form.fields_submit text: 'Submit'
59
147
  end
60
148
 
61
149
  res.spacer height: 16
@@ -0,0 +1,17 @@
1
+
2
+
3
+ json.title 'Test Page (Form)'
4
+
5
+ page = json_ui_page json
6
+
7
+ page.body childViews: ->(body) do
8
+ render 'json_ui/garage/test_page/header', view: body
9
+
10
+ body.panels_responsive padding: glib_json_padding_body, childViews: ->(res) do
11
+ res.h2 text: 'Window'
12
+ res.spacer height: 8
13
+ res.button text: 'windows/open updateExisting: true', onClick: ->(action) do
14
+ action.windows_open updateExisting: true, url: json_ui_garage_url(path: 'test_page/multiupload')
15
+ end
16
+ end
17
+ 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.19.0
4
+ version: 4.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -315,6 +315,7 @@ files:
315
315
  - app/views/json_ui/garage/tables/index.json.jbuilder
316
316
  - app/views/json_ui/garage/tables/layout.json.jbuilder
317
317
  - app/views/json_ui/garage/tables/nested_table.json.jbuilder
318
+ - app/views/json_ui/garage/tables/pagination.json.jbuilder
318
319
  - app/views/json_ui/garage/tables/panel_content.json.jbuilder
319
320
  - app/views/json_ui/garage/test_page/_header.json.jbuilder
320
321
  - app/views/json_ui/garage/test_page/auto_validate.json.jbuilder
@@ -324,6 +325,7 @@ files:
324
325
  - app/views/json_ui/garage/test_page/form.json.jbuilder
325
326
  - app/views/json_ui/garage/test_page/form_dynamic.json.jbuilder
326
327
  - app/views/json_ui/garage/test_page/multiupload.json.jbuilder
328
+ - app/views/json_ui/garage/test_page/window.json.jbuilder
327
329
  - app/views/json_ui/garage/views/_chart_data.json.jbuilder
328
330
  - app/views/json_ui/garage/views/banners.json.jbuilder
329
331
  - app/views/json_ui/garage/views/calendar_data.json.jbuilder