katalyst-tables 3.3.1 → 3.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/assets/builds/katalyst/tables.esm.js +332 -6
- data/app/assets/builds/katalyst/tables.js +332 -6
- 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/_index.scss +1 -1
- data/app/assets/stylesheets/katalyst/tables/_query.scss +109 -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/components/katalyst/table_component.rb +13 -2
- data/app/components/katalyst/tables/cells/currency_component.rb +21 -2
- data/app/components/katalyst/tables/cells/number_component.rb +31 -1
- data/app/components/katalyst/tables/query/input_component.html.erb +13 -0
- data/app/components/katalyst/tables/query/input_component.rb +50 -0
- data/app/components/katalyst/tables/query/modal_component.html.erb +33 -0
- data/app/components/katalyst/tables/query/modal_component.rb +89 -0
- data/app/components/katalyst/tables/query_component.html.erb +8 -0
- data/app/components/katalyst/tables/{filter_component.rb → query_component.rb} +37 -30
- data/app/controllers/concerns/katalyst/tables/backend.rb +14 -0
- data/app/helpers/katalyst/tables/frontend.rb +14 -8
- data/app/javascript/tables/application.js +8 -3
- data/app/javascript/tables/query_controller.js +108 -0
- data/app/javascript/tables/query_input_controller.js +228 -0
- data/app/models/concerns/katalyst/tables/collection/core.rb +2 -2
- data/app/models/concerns/katalyst/tables/collection/query/array_value_parser.rb +13 -26
- data/app/models/concerns/katalyst/tables/collection/query/parser.rb +16 -13
- data/app/models/concerns/katalyst/tables/collection/query/single_value_parser.rb +11 -3
- data/app/models/concerns/katalyst/tables/collection/query/value_parser.rb +10 -5
- data/app/models/concerns/katalyst/tables/collection/query.rb +42 -5
- data/app/models/concerns/katalyst/tables/collection/sorting.rb +11 -1
- data/app/models/katalyst/tables/collection/base.rb +10 -0
- data/app/models/katalyst/tables/collection/filter.rb +10 -0
- data/config/locales/tables.en.yml +2 -0
- data/{app/models → lib}/katalyst/tables/collection/type/boolean.rb +11 -1
- data/lib/katalyst/tables/collection/type/date.rb +57 -0
- data/lib/katalyst/tables/collection/type/enum.rb +32 -0
- data/lib/katalyst/tables/collection/type/float.rb +21 -0
- data/lib/katalyst/tables/collection/type/helpers/delegate.rb +32 -0
- data/{app/models → lib}/katalyst/tables/collection/type/helpers/extensions.rb +14 -0
- data/lib/katalyst/tables/collection/type/helpers/multiple.rb +60 -0
- data/lib/katalyst/tables/collection/type/helpers/range.rb +59 -0
- data/lib/katalyst/tables/collection/type/integer.rb +21 -0
- data/{app/models → lib}/katalyst/tables/collection/type/value.rb +22 -2
- data/{app/models → lib}/katalyst/tables/collection/type.rb +16 -0
- data/lib/katalyst/tables/collection.rb +11 -0
- data/lib/katalyst/tables.rb +6 -0
- metadata +26 -21
- data/app/assets/stylesheets/katalyst/tables/_filter.scss +0 -43
- data/app/components/katalyst/tables/filter/modal_component.html.erb +0 -25
- data/app/components/katalyst/tables/filter/modal_component.rb +0 -112
- data/app/components/katalyst/tables/filter_component.html.erb +0 -18
- data/app/javascript/tables/filter/modal_controller.js +0 -13
- data/app/models/katalyst/tables/collection/type/date.rb +0 -60
- data/app/models/katalyst/tables/collection/type/enum.rb +0 -21
- data/app/models/katalyst/tables/collection/type/float.rb +0 -57
- data/app/models/katalyst/tables/collection/type/helpers/delegate.rb +0 -50
- data/app/models/katalyst/tables/collection/type/helpers/multiple.rb +0 -30
- data/app/models/katalyst/tables/collection/type/integer.rb +0 -57
- /data/{app/models → lib}/katalyst/tables/collection/type/query.rb +0 -0
- /data/{app/models → lib}/katalyst/tables/collection/type/search.rb +0 -0
- /data/{app/models → lib}/katalyst/tables/collection/type/string.rb +0 -0
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Katalyst
|
4
|
-
module Tables
|
5
|
-
module Collection
|
6
|
-
module Type
|
7
|
-
class Enum < Value
|
8
|
-
include Helpers::Multiple
|
9
|
-
|
10
|
-
def initialize(multiple: true, **)
|
11
|
-
super
|
12
|
-
end
|
13
|
-
|
14
|
-
def type
|
15
|
-
:enum
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Katalyst
|
4
|
-
module Tables
|
5
|
-
module Collection
|
6
|
-
module Type
|
7
|
-
class Float < Value
|
8
|
-
include Helpers::Delegate
|
9
|
-
include Helpers::Multiple
|
10
|
-
|
11
|
-
def initialize(**)
|
12
|
-
super(**, delegate: ActiveModel::Type::Float)
|
13
|
-
end
|
14
|
-
|
15
|
-
def serialize(value)
|
16
|
-
if value.is_a?(Range)
|
17
|
-
if value.begin.nil?
|
18
|
-
"<#{super(value.end)}"
|
19
|
-
elsif value.end.nil?
|
20
|
-
">#{super(value.begin)}"
|
21
|
-
else
|
22
|
-
"#{super(value.begin)}..#{super(value.end)}"
|
23
|
-
end
|
24
|
-
else
|
25
|
-
super
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
FLOAT = /(-?\d+(?:\.\d+)?)/
|
32
|
-
SINGLE_VALUE = /\A#{FLOAT}\z/
|
33
|
-
LOWER_BOUND = /\A>#{FLOAT}\z/
|
34
|
-
UPPER_BOUND = /\A<#{FLOAT}\z/
|
35
|
-
BOUNDED = /\A#{FLOAT}\.\.#{FLOAT}\z/
|
36
|
-
|
37
|
-
def cast_value(value)
|
38
|
-
case value
|
39
|
-
when ::Range, ::Integer
|
40
|
-
value
|
41
|
-
when SINGLE_VALUE
|
42
|
-
super($1)
|
43
|
-
when LOWER_BOUND
|
44
|
-
((super($1))..)
|
45
|
-
when UPPER_BOUND
|
46
|
-
(..(super($1)))
|
47
|
-
when BOUNDED
|
48
|
-
((super($1))..(super($2)))
|
49
|
-
else
|
50
|
-
super
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Katalyst
|
4
|
-
module Tables
|
5
|
-
module Collection
|
6
|
-
module Type
|
7
|
-
module Helpers
|
8
|
-
# Lifts a delegating type from value to arrays of values
|
9
|
-
module Delegate
|
10
|
-
delegate :type, to: :@delegate
|
11
|
-
|
12
|
-
def initialize(delegate:, **arguments)
|
13
|
-
super(**arguments)
|
14
|
-
|
15
|
-
@delegate = delegate.new(**arguments.except(:filter, :multiple, :scope))
|
16
|
-
end
|
17
|
-
|
18
|
-
using Extensions
|
19
|
-
|
20
|
-
def deserialize(value)
|
21
|
-
if multiple? && value.is_a?(::Array)
|
22
|
-
value.map { |v| @delegate.deserialize(v) }
|
23
|
-
else
|
24
|
-
@delegate.deserialize(value)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def serialize(value)
|
29
|
-
if multiple? && value.is_a?(::Array)
|
30
|
-
value.map { |v| @delegate.serialize(v) }
|
31
|
-
else
|
32
|
-
@delegate.serialize(value)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
def cast_value(value)
|
39
|
-
if multiple? && value.is_a?(::Array)
|
40
|
-
value.map { |v| @delegate.cast(v) }
|
41
|
-
else
|
42
|
-
@delegate.cast(value)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Katalyst
|
4
|
-
module Tables
|
5
|
-
module Collection
|
6
|
-
module Type
|
7
|
-
module Helpers
|
8
|
-
# Adds support for multiple: true
|
9
|
-
module Multiple
|
10
|
-
def initialize(multiple: false, **)
|
11
|
-
super(**)
|
12
|
-
|
13
|
-
@multiple = multiple
|
14
|
-
end
|
15
|
-
|
16
|
-
def multiple?
|
17
|
-
@multiple
|
18
|
-
end
|
19
|
-
|
20
|
-
using Extensions
|
21
|
-
|
22
|
-
def default_value
|
23
|
-
multiple? ? [] : super
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Katalyst
|
4
|
-
module Tables
|
5
|
-
module Collection
|
6
|
-
module Type
|
7
|
-
class Integer < Value
|
8
|
-
include Helpers::Delegate
|
9
|
-
include Helpers::Multiple
|
10
|
-
|
11
|
-
def initialize(**)
|
12
|
-
super(**, delegate: ActiveModel::Type::Integer)
|
13
|
-
end
|
14
|
-
|
15
|
-
def serialize(value)
|
16
|
-
if value.is_a?(Range)
|
17
|
-
if value.begin.nil?
|
18
|
-
"<#{super(value.end)}"
|
19
|
-
elsif value.end.nil?
|
20
|
-
">#{super(value.begin)}"
|
21
|
-
else
|
22
|
-
"#{super(value.begin)}..#{super(value.end)}"
|
23
|
-
end
|
24
|
-
else
|
25
|
-
super
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
INTEGER = /(-?\d+)/
|
32
|
-
SINGLE_VALUE = /\A#{INTEGER}\z/
|
33
|
-
LOWER_BOUND = /\A>#{INTEGER}\z/
|
34
|
-
UPPER_BOUND = /\A<#{INTEGER}\z/
|
35
|
-
BOUNDED = /\A#{INTEGER}\.\.#{INTEGER}\z/
|
36
|
-
|
37
|
-
def cast_value(value)
|
38
|
-
case value
|
39
|
-
when ::Range, ::Integer
|
40
|
-
value
|
41
|
-
when SINGLE_VALUE
|
42
|
-
super($1)
|
43
|
-
when LOWER_BOUND
|
44
|
-
((super($1))..)
|
45
|
-
when UPPER_BOUND
|
46
|
-
(..(super($1)))
|
47
|
-
when BOUNDED
|
48
|
-
((super($1))..(super($2)))
|
49
|
-
else
|
50
|
-
super
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
File without changes
|
File without changes
|
File without changes
|