avo 1.21.1.pre.1 → 1.22.1.pre.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of avo might be problematic. Click here for more details.

Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +61 -61
  3. data/README.md +1 -1
  4. data/app/assets/builds/avo.css +4 -4
  5. data/app/assets/builds/avo.js +40 -18
  6. data/app/assets/builds/avo.js.map +2 -2
  7. data/app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb +14 -7
  8. data/app/components/avo/fields/belongs_to_field/autocomplete_component.rb +54 -10
  9. data/app/components/avo/fields/belongs_to_field/edit_component.html.erb +31 -8
  10. data/app/components/avo/fields/belongs_to_field/edit_component.rb +37 -0
  11. data/app/components/avo/fields/select_field/edit_component.html.erb +3 -3
  12. data/app/components/avo/navigation_link_component.html.erb +1 -1
  13. data/app/components/avo/navigation_link_component.rb +2 -1
  14. data/app/controllers/avo/application_controller.rb +16 -14
  15. data/app/controllers/avo/base_controller.rb +2 -4
  16. data/app/controllers/avo/relations_controller.rb +1 -4
  17. data/app/javascript/avo.js +1 -0
  18. data/app/javascript/js/controllers/fields/belongs_to_field_controller.js +23 -15
  19. data/app/javascript/js/controllers/fields/date_field_controller.js +10 -2
  20. data/app/javascript/js/controllers/item_selector_controller.js +29 -19
  21. data/app/javascript/js/controllers/search_controller.js +8 -3
  22. data/app/views/avo/partials/_logo.html.erb +3 -1
  23. data/app/views/avo/partials/_turbo_frame_wrap.html.erb +7 -1
  24. data/app/views/avo/relations/new.html.erb +1 -1
  25. data/app/views/avo/sidebar/_sidebar.html.erb +1 -3
  26. data/db/factories.rb +9 -5
  27. data/lib/avo/base_resource.rb +16 -14
  28. data/lib/avo/fields/base_field.rb +7 -4
  29. data/lib/avo/fields/belongs_to_field.rb +92 -11
  30. data/lib/avo/fields/key_value_field.rb +28 -8
  31. data/lib/avo/version.rb +1 -1
  32. data/lib/generators/avo/templates/locales/avo.en.yml +1 -0
  33. data/lib/generators/avo/templates/locales/avo.nb-NO.yml +1 -0
  34. data/lib/generators/avo/templates/locales/avo.pt-BR.yml +1 -0
  35. data/lib/generators/avo/templates/locales/avo.ro.yml +1 -0
  36. data/public/avo-assets/avo.css +4 -4
  37. data/public/avo-assets/avo.js +40 -18
  38. data/public/avo-assets/avo.js.map +2 -2
  39. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e78eb8560841b7427b02bd8ec702762d50211df5f1dc12e73ea2f002ffa26006
4
- data.tar.gz: '08f1502ed0e5d5be5d93ab466317a789a978ce6a9c6220536e14776833984723'
3
+ metadata.gz: 5f3877093b6d069865155c2f545765fbf70abec721d0795e87894979c80c29a6
4
+ data.tar.gz: c7df311af825024a23ee29dadf8e2ee427a7e6ba162ef3e7d29d419164afcc23
5
5
  SHA512:
6
- metadata.gz: '09e9d276e94cce4ce299cafe4d99767a27481b3fd375bef413b4a20c1701db4fa21bb483c4015ac1f18392620439aeb9d4369ca1706b880634b760b91ddbcc1c'
7
- data.tar.gz: b935e3dfa5adc7e243989b95e0e8ada16ea7f22b643ee3892b3e9a8dcb9ea8e1ea4535af8871370a80e5df5d33571a24fb4ea01450e4821626a532410b28838e
6
+ metadata.gz: 94fab6c8ddef7e55d5c2f659c3ffecec573839a25d4171c389355b677b92ff922ad1ffe5d5bd2c907bcabddaaa5b1696572f315588cebc28702a94d844dd959d
7
+ data.tar.gz: d813448938980e0f16f62dc5bf9688da849849b8f2e3b141b9fcb27dc098bf0128fabffb8d35faca9b01f6831aca92d0d585e6a69c639d09299f991907ac757d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (1.21.1.pre.1)
4
+ avo (1.22.1.pre.2)
5
5
  active_link_to
6
6
  addressable
7
7
  breadcrumbs_on_rails
@@ -19,40 +19,40 @@ PATH
19
19
  GEM
20
20
  remote: https://rubygems.org/
21
21
  specs:
