@museumwnf/viewer-core 2.25.1 → 2.25.2
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed, toValue } from 'vue'
|
|
1
|
+
import { computed, toValue, watchEffect } from 'vue'
|
|
2
2
|
import { useDataPackage } from '../composables/useDataPackage.js'
|
|
3
3
|
import { entityRef } from '../composables/useEntities.js'
|
|
4
4
|
import { useI18n } from '../i18n/index.js'
|
|
@@ -42,6 +42,19 @@ export function useCatalogueResults(spec, { entity: routeEntity = '' } = {}) {
|
|
|
42
42
|
]
|
|
43
43
|
const { filters, page, active, apply, reset, goToPage } = useListQuery({ keys })
|
|
44
44
|
|
|
45
|
+
// A URL value in an older spelling (a legacy country code) is turned into
|
|
46
|
+
// the facet's own as soon as the facet can read it, so the controls bound
|
|
47
|
+
// to `filters`, the options they match and the summary all see the value
|
|
48
|
+
// the records carry. Re-runs when the route writes the old spelling back.
|
|
49
|
+
watchEffect(() => {
|
|
50
|
+
for (const [key, facet] of Object.entries(current.value.facets ?? {})) {
|
|
51
|
+
const value = filters[key]
|
|
52
|
+
if (!facet.canonical || !value) continue
|
|
53
|
+
const wanted = facet.canonical(value)
|
|
54
|
+
if (wanted != null && String(wanted) !== value) filters[key] = String(wanted)
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
|
|
45
58
|
const helpers = {
|
|
46
59
|
t,
|
|
47
60
|
locale,
|
|
@@ -156,7 +156,7 @@ export function useGalleryCollection(data, config = {}) {
|
|
|
156
156
|
/** The filter summary line legacy printed as "Collection | <selections>". */
|
|
157
157
|
function filterSummary(filters, t) {
|
|
158
158
|
const parts = []
|
|
159
|
-
if (filters.country) parts.push(labelOf('countries', countryIdForCode(filters.country)))
|
|
159
|
+
if (filters.country) parts.push(labelOf('countries', countryIdForCode(FACETS.country.canonical(filters.country) ?? filters.country)))
|
|
160
160
|
for (const key of FACET_CATEGORIES) if (filters[key]) parts.push(tagLabelForLegacy(filters[key]))
|
|
161
161
|
if (filters.from) parts.push(`${t('catalogue.filter.from')} ${filters.from}`)
|
|
162
162
|
if (filters.to) parts.push(`${t('catalogue.filter.to')} ${filters.to}`)
|