glib-web 4.40.0 → 4.41.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd0efe0c2aa42dbfd2131c020d25f47d543796e865c775073acd3218ad966f4e
4
- data.tar.gz: dc82d410b14230f797865e9ac1d484e21345f809796cf20867e9582de4ed739d
3
+ metadata.gz: c3c5782b7132ed122204cc3314927ada0e3804ea47ee795c34d6311a959580b6
4
+ data.tar.gz: ca30770101141a9388bb11ef182a6c554ada7cc1ba88b068f7e3e0ef130425f6
5
5
  SHA512:
6
- metadata.gz: d5bebe2d5a905aa416fc6c308ac3f66b36f5b2b700a833828c0e1b582fa94627930b9fab8d5a1cf40f39f727f4b0182492b89f48c51ae91fb2fe37d8f6b20d0e
7
- data.tar.gz: 624b7523faf66fc74b11df5199f17ba580bbc405cdd5f934c56019c9480e12e1bca3f3f055f59c92250179dcd3af5b9d63b5cdcf0f0030abf4a2f5b46b92791a
6
+ metadata.gz: eef32c78bfbd00ae4082fbd0069b7a92045d253411dc70cd2a82a6218f6b59984362652e63c9ad64bbad0d26bef567a23f7e9d3edfca125d97eb8cd2e6379529
7
+ data.tar.gz: 84039000106e73c327d049234261c182d099e5f66412138ea7e5cd3abe4921898c5ba4c72640acc2cbf7036955d0a6c6b9994c66b7ca77b3512693ca9f3418b1
@@ -7,6 +7,7 @@ class Glib::JsonUi::ActionBuilder
7
7
  # @note Does not support markdown formatting. For markdown support, use dialogs/show with a custom body instead.
8
8
  string :message
9
9
 
10
+ action :onOpen
10
11
  action :onLoad
11
12
  action :onClose
12
13
  singleton_array :styleClass, :styleClasses
@@ -20,6 +21,7 @@ class Glib::JsonUi::ActionBuilder
20
21
  length :width
21
22
  bool :closeOnBlur
22
23
  bool :updateExisting
24
+ action :onShow
23
25
  action :onClose
24
26
  singleton_array :styleClass, :styleClasses
25
27
 
@@ -42,6 +44,7 @@ class Glib::JsonUi::ActionBuilder
42
44
  length :height
43
45
  bool :closeOnBlur
44
46
  bool :updateExisting
47
+ action :onOpen
45
48
  action :onClose
46
49
  singleton_array :styleClass, :styleClasses
47
50
  end
@@ -848,6 +848,38 @@ class Glib::JsonUi::ViewBuilder
848
848
  # hash :placeholderView
849
849
  # end
850
850
 
851
+ # Supported format https://vuetifyjs.com/en/features/dates/#format-options
852
+ DATE_FORMAT_OPTIONS = %i[
853
+ fullDate
854
+ fullDateWithWeekday
855
+ normalDate
856
+ normalDateWithWeekday
857
+ shortDate
858
+ year
859
+ month
860
+ monthShort
861
+ monthAndYear
862
+ monthAndDate
863
+ weekday
864
+ weekdayShort
865
+ dayOfMonth
866
+ hours12h
867
+ hours24h
868
+ minutes
869
+ seconds
870
+ fullTime
871
+ fullTime12h
872
+ fullTime24h
873
+ fullDateTime
874
+ fullDateTime12h
875
+ fullDateTime24h
876
+ keyboardDate
877
+ keyboardDateTime
878
+ keyboardDateTime12h
879
+ keyboardDateTime24h
880
+ glibDate
881
+ ].freeze
882
+
851
883
  class Date < AbstractField
852
884
  date :min
853
885
  date :max
@@ -859,6 +891,7 @@ class Glib::JsonUi::ViewBuilder
859
891
  bool :buttonTemplate # TODO: Remove
860
892
  hash :template, required: [:type]
861
893
  string :time_zone
894
+ enum :format, options: DATE_FORMAT_OPTIONS
862
895
 
863
896
  # Override
864
897
  def value(value)
@@ -873,6 +906,7 @@ class Glib::JsonUi::ViewBuilder
873
906
  date_time :max
874
907
  bool :clearable
875
908
  string :time_zone
909
+ enum :format, options: DATE_FORMAT_OPTIONS
876
910
 
877
911
  bool :buttonTemplate # TODO: Remove
878
912
  hash :template, required: [:type]
@@ -5,9 +5,14 @@ end
5
5
 
6
6
  section.rows builder: ->(template) do
7
7
  template.thumbnail title: 'dialogs/alert', onClick: ->(action) do
