katalyst-tables 3.4.2 → 3.4.4
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/app/assets/stylesheets/katalyst/tables/_query.scss +3 -7
- data/app/assets/stylesheets/katalyst/tables/_table.scss +2 -0
- data/app/assets/stylesheets/katalyst/tables/typed-columns/_enum.scss +10 -4
- data/app/components/katalyst/tables/cells/enum_component.rb +1 -5
- data/app/components/katalyst/tables/query/modal_component.rb +8 -1
- data/lib/katalyst/tables/collection/type/date.rb +1 -1
- data/lib/katalyst/tables/collection/type/enum.rb +8 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4dc2698abbad7fb7b3f49ead09af73c697bdef0f31371c6b2c0c69478ab0df5f
|
4
|
+
data.tar.gz: dea2e28dfed3ce6c39ccf61f607755915fa86e138f3ac59f55e926049c5ec34d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ab5ffed559436e0ed73671445d653ab603e48be03f2099ae39e8b6e4bcbe2d2b503752dd2fa722b9673dbdc9a2309e52c45841dabbf6443f83a0e5dd9c57671
|
7
|
+
data.tar.gz: 832a7746ba587a059810117e215c5dd2011604d92e8f1be63e8842dce1b8d15153f789a41834a0a912dc6410356abda2eaa63d0574ee8c4fb372c9456146c3a2
|
@@ -72,8 +72,9 @@
|
|
72
72
|
dl {
|
73
73
|
display: grid;
|
74
74
|
grid-auto-flow: row;
|
75
|
-
grid-auto-rows:
|
76
|
-
grid-template-columns: 1fr
|
75
|
+
grid-auto-rows: auto;
|
76
|
+
grid-template-columns: auto 1fr;
|
77
|
+
gap: 0 1rem;
|
77
78
|
}
|
78
79
|
|
79
80
|
dt {
|
@@ -85,11 +86,6 @@
|
|
85
86
|
color: #666;
|
86
87
|
}
|
87
88
|
|
88
|
-
ul {
|
89
|
-
list-style: none;
|
90
|
-
padding-left: 0;
|
91
|
-
}
|
92
|
-
|
93
89
|
.error {
|
94
90
|
background: #fff2f2;
|
95
91
|
border-bottom: 1px solid #fdd3d3;
|
@@ -9,6 +9,7 @@ $row-border-color: $grey !default;
|
|
9
9
|
$row-height: 48px !default;
|
10
10
|
$cell-spacing: 0.5rem !default;
|
11
11
|
$tag-color: $grey !default;
|
12
|
+
$on-tag-color: black !default;
|
12
13
|
|
13
14
|
$width-small: 6rem !default;
|
14
15
|
$width-medium: 12rem !default;
|
@@ -20,6 +21,7 @@ table {
|
|
20
21
|
--table-header-color: #{$table-header-color};
|
21
22
|
--row-border-color: #{$row-border-color};
|
22
23
|
--tag-color: #{$tag-color};
|
24
|
+
--on-tag-color: #{$on-tag-color};
|
23
25
|
|
24
26
|
--width-small: #{$width-small};
|
25
27
|
--width-medium: #{$width-medium};
|
@@ -2,8 +2,14 @@
|
|
2
2
|
width: var(--width-small);
|
3
3
|
}
|
4
4
|
|
5
|
-
:where(td.type-enum
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
:where(td.type-enum) {
|
6
|
+
// ensure ellipsis is the correct color
|
7
|
+
color: var(--on-tag-color);
|
8
|
+
|
9
|
+
small {
|
10
|
+
background: var(--tag-color);
|
11
|
+
border-radius: 0.25rem;
|
12
|
+
padding: 0.25rem 0.5rem;
|
13
|
+
font-size: small;
|
14
|
+
}
|
9
15
|
}
|
@@ -7,7 +7,7 @@ module Katalyst
|
|
7
7
|
class EnumComponent < CellComponent
|
8
8
|
def rendered_value
|
9
9
|
if (value = self.value).present?
|
10
|
-
label =
|
10
|
+
label = collection.model.human_attribute_name("#{column}.#{value}")
|
11
11
|
content_tag(:small, label, data: { enum: column, value: })
|
12
12
|
end
|
13
13
|
end
|
@@ -17,10 +17,6 @@ module Katalyst
|
|
17
17
|
def default_html_attributes
|
18
18
|
{ class: "type-enum" }
|
19
19
|
end
|
20
|
-
|
21
|
-
def i18n_enum_label_key(value)
|
22
|
-
"active_record.attributes.#{collection.model_name.i18n_key}/#{column}.#{value}"
|
23
|
-
end
|
24
20
|
end
|
25
21
|
end
|
26
22
|
end
|
@@ -64,7 +64,14 @@ module Katalyst
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def examples_for(key)
|
67
|
-
collection.examples_for(key)
|
67
|
+
collection.examples_for(key).filter_map do |example|
|
68
|
+
case example
|
69
|
+
when Collection::Type::Example
|
70
|
+
example if example.value.to_s.present?
|
71
|
+
else
|
72
|
+
raise ArgumentError, "Invalid example #{example.inspect} for #{collection.model_name}.#{key}"
|
73
|
+
end
|
74
|
+
end
|
68
75
|
end
|
69
76
|
|
70
77
|
def format_value(value)
|
@@ -24,7 +24,7 @@ module Katalyst
|
|
24
24
|
|
25
25
|
def examples_for(scope, attribute)
|
26
26
|
[
|
27
|
-
*super(scope, attribute, limit: 6),
|
27
|
+
*super(scope, attribute, limit: 6, order: :desc),
|
28
28
|
example(::Date.current.beginning_of_week.., "this week"),
|
29
29
|
example(::Date.current.beginning_of_month.., "this month"),
|
30
30
|
example(1.month.ago.all_month, "last month"),
|
@@ -17,7 +17,10 @@ module Katalyst
|
|
17
17
|
|
18
18
|
def examples_for(scope, attribute)
|
19
19
|
_, model, column = model_and_column_for(scope, attribute)
|
20
|
-
|
20
|
+
|
21
|
+
raise ArgumentError, "Unknown enum #{column} for #{model}" unless model.defined_enums.has_key?(column)
|
22
|
+
|
23
|
+
keys = model.defined_enums[column].keys
|
21
24
|
|
22
25
|
if attribute.value_before_type_cast.present?
|
23
26
|
keys = keys.select { |key| key.include?(attribute.value_before_type_cast.last) }
|
@@ -28,9 +31,10 @@ module Katalyst
|
|
28
31
|
|
29
32
|
private
|
30
33
|
|
31
|
-
def describe_key(model,
|
32
|
-
|
33
|
-
|
34
|
+
def describe_key(model, name, key)
|
35
|
+
label = model.human_attribute_name(name).downcase
|
36
|
+
value = model.human_attribute_name("#{name}.#{key}").downcase
|
37
|
+
"#{model.model_name.human} #{label} is #{value}"
|
34
38
|
end
|
35
39
|
end
|
36
40
|
end
|
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.
|
4
|
+
version: 3.4.4
|
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-07-
|
11
|
+
date: 2024-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: katalyst-html-attributes
|