@museumwnf/viewer-core 2.6.0 → 2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@museumwnf/viewer-core",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "Application engine for MWNF websites: turns a dataset.config.js into a mounted Vue application.",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -28,7 +28,7 @@ export function searchFields({ dynastyLabel } = {}) {
28
28
  location: (item, text) => [text.location, item.country_id],
29
29
  provenance: (item, text) => text.provenance,
30
30
  patron: (item, text) => text.patrons ?? text.initial_owner,
31
- artist: (item, text) => [...(item.artist_names ?? []), text.architects],
31
+ artist: (item, text) => [...(item.artist_names ?? []), text.artist, text.architects],
32
32
  material: (item, text) => text.type,
33
33
  // The catch-all across the descriptive fields the others leave out.
34
34
  other: (item, text) => [
@@ -27,7 +27,7 @@
27
27
  // dynasties stand in when it has none, and keep their own popouts
28
28
  // (decision D5, inventory-app#2233).
29
29
 
30
- import { artistLine } from '../../record/derivations.js'
30
+ import { artistLine, recordArtist } from '../../record/derivations.js'
31
31
 
32
32
  /**
33
33
  * The exhibition's item-sheet spec, over its data layer's `data`.
@@ -61,7 +61,7 @@ export function useExhibitionSheet(data, config = {}) {
61
61
  { key: 'originalOwner', label: 'sheet.field.originalOwner', value: 'initial_owner' },
62
62
  { key: 'currentOwner', label: 'sheet.field.currentOwner', value: 'owner' },
63
63
  { key: 'date', label: 'sheet.field.date', value: 'dates' },
64
- { key: 'artist', label: 'sheet.field.artists', value: (c) => artistLine((c.record.artist_names ?? []).join(', '), c.text, { style: 'line' }) },
64
+ { key: 'artist', label: 'sheet.field.artists', value: (c) => artistLine(recordArtist(c.record, c.text), c.text, { style: 'line' }) },
65
65
  { key: 'scribe', label: 'sheet.field.scribe', value: 'scriber' },
66
66
  { key: 'workshop', label: 'sheet.field.workshop', value: 'workshop' },
67
67
  { key: 'type', label: 'sheet.field.type', value: 'type' },
@@ -2,6 +2,7 @@ import { computed } from 'vue'
2
2
  import { useI18n } from '../../i18n/index.js'
3
3
  import { entityRef } from '../../composables/useEntities.js'
4
4
  import { useCollectionTree } from '../../record/collectionTree.js'
5
+ import { recordArtist } from '../../record/derivations.js'
5
6
 
6
7
  // An exhibition's themes: the tour its theme pages, its themes list and its
7
8
  // theme galleries read (inventory-app#2053). The six exhibitions each carried
@@ -240,7 +241,8 @@ export function useExhibitionThemes(data) {
240
241
  if (sheet.alternate_name) {
241
242
  fields.push({ label: `${t('sheet.field.alsoKnownAs')}:`, value: mdInline(sheet.alternate_name) })
242
243
  }
243
- if (parent.artist_names?.length) fields.push({ label: '', value: parent.artist_names.join(', ') })
244
+ const artist = recordArtist(parent, sheet)
245
+ if (artist) fields.push({ label: '', value: artist })
244
246
  if (sheet.dates) fields.push({ label: '', value: sheet.dates })
245
247
  return fields
246
248
  }
@@ -27,7 +27,7 @@
27
27
  // dynasties stand in when it has none, and keep their own popouts
28
28
  // (decision D5, inventory-app#2233).
29
29
 
30
- import { artistLine } from '../../record/derivations.js'
30
+ import { artistLine, recordArtist } from '../../record/derivations.js'
31
31
 
32
32
  /**
33
33
  * The gallery's item-sheet spec, over its data layer's `data`.
@@ -61,7 +61,7 @@ export function useGallerySheet(data, config = {}) {
61
61
  { key: 'originalOwner', label: 'sheet.field.originalOwner', value: 'initial_owner' },
62
62
  { key: 'currentOwner', label: 'sheet.field.currentOwner', value: 'owner' },
63
63
  { key: 'date', label: 'sheet.field.date', value: 'dates' },
64
- { key: 'artist', label: 'sheet.field.artists', value: (c) => artistLine((c.record.artist_names ?? []).join(', '), c.text, { style: 'line' }) },
64
+ { key: 'artist', label: 'sheet.field.artists', value: (c) => artistLine(recordArtist(c.record, c.text), c.text, { style: 'line' }) },
65
65
  { key: 'scribe', label: 'sheet.field.scribe', value: 'scriber' },
66
66
  { key: 'workshop', label: 'sheet.field.workshop', value: 'workshop' },
67
67
  { key: 'type', label: 'sheet.field.type', value: 'type' },
package/src/index.js CHANGED
@@ -39,7 +39,7 @@ export {
39
39
  glossaryEntries, glossaryTermsFor, glossaryTermsForText, sheetRows, useRecordSheet,
40
40
  } from './record/recordSheet.js'
41
41
  export {
42
- artistLine, citation, relatedRecords, removeEndingPoint, searchGlossary, timelineLinkFor, useGlossaryPopup,
42
+ artistLine, citation, recordArtist, relatedRecords, removeEndingPoint, searchGlossary, timelineLinkFor, useGlossaryPopup,
43
43
  useRelatedRecords,
44
44
  } from './record/derivations.js'
45
45
  export { buildCollectionTree, collectionTreeFromThemes, useCollectionTree } from './record/collectionTree.js'
@@ -181,6 +181,16 @@ export function removeEndingPoint(text) {
181
181
 
182
182
  const lifePart = (value) => (typeof value === 'string' ? value.trim() : '')
183
183
 
184
+ /**
185
+ * The artist the sheet names: the translation's own `artist` when it has one,
186
+ * else the record's `artist_names`. A Sharing History record has no artist
187
+ * entity, and legacy wrote its artist per language ("Unknown", "Inconnu"),
188
+ * so the package carries it on each translation (inventory-app#2233, C22).
189
+ */
190
+ export function recordArtist(record, text) {
191
+ return lifePart(text?.artist) || (record?.artist_names ?? []).join(', ')
192
+ }
193
+
184
194
  /**
185
195
  * The artist line as Markdown: `artist`, then the artist's life data the
186
196
  * record's translation carries (`artist_birthdate`, `artist_birthplace`,