8
- action.dialogs_alert message: 'This is an alert dialog', onClose: ->(subaction) do
9
- subaction.snackbars_alert message: 'Closed'
10
- end
8
+ action.dialogs_alert \
9
+ message: 'This is an alert dialog',
10
+ onOpen: ->(subaction) do
11
+ subaction.snackbars_alert message: 'Opened'
12
+ end,
13
+ onClose: ->(subaction) do
14
+ subaction.snackbars_alert message: 'Closed'
15
+ end
11
16
  end
12
17
 
13
18
  # markdown = '# h1 Heading' + "\n" +
@@ -60,60 +65,109 @@ section.rows builder: ->(template) do
60
65
  res.skeleton template: 'commentList'
61
66
  end
62
67
  end,
68
+ onOpen: ->(saction) do
69
+ saction.snackbars_alert message: 'Opened'
70
+ end,
63
71
  onClose: ->(saction) do
64
72
  saction.snackbars_alert message: 'dialog closed'
65
73
  end
66
74
  end
67
75
 
68
76
  template.thumbnail title: 'dialogs/open (fullscreen on mobile)', onClick: ->(action) do
69
- action.dialogs_open fullscreen: 'mobile', url: json_ui_garage_url(path: 'forms/basic', mode: 'dialog')
77
+ action.dialogs_open \
78
+ fullscreen: 'mobile',
79
+ url: json_ui_garage_url(path: 'forms/basic', mode: 'dialog'),
80
+ onOpen: ->(saction) do
81
+ saction.snackbars_alert message: 'Opened'
82
+ end
70
83
  end
71
84
 
72
85
  template.thumbnail title: 'dialogs/reload (without url)', onClick: ->(action) do
73
86
  action.runMultiple childActions: ->(saction) do
74
- saction.dialogs_open url: json_ui_garage_url(path: 'forms/dialogs_form')
75
- saction.timeouts_set interval: 1000, onTimeout: ->(ssaction) do
76
- ssaction.dialogs_reload onReload: ->(xaction) do
77
- xaction.snackbars_alert message: 'reload!'
87
+ saction.dialogs_open \
88
+ url: json_ui_garage_url(path: 'forms/dialogs_form'),
89
+ onOpen: ->(ssaction) do
90
+ ssaction.snackbars_alert message: 'Opened'
78
91
  end
92
+ saction.timeouts_set interval: 1000, onTimeout: ->(ssaction) do
93
+ ssaction.dialogs_reload \
94
+ onReload: ->(xaction) do
95
+ xaction.snackbars_alert message: 'reload!'
96
+ end
79
97
  end
80
98
  end
81
99
  end
82
100
 
83
101
  if !Rails.env.test? # Prevent test failure
84
102
  template.thumbnail title: 'dialogs/open (page with error)', onClick: ->(action) do
85
- action.dialogs_open url: json_ui_garage_url(path: 'forms/non_existent', mode: 'dialog')
103
+ action.dialogs_open \
104
+ url: json_ui_garage_url(path: 'forms/non_existent', mode: 'dialog'),
105
+ onOpen: ->(saction) do
106
+ saction.snackbars_alert message: 'Opened'
107
+ end
86
108
  end
87
109
  end
88
110
 
89
111
  template.thumbnail title: 'dialogs/open (page with dialogs/close)', onClick: ->(action) do
90
- action.dialogs_open url: json_ui_garage_url(path: 'forms/dialogs_close', mode: 'dialog')
112
+ action.dialogs_open \
113
+ url: json_ui_garage_url(path: 'forms/dialogs_close', mode: 'dialog'),
114
+ onOpen: ->(saction) do
115
+ saction.snackbars_alert message: 'Opened'
116
+ end
91
117
  end
92
118
 
93
119
  template.thumbnail title: 'dialogs/open (page with dialogs/show with updateExisting)', onClick: ->(action) do
94
- action.dialogs_open url: json_ui_garage_url(path: 'forms/dialogs_update', mode: 'dialog')
120
+ action.dialogs_open \
121
+ url: json_ui_garage_url(path: 'forms/dialogs_update', mode: 'dialog'),
122
+ onOpen: ->(saction) do
123
+ saction.snackbars_alert message: 'Opened'
124
+ end
95
125
  end
96
126
 
97
127
  template.thumbnail title: 'dialogs/open (page with dialogs/open with updateExisting)', onClick: ->(action) do
98
- action.dialogs_open url: json_ui_garage_url(path: 'forms/dialogs_update2')
128
+ action.dialogs_open \
129
+ url: json_ui_garage_url(path: 'forms/dialogs_update2'),
130
+ onOpen: ->(saction) do
131
+ saction.snackbars_alert message: 'Opened'
132
+ end
99
133
  end
100
134
 