22
- actioncable (6.1.4.4)
23
- actionpack (= 6.1.4.4)
24
- activesupport (= 6.1.4.4)
22
+ actioncable (6.1.4.6)
23
+ actionpack (= 6.1.4.6)
24
+ activesupport (= 6.1.4.6)
25
25
  nio4r (~> 2.0)
26
26
  websocket-driver (>= 0.6.1)
27
- actionmailbox (6.1.4.4)
28
- actionpack (= 6.1.4.4)
29
- activejob (= 6.1.4.4)
30
- activerecord (= 6.1.4.4)
31
- activestorage (= 6.1.4.4)
32
- activesupport (= 6.1.4.4)
27
+ actionmailbox (6.1.4.6)
28
+ actionpack (= 6.1.4.6)
29
+ activejob (= 6.1.4.6)
30
+ activerecord (= 6.1.4.6)
31
+ activestorage (= 6.1.4.6)
32
+ activesupport (= 6.1.4.6)
33
33
  mail (>= 2.7.1)
34
- actionmailer (6.1.4.4)
35
- actionpack (= 6.1.4.4)
36
- actionview (= 6.1.4.4)
37
- activejob (= 6.1.4.4)
38
- activesupport (= 6.1.4.4)
34
+ actionmailer (6.1.4.6)
35
+ actionpack (= 6.1.4.6)
36
+ actionview (= 6.1.4.6)
37
+ activejob (= 6.1.4.6)
38
+ activesupport (= 6.1.4.6)
39
39
  mail (~> 2.5, >= 2.5.4)
40
40
  rails-dom-testing (~> 2.0)
41
- actionpack (6.1.4.4)
42
- actionview (= 6.1.4.4)
43
- activesupport (= 6.1.4.4)
41
+ actionpack (6.1.4.6)
42
+ actionview (= 6.1.4.6)
43
+ activesupport (= 6.1.4.6)
44
44
  rack (~> 2.0, >= 2.0.9)
45
45
  rack-test (>= 0.6.3)
46
46
  rails-dom-testing (~> 2.0)
47
47
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
48
- actiontext (6.1.4.4)
49
- actionpack (= 6.1.4.4)
50
- activerecord (= 6.1.4.4)
51
- activestorage (= 6.1.4.4)
52
- activesupport (= 6.1.4.4)
48
+ actiontext (6.1.4.6)
49
+ actionpack (= 6.1.4.6)
50
+ activerecord (= 6.1.4.6)
51
+ activestorage (= 6.1.4.6)
52
+ activesupport (= 6.1.4.6)
53
53
  nokogiri (>= 1.8.5)
54
- actionview (6.1.4.4)
55
- activesupport (= 6.1.4.4)
54
+ actionview (6.1.4.6)
55
+ activesupport (= 6.1.4.6)
56
56
  builder (~> 3.1)
57
57
  erubi (~> 1.4)
58
58
  rails-dom-testing (~> 2.0)
@@ -60,22 +60,22 @@ GEM
60
60
  active_link_to (1.0.5)
61
61
  actionpack
62
62
  addressable
63
- activejob (6.1.4.4)
64
- activesupport (= 6.1.4.4)
63
+ activejob (6.1.4.6)
64
+ activesupport (= 6.1.4.6)
65
65
  globalid (>= 0.3.6)
66
- activemodel (6.1.4.4)
67
- activesupport (= 6.1.4.4)
68
- activerecord (6.1.4.4)
69
- activemodel (= 6.1.4.4)
70
- activesupport (= 6.1.4.4)
71
- activestorage (6.1.4.4)
72
- actionpack (= 6.1.4.4)
73
- activejob (= 6.1.4.4)
74
- activerecord (= 6.1.4.4)
75
- activesupport (= 6.1.4.4)
66
+ activemodel (6.1.4.6)
67
+ activesupport (= 6.1.4.6)
68
+ activerecord (6.1.4.6)
69
+ activemodel (= 6.1.4.6)
70
+ activesupport (= 6.1.4.6)
71
+ activestorage (6.1.4.6)
72
+ actionpack (= 6.1.4.6)
73
+ activejob (= 6.1.4.6)
74
+ activerecord (= 6.1.4.6)
75
+ activesupport (= 6.1.4.6)
76
76
  marcel (~> 1.0.0)
77
77
  mini_mime (>= 1.1.0)
78
- activesupport (6.1.4.4)
78
+ activesupport (6.1.4.6)
79
79
  concurrent-ruby (~> 1.0, >= 1.0.2)
80
80
  i18n (>= 1.6, < 2)
