katalyst-tables 3.12.1 → 3.13.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 +4 -4
- data/CHANGELOG.md +7 -0
- data/app/assets/stylesheets/katalyst/tables/summary.css +31 -6
- data/app/components/concerns/katalyst/tables/has_table_content.rb +3 -3
- data/app/components/concerns/katalyst/tables/selectable.rb +2 -2
- data/app/components/concerns/katalyst/tables/sortable.rb +7 -7
- data/app/components/katalyst/table_component.rb +3 -3
- data/app/components/katalyst/tables/cell_component.rb +4 -4
- data/app/components/katalyst/tables/cells/date_time_component.rb +1 -1
- data/app/components/katalyst/tables/cells/number_component.rb +1 -1
- data/app/components/katalyst/tables/cells/select_component.rb +1 -1
- data/app/components/katalyst/tables/label.rb +2 -2
- data/app/components/katalyst/tables/query_component.rb +1 -1
- data/app/helpers/katalyst/tables/frontend.rb +2 -2
- data/app/models/concerns/katalyst/tables/collection/pagination.rb +1 -1
- data/app/models/concerns/katalyst/tables/collection/query/parser.rb +2 -2
- data/app/models/concerns/katalyst/tables/collection/query/untagged_literal.rb +1 -1
- data/app/models/concerns/katalyst/tables/collection/query/value_parser.rb +1 -1
- data/app/models/katalyst/tables/suggestions/constant_value.rb +1 -1
- data/app/models/katalyst/tables/suggestions/custom_value.rb +1 -1
- data/app/models/katalyst/tables/suggestions/database_value.rb +1 -1
- data/lib/katalyst/tables/collection/type/enum.rb +2 -2
- data/lib/katalyst/tables/collection/type/helpers/range.rb +1 -1
- data/lib/katalyst/tables/collection/type/string.rb +1 -1
- data/lib/katalyst/tables/collection/type/value.rb +3 -3
- data/lib/katalyst/tables/config.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9a139afe818b1985bc81203a5370dd737fb2df832f83bbb3966407ca299a953b
|
|
4
|
+
data.tar.gz: cb3c47dbcb78cde5243686b8787aa37ee549d2ec1c9eb5b655c7d4cc00319358
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ee72cb55d174f7510f68ed3c8b6eaaedbcdaf8f3167de81a2d22234dc6fabc5e9e2d769c1d5ad5bdaae7f976643667001e37b8c406ba1edae480c347bb8d3cb1
|
|
7
|
+
data.tar.gz: 137584392a2357aa056b4c45124b1bc11f1d7585b4eaa1ad1901b05d42ecfe479677543351bf30da45c32efd23a1983214c99b21d77e1dfa00d3e1f371bfea14
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [3.13.0]
|
|
2
|
+
|
|
3
|
+
Default style overhaul for .katalyst--summary-table (BREAKING CHANGE)
|
|
4
|
+
* Use grid instead of table layout to support more complex alignment
|
|
5
|
+
* Respond to stacked layout on mobile
|
|
6
|
+
* Users will likely want to make spacing and layout tweaks depending on table style
|
|
7
|
+
|
|
1
8
|
## [3.12.0]
|
|
2
9
|
|
|
3
10
|
* Support for ordering variable height rows
|
|
@@ -1,17 +1,42 @@
|
|
|
1
1
|
.katalyst--summary-table {
|
|
2
|
-
width:
|
|
3
|
-
|
|
2
|
+
--table-min-width: min(60ch, 100cqi);
|
|
3
|
+
--table-max-width: 100%;
|
|
4
|
+
--label-min-width: min(20ch, 33cqi);
|
|
5
|
+
--label-width: clamp(12ch, 33cqi, 30ch);
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
display: grid;
|
|
8
|
+
grid-template-columns: fit-content(var(--label-width)) 1fr;
|
|
9
|
+
align-items: stretch;
|
|
10
|
+
|
|
11
|
+
width: fit-content;
|
|
12
|
+
min-width: var(--table-min-width);
|
|
13
|
+
max-width: var(--table-max-width);
|
|
14
|
+
|
|
15
|
+
tbody,
|
|
16
|
+
tr {
|
|
17
|
+
display: contents;
|
|
7
18
|
}
|
|
8
19
|
|
|
9
20
|
th,
|
|
10
21
|
td {
|
|
11
|
-
|
|
12
|
-
|
|
22
|
+
overflow-wrap: anywhere;
|
|
23
|
+
hyphens: auto;
|
|
13
24
|
}
|
|
14
25
|
|
|
26
|
+
th {
|
|
27
|
+
min-width: var(--label-min-width);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@container (width < 60ch) {
|
|
32
|
+
.katalyst--summary-table {
|
|
33
|
+
grid-template-columns: 1fr;
|
|
34
|
+
min-width: unset;
|
|
35
|
+
width: 100%;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.katalyst--summary-table {
|
|
15
40
|
:where([data-cell-type="enum"]) {
|
|
16
41
|
[data-enum] {
|
|
17
42
|
background: var(--tag-background-color, var(--color-tint, #f0ecf3));
|
|
@@ -15,7 +15,7 @@ module Katalyst
|
|
|
15
15
|
|
|
16
16
|
def before_render
|
|
17
17
|
# move @__vc_render_in_block to @row_proc to avoid slot lookup attempting to call it
|
|
18
|
-
@row_proc
|
|
18
|
+
@row_proc = @__vc_render_in_block
|
|
19
19
|
@__vc_render_in_block = nil
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -26,11 +26,11 @@ module Katalyst
|
|
|
26
26
|
private
|
|
27
27
|
|
|
28
28
|
def row_content(row, record)
|
|
29
|
-
@current_row
|
|
29
|
+
@current_row = row
|
|
30
30
|
@current_record = record
|
|
31
31
|
row_proc.call(self, record)
|
|
32
32
|
ensure
|
|
33
|
-
@current_row
|
|
33
|
+
@current_row = nil
|
|
34
34
|
@current_record = nil
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -7,9 +7,9 @@ module Katalyst
|
|
|
7
7
|
module Selectable
|
|
8
8
|
extend ActiveSupport::Concern
|
|
9
9
|
|
|
10
|
-
FORM_CONTROLLER
|
|
10
|
+
FORM_CONTROLLER = "tables--selection--form"
|
|
11
11
|
TABLE_CONTROLLER = "tables--selection--table"
|
|
12
|
-
ITEM_CONTROLLER
|
|
12
|
+
ITEM_CONTROLLER = "tables--selection--item"
|
|
13
13
|
|
|
14
14
|
# Returns the default dom id for the selection form, uses the table's
|
|
15
15
|
# default id with '_selection' appended.
|
|
@@ -33,7 +33,7 @@ module Katalyst
|
|
|
33
33
|
super(**)
|
|
34
34
|
|
|
35
35
|
@collection = collection
|
|
36
|
-
@cell
|
|
36
|
+
@cell = cell
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def call
|
|
@@ -46,12 +46,12 @@ module Katalyst
|
|
|
46
46
|
# Implementation inspired by pagy's `pagy_url_for` helper.
|
|
47
47
|
# Preserve any existing GET parameters
|
|
48
48
|
# CAUTION: these parameters are not sanitised
|
|
49
|
-
sort
|
|
50
|
-
params
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
sort = column && collection.toggle_sort(column)
|
|
50
|
+
params = if sort && !sort.eql?(collection.default_sort)
|
|
51
|
+
request.GET.merge("sort" => sort).except("page")
|
|
52
|
+
else
|
|
53
|
+
request.GET.except("page", "sort")
|
|
54
|
+
end
|
|
55
55
|
query_string = params.empty? ? "" : "?#{Rack::Utils.build_nested_query(params)}"
|
|
56
56
|
|
|
57
57
|
"#{request.path}#{query_string}"
|
|
@@ -61,10 +61,10 @@ module Katalyst
|
|
|
61
61
|
# caption: true means render the caption, caption: false means no caption, if a hash, passes as options
|
|
62
62
|
@caption_options = caption
|
|
63
63
|
|
|
64
|
-
@header_row_callbacks
|
|
65
|
-
@body_row_callbacks
|
|
64
|
+
@header_row_callbacks = []
|
|
65
|
+
@body_row_callbacks = []
|
|
66
66
|
@header_row_cell_callbacks = []
|
|
67
|
-
@body_row_cell_callbacks
|
|
67
|
+
@body_row_cell_callbacks = []
|
|
68
68
|
|
|
69
69
|
super(generate_ids:, object_name:, partial:, as:, **)
|
|
70
70
|
end
|
|
@@ -11,10 +11,10 @@ module Katalyst
|
|
|
11
11
|
super(**)
|
|
12
12
|
|
|
13
13
|
@collection = collection
|
|
14
|
-
@row
|
|
15
|
-
@column
|
|
16
|
-
@record
|
|
17
|
-
@heading
|
|
14
|
+
@row = row
|
|
15
|
+
@column = column
|
|
16
|
+
@record = record
|
|
17
|
+
@heading = heading
|
|
18
18
|
|
|
19
19
|
if @row.header?
|
|
20
20
|
@label = Label.new(collection:, column:, label:)
|
|
@@ -63,7 +63,7 @@ module Katalyst
|
|
|
63
63
|
# Caution: requires config.view_component.capture_compatibility_patch_enabled to be set
|
|
64
64
|
def with_form(model: collection, url: @url, method: :get, **options, &block)
|
|
65
65
|
@form_options = { model:, url:, method:, **options }
|
|
66
|
-
@form_block
|
|
66
|
+
@form_block = block
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
def with_modal(collection: self.collection, **, &)
|
|
@@ -35,7 +35,7 @@ module Katalyst
|
|
|
35
35
|
**,
|
|
36
36
|
&)
|
|
37
37
|
component ||= default_table_component_class
|
|
38
|
-
component
|
|
38
|
+
component = component.new(collection:, header:, caption:, generate_ids:, object_name:, partial:, as:, **)
|
|
39
39
|
|
|
40
40
|
render(component, &)
|
|
41
41
|
end
|
|
@@ -81,7 +81,7 @@ module Katalyst
|
|
|
81
81
|
# @yieldparam [nil, Object] nil for the header column, or the given model for the value column
|
|
82
82
|
def summary_table_with(model:, **, &)
|
|
83
83
|
component ||= default_summary_table_component_class
|
|
84
|
-
component
|
|
84
|
+
component = component.new(model:, **)
|
|
85
85
|
|
|
86
86
|
render(component, &)
|
|
87
87
|
end
|
|
@@ -46,7 +46,7 @@ module Katalyst
|
|
|
46
46
|
class Paginate # :nodoc:
|
|
47
47
|
# Pagy is not a required gem unless you're using pagination
|
|
48
48
|
# Expect to see NoMethodError failures if pagy is not available
|
|
49
|
-
if (pagy_method
|
|
49
|
+
if (pagy_method = "Pagy::Method".safe_constantize)
|
|
50
50
|
include(pagy_method)
|
|
51
51
|
elsif (pagy_backend = "Pagy::Backend".safe_constantize)
|
|
52
52
|
include(pagy_backend)
|
|
@@ -16,12 +16,12 @@ module Katalyst
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def suggestions(scope, attribute)
|
|
19
|
-
model
|
|
19
|
+
model = scope.model
|
|
20
20
|
column = attribute.name
|
|
21
21
|
|
|
22
22
|
if attribute.name.include?(".")
|
|
23
23
|
table_name, column = attribute.name.split(".")
|
|
24
|
-
model
|
|
24
|
+
model = scope.model.reflections[table_name].klass
|
|
25
25
|
|
|
26
26
|
raise(ArgumentError, "Unknown association '#{table_name}' for #{scope.model}") unless model
|
|
27
27
|
end
|
|
@@ -86,7 +86,7 @@ module Katalyst
|
|
|
86
86
|
# when a value that accepts multiple is given a range, it double-packs the value so we get ..[0]
|
|
87
87
|
# unpack the array value
|
|
88
88
|
from = from.first if from.is_a?(::Array) && from.length == 1
|
|
89
|
-
to
|
|
89
|
+
to = to.first if to.is_a?(::Array) && to.length == 1
|
|
90
90
|
(from..to)
|
|
91
91
|
end
|
|
92
92
|
end
|
|
@@ -12,7 +12,7 @@ module Katalyst
|
|
|
12
12
|
def initialize(scope: nil, filter: true)
|
|
13
13
|
super()
|
|
14
14
|
|
|
15
|
-
@scope
|
|
15
|
+
@scope = scope
|
|
16
16
|
@filterable = filter
|
|
17
17
|
end
|
|
18
18
|
|
|
@@ -52,12 +52,12 @@ module Katalyst
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
def suggestions(scope, attribute, limit: 10, order: :asc)
|
|
55
|
-
model
|
|
55
|
+
model = scope.model
|
|
56
56
|
column = attribute.name
|
|
57
57
|
|
|
58
58
|
if attribute.name.include?(".")
|
|
59
59
|
table_name, column = attribute.name.split(".")
|
|
60
|
-
model
|
|
60
|
+
model = scope.model.reflections[table_name].klass
|
|
61
61
|
|
|
62
62
|
raise(ArgumentError, "Unknown association '#{table_name}' for #{scope.model}") unless model
|
|
63
63
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: katalyst-tables
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.13.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Katalyst Interactive
|
|
@@ -37,8 +37,10 @@ dependencies:
|
|
|
37
37
|
- - ">="
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
39
|
version: 4.0.0
|
|
40
|
-
description: HTML table generator for building tabular index views with filtering,
|
|
40
|
+
description: 'HTML table generator for building tabular index views with filtering,
|
|
41
41
|
sorting, and pagination.
|
|
42
|
+
|
|
43
|
+
'
|
|
42
44
|
email:
|
|
43
45
|
- devs@katalyst.com.au
|
|
44
46
|
executables: []
|
|
@@ -182,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
182
184
|
- !ruby/object:Gem::Version
|
|
183
185
|
version: '0'
|
|
184
186
|
requirements: []
|
|
185
|
-
rubygems_version: 4.0.
|
|
187
|
+
rubygems_version: 4.0.16
|
|
186
188
|
specification_version: 4
|
|
187
189
|
summary: HTML table generator for Rails views
|
|
188
190
|
test_files: []
|