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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e67baf48a78976b4b693d5c87c96ef05320e8758575816e88b2c342954eceb5
4
- data.tar.gz: b450d88751a87221bbeb4499000c85d21f358a171fa4506ea33af7dabfbfb02f
3
+ metadata.gz: 7f82cbe6244860401184fb219b90a22f66839abbb8c0348fe324d5662491ff53
4
+ data.tar.gz: 94f1678aaf84f214ab0fa9d4f913a3e2df19a6b0eacb54c8967201a26abe2569
5
5
  SHA512:
6
- metadata.gz: 4a02652c1ff1ecc421faf705052ca63efbe5c317113127c0031b66306e3b4919fb68ebd83ea059c294635e7d17e5c0584a9c4f7840f5535bc1d7c18d16394c26
7
- data.tar.gz: d7354cb5e26276e41ed369ca681a8dfa75625477922646998a87046b74b012bfa8830e299b18951eedcb1b9938f4b92384fe21d4edf1b7d81ba7db2615c12d3f
6
+ metadata.gz: 5c097c0f55e226e9960f13da37912392729a8f7acbfc2b314b18b146e340be7747aa61d7a58fdc13b1dcd77e00e1f157e0fee8f6dea6f1265d8bfe4389939b27
7
+ data.tar.gz: 3442a41bf7b197ce9c6a0bebd2cbe95bff08d0e97f3db65e70e5e0264bcdf6056b6942bbbdc531e4c028a6a93cdce724cfc69d1590fcb54e5ae9e973bad3f2ba
@@ -65,7 +65,7 @@ module Glib
65
65
 
66
66
  required_properties = @@_required_properties[self.class.component_name] || []
67
67
  required_properties.each do |prop|
68
- raise "Property required: #{prop}. Properties provided: #{args}. Component: #{self.class.component_name}" unless args[prop].present?
68
+ raise "Property required: #{prop}. Properties provided: #{args}. Component: #{self.class.component_name}" if args[prop].nil?
69
69
  end
70
70
  else
71
71
  raise "Invalid properties: #{args}"
@@ -14,9 +14,7 @@ class Glib::JsonUi::ActionBuilder
14
14
  action :onSet
15
15
  bool :replace, cache: true
16
16
 
17
- def created
18
- replace(true) unless instance_variable_defined?(:@replace)
19
- end
17
+ required :replace
20
18
  end
21
19
  end
22
20
  end
@@ -751,59 +751,6 @@ class Glib::JsonUi::ViewBuilder
751
751
  end
752
752
  end
753
753
 
754
- # deprecated
755
- class MultiUpload < AbstractField
756
- include Glib::JsonUi::Default
757
- include Glib::JsonUi::Upload
758
- include Glib::JsonUi::FileUploadErrorHandler
759
-
760
- array :files
761
- string :uploadTitle
762
- action :onFinishUpload
763
- string :url # http post end point if you don't want to use onFinishUpload
764
-
765
- def files(values)
766
- @files = values
767
- end
768
-
769
- def responseMessages(values)
770
- @responseMessages = values
771
- end
772
-
773
- def created
774
- super
775
- file_upload_error_handler_on_create
776
-
777
- @placeholder ||= I18n.t('glib.multi_upload.placeholder', default: nil)
778
- @hint ||= I18n.t('glib.multi_upload.hint', default: nil)
779
-
780
- ['200', '403', '401', 'else'].each do |status|
781
- key = "glib.multi_upload.responseMessages.#{status}"
782
- @responseMessages[status] = I18n.t(key) if I18n.exists?(key)
783
- end
784
- json.responseMessages(
785
- (@responseMessages || {}).reverse_merge(
786
- '200' => 'Completed',
787
- '403' => 'Forbidden',
788
- '401' => 'Session expired',
789
- 'else' => 'Failed'
790
- )
791
- )
792
-
793
- json.placeholder @placeholder if @placeholder
794
- json.hint @hint if @hint
795
-
796
- if @prop && context
797
- # association = form.nested_associations.last
798
- # context = association || form
799
-
800
- @files ||= context.field_value(@prop, collect_ids: false).to_a.map { |file| { name: file.blob&.filename, signed_id: file.signed_id, url: url_for(file) } }
801
- end
802
-
803
- json.files @files if @files.present?
804
- end
805
- end
806
-
807
754
  class Upload < AbstractField
808
755
  include Glib::JsonUi::Upload
809
756
  include Glib::JsonUi::FileUploadErrorHandler
