@teipublisher/pb-components 2.26.0-next-3.11 → 2.26.0-next-3.13

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.
Files changed (133) hide show
  1. package/.github/workflows/main.yml +3 -3
  2. package/.github/workflows/node.js.yml +3 -3
  3. package/.github/workflows/release.js.yml +3 -3
  4. package/CHANGELOG.md +38 -0
  5. package/Dockerfile +78 -70
  6. package/css/components.css +5 -5
  7. package/dist/demo/components.css +2 -8
  8. package/dist/demo/pb-drawer2.html +1 -1
  9. package/dist/demo/pb-leaflet-map.html +1 -1
  10. package/dist/demo/pb-progress.html +2 -2
  11. package/dist/demo/pb-repeat.html +1 -3
  12. package/dist/demo/pb-view3.html +1 -1
  13. package/dist/{paper-icon-button-0fb125c4.js → paper-icon-button-72125e67.js} +1 -1
  14. package/dist/pb-code-editor.js +25 -20
  15. package/dist/pb-component-docs.js +58 -54
  16. package/dist/pb-components-bundle.js +1937 -1782
  17. package/dist/pb-edit-app.js +167 -107
  18. package/dist/pb-elements.json +45 -45
  19. package/dist/{pb-i18n-0611135a.js → pb-i18n-4cc00bfe.js} +1 -1
  20. package/dist/pb-leaflet-map.js +23 -23
  21. package/dist/pb-mei.js +56 -41
  22. package/dist/{pb-mixin-b1caa22e.js → pb-mixin-886ece32.js} +1 -1
  23. package/dist/pb-odd-editor.js +923 -756
  24. package/dist/pb-tify.js +2 -2
  25. package/dist/{vaadin-element-mixin-6633322b.js → vaadin-element-mixin-84fb7d82.js} +181 -143
  26. package/gh-pages.js +5 -3
  27. package/i18n/common/pl.json +2 -2
  28. package/lib/openseadragon.min.js +1 -1
  29. package/package.json +2 -2
  30. package/pb-elements.json +45 -45
  31. package/src/assets/components.css +5 -5
  32. package/src/authority/airtable.js +20 -21
  33. package/src/authority/anton.js +129 -129
  34. package/src/authority/custom.js +23 -21
  35. package/src/authority/geonames.js +38 -32
  36. package/src/authority/gnd.js +47 -42
  37. package/src/authority/kbga.js +137 -134
  38. package/src/authority/metagrid.js +44 -46
  39. package/src/authority/reconciliation.js +66 -67
  40. package/src/authority/registry.js +4 -4
  41. package/src/docs/pb-component-docs.js +2 -2
  42. package/src/docs/pb-component-view.js +5 -5
  43. package/src/docs/pb-components-list.js +2 -2
  44. package/src/docs/pb-demo-snippet.js +2 -2
  45. package/src/dts-client.js +299 -297
  46. package/src/dts-select-endpoint.js +90 -82
  47. package/src/parse-date-service.js +184 -135
  48. package/src/pb-ajax.js +150 -146
  49. package/src/pb-authority-lookup.js +183 -146
  50. package/src/pb-autocomplete.js +292 -280
  51. package/src/pb-blacklab-highlight.js +264 -259
  52. package/src/pb-blacklab-results.js +236 -221
  53. package/src/pb-browse-docs.js +540 -475
  54. package/src/pb-browse.js +68 -65
  55. package/src/pb-clipboard.js +79 -76
  56. package/src/pb-code-editor.js +110 -102
  57. package/src/pb-code-highlight.js +209 -204
  58. package/src/pb-codepen.js +79 -72
  59. package/src/pb-collapse.js +212 -207
  60. package/src/pb-combo-box.js +190 -190
  61. package/src/pb-components-bundle.js +1 -1
  62. package/src/pb-custom-form.js +151 -149
  63. package/src/pb-dialog.js +96 -60
  64. package/src/pb-document.js +89 -90
  65. package/src/pb-download.js +210 -198
  66. package/src/pb-drawer.js +145 -148
  67. package/src/pb-edit-app.js +301 -229
  68. package/src/pb-edit-xml.js +98 -96
  69. package/src/pb-events.js +114 -107
  70. package/src/pb-facs-link.js +104 -102
  71. package/src/pb-facsimile.js +411 -413
  72. package/src/pb-formula.js +151 -153
  73. package/src/pb-geolocation.js +129 -131
  74. package/src/pb-grid-action.js +53 -56
  75. package/src/pb-grid.js +231 -228
  76. package/src/pb-highlight.js +140 -140
  77. package/src/pb-hotkeys.js +40 -42
  78. package/src/pb-i18n.js +101 -104
  79. package/src/pb-image-strip.js +84 -78
  80. package/src/pb-lang.js +132 -128
  81. package/src/pb-leaflet-map.js +488 -485
  82. package/src/pb-link.js +126 -124
  83. package/src/pb-load.js +431 -426
  84. package/src/pb-login.js +291 -248
  85. package/src/pb-manage-odds.js +364 -318
  86. package/src/pb-map-icon.js +89 -89
  87. package/src/pb-map-layer.js +85 -85
  88. package/src/pb-markdown.js +90 -99
  89. package/src/pb-media-query.js +74 -72
  90. package/src/pb-mei.js +306 -295
  91. package/src/pb-message.js +144 -144
  92. package/src/pb-mixin.js +269 -264
  93. package/src/pb-navigation.js +80 -82
  94. package/src/pb-observable.js +38 -38
  95. package/src/pb-odd-editor.js +1053 -955
  96. package/src/pb-odd-elementspec-editor.js +348 -297
  97. package/src/pb-odd-model-editor.js +1061 -901
  98. package/src/pb-odd-parameter-editor.js +200 -178
  99. package/src/pb-odd-rendition-editor.js +136 -124
  100. package/src/pb-page.js +431 -421
  101. package/src/pb-paginate.js +202 -190
  102. package/src/pb-panel.js +191 -179
  103. package/src/pb-popover-themes.js +7 -5
  104. package/src/pb-popover.js +296 -287
  105. package/src/pb-print-preview.js +127 -127
  106. package/src/pb-progress.js +51 -51
  107. package/src/pb-repeat.js +105 -104
  108. package/src/pb-restricted.js +84 -77
  109. package/src/pb-search.js +252 -241
  110. package/src/pb-select-feature.js +127 -120
  111. package/src/pb-select-odd.js +132 -124
  112. package/src/pb-select-template.js +89 -78
  113. package/src/pb-select.js +251 -227
  114. package/src/pb-split-list.js +179 -174
  115. package/src/pb-svg.js +80 -79
  116. package/src/pb-table-column.js +54 -54
  117. package/src/pb-table-grid.js +221 -203
  118. package/src/pb-tabs.js +61 -63
  119. package/src/pb-tify.js +154 -154
  120. package/src/pb-timeline.js +271 -229
  121. package/src/pb-toggle-feature.js +182 -175
  122. package/src/pb-upload.js +184 -174
  123. package/src/pb-version.js +30 -30
  124. package/src/pb-view-annotate.js +132 -98
  125. package/src/pb-view.js +1289 -1270
  126. package/src/pb-zoom.js +75 -59
  127. package/src/polymer-hack.js +1 -1
  128. package/src/search-result-service.js +256 -223
  129. package/src/seed-element.js +13 -20
  130. package/src/settings.js +4 -4
  131. package/src/theming.js +96 -96
  132. package/src/urls.js +289 -289
  133. package/src/utils.js +53 -51
