avo 3.7.0 → 3.7.2
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 +4 -4
- data/Gemfile +3 -0
- data/Gemfile.lock +3 -2
- data/app/assets/builds/avo.base.css +337 -104
- data/app/assets/stylesheets/css/pagination.css +87 -47
- data/app/components/avo/field_wrapper_component.rb +2 -8
- data/app/components/avo/fields/common/heading_component.html.erb +5 -5
- data/app/components/avo/fields/common/heading_component.rb +8 -5
- data/app/components/avo/fields/heading_field/edit_component.html.erb +1 -1
- data/app/components/avo/fields/heading_field/show_component.html.erb +1 -1
- data/app/components/avo/paginator_component.html.erb +1 -1
- data/app/components/avo/paginator_component.rb +9 -0
- data/lib/avo/concerns/has_resource_stimulus_controllers.rb +9 -3
- data/lib/avo/concerns/pagination.rb +2 -1
- data/lib/avo/version.rb +1 -1
- data/lib/avo.rb +1 -0
- data/public/avo-assets/avo.base.css +333 -84
- data/public/avo-assets/avo.base.js +156 -156
- data/public/avo-assets/avo.base.js.map +4 -4
- metadata +2 -2
@@ -1,63 +1,103 @@
|
|
1
|
-
.pagy-
|
2
|
-
.pagy-nav
|
3
|
-
.pagy-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
.pagy-nav.pagination,
|
8
|
-
.pagy-nav-js.pagination,
|
9
|
-
.pagy-combo-nav-js.pagination {
|
10
|
-
@apply space-x-2;
|
11
|
-
}
|
1
|
+
.pagy-gem-version-7 {
|
2
|
+
.pagy-nav,
|
3
|
+
.pagy-nav-js,
|
4
|
+
.pagy-combo-nav-js {
|
5
|
+
@apply relative z-0 flex;
|
6
|
+
}
|
12
7
|
|
13
|
-
.pagy-nav
|
14
|
-
|
15
|
-
|
8
|
+
.pagy-nav.pagination,
|
9
|
+
.pagy-nav-js.pagination,
|
10
|
+
.pagy-combo-nav-js.pagination {
|
11
|
+
@apply space-x-2;
|
12
|
+
}
|
16
13
|
|
17
|
-
.pagy-nav .page a
|
18
|
-
|
19
|
-
.pagy-nav .page.prev.disabled a,
|
20
|
-
.pagy-nav .page.next.disabled a,
|
21
|
-
.pagy-nav-js .page a,
|
22
|
-
.pagy-combo-nav-js .page a,
|
23
|
-
.pagy-combo-nav-js .pagy-combo-input a {
|
24
|
-
@apply rounded px-3 py-1 text-sm text-gray-500 font-semibold bg-white shadow-md border border-gray-300;
|
25
|
-
|
26
|
-
&:hover{
|
27
|
-
@apply bg-gray-150;
|
14
|
+
.pagy-nav .page a{
|
15
|
+
@apply block;
|
28
16
|
}
|
29
17
|
|
30
|
-
|
31
|
-
|
18
|
+
.pagy-nav .page a,
|
19
|
+
.pagy-nav .page.active a,
|
20
|
+
.pagy-nav .page.prev.disabled a,
|
21
|
+
.pagy-nav .page.next.disabled a,
|
22
|
+
.pagy-nav-js .page a,
|
23
|
+
.pagy-combo-nav-js .page a,
|
24
|
+
.pagy-combo-nav-js .pagy-combo-input a {
|
25
|
+
@apply rounded px-3 py-1 text-sm text-gray-500 font-semibold bg-white shadow-md border border-gray-300;
|
26
|
+
|
27
|
+
&:hover{
|
28
|
+
@apply bg-gray-150;
|
29
|
+
}
|
30
|
+
|
31
|
+
&:active{
|
32
|
+
@apply bg-gray-200;
|
33
|
+
}
|
32
34
|
}
|
33
|
-
}
|
34
35
|
|
35
|
-
.pagy-nav .page.prev.disabled a,
|
36
|
-
.pagy-nav-js .page.prev.disabled a,
|
37
|
-
.pagy-combo-nav-js .page.prev.disabled a,
|
38
|
-
.pagy-nav .page.next.disabled a,
|
39
|
-
.pagy-nav-js .page.next.disabled a,
|
40
|
-
.pagy-combo-nav-js .page.next.disabled a {
|
41
|
-
|
36
|
+
.pagy-nav .page.prev.disabled a,
|
37
|
+
.pagy-nav-js .page.prev.disabled a,
|
38
|
+
.pagy-combo-nav-js .page.prev.disabled a,
|
39
|
+
.pagy-nav .page.next.disabled a,
|
40
|
+
.pagy-nav-js .page.next.disabled a,
|
41
|
+
.pagy-combo-nav-js .page.next.disabled a {
|
42
|
+
@apply text-gray-300 cursor-default;
|
43
|
+
|
44
|
+
&:hover {
|
45
|
+
@apply text-gray-300 bg-white;
|
46
|
+
}
|
42
47
|
|
43
|
-
|
44
|
-
|
48
|
+
&:active {
|
49
|
+
@apply text-gray-300 bg-white;
|
50
|
+
}
|
45
51
|
}
|
46
52
|
|
47
|
-
|
48
|
-
|
53
|
+
.pagy-nav .page.active a,
|
54
|
+
.pagy-nav-js .page.active a {
|
55
|
+
@apply text-white cursor-default bg-gray-500 border-gray-500;
|
56
|
+
|
57
|
+
&:hover {
|
58
|
+
@apply text-white bg-gray-500;
|
59
|
+
}
|
60
|
+
|
61
|
+
&:active {
|
62
|
+
@apply bg-gray-500 text-white;
|
63
|
+
}
|
49
64
|
}
|
50
65
|
}
|
51
66
|
|
52
|
-
.pagy-
|
53
|
-
.pagy
|
54
|
-
|
67
|
+
.pagy-gem-version-8-or-more {
|
68
|
+
.pagy.nav {
|
69
|
+
@apply relative z-0 flex space-x-2;
|
55
70
|
|
56
|
-
|
57
|
-
|
58
|
-
|
71
|
+
a.gap {
|
72
|
+
@apply text-gray-500;
|
73
|
+
}
|
74
|
+
|
75
|
+
& a:not(.gap) {
|
76
|
+
@apply block rounded px-3 py-1 text-sm text-gray-500 font-semibold bg-white shadow-md border border-gray-300;
|
77
|
+
|
78
|
+
&:hover{
|
79
|
+
@apply bg-gray-150;
|
80
|
+
}
|
81
|
+
|
82
|
+
&:active{
|
83
|
+
@apply bg-gray-200;
|
84
|
+
}
|
85
|
+
|
86
|
+
&.current {
|
87
|
+
@apply text-white cursor-default bg-gray-500 border-gray-500;
|
88
|
+
|
89
|
+
&:hover {
|
90
|
+
@apply text-white bg-gray-500;
|
91
|
+
}
|
92
|
+
|
93
|
+
&:active {
|
94
|
+
@apply bg-gray-500 text-white;
|
95
|
+
}
|
96
|
+
}
|
59
97
|
|
60
|
-
|
61
|
-
|
98
|
+
&[aria-disabled="true"]:not(.current) {
|
99
|
+
@apply bg-gray-100 text-gray-300 cursor-default;
|
100
|
+
}
|
101
|
+
}
|
62
102
|
}
|
63
103
|
}
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Avo::FieldWrapperComponent < ViewComponent::Base
|
4
|
+
include Avo::Concerns::HasResourceStimulusControllers
|
5
|
+
|
4
6
|
attr_reader :dash_if_blank
|
5
7
|
attr_reader :compact
|
6
8
|
attr_reader :field
|
@@ -112,12 +114,4 @@ class Avo::FieldWrapperComponent < ViewComponent::Base
|
|
112
114
|
def full_width?
|
113
115
|
@full_width
|
114
116
|
end
|
115
|
-
|
116
|
-
private
|
117
|
-
|
118
|
-
def add_stimulus_attributes_for(entity, attributes)
|
119
|
-
entity.get_stimulus_controllers.split(" ").each do |controller|
|
120
|
-
attributes["#{controller}-target"] = "#{@field.id.to_s.underscore}_#{@field.type.to_s.underscore}_wrapper".camelize(:lower)
|
121
|
-
end
|
122
|
-
end
|
123
117
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
|
1
|
+
<%= content_tag :div, class: @classes, data: @data do %>
|
2
2
|
<div class="py-2 px-6 h-full w-full">
|
3
|
-
<% if as_html %>
|
4
|
-
<%= sanitize value %>
|
3
|
+
<% if @field.as_html %>
|
4
|
+
<%= sanitize @field.value %>
|
5
5
|
<% else %>
|
6
|
-
<div class="font-semibold uppercase"><%= value %></div>
|
6
|
+
<div class="font-semibold uppercase"><%= @field.value %></div>
|
7
7
|
<% end %>
|
8
8
|
</div>
|
9
|
-
|
9
|
+
<% end %>
|
@@ -1,11 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Avo::Fields::Common::HeadingComponent < ViewComponent::Base
|
4
|
-
|
5
|
-
attr_reader :as_html
|
4
|
+
include Avo::Concerns::HasResourceStimulusControllers
|
6
5
|
|
7
|
-
def initialize(
|
8
|
-
@
|
9
|
-
@
|
6
|
+
def initialize(field:)
|
7
|
+
@field = field
|
8
|
+
@view = field.resource.view
|
9
|
+
@classes = "flex items-start py-1 leading-tight bg-gray-100 text-gray-500 text-xs #{@field.get_html(:classes, view: @view, element: :wrapper)}"
|
10
|
+
|
11
|
+
@data = stimulus_data_attributes
|
12
|
+
add_stimulus_attributes_for(field.resource, @data)
|
10
13
|
end
|
11
14
|
end
|
@@ -1,3 +1,3 @@
|
|
1
1
|
<div <% if @index == 0 %> class="overflow-hidden rounded-t" <% end %> data-field-id="<%= @field.id %>">
|
2
|
-
<%= render Avo::Fields::Common::HeadingComponent.new
|
2
|
+
<%= render Avo::Fields::Common::HeadingComponent.new field: @field %>
|
3
3
|
</div>
|
@@ -1,3 +1,3 @@
|
|
1
1
|
<div <% if @index == 0 %> class="overflow-hidden rounded-t" <% end %> data-field-id="<%= @field.id %>">
|
2
|
-
<%= render Avo::Fields::Common::HeadingComponent.new
|
2
|
+
<%= render Avo::Fields::Common::HeadingComponent.new field: @field %>
|
3
3
|
</div>
|
@@ -22,7 +22,7 @@
|
|
22
22
|
</div>
|
23
23
|
</div>
|
24
24
|
<div class="flex">
|
25
|
-
<div class="flex-2 sm:flex sm:items-center sm:justify-between space-y-2 sm:space-y-0 text-center sm:text-left">
|
25
|
+
<div class="flex-2 sm:flex sm:items-center sm:justify-between space-y-2 sm:space-y-0 text-center sm:text-left pagy-gem-version-<%= pagy_major_version %>">
|
26
26
|
<% if @resource.pagination_type.default? %>
|
27
27
|
<div class="text-sm text-slate-600 mr-4"><%== helpers.pagy_info @pagy %></div>
|
28
28
|
<% end %>
|
@@ -42,4 +42,13 @@ class Avo::PaginatorComponent < ViewComponent::Base
|
|
42
42
|
options.sort.uniq
|
43
43
|
end
|
44
44
|
end
|
45
|
+
|
46
|
+
def pagy_major_version
|
47
|
+
return nil unless defined?(Pagy::VERSION)
|
48
|
+
version = Pagy::VERSION&.split(".")&.first&.to_i
|
49
|
+
|
50
|
+
return "8-or-more" if version >= 8
|
51
|
+
|
52
|
+
version
|
53
|
+
end
|
45
54
|
end
|
@@ -8,11 +8,11 @@ module Avo
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def get_stimulus_controllers
|
11
|
-
return "" if view.nil?
|
11
|
+
return "" if @view.nil?
|
12
12
|
|
13
13
|
controllers = []
|
14
14
|
|
15
|
-
case view.to_sym
|
15
|
+
case @view.to_sym
|
16
16
|
when :show
|
17
17
|
controllers << "resource-show"
|
18
18
|
when :new, :edit
|
@@ -32,11 +32,17 @@ module Avo
|
|
32
32
|
}
|
33
33
|
|
34
34
|
get_stimulus_controllers.split(" ").each do |controller|
|
35
|
-
attributes["#{controller}-view-value"] = view
|
35
|
+
attributes["#{controller}-view-value"] = @view
|
36
36
|
end
|
37
37
|
|
38
38
|
attributes
|
39
39
|
end
|
40
|
+
|
41
|
+
def add_stimulus_attributes_for(entity, attributes)
|
42
|
+
entity.get_stimulus_controllers.split(" ").each do |controller|
|
43
|
+
attributes["#{controller}-target"] = "#{@field.id.to_s.underscore}_#{@field.type.to_s.underscore}_wrapper".camelize(:lower)
|
44
|
+
end
|
45
|
+
end
|
40
46
|
end
|
41
47
|
end
|
42
48
|
end
|
@@ -38,7 +38,8 @@ module Avo
|
|
38
38
|
send PAGINATION_METHOD[pagination_type.to_sym],
|
39
39
|
query,
|
40
40
|
items: index_params[:per_page],
|
41
|
-
link_extra: "data-turbo-frame=\"#{params[:turbo_frame]}\"",
|
41
|
+
link_extra: "data-turbo-frame=\"#{params[:turbo_frame]}\"", # Add extra arguments in pagy 7.
|
42
|
+
anchor_string: "data-turbo-frame=\"#{params[:turbo_frame]}\"", # Add extra arguments in pagy 8.
|
42
43
|
params: extra_pagy_params,
|
43
44
|
size: pagination_hash[:size]
|
44
45
|
end
|
data/lib/avo/version.rb
CHANGED