101
135
  template.thumbnail title: 'dialogs/open (update form inside dialog)', onClick: ->(action) do
102
- action.dialogs_open url: json_ui_garage_url(path: 'forms/dialogs_form')
136
+ action.dialogs_open \
137
+ url: json_ui_garage_url(path: 'forms/dialogs_form'),
138
+ onOpen: ->(saction) do
139
+ saction.snackbars_alert message: 'Opened'
140
+ end
103
141
  end
104
142
 
105
143
  template.thumbnail title: 'dialogs/open (with filePaster)', onClick: ->(action) do
106
- action.dialogs_open url: json_ui_garage_url(path: 'forms/dialogs_update3')
144
+ action.dialogs_open \
145
+ url: json_ui_garage_url(path: 'forms/dialogs_update3'),
146
+ onOpen: ->(saction) do
147
+ saction.snackbars_alert message: 'Opened'
148
+ end
107
149
  end
108
150
 
109
151
  template.thumbnail title: 'dialogs/open (update form inside dialog)', onClick: ->(action) do
110
- action.dialogs_open url: json_ui_garage_url(path: 'forms/dialogs_form')
152
+ action.dialogs_open \
153
+ url: json_ui_garage_url(path: 'forms/dialogs_form'),
154
+ onOpen: ->(saction) do
155
+ saction.snackbars_alert message: 'Opened'
156
+ end
111
157
  end
112
158
 
113
159
  template.thumbnail title: 'dialogs/closeAll', onClick: ->(action) do
114
160
  action.runMultiple childActions: ->(saction) do
115
- saction.dialogs_open url: json_ui_garage_url(path: 'forms/dialogs_form')
116
- saction.dialogs_open url: json_ui_garage_url(path: 'forms/dialogs_form')
161
+ saction.dialogs_open \
162
+ url: json_ui_garage_url(path: 'forms/dialogs_form'),
163
+ onOpen: ->(ssaction) do
164
+ ssaction.snackbars_alert message: 'Opened'
165
+ end
166
+ saction.dialogs_open \
167
+ url: json_ui_garage_url(path: 'forms/dialogs_form'),
168
+ onOpen: ->(ssaction) do
169
+ ssaction.snackbars_alert message: 'Opened'
170
+ end
117
171
  saction.timeouts_set interval: 1000, onTimeout: ->(ssaction) do
118
172
  ssaction.dialogs_closeAll
119
173
  end
@@ -32,9 +32,18 @@ if (update_existing = local_assigns[:update_existing])
32
32
  options[:updateExisting] = update_existing
33
33
  end
34
34
 
35
+ dialog_mode_sym = (local_assigns[:dialog_mode] || :show).to_sym
36
+ dialog_callback_message = dialog_mode_sym == :reload ? 'onReload' : 'onShow'
37
+
38
+ if dialog_mode_sym == :reload
39
+ options[:onReload] = ->(action) { action.snackbars_alert message: dialog_callback_message }
40
+ else
41
+ options[:onShow] = ->(action) { action.snackbars_alert message: dialog_callback_message }
42
+ end
43
+
35
44
  include_form = local_assigns[:include_form]
36
45
 
37
- action.send "dialogs_#{dialog_mode}", **options,
46
+ action.send "dialogs_#{dialog_mode_sym}", **options,
38
47
  onClose: ->(action) { action.snackbars_alert message: 'dialog closed' },
39
48
  content: ->(dialog) do
40
49
  dialog.body padding: glib_json_padding_body, childViews: ->(body) do
@@ -78,6 +78,19 @@ page.form \
78
78
  max: '2021-03-01',
79
79
  value: '2021-11'
80
80
 
81
+ form.spacer height: 8
82
+ form.fields_date \
83
+ name: 'user[formatted_date]',
84
+ width: 'matchParent',
85
+ label: 'Date (formatted)',
86
+ placeholder: 'Select Date'
87
+ form.fields_datetime \
88
+ name: 'user[formatted_date_time]',
89
+ width: 'matchParent',
90
+ label: 'Date Time (formatted)',
91
+ format: 'keyboardDateTime12h',
92
+ placeholder: 'Select Date'
93
+
81
94
  if record.present?
82
95
  form.fields_datetime \
83
96
  prop: :created_at,
@@ -113,4 +113,8 @@ page.form \
113
113
  form.spacer height: 8
114
114
  form.fields_submit text: 'Submit'
115
115
  form.fields_submit text: 'Submit (disable if form invalid)', disableIfFormInvalid: true
116
+ form.spacer height: 8
117
+ form.button styleClass: 'link', text: 'Cancel', onClick: ->(action) do
118
+ action.http_get url: json_ui_garage_url(path: 'forms/index')
119
+ end
116
120
  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.40.0
4
+ version: 4.41.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''