@museumwnf/viewer-core 2.18.0 → 2.19.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/package.json
CHANGED
|
@@ -148,13 +148,14 @@ export function useExhibitionData(config = {}) {
|
|
|
148
148
|
return { name: 'item', params: { id: item.id } }
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
// Institutions (monument owners) and museums both live in partners.json
|
|
152
|
-
//
|
|
153
|
-
//
|
|
154
|
-
//
|
|
155
|
-
//
|
|
151
|
+
// Institutions (monument owners) and museums both live in partners.json.
|
|
152
|
+
// Legacy's /partners lists every owner once (MWNF-621), and its client
|
|
153
|
+
// opens the institution's pages only for a record of legacy's mwnf3
|
|
154
|
+
// institutions table: a Sharing History partner is a partner whatever it
|
|
155
|
+
// holds, though the package types one holding monuments as an institution.
|
|
156
|
+
const INSTITUTIONS_TABLE = 'mwnf3:institutions:'
|
|
156
157
|
function isInstitution(partner) {
|
|
157
|
-
return partner?.
|
|
158
|
+
return String(partner?.backward_compatibility ?? '').startsWith(INSTITUTIONS_TABLE)
|
|
158
159
|
}
|
|
159
160
|
|
|
160
161
|
function partnerRoute(partner) {
|
|
@@ -204,6 +205,13 @@ export function useExhibitionData(config = {}) {
|
|
|
204
205
|
return projectLabel(manifest, item?.project_id, lang)
|
|
205
206
|
}
|
|
206
207
|
|
|
208
|
+
/** The record's project by its legacy code (`ISL`, `EPM`), which legacy's
|
|
209
|
+
* sheet keyed some labels on; '' when the manifest does not carry it. */
|
|
210
|
+
function projectCode(item) {
|
|
211
|
+
const key = manifest?.projects?.[item?.project_id]?.backward_compatibility
|
|
212
|
+
return key ? String(key).split(':').pop().toUpperCase() : ''
|
|
213
|
+
}
|
|
214
|
+
|
|
207
215
|
/** The exhibition's own per-language chrome text. */
|
|
208
216
|
function exhibitionTitle(lang = defaultLang) {
|
|
209
217
|
return exhibition.value?.titles?.[lang] ?? exhibition.value?.titles?.en ?? ''
|
|
@@ -247,7 +255,7 @@ export function useExhibitionData(config = {}) {
|
|
|
247
255
|
chromeImage,
|
|
248
256
|
partnerById, countryById, tagById, dynastyById, glossaryById, languageByCode,
|
|
249
257
|
countryByCode, countryLabelFromCode, countryIdForCode, countryLabel,
|
|
250
|
-
itemRoute, isInstitution, partnerRoute, partnerObjectsRoute,
|
|
258
|
+
itemRoute, isInstitution, partnerRoute, partnerObjectsRoute, projectCode,
|
|
251
259
|
isExploreRecord, projectName,
|
|
252
260
|
exhibitionTitle, exhibitionSubtitle, exhibitionHeadline, bannerCaption,
|
|
253
261
|
siblingSites, siblingUrl,
|
|
@@ -26,13 +26,14 @@ import { useExhibitionSheet } from './useExhibitionSheet.js'
|
|
|
26
26
|
* `data.isHiddenPartner`, `data.labelOf`, `data.partnerById`,
|
|
27
27
|
* `data.partnerRoute`, `data.translations`, what `useExhibitionSheet` reads,
|
|
28
28
|
* and `timeline.countryIdForCode`, `timeline.hasTimeline`,
|
|
29
|
-
* `timeline.timelineEvents` (`countries`,
|
|
29
|
+
* `timeline.usesLocalTimeline`, `timeline.timelineEvents` (`countries`,
|
|
30
|
+
* `findEvents`), `timeline.timelineSpec`.
|
|
30
31
|
*/
|
|
31
32
|
export function useExhibitionItemDetail(data, timeline) {
|
|
32
33
|
const {
|
|
33
34
|
dynastyById, isExploreRecord, isHiddenPartner, labelOf, partnerById, partnerRoute, translations,
|
|
34
35
|
} = data
|
|
35
|
-
const { countryIdForCode, hasTimeline, timelineEvents, timelineSpec } = timeline
|
|
36
|
+
const { countryIdForCode, hasTimeline, usesLocalTimeline, timelineEvents, timelineSpec } = timeline
|
|
36
37
|
const { countries: timelineCountries, findEvents } = timelineEvents
|
|
37
38
|
const { itemSheet: platformSheet } = useExhibitionSheet(data)
|
|
38
39
|
|
|
@@ -107,13 +108,18 @@ export function useExhibitionItemDetail(data, timeline) {
|
|
|
107
108
|
records: dynastiesWithHistory(record, language),
|
|
108
109
|
tr: (d) => dynastyTr(d, language),
|
|
109
110
|
}),
|
|
110
|
-
//
|
|
111
|
-
//
|
|
112
|
-
//
|
|
111
|
+
// Legacy's sheet asked its own chronology (`/thg/timeline`) for the
|
|
112
|
+
// events of the item's period whatever the exhibition's timeline flags
|
|
113
|
+
// said, and drew the link when it answered any. So the link stays for
|
|
114
|
+
// an exhibition with a chronology of its own and both flags off (The
|
|
115
|
+
// Hijaz Railway); it is withheld when the exhibition has no chronology
|
|
116
|
+
// in force, when the item has no date to anchor a range on, or when no
|
|
117
|
+
// event falls in it.
|
|
113
118
|
timeline: (record, ctx) => {
|
|
114
|
-
if (!hasTimeline.value) return null
|
|
119
|
+
if (!hasTimeline.value && !usesLocalTimeline?.value) return null
|
|
115
120
|
const range = roundOutward(record.start_date, record.end_date)
|
|
116
121
|
if (range[0] == null) return null
|
|
122
|
+
if (findEvents({ begin: range[0], end: range[1] }).length === 0) return null
|
|
117
123
|
return {
|
|
118
124
|
heading: 'core.section.timeline',
|
|
119
125
|
countries: timelineCountries.value.map((c) => ({ value: c.value, label: c.label ?? ctx.t('timeline.form.allCountries') })),
|
|
@@ -33,12 +33,13 @@ import { artistLine, pictureCredits, picturesInLanguage, recordArtist } from '..
|
|
|
33
33
|
* The exhibition's item-sheet spec, over its data layer's `data`.
|
|
34
34
|
*
|
|
35
35
|
* Reads `data.defaultLang`, `data.itemRoute`, `data.labelOf`,
|
|
36
|
-
* `data.mdInline`, `data.mdStrip`, `data.partnerById`, `data.
|
|
37
|
-
* `data.tr`, `data.translations`. `config` carries
|
|
36
|
+
* `data.mdInline`, `data.mdStrip`, `data.partnerById`, `data.projectCode`,
|
|
37
|
+
* `data.projectName`, `data.tr`, `data.translations`. `config` carries
|
|
38
|
+
* nothing today.
|
|
38
39
|
*/
|
|
39
40
|
export function useExhibitionSheet(data, config = {}) {
|
|
40
41
|
void config
|
|
41
|
-
const { defaultLang, itemRoute, labelOf, mdInline, mdStrip, partnerById, projectName, tr, translations } = data
|
|
42
|
+
const { defaultLang, itemRoute, labelOf, mdInline, mdStrip, partnerById, projectCode, projectName, tr, translations } = data
|
|
42
43
|
|
|
43
44
|
const bothDescriptions = (c) => Boolean(c.text.description) && Boolean(c.text.short_description)
|
|
44
45
|
|
|
@@ -48,40 +49,60 @@ export function useExhibitionSheet(data, config = {}) {
|
|
|
48
49
|
.filter(Boolean)
|
|
49
50
|
.join(', ')
|
|
50
51
|
|
|
52
|
+
// Legacy's sheet printed a monument (a record with a `monumentId`) under
|
|
53
|
+
// its own labels and with the rows only a monument has; an object keeps
|
|
54
|
+
// the object's. Its architects row read "Architect(s) / Masterbuilder(s)"
|
|
55
|
+
// for a Discover Islamic Art or Explore record and "Artists" otherwise.
|
|
56
|
+
const monument = (c) => c.record.type === 'monument'
|
|
57
|
+
const object = (c) => !monument(c)
|
|
58
|
+
const islamicArt = (c) => ['ISL', 'EPM'].includes(projectCode(c.record))
|
|
59
|
+
|
|
51
60
|
const fields = [
|
|
52
|
-
{ key: 'name', label: 'sheet.field.name', value: 'name' },
|
|
53
|
-
{ key: '
|
|
61
|
+
{ key: 'name', label: 'sheet.field.name', value: 'name', when: object },
|
|
62
|
+
{ key: 'monumentName', label: 'sheet.dxa.monumentName', value: 'name', when: monument },
|
|
63
|
+
{ key: 'aka', label: 'sheet.field.alsoKnownAs', value: 'alternate_name', when: object },
|
|
64
|
+
{ key: 'monumentAka', label: 'sheet.dxa.monumentAlsoKnownAs', value: 'alternate_name', when: monument },
|
|
54
65
|
{ key: 'location', label: 'sheet.field.location', value: (c) => [c.text.location, labelOf('countries', c.record.country_id)].filter(Boolean).join(', ') },
|
|
55
66
|
// The holding museum, rendered by the wrapper's `museum` slot: the item's
|
|
56
67
|
// holder text, then the partner it refers to (decision D3,
|
|
57
68
|
// inventory-app#2015). The value is the partner's id when the package
|
|
58
69
|
// carries the partner, otherwise the holder text, so the row stays for an
|
|
59
|
-
// item whose holder has no partner page.
|
|
60
|
-
|
|
70
|
+
// item whose holder has no partner page. A monument has no holding
|
|
71
|
+
// museum: legacy printed its responsible institution as written.
|
|
72
|
+
{ key: 'museum', label: 'sheet.field.holdingMuseum', value: (c) => (partnerById.value.get(c.record.partner_id) ? c.record.partner_id : (c.text.holder ?? '')), render: 'custom', when: object },
|
|
73
|
+
{ key: 'institution', label: 'sheet.dxa.responsibleInstitution', value: (c) => c.text.institution || c.text.holder, when: monument },
|
|
61
74
|
{ key: 'originalOwner', label: 'sheet.field.originalOwner', value: 'initial_owner' },
|
|
62
75
|
{ key: 'currentOwner', label: 'sheet.field.currentOwner', value: 'owner' },
|
|
63
|
-
{ key: 'date', label: 'sheet.field.date', value: 'dates' },
|
|
76
|
+
{ key: 'date', label: 'sheet.field.date', value: 'dates', when: object },
|
|
77
|
+
{ key: 'monumentDate', label: 'sheet.field.dateOfMonument', value: 'dates', when: monument },
|
|
78
|
+
{ key: 'architects', label: 'sheet.field.architects', value: 'architects', when: islamicArt },
|
|
79
|
+
{ key: 'monumentArtists', label: 'sheet.dxa.monumentArtists', value: 'architects', when: (c) => !islamicArt(c) },
|
|
64
80
|
{ key: 'artist', label: 'sheet.field.artists', value: (c) => artistLine(recordArtist(c.record, c.text), c.text, { style: 'line' }) },
|
|
65
81
|
{ key: 'scribe', label: 'sheet.field.scribe', value: 'scriber' },
|
|
66
82
|
{ key: 'workshop', label: 'sheet.field.workshop', value: 'workshop' },
|
|
67
|
-
{ key: 'type', label: 'sheet.field.type', value: 'type' },
|
|
83
|
+
{ key: 'type', label: 'sheet.field.type', value: 'type', when: object },
|
|
84
|
+
{ key: 'monumentType', label: 'sheet.dxa.monumentType', value: 'type', when: monument },
|
|
68
85
|
{ key: 'inventoryNumber', label: 'sheet.field.inventoryNumber', value: (c) => c.record.owner_reference },
|
|
69
86
|
{ key: 'materials', label: 'sheet.field.materials', value: (c) => c.text.materials, join: '; ' },
|
|
70
87
|
{ key: 'dimensions', label: 'sheet.field.dimensions', value: 'dimensions' },
|
|
71
88
|
{ key: 'dynasty', label: 'sheet.field.periodDynasty', value: (c) => c.text?.dynasty || dynastyNames(c) },
|
|
89
|
+
{ key: 'patrons', label: 'sheet.field.patrons', value: 'patrons' },
|
|
72
90
|
{ key: 'production', label: 'sheet.field.placeOfProduction', value: 'place_of_production' },
|
|
73
91
|
{ key: 'provenance', label: 'sheet.field.provenance', value: 'provenance' },
|
|
74
92
|
{ key: 'binding', label: 'sheet.field.binding', value: 'binding_desc' },
|
|
93
|
+
{ key: 'history', label: 'sheet.field.history', value: 'history', render: 'block' },
|
|
75
94
|
{ key: 'description', label: 'sheet.field.description', value: 'description', render: 'block' },
|
|
76
95
|
// The only description there is, under the plain label; the toggled one
|
|
77
96
|
// is the view's, folded after `description` when both exist.
|
|
78
97
|
{ key: 'shortDescription', label: 'sheet.field.description', value: 'short_description', render: 'block', when: (c) => !bothDescriptions(c) },
|
|
79
98
|
{ key: 'catalogue', label: 'sheet.field.catalogueLink', value: 'linkcatalogs', render: 'link' },
|
|
99
|
+
{ key: 'datation', label: 'sheet.field.datationMethod', value: 'method_for_datation', when: object },
|
|
100
|
+
{ key: 'monumentDatation', label: 'sheet.field.monumentDatationMethod', value: 'method_for_datation', when: monument },
|
|
80
101
|
{ key: 'obtention', label: 'sheet.field.obtentionMethod', value: 'obtention' },
|
|
81
|
-
{ key: 'datation', label: 'sheet.field.datationMethod', value: 'method_for_datation' },
|
|
82
102
|
{ key: 'provenanceMethod', label: 'sheet.field.provenanceMethod', value: 'method_for_provenance' },
|
|
83
103
|
{ key: 'bibliography', label: 'sheet.field.bibliography', value: 'bibliography', render: 'block' },
|
|
84
|
-
{ key: 'copyright', label: 'sheet.field.copyrightInformation', value: 'copyright' },
|
|
104
|
+
{ key: 'copyright', label: 'sheet.field.copyrightInformation', value: 'copyright', when: object },
|
|
105
|
+
{ key: 'monumentCopyright', label: 'sheet.dxa.monumentCopyrightInformation', value: 'copyright', when: monument },
|
|
85
106
|
]
|
|
86
107
|
|
|
87
108
|
const itemSheet = {
|
|
@@ -247,7 +247,8 @@ export function recordArtist(record, text) {
|
|
|
247
247
|
* comma before the place, as it did there. Nothing without an artist.
|
|
248
248
|
* - `'line'` — the galleries' and exhibitions' `DatabaseItem.vue`
|
|
249
249
|
* (`returnArtistData`): on a line of its own under the artist,
|
|
250
|
-
* `1660, Chemnitz - 1736, Augsburg
|
|
250
|
+
* `1660, Chemnitz - 1736, Augsburg`, then the period of activity
|
|
251
|
+
* (`period_activity`) on a line of its own.
|
|
251
252
|
*
|
|
252
253
|
* Islamic Art's sheet printed the artist alone. '' when there is nothing
|
|
253
254
|
* to print.
|
|
@@ -261,7 +262,7 @@ export function artistLine(artist, text, { style = 'bracketed' } = {}) {
|
|
|
261
262
|
if (style === 'line') {
|
|
262
263
|
const birth = [born, bornAt].filter(Boolean).join(', ')
|
|
263
264
|
const death = [died, diedAt].filter(Boolean).join(', ')
|
|
264
|
-
return [name, [birth, death].filter(Boolean).join(' - ')].filter(Boolean).join(' \n')
|
|
265
|
+
return [name, [birth, death].filter(Boolean).join(' - '), lifePart(text?.period_activity)].filter(Boolean).join(' \n')
|
|
265
266
|
}
|
|
266
267
|
if (!name) return ''
|
|
267
268
|
if (!(born || bornAt || died || diedAt)) return name
|