81
81
  minitest (>= 5.1)
@@ -179,7 +179,7 @@ GEM
179
179
  httparty (0.20.0)
180
180
  mime-types (~> 3.0)
181
181
  multi_xml (>= 0.5.2)
182
- i18n (1.9.1)
182
+ i18n (1.10.0)
183
183
  concurrent-ruby (~> 1.0)
184
184
  i18n_data (0.15.0)
185
185
  simple_po_parser (~> 1.1)
@@ -197,7 +197,7 @@ GEM
197
197
  listen (3.7.1)
198
198
  rb-fsevent (~> 0.10, >= 0.10.3)
199
199
  rb-inotify (~> 0.9, >= 0.9.10)
200
- loofah (2.13.0)
200
+ loofah (2.14.0)
201
201
  crass (~> 1.0.2)
202
202
  nokogiri (>= 1.5.9)
203
203
  mail (2.7.1)
@@ -215,7 +215,7 @@ GEM
215
215
  mime-types-data (3.2022.0105)
216
216
  mini_magick (4.11.0)
217
217
  mini_mime (1.1.2)
218
- mini_portile2 (2.7.1)
218
+ mini_portile2 (2.8.0)
219
219
  minitest (5.15.0)
220
220
  msgpack (1.4.4)
221
221
  multi_xml (0.6.0)
@@ -227,10 +227,10 @@ GEM
227
227
  net-protocol
228
228
  timeout
229
229
  nio4r (2.5.8)
230
- nokogiri (1.13.1)
231
- mini_portile2 (~> 2.7.0)
230
+ nokogiri (1.13.3)
231
+ mini_portile2 (~> 2.8.0)
232
232
  racc (~> 1.4)
233
- nokogiri (1.13.1-x86_64-linux)
233
+ nokogiri (1.13.3-x86_64-linux)
234
234
  racc (~> 1.4)
235
235
  orm_adapter (0.5.0)
236
236
  pagy (5.10.1)
@@ -242,26 +242,26 @@ GEM
242
242
  public_suffix (4.0.6)
243
243
  puma (5.6.2)
244
244
  nio4r (~> 2.0)
245
- pundit (2.1.1)
245
+ pundit (2.2.0)
246
246
  activesupport (>= 3.0.0)
247
247
  racc (1.6.0)
248
248
  rack (2.2.3)
249
249
  rack-test (1.1.0)
250
250
  rack (>= 1.0, < 3)
251
- rails (6.1.4.4)
252
- actioncable (= 6.1.4.4)
253
- actionmailbox (= 6.1.4.4)
254
- actionmailer (= 6.1.4.4)
255
- actionpack (= 6.1.4.4)
256
- actiontext (= 6.1.4.4)
257
- actionview (= 6.1.4.4)
258
- activejob (= 6.1.4.4)
259
- activemodel (= 6.1.4.4)
260
- activerecord (= 6.1.4.4)
261
- activestorage (= 6.1.4.4)
262
- activesupport (= 6.1.4.4)
251
+ rails (6.1.4.6)
252
+ actioncable (= 6.1.4.6)
253
+ actionmailbox (= 6.1.4.6)
254
+ actionmailer (= 6.1.4.6)
255
+ actionpack (= 6.1.4.6)
256
+ actiontext (= 6.1.4.6)
257
+ actionview (= 6.1.4.6)
258
+ activejob (= 6.1.4.6)
259
+ activemodel (= 6.1.4.6)
260
+ activerecord (= 6.1.4.6)
261
+ activestorage (= 6.1.4.6)
262
+ activesupport (= 6.1.4.6)
263
263
  bundler (>= 1.15.0)
264
- railties (= 6.1.4.4)
264
+ railties (= 6.1.4.6)
265
265
  sprockets-rails (>= 2.0.0)
266
266
  rails-controller-testing (1.0.5)
267
267
  actionpack (>= 5.0.1.rc1)
@@ -272,9 +272,9 @@ GEM
272
272
  nokogiri (>= 1.6)
273
273
  rails-html-sanitizer (1.4.2)
274
274
  loofah (~> 2.3)
275
- railties (6.1.4.4)
276
- actionpack (= 6.1.4.4)
277
- activesupport (= 6.1.4.4)
275
+ railties (6.1.4.6)
276
+ actionpack (= 6.1.4.6)
277
+ activesupport (= 6.1.4.6)
278
278
  method_source
279
279
  rake (>= 0.13)
280
280
  thor (~> 1.0)
data/README.md CHANGED
@@ -54,7 +54,7 @@ $ bundle install
54
54
 
