@museumwnf/viewer-layout 3.80.1 → 3.80.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.
@@ -1,384 +0,0 @@
1
- import { t as e } from "./GlossaryPopover-DbQKXhx9.js";
2
- import { a as t, c as n, d as r, i, n as a, o as ee, r as te, s as ne } from "./PartnerMap-DdyMLtgH.js";
3
- import { Fragment as re, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createSlots as ie, createTextVNode as ae, createVNode as d, guardReactiveProps as f, mergeProps as oe, normalizeClass as se, normalizeProps as p, openBlock as m, ref as h, renderList as g, renderSlot as _, toDisplayString as v, unref as y, useSlots as ce, watch as b, withCtx as le } from "vue";
4
- import { useI18n as x } from "@museumwnf/viewer-core/i18n";
5
- import { NotFoundView as ue, byId as S, citation as de, creditLine as fe, entityRef as C, languageLabels as pe, loadEntities as me, pictureCredits as he, picturesInLanguage as ge, renderBlock as w, renderInline as T, renderPlain as _e, sheetRows as ve, sourceUrl as ye, useDataPackage as be, useGlossaryPopup as xe, useI18n as Se, useProjects as Ce, useRecordSheet as we, useRelatedRecords as Te } from "@museumwnf/viewer-core";
6
- import { useRoute as Ee } from "vue-router";
7
- // src/content/ShortDescription.vue
8
- var E = ["dir"], De = ["aria-expanded"], D = ["innerHTML"], Oe = {
9
- __name: "ShortDescription",
10
- props: {
11
- html: {
12
- type: String,
13
- required: !0
14
- },
15
- dir: {
16
- type: String,
17
- default: void 0
18
- }
19
- },
20
- setup(e) {
21
- let t = e, { t: n } = x(), r = h(!1);
22
- return b(() => t.html, () => {
23
- r.value = !1;
24
- }), (t, i) => (m(), l("div", {
25
- class: "mwnf-sheet__short",
26
- dir: e.dir
27
- }, [u("button", {
28
- type: "button",
29
- class: "mwnf-sheet__toggle",
30
- "aria-expanded": r.value ? "true" : "false",
31
- onClick: i[0] ||= (e) => r.value = !r.value
32
- }, v(r.value ? y(n)("record.action.hideShortDescription") : y(n)("record.action.viewShortDescription")), 9, De), r.value ? (m(), l("div", {
33
- key: 0,
34
- class: "mwnf-sheet__block",
35
- innerHTML: e.html
36
- }, null, 8, D)) : c("", !0)], 8, E));
37
- }
38
- };
39
- // src/views/pictureLimit.js
40
- function ke(e, t, n) {
41
- let r = typeof t == "function" ? t(n) : t;
42
- return Number.isInteger(r) && r > 0 ? e.slice(0, r) : e;
43
- }
44
- // src/views/RecordView.vue
45
- var Ae = ["dir", "innerHTML"], je = { class: "mwnf-record__body" }, Me = { class: "mwnf-record__main" }, Ne = {
46
- key: 0,
47
- class: "mwnf-record__media"
48
- }, Pe = {
49
- key: 2,
50
- class: "mwnf-record__status"
51
- }, Fe = {
52
- key: 0,
53
- class: "mwnf-record__aside"
54
- }, Ie = {
55
- key: 2,
56
- class: "mwnf-record__status"
57
- }, Le = {
58
- __name: "RecordView",
59
- props: {
60
- spec: {
61
- type: Object,
62
- required: !0
63
- },
64
- id: {
65
- type: String,
66
- required: !0
67
- },
68
- entity: {
69
- type: String,
70
- default: ""
71
- }
72
- },
73
- setup(h) {
74
- let b = h, { t: x, tIn: E, locale: De } = Se(), D = be(), Le = Ce(), Re = ce(), ze = Ee(), O = b.spec.entity ?? b.entity, k = o(() => b.spec), Be = C(O), Ve = S(O), A = o(() => Ve.value.get(b.id) ?? null), He = o(() => Be.value !== null), j = b.spec.creditPeople ? b.spec.creditPeople.entity ?? "authors" : null;
75
- j && me([j]).catch(() => {});
76
- let Ue = j ? S(j) : null, { language: M, languages: We, dir: N, select: P, text: F, ready: I, terms: Ge, glossary: L, attribution: R } = we(A, {
77
- entity: O,
78
- translations: [...b.spec.translations ?? [], ...j ? [j] : []],
79
- attribution: b.spec.attribution ?? []
80
- }), Ke = C("languages"), z = o(() => pe(We.value).map((e) => {
81
- if (e.label !== e.code.toUpperCase()) return e;
82
- let t = (Ke.value ?? []).find((t) => t.code === e.code)?.names?.[e.code];
83
- return t ? {
84
- ...e,
85
- label: t
86
- } : e;
87
- })), { active: B, onClick: V, close: qe } = xe(Ge), Je = o(() => B.value ? w(B.value.definition, { breaks: !0 }) : ""), H = (e, t) => D.tr(e, t, M.value, "en"), U = (e) => D.translations(e, M.value), W = o(() => ({
88
- record: A.value,
89
- text: F.value,
90
- language: M.value,
91
- languages: z.value,
92
- select: P,
93
- dir: N.value,
94
- glossary: L.value,
95
- ready: I.value,
96
- attribution: R.value,
97
- t: x,
98
- tIn: (e) => E ? E(M.value, e) : x(e),
99
- tr: H,
100
- translations: U
101
- })), G = (e) => k.value.labelsInRecordLanguage && E ? E(M.value, e) : x(e);
102
- function K(e) {
103
- return ((typeof e == "function" ? e(W.value) : e) ?? []).map((e) => ({
104
- ...e,
105
- label: e.label ? G(e.label) : ""
106
- }));
107
- }
108
- let q = o(() => A.value ? ve(K(k.value.fields), W.value) : []), Ye = o(() => A.value ? ve(K(k.value.sections).map((e) => ({
109
- render: "block",
110
- ...e
111
- })), W.value) : []), J = o(() => k.value.shortDescriptionAfter ?? "description"), Xe = o(() => !q.value.some((e) => e.key === J.value) && Ye.value.some((e) => e.key === J.value)), Ze = o(() => k.value.shortDescription === !1 ? "" : k.value.shortDescription ?? "short_description"), Y = o(() => {
112
- let e = Ze.value ? F.value[Ze.value] : "";
113
- return e ? { html: w(String(e), {
114
- breaks: !0,
115
- glossary: L.value
116
- }) } : null;
117
- }), Qe = o(() => {
118
- if (!A.value) return "";
119
- if (k.value.title) return k.value.title(W.value);
120
- let e = F.value.name ?? A.value.internal_name ?? A.value.id;
121
- return T(String(e), { glossary: L.value });
122
- }), X = o(() => A.value ? ke($e(), k.value.pictureLimit, W.value) : []);
123
- function $e() {
124
- if (k.value.media) return k.value.media(A.value, W.value);
125
- let e = _e(String(F.value.name ?? A.value.internal_name ?? ""));
126
- return ge(A.value.images, M.value).map((t) => ({
127
- url: t.url,
128
- alt: t.captions?.[M.value] ?? e,
129
- caption: t.captions?.[M.value] ?? "",
130
- ...he(t, M.value)
131
- }));
132
- }
133
- let et = [
134
- {
135
- field: "author",
136
- label: "sheet.field.preparedBy"
137
- },
138
- {
139
- field: "copy_editor",
140
- label: "sheet.field.copyeditedBy"
141
- },
142
- {
143
- field: "translator",
144
- label: "sheet.field.translationBy"
145
- },
146
- {
147
- field: "translation_copy_editor",
148
- label: "sheet.field.translationCopyeditedBy"
149
- }
150
- ];
151
- function tt(e) {
152
- let t = k.value.creditNames ? F.value.credit_names?.[e] : null;
153
- return t?.length ? fe(t) : F.value[e] ?? R.value[e] ?? "";
154
- }
155
- function nt(e) {
156
- let t = Ue ? F.value.credit_ids?.[e] : null;
157
- if (!t?.length) return null;
158
- let n = U(j), r = t.map((e) => {
159
- let t = Ue.value.get(e);
160
- if (!t) return null;
161
- let r = t.name ?? "";
162
- return {
163
- name: M.value === "ar" && t.originalname ? t.originalname : r,
164
- heading: [t.firstname, t.lastname].filter(Boolean).join(" ") || r,
165
- biography: n?.[e]?.curriculum ?? ""
166
- };
167
- });
168
- return r.every(Boolean) ? r : null;
169
- }
170
- let rt = o(() => (k.value.credits ?? et).map(({ field: e, label: t }) => ({
171
- label: G(t),
172
- value: tt(e),
173
- people: nt(e)
174
- })).filter((e) => e.value)), it = o(() => String(A.value?.[k.value.workingNumber ?? "mwnf_reference"] ?? ""));
175
- function at(e) {
176
- if (e?.permalink !== !1) return typeof e?.permalink == "string" ? e.permalink : ye(ze) ?? void 0;
177
- }
178
- let ot = o(() => {
179
- let e = k.value.citation;
180
- return !A.value || typeof e?.format != "function" ? "" : e.format(W.value, {
181
- permalink: at(e),
182
- year: (/* @__PURE__ */ new Date()).getFullYear()
183
- });
184
- }), st = o(() => {
185
- let e = k.value.citation;
186
- if (!A.value || e === !1 || typeof e?.format == "function") return "";
187
- let t = typeof e?.project == "function" ? null : e?.project ?? A.value.project_id, n = typeof e?.project == "function" ? e.project(A.value, W.value) : Le.label(t);
188
- return de({
189
- author: tt("author") || void 0,
190
- name: F.value.name ?? A.value.internal_name ?? "",
191
- project: n,
192
- permalink: at(e),
193
- inWord: x("record.citation.in")
194
- });
195
- }), Z = Te(A, {
196
- entity: O,
197
- language: M
198
- }), Q = o(() => k.value.related === !1 ? null : k.value.related ?? {}), $ = o(() => {
199
- if (!Q.value) return [];
200
- let e = Q.value.record ?? ct;
201
- return Z.value.inPackage.map((t) => e(t, W.value));
202
- });
203
- function ct({ record: e, justification: t }) {
204
- let n = H(O, e.id).name ?? e.internal_name ?? e.id;
205
- return {
206
- id: e.id,
207
- image: e.images?.[0]?.url ?? "",
208
- imageAlt: _e(String(n)),
209
- name: T(String(n)),
210
- meta: t ? [t] : [],
211
- badge: e.type ?? "",
212
- to: {
213
- name: k.value.route ?? (b.entity ? `${b.entity}-detail` : "item"),
214
- params: { id: e.id }
215
- }
216
- };
217
- }
218
- let lt = /* @__PURE__ */ new Set([
219
- "header",
220
- "before-sheet",
221
- "after-sheet",
222
- "after-media",
223
- "credits",
224
- "aside",
225
- "source",
226
- "related",
227
- "after",
228
- "default"
229
- ]), ut = o(() => Object.keys(Re).filter((e) => !lt.has(e)));
230
- return (o, h) => He.value && !A.value ? (m(), s(y(ue), { key: 0 })) : A.value ? (m(), l("article", {
231
- key: 1,
232
- class: se(["mwnf-record", { "mwnf-record--spaced": k.value.spaced }]),
233
- onClick: h[0] ||= (...e) => y(V) && y(V)(...e)
234
- }, [
235
- _(o.$slots, "header", p(f(W.value)), () => [
236
- k.value.back ? (m(), s(r, {
237
- key: 0,
238
- class: "mwnf-record__back",
239
- to: k.value.back.to,
240
- href: k.value.back.href
241
- }, {
242
- default: le(() => [ae("← " + v(y(x)(k.value.back.label)), 1)]),
243
- _: 1
244
- }, 8, ["to", "href"])) : c("", !0),
245
- d(n, {
246
- languages: z.value,
247
- language: y(M),
248
- onSelect: y(P)
249
- }, null, 8, [
250
- "languages",
251
- "language",
252
- "onSelect"
253
- ]),
254
- u("h1", {
255
- class: "mwnf-record__title",
256
- dir: y(N) || void 0,
257
- innerHTML: Qe.value
258
- }, null, 8, Ae)
259
- ]),
260
- u("div", je, [u("div", Me, [
261
- o.$slots["after-media"] ? (m(), l("div", Ne, [X.value.length ? (m(), s(a, {
262
- key: 0,
263
- images: X.value,
264
- variant: k.value.mediaVariant ?? "",
265
- "thumbs-from": k.value.mediaThumbsFrom ?? 2,
266
- "credit-caption": k.value.mediaCreditCaption ?? !0
267
- }, null, 8, [
268
- "images",
269
- "variant",
270
- "thumbs-from",
271
- "credit-caption"
272
- ])) : c("", !0), _(o.$slots, "after-media", p(f(W.value)))])) : X.value.length ? (m(), s(a, {
273
- key: 1,
274
- images: X.value,
275
- variant: k.value.mediaVariant ?? "",
276
- "thumbs-from": k.value.mediaThumbsFrom ?? 2,
277
- "credit-caption": k.value.mediaCreditCaption ?? !0
278
- }, null, 8, [
279
- "images",
280
- "variant",
281
- "thumbs-from",
282
- "credit-caption"
283
- ])) : c("", !0),
284
- y(I) ? c("", !0) : (m(), l("p", Pe, v(y(x)("core.status.loading")), 1)),
285
- _(o.$slots, "before-sheet", p(f(W.value))),
286
- d(ne, {
287
- rows: q.value,
288
- layout: k.value.layout ?? "table",
289
- dir: y(N),
290
- "short-description": Y.value,
291
- "short-description-after": J.value,
292
- "toggle-labels": k.value.shortDescriptionLabels ?? {}
293
- }, ie({ _: 2 }, [g(ut.value, (e) => ({
294
- name: e,
295
- fn: le((t) => [_(o.$slots, e, p(f({
296
- ...t,
297
- ...W.value
298
- })))])
299
- }))]), 1032, [
300
- "rows",
301
- "layout",
302
- "dir",
303
- "short-description",
304
- "short-description-after",
305
- "toggle-labels"
306
- ]),
307
- (m(!0), l(re, null, g(Ye.value, (e) => (m(), l(re, { key: e.key }, [
308
- d(ee, {
309
- heading: e.label,
310
- html: e.html,
311
- dir: y(N)
312
- }, null, 8, [
313
- "heading",
314
- "html",
315
- "dir"
316
- ]),
317
- Y.value && Xe.value && e.key === J.value ? (m(), s(Oe, {
318
- key: 0,
319
- html: Y.value.html,
320
- dir: y(N)
321
- }, null, 8, ["html", "dir"])) : c("", !0),
322
- _(o.$slots, `after-${e.key}`, oe({ ref_for: !0 }, W.value))
323
- ], 64))), 128)),
324
- _(o.$slots, "after-sheet", p(f(W.value))),
325
- _(o.$slots, "credits", p(f({
326
- ...W.value,
327
- credits: rt.value,
328
- workingNumber: it.value,
329
- workingNumberLabel: G(k.value.workingNumberLabel ?? "sheet.field.workingNumber"),
330
- citation: st.value,
331
- citationHtml: ot.value
332
- })), () => [d(t, {
333
- credits: rt.value,
334
- "working-number": it.value,
335
- "working-number-label": G(k.value.workingNumberLabel ?? "sheet.field.workingNumber"),
336
- citation: st.value,
337
- "citation-html": ot.value,
338
- "citation-heading": k.value.citation?.heading ? G(k.value.citation.heading) : ""
339
- }, null, 8, [
340
- "credits",
341
- "working-number",
342
- "working-number-label",
343
- "citation",
344
- "citation-html",
345
- "citation-heading"
346
- ])]),
347
- _(o.$slots, "source", p(f(W.value)), () => [k.value.sourceCredit === !1 ? c("", !0) : (m(), s(i, { key: 0 }))]),
348
- _(o.$slots, "related", p(f({
349
- ...W.value,
350
- records: $.value,
351
- outside: y(Z).outside
352
- })), () => [Q.value && Q.value.inline !== !1 ? (m(), s(te, {
353
- key: 0,
354
- heading: y(x)(Q.value.heading ?? "record.related.items"),
355
- records: $.value,
356
- variant: Q.value.variant ?? "list",
357
- "action-label": Q.value.actionLabel ? y(x)(Q.value.actionLabel) : ""
358
- }, null, 8, [
359
- "heading",
360
- "records",
361
- "variant",
362
- "action-label"
363
- ])) : c("", !0)])
364
- ]), o.$slots.aside ? (m(), l("aside", Fe, [_(o.$slots, "aside", p(f({
365
- ...W.value,
366
- records: $.value,
367
- outside: y(Z).outside
368
- })))])) : c("", !0)]),
369
- _(o.$slots, "after", p(f(W.value))),
370
- d(e, {
371
- term: y(B),
372
- html: Je.value,
373
- dir: y(N),
374
- onClose: y(qe)
375
- }, null, 8, [
376
- "term",
377
- "html",
378
- "dir",
379
- "onClose"
380
- ])
381
- ], 2)) : (m(), l("p", Ie, v(y(x)("core.status.loading")), 1));
382
- }
383
- };
384
- export { ke as n, Le as t };