glib-web 4.44.4 → 5.0.0

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.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/glib/json_ui/abstract_builder.rb +1 -1
  3. data/app/helpers/glib/json_ui/action_builder/browsers.rb +1 -3
  4. data/app/helpers/glib/json_ui/view_builder/fields.rb +0 -53
  5. data/app/views/json_ui/garage/forms/file_upload.json.jbuilder +0 -65
  6. data/app/views/json_ui/garage/test_page/_header.json.jbuilder +9 -2
  7. data/app/views/json_ui/garage/test_page/auth.json.jbuilder +37 -0
  8. data/app/views/json_ui/garage/test_page/browsers.json.jbuilder +1 -0
  9. data/app/views/json_ui/garage/test_page/dialog.json.jbuilder +123 -26
  10. data/app/views/json_ui/garage/test_page/dirty_state.json.jbuilder +0 -5
  11. data/app/views/json_ui/garage/test_page/fields_creditCard.json.jbuilder +118 -0
  12. data/app/views/json_ui/garage/test_page/fields_date_time.json.jbuilder +213 -0
  13. data/app/views/json_ui/garage/test_page/fields_location.json.jbuilder +151 -0
  14. data/app/views/json_ui/garage/test_page/fields_otp.json.jbuilder +168 -0
  15. data/app/views/json_ui/garage/test_page/fields_phone.json.jbuilder +176 -0
  16. data/app/views/json_ui/garage/test_page/fields_rating.json.jbuilder +191 -0
  17. data/app/views/json_ui/garage/test_page/fields_richText.json.jbuilder +213 -0
  18. data/app/views/json_ui/garage/test_page/fields_stripeExternalAccount.json.jbuilder +146 -0
  19. data/app/views/json_ui/garage/test_page/fields_stripeToken.json.jbuilder +118 -0
  20. data/app/views/json_ui/garage/test_page/fields_upload.json.jbuilder +15 -1
  21. data/app/views/json_ui/garage/test_page/window.json.jbuilder +23 -14
  22. data/app/views/json_ui/garage/test_page/windows.json.jbuilder +74 -16
  23. data/lib/glib/rubocop/cops/multiline_method_call_style.rb +0 -8
  24. data/lib/tasks/db.rake +0 -1
  25. metadata +15 -8
  26. data/app/views/json_ui/garage/test_page/multiupload.json.jbuilder +0 -65
  27. data/lib/glib/doc_generator.rb +0 -386