55
55
  # Quick Purchase
56
56
 
57
- Use [this](https://buy.stripe.com/9AQ6rX0uIbLF2CQdQQ) link to quickly purchase a Pro license to support this project. Thank you 🙏
57
+ Use [this](https://avohq.io/purchase/pro) link to quickly purchase a Pro license to support this project. Thank you 🙏
58
58
 
59
59
  # Contributing
60
60
 
@@ -6651,6 +6651,10 @@ progress[value]::-moz-progress-bar{
6651
6651
  height:10rem
6652
6652
  }
6653
6653
 
6654
+ .h-16{
6655
+ height:4rem
6656
+ }
6657
+
6654
6658
  .h-full{
6655
6659
  height:100%
6656
6660
  }
@@ -6659,10 +6663,6 @@ progress[value]::-moz-progress-bar{
6659
6663
  height:3rem
6660
6664
  }
6661
6665
 
6662
- .h-16{
6663
- height:4rem
6664
- }
6665
-
6666
6666
  .h-3{
6667
6667
  height:0.75rem
6668
6668
  }
@@ -81101,18 +81101,18 @@
81101
81101
  const { type } = target.dataset;
81102
81102
  if (this.isSearchable) {
81103
81103
  const textInput = target.querySelector('input[type="text"]');
81104
- if (textInput) {
81105
- textInput.setAttribute("valid-name", textInput.getAttribute("name"));
81106
- }
81104
+ if (textInput)
81105
+ this.nameToValidName(textInput);
81107
81106
  const hiddenInput = target.querySelector('input[type="hidden"]');
81108
- if (hiddenInput) {
81109
- hiddenInput.setAttribute("valid-name", hiddenInput.getAttribute("name"));
81110
- }
81107
+ if (hiddenInput)
81108
+ this.nameToValidName(hiddenInput);
81111
81109
  } else {
81112
81110
  const select = target.querySelector("select");
81113
- if (select) {
81114
- select.setAttribute("valid-name", select.getAttribute("name"));
81115
- }
81111
+ if (select)
81112
+ this.nameToValidName(select);
81113
+ const hiddenInput = target.querySelector('input[type="hidden"]');
81114
+ if (hiddenInput)
81115
+ this.nameToValidName(hiddenInput);
81116
81116
  if (this.selectedType !== type) {
81117
81117
  select.selectedIndex = 0;
81118
81118
  }
@@ -81130,11 +81130,15 @@
81130
81130
  if (this.isSearchable) {
81131
81131
  const textInput = target.querySelector('input[type="text"]');
81132
81132
  const hiddenInput = target.querySelector('input[type="hidden"]');
81133
- textInput.setAttribute("name", textInput.getAttribute("valid-name"));
81134
- hiddenInput.setAttribute("name", hiddenInput.getAttribute("valid-name"));
81133
+ this.validNameToName(textInput);
81134
+ this.validNameToName(hiddenInput);
81135
81135
  } else {
81136
81136
  const select = target.querySelector("select");
81137
- select.setAttribute("name", select.getAttribute("valid-name"));
81137
+ const hiddenInput = target.querySelector('input[type="hidden"]');
81138
+ this.validNameToName(select);
81139
+ if (hiddenInput) {
81140
+ this.validNameToName(hiddenInput);
81141
+ }
81138
81142
  }
81139
81143
  }
81140
81144
  invalidateTarget(target) {
@@ -81147,10 +81151,17 @@
81147
81151
  } else if (target) {
81148
81152
  try {
81149
81153
  target.querySelector("select").setAttribute("name", "");
81154
+ target.querySelector('input[type="hidden"]').setAttribute("name", "");
81150
81155
  } catch (error2) {
81151
81156
  }
81152
81157
  }
81153
81158
  }
81159
+ validNameToName(target) {
81160
+ target.setAttribute("name", target.getAttribute("valid-name"));
81161
+ }
81162
+ nameToValidName(target) {
81163
+ target.setAttribute("valid-name", target.getAttribute("name"));
81164
+ }
81154
81165
  };
81155
81166
  __publicField(belongs_to_field_controller_default, "targets", ["select", "type", "loadAssociationLink"]);
81156
81167
 
@@ -83368,6 +83379,9 @@
83368
83379
  var esm_default = flatpickr;
83369
83380
 
83370
83381
  // app/javascript/js/controllers/fields/date_field_controller.js
