@museumwnf/viewer-layout 3.5.0 → 3.7.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.
@@ -1,263 +0,0 @@
1
- import { a as e, c as t, d as n, i as r, n as ee, o as te, r as ne, s as re, t as i } from "./GlossaryPopover-DcptyNWI.js";
2
- import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createSlots as d, createTextVNode as f, createVNode as p, guardReactiveProps as m, normalizeClass as ie, normalizeProps as h, openBlock as g, renderList as _, renderSlot as v, toDisplayString as y, unref as b, useSlots as x, withCtx as S } from "vue";
3
- import { NotFoundView as ae, byId as oe, citation as se, entityRef as ce, languageLabels as le, renderBlock as C, renderInline as w, renderPlain as T, sheetRows as E, sourceUrl as ue, useDataPackage as de, useGlossaryPopup as fe, useI18n as pe, useProjects as me, useRecordSheet as he, useRelatedRecords as ge } from "@museumwnf/viewer-core";
4
- import { useRoute as _e } from "vue-router";
5
- //#region src/views/RecordView.vue
6
- var ve = ["dir", "innerHTML"], ye = { class: "mwnf-record__body" }, be = { class: "mwnf-record__main" }, xe = {
7
- key: 1,
8
- class: "mwnf-record__status"
9
- }, D = {
10
- key: 0,
11
- class: "mwnf-record__aside"
12
- }, O = {
13
- key: 2,
14
- class: "mwnf-record__status"
15
- }, k = {
16
- __name: "RecordView",
17
- props: {
18
- spec: {
19
- type: Object,
20
- required: !0
21
- },
22
- id: {
23
- type: String,
24
- required: !0
25
- },
26
- entity: {
27
- type: String,
28
- default: ""
29
- }
30
- },
31
- setup(k) {
32
- let A = k, { t: j, locale: Se } = pe(), M = de(), Ce = me(), we = x(), Te = _e(), N = A.spec.entity ?? A.entity, P = o(() => A.spec), Ee = ce(N), De = oe(N), F = o(() => De.value.get(A.id) ?? null), Oe = o(() => Ee.value !== null), { language: I, languages: ke, dir: L, select: R, text: z, ready: B, terms: Ae, glossary: V, attribution: H } = he(F, {
33
- entity: N,
34
- translations: A.spec.translations ?? [],
35
- attribution: A.spec.attribution ?? []
36
- }), U = o(() => le(ke.value)), { active: W, onClick: G, close: je } = fe(Ae), Me = o(() => W.value ? C(W.value.definition, { breaks: !0 }) : ""), K = (e, t) => M.tr(e, t, I.value, "en"), q = o(() => ({
37
- record: F.value,
38
- text: z.value,
39
- language: I.value,
40
- languages: U.value,
41
- select: R,
42
- dir: L.value,
43
- glossary: V.value,
44
- ready: B.value,
45
- attribution: H.value,
46
- t: j,
47
- tr: K
48
- }));
49
- function J(e) {
50
- return ((typeof e == "function" ? e(q.value) : e) ?? []).map((e) => ({
51
- ...e,
52
- label: e.label ? j(e.label) : ""
53
- }));
54
- }
55
- let Ne = o(() => F.value ? E(J(P.value.fields), q.value) : []), Pe = o(() => F.value ? E(J(P.value.sections).map((e) => ({
56
- render: "block",
57
- ...e
58
- })), q.value) : []), Y = o(() => P.value.shortDescription === !1 ? "" : P.value.shortDescription ?? "short_description"), Fe = o(() => {
59
- let e = Y.value ? z.value[Y.value] : "";
60
- return e ? { html: C(String(e), {
61
- breaks: !0,
62
- glossary: V.value
63
- }) } : null;
64
- }), Ie = o(() => {
65
- if (!F.value) return "";
66
- if (P.value.title) return P.value.title(q.value);
67
- let e = z.value.name ?? F.value.internal_name ?? F.value.id;
68
- return w(String(e), { glossary: V.value });
69
- }), X = o(() => {
70
- if (!F.value) return [];
71
- if (P.value.media) return P.value.media(F.value, q.value);
72
- let e = T(String(z.value.name ?? F.value.internal_name ?? ""));
73
- return (F.value.images ?? []).map((t) => ({
74
- url: t.url,
75
- alt: t.captions?.[I.value] ?? e,
76
- caption: t.captions?.[I.value] ?? t.captions?.en ?? "",
77
- photographer: t.photographer ?? "",
78
- copyright: t.copyright ?? ""
79
- }));
80
- }), Le = [
81
- {
82
- field: "author",
83
- label: "sheet.field.preparedBy"
84
- },
85
- {
86
- field: "copy_editor",
87
- label: "sheet.field.copyeditedBy"
88
- },
89
- {
90
- field: "translator",
91
- label: "sheet.field.translationBy"
92
- },
93
- {
94
- field: "translation_copy_editor",
95
- label: "sheet.field.translationCopyeditedBy"
96
- }
97
- ], Re = o(() => (P.value.credits ?? Le).map(({ field: e, label: t }) => ({
98
- label: j(t),
99
- value: z.value[e] ?? H.value[e] ?? ""
100
- })).filter((e) => e.value)), ze = o(() => String(F.value?.[P.value.workingNumber ?? "mwnf_reference"] ?? "")), Be = o(() => {
101
- let e = P.value.citation;
102
- if (!F.value || e === !1) return "";
103
- let t = typeof e?.project == "function" ? null : e?.project ?? F.value.project_id, n = typeof e?.project == "function" ? e.project(F.value, q.value) : Ce.label(t), r = e?.permalink === !1 ? void 0 : typeof e?.permalink == "string" ? e.permalink : ue(Te) ?? void 0;
104
- return se({
105
- author: z.value.author ?? H.value.author,
106
- name: z.value.name ?? F.value.internal_name ?? "",
107
- project: n,
108
- permalink: r,
109
- inWord: j("record.citation.in")
110
- });
111
- }), Z = ge(F, {
112
- entity: N,
113
- language: I
114
- }), Q = o(() => P.value.related === !1 ? null : P.value.related ?? {}), $ = o(() => {
115
- if (!Q.value) return [];
116
- let e = Q.value.record ?? Ve;
117
- return Z.value.inPackage.map((t) => e(t, q.value));
118
- });
119
- function Ve({ record: e, justification: t }) {
120
- let n = K(N, e.id).name ?? e.internal_name ?? e.id;
121
- return {
122
- id: e.id,
123
- image: e.images?.[0]?.url ?? "",
124
- imageAlt: T(String(n)),
125
- name: w(String(n)),
126
- meta: t ? [t] : [],
127
- badge: e.type ?? "",
128
- to: {
129
- name: P.value.route ?? (A.entity ? `${A.entity}-detail` : "item"),
130
- params: { id: e.id }
131
- }
132
- };
133
- }
134
- let He = /* @__PURE__ */ new Set([
135
- "header",
136
- "before-sheet",
137
- "after-sheet",
138
- "aside",
139
- "source",
140
- "related",
141
- "after",
142
- "default"
143
- ]), Ue = o(() => Object.keys(we).filter((e) => !He.has(e)));
144
- return (o, x) => Oe.value && !F.value ? (g(), s(b(ae), { key: 0 })) : F.value ? (g(), l("article", {
145
- key: 1,
146
- class: ie(["mwnf-record", { "mwnf-record--spaced": P.value.spaced }]),
147
- onClick: x[0] ||= (...e) => b(G) && b(G)(...e)
148
- }, [
149
- v(o.$slots, "header", h(m(q.value)), () => [
150
- P.value.back ? (g(), s(n, {
151
- key: 0,
152
- class: "mwnf-record__back",
153
- to: P.value.back.to,
154
- href: P.value.back.href
155
- }, {
156
- default: S(() => [f("← " + y(b(j)(P.value.back.label)), 1)]),
157
- _: 1
158
- }, 8, ["to", "href"])) : c("", !0),
159
- p(t, {
160
- languages: U.value,
161
- language: b(I),
162
- onSelect: b(R)
163
- }, null, 8, [
164
- "languages",
165
- "language",
166
- "onSelect"
167
- ]),
168
- u("h1", {
169
- class: "mwnf-record__title",
170
- dir: b(L) || void 0,
171
- innerHTML: Ie.value
172
- }, null, 8, ve)
173
- ]),
174
- u("div", ye, [u("div", be, [
175
- X.value.length ? (g(), s(ee, {
176
- key: 0,
177
- images: X.value,
178
- variant: P.value.mediaVariant ?? ""
179
- }, null, 8, ["images", "variant"])) : c("", !0),
180
- b(B) ? c("", !0) : (g(), l("p", xe, y(b(j)("core.status.loading")), 1)),
181
- v(o.$slots, "before-sheet", h(m(q.value))),
182
- p(re, {
183
- rows: Ne.value,
184
- layout: P.value.layout ?? "table",
185
- dir: b(L),
186
- "short-description": Fe.value,
187
- "short-description-after": P.value.shortDescriptionAfter ?? "description"
188
- }, d({ _: 2 }, [_(Ue.value, (e) => ({
189
- name: e,
190
- fn: S((t) => [v(o.$slots, e, h(m({
191
- ...t,
192
- ...q.value
193
- })))])
194
- }))]), 1032, [
195
- "rows",
196
- "layout",
197
- "dir",
198
- "short-description",
199
- "short-description-after"
200
- ]),
201
- (g(!0), l(a, null, _(Pe.value, (e) => (g(), s(te, {
202
- key: e.key,
203
- heading: e.label,
204
- html: e.html,
205
- dir: b(L)
206
- }, null, 8, [
207
- "heading",
208
- "html",
209
- "dir"
210
- ]))), 128)),
211
- v(o.$slots, "after-sheet", h(m(q.value))),
212
- p(e, {
213
- credits: Re.value,
214
- "working-number": ze.value,
215
- "working-number-label": b(j)("sheet.field.workingNumber"),
216
- citation: Be.value,
217
- "citation-heading": P.value.citation?.heading ? b(j)(P.value.citation.heading) : ""
218
- }, null, 8, [
219
- "credits",
220
- "working-number",
221
- "working-number-label",
222
- "citation",
223
- "citation-heading"
224
- ]),
225
- v(o.$slots, "source", h(m(q.value)), () => [p(r)]),
226
- v(o.$slots, "related", h(m({
227
- ...q.value,
228
- records: $.value,
229
- outside: b(Z).outside
230
- })), () => [Q.value ? (g(), s(ne, {
231
- key: 0,
232
- heading: b(j)(Q.value.heading ?? "record.related.items"),
233
- records: $.value,
234
- variant: Q.value.variant ?? "list",
235
- "action-label": Q.value.actionLabel ? b(j)(Q.value.actionLabel) : ""
236
- }, null, 8, [
237
- "heading",
238
- "records",
239
- "variant",
240
- "action-label"
241
- ])) : c("", !0)])
242
- ]), o.$slots.aside ? (g(), l("aside", D, [v(o.$slots, "aside", h(m({
243
- ...q.value,
244
- records: $.value,
245
- outside: b(Z).outside
246
- })))])) : c("", !0)]),
247
- v(o.$slots, "after", h(m(q.value))),
248
- p(i, {
249
- term: b(W),
250
- html: Me.value,
251
- dir: b(L),
252
- onClose: b(je)
253
- }, null, 8, [
254
- "term",
255
- "html",
256
- "dir",
257
- "onClose"
258
- ])
259
- ], 2)) : (g(), l("p", O, y(b(j)("core.status.loading")), 1));
260
- }
261
- };
262
- //#endregion
263
- export { k as t };