@@ -0,0 +1,213 @@
1
+ json.title 'Test Page (Fields Date/Datetime)'
2
+
3
+ page = json_ui_page json
4
+
5
+ page.body(
6
+ childViews: ->(body) do
7
+ render 'json_ui/garage/test_page/header', view: body
8
+
9
+ body.panels_responsive(
10
+ padding: glib_json_padding_body,
11
+ childViews: ->(res) do
12
+ res.h2 text: 'Fields Date & Datetime'
13
+ res.spacer height: 8
14
+ res.label text: 'Calendar inputs for date-only and date-time values, including constraints and formatting.'
15
+ res.spacer height: 12
16
+
17
+ res.panels_form(
18
+ url: json_ui_garage_url(path: 'forms/generic_post'),
19
+ method: 'post',
20
+ childViews: ->(form) do
21
+ form.h2 text: 'Overview'
22
+ form.spacer height: 8
23
+ form.label text: 'Use fields_date for date-only inputs and fields_datetime when time selection is required.'
24
+ form.spacer height: 12
25
+ form.hr width: 'matchParent'
26
+ form.spacer height: 12
27
+
28
+ form.h2 text: 'Basic example'
29
+ form.spacer height: 8
30
+ form.fields_date(
31
+ id: 'date_basic',
32
+ name: 'user[date_basic]',
33
+ width: 'matchParent',
34
+ label: 'Date',
35
+ value: '2024-12-12',
36
+ onChange: ->(action) do
37
+ action.logics_set targetId: 'date_status', data: { text: 'Date changed' }
38
+ end
39
+ )
40
+ form.spacer height: 8
41
+ form.fields_datetime(
42
+ id: 'datetime_basic',
43
+ name: 'user[datetime_basic]',
44
+ width: 'matchParent',
45
+ label: 'Date Time',
46
+ value: '2024-12-12T09:30',
47
+ onChange: ->(action) do
48
+ action.logics_set targetId: 'datetime_status', data: { text: 'Datetime changed' }
49
+ end
50
+ )
51
+
52
+ form.spacer height: 12
53
+ form.hr width: 'matchParent'
54
+ form.spacer height: 12
55
+
56
+ form.h2 text: 'Variants/props'
57
+ form.spacer height: 8
58
+ form.fields_date(
59
+ id: 'date_range',
60
+ name: 'user[date_range]',
61
+ width: 'matchParent',
62
+ label: 'Date with range',
63
+ min: '2024-12-01',
64
+ max: '2024-12-31',
65
+ value: '2024-12-15'
66
+ )
67
+ form.spacer height: 8
68
+ form.fields_datetime(
69
+ id: 'datetime_format',
70
+ name: 'user[datetime_format]',
71
+ width: 'matchParent',
72
+ label: 'Formatted datetime',
73
+ format: 'keyboardDateTime12h',
74
+ placeholder: 'Select date/time'
75
+ )
76
+ form.spacer height: 8
77
+ form.fields_datetime(
78
+ id: 'datetime_timezone',
79
+ name: 'user[datetime_timezone]',
80
+ width: 'matchParent',
81
+ label: 'Datetime (Asia/Taipei)',
82
+ value: '2025-01-26T13:49:00.000+05:00',
83
+ time_zone: 'Asia/Taipei'
84
+ )
85
+
86
+ form.spacer height: 12
87
+ form.hr width: 'matchParent'
88
+ form.spacer height: 12
89
+
90
+ form.h2 text: 'Actions/events'
91
+ form.spacer height: 8
92
+ form.label id: 'date_status', text: 'Date status: idle'
93
+ form.spacer height: 4
94
+ form.label id: 'datetime_status', text: 'Datetime status: idle'
95
+ form.spacer height: 8
96
+ form.panels_flow(
97
+ innerPadding: { bottom: 0 },
98
+ width: 'matchParent',
99
+ childViews: ->(flow) do
100
+ flow.button(
101
+ text: 'Set today + 1 week',
102
+ onClick: ->(action) do
103
+ action.runMultiple(
104
+ childActions: ->(multiple) do
105
+ multiple.components_set targetId: 'date_basic', data: { value: (Date.current + 7.days).strftime('%Y-%m-%d') }
106
+ multiple.logics_set targetId: 'date_status', data: { text: 'Date set to +1 week' }
107
+ end
108
+ )
109
+ end
110
+ )
111
+ flow.spacer width: 8
112
+ flow.button(
113
+ text: 'Clear date',
114
+ onClick: ->(action) do
115
+ action.runMultiple(
116
+ childActions: ->(multiple) do
117
+ multiple.components_set targetId: 'date_basic', data: { value: '' }
118
+ multiple.logics_set targetId: 'date_status', data: { text: 'Date cleared' }
119
+ end
120
+ )
121
+ end
122
+ )
123
+ flow.spacer width: 8
124
+ flow.button(
125
+ text: 'Set datetime (evening)',
126
+ onClick: ->(action) do
127
+ action.runMultiple(
128
+ childActions: ->(multiple) do
129
+ multiple.components_set targetId: 'datetime_basic', data: { value: '2024-12-12T18:45' }
130
+ multiple.logics_set targetId: 'datetime_status', data: { text: 'Datetime set to evening' }
131
+ end
132
+ )
133
+ end
134
+ )
135
+ flow.spacer width: 8
136
+ flow.button(
137
+ text: 'Clear datetime',
138
+ onClick: ->(action) do
139
+ action.runMultiple(
140
+ childActions: ->(multiple) do
141
+ multiple.components_set targetId: 'datetime_basic', data: { value: '' }
142
+ multiple.logics_set targetId: 'datetime_status', data: { text: 'Datetime cleared' }
143
+ end
144
+ )
145
+ end
146
+ )
147
+ end
148
+ )
149
+
150
+ form.spacer height: 12
151
+ form.hr width: 'matchParent'
152
+ form.spacer height: 12
153
+
154
+ form.h2 text: 'Edge/advanced'
155
+ form.spacer height: 8
156
+ form.fields_date(
157
+ id: 'date_month',
158
+ name: 'user[date_month]',
159
+ width: 'matchParent',
160
+ label: 'Month picker',
161
+ type: 'month',
162
+ min: '2024-10-01',
163
+ max: '2025-01-01',
164
+ value: '2024-11'
165
+ )
166
+ form.spacer height: 8
167
+ form.fields_datetime(
168
+ id: 'datetime_plain',
169
+ name: 'user[datetime_plain]',
170
+ width: 'matchParent',
171
+ label: 'Plain template',
172
+ template: { type: 'plain' }
173
+ )
174
+ form.spacer height: 8
175
+ form.panels_flow(
176
+ innerPadding: { bottom: 0 },
177
+ width: 'matchParent',
178
+ childViews: ->(flow) do
179
+ flow.button(
180
+ text: 'Disable date',
181
+ onClick: ->(action) do
182
+ action.components_set targetId: 'date_basic', data: { disabled: true }
183
+ end
184
+ )
185
+ flow.spacer width: 8
186
+ flow.button(
187
+ text: 'Enable date',
188
+ onClick: ->(action) do
189
+ action.components_set targetId: 'date_basic', data: { disabled: nil }
190
+ end
191
+ )
192
+ flow.spacer width: 8
193
+ flow.button(
194
+ text: 'Use text template',
195
+ onClick: ->(action) do
196
+ action.components_set targetId: 'datetime_plain', data: { template: { type: 'text' } }
197
+ end
198
+ )
199
+ flow.spacer width: 8
200
+ flow.button(
201
+ text: 'Restore plain template',
202
+ onClick: ->(action) do
203
+ action.components_set targetId: 'datetime_plain', data: { template: { type: 'plain' } }
204
+ end
205
+ )
206
+ end
207
+ )
208
+ end
209
+ )
210
+ end
211
+ )
212
+ end
213
+ )
@@ -0,0 +1,151 @@
1
+ json.title 'Test Page (Fields Location)'
2
+
3
+ page = json_ui_page json
4
+
5
+ page.body(
6
+ childViews: ->(body) do
7
+ render 'json_ui/garage/test_page/header', view: body
8
+
9
+ body.panels_responsive(
10
+ padding: glib_json_padding_body,
11
+ childViews: ->(res) do
12
+ res.h2 text: 'Fields Location'
13
+ res.spacer height: 8
14
+ res.label text: 'Google Places autocomplete with optional latitude/longitude helpers.'
15
+ res.spacer height: 12
16
+
17
+ res.panels_form(
18
+ url: json_ui_garage_url(path: 'forms/generic_post'),
19
+ method: 'post',
20
+ childViews: ->(form) do
21
+ form.h2 text: 'Overview'
22
+ form.spacer height: 8
23
+ form.label text: 'Use fields_location to capture structured places and coordinates.'
24
+ form.spacer height: 12
25
+ form.hr width: 'matchParent'
26
+ form.spacer height: 12
27
+
28
+ form.h2 text: 'Basic example'
29
+ form.spacer height: 8
30
+ form.fields_location(
31
+ id: 'location_basic',
32
+ name: 'user[address]',
33
+ width: 'matchParent',
34
+ label: 'Type an address',
35
+ value: 'Sydney Harbour Bridge',
36
+ autocompleteOptions: {
37
+ componentRestrictions: { country: 'au' },
38
+ types: ['(cities)']
39
+ },
40
+ latitudeField: { view: 'fields/text', name: 'user[latitude]', label: 'Lat', value: -33.8523063, readOnly: true },
41
+ longitudeField: { view: 'fields/text', name: 'user[longitude]', label: 'Long', value: 151.21078710000006, readOnly: true },
42
+ zoomField: { view: 'fields/text', name: 'user[zoom]', label: 'Zoom' },
43
+ onChange: ->(action) do
44
+ action.logics_set targetId: 'location_status', data: { text: 'Status: location updated' }
45
+ end
46
+ )
47
+ # form.spacer height: 8
48
+ # form.label id: 'location_status', text: 'Status: idle'
49
+
50
+ # form.spacer height: 12
51
+ # form.hr width: 'matchParent'
52
+ # form.spacer height: 12
53
+
54
+ # form.h2 text: 'Variants/props'
55
+ # form.spacer height: 8
56
+ # form.label text: 'Switch autocomplete restrictions and values.'
57
+ # form.spacer height: 8
58
+ # form.panels_flow(
59
+ # innerPadding: { bottom: 0 },
60
+ # width: 'matchParent',
61
+ # childViews: ->(flow) do
62
+ # flow.button(
63
+ # text: 'US cities',
64
+ # onClick: ->(action) do
65
+ # action.components_set(
66
+ # targetId: 'location_basic',
67
+ # data: {
68
+ # value: 'San Francisco',
69
+ # autocompleteOptions: {
70
+ # componentRestrictions: { country: 'us' },
71
+ # types: ['(cities)']
72
+ # }
73
+ # }
74
+ # )
75
+ # end
76
+ # )
77
+ # flow.spacer width: 8
78
+ # flow.button(
79
+ # text: 'Geocode (worldwide)',
80
+ # onClick: ->(action) do
81
+ # action.components_set(
82
+ # targetId: 'location_basic',
83
+ # data: {
84
+ # value: '10 Downing Street',
85
+ # autocompleteOptions: {
86
+ # types: ['geocode']
87
+ # }
88
+ # }
89
+ # )
90
+ # end
91
+ # )
92
+ # flow.spacer width: 8
93
+ # flow.button(
94
+ # text: 'Reset AU default',
95
+ # onClick: ->(action) do
96
+ # action.components_set(
97
+ # targetId: 'location_basic',
98
+ # data: {
99
+ # value: 'Sydney Harbour Bridge',
100
+ # autocompleteOptions: {
101
+ # componentRestrictions: { country: 'au' },
102
+ # types: ['(cities)']
103
+ # }
104
+ # }
105
+ # )
106
+ # end
107
+ # )
108
+ # end
109
+ # )
110
+
111
+ # form.spacer height: 12
112
+ # form.hr width: 'matchParent'
113
+ # form.spacer height: 12
114
+
115
+ # form.h2 text: 'Edge/advanced'
116
+ # form.spacer height: 8
117
+ # form.panels_flow(
118
+ # innerPadding: { bottom: 0 },
119
+ # width: 'matchParent',
120
+ # childViews: ->(flow) do
121
+ # flow.button(
122
+ # text: 'Clear value',
123
+ # onClick: ->(action) do
124
+ # action.components_set targetId: 'location_basic', data: { value: '' }
125
+ # end
126
+ # )
127
+ # flow.spacer width: 8
128
+ # flow.button(
129
+ # text: 'Disable field',
130
+ # onClick: ->(action) do
131
+ # action.components_set targetId: 'location_basic', data: { disabled: true }
132
+ # end
133
+ # )
134
+ # flow.spacer width: 8
135
+ # flow.button(
136
+ # text: 'Enable field',
137
+ # onClick: ->(action) do
138
+ # action.components_set targetId: 'location_basic', data: { disabled: nil }
139
+ # end
140
+ # )
141
+ # end
142
+ # )
143
+
144
+ form.spacer height: 12
145
+ form.fields_submit text: 'Submit'
146
+ end
147
+ )
148
+ end
149
+ )
150
+ end
151
+ )
@@ -0,0 +1,168 @@
1
+ json.title 'Test Page (Fields OTP)'
2
+
3
+ page = json_ui_page json
4
+
5
+ page.body(
6
+ childViews: ->(body) do
7
+ render 'json_ui/garage/test_page/header', view: body
8
+
9
+ body.panels_responsive(
10
+ padding: glib_json_padding_body,
11
+ childViews: ->(res) do
12
+ res.h2 text: 'Fields OTP'
13
+ res.spacer height: 8
14
+ res.label text: 'One-time password input with segmented digits for verification flows.'
15
+ res.spacer height: 12
16
+
17
+ res.panels_form(
18
+ url: json_ui_garage_url(path: 'forms/generic_post'),
19
+ method: 'post',
20
+ childViews: ->(form) do
21
+ form.h2 text: 'Overview'
22
+ form.spacer height: 8
23
+ form.label text: 'Use fields_otp for multi-digit verification codes (SMS, email, or authenticator apps).'
24
+ form.spacer height: 12
25
+ form.hr width: 'matchParent'
26
+ form.spacer height: 12
27
+
28
+ form.h2 text: 'Basic example'
29
+ form.spacer height: 8
30
+ form.fields_otp(
31
+ id: 'otp_basic',
32
+ name: 'user[otp_basic]',
33
+ width: 'matchParent',
34
+ label: 'Verification code',
35
+ length: 6,
36
+ type: 'number',
37
+ value: '123456',
38
+ onChange: ->(action) do
39
+ action.logics_set targetId: 'otp_status', data: { text: 'Status: code changed' }
40
+ end
41
+ )
42
+
43
+ form.spacer height: 12
44
+ form.hr width: 'matchParent'
45
+ form.spacer height: 12
46
+
47
+ form.h2 text: 'Variants/props'
48
+ form.spacer height: 8
49
+ form.label id: 'otp_variant_status', text: 'Variant: 6 digits (number)'
50
+ form.spacer height: 8
51
+ form.panels_flow(
52
+ innerPadding: { bottom: 0 },
53
+ width: 'matchParent',
54
+ childViews: ->(flow) do
55
+ flow.button(
56
+ text: 'Length 4 (text)',
57
+ onClick: ->(action) do
58
+ action.runMultiple(
59
+ childActions: ->(multiple) do
60
+ multiple.components_set targetId: 'otp_basic', data: { length: 4, type: 'text', value: 'ABCD' }
61
+ multiple.logics_set targetId: 'otp_variant_status', data: { text: 'Variant: 4 digits (text)' }
62
+ end
63
+ )
64
+ end
65
+ )
66
+ flow.spacer width: 8
67
+ flow.button(
68
+ text: 'Length 6 (number)',
69
+ onClick: ->(action) do
70
+ action.runMultiple(
71
+ childActions: ->(multiple) do
72
+ multiple.components_set targetId: 'otp_basic', data: { length: 6, type: 'number', value: '123456' }
73
+ multiple.logics_set targetId: 'otp_variant_status', data: { text: 'Variant: 6 digits (number)' }
74
+ end
75
+ )
76
+ end
77
+ )
78
+ flow.spacer width: 8
79
+ flow.button(
80
+ text: 'Length 8 (text)',
81
+ onClick: ->(action) do
82
+ action.runMultiple(
83
+ childActions: ->(multiple) do
84
+ multiple.components_set targetId: 'otp_basic', data: { length: 8, type: 'text', value: 'A1B2C3D4' }
85
+ multiple.logics_set targetId: 'otp_variant_status', data: { text: 'Variant: 8 digits (text)' }
86
+ end
87
+ )
88
+ end
89
+ )
90
+ end
91
+ )
92
+
93
+ form.spacer height: 12
94
+ form.hr width: 'matchParent'
95
+ form.spacer height: 12
96
+
97
+ form.h2 text: 'Actions/events'
98
+ form.spacer height: 8
99
+ form.label id: 'otp_status', text: 'Status: idle'
100
+ form.spacer height: 8
101
+ form.panels_flow(
102
+ innerPadding: { bottom: 0 },
103
+ width: 'matchParent',
104
+ childViews: ->(flow) do
105
+ flow.button(
106
+ text: 'Autofill code',
107
+ onClick: ->(action) do
108
+ action.runMultiple(
109
+ childActions: ->(multiple) do
110
+ multiple.components_set targetId: 'otp_basic', data: { value: '654321' }
111
+ multiple.logics_set targetId: 'otp_status', data: { text: 'Status: autofilled' }
112
+ end
113
+ )
114
+ end
115
+ )
116
+ flow.spacer width: 8
117
+ flow.button(
118
+ text: 'Clear code',
119
+ onClick: ->(action) do
120
+ action.runMultiple(
121
+ childActions: ->(multiple) do
122
+ multiple.components_set targetId: 'otp_basic', data: { value: '' }
123
+ multiple.logics_set targetId: 'otp_status', data: { text: 'Status: cleared' }
124
+ end
125
+ )
126
+ end
127
+ )
128
+ end
129
+ )
130
+
131
+ form.spacer height: 12
132
+ form.hr width: 'matchParent'
133
+ form.spacer height: 12
134
+
135
+ form.h2 text: 'Edge/advanced'
136
+ form.spacer height: 8
137
+ form.panels_flow(
138
+ innerPadding: { bottom: 0 },
139
+ width: 'matchParent',
140
+ childViews: ->(flow) do
141
+ flow.button(
142
+ text: 'Disable field',
143
+ onClick: ->(action) do
144
+ action.components_set targetId: 'otp_basic', data: { disabled: true }
145
+ end
146
+ )
147
+ flow.spacer width: 8
148
+ flow.button(
149
+ text: 'Enable field',
150
+ onClick: ->(action) do
151
+ action.components_set targetId: 'otp_basic', data: { disabled: nil }
152
+ end
153
+ )
154
+ flow.spacer width: 8
155
+ flow.button(
156
+ text: 'Clear value',
157
+ onClick: ->(action) do
158
+ action.components_set targetId: 'otp_basic', data: { value: '' }
159
+ end
160
+ )
161
+ end
162
+ )
163
+ end
164
+ )
165
+ end
166
+ )
167
+ end
168
+ )