forest_admin_datasource_customizer 1.39.1 → 1.39.3
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 78d96df2b8c9a17830a1e489d8fd05780fd0f320c791bbfbec87c697d2fb25d3
|
|
4
|
+
data.tar.gz: f6c904ab8d5fba6fc0cc736fd0ab632cf6398272121a1e1e5c5f70616828bc66
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8d624eb012a899bbc077fd0b577ecf2a60d66bc4d2b4b9dc8fc319cfaf76fe4f1244505a12e4b177feccdb2502952ba442c611c9a3405291f4fda64dcdec10c0
|
|
7
|
+
data.tar.gz: 64a764eaabecfd51708fa405f7dc9ce88cf6e4e3b74a76d2b4a8c6d152bb6783322597ab4594195f4c5f0b6e6a2afe5525405f3cf469765f6cf84c5697919a6c
|
data/lib/forest_admin_datasource_customizer/decorators/search/search_collection_decorator.rb
CHANGED
|
@@ -56,8 +56,43 @@ module ForestAdminDatasourceCustomizer
|
|
|
56
56
|
filter
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
+
# Answers against +@child_collection+, which is what the search actually reads: a field
|
|
60
|
+
# hidden by the publication or renaming layers above is still searched.
|
|
61
|
+
#
|
|
62
|
+
# The term is run through the same +build_condition+ selection +refine_filter+ applies, so a
|
|
63
|
+
# field the search cannot match — a number column for a word, a uuid column for anything
|
|
64
|
+
# else — is left out rather than reported as reached.
|
|
65
|
+
#
|
|
66
|
+
# +nil+ whenever this layer does not choose the fields — a replacer is installed, or the
|
|
67
|
+
# child collection searches natively — because then no enumeration made here is true.
|
|
68
|
+
def searched_fields(search, extended)
|
|
69
|
+
return nil unless enumerable_search?
|
|
70
|
+
return [] if insignificant_search?(search)
|
|
71
|
+
|
|
72
|
+
get_fields(extended).filter_map do |path, schema|
|
|
73
|
+
searched_field(path) if build_condition(path, schema, search)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
59
77
|
private
|
|
60
78
|
|
|
79
|
+
def enumerable_search?
|
|
80
|
+
@replacer.nil? && !@child_collection.schema[:searchable]
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def insignificant_search?(search)
|
|
84
|
+
search.nil? || search.strip.empty?
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def searched_field(path)
|
|
88
|
+
{
|
|
89
|
+
path: path,
|
|
90
|
+
collections: ForestAdminDatasourceToolkit::Utils::FieldPath.leaf_collection_names(
|
|
91
|
+
@child_collection, path
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
end
|
|
95
|
+
|
|
61
96
|
def default_replacer(search, extended)
|
|
62
97
|
searchable_fields = get_fields(extended)
|
|
63
98
|
|
|
@@ -51,15 +51,19 @@ module ForestAdminDatasourceCustomizer
|
|
|
51
51
|
projection.apply(records)
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
+
# `@sorts` holds nil as the value of an emulated field, so membership is
|
|
55
|
+
# read with `key?`, the way `emulated?` reads it. The ColumnSchema objects
|
|
56
|
+
# belong to the collection below, so each is copied before the flag is
|
|
57
|
+
# written.
|
|
54
58
|
def refine_schema(child_schema)
|
|
55
|
-
child_schema
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
schema = child_schema.dup
|
|
60
|
+
schema[:fields] = child_schema[:fields].to_h do |name, field|
|
|
61
|
+
next [name, field] unless field.type == 'Column' && @sorts.key?(name)
|
|
62
|
+
|
|
63
|
+
[name, field.dup.tap { |column| column.is_sortable = true }]
|
|
60
64
|
end
|
|
61
65
|
|
|
62
|
-
|
|
66
|
+
schema
|
|
63
67
|
end
|
|
64
68
|
|
|
65
69
|
def rewrite_plain_sort_clause(clause)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: forest_admin_datasource_customizer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.39.
|
|
4
|
+
version: 1.39.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matthieu
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2026-08-
|
|
12
|
+
date: 2026-08-26 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activesupport
|