katalyst-tables 3.0.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +17 -3
- data/app/assets/builds/katalyst/tables.esm.js +16 -0
- data/app/assets/builds/katalyst/tables.js +16 -0
- data/app/assets/builds/katalyst/tables.min.js +1 -1
- data/app/assets/builds/katalyst/tables.min.js.map +1 -1
- data/app/assets/stylesheets/katalyst/tables/_filter.scss +34 -0
- data/app/assets/stylesheets/katalyst/tables/_index.scss +2 -0
- data/app/assets/stylesheets/katalyst/tables/_select.scss +3 -0
- data/app/assets/stylesheets/katalyst/tables/_summary.scss +14 -0
- data/app/assets/stylesheets/katalyst/tables/_table.scss +3 -0
- data/app/assets/stylesheets/katalyst/tables/typed-columns/_boolean.scss +1 -1
- data/app/assets/stylesheets/katalyst/tables/typed-columns/_currency.scss +3 -0
- data/app/assets/stylesheets/katalyst/tables/typed-columns/_date.scss +1 -1
- data/app/assets/stylesheets/katalyst/tables/typed-columns/_datetime.scss +1 -1
- data/app/assets/stylesheets/katalyst/tables/typed-columns/_enum.scss +9 -0
- data/app/assets/stylesheets/katalyst/tables/typed-columns/_index.scss +1 -0
- data/app/assets/stylesheets/katalyst/tables/typed-columns/_number.scss +3 -0
- data/app/components/concerns/katalyst/tables/has_table_content.rb +2 -2
- data/app/components/concerns/katalyst/tables/row_renderer.rb +1 -1
- data/app/components/concerns/katalyst/tables/sortable.rb +1 -1
- data/app/components/katalyst/summary_table_component.html.erb +15 -0
- data/app/components/katalyst/summary_table_component.rb +44 -0
- data/app/components/katalyst/table_component.rb +28 -0
- data/app/components/katalyst/tables/cells/enum_component.rb +27 -0
- data/app/components/katalyst/tables/filter/modal_component.html.erb +25 -0
- data/app/components/katalyst/tables/filter/modal_component.rb +66 -0
- data/app/components/katalyst/tables/filter_component.html.erb +20 -0
- data/app/components/katalyst/tables/filter_component.rb +91 -0
- data/app/components/katalyst/tables/summary/body_component.html.erb +3 -0
- data/app/components/katalyst/tables/summary/body_component.rb +10 -0
- data/app/components/katalyst/tables/summary/header_component.html.erb +3 -0
- data/app/components/katalyst/tables/summary/header_component.rb +10 -0
- data/app/components/katalyst/tables/summary/row_component.html.erb +4 -0
- data/app/components/katalyst/tables/summary/row_component.rb +12 -0
- data/app/controllers/concerns/katalyst/tables/backend.rb +15 -0
- data/app/helpers/katalyst/tables/frontend.rb +27 -0
- data/app/javascript/tables/application.js +5 -0
- data/app/javascript/tables/filter/modal_controller.js +13 -0
- data/app/models/concerns/katalyst/tables/collection/core.rb +30 -0
- data/app/models/concerns/katalyst/tables/collection/filtering.rb +80 -9
- data/app/models/concerns/katalyst/tables/collection/pagination.rb +2 -2
- data/app/models/concerns/katalyst/tables/collection/query/array_value_parser.rb +56 -0
- data/app/models/concerns/katalyst/tables/collection/query/parser.rb +65 -0
- data/app/models/concerns/katalyst/tables/collection/query/single_value_parser.rb +24 -0
- data/app/models/concerns/katalyst/tables/collection/query/value_parser.rb +34 -0
- data/app/models/concerns/katalyst/tables/collection/query.rb +43 -0
- data/app/models/concerns/katalyst/tables/collection/sorting.rb +2 -2
- data/app/models/katalyst/tables/collection/array.rb +0 -1
- data/app/models/katalyst/tables/collection/base.rb +0 -5
- data/app/models/katalyst/tables/collection/filter.rb +2 -3
- data/config/importmap.rb +1 -0
- metadata +27 -4
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Katalyst
|
4
|
+
module Tables
|
5
|
+
module Collection
|
6
|
+
module Query # :nodoc:
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
include Filtering
|
10
|
+
|
11
|
+
included do
|
12
|
+
config_accessor :search_scope
|
13
|
+
|
14
|
+
attribute :query, :string, default: ""
|
15
|
+
attribute :search, :string, default: ""
|
16
|
+
|
17
|
+
# Note: this is defined inline so that we can overwrite query=
|
18
|
+
def query=(value)
|
19
|
+
query = super
|
20
|
+
|
21
|
+
parser = Parser.new(self).parse(query)
|
22
|
+
|
23
|
+
if searchable? && parser.untagged.any?
|
24
|
+
self.search = parser.untagged.join(" ")
|
25
|
+
end
|
26
|
+
|
27
|
+
query
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Returns true if the collection supports untagged searching. This
|
32
|
+
# requires config.search_scope to be set to the name of the scope to use
|
33
|
+
# in the target record for untagged text searches. If not set, untagged
|
34
|
+
# search terms will be silently ignored.
|
35
|
+
#
|
36
|
+
# @return [true, false]
|
37
|
+
def searchable?
|
38
|
+
config.search_scope.present?
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -45,10 +45,10 @@ module Katalyst
|
|
45
45
|
attr_reader :default_sort
|
46
46
|
end
|
47
47
|
|
48
|
-
def initialize(sorting: config.sorting, **
|
48
|
+
def initialize(sorting: config.sorting, **)
|
49
49
|
@default_sort = sorting.to_param if sorting.present?
|
50
50
|
|
51
|
-
super(sort: @default_sort, **
|
51
|
+
super(sort: @default_sort, **) # set default sort based on config
|
52
52
|
end
|
53
53
|
|
54
54
|
def default_sort?
|
@@ -23,7 +23,6 @@ module Katalyst
|
|
23
23
|
# ````
|
24
24
|
class Base
|
25
25
|
include Core
|
26
|
-
include Filtering
|
27
26
|
include Pagination
|
28
27
|
include Sorting
|
29
28
|
|
@@ -34,10 +33,6 @@ module Katalyst
|
|
34
33
|
new.with_params(params)
|
35
34
|
end
|
36
35
|
|
37
|
-
def model
|
38
|
-
items.model
|
39
|
-
end
|
40
|
-
|
41
36
|
def model_name
|
42
37
|
@model_name ||= items.model_name.dup.tap do |name|
|
43
38
|
name.param_key = ""
|
@@ -23,7 +23,6 @@ module Katalyst
|
|
23
23
|
# ````
|
24
24
|
class Filter
|
25
25
|
include Core
|
26
|
-
include Filtering
|
27
26
|
include Pagination
|
28
27
|
include Sorting
|
29
28
|
|
@@ -40,8 +39,8 @@ module Katalyst
|
|
40
39
|
|
41
40
|
attr_reader :param_key
|
42
41
|
|
43
|
-
def initialize(param_key: :filters, **
|
44
|
-
super(**
|
42
|
+
def initialize(param_key: :filters, **)
|
43
|
+
super(**)
|
45
44
|
|
46
45
|
@param_key = param_key.to_sym
|
47
46
|
end
|
data/config/importmap.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: katalyst-tables
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katalyst Interactive
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: katalyst-html-attributes
|
@@ -54,13 +54,17 @@ files:
|
|
54
54
|
- app/assets/builds/katalyst/tables.min.js
|
55
55
|
- app/assets/builds/katalyst/tables.min.js.map
|
56
56
|
- app/assets/config/katalyst-tables.js
|
57
|
+
- app/assets/stylesheets/katalyst/tables/_filter.scss
|
57
58
|
- app/assets/stylesheets/katalyst/tables/_index.scss
|
58
59
|
- app/assets/stylesheets/katalyst/tables/_ordinal.scss
|
60
|
+
- app/assets/stylesheets/katalyst/tables/_select.scss
|
61
|
+
- app/assets/stylesheets/katalyst/tables/_summary.scss
|
59
62
|
- app/assets/stylesheets/katalyst/tables/_table.scss
|
60
63
|
- app/assets/stylesheets/katalyst/tables/typed-columns/_boolean.scss
|
61
64
|
- app/assets/stylesheets/katalyst/tables/typed-columns/_currency.scss
|
62
65
|
- app/assets/stylesheets/katalyst/tables/typed-columns/_date.scss
|
63
66
|
- app/assets/stylesheets/katalyst/tables/typed-columns/_datetime.scss
|
67
|
+
- app/assets/stylesheets/katalyst/tables/typed-columns/_enum.scss
|
64
68
|
- app/assets/stylesheets/katalyst/tables/typed-columns/_index.scss
|
65
69
|
- app/assets/stylesheets/katalyst/tables/typed-columns/_number.scss
|
66
70
|
- app/components/concerns/katalyst/tables/has_table_content.rb
|
@@ -69,6 +73,8 @@ files:
|
|
69
73
|
- app/components/concerns/katalyst/tables/row_renderer.rb
|
70
74
|
- app/components/concerns/katalyst/tables/selectable.rb
|
71
75
|
- app/components/concerns/katalyst/tables/sortable.rb
|
76
|
+
- app/components/katalyst/summary_table_component.html.erb
|
77
|
+
- app/components/katalyst/summary_table_component.rb
|
72
78
|
- app/components/katalyst/table_component.html.erb
|
73
79
|
- app/components/katalyst/table_component.rb
|
74
80
|
- app/components/katalyst/tables/body_row_component.html.erb
|
@@ -78,6 +84,7 @@ files:
|
|
78
84
|
- app/components/katalyst/tables/cells/currency_component.rb
|
79
85
|
- app/components/katalyst/tables/cells/date_component.rb
|
80
86
|
- app/components/katalyst/tables/cells/date_time_component.rb
|
87
|
+
- app/components/katalyst/tables/cells/enum_component.rb
|
81
88
|
- app/components/katalyst/tables/cells/number_component.rb
|
82
89
|
- app/components/katalyst/tables/cells/ordinal_component.rb
|
83
90
|
- app/components/katalyst/tables/cells/rich_text_component.rb
|
@@ -85,6 +92,10 @@ files:
|
|
85
92
|
- app/components/katalyst/tables/data.rb
|
86
93
|
- app/components/katalyst/tables/empty_caption_component.html.erb
|
87
94
|
- app/components/katalyst/tables/empty_caption_component.rb
|
95
|
+
- app/components/katalyst/tables/filter/modal_component.html.erb
|
96
|
+
- app/components/katalyst/tables/filter/modal_component.rb
|
97
|
+
- app/components/katalyst/tables/filter_component.html.erb
|
98
|
+
- app/components/katalyst/tables/filter_component.rb
|
88
99
|
- app/components/katalyst/tables/header_row_component.html.erb
|
89
100
|
- app/components/katalyst/tables/header_row_component.rb
|
90
101
|
- app/components/katalyst/tables/label.rb
|
@@ -92,9 +103,16 @@ files:
|
|
92
103
|
- app/components/katalyst/tables/pagy_nav_component.rb
|
93
104
|
- app/components/katalyst/tables/selectable/form_component.html.erb
|
94
105
|
- app/components/katalyst/tables/selectable/form_component.rb
|
106
|
+
- app/components/katalyst/tables/summary/body_component.html.erb
|
107
|
+
- app/components/katalyst/tables/summary/body_component.rb
|
108
|
+
- app/components/katalyst/tables/summary/header_component.html.erb
|
109
|
+
- app/components/katalyst/tables/summary/header_component.rb
|
110
|
+
- app/components/katalyst/tables/summary/row_component.html.erb
|
111
|
+
- app/components/katalyst/tables/summary/row_component.rb
|
95
112
|
- app/controllers/concerns/katalyst/tables/backend.rb
|
96
113
|
- app/helpers/katalyst/tables/frontend.rb
|
97
114
|
- app/javascript/tables/application.js
|
115
|
+
- app/javascript/tables/filter/modal_controller.js
|
98
116
|
- app/javascript/tables/orderable/form_controller.js
|
99
117
|
- app/javascript/tables/orderable/item_controller.js
|
100
118
|
- app/javascript/tables/orderable/list_controller.js
|
@@ -104,6 +122,11 @@ files:
|
|
104
122
|
- app/models/concerns/katalyst/tables/collection/filtering.rb
|
105
123
|
- app/models/concerns/katalyst/tables/collection/has_params.rb
|
106
124
|
- app/models/concerns/katalyst/tables/collection/pagination.rb
|
125
|
+
- app/models/concerns/katalyst/tables/collection/query.rb
|
126
|
+
- app/models/concerns/katalyst/tables/collection/query/array_value_parser.rb
|
127
|
+
- app/models/concerns/katalyst/tables/collection/query/parser.rb
|
128
|
+
- app/models/concerns/katalyst/tables/collection/query/single_value_parser.rb
|
129
|
+
- app/models/concerns/katalyst/tables/collection/query/value_parser.rb
|
107
130
|
- app/models/concerns/katalyst/tables/collection/reducers.rb
|
108
131
|
- app/models/concerns/katalyst/tables/collection/sorting.rb
|
109
132
|
- app/models/katalyst/tables/collection/array.rb
|
@@ -131,14 +154,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
131
154
|
requirements:
|
132
155
|
- - ">="
|
133
156
|
- !ruby/object:Gem::Version
|
134
|
-
version: 3.
|
157
|
+
version: 3.3.0
|
135
158
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
159
|
requirements:
|
137
160
|
- - ">="
|
138
161
|
- !ruby/object:Gem::Version
|
139
162
|
version: '0'
|
140
163
|
requirements: []
|
141
|
-
rubygems_version: 3.5.
|
164
|
+
rubygems_version: 3.5.11
|
142
165
|
signing_key:
|
143
166
|
specification_version: 4
|
144
167
|
summary: HTML table generator for Rails views
|