glib-web 4.42.4 → 4.43.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 (23) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/glib/json_ui/action_builder/browsers.rb +10 -0
  3. data/app/views/json_ui/garage/forms/selects.json.jbuilder +240 -174
  4. data/app/views/json_ui/garage/tables/bulk_edit.json.jbuilder +0 -24
  5. data/app/views/json_ui/garage/test_page/_header.json.jbuilder +25 -15
  6. data/app/views/json_ui/garage/test_page/auth.json.jbuilder +113 -0
  7. data/app/views/json_ui/garage/test_page/browsers.json.jbuilder +44 -0
  8. data/app/views/json_ui/garage/test_page/commands.json.jbuilder +30 -0
  9. data/app/views/json_ui/garage/test_page/cookies.json.jbuilder +12 -4
  10. data/app/views/json_ui/garage/test_page/fields.json.jbuilder +160 -0
  11. data/app/views/json_ui/garage/test_page/fields_dynamicSelect.json.jbuilder +177 -0
  12. data/app/views/json_ui/garage/test_page/fields_select.json.jbuilder +152 -0
  13. data/app/views/json_ui/garage/test_page/fields_sign.json.jbuilder +153 -0
  14. data/app/views/json_ui/garage/test_page/fields_timer.json.jbuilder +148 -0
  15. data/app/views/json_ui/garage/test_page/fields_upload.json.jbuilder +129 -0
  16. data/app/views/json_ui/garage/test_page/forms.json.jbuilder +6 -2
  17. data/app/views/json_ui/garage/test_page/list.json.jbuilder +110 -69
  18. data/app/views/json_ui/garage/test_page/panels_bulkEdit2.json.jbuilder +240 -0
  19. data/app/views/json_ui/garage/test_page/popovers.json.jbuilder +6 -2
  20. data/app/views/json_ui/garage/test_page/progressCircle.json.jbuilder +74 -65
  21. data/app/views/json_ui/garage/test_page/table.json.jbuilder +157 -88
  22. metadata +9 -2
  23. data/app/views/json_ui/garage/test_page/file_upload_new.json.jbuilder +0 -158
