@museumwnf/viewer-layout 3.70.0 → 3.71.0
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/README.md +40 -27
- package/dist/{Theme-DmcJnG3h.js → Theme-DvCv48p7.js} +119 -123
- package/dist/TimelineResultsView-Bn4rC_Se.js +614 -0
- package/dist/dxa.js +509 -489
- package/dist/minisite.js +837 -735
- package/dist/viewer-layout.css +1 -1
- package/dist/views.js +1 -1
- package/package.json +6 -4
- package/src/minisite/testing.js +281 -0
- package/src/styles/dxa-exhibition.css +14 -1
- package/src/styles/dxa-gallery.css +9 -3
- package/dist/TimelineResultsView-BF3VoCs_.js +0 -686
|
@@ -0,0 +1,614 @@
|
|
|
1
|
+
import { d as e, l as t, u as n } from "./PartnerMap-DdyMLtgH.js";
|
|
2
|
+
import { a as r, i, n as a, o, r as s, t as c } from "./TimelineEventList-CIkKxyQu.js";
|
|
3
|
+
import { Fragment as l, computed as u, createBlock as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, createSlots as h, createTextVNode as g, createVNode as _, guardReactiveProps as v, mergeProps as y, normalizeClass as b, normalizeProps as x, openBlock as S, reactive as C, ref as w, renderList as T, renderSlot as E, resolveDynamicComponent as D, toDisplayString as O, unref as k, withCtx as A } from "vue";
|
|
4
|
+
import { entityRef as j, eventDateLabel as ee, groupByCountry as M, partnerHierarchy as N, partnerView as P, renderBlock as te, renderInline as F, renderPlain as I, useCatalogueResults as ne, useDataPackage as L, useI18n as re, useListQuery as ie, usePagination as R, useTimelineEvents as z } from "@museumwnf/viewer-core";
|
|
5
|
+
import { useRouter as B } from "vue-router";
|
|
6
|
+
// src/views/CatalogueResultsView.vue
|
|
7
|
+
var V = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "mwnf-catalogue__title"
|
|
10
|
+
}, H = {
|
|
11
|
+
key: 0,
|
|
12
|
+
class: "mwnf-facet"
|
|
13
|
+
}, ae = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "mwnf-facet__label"
|
|
16
|
+
}, U = [
|
|
17
|
+
"value",
|
|
18
|
+
"placeholder",
|
|
19
|
+
"onInput"
|
|
20
|
+
], W = {
|
|
21
|
+
key: 1,
|
|
22
|
+
class: "mwnf-facet"
|
|
23
|
+
}, G = {
|
|
24
|
+
key: 0,
|
|
25
|
+
class: "mwnf-facet__label"
|
|
26
|
+
}, K = [
|
|
27
|
+
"value",
|
|
28
|
+
"placeholder",
|
|
29
|
+
"onInput"
|
|
30
|
+
], q = {
|
|
31
|
+
key: 2,
|
|
32
|
+
class: "mwnf-facet mwnf-facet--checkbox"
|
|
33
|
+
}, oe = ["checked", "onChange"], se = {
|
|
34
|
+
key: 0,
|
|
35
|
+
class: "mwnf-facet__label"
|
|
36
|
+
}, ce = { class: "mwnf-catalogue__body" }, J = { class: "mwnf-catalogue__results" }, Y = {
|
|
37
|
+
key: 0,
|
|
38
|
+
class: "mwnf-catalogue__aside"
|
|
39
|
+
}, X = {
|
|
40
|
+
__name: "CatalogueResultsView",
|
|
41
|
+
props: {
|
|
42
|
+
spec: {
|
|
43
|
+
type: Object,
|
|
44
|
+
required: !0
|
|
45
|
+
},
|
|
46
|
+
entity: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: ""
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
setup(e) {
|
|
52
|
+
let a = e, { t: c } = re(), y = u(() => a.spec), { filters: C, apply: w, reset: j, goToPage: ee, options: M, pageInfo: N, rows: P, summary: te, state: F } = ne(() => a.spec, { entity: a.entity }), I = u(() => y.value.filterMode ?? "apply"), L = u(() => y.value.controls ?? []), ie = u(() => L.value.length > 0 || !!y.value.panel);
|
|
53
|
+
function R(e, t) {
|
|
54
|
+
I.value === "immediate" ? w({ [e]: t }) : C[e] = t;
|
|
55
|
+
}
|
|
56
|
+
let z = u(() => c(y.value.empty ?? "catalogue.results.noResultsFilter")), B = u(() => y.value.variant === "grid"), X = u(() => ({
|
|
57
|
+
window: 5,
|
|
58
|
+
jump: !1,
|
|
59
|
+
ends: !0,
|
|
60
|
+
...y.value.pagination ?? {}
|
|
61
|
+
}));
|
|
62
|
+
return (e, a) => (S(), p("section", { class: b(["mwnf-catalogue", { "mwnf-catalogue--boxed": y.value.boxed }]) }, [
|
|
63
|
+
E(e.$slots, "before", x(v(k(F)))),
|
|
64
|
+
y.value.title ? (S(), p("h1", V, O(k(c)(y.value.title)), 1)) : f("", !0),
|
|
65
|
+
ie.value || e.$slots.filters ? (S(), d(i, {
|
|
66
|
+
key: 1,
|
|
67
|
+
class: "mwnf-catalogue__filters",
|
|
68
|
+
mode: I.value,
|
|
69
|
+
title: y.value.filterTitle ? k(c)(y.value.filterTitle) : "",
|
|
70
|
+
"reset-label": y.value.resetLabel ? k(c)(y.value.resetLabel) : "",
|
|
71
|
+
onApply: a[2] ||= (e) => k(w)(),
|
|
72
|
+
onReset: a[3] ||= (e) => k(j)()
|
|
73
|
+
}, {
|
|
74
|
+
default: A(() => [(S(!0), p(l, null, T(L.value, (e) => (S(), p(l, { key: e.key }, [e.type === "year" ? (S(), p("label", H, [e.label ? (S(), p("span", ae, O(k(c)(e.label)), 1)) : f("", !0), m("input", {
|
|
75
|
+
type: "number",
|
|
76
|
+
class: "mwnf-facet__select",
|
|
77
|
+
value: k(C)[e.key],
|
|
78
|
+
placeholder: e.placeholder ? k(c)(e.placeholder) : "",
|
|
79
|
+
onInput: (t) => k(C)[e.key] = t.target.value,
|
|
80
|
+
onChange: a[0] ||= (e) => I.value === "immediate" ? k(w)() : null
|
|
81
|
+
}, null, 40, U)])) : e.type === "query" ? (S(), p("label", W, [e.label ? (S(), p("span", G, O(k(c)(e.label)), 1)) : f("", !0), m("input", {
|
|
82
|
+
type: "text",
|
|
83
|
+
class: "mwnf-facet__select",
|
|
84
|
+
value: k(C)[e.key],
|
|
85
|
+
placeholder: e.placeholder ? k(c)(e.placeholder) : "",
|
|
86
|
+
onInput: (t) => k(C)[e.key] = t.target.value,
|
|
87
|
+
onChange: a[1] ||= (e) => I.value === "immediate" ? k(w)() : null
|
|
88
|
+
}, null, 40, K)])) : e.type === "checkbox" ? (S(), p("label", q, [m("input", {
|
|
89
|
+
type: "checkbox",
|
|
90
|
+
class: "mwnf-facet__checkbox",
|
|
91
|
+
checked: k(C)[e.key] === "1",
|
|
92
|
+
onChange: (t) => R(e.key, t.target.checked ? "1" : "")
|
|
93
|
+
}, null, 40, oe), e.label ? (S(), p("span", se, O(k(c)(e.label)), 1)) : f("", !0)])) : (S(), d(r, {
|
|
94
|
+
key: 3,
|
|
95
|
+
"model-value": k(C)[e.key],
|
|
96
|
+
label: e.label ? k(c)(e.label) : "",
|
|
97
|
+
options: k(M)[e.key] ?? [],
|
|
98
|
+
placeholder: e.placeholder ? k(c)(e.placeholder) : "",
|
|
99
|
+
"any-label": e.anyLabel ? k(c)(e.anyLabel) : "",
|
|
100
|
+
"hide-empty": !!e.hideEmpty,
|
|
101
|
+
"onUpdate:modelValue": (t) => R(e.key, t)
|
|
102
|
+
}, null, 8, [
|
|
103
|
+
"model-value",
|
|
104
|
+
"label",
|
|
105
|
+
"options",
|
|
106
|
+
"placeholder",
|
|
107
|
+
"any-label",
|
|
108
|
+
"hide-empty",
|
|
109
|
+
"onUpdate:modelValue"
|
|
110
|
+
]))], 64))), 128)), E(e.$slots, "filters", x(v(k(F))))]),
|
|
111
|
+
_: 3
|
|
112
|
+
}, 8, [
|
|
113
|
+
"mode",
|
|
114
|
+
"title",
|
|
115
|
+
"reset-label"
|
|
116
|
+
])) : f("", !0),
|
|
117
|
+
_(s, { parts: k(te) }, h({ _: 2 }, [e.$slots.actions ? {
|
|
118
|
+
name: "actions",
|
|
119
|
+
fn: A(() => [E(e.$slots, "actions", x(v(k(F))))]),
|
|
120
|
+
key: "0"
|
|
121
|
+
} : void 0]), 1032, ["parts"]),
|
|
122
|
+
m("div", ce, [m("div", J, [E(e.$slots, "records", x(v({
|
|
123
|
+
...k(F),
|
|
124
|
+
rows: k(P),
|
|
125
|
+
empty: z.value
|
|
126
|
+
})), () => [(S(), d(D(B.value ? t : n), {
|
|
127
|
+
records: k(P),
|
|
128
|
+
"action-label": y.value.actionLabel ? k(c)(y.value.actionLabel) : ""
|
|
129
|
+
}, {
|
|
130
|
+
empty: A(() => [E(e.$slots, "empty", x(v(k(F))), () => [g(O(z.value), 1)])]),
|
|
131
|
+
_: 3
|
|
132
|
+
}, 8, ["records", "action-label"]))]), E(e.$slots, "pagination", x(v(k(F))), () => [e.$slots.pagination ? f("", !0) : (S(), d(o, {
|
|
133
|
+
key: 0,
|
|
134
|
+
"page-info": k(N),
|
|
135
|
+
window: X.value.window,
|
|
136
|
+
jump: X.value.jump,
|
|
137
|
+
ends: X.value.ends,
|
|
138
|
+
onNavigate: k(ee)
|
|
139
|
+
}, null, 8, [
|
|
140
|
+
"page-info",
|
|
141
|
+
"window",
|
|
142
|
+
"jump",
|
|
143
|
+
"ends",
|
|
144
|
+
"onNavigate"
|
|
145
|
+
]))])]), e.$slots.aside ? (S(), p("aside", Y, [E(e.$slots, "aside", x(v(k(F))))])) : f("", !0)]),
|
|
146
|
+
E(e.$slots, "after", x(v(k(F))))
|
|
147
|
+
], 2));
|
|
148
|
+
}
|
|
149
|
+
}, le = { class: "mwnf-partner-list" }, ue = {
|
|
150
|
+
key: 0,
|
|
151
|
+
class: "mwnf-partner-list__title"
|
|
152
|
+
}, de = {
|
|
153
|
+
key: 1,
|
|
154
|
+
class: "mwnf-partner-list__count"
|
|
155
|
+
}, fe = {
|
|
156
|
+
key: 2,
|
|
157
|
+
class: "mwnf-partner-list__toggle"
|
|
158
|
+
}, Z = {
|
|
159
|
+
key: 3,
|
|
160
|
+
class: "mwnf-partner-list__groups"
|
|
161
|
+
}, Q = {
|
|
162
|
+
key: 0,
|
|
163
|
+
class: "mwnf-partner-list__group-title"
|
|
164
|
+
}, pe = { class: "mwnf-partner-list__tier" }, me = { class: "mwnf-partner-list__row" }, he = {
|
|
165
|
+
key: 0,
|
|
166
|
+
class: "mwnf-partner-list__children"
|
|
167
|
+
}, $ = {
|
|
168
|
+
key: 0,
|
|
169
|
+
class: "mwnf-partner-list__tier mwnf-partner-list__tier--associated"
|
|
170
|
+
}, ge = { class: "mwnf-partner-list__tier-label" }, _e = {
|
|
171
|
+
key: 4,
|
|
172
|
+
class: "mwnf-partner-list__empty"
|
|
173
|
+
}, ve = {
|
|
174
|
+
__name: "PartnerListView",
|
|
175
|
+
props: { spec: {
|
|
176
|
+
type: Object,
|
|
177
|
+
required: !0
|
|
178
|
+
} },
|
|
179
|
+
setup(e) {
|
|
180
|
+
let t = e, { t: n, locale: r } = re(), i = L(), o = u(() => t.spec), s = u(() => o.value.entity ?? "partners"), c = j(s.value);
|
|
181
|
+
s.value && i.loadTranslations(s.value, "en");
|
|
182
|
+
let h = {
|
|
183
|
+
t: n,
|
|
184
|
+
locale: r,
|
|
185
|
+
tr: (e) => i.tr(s.value, e, r.value, "en"),
|
|
186
|
+
renderInline: F,
|
|
187
|
+
renderPlain: I
|
|
188
|
+
}, { filters: g, apply: b } = ie({
|
|
189
|
+
keys: ["order"],
|
|
190
|
+
page: !1
|
|
191
|
+
}), C = u(() => g.order === "desc" ? "desc" : "asc");
|
|
192
|
+
function w() {
|
|
193
|
+
b({ order: C.value === "asc" ? "desc" : "asc" });
|
|
194
|
+
}
|
|
195
|
+
let k = u(() => {
|
|
196
|
+
let e = o.value, t = c.value ?? [];
|
|
197
|
+
return e.scope ? t.filter((t) => e.scope(t, h)) : t;
|
|
198
|
+
}), ee = u(() => o.value.route);
|
|
199
|
+
function te(e) {
|
|
200
|
+
let t = ee.value;
|
|
201
|
+
return t ? typeof t == "function" ? t(e, h) : {
|
|
202
|
+
name: t,
|
|
203
|
+
params: { id: e.id }
|
|
204
|
+
} : null;
|
|
205
|
+
}
|
|
206
|
+
function ne(e) {
|
|
207
|
+
let t = o.value.objectsRoute;
|
|
208
|
+
return P(e, h.tr(e.id), {
|
|
209
|
+
route: te,
|
|
210
|
+
objectsRoute: t ? (e) => t(e, h) : null
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
function R(e, t) {
|
|
214
|
+
let n = t.name ?? "";
|
|
215
|
+
return {
|
|
216
|
+
...P(e, {}, {}),
|
|
217
|
+
name: n,
|
|
218
|
+
plainName: B(n),
|
|
219
|
+
city: t.city ?? "",
|
|
220
|
+
location: t.city ?? "",
|
|
221
|
+
logos: t.logo ? [{
|
|
222
|
+
url: t.logo,
|
|
223
|
+
alt: B(n),
|
|
224
|
+
type: ""
|
|
225
|
+
}] : [],
|
|
226
|
+
itemCount: t.count ?? 0,
|
|
227
|
+
route: t.route ?? null
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function z(e) {
|
|
231
|
+
if (o.value.record) {
|
|
232
|
+
let t = o.value.record(e, h);
|
|
233
|
+
return {
|
|
234
|
+
partner: e,
|
|
235
|
+
row: t,
|
|
236
|
+
view: R(e, t)
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
let t = ne(e);
|
|
240
|
+
return {
|
|
241
|
+
partner: e,
|
|
242
|
+
row: {
|
|
243
|
+
name: t.name,
|
|
244
|
+
city: t.city,
|
|
245
|
+
logo: t.logos[0]?.url ?? "",
|
|
246
|
+
count: t.itemCount,
|
|
247
|
+
route: t.route
|
|
248
|
+
},
|
|
249
|
+
view: t
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
function B(e) {
|
|
253
|
+
return String(e ?? "").replace(/<[^>]*>/g, "");
|
|
254
|
+
}
|
|
255
|
+
let V = u(() => o.value.nested ? N(k.value) : null), H = u(() => {
|
|
256
|
+
let e = o.value, t = e.group?.tier ?? !1, n = (e.group?.order ?? "country") === "name", r = n ? k.value.map((e) => ({
|
|
257
|
+
...e,
|
|
258
|
+
country_id: "\0"
|
|
259
|
+
})) : k.value, i = M(r, {
|
|
260
|
+
label: n ? () => "" : (t) => e.label ? e.label(t, h) : t,
|
|
261
|
+
tier: t,
|
|
262
|
+
order: C.value
|
|
263
|
+
}), a = e.tiebreak ?? (() => ""), s = (e, t) => B(e.row.name).localeCompare(B(t.row.name)) || String(a(e.partner)).localeCompare(String(a(t.partner)));
|
|
264
|
+
return i.map((t) => {
|
|
265
|
+
let r = t.main.map(z).sort(s), i = t.associated.map(z).sort(s);
|
|
266
|
+
if (n && C.value === "desc" && (r.reverse(), i.reverse()), e.nested && V.value) {
|
|
267
|
+
let e = new Set(i.map((e) => e.partner.id));
|
|
268
|
+
r = r.map((t) => {
|
|
269
|
+
let n = V.value.children(t.partner.id).filter((t) => e.has(t.id));
|
|
270
|
+
for (let t of n) e.delete(t.id);
|
|
271
|
+
return {
|
|
272
|
+
...t,
|
|
273
|
+
children: n.map(z)
|
|
274
|
+
};
|
|
275
|
+
}), i = i.filter((t) => e.has(t.partner.id));
|
|
276
|
+
}
|
|
277
|
+
return {
|
|
278
|
+
country: t.country,
|
|
279
|
+
label: t.label,
|
|
280
|
+
main: r,
|
|
281
|
+
associated: i
|
|
282
|
+
};
|
|
283
|
+
});
|
|
284
|
+
}), ae = u(() => H.value.some((e) => e.main.length > 0 || e.associated.length > 0)), U = u(() => n(o.value.associatedLabel ?? "partner.list.associated")), W = u(() => ({
|
|
285
|
+
objectsLabel: o.value.objectsLabel ?? "partner.item.objectsInSite",
|
|
286
|
+
emptyLabel: o.value.emptyLabel ?? "",
|
|
287
|
+
show: { actions: !!o.value.actions }
|
|
288
|
+
})), G = u(() => n(o.value.foundLabel ?? "partner.list.partnersFound")), K = u(() => n(o.value.sortAscendingLabel ?? "partner.list.sortAscending")), q = u(() => n(o.value.sortDescendingLabel ?? "partner.list.sortDescending")), oe = u(() => n(o.value.empty ?? "catalogue.results.noResults")), se = u(() => o.value.title ? n(o.value.title) : ""), ce = u(() => H.value.reduce((e, t) => e + t.main.length + t.associated.length, 0)), J = u(() => o.value.variant ?? "accordion"), Y = u(() => ({
|
|
289
|
+
t: n,
|
|
290
|
+
locale: r,
|
|
291
|
+
groups: H.value,
|
|
292
|
+
orderDir: C.value,
|
|
293
|
+
toggleOrder: w
|
|
294
|
+
}));
|
|
295
|
+
return (e, t) => (S(), p("section", le, [
|
|
296
|
+
se.value ? (S(), p("h1", ue, O(se.value), 1)) : f("", !0),
|
|
297
|
+
o.value.count ? (S(), p("div", de, O(G.value) + ": " + O(ce.value), 1)) : f("", !0),
|
|
298
|
+
E(e.$slots, "before", x(v(Y.value))),
|
|
299
|
+
o.value.orderToggle ? (S(), p("div", fe, [m("button", {
|
|
300
|
+
type: "button",
|
|
301
|
+
class: "mwnf-partner-list__toggle-button",
|
|
302
|
+
onClick: w
|
|
303
|
+
}, O(C.value === "asc" ? q.value : K.value), 1)])) : f("", !0),
|
|
304
|
+
ae.value ? (S(), p("div", Z, [(S(!0), p(l, null, T(H.value, (t) => (S(), d(D(J.value === "accordion" ? "details" : "section"), y({
|
|
305
|
+
key: t.country ?? "",
|
|
306
|
+
class: "mwnf-partner-list__group"
|
|
307
|
+
}, { ref_for: !0 }, J.value === "accordion" ? { open: !0 } : {}), {
|
|
308
|
+
default: A(() => [
|
|
309
|
+
(S(), d(D(J.value === "accordion" ? "summary" : "div"), { class: "mwnf-partner-list__group-heading" }, {
|
|
310
|
+
default: A(() => [E(e.$slots, "group-heading", y({ group: t }, { ref_for: !0 }, Y.value), () => [t.label ? (S(), p("h2", Q, O(t.label), 1)) : f("", !0)])]),
|
|
311
|
+
_: 2
|
|
312
|
+
}, 1024)),
|
|
313
|
+
m("div", pe, [(S(!0), p(l, null, T(t.main, (n) => (S(), p("div", {
|
|
314
|
+
key: n.partner.id,
|
|
315
|
+
class: "mwnf-partner-list__row-block"
|
|
316
|
+
}, [m("div", me, [E(e.$slots, "row", y({
|
|
317
|
+
group: t,
|
|
318
|
+
partner: n.partner,
|
|
319
|
+
row: n.row,
|
|
320
|
+
view: n.view
|
|
321
|
+
}, { ref_for: !0 }, Y.value), () => [_(a, y({
|
|
322
|
+
variant: "line",
|
|
323
|
+
partner: n.view
|
|
324
|
+
}, { ref_for: !0 }, W.value), null, 16, ["partner"])])]), n.children?.length ? (S(), p("div", he, [(S(!0), p(l, null, T(n.children, (n) => (S(), p("div", {
|
|
325
|
+
key: n.partner.id,
|
|
326
|
+
class: "mwnf-partner-list__row mwnf-partner-list__row--child"
|
|
327
|
+
}, [E(e.$slots, "row", y({
|
|
328
|
+
group: t,
|
|
329
|
+
partner: n.partner,
|
|
330
|
+
row: n.row,
|
|
331
|
+
view: n.view
|
|
332
|
+
}, { ref_for: !0 }, Y.value), () => [_(a, y({
|
|
333
|
+
variant: "line",
|
|
334
|
+
partner: n.view
|
|
335
|
+
}, { ref_for: !0 }, W.value), null, 16, ["partner"])])]))), 128))])) : f("", !0)]))), 128))]),
|
|
336
|
+
t.associated.length ? (S(), p("div", $, [m("p", ge, O(U.value), 1), (S(!0), p(l, null, T(t.associated, (n) => (S(), p("div", {
|
|
337
|
+
key: n.partner.id,
|
|
338
|
+
class: "mwnf-partner-list__row"
|
|
339
|
+
}, [E(e.$slots, "row", y({
|
|
340
|
+
group: t,
|
|
341
|
+
partner: n.partner,
|
|
342
|
+
row: n.row,
|
|
343
|
+
view: n.view
|
|
344
|
+
}, { ref_for: !0 }, Y.value), () => [_(a, y({
|
|
345
|
+
variant: "line",
|
|
346
|
+
partner: n.view
|
|
347
|
+
}, { ref_for: !0 }, W.value), null, 16, ["partner"])])]))), 128))])) : f("", !0)
|
|
348
|
+
]),
|
|
349
|
+
_: 2
|
|
350
|
+
}, 1040))), 128))])) : (S(), p("p", _e, O(oe.value), 1)),
|
|
351
|
+
E(e.$slots, "after", x(v(Y.value)))
|
|
352
|
+
]));
|
|
353
|
+
}
|
|
354
|
+
}, ye = { class: "mwnf-timeline" }, be = {
|
|
355
|
+
key: 0,
|
|
356
|
+
class: "mwnf-timeline__title"
|
|
357
|
+
}, xe = {
|
|
358
|
+
key: 3,
|
|
359
|
+
class: "mwnf-facet"
|
|
360
|
+
}, Se = { class: "mwnf-facet__label" }, Ce = [
|
|
361
|
+
"value",
|
|
362
|
+
"placeholder",
|
|
363
|
+
"onInput"
|
|
364
|
+
], we = {
|
|
365
|
+
key: 3,
|
|
366
|
+
class: "mwnf-timeline__error"
|
|
367
|
+
}, Te = {
|
|
368
|
+
__name: "TimelineResultsView",
|
|
369
|
+
props: { spec: {
|
|
370
|
+
type: Object,
|
|
371
|
+
required: !0
|
|
372
|
+
} },
|
|
373
|
+
setup(t) {
|
|
374
|
+
let n = t, { t: a } = re(), h = B(), b = u(() => n.spec), D = u(() => !!b.value.entrance), j = z({
|
|
375
|
+
scope: n.spec.scope ?? "country",
|
|
376
|
+
countryLabel: n.spec.countryLabel,
|
|
377
|
+
countryIdForCode: n.spec.countryIdForCode,
|
|
378
|
+
tr: n.spec.tr,
|
|
379
|
+
timelinesEntity: n.spec.timelinesEntity,
|
|
380
|
+
eventsEntity: n.spec.eventsEntity
|
|
381
|
+
}), M = u(() => b.value.controls ?? []), N = u(() => b.value.keys ?? M.value.map((e) => e.key)), P = (e) => M.value.some((t) => t.key === e), I = u(() => ({
|
|
382
|
+
t: a,
|
|
383
|
+
tr: n.spec.tr,
|
|
384
|
+
years: {
|
|
385
|
+
min: K.value[0],
|
|
386
|
+
max: K.value[1]
|
|
387
|
+
}
|
|
388
|
+
})), ne = C(Object.fromEntries(N.value.map((e) => [e, ""]))), L = w(""), V = D.value ? null : ie({ keys: N.value }), H = D.value ? ne : V.filters;
|
|
389
|
+
function ae(e) {
|
|
390
|
+
if (P("collection") && e !== "" && e != null) return e === "pc" ? null : e;
|
|
391
|
+
}
|
|
392
|
+
function U() {
|
|
393
|
+
for (let e of N.value) ne[e] = "";
|
|
394
|
+
L.value = "";
|
|
395
|
+
}
|
|
396
|
+
function W() {
|
|
397
|
+
L.value = "";
|
|
398
|
+
let e = !!H.begin && !!H.end;
|
|
399
|
+
if (e && Number(H.begin) >= Number(H.end)) {
|
|
400
|
+
L.value = a(b.value.errorPeriod ?? "timeline.form.errorPeriod");
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
if (!H.country && !e) {
|
|
404
|
+
L.value = a(b.value.errorSelect ?? "timeline.form.errorSelect");
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
let t = {};
|
|
408
|
+
for (let e of N.value) H[e] && (t[e] = H[e]);
|
|
409
|
+
h.push({
|
|
410
|
+
name: b.value.route,
|
|
411
|
+
query: t
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
let G = u(() => {
|
|
415
|
+
if (D.value) return [];
|
|
416
|
+
let e = H;
|
|
417
|
+
return j.findEvents({
|
|
418
|
+
country: e.country || void 0,
|
|
419
|
+
collection: ae(e.collection),
|
|
420
|
+
begin: e.begin,
|
|
421
|
+
end: e.end
|
|
422
|
+
});
|
|
423
|
+
}), K = u(() => {
|
|
424
|
+
let e = j.findEvents({
|
|
425
|
+
country: void 0,
|
|
426
|
+
collection: void 0
|
|
427
|
+
}), t = (e) => Number.isFinite(e) && e !== 0, n = e.map((e) => e.year_from).filter(t), r = e.map((e) => t(e.year_to) ? e.year_to : e.year_from).filter(t);
|
|
428
|
+
return n.length ? [Math.min(...n), Math.max(...r)] : [null, null];
|
|
429
|
+
}), q = R(G, {
|
|
430
|
+
page: () => V ? V.page.value : 1,
|
|
431
|
+
size: () => b.value.pageSize ?? 15
|
|
432
|
+
}), oe = (e) => a(b.value.eraWords?.[e] ?? e);
|
|
433
|
+
function se(e) {
|
|
434
|
+
let t = b.value.countryLabel && e.country_id ? b.value.countryLabel(e.country_id) : "";
|
|
435
|
+
return {
|
|
436
|
+
id: e.id,
|
|
437
|
+
date: ee(e, e.text, oe),
|
|
438
|
+
caption: t ? F(String(t)) : "",
|
|
439
|
+
description: e.text?.description ? te(String(e.text.description), { breaks: !0 }) : ""
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
let ce = u(() => q.value.rows.map((e) => (b.value.event ?? se)(e, I.value))), J = u(() => (j.countries.value ?? []).map((e) => ({
|
|
443
|
+
value: e.value,
|
|
444
|
+
label: e.value === "all" ? a("timeline.form.allCountries") : e.label
|
|
445
|
+
}))), Y = u(() => b.value.collections?.(I.value) ?? []), X = u(() => {
|
|
446
|
+
let e = {};
|
|
447
|
+
for (let t of M.value) (t.key === "begin" || t.key === "end") && t.options && (typeof t.options == "function" ? e[t.key] = t.options(I.value) : e[t.key] = t.options);
|
|
448
|
+
return e;
|
|
449
|
+
}), le = u(() => ({
|
|
450
|
+
filters: H,
|
|
451
|
+
active: N.value.some((e) => H[e]),
|
|
452
|
+
apply: D.value ? W : (e) => V.apply(e),
|
|
453
|
+
reset: D.value ? U : V.reset,
|
|
454
|
+
goToPage: D.value ? () => {} : V.goToPage,
|
|
455
|
+
events: G.value,
|
|
456
|
+
rows: ce.value,
|
|
457
|
+
pageInfo: q.value,
|
|
458
|
+
countries: J.value,
|
|
459
|
+
collections: Y.value,
|
|
460
|
+
t: a,
|
|
461
|
+
tr: b.value.tr
|
|
462
|
+
})), ue = u(() => {
|
|
463
|
+
let e = b.value.gallery;
|
|
464
|
+
return !e || D.value ? null : !e.items || e.items(le.value);
|
|
465
|
+
}), de = u(() => {
|
|
466
|
+
let e = ue.value;
|
|
467
|
+
return e == null ? !1 : Array.isArray(e) ? e.length > 0 : !!e;
|
|
468
|
+
}), fe = u(() => {
|
|
469
|
+
let e = ue.value;
|
|
470
|
+
return Array.isArray(e) ? e.length : typeof e == "number" ? e : null;
|
|
471
|
+
}), Z = u(() => {
|
|
472
|
+
if (!de.value) return null;
|
|
473
|
+
let e = {};
|
|
474
|
+
for (let t of N.value) H[t] && (e[t] = H[t]);
|
|
475
|
+
return {
|
|
476
|
+
to: {
|
|
477
|
+
name: b.value.gallery.route,
|
|
478
|
+
query: e
|
|
479
|
+
},
|
|
480
|
+
count: fe.value,
|
|
481
|
+
label: a(b.value.gallery.label ?? "timeline.nav.seeGallery")
|
|
482
|
+
};
|
|
483
|
+
}), Q = u(() => ({
|
|
484
|
+
...le.value,
|
|
485
|
+
gallery: Z.value
|
|
486
|
+
})), pe = u(() => b.value.summary ? b.value.summary(Q.value) : [{
|
|
487
|
+
label: a(b.value.summaryLabel ?? "timeline.results.eventsFound"),
|
|
488
|
+
count: q.value.total
|
|
489
|
+
}]), me = u(() => a(b.value.empty ?? "timeline.results.noResults")), he = u(() => ({
|
|
490
|
+
window: 5,
|
|
491
|
+
jump: !1,
|
|
492
|
+
ends: !0,
|
|
493
|
+
...b.value.pagination ?? {}
|
|
494
|
+
}));
|
|
495
|
+
function $(e, t) {
|
|
496
|
+
return e.label ? a(e.label) : t ? a(t) : "";
|
|
497
|
+
}
|
|
498
|
+
return (t, n) => (S(), p("section", ye, [
|
|
499
|
+
E(t.$slots, "before", x(v(Q.value))),
|
|
500
|
+
b.value.title ? (S(), p("h1", be, O(k(a)(b.value.title)), 1)) : f("", !0),
|
|
501
|
+
t.$slots.form ? E(t.$slots, "form", y(D.value ? {} : Q.value, {
|
|
502
|
+
filters: k(H),
|
|
503
|
+
countries: J.value,
|
|
504
|
+
options: X.value,
|
|
505
|
+
go: (e) => k(h).push({
|
|
506
|
+
name: b.value.route,
|
|
507
|
+
query: e
|
|
508
|
+
}),
|
|
509
|
+
t: k(a)
|
|
510
|
+
}), void 0, void 0, 1) : (S(), d(i, {
|
|
511
|
+
key: 2,
|
|
512
|
+
class: "mwnf-timeline__filters",
|
|
513
|
+
title: b.value.filterTitle ? k(a)(b.value.filterTitle) : "",
|
|
514
|
+
"apply-label": D.value ? k(a)(b.value.submitLabel ?? "core.action.search") : b.value.applyLabel ? k(a)(b.value.applyLabel) : "",
|
|
515
|
+
"reset-label": b.value.resetLabel ? k(a)(b.value.resetLabel) : "",
|
|
516
|
+
onApply: n[2] ||= (e) => D.value ? W() : k(V).apply(),
|
|
517
|
+
onReset: n[3] ||= (e) => D.value ? U() : k(V).reset()
|
|
518
|
+
}, {
|
|
519
|
+
default: A(() => [(S(!0), p(l, null, T(M.value, (e) => (S(), p(l, { key: e.key }, [e.key === "country" ? (S(), d(r, {
|
|
520
|
+
key: 0,
|
|
521
|
+
"model-value": k(H).country,
|
|
522
|
+
label: $(e, "catalogue.facet.country"),
|
|
523
|
+
options: J.value,
|
|
524
|
+
placeholder: e.placeholder ? k(a)(e.placeholder) : k(a)("catalogue.facet.selectCountry"),
|
|
525
|
+
"any-label": e.anyLabel ? k(a)(e.anyLabel) : "",
|
|
526
|
+
"hide-empty": !!e.hideEmpty,
|
|
527
|
+
"onUpdate:modelValue": n[0] ||= (e) => k(H).country = e
|
|
528
|
+
}, null, 8, [
|
|
529
|
+
"model-value",
|
|
530
|
+
"label",
|
|
531
|
+
"options",
|
|
532
|
+
"placeholder",
|
|
533
|
+
"any-label",
|
|
534
|
+
"hide-empty"
|
|
535
|
+
])) : e.key === "collection" ? (S(), d(r, {
|
|
536
|
+
key: 1,
|
|
537
|
+
"model-value": k(H).collection,
|
|
538
|
+
label: $(e),
|
|
539
|
+
options: Y.value,
|
|
540
|
+
placeholder: e.placeholder ? k(a)(e.placeholder) : "",
|
|
541
|
+
"any-label": e.anyLabel ? k(a)(e.anyLabel) : "",
|
|
542
|
+
"hide-empty": !!e.hideEmpty,
|
|
543
|
+
"onUpdate:modelValue": n[1] ||= (e) => k(H).collection = e
|
|
544
|
+
}, null, 8, [
|
|
545
|
+
"model-value",
|
|
546
|
+
"label",
|
|
547
|
+
"options",
|
|
548
|
+
"placeholder",
|
|
549
|
+
"any-label",
|
|
550
|
+
"hide-empty"
|
|
551
|
+
])) : (e.key === "begin" || e.key === "end") && X.value[e.key] ? (S(), d(r, {
|
|
552
|
+
key: 2,
|
|
553
|
+
"model-value": k(H)[e.key],
|
|
554
|
+
label: $(e, e.key === "begin" ? "catalogue.facet.startDate" : "catalogue.facet.endDate"),
|
|
555
|
+
options: X.value[e.key],
|
|
556
|
+
placeholder: e.placeholder ? k(a)(e.placeholder) : k(a)(e.key === "begin" ? "timeline.form.fromYearHint" : "timeline.form.toYearHint"),
|
|
557
|
+
"any-label": e.anyLabel ? k(a)(e.anyLabel) : "",
|
|
558
|
+
"hide-empty": !!e.hideEmpty,
|
|
559
|
+
"onUpdate:modelValue": (t) => k(H)[e.key] = t
|
|
560
|
+
}, null, 8, [
|
|
561
|
+
"model-value",
|
|
562
|
+
"label",
|
|
563
|
+
"options",
|
|
564
|
+
"placeholder",
|
|
565
|
+
"any-label",
|
|
566
|
+
"hide-empty",
|
|
567
|
+
"onUpdate:modelValue"
|
|
568
|
+
])) : (S(), p("label", xe, [m("span", Se, O($(e, e.key === "begin" ? "catalogue.facet.startDate" : "catalogue.facet.endDate")), 1), m("input", {
|
|
569
|
+
type: "number",
|
|
570
|
+
class: "mwnf-facet__select",
|
|
571
|
+
value: k(H)[e.key],
|
|
572
|
+
placeholder: e.placeholder ? k(a)(e.placeholder) : k(a)(e.key === "begin" ? "timeline.form.fromYearHint" : "timeline.form.toYearHint"),
|
|
573
|
+
onInput: (t) => k(H)[e.key] = t.target.value
|
|
574
|
+
}, null, 40, Ce)]))], 64))), 128))]),
|
|
575
|
+
_: 1
|
|
576
|
+
}, 8, [
|
|
577
|
+
"title",
|
|
578
|
+
"apply-label",
|
|
579
|
+
"reset-label"
|
|
580
|
+
])),
|
|
581
|
+
D.value && L.value ? (S(), p("p", we, O(L.value), 1)) : f("", !0),
|
|
582
|
+
D.value ? f("", !0) : (S(), p(l, { key: 4 }, [
|
|
583
|
+
E(t.$slots, "summary", x(v(Q.value)), () => [_(s, { parts: pe.value }, null, 8, ["parts"])]),
|
|
584
|
+
E(t.$slots, "gallery", x(v(Q.value)), () => [Z.value && !t.$slots.gallery ? (S(), d(e, {
|
|
585
|
+
key: 0,
|
|
586
|
+
class: "mwnf-timeline__gallery",
|
|
587
|
+
to: Z.value.to
|
|
588
|
+
}, {
|
|
589
|
+
default: A(() => [E(t.$slots, "cross-link", x(v(Q.value)), () => [g(O(Z.value.label), 1), Z.value.count == null ? f("", !0) : (S(), p(l, { key: 0 }, [g(" (" + O(Z.value.count) + ")", 1)], 64))])]),
|
|
590
|
+
_: 3
|
|
591
|
+
}, 8, ["to"])) : f("", !0)]),
|
|
592
|
+
E(t.$slots, "event", x(v(Q.value)), () => [_(c, { events: ce.value }, {
|
|
593
|
+
empty: A(() => [E(t.$slots, "empty", x(v(Q.value)), () => [g(O(me.value), 1)])]),
|
|
594
|
+
_: 3
|
|
595
|
+
}, 8, ["events"])]),
|
|
596
|
+
E(t.$slots, "pagination", x(v(Q.value)), () => [_(o, {
|
|
597
|
+
"page-info": k(q),
|
|
598
|
+
window: he.value.window,
|
|
599
|
+
jump: he.value.jump,
|
|
600
|
+
ends: he.value.ends,
|
|
601
|
+
onNavigate: k(V).goToPage
|
|
602
|
+
}, null, 8, [
|
|
603
|
+
"page-info",
|
|
604
|
+
"window",
|
|
605
|
+
"jump",
|
|
606
|
+
"ends",
|
|
607
|
+
"onNavigate"
|
|
608
|
+
])])
|
|
609
|
+
], 64)),
|
|
610
|
+
E(t.$slots, "after", x(v(Q.value)))
|
|
611
|
+
]));
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
export { ve as n, X as r, Te as t };
|