83382
+ function universalTimestamp(timestampStr) {
83383
+ return new Date(new Date(timestampStr).getTime() + new Date(timestampStr).getTimezoneOffset() * 60 * 1e3);
83384
+ }
83371
83385
  var date_field_controller_default = class extends Controller {
83372
83386
  connect() {
83373
83387
  const options = {
@@ -83393,7 +83407,7 @@
83393
83407
  options.time_24hr = castBoolean(this.inputTarget.dataset.time24hr);
83394
83408
  options.appTimezone = this.inputTarget.dataset.timezone;
83395
83409
  } else {
83396
- currentValue = new Date(this.inputTarget.value);
83410
+ currentValue = universalTimestamp(this.inputTarget.value);
83397
83411
  }
83398
83412
  options.defaultDate = currentValue;
83399
83413
  esm_default(this.inputTarget, options);
@@ -83443,6 +83457,9 @@
83443
83457
  return [];
83444
83458
  }
83445
83459
  }
83460
+ get actionLinks() {
83461
+ return document.querySelectorAll('.js-actions-dropdown a[data-actions-picker-target="resourceAction"]');
83462
+ }
83446
83463
  set currentIds(value) {
83447
83464
  this.stateHolderElement.dataset.selectedResources = JSON.stringify(value);
83448
83465
  if (this.actionsPanelPresent) {
@@ -83476,7 +83493,7 @@
83476
83493
  }
83477
83494
  }
83478
83495
  enableResourceActions() {
83479
- document.querySelectorAll('.js-actions-dropdown a[data-actions-picker-target="resourceAction"]').forEach((link) => {
83496
+ this.actionLinks.forEach((link) => {
83480
83497
  link.classList.add("text-gray-700");
83481
83498
  link.classList.remove("text-gray-500");
83482
83499
  link.setAttribute("data-href", link.getAttribute("href"));
@@ -83484,7 +83501,7 @@
83484
83501
  });
83485
83502
  }
83486
83503
  disableResourceActions() {
83487
- document.querySelectorAll('.js-actions-dropdown a[data-actions-picker-target="resourceAction"]').forEach((link) => {
83504
+ this.actionLinks.forEach((link) => {
83488
83505
  link.classList.remove("text-gray-700");
83489
83506
  link.classList.add("text-gray-500");
83490
83507
  link.setAttribute("href", link.getAttribute("data-href"));
@@ -87339,7 +87356,9 @@
87339
87356
  this.hiddenIdTarget.setAttribute("value", item._id);
87340
87357
  this.buttonTarget.setAttribute("value", item._label);
87341
87358
  document.querySelector(".aa-DetachedOverlay").remove();
87342
- this.clearButtonTarget.classList.remove("hidden");
87359
+ if (this.hasClearButtonTarget) {
87360
+ this.clearButtonTarget.classList.remove("hidden");
87361
+ }
87343
87362
  } else {
87344
87363
  turbo_es2017_esm_exports.visit(item._url, { action: "advance" });
87345
87364
  }
@@ -87398,7 +87417,7 @@
87398
87417
  const that = this;
87399
87418
  this.buttonTarget.onclick = () => this.showSearchPanel();
87400
87419
  this.clearValueTargets.forEach((target) => {
87401
- if (target.getAttribute("value")) {
87420
+ if (target.getAttribute("value") && this.hasClearButtonTarget) {
87402
87421
  this.clearButtonTarget.classList.remove("hidden");
87403
87422
  }
87404
87423
  });
@@ -87418,7 +87437,9 @@
87418
87437
  return that.debouncedFetch(endpoint).then((response) => response.json()).then((data) => Object.keys(data).map((resourceName) => that.addSource(resourceName, data[resourceName])));
87419
87438
  }
87420
87439
  });
87421
- this.buttonTarget.removeAttribute("disabled");
87440
+ if (this.buttonTarget.dataset.shouldBeDisabled !== "true") {
87441
+ this.buttonTarget.removeAttribute("disabled");
87442
+ }
87422
87443
  }
87423
87444
  };
87424
87445
  __publicField(search_controller_default, "targets", [
@@ -87779,6 +87800,7 @@
87779
87800
  });
87780
87801
  document.addEventListener("turbo:visit", () => document.body.classList.add("turbo-loading"));
87781
87802
  document.addEventListener("turbo:submit-start", () => document.body.classList.add("turbo-loading"));
87803
+ document.addEventListener("turbo:submit-end", () => document.body.classList.remove("turbo-loading"));
87782
87804
  document.addEventListener("turbo:before-cache", () => {
87783
87805
  document.querySelectorAll("[data-turbo-remove-before-cache]").forEach((element) => element.remove());
87784
87806
  });