@@ -2,98 +2,167 @@ json.title 'Test Page (Table)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
- page.body childViews: ->(body) do
6
- render 'json_ui/garage/test_page/header', view: body
7
-
8
- body.panels_responsive padding: glib_json_padding_body, childViews: ->(res) do
9
- res.h2 text: 'Overview'
10
- res.p text: 'Table panels render rows with columns and support pagination and bulk actions.'
11
-
12
- res.spacer height: 12
13
- res.hr width: 'matchParent'
14
-
15
- res.h2 text: 'Basic'
16
- res.spacer height: 8
17
- res.panels_table id: 'table_main', import: { submitUrl: json_ui_garage_url(path: 'forms/generic_post'), paramName: 'table' }, export: { label: 'Export', fileName: 'table_export.csv' }, sections: [
18
- ->(section) do
19
- section.header cellViews: ->(header) do
20
- header.label text: 'Name'
21
- header.label text: 'Status'
5
+ page.body(
6
+ childViews: ->(body) do
7
+ render 'json_ui/garage/test_page/header', view: body
8
+ body.panels_responsive(
9
+ padding: glib_json_padding_body,
10
+ childViews: ->(res) do
11
+ res.h2 text: 'Overview'
12
+ res.p text: 'Table panels render rows with columns and support pagination and bulk actions.'
13
+ res.spacer height: 12
14
+ res.hr width: 'matchParent'
15
+ res.h2 text: 'Basic'
16
+ res.spacer height: 8
17
+ res.panels_table(
18
+ id: 'table_main',
19
+ import: { submitUrl: json_ui_garage_url(path: 'forms/generic_post'), paramName: 'table' },
20
+ export: { label: 'Export', fileName: 'table_export.csv' },
21
+ sections: [
22
+ ->(section) do
23
+ section.header(
24
+ cellViews: ->(header) do
25
+ header.label text: 'Name'
26
+ header.label text: 'Status'
27
+ end
28
+ )
29
+ items = ['Alpha', 'Bravo', 'Charlie']
30
+ section.rows(
31
+ objects: items,
32
+ builder: ->(row, item, index) do
33
+ status = index.even? ? 'Active' : 'Paused'
34
+ row.default(
35
+ cellViews: ->(cell) do
36
+ cell.label text: item
37
+ cell.label text: status
38
+ end
39
+ )
40
+ end
41
+ )
22
42
  end
23
-
24
- items = ['Alpha', 'Bravo', 'Charlie']
25
- section.rows objects: items, builder: ->(row, item, index) do
26
- status = index.even? ? 'Active' : 'Paused'
27
- row.default cellViews: ->(cell) do
28
- cell.label text: item
29
- cell.label text: status
43
+ ]
44
+ )
45
+ res.spacer height: 12
46
+ res.hr width: 'matchParent'
47
+ res.h2 text: 'Variants and Props'
48
+ res.spacer height: 8
49
+ res.panels_flow(
50
+ innerPadding: { bottom: 0 },
51
+ childViews: ->(flow) do
52
+ flow.button(
53
+ text: 'Compact style',
54
+ onClick: ->(action) do
55
+ action.components_set targetId: 'table_main', data: { styleClass: 'table--compact' }
56
+ end
57
+ )
58
+ flow.spacer width: 4
59
+ flow.button(
60
+ text: 'Striped style',
61
+ onClick: ->(action) do
62
+ action.components_set targetId: 'table_main', data: { styleClass: 'table--striped' }
63
+ end
64
+ )
65
+ flow.spacer width: 4
66
+ flow.button(
67
+ text: 'Clear style',
68
+ onClick: ->(action) do
69
+ action.components_set targetId: 'table_main', data: { styleClass: nil }
70
+ end
71
+ )
30
72
  end
31
- end
32
- end
33
- ]
34
-
35
- res.spacer height: 12
36
- res.hr width: 'matchParent'
37
-
38
- res.h2 text: 'Variants and Props'
39
- res.spacer height: 8
40
- res.panels_flow innerPadding: { bottom: 0 }, childViews: ->(flow) do
41
- flow.button text: 'Compact style', onClick: ->(action) do
42
- action.components_set targetId: 'table_main', data: { styleClass: 'table--compact' }
43
- end
44
- flow.spacer width: 4
45
- flow.button text: 'Striped style', onClick: ->(action) do
46
- action.components_set targetId: 'table_main', data: { styleClass: 'table--striped' }
47
- end
48
- flow.spacer width: 4
49
- flow.button text: 'Clear style', onClick: ->(action) do
50
- action.components_set targetId: 'table_main', data: { styleClass: nil }
51
- end
52
- end
53
-
54
- res.spacer height: 12
55
- res.hr width: 'matchParent'
56
-
57
- res.h2 text: 'Actions and Events'
58
- res.spacer height: 8
59
- res.label id: 'table_event_status', text: 'Scroll events: idle'
60
- res.spacer height: 6
61
- res.panels_table height: 160, onScrollToTop: ->(action) do
62
- action.components_set targetId: 'table_event_status', data: { text: 'Scroll events: top reached' }
63
- end, onScrollToBottom: ->(action) do
64
- action.components_set targetId: 'table_event_status', data: { text: 'Scroll events: bottom reached' }
65
- end, sections: [
66
- ->(section) do
67
- section.header cellViews: ->(header) do
68
- header.label text: 'Item'
69
- header.label text: 'Value'
70
- end
71
- section.rows builder: ->(row) do
72
- (1..12).each do |index|
73
- row.default cellViews: ->(cell) do
74
- cell.label text: "Row #{index}"
75
- cell.label text: "Value #{index}"
76
- end
73
+ )
74
+ res.spacer height: 12
75
+ res.hr width: 'matchParent'
76
+ res.h2 text: 'Actions and Events'
77
+ res.spacer height: 8
78
+ res.label id: 'table_event_status', text: 'Scroll events: idle'
79
+ res.spacer height: 6
80
+ res.panels_scroll(
81
+ height: 160,
82
+ width: 'matchParent',
83
+ childViews: ->(scroll) do
84
+ scroll.panels_table(
85
+ height: 'matchParent',
86
+ onScrollToTop: ->(action) do
87
+ action.components_set targetId: 'table_event_status', data: { text: 'Scroll events: top reached' }
88
+ end,
89
+ onScrollToBottom: ->(action) do
90
+ action.components_set targetId: 'table_event_status', data: { text: 'Scroll events: bottom reached' }
91
+ end,
92
+ sections: [
93
+ ->(section) do
94
+ section.header(
95
+ cellViews: ->(header) do
96
+ header.label text: 'Item'
97
+ header.label text: 'Value'
98
+ end
99
+ )
100
+ section.rows(
101
+ builder: ->(row) do
102
+ (1..12).each do |index|
103
+ row.default(
104
+ cellViews: ->(cell) do
105
+ cell.label text: "Row #{index}"
106
+ cell.label text: "Value #{index}"
107
+ end
108
+ )
109
+ end
110
+ end
111
+ )
112
+ end
113
+ ]
114
+ )
77
115
  end
116
+ )
117
+ res.spacer height: 12
118
+ res.hr width: 'matchParent'
119
+ res.h2 text: 'Autoload'
120
+ res.spacer height: 8
121
+ res.label text: 'Scroll to load more rows (asNeeded).'
122
+ res.spacer height: 8
123
+ column_indexes = (1..3)
124
+ res.panels_table(
125
+ id: 'table_autoload',
126
+ height: 220,
127
+ nextPage: {
128
+ url: json_ui_garage_url(path: 'tables/autoload_as_needed', page: 1, col: 0, section_only: 'v1'),
129
+ autoload: 'asNeeded'
130
+ },
131
+ sections: [
132
+ ->(section) do
133
+ section.header(
134
+ cellViews: ->(header) do
135
+ header.label text: ''
136
+ column_indexes.each do |i|
137
+ header.label text: "Heading#{i}"
138
+ end
139
+ header.label text: ''
140
+ end
141
+ )
142
+ render 'json_ui/garage/tables/autoload_section', page: page, page_index: 0, column_indexes: column_indexes
78
143
  end
79
- end
80
- ]
81
-
82
- res.spacer height: 12
83
- res.hr width: 'matchParent'
84
-
85
- res.h2 text: 'Edge and Advanced'
86
- res.spacer height: 8
87
- res.label text: 'Empty table (no rows)'
88
- res.panels_table sections: [
89
- ->(section) do
90
- section.header cellViews: ->(header) do
91
- header.label text: 'Column A'
92
- header.label text: 'Column B'
93
- end
94
- section.rows builder: ->(_row) do
144
+ ]
145
+ )
146
+ res.h2 text: 'Edge and Advanced'
147
+ res.spacer height: 8
148
+ res.label text: 'Empty table (no rows)'
149
+ res.panels_table(
150
+ sections: [
151
+ ->(section) do
152
+ section.header(
153
+ cellViews: ->(header) do
154
+ header.label text: 'Column A'
155
+ header.label text: 'Column B'
156
+ end
157
+ )
158
+ section.rows(
159
+ builder: ->(_row) do
160
+ end
161
+ )
95
162
  end
163
+ ]
164
+ )
96
165
  end
97
- ]
166
+ )
98
167
  end
99
- end
168
+ )
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.42.4
4
+ version: 4.43.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -372,6 +372,7 @@ files:
372
372
  - app/views/json_ui/garage/tables/pagination.json.jbuilder