@@ -39,71 +39,6 @@ page.form options.merge(childViews: ->(form) do
39
39
  # form.fields_multiImage name: 'user[photos][]', width: 'matchParent', label: 'Avatar', accepts: rules, directUploadUrl: glib_direct_uploads_url,
40
40
  # placeholderView: { type: 'avatar', width: 100, height: 100, url: 'data:image/jpeg;base64,/9j/4AAQSkZJRgABA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771IkBERAREQEREBERAREQEREBERAREQeFnPm621MvNAbGA0Xe9+l3DjsVYRoRY4tcCHNJBBxBGIV2Lx7bmpCj2lloiaoGkyX8Rw1Z8N++QQeNmDm7dlbIzf8lp/9h+nfcp5cvaX7osMEtYSGwbByCOBnTV9ONEAOv0w2oX3KY7Vl8jqY8KURhA1seNaIMB9+mG1C+5o4rLyDq48KIwgCTseNUAsuVx2IGXtJYYCNbDjWqOBJm3Dsg+mRL1CFoiwZcv3itzyDq48KUWWOAEjj+5IONF0PgbcDu+y0ESxQYREQEREBERAREQEREBERARfTGE4BdDGNbiaoNbYUhN3QfdbQy9penJYZMGbsONao4EmbcO3OiAHX6YbUL7uj+6rLyDq48KURpAEjj+5VQC25XHYgbfrhsWGAjWw41R4J1cOFKoMllyo5IGX6lYYCDN2HdHgkzbh2QGvv0NNqF93RWXkGjce1EaQBJ2Pf1QC25UV2IGXtL90WGAjWw71RwJM24dudEBrr9DTasRDLRIn819PIOrj2ojSAJOx7+qD4iWbce60uYRiF0MBGth3qskkmYw/exByIustacBPlRa3QW4TIPGvyQaEW91nl7QWPw53hBpRbhZydo7p5FZFwQaUXSYDRiSshu1rRLf8APFBoZDJwC2CEAZEzO4LbEde1T9FgESkdb67KoPqJo1HKWxfIZe0lhgIq7DujgSZtw7eiA11+hptQvu6P7qsvIOrj2ojSAJOx7+qAW3KiuxAy9pfuiwwEa2HeqOBJmMO3OiAHX6Gm1C65QV2rLzPVx7IwgUdj3QfVp1eqWfVREGqy49PskfW7IiDZasOv3WYGr3REGuy49FiPrdkRBstWHX7rMHV7rKINVlx6LEXX7IiDZasBzWYOp3+qyiDVZcTyWIuv2+iIg2WrAc1mHqdD9URB8WXEr5fr9R9ERBttOr1Sz6vdZRBpsuPT7JH1uyIg2WrDqswdTuiINdlxPJYtOt0REH//2Q==' }
41
41
 
42
- form.spacer height: 16
43
- form.label text: 'Simple file upload'
44
- form.spacer height: 8
45
- form.fields_multiUpload \
46
- name: 'user[multi][]',
47
- id: 'upload_1',
48
- width: 360,
49
- accepts: {
50
- fileType: 'image',
51
- maxFileSize: 100,
52
- maxFileLength: 2,
53
- maxFileLengthErrorText: {
54
- body: 'try with a smaller number of files',
55
- button: 'OK'
56
- }
57
- },
58
- directUploadUrl: glib_direct_uploads_url,
59
- uploadTitle: 'Files uploaded:',
60
- storagePrefix: 'glib',
61
- metadata: {
62
- foo: 'bar',
63
- zoo: 'baz'
64
- },
65
- # tagging: 'key=value&key1=value1',
66
- tags: { key: 'value', key1: 'value1' },
67
- files: [
68
- { name: 'File (Example)', signed_id: ActiveStorage::Attachment.first&.signed_id }
69
- ]
70
- form.button text: 'Clear files', onClick: ->(action) do
71
- action.components_set targetId: 'upload_1', data: { files: [], value: nil }
72
- end
73
-
74
- form.spacer height: 16
75
- form.label text: 'File upload with onFinishUpload'
76
- form.spacer height: 8
77
- form.fields_multiUpload \
78
- name: 'user[multi2][]',
79
- id: 'upload_2',
80
- width: 360,
81
- accepts: {
82
- fileType: 'image',
83
- maxFileSize: 5000
84
- },
85
- directUploadUrl: glib_direct_uploads_url,
86
- uploadTitle: 'Files uploaded:',
87
- onFinishUpload: ->(action) { action.forms_submit }
88
- form.button text: 'Populate files', onClick: ->(action) do
89
- action.components_set targetId: 'upload_2', data: {
90
- files: [
91
- { name: 'File (Example)', signed_id: ActiveStorage::Attachment.last&.signed_id }
92
- ],
93
- value: [1]
94
- }
95
- end
96
-
97
- form.spacer height: 16
98
- form.label text: 'File upload without directUploadUrl'
99
- form.spacer height: 8
100
- form.fields_multiUpload \
101
- name: 'user[multi3][]',
102
- width: 360,
103
- accepts: { fileType: 'image', maxFileSize: 100, maxFileLength: 2 },
104
- uploadTitle: 'Files uploaded:',
105
- onFinishUpload: ->(action) { action.forms_submit }
106
-
107
42
  form.spacer height: 16
108
43
  form.label text: 'Sign'
109
44
  form.spacer height: 8
@@ -18,7 +18,6 @@ nav_groups = {
18
18
  'snackbars',
19
19
  'storage_items',
20
20
  'timeouts',
21
- 'window',
22
21
  'windows'
23
22
  ],
24
23
  'Forms' => [
@@ -26,14 +25,22 @@ nav_groups = {
26
25
  'dirty_state',
27
26
  'fields_select',
28
27
  'fields_dynamicSelect',
28
+ 'fields_date_time',
29
+ 'fields_location',
30
+ 'fields_phone',
31
+ 'fields_otp',
32
+ 'fields_rating',
33
+ 'fields_richText',
29
34
  'fields_sign',
35
+ 'fields_stripeToken',
36
+ 'fields_stripeExternalAccount',
37
+ 'fields_creditCard',
30
38
  'fields_timer',
31
39
  'fields_upload',
32
40
  'fields_url_fragment',
33
41
  'fields_captcha',
34
42
  'form',
35
43
  'form_dynamic',
36
- 'multiupload',
37
44
  'selectable'
38
45
  ],
39
46
  'Lists' => [
@@ -107,6 +107,43 @@ page.body(
107
107
  )
108
108
  end
109
109
  )
110
+
111
+ res.spacer height: 16
112
+ res.hr width: 'matchParent'
113
+ res.spacer height: 16
114
+
115
+ res.h2 text: 'auth/restart'
116
+ res.spacer height: 8
117
+ res.button(
118
+ text: 'auth/restart',
119
+ onClick: ->(action) do
120
+ action.auth_restart
121
+ end
122
+ )
123
+
124
+ res.spacer height: 16
125
+ res.hr width: 'matchParent'
126
+ res.spacer height: 16
127
+
128
+ res.h2 text: 'auth/creditCard'
129
+ res.label text: 'Requires a Stripe public key and a client secret from your server.'
130
+ res.spacer height: 8
131
+ res.button(
132
+ text: 'auth/creditCard (setup only)',
133
+ onClick: ->(action) do
134
+ action.auth_creditCard(
135
+ publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx',
136
+ clientSecret: 'set_your_client_secret',
137
+ setupOnly: true,
138
+ onSuccess: ->(subaction) do
139
+ subaction.snackbars_alert message: 'Card setup succeeded', styleClass: 'success'
140
+ end,
141
+ onFailure: ->(subaction) do
142
+ subaction.snackbars_alert message: 'Card setup failed', styleClass: 'danger'
143
+ end
144
+ )
145
+ end
146
+ )
110
147
  end
111
148
  )
112
149
  end
@@ -92,6 +92,7 @@ page.body(
92
92
  onClick: ->(action) do
93
93
  action.browsers_setLocation(
94
94
  url: json_ui_garage_url(path: 'forms/generic_post_all'),
95
+ replace: true,
95
96
  onSet: ->(set) do
96
97
  set.runMultiple(
97
98
  childActions: ->(multi) do
@@ -4,35 +4,132 @@ json.title 'Test Page (Form)'
4
4
 
5
5
  page = json_ui_page json
6
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: 'Dialog'
12
- res.spacer height: 8
13
- res.button text: 'Dialog updateExisting', onClick: ->(action) do
14
- action.runMultiple childActions: ->(saction) do
15
- saction.dialogs_show content: ->(dialog) do
16
- dialog.body padding: glib_json_padding_body, childViews: ->(sbody) do
17
- sbody.h1 text: 'Hello world'
18
- sbody.button text: 'change dialog content', onClick: ->(ssaction) do
19
- ssaction.dialogs_show updateExisting: true, disableCloseButton: true, content: ->(sdialog) do
20
- sdialog.body padding: glib_json_padding_body, childViews: ->(ssbody) do
21
- ssbody.h1 text: 'Hello world (updated)'
22
- ssbody.spacer height: 8
23
- ssbody.button text: 'close', onClick: ->(xaction) do
24
- xaction.dialogs_close
7
+ page.body(
8
+ childViews: ->(body) do
9
+ render 'json_ui/garage/test_page/header', view: body
10
+ body.panels_responsive(
11
+ padding: glib_json_padding_body,
12
+ childViews: ->(res) do
13
+ res.h2 text: 'Dialog'
14
+ res.spacer height: 8
15
+ res.button(
16
+ text: 'Dialog updateExisting',
17
+ onClick: ->(action) do
18
+ action.runMultiple(
19
+ childActions: ->(saction) do
20
+ saction.dialogs_show(
21
+ content: ->(dialog) do
22
+ dialog.body(
23
+ padding: glib_json_padding_body,
24
+ childViews: ->(sbody) do
25
+ sbody.h1 text: 'Hello world'
26
+ sbody.button(
27
+ text: 'change dialog content',
28
+ onClick: ->(ssaction) do
29
+ ssaction.dialogs_show(
30
+ updateExisting: true,
31
+ disableCloseButton: true,
32
+ content: ->(sdialog) do
33
+ sdialog.body(
34
+ padding: glib_json_padding_body,
35
+ childViews: ->(ssbody) do
36
+ ssbody.h1 text: 'Hello world (updated)'
37
+ ssbody.spacer height: 8
38
+ ssbody.button(
39
+ text: 'close',
40
+ onClick: ->(xaction) do
41
+ xaction.dialogs_close
42
+ end
43
+ )
44
+ end
45
+ )
46
+ end
47
+ )
48
+ end
49
+ )
50
+ end
51
+ )
25
52
  end
26
- end
53
+ )
27
54
  end
55
+ )
56
+ end
57
+ )
58
+ res.spacer height: 4
59
+ res.button(
60
+ text: 'Dialog open',
61
+ onClick: ->(action) do
62
+ action.dialogs_open url: json_ui_garage_url(path: 'test_page/dialog_open')
63
+ end
64
+ )
65
+ res.spacer height: 4
66
+ res.button(
67
+ text: 'Dialog closeAll',
68
+ onClick: ->(action) do
69
+ action.runMultiple childActions: ->(saction) do
70
+ saction.dialogs_open url: json_ui_garage_url(path: 'test_page/dialog_open')
71
+ saction.dialogs_open url: json_ui_garage_url(path: 'test_page/dialog_open')
72
+ saction.timeouts_set interval: 800, onTimeout: ->(ssaction) do
73
+ ssaction.dialogs_closeAll
74
+ end
75
+ end
76
+ end
77
+ )
78
+ res.spacer height: 4
79
+ res.button(
80
+ text: 'Dialog reload',
81
+ onClick: ->(action) do
82
+ action.runMultiple childActions: ->(saction) do
83
+ saction.dialogs_open url: json_ui_garage_url(path: 'test_page/dialog_open')
84
+ saction.timeouts_set interval: 800, onTimeout: ->(ssaction) do
85
+ ssaction.dialogs_reload
86
+ end
87
+ end
88
+ end
89
+ )
90
+ res.spacer height: 4
91
+ res.button(
92
+ text: 'Dialog notification',
93
+ onClick: ->(action) do
94
+ action.dialogs_notification(
95
+ title: 'Hello World',
96
+ message: 'This is a notification',
97
+ onClick: ->(subaction) do
98
+ subaction.dialogs_alert message: 'Perform action'
99
+ end
100
+ )
101
+ end
102
+ )
103
+ res.spacer height: 4
104
+ res.button(
105
+ text: 'Dialog oauth',
106
+ onClick: ->(action) do
107
+ if respond_to?(:user_facebook_omniauth_authorize_url)
108
+ provider = {
109
+ name: 'facebook',
110
+ webRequestUrl: user_facebook_omniauth_authorize_url(format: nil, _render: nil),
111
+ requestUrl: user_facebook_omniauth_authorize_url(format: nil),
112
+ clientId: Devise.omniauth_configs[:facebook].strategy[:client_id],
113
+ permissions: Devise.omniauth_configs[:facebook].strategy[:scope],
114
+ redirectUrl: user_facebook_omniauth_callback_url(format: nil)
115
+ }
116
+ action.dialogs_oauth(
117
+ provider: provider,
118
+ providerParamName: 'session[oauth_provider]',
119
+ callbackUrlParamName: 'session[[oauth_callback_url]',
120
+ onSuccess: ->(subaction) do
121
+ subaction.http_post(
122
+ url: json_ui_garage_url(path: 'actions/dialogs_oauth_post'),
123
+ formData: { authenticity_token: form_authenticity_token }
124
+ )
125
+ end
126
+ )
127
+ else
128
+ action.dialogs_alert message: 'To enable this, set up omniauth using devise'
28
129
  end
29
130
  end
30
- end
131
+ )
31
132
  end
32
- end
33
- res.spacer height: 4
34
- res.button text: 'Dialog open', onClick: ->(action) do
35
- action.dialogs_open url: json_ui_garage_url(path: 'test_page/dialog_open')
36
- end
133
+ )
37
134
  end
38
- end
135
+ )
@@ -28,11 +28,6 @@ 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
-
36
31
  form.spacer height: 24
37
32
  form.panels_split width: 'matchParent', content: ->(split) do
38
33
  split.left childViews: ->(left) do
@@ -0,0 +1,118 @@
1
+ json.title 'Test Page (Fields Credit Card)'
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 Credit Card'
13
+ res.spacer height: 8
14
+ res.label text: 'Credit card entry with tokenization for payment 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_creditCard to capture card number, expiry, and CVC securely.'
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_creditCard(
31
+ id: 'credit_card_basic',
32
+ name: 'user[credit_card_token]',
33
+ width: 'matchParent',
34
+ label: 'Card details',
35
+ publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx',
36
+ onChange: ->(action) do
37
+ action.logics_set targetId: 'credit_card_status', data: { text: 'Status: card updated' }
38
+ end
39
+ )
40
+ # form.spacer height: 8
41
+ # form.label id: 'credit_card_status', text: 'Status: idle'
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 text: 'Swap between style variants on the same component.'
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: 'Default',
57
+ # onClick: ->(action) do
58
+ # action.components_set targetId: 'credit_card_basic', data: { styleClass: nil, label: 'Card details', hint: nil }
59
+ # end
60
+ # )
61
+ # flow.spacer width: 8
62
+ # flow.button(
63
+ # text: 'Outlined',
64
+ # onClick: ->(action) do
65
+ # action.components_set targetId: 'credit_card_basic', data: { styleClass: 'outlined', label: 'Outlined card' }
66
+ # end
67
+ # )
68
+ # flow.spacer width: 8
69
+ # flow.button(
70
+ # text: 'Individual',
71
+ # onClick: ->(action) do
72
+ # action.components_set targetId: 'credit_card_basic', data: { styleClass: 'individual', label: 'Personal card', hint: 'Use a personal card' }
73
+ # end
74
+ # )
75
+ # end
76
+ # )
77
+
78
+ # form.spacer height: 12
79
+ # form.hr width: 'matchParent'
80
+ # form.spacer height: 12
81
+
82
+ # form.h2 text: 'Edge/advanced'
83
+ # form.spacer height: 8
84
+ # form.panels_flow(
85
+ # innerPadding: { bottom: 0 },
86
+ # width: 'matchParent',
87
+ # childViews: ->(flow) do
88
+ # flow.button(
89
+ # text: 'Disable field',
90
+ # onClick: ->(action) do
91
+ # action.components_set targetId: 'credit_card_basic', data: { disabled: true }
92
+ # end
93
+ # )
94
+ # flow.spacer width: 8
95
+ # flow.button(
96
+ # text: 'Enable field',
97
+ # onClick: ->(action) do
98
+ # action.components_set targetId: 'credit_card_basic', data: { disabled: nil }
99
+ # end
100
+ # )
101
+ # flow.spacer width: 8
102
+ # flow.button(
103
+ # text: 'Clear hint',
104
+ # onClick: ->(action) do
105
+ # action.components_set targetId: 'credit_card_basic', data: { hint: nil }
106
+ # end
107
+ # )
108
+ # end
109
+ # )
110
+
111
+ form.spacer height: 12
112
+ form.fields_submit text: 'Submit'
113
+ end
114
+ )
115
+ end
116
+ )
117
+ end
118
+ )