@museumwnf/viewer-core 2.25.0 → 2.25.1
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.
package/package.json
CHANGED
|
@@ -55,7 +55,9 @@ export function useCatalogueResults(spec, { entity: routeEntity = '' } = {}) {
|
|
|
55
55
|
let list = records.value ?? []
|
|
56
56
|
if (s.scope) list = list.filter((record) => s.scope(record, filters, helpers))
|
|
57
57
|
for (const [key, facet] of Object.entries(s.facets ?? {})) {
|
|
58
|
-
|
|
58
|
+
// A facet's `canonical(value)` turns a value the URL may carry in an
|
|
59
|
+
// older spelling (a legacy country code) into the one its records carry.
|
|
60
|
+
const wanted = facet.canonical && filters[key] ? facet.canonical(filters[key]) ?? filters[key] : filters[key]
|
|
59
61
|
if (!wanted) continue
|
|
60
62
|
list = list.filter((record) => facetValues(record, facet).map(String).includes(String(wanted)))
|
|
61
63
|
}
|
|
@@ -56,6 +56,10 @@ export function useGalleryCollection(data, config = {}) {
|
|
|
56
56
|
country: {
|
|
57
57
|
values: (item) => countryUrlCode(countryById.value.get(item.country_id)),
|
|
58
58
|
label: (code) => labelOf('countries', countryIdForCode(code)),
|
|
59
|
+
// A link shared with a legacy code (`uk`) still filters: the code is
|
|
60
|
+
// read as the country's URL code (`gb`). Where a legacy code is another
|
|
61
|
+
// country's ISO code (`ua`), the ISO reading wins.
|
|
62
|
+
canonical: (code) => countryUrlCode(countryById.value.get(countryIdForCode(code))),
|
|
59
63
|
},
|
|
60
64
|
...Object.fromEntries(
|
|
61
65
|
FACET_CATEGORIES.map((category) => [
|