glib-web 4.6.0 → 4.8.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.
- checksums.yaml +4 -4
- data/app/helpers/glib/json_ui/action_builder/files.rb +3 -0
- data/app/helpers/glib/json_ui/view_builder/fields.rb +17 -10
- data/app/helpers/glib/json_ui/view_builder/panels.rb +2 -0
- data/app/helpers/glib/json_ui/view_builder.rb +3 -0
- data/app/views/json_ui/garage/forms/rich_text.json.jbuilder +1 -1
- data/app/views/json_ui/garage/forms/selects.json.jbuilder +2 -1
- data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +3 -3
- data/app/views/json_ui/garage/forms/text_validation.json.jbuilder +14 -7
- data/app/views/json_ui/garage/panels/tree.json.jbuilder +11 -3
- data/app/views/json_ui/garage/test_page/form.json.jbuilder +20 -2
- data/app/views/json_ui/garage/views/images.json.jbuilder +8 -0
- data/lib/glib/integration_test.rb +9 -0
- data/lib/glib/test_helpers.rb +4 -1
- data/lib/glib-web.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14b477903f0539909ec17ac01c7f892fc27a90dfc205680435539c2eb7cfc688
|
4
|
+
data.tar.gz: c08e982d602198ee4a1d5568143ed0a763d3f19a6f3fb9289ad37faa9c2519c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a25abbe0d1571f5545e4edb184899a90c5159069672ec3d88d353ca450add1b264b2d172b4b90caa94ae24cebf9dbb1b5e7cd015fe1c239eef47c85daf71923
|
7
|
+
data.tar.gz: 9f65a3e84dc11bb8b87c2af03c028e7722f3b57b994bb746d494da000e9e0b85b1a290ebea7289535bf5d6daba2a69f0a20533f59ae0334af14b8d6b63dc3d99
|
@@ -117,6 +117,7 @@ class Glib::JsonUi::ViewBuilder
|
|
117
117
|
string :rightText
|
118
118
|
action :onTypeStart
|
119
119
|
action :onTypeEnd
|
120
|
+
bool :clearable
|
120
121
|
end
|
121
122
|
|
122
123
|
class Number < Text
|
@@ -190,13 +191,21 @@ class Glib::JsonUi::ViewBuilder
|
|
190
191
|
end
|
191
192
|
|
192
193
|
class Select < AbstractField
|
193
|
-
|
194
|
+
attr_reader :_options
|
195
|
+
|
196
|
+
# array :options
|
194
197
|
# bool :readOnly
|
195
198
|
bool :multiple, cache: true
|
196
199
|
# bool :manualEntry
|
197
200
|
hash :append, optional: [:icon]
|
198
201
|
|
199
202
|
panels_builder :accessory, :header, :footer
|
203
|
+
bool :clearable
|
204
|
+
|
205
|
+
def options(value)
|
206
|
+
@_options = value
|
207
|
+
json.set! 'options', value&.to_a
|
208
|
+
end
|
200
209
|
|
201
210
|
def searchable(value)
|
202
211
|
@searchable = value
|
@@ -205,7 +214,9 @@ class Glib::JsonUi::ViewBuilder
|
|
205
214
|
def created
|
206
215
|
super
|
207
216
|
|
208
|
-
|
217
|
+
if @searchable.nil?
|
218
|
+
@searchable = _options.size >= 10
|
219
|
+
end
|
209
220
|
json.set! 'searchable', @searchable
|
210
221
|
end
|
211
222
|
end
|
@@ -218,7 +229,7 @@ class Glib::JsonUi::ViewBuilder
|
|
218
229
|
|
219
230
|
class TimeZone < AbstractField
|
220
231
|
include Glib::EnumHelper
|
221
|
-
|
232
|
+
bool :clearable
|
222
233
|
# Override
|
223
234
|
def created
|
224
235
|
super
|
@@ -284,13 +295,6 @@ class Glib::JsonUi::ViewBuilder
|
|
284
295
|
string :onIcon
|
285
296
|
hash :image, required: [:url, :template], optional: [:width, :height]
|
286
297
|
hash :icon, required: [:name, :template], optional: [:color, :size]
|
287
|
-
# bool :featured
|
288
|
-
# bool :thumbnail
|
289
|
-
# hash :image
|
290
|
-
# string :imageUrl
|
291
|
-
# string :icon
|
292
|
-
# string :iconColor
|
293
|
-
# string :iconSize
|
294
298
|
|
295
299
|
views :childViews
|
296
300
|
end
|
@@ -422,6 +426,7 @@ class Glib::JsonUi::ViewBuilder
|
|
422
426
|
date :min
|
423
427
|
date :max
|
424
428
|
string :type
|
429
|
+
bool :clearable
|
425
430
|
|
426
431
|
# Override
|
427
432
|
def value(value)
|
@@ -434,6 +439,7 @@ class Glib::JsonUi::ViewBuilder
|
|
434
439
|
class Datetime < AbstractField
|
435
440
|
date_time :min
|
436
441
|
date_time :max
|
442
|
+
bool :clearable
|
437
443
|
end
|
438
444
|
|
439
445
|
class Location < AbstractField
|
@@ -459,6 +465,7 @@ class Glib::JsonUi::ViewBuilder
|
|
459
465
|
class Phone < AbstractField
|
460
466
|
string :defaultCountry
|
461
467
|
bool :disableAutoDetect
|
468
|
+
bool :clearable
|
462
469
|
end
|
463
470
|
|
464
471
|
class CreditCard < AbstractField
|
@@ -50,6 +50,7 @@ module Glib
|
|
50
50
|
include Builder::MouseEvents
|
51
51
|
|
52
52
|
string :id
|
53
|
+
string :key
|
53
54
|
length :width
|
54
55
|
length :height
|
55
56
|
color :backgroundColor
|
@@ -175,6 +176,8 @@ module Glib
|
|
175
176
|
string :url
|
176
177
|
string :base64Data
|
177
178
|
action :onClick
|
179
|
+
color :backgroundColor
|
180
|
+
hash :initials, required: [:text], optional: [:color]
|
178
181
|
end
|
179
182
|
|
180
183
|
class Icon < View
|
@@ -46,7 +46,7 @@ page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', pad
|
|
46
46
|
],
|
47
47
|
imageUploader: {
|
48
48
|
name: 'user[images_attributes][]',
|
49
|
-
accepts: { fileType: 'image
|
49
|
+
accepts: { fileType: 'image', maxFileSize: 5000 },
|
50
50
|
directUploadUrl: glib_direct_uploads_url
|
51
51
|
},
|
52
52
|
onChange: ->(action) do
|
@@ -20,6 +20,7 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
|
|
20
20
|
form.fields_select \
|
21
21
|
name: 'user[city]',
|
22
22
|
width: 'matchParent',
|
23
|
+
clearable: true,
|
23
24
|
label: 'City1',
|
24
25
|
placeholder: 'This is a placeholder',
|
25
26
|
options: languages.map { |k, v| { value: k, text: v } },
|
@@ -147,7 +148,7 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
|
|
147
148
|
form.spacer height: 6
|
148
149
|
form.label text: 'The select field defaults to the device\'s time zone.'
|
149
150
|
form.spacer height: 6
|
150
|
-
form.fields_timeZone name: 'user[time_zone]', width: 'matchParent', label: 'Time Zone'
|
151
|
+
form.fields_timeZone name: 'user[time_zone]', width: 'matchParent', label: 'Time Zone', clearable: true
|
151
152
|
|
152
153
|
|
153
154
|
form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
@@ -383,7 +383,7 @@ page.form \
|
|
383
383
|
end
|
384
384
|
end
|
385
385
|
|
386
|
-
form.
|
386
|
+
form.panels_responsive \
|
387
387
|
id: 'panel7a',
|
388
388
|
styleClass: 'border-2',
|
389
389
|
width: 'matchParent',
|
@@ -392,7 +392,7 @@ page.form \
|
|
392
392
|
vertical.fields_text name: 'user[0][loadif_target9]', width: 'matchParent', value: 'Value 7a'
|
393
393
|
end
|
394
394
|
|
395
|
-
form.
|
395
|
+
form.panels_responsive \
|
396
396
|
id: 'panel7b',
|
397
397
|
styleClass: 'border-2',
|
398
398
|
width: 'matchParent',
|
@@ -401,7 +401,7 @@ page.form \
|
|
401
401
|
vertical.fields_text name: 'user[1][loadif_target9]', width: 'matchParent', value: 'Value 7b'
|
402
402
|
end
|
403
403
|
|
404
|
-
form.
|
404
|
+
form.panels_responsive \
|
405
405
|
id: 'panel7c',
|
406
406
|
styleClass: 'border-2',
|
407
407
|
width: 'matchParent',
|
@@ -20,26 +20,30 @@ page.form \
|
|
20
20
|
form.fields_email \
|
21
21
|
name: 'user[email]',
|
22
22
|
width: 'matchParent',
|
23
|
-
label: 'Email'
|
23
|
+
label: 'Email',
|
24
|
+
clearable: true
|
24
25
|
form.spacer height: 8
|
25
26
|
|
26
27
|
form.fields_url \
|
27
28
|
name: 'user[url]',
|
28
29
|
width: 'matchParent',
|
29
|
-
label: 'URL'
|
30
|
+
label: 'URL',
|
31
|
+
clearable: true
|
30
32
|
form.spacer height: 8
|
31
33
|
|
32
34
|
form.fields_number \
|
33
35
|
prop: :age,
|
34
36
|
name: 'user[age]',
|
35
37
|
width: 'matchParent',
|
36
|
-
label: 'Age'
|
38
|
+
label: 'Age',
|
39
|
+
clearable: true
|
37
40
|
form.spacer height: 8
|
38
41
|
|
39
42
|
form.fields_phone \
|
40
43
|
name: 'user[phone1]',
|
41
44
|
width: 'matchParent',
|
42
|
-
label: 'Phone field'
|
45
|
+
label: 'Phone field',
|
46
|
+
clearable: true
|
43
47
|
form.spacer height: 8
|
44
48
|
|
45
49
|
form.fields_phone \
|
@@ -55,7 +59,8 @@ page.form \
|
|
55
59
|
width: 'matchParent',
|
56
60
|
label: 'Password',
|
57
61
|
hint: 'Should contain at least 6 characters',
|
58
|
-
leftIcon: 'lock'
|
62
|
+
leftIcon: 'lock',
|
63
|
+
clearable: true
|
59
64
|
form.spacer height: 8
|
60
65
|
|
61
66
|
form.fields_textarea \
|
@@ -63,7 +68,8 @@ page.form \
|
|
63
68
|
name: 'user[words]',
|
64
69
|
width: 'matchParent',
|
65
70
|
label: 'Textarea with maxLength',
|
66
|
-
maxLength: 1000
|
71
|
+
maxLength: 1000,
|
72
|
+
clearable: true
|
67
73
|
form.spacer height: 8
|
68
74
|
|
69
75
|
|
@@ -73,7 +79,8 @@ page.form \
|
|
73
79
|
name: 'user[position]',
|
74
80
|
width: 'matchParent',
|
75
81
|
label: 'Position',
|
76
|
-
options: options
|
82
|
+
options: options,
|
83
|
+
clearable: true
|
77
84
|
form.spacer height: 8
|
78
85
|
|
79
86
|
|
@@ -1,9 +1,12 @@
|
|
1
1
|
json.title 'Panels'
|
2
2
|
|
3
3
|
onDropFile = ->(action) do
|
4
|
-
action.files_upload
|
5
|
-
|
6
|
-
|
4
|
+
action.files_upload \
|
5
|
+
directUploadUrl: glib_direct_uploads_url,
|
6
|
+
paramNameForFiles: 'signedIds',
|
7
|
+
onFinished: ->(saction) do
|
8
|
+
saction.http_post url: json_ui_garage_url(path: 'forms/generic_post_all')
|
9
|
+
end
|
7
10
|
end
|
8
11
|
onDropView = ->(action) do
|
9
12
|
action.http_post url: json_ui_garage_url(path: 'forms/generic_post_all')
|
@@ -18,6 +21,8 @@ json_ui_page json do |page|
|
|
18
21
|
|
19
22
|
scroll.panels_column md: { cols: 4 }, childViews: ->(col) do
|
20
23
|
scroll.panels_tree \
|
24
|
+
paramNameForContext: 'moved',
|
25
|
+
# paramNameForFormData: 'message',
|
21
26
|
onDropFile: onDropFile,
|
22
27
|
onDropView: onDropView,
|
23
28
|
selected: params[:selected] || 'arabian-1.mp3',
|
@@ -33,6 +38,7 @@ json_ui_page json do |page|
|
|
33
38
|
id: 'pop',
|
34
39
|
title: 'Pop',
|
35
40
|
icon: { name: 'folder', size: 24, color: '#6e6e6e' },
|
41
|
+
dropData: { genre: 'pop' },
|
36
42
|
onClick: ->(action) { action.windows_reload url: json_ui_garage_current_url(selected: 'pop') },
|
37
43
|
subtitle: params['selected'] == 'pop' ? 'Pop music is a genre of popular music that originated in its modern' : nil,
|
38
44
|
rows: ['pop-1.mp3', 'pop-2.mp3', 'pop-3.mp3']
|
@@ -40,6 +46,7 @@ json_ui_page json do |page|
|
|
40
46
|
id: 'arab',
|
41
47
|
title: 'Arabian',
|
42
48
|
icon: { name: 'folder', size: 24, color: '#6e6e6e' },
|
49
|
+
dropData: { genre: 'arab' },
|
43
50
|
onClick: ->(action) { action.windows_reload url: json_ui_garage_current_url(selected: 'arab') },
|
44
51
|
subtitle: params['selected'] == 'arab' ? 'Arabic music is the music of the Arab world' : nil,
|
45
52
|
rows: ['arabian-1.mp3', 'arabian-2.mp3', 'arabian-3.mp3']
|
@@ -48,6 +55,7 @@ json_ui_page json do |page|
|
|
48
55
|
title: 'Phonk',
|
49
56
|
onClick: ->(action) { action.windows_reload url: json_ui_garage_current_url(selected: 'phonk') },
|
50
57
|
icon: { name: 'folder', size: 24, color: '#6e6e6e' },
|
58
|
+
dropData: { genre: 'phonk' },
|
51
59
|
subtitle: params['selected'] == 'phonk' ? 'Phonk is a subgenre of hip hop and trap music' : nil,
|
52
60
|
rows: ['phonk1.mp3', 'phonk-2.mp3', { id: 'hard-phonk', title: 'Hard Phonk', rows: ['hard-phonk-1.mp3', 'hard-phonk-2.mp3'] }]
|
53
61
|
end
|
@@ -44,7 +44,11 @@ page.body childViews: ->(body) do
|
|
44
44
|
end
|
45
45
|
hori.spacer width: 4
|
46
46
|
hori.button text: 'hide select', onClick: ->(action) do
|
47
|
-
action.
|
47
|
+
action.runMultiple childActions: ->(saction) do
|
48
|
+
['select', 'select1', 'select2', 'select3'].each do |id|
|
49
|
+
saction.components_set targetId: id, data: { displayed: false }
|
50
|
+
end
|
51
|
+
end
|
48
52
|
end
|
49
53
|
hori.spacer height: 4
|
50
54
|
hori.button text: 'hide jack', onClick: ->(action) do
|
@@ -71,8 +75,22 @@ page.body childViews: ->(body) do
|
|
71
75
|
|
72
76
|
form.fields_date width: 'matchParent', name: 'user[date]', id: 'date', value: Date.new(2024, 7, 24), validation: validation
|
73
77
|
form.hr width: 'matchParent'
|
74
|
-
form.fields_select multiple: true, width: 'matchParent', name: 'user[select][]', id: 'select', options: options, value: ['option1', 'option2'], validation: validation
|
78
|
+
form.fields_select clearable: true, multiple: true, width: 'matchParent', name: 'user[select][]', id: 'select', options: options, value: ['option1', 'option2'], validation: validation
|
75
79
|
form.hr width: 'matchParent'
|
80
|
+
form.panels_flow innerPadding: { bottom: 0 }, width: 'matchParent', id: 'select1', childViews: ->(flow) do
|
81
|
+
form.fields_select clearable: true, width: 'matchParent', name: 'user[select1]', options: options, value: 'option1'
|
82
|
+
form.hr width: 'matchParent'
|
83
|
+
end
|
84
|
+
form.panels_horizontal id: 'select2', width: 'matchParent', childViews: ->(hori) do
|
85
|
+
form.fields_select clearable: true, width: 'matchParent', name: 'user[select2]', options: options, value: 'option2'
|
86
|
+
form.hr width: 'matchParent'
|
87
|
+
end
|
88
|
+
form.panels_split id: 'select3', width: 'matchParent', content: ->(split) do
|
89
|
+
split.left childViews: ->(right) do
|
90
|
+
form.fields_select clearable: true, width: 'matchParent', name: 'user[select3]', options: options, value: 'option3'
|
91
|
+
form.hr width: 'matchParent'
|
92
|
+
end
|
93
|
+
end
|
76
94
|
form.fields_chipGroup width: 'matchParent', name: 'user[chip_group]', id: 'chip_group', options: options, value: ['option2'], validation: validation
|
77
95
|
form.hr width: 'matchParent'
|
78
96
|
form.fields_radioGroup width: 'matchParent', name: 'user[radio_group]', id: 'radio_group', value: 'option3', validation: validation, childViews: ->(radio) do
|
@@ -7,6 +7,14 @@ render "#{@path_prefix}/nav_menu", json: json, page: page
|
|
7
7
|
small_image_url = 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSGQpSWjtELISLBlmugOZ6wzl1JamYXQvbFeYywpfg3E8b8DrO0Kg&s'
|
8
8
|
|
9
9
|
page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
10
|
+
scroll.h2 text: 'Avatar Text'
|
11
|
+
scroll.spacer height: 6
|
12
|
+
scroll.avatar \
|
13
|
+
url: glib_json_image_avatar_url,
|
14
|
+
tooltip: { text: 'This is a tooltip' },
|
15
|
+
backgroundColor: '#ddd',
|
16
|
+
initials: { text: 'JD', color: '#AAB396' }
|
17
|
+
|
10
18
|
scroll.h2 text: 'Avatar'
|
11
19
|
scroll.spacer height: 6
|
12
20
|
scroll.avatar \
|
data/lib/glib/test_helpers.rb
CHANGED
@@ -21,7 +21,10 @@ module Glib
|
|
21
21
|
end
|
22
22
|
|
23
23
|
# See https://stackoverflow.com/questions/51583321/it-is-safe-to-use-lvh-me-instead-of-localhost-for-testing
|
24
|
-
HOST = 'www.lvh.me:3000'
|
24
|
+
# HOST = 'www.lvh.me:3000'
|
25
|
+
|
26
|
+
# The best practice is to avoid using lvh.me due to security and performance concerns.
|
27
|
+
HOST = 'www.localhost:3000'
|
25
28
|
|
26
29
|
# LOG_DIR = File.expand_path(
|
27
30
|
# File.join(File.dirname(__FILE__), 'integration/json_ui_crawler_test_results')
|
data/lib/glib-web.rb
CHANGED
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.
|
4
|
+
version: 4.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -342,6 +342,7 @@ files:
|
|
342
342
|
- lib/glib/dynamic_text.rb
|
343
343
|
- lib/glib/dynamic_text/config.rb
|
344
344
|
- lib/glib/engine.rb
|
345
|
+
- lib/glib/integration_test.rb
|
345
346
|
- lib/glib/json_crawler.rb
|
346
347
|
- lib/glib/json_crawler/action_crawler.rb
|
347
348
|
- lib/glib/json_crawler/action_crawlers/action_http.rb
|