373
373
  - app/views/json_ui/garage/tables/panel_content.json.jbuilder
374
374
  - app/views/json_ui/garage/test_page/_header.json.jbuilder
375
+ - app/views/json_ui/garage/test_page/auth.json.jbuilder
375
376
  - app/views/json_ui/garage/test_page/auto_validate.json.jbuilder
376
377
  - app/views/json_ui/garage/test_page/browsers.json.jbuilder
377
378
  - app/views/json_ui/garage/test_page/calendar.json.jbuilder
@@ -386,7 +387,12 @@ files:
386
387
  - app/views/json_ui/garage/test_page/dialog.json.jbuilder
387
388
  - app/views/json_ui/garage/test_page/dialog_open.json.jbuilder
388
389
  - app/views/json_ui/garage/test_page/dirty_state.json.jbuilder
389
- - app/views/json_ui/garage/test_page/file_upload_new.json.jbuilder
390
+ - app/views/json_ui/garage/test_page/fields.json.jbuilder
391
+ - app/views/json_ui/garage/test_page/fields_dynamicSelect.json.jbuilder
392
+ - app/views/json_ui/garage/test_page/fields_select.json.jbuilder
393
+ - app/views/json_ui/garage/test_page/fields_sign.json.jbuilder
394
+ - app/views/json_ui/garage/test_page/fields_timer.json.jbuilder
395
+ - app/views/json_ui/garage/test_page/fields_upload.json.jbuilder
390
396
  - app/views/json_ui/garage/test_page/flow.json.jbuilder