@@ -1,89 +1,89 @@
1
- import { Registry } from "./registry.js";
1
+ import { Registry } from './registry.js';
2
2
 
3
3
  /**
4
4
  * Connector for the corporate archive of Georgfischer AG.
5
5
  */
6
6
  export class Anton extends Registry {
7
-
8
- constructor(configElem) {
9
- super(configElem);
10
- this._url = configElem.getAttribute('url') || `https://archives.georgfischer.com/api`;
11
- this._api = configElem.getAttribute('api');
12
- this._limit = configElem.getAttribute('limit') || 999999;
13
- this._provider = configElem.getAttribute('provider') || configElem.getAttribute('connector')
14
- }
7
+ constructor(configElem) {
8
+ super(configElem);
9
+ this._url = configElem.getAttribute('url') || `https://archives.georgfischer.com/api`;
10
+ this._api = configElem.getAttribute('api');
11
+ this._limit = configElem.getAttribute('limit') || 999999;
12
+ this._provider = configElem.getAttribute('provider') || configElem.getAttribute('connector');
13
+ }
15
14
 
16
- async query(key) {
17
- const results = [];
18
-
19
- const register = this.getRegister();
20
- const url = `${this._url}/${register}?search=${encodeURIComponent(key)}&perPage=${this._limit}`;
21
- const label = this.getLabelField();
22
- return new Promise((resolve) => {
23
- fetch(url)
24
- .then(response => response.json())
25
- .then(json => {
26
- if (!json.data) {
27
- resolve({
28
- totalItems: 0,
29
- items: []
30
- });
31
- return;
32
- }
33
- json.data.forEach(item => {
34
- if ((this._register === 'organization' && item.authority_type === 'Person') ||
35
- (this._register === 'person' && item.authority_type !== 'Person')) {
36
- return;
37
- }
38
- const result = {
39
- register: this._register,
40
- id: (this._prefix ? `${this._prefix}-${item.id}` : item.id),
41
- label: item[label],
42
- details: `${item.id}`,
43
- link: `${this._url}/${register}/${item.id}`,
44
- strings: [item[label]],
45
- provider: this._provider
46
- };
47
- results.push(result);
48
- });
49
- resolve({
50
- totalItems: json.meta.total,
51
- items: results,
52
- });
53
- })
54
- .catch((reason) => Promise.reject(reason));
55
- })
56
- }
15
+ async query(key) {
16
+ const results = [];
57
17
 
58
- info(key, container) {
59
- if (!key) {
60
- return Promise.resolve({});
61
- }
62
- const id = this._prefix ? key.substring(this._prefix.length + 1) : key;
63
- const label = this.getLabelField();
64
- return new Promise((resolve) => {
65
- this.getRecord(id)
18
+ const register = this.getRegister();
19
+ const url = `${this._url}/${register}?search=${encodeURIComponent(key)}&perPage=${this._limit}`;
20
+ const label = this.getLabelField();
21
+ return new Promise(resolve => {
22
+ fetch(url)
23
+ .then(response => response.json())
66
24
  .then(json => {
67
- const died = json.data.death ? `† ${json.data.death}` : '';
68
- const dates = json.data.birth ? `<p>* ${json.data.birth} ${died}</p>` : '';
69
- const note = json.data.note_bio ? `<p>${json.data.note_bio}</p>` : '';
70
- const output = `
25
+ if (!json.data) {
26
+ resolve({
27
+ totalItems: 0,
28
+ items: [],
29
+ });
30
+ return;
31
+ }
32
+ json.data.forEach(item => {
33
+ if (
34
+ (this._register === 'organization' && item.authority_type === 'Person') ||
35
+ (this._register === 'person' && item.authority_type !== 'Person')
36
+ ) {
37
+ return;
38
+ }
39
+ const result = {
40
+ register: this._register,
41
+ id: this._prefix ? `${this._prefix}-${item.id}` : item.id,
42
+ label: item[label],
43
+ details: `${item.id}`,
44
+ link: `${this._url}/${register}/${item.id}`,
45
+ strings: [item[label]],
46
+ provider: this._provider,
47
+ };
48
+ results.push(result);
49
+ });
50
+ resolve({
51
+ totalItems: json.meta.total,
52
+ items: results,
53
+ });
54
+ })
55
+ .catch(reason => Promise.reject(reason));
56
+ });
57
+ }
58
+
59
+ info(key, container) {
60
+ if (!key) {
61
+ return Promise.resolve({});
62
+ }
63
+ const id = this._prefix ? key.substring(this._prefix.length + 1) : key;
64
+ const label = this.getLabelField();
65
+ return new Promise(resolve => {
66
+ this.getRecord(id).then(json => {
67
+ const died = json.data.death ? `† ${json.data.death}` : '';
68
+ const dates = json.data.birth ? `<p>* ${json.data.birth} ${died}</p>` : '';
69
+ const note = json.data.note_bio ? `<p>${json.data.note_bio}</p>` : '';
70
+ const output = `
71
71
  <h3 class="label"><a href="https://${json.wikipediaURL}" target="_blank">${json.data[label]}</a></h3>
72
72
  ${dates}
73
73
  ${note}
74
74
  `;
75
- container.innerHTML = output;
76
- resolve({
77
- id: (this._prefix ? `${this._prefix}-${json.data.id}` : json.data.id),
78
- strings: [json.data[label]]
79
- });
75
+ container.innerHTML = output;
76
+ resolve({
77
+ id: this._prefix ? `${this._prefix}-${json.data.id}` : json.data.id,
78
+ strings: [json.data[label]],
80
79
  });
81
80
  });
82
- }
81
+ });
82
+ }
83
83
 
84
- /**
84
+ /**
85
85
  * Retrieve a raw JSON record for the given key as returned by the endpoint.
86
- *
86
+ *
87
87
  * @param {string} key the key to look up
88
88
  * @returns {Promise<any>} promise resolving to the JSON record returned by the endpoint
89
89
  */
@@ -91,68 +91,68 @@ export class Anton extends Registry {
91
91
  const id = key.replace(/^.*-([^-]+)$/, '$1');
92
92
  const url = `${this._url}/${this.getRegister()}/${id}`;
93
93
  return fetch(url)
94
- .then(response => response.json())
95
- .then(json => {
96
- const output = Object.assign({}, json);
97
- output.name = json.data[this.getLabelField()];
98
- switch (this._register) {
99
- case 'place':
100
- output.country = json.data.country;
101
- if (json.data.location && json.data.location.coordinates) {
102
- output.location = json.data.location.coordinates;
103
- }
104
- output.links = json.data.links.map((link) => link.url);
105
- break;
106
- case 'person':
107
- output.birth = json.data.birth;
108
- output.death = json.data.death;
109
- output.note = json.data.note_bio;
110
- output.links = [`https://${json.wikipediaURL}`];
111
- break;
112
- default:
113
- break;
114
- }
115
- return output;
116
- })
117
- .catch((reason) => Promise.reject(reason));
94
+ .then(response => response.json())
95
+ .then(json => {
96
+ const output = { ...json };
97
+ output.name = json.data[this.getLabelField()];
98
+ switch (this._register) {
99
+ case 'place':
100
+ output.country = json.data.country;
101
+ if (json.data.location && json.data.location.coordinates) {
102
+ output.location = json.data.location.coordinates;
103
+ }
104
+ output.links = json.data.links.map(link => link.url);
105
+ break;
106
+ case 'person':
107
+ output.birth = json.data.birth;
108
+ output.death = json.data.death;
109
+ output.note = json.data.note_bio;
110
+ output.links = [`https://${json.wikipediaURL}`];
111
+ break;
112
+ default:
113
+ break;
114
+ }
115
+ return output;
116
+ })
117
+ .catch(reason => Promise.reject(reason));
118
118
  }
119
119
 
120
- getLabelField() {
121
- let label;
122
- switch (this._register) {
123
- case 'term':
124
- label = 'label';
125
- break;
126
- default:
127
- label = 'fullname';
128
- break;
129
- }
130
- return label;
120
+ getLabelField() {
121
+ let label;
122
+ switch (this._register) {
123
+ case 'term':
124
+ label = 'label';
125
+ break;
126
+ default:
127
+ label = 'fullname';
128
+ break;
131
129
  }
130
+ return label;
131
+ }
132
132
 
133
- getRegister() {
134
- if (this._api) {
135
- return this._api;
136
- }
137
- let register;
138
- switch(this._register) {
139
- case 'person':
140
- case 'organization':
141
- register = 'actors';
142
- break;
143
- case 'origPlace':
144
- case 'place':
145
- register = 'places';
146
- break;
147
- case 'term':
148
- register = 'keywords';
149
- break;
150
- case 'abbreviation':
151
- register = 'abbreviations';
152
- break;
153
- default:
154
- register = this._register;
155
- }
156
- return register;
133
+ getRegister() {
134
+ if (this._api) {
135
+ return this._api;
157
136
  }
137
+ let register;
138
+ switch (this._register) {
139
+ case 'person':
140
+ case 'organization':
141
+ register = 'actors';
142
+ break;
143
+ case 'origPlace':
144
+ case 'place':
145
+ register = 'places';
146
+ break;
147
+ case 'term':
148
+ register = 'keywords';
149
+ break;
150
+ case 'abbreviation':
151
+ register = 'abbreviations';
152
+ break;
153
+ default:
154
+ register = this._register;
155
+ }
156
+ return register;
157
+ }
158
158
  }
@@ -3,13 +3,12 @@ import { Registry } from './registry.js';
3
3
  import { createConnectors } from './connectors.js';
4
4
 
5
5
  export class Custom extends Registry {
6
-
7
6
  constructor(endpoint, configElem) {
8
7
  super(configElem);
9
8
  this._editable = configElem.hasAttribute('edit');
10
9
  this._endpoint = endpoint;
11
10
  this._connectors = createConnectors(endpoint, configElem);
12
- this._connectors.forEach((connector) => {
11
+ this._connectors.forEach(connector => {
13
12
  connector.name = this.name;
14
13
  });
15
14
  console.log(
@@ -39,7 +38,7 @@ export class Custom extends Registry {
39
38
  label: item.label,
40
39
  link: item.link,
41
40
  details: item.details,
42
- provider: 'local'
41
+ provider: 'local',
43
42
  });
44
43
  localResults.add(item.id);
45
44
  });
@@ -48,7 +47,7 @@ export class Custom extends Registry {
48
47
  for (const connector of this._connectors) {
49
48
  // eslint-disable-next-line no-await-in-loop
50
49
  const dr = await connector.query(key);
51
- results = results.concat(dr.items.filter((result) => !localResults.has(result.id)));
50
+ results = results.concat(dr.items.filter(result => !localResults.has(result.id)));
52
51
  totalItems += dr.totalItems;
53
52
  }
54
53
  resolve({
@@ -65,15 +64,15 @@ export class Custom extends Registry {
65
64
  }
66
65
  const id = key;
67
66
  return new Promise((resolve, reject) => {
68
- fetch(`${this._endpoint}/api/register/${this._register}/${encodeURIComponent(id)}`)
69
- .then(async (response) => {
67
+ fetch(`${this._endpoint}/api/register/${this._register}/${encodeURIComponent(id)}`).then(
68
+ async response => {
70
69
  if (response.ok) {
71
70
  const json = await response.json();
72
71
  container.innerHTML = json.details;
73
72
  resolve({
74
73
  id: json.id,
75
74
  strings: json.strings,
76
- editable: this._editable
75
+ editable: this._editable,
77
76
  });
78
77
  return;
79
78
  }
@@ -87,17 +86,18 @@ export class Custom extends Registry {
87
86
  }
88
87
  } catch (e) {
89
88
  // not found: continue
90
- };
89
+ }
91
90
  }
92
91
  }
93
92
  reject();
94
- });
93
+ },
94
+ );
95
95
  });
96
96
  }
97
97
 
98
98
  /**
99
- *
100
- * @param {any} item
99
+ *
100
+ * @param {any} item
101
101
  * @returns {Promise}
102
102
  */
103
103
  async select(item) {
@@ -112,16 +112,18 @@ export class Custom extends Registry {
112
112
  if (!entry) {
113
113
  return Promise.resolve(item);
114
114
  }
115
- return fetch(`${this._endpoint}/api/register/${this._register}/${encodeURIComponent(item.id)}`, {
116
- method: 'POST',
117
- mode: "cors",
118
- credentials: "same-origin",
119
- headers: {
120
- "Content-Type": "application/json",
121
- },
122
- body: JSON.stringify(entry),
123
- })
124
- .then((response) => {
115
+ return fetch(
116
+ `${this._endpoint}/api/register/${this._register}/${encodeURIComponent(item.id)}`,
117
+ {
118
+ method: 'POST',
119
+ mode: 'cors',
120
+ credentials: 'same-origin',
121
+ headers: {
122
+ 'Content-Type': 'application/json',
123
+ },
124
+ body: JSON.stringify(entry),
125
+ },
126
+ ).then(response => {
125
127
  if (response.ok) {
126
128
  return response.json();
127
129
  }
@@ -1,7 +1,6 @@
1
1
  import { Registry } from './registry.js';
2
2
 
3
3
  export class GeoNames extends Registry {
4
-
5
4
  constructor(configElem) {
6
5
  super(configElem);
7
6
  this.user = configElem.getAttribute('user');
@@ -26,7 +25,7 @@ export class GeoNames extends Registry {
26
25
  details: `${item.fcodeName} - ${item.adminName1}, ${item.countryName}`,
27
26
  link: `https://www.geonames.org/${item.geonameId}`,
28
27
  strings: [item.toponymName],
29
- provider: 'geonames.org'
28
+ provider: 'geonames.org',
30
29
  };
31
30
  results.push(result);
32
31
  });
@@ -43,24 +42,25 @@ export class GeoNames extends Registry {
43
42
  return Promise.resolve({});
44
43
  }
45
44
  return new Promise((resolve, reject) => {
46
- this.getRecord(key).then(json => {
47
- if (json.status) {
48
- reject(json.status.message);
49
- return;
50
- }
51
- const output = `
45
+ this.getRecord(key)
46
+ .then(json => {
47
+ if (json.status) {
48
+ reject(json.status.message);
49
+ return;
50
+ }
51
+ const output = `
52
52
  <h3 class="label">
53
53
  <a href="${json.link}" target="_blank">${json.name}</a>
54
54
  </h3>
55
55
  <p class="fcode">${json.note} - ${json.region}, ${json.country}</p>
56
56
  `;
57
- container.innerHTML = output;
58
- resolve({
59
- id: this._prefix ? `${this._prefix}-${json.geonameId}` : json.geonameId,
60
- strings: [json.name],
61
- });
62
- })
63
- .catch(() => reject());
57
+ container.innerHTML = output;
58
+ resolve({
59
+ id: this._prefix ? `${this._prefix}-${json.geonameId}` : json.geonameId,
60
+ strings: [json.name],
61
+ });
62
+ })
63
+ .catch(() => reject());
64
64
  });
65
65
  }
66
66
 
@@ -73,22 +73,28 @@ export class GeoNames extends Registry {
73
73
  async getRecord(key) {
74
74
  const id = this._prefix ? key.substring(this._prefix.length + 1) : key;
75
75
  return fetch(
76
- `https://secure.geonames.org/getJSON?geonameId=${encodeURIComponent(id)}&username=${this.user}`,
77
- ).then(response => {
78
- if (response.ok) {
79
- return response.json();
80
- }
81
- return Promise.reject(response.status);
82
- })
83
- .then((json) => {
84
- const output = Object.assign({}, json);
85
- output.name = json.toponymName;
86
- output.country = json.countryName;
87
- output.region = json.adminName1;
88
- output.note = json.fcodeName;
89
- output.links = [`https://www.geonames.org/${json.geonameId}`, `https://${json.wikipediaURL}`];
90
- return output;
91
- })
92
- .catch(() => Promise.reject());
76
+ `https://secure.geonames.org/getJSON?geonameId=${encodeURIComponent(id)}&username=${
77
+ this.user
78
+ }`,
79
+ )
80
+ .then(response => {
81
+ if (response.ok) {
82
+ return response.json();
83
+ }
84
+ return Promise.reject(response.status);
85
+ })
86
+ .then(json => {
87
+ const output = { ...json };
88
+ output.name = json.toponymName;
89
+ output.country = json.countryName;
90
+ output.region = json.adminName1;
91
+ output.note = json.fcodeName;
92
+ output.links = [
93
+ `https://www.geonames.org/${json.geonameId}`,
94
+ `https://${json.wikipediaURL}`,
95
+ ];
96
+ return output;
97
+ })
98
+ .catch(() => Promise.reject());
93
99
  }
94
100
  }
@@ -7,7 +7,7 @@ function _details(item) {
7
7
  professions = item.professionOrOccupation.map(p => p.label).join(', ');
8
8
  }
9
9
  if (item.biographicalOrHistoricalInformation) {
10
- professions = `${professions}; ${item.biographicalOrHistoricalInformation.join(', ')}`;
10
+ professions = `${professions}; ${item.biographicalOrHistoricalInformation.join(', ')}`;
11
11
  }
12
12
  const dates = [];
13
13
  if (item.dateOfBirth && item.dateOfBirth.length > 0) {
@@ -27,7 +27,6 @@ function _details(item) {
27
27
  * Uses https://lobid.org to query the German GND
28
28
  */
29
29
  export class GND extends Registry {
30
-
31
30
  query(key) {
32
31
  const results = [];
33
32
  let filter;
@@ -45,28 +44,32 @@ export class GND extends Registry {
45
44
  filter = 'Person';
46
45
  break;
47
46
  }
48
- return new Promise((resolve) => {
49
- fetch(`https://lobid.org/gnd/search?q=${encodeURIComponent(key)}&filter=%2B%28type%3A${filter}%29&format=json&size=100`)
50
- .then((response) => response.json())
51
- .then((json) => {
52
- json.member.forEach((item) => {
47
+ return new Promise(resolve => {
48
+ fetch(
49
+ `https://lobid.org/gnd/search?q=${encodeURIComponent(
50
+ key,
51
+ )}&filter=%2B%28type%3A${filter}%29&format=json&size=100`,
52
+ )
53
+ .then(response => response.json())
54
+ .then(json => {
55
+ json.member.forEach(item => {
53
56
  const result = {
54
- register: this._register,
55
- id: (this._prefix ? `${this._prefix}-${item.gndIdentifier}` : item.gndIdentifier),
56
- label: item.preferredName,
57
- link: item.id,
58
- details: _details(item),
59
- strings: [item.preferredName].concat(item.variantName),
60
- provider: 'GND'
57
+ register: this._register,
58
+ id: this._prefix ? `${this._prefix}-${item.gndIdentifier}` : item.gndIdentifier,
59
+ label: item.preferredName,
60
+ link: item.id,
61
+ details: _details(item),
62
+ strings: [item.preferredName].concat(item.variantName),
63
+ provider: 'GND',
61
64
  };
62
65
  results.push(result);
63
- });
64
- resolve({
65
- totalItems: json.totalItems,
66
- items: results,
67
- });
68
- })
69
- })
66
+ });
67
+ resolve({
68
+ totalItems: json.totalItems,
69
+ items: results,
70
+ });
71
+ });
72
+ });
70
73
  }
71
74
 
72
75
  /**
@@ -78,14 +81,14 @@ export class GND extends Registry {
78
81
  async getRecord(key) {
79
82
  const id = this._prefix ? key.substring(this._prefix.length + 1) : key;
80
83
  return fetch(`https://lobid.org/gnd/${id}.json`)
81
- .then((response) => {
84
+ .then(response => {
82
85
  if (response.ok) {
83
86
  return response.json();
84
87
  }
85
88
  return Promise.reject();
86
89
  })
87
- .then((json) => {
88
- const output = Object.assign({}, json);
90
+ .then(json => {
91
+ const output = { ...json };
89
92
  output.name = json.preferredName;
90
93
  output.link = json.id;
91
94
  if (json.dateOfBirth && json.dateOfBirth.length > 0) {
@@ -98,7 +101,7 @@ export class GND extends Registry {
98
101
  output.note = json.biographicalOrHistoricalInformation.join('; ');
99
102
  }
100
103
  if (json.professionOrOccupation && json.professionOrOccupation.length > 0) {
101
- output.profession = json.professionOrOccupation.map((prof) => prof.label);
104
+ output.profession = json.professionOrOccupation.map(prof => prof.label);
102
105
  }
103
106
  return output;
104
107
  })
@@ -111,38 +114,40 @@ export class GND extends Registry {
111
114
  }
112
115
  return new Promise((resolve, reject) => {
113
116
  this.getRecord(key)
114
- .then((json) => {
115
- let info;
116
- if (json.type.indexOf('SubjectHeading') > -1) {
117
- info = this.infoSubject(json);
118
- } else if (json.type.indexOf('AuthorityResource') > -1) {
119
- info = this.infoPerson(json);
120
- }
121
- const output = `
117
+ .then(json => {
118
+ let info;
119
+ if (json.type.indexOf('SubjectHeading') > -1) {
120
+ info = this.infoSubject(json);
121
+ } else if (json.type.indexOf('AuthorityResource') > -1) {
122
+ info = this.infoPerson(json);
123
+ }
124
+ const output = `
122
125
  <h3 class="label">
123
126
  <a href="https://${json.id}" target="_blank"> ${json.preferredName} </a>
124
127
  </h3>
125
128
  ${info}
126
129
  `;
127
- container.innerHTML = output;
128
- resolve({
129
- id: this._prefix ? `${this._prefix}-${json.gndIdentifier}` : json.gndIdentifier,
130
- strings: [json.preferredName].concat(json.variantName)
131
- });
132
- })
133
- .catch(() => reject());
130
+ container.innerHTML = output;
131
+ resolve({
132
+ id: this._prefix ? `${this._prefix}-${json.gndIdentifier}` : json.gndIdentifier,
133
+ strings: [json.preferredName].concat(json.variantName),
134
+ });
135
+ })
136
+ .catch(() => reject());
134
137
  });
135
138
  }
136
139
 
137
140
  infoPerson(json) {
138
- const professions = json.professionOrOccuption ? json.professionOrOccupation.map((prof) => prof.label) : [];
141
+ const professions = json.professionOrOccuption
142
+ ? json.professionOrOccupation.map(prof => prof.label)
143
+ : [];
139
144
  return `<p>${json.dateOfBirth} - ${json.dateOfDeath}</p>
140
145
  <p>${professions.join(' ')}</p>`;
141
146
  }
142
147
 
143
148
  infoSubject(json) {
144
149
  if (json.broaderTermGeneral) {
145
- const terms = json.broaderTermGeneral.map((term) => term.label);
150
+ const terms = json.broaderTermGeneral.map(term => term.label);
146
151
  return `<p>${terms.join(', ')}</p>`;
147
152
  }
148
153
  return '';