avo 1.20.2.pre.2 → 1.21.0.pre.1

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 (31) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -3
  3. data/Gemfile.lock +3 -5
  4. data/app/assets/builds/avo.css +0 -16
  5. data/app/assets/builds/avo.js +234 -317
  6. data/app/assets/builds/avo.js.map +2 -2
  7. data/app/components/avo/fields/belongs_to_field/edit_component.html.erb +33 -39
  8. data/app/components/avo/views/resource_index_component.html.erb +1 -1
  9. data/app/controllers/avo/application_controller.rb +13 -11
  10. data/app/controllers/avo/base_controller.rb +4 -1
  11. data/app/controllers/avo/relations_controller.rb +4 -4
  12. data/app/controllers/avo/search_controller.rb +1 -0
  13. data/app/javascript/js/controllers/fields/belongs_to_field_controller.js +33 -96
  14. data/app/javascript/js/controllers/search_controller.js +17 -83
  15. data/app/views/avo/partials/_global_search.html.erb +1 -0
  16. data/app/views/avo/partials/_javascript.html.erb +0 -1
  17. data/app/views/avo/partials/_resource_search.html.erb +1 -0
  18. data/db/factories.rb +0 -4
  19. data/lib/avo/fields/base_field.rb +1 -1
  20. data/lib/avo/fields/belongs_to_field.rb +2 -19
  21. data/lib/avo/fields/files_field.rb +1 -2
  22. data/lib/avo/licensing/pro_license.rb +1 -2
  23. data/lib/avo/version.rb +1 -1
  24. data/lib/generators/avo/templates/locales/avo.en.yml +0 -1
  25. data/public/avo-assets/avo.css +0 -16
  26. data/public/avo-assets/avo.js +234 -317
  27. data/public/avo-assets/avo.js.map +2 -2
  28. metadata +2 -5
  29. data/app/assets/svgs/x.svg +0 -3
  30. data/app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb +0 -22
  31. data/app/components/avo/fields/belongs_to_field/autocomplete_component.rb +0 -33
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.20.2.pre.2
4
+ version: 1.21.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Marin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-02-14 00:00:00.000000000 Z
12
+ date: 2022-02-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -273,15 +273,12 @@ files:
273
273
  - app/assets/svgs/view-list.svg
274
274
  - app/assets/svgs/x-circle-sm.svg
275
275
  - app/assets/svgs/x-circle.svg
276
- - app/assets/svgs/x.svg
277
276
  - app/components/avo/edit/field_wrapper_component.html.erb
278
277
  - app/components/avo/edit/field_wrapper_component.rb
279
278
  - app/components/avo/fields/badge_field/index_component.html.erb
280
279
  - app/components/avo/fields/badge_field/index_component.rb
281
280
  - app/components/avo/fields/badge_field/show_component.html.erb
282
281
  - app/components/avo/fields/badge_field/show_component.rb
283
- - app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb
284
- - app/components/avo/fields/belongs_to_field/autocomplete_component.rb
285
282
  - app/components/avo/fields/belongs_to_field/edit_component.html.erb
286
283
  - app/components/avo/fields/belongs_to_field/edit_component.rb
287
284
  - app/components/avo/fields/belongs_to_field/index_component.html.erb
@@ -1,3 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
2
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
3
- </svg>
@@ -1,22 +0,0 @@
1
- <div data-controller="search" class="resource-search flex items-center h-full w-full" data-turbo-remove-before-cache>
2
- <div class="w-full hidden"
3
- data-search-target="autocomplete"
4
- data-search-resource="<%= @model_key %>"
5
- data-translation-keys='{"no_item_found": "<%= I18n.translate 'avo.no_item_found' %>"}'
6
- data-via-association="belongs_to"
7
- ></div>
8
- <div class="relative w-full" autocomplete="off">
9
- <%= @form.text_field @field.foreign_key,
10
- value: field_label,
11
- class: helpers.input_classes('w-full', has_error: @field.model_errors.include?(@field.id)), 'data-search-target': 'button clearValue',
12
- placeholder: @field.placeholder,
13
- disabled: true %>
14
- <div class="absolute top-1/2 left-auto right-3 mr-px -mt-2 cursor-pointer hidden text-gray-500"
15
- data-tippy="tooltip"
16
- data-search-target="clearButton"
17
- title="<%= I18n.translate 'avo.clear_value' %>"
18
- data-action="click->search#clearValue"
19
- ><%= helpers.svg 'x', class: 'h-4' %></div>
20
- </div>
21
- <%= @form.hidden_field @foreign_key, value: field_value, 'data-search-target': 'hiddenId clearValue' %>
22
- </div>
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class Avo::Fields::BelongsToField::AutocompleteComponent < ViewComponent::Base
4
- def initialize(form:, field:, type: nil, model_key:, foreign_key:)
5
- @form = form
6
- @field = field
7
- @type = type
8
- @model_key = model_key
9
- @foreign_key = foreign_key
10
- end
11
-
12
- def field_label
13
- if searchable?
14
- @field.value&.class == @type ? @field.field_label : nil
15
- else
16
- @field.field_label
17
- end
18
- end
19
-
20
- def field_value
21
- if searchable?
22
- @field.value&.class == @type ? @field.field_value : nil
23
- else
24
- @field.field_value
25
- end
26
- end
27
-
28
- private
29
-
30
- def searchable?
31
- @type.present?
32
- end
33
- end