391
397
  - app/views/json_ui/garage/test_page/form.json.jbuilder
392
398
  - app/views/json_ui/garage/test_page/form_dynamic.json.jbuilder
@@ -404,6 +410,7 @@ files:
404
410
  - app/views/json_ui/garage/test_page/multiupload.json.jbuilder
405
411
  - app/views/json_ui/garage/test_page/pagination.json.jbuilder
406
412
  - app/views/json_ui/garage/test_page/panels.json.jbuilder
413
+ - app/views/json_ui/garage/test_page/panels_bulkEdit2.json.jbuilder
407
414
  - app/views/json_ui/garage/test_page/popovers.json.jbuilder
408
415
  - app/views/json_ui/garage/test_page/progressCircle.json.jbuilder
409
416
  - app/views/json_ui/garage/test_page/responsive.json.jbuilder
@@ -1,158 +0,0 @@
1
- json.title 'Forms'
2
- page = json_ui_page json
3
- render "#{@path_prefix}/nav_menu", json: json, page: page
4
-
5
- params[:mode] ||= 'html'
6
-
7
- image = OpenStruct.new(
8
- url: 'https://picsum.photos/id/11/100/60',
9
- signed_id: 'test',
10
- filename: 'upload.png'
11
- )
12
-
13
- accepts = {
14
- fileType: 'image',
15
- maxFileSize: 10,
16
- maxFileLength: 2
17
- }
18
-
19
- if params[:mode] == 'html'
20
- directUploadUrl = nil
21
- else
22
- directUploadUrl = glib_direct_uploads_url
23
- end
24
-
25
- properties = {
26
- styleClass: 'pb-2',
27
- directUploadUrl: params,
28
- accepts: accepts,
29
- directUploadUrl: directUploadUrl,
30
- value: image&.signed_id
31
- }
32
-
33
- # properties[:onMaxFileLengthError] = ->(action) do
34
- # action.snackbars_alert message: 'max file length exceeded'
35
- # end
36
-
37
- # properties[:onMaxFileSizeError] = ->(action) do
38
- # action.snackbars_alert message: 'max file size exceeded'
39
- # end
40
-
41
- # properties[:onFileTypeError] = ->(action) do
42
- # action.snackbars_alert message: 'file type invalid'
43
- # end
44
-
45
- properties[:onFinishUpload] = ->(action) do # rubocop:disable Glib/MultilineMethodCallStyle
46
- action.snackbars_alert message: 'Get the signed ids!'
47
- end
48
-
49
- page.form(
50
- url: json_ui_garage_url(path: 'forms/generic_post'),
51
- method: 'post',
52
- childViews: ->(form) do
53
- render 'json_ui/garage/test_page/header', view: form
54
-
55
- # form.panels_flow(
56
- # styleClass: 'items-center justify-center gap-2 pb-4',
57
- # childViews: ->(flow) do
58
- # flow.label text: "MODE: #{params[:mode] || 'directUpload'}"
59
- # change = params[:mode] == 'html' ? 'directUpload' : 'html'
60
- # flow.button text: 'Change', onClick: ->(action) { action.windows_open url: json_ui_garage_current_url({ mode: change }) }
61
- # end
62
- # )
63
-
64
- form.h2 text: 'Field Upload', styleClass: 'pb-4'
65
- form.label text: 'placeholder image', styleClass: 'pb-1'
66
- form.panels_flow(
67
- styleClass: 'align-center',
68
- xs: { gap: { all: 4 } },
69
- childViews: ->(flow) do
70
- flow.fields_upload(
71
- properties.merge(
72
- name: 'user[file_placeholderView]',
73
- id: 'pv1',
74
- placeholderView: { type: 'image', url: image&.url, width: 144, height: 144 }
75
- )
76
- )
77
-
78
- flow.button(
79
- text: 'Trigger',
80
- onClick: ->(action) do
81
- action.components_invoke targetId: 'pv1', name: 'trigger'
82
- end
83
- )
84
- flow.button(
85
- text: 'Reset',
86
- onClick: ->(action) do
87
- action.components_invoke targetId: 'pv1', name: 'reset'
88
- end
89
- )
90
- end
91
- )
92
-
93
- form.label text: 'placeholder avatar', styleClass: 'pb-1'
94
- form.panels_flow(
95
- styleClass: 'align-center',
96
- xs: { gap: { all: 4 } },
97
- childViews: ->(flow) do
98
- flow.fields_upload(
99
- properties.merge(
100
- name: 'user[file_placeholderView2]',
101
- id: 'pv2',
102
- placeholderView: { type: 'avatar', url: image&.url, width: 64, height: 64 }
103
- )
104
- )
105
-
106
- end
107
- )
108
-
109
- form.label text: 'file input', styleClass: 'pb-1'
110
- form.fields_upload(
111
- properties.merge(
112
- name: 'user[file_input1]',
113
- id: 'fi1',
114
- label: 'Upload file',
115
- width: 300,
116
- label: 'Choose file',
117
- inputView: { variant: 'outlined' },
118
- multiple: false
119
- )
120
- )
121
-
122
-
123
- form.label text: 'multiprogress', styleClass: 'pb-1'
124
- form.fields_upload(
125
- properties.merge(
126
- name: 'user[file_multiprogress1][]',
127
- id: 'mp1',
128
- width: 300,
129
- label: 'Upload file',
130
- multiple: true,
131
- multiProgressView: { files: [] }
132
- )
133
- )
134
-
135
-
136
- form.label text: 'Button file upload', styleClass: 'pb-1'
137
- form.button(
138
- text: 'click me to select file',
139
- onClick: ->(action) do
140
- action.components_invoke targetId: 'btn1', name: 'trigger'
141
- end
142
- )
143
- form.fields_upload(
144
- properties.merge(
145
- name: 'user[file_btn1][]',
146
- id: 'btn1',
147
- width: 300,
148
- label: 'Upload file',
149
- multiple: true,
150
- inputView: { files: [] },
151
- styleClass: 'pb-4 d-none'
152
- )
153
- )
154
-
155
- form.fields_submit text: 'submit'
156
-
157
- end
158
- )