@teipublisher/pb-components 2.26.0-next-3.12 → 2.26.0-next-3.14

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 (136) 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 +43 -0
  5. package/Dockerfile +78 -70
  6. package/css/components.css +5 -5
  7. package/dist/demo/pb-drawer2.html +1 -1
  8. package/dist/demo/pb-grid.html +19 -6
  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/{iron-form-277f9d42.js → iron-form-78b43d38.js} +1 -1
  14. package/dist/{paper-checkbox-4f410b1f.js → paper-checkbox-d16f23be.js} +44 -44
  15. package/dist/{paper-icon-button-0fb125c4.js → paper-icon-button-2cd9e0b4.js} +3 -3
  16. package/dist/{paper-listbox-c2468542.js → paper-listbox-2ad5c882.js} +7 -7
  17. package/dist/pb-code-editor.js +25 -20
  18. package/dist/pb-component-docs.js +58 -54
  19. package/dist/pb-components-bundle.js +2057 -2351
  20. package/dist/pb-edit-app.js +167 -107
  21. package/dist/pb-elements.json +45 -45
  22. package/dist/{pb-i18n-0611135a.js → pb-i18n-4cc00bfe.js} +1 -1
  23. package/dist/pb-leaflet-map.js +23 -23
  24. package/dist/pb-mei.js +56 -41
  25. package/dist/{pb-mixin-b1caa22e.js → pb-mixin-886ece32.js} +1 -1
  26. package/dist/pb-odd-editor.js +923 -756
  27. package/dist/pb-tify.js +2 -2
  28. package/dist/{vaadin-element-mixin-49ab4037.js → vaadin-element-mixin-c200b196.js} +179 -164
  29. package/gh-pages.js +5 -3
  30. package/i18n/common/pl.json +2 -2
  31. package/lib/openseadragon.min.js +1 -1
  32. package/package.json +2 -2
  33. package/pb-elements.json +45 -45
  34. package/src/assets/components.css +5 -5
  35. package/src/authority/airtable.js +20 -21
  36. package/src/authority/anton.js +129 -129
  37. package/src/authority/custom.js +23 -21
  38. package/src/authority/geonames.js +38 -32
  39. package/src/authority/gnd.js +47 -42
  40. package/src/authority/kbga.js +137 -134
  41. package/src/authority/metagrid.js +44 -46
  42. package/src/authority/reconciliation.js +66 -67
  43. package/src/authority/registry.js +4 -4
  44. package/src/docs/pb-component-docs.js +2 -2
  45. package/src/docs/pb-component-view.js +5 -5
  46. package/src/docs/pb-components-list.js +2 -2
  47. package/src/docs/pb-demo-snippet.js +2 -2
  48. package/src/dts-client.js +299 -297
  49. package/src/dts-select-endpoint.js +90 -82
  50. package/src/parse-date-service.js +184 -135
  51. package/src/pb-ajax.js +150 -146
  52. package/src/pb-authority-lookup.js +183 -146
  53. package/src/pb-autocomplete.js +292 -280
  54. package/src/pb-blacklab-highlight.js +264 -259
  55. package/src/pb-blacklab-results.js +236 -221
  56. package/src/pb-browse-docs.js +540 -475
  57. package/src/pb-browse.js +68 -65
  58. package/src/pb-clipboard.js +79 -76
  59. package/src/pb-code-editor.js +110 -102
  60. package/src/pb-code-highlight.js +209 -204
  61. package/src/pb-codepen.js +79 -72
  62. package/src/pb-collapse.js +212 -207
  63. package/src/pb-combo-box.js +190 -190
  64. package/src/pb-components-bundle.js +1 -1
  65. package/src/pb-custom-form.js +151 -149
  66. package/src/pb-dialog.js +94 -85
  67. package/src/pb-document.js +89 -90
  68. package/src/pb-download.js +210 -198
  69. package/src/pb-drawer.js +145 -148
  70. package/src/pb-edit-app.js +301 -229
  71. package/src/pb-edit-xml.js +98 -96
  72. package/src/pb-events.js +114 -107
  73. package/src/pb-facs-link.js +104 -102
  74. package/src/pb-facsimile.js +419 -414
  75. package/src/pb-formula.js +151 -153
  76. package/src/pb-geolocation.js +129 -131
  77. package/src/pb-grid-action.js +53 -56
  78. package/src/pb-grid.js +231 -228
  79. package/src/pb-highlight.js +140 -140
  80. package/src/pb-hotkeys.js +40 -42
  81. package/src/pb-i18n.js +101 -104
  82. package/src/pb-image-strip.js +84 -78
  83. package/src/pb-lang.js +132 -128
  84. package/src/pb-leaflet-map.js +488 -485
  85. package/src/pb-link.js +126 -124
  86. package/src/pb-load.js +431 -426
  87. package/src/pb-login.js +291 -248
  88. package/src/pb-manage-odds.js +364 -318
  89. package/src/pb-map-icon.js +89 -89
  90. package/src/pb-map-layer.js +85 -85
  91. package/src/pb-markdown.js +90 -99
  92. package/src/pb-media-query.js +74 -72
  93. package/src/pb-mei.js +306 -295
  94. package/src/pb-message.js +144 -144
  95. package/src/pb-mixin.js +269 -264
  96. package/src/pb-navigation.js +80 -82
  97. package/src/pb-observable.js +38 -38
  98. package/src/pb-odd-editor.js +1053 -955
  99. package/src/pb-odd-elementspec-editor.js +348 -297
  100. package/src/pb-odd-model-editor.js +1061 -901
  101. package/src/pb-odd-parameter-editor.js +200 -178
  102. package/src/pb-odd-rendition-editor.js +136 -124
  103. package/src/pb-page.js +431 -421
  104. package/src/pb-paginate.js +202 -190
  105. package/src/pb-panel.js +198 -182
  106. package/src/pb-popover-themes.js +7 -5
  107. package/src/pb-popover.js +296 -287
  108. package/src/pb-print-preview.js +127 -127
  109. package/src/pb-progress.js +51 -51
  110. package/src/pb-repeat.js +105 -104
  111. package/src/pb-restricted.js +84 -77
  112. package/src/pb-search.js +252 -241
  113. package/src/pb-select-feature.js +127 -120
  114. package/src/pb-select-odd.js +132 -124
  115. package/src/pb-select-template.js +89 -78
  116. package/src/pb-select.js +251 -227
  117. package/src/pb-split-list.js +179 -174
  118. package/src/pb-svg.js +80 -79
  119. package/src/pb-table-column.js +54 -54
  120. package/src/pb-table-grid.js +221 -203
  121. package/src/pb-tabs.js +61 -63
  122. package/src/pb-tify.js +154 -154
  123. package/src/pb-timeline.js +271 -229
  124. package/src/pb-toggle-feature.js +182 -175
  125. package/src/pb-upload.js +184 -174
  126. package/src/pb-version.js +30 -30
  127. package/src/pb-view-annotate.js +132 -98
  128. package/src/pb-view.js +1290 -1270
  129. package/src/pb-zoom.js +75 -59
  130. package/src/polymer-hack.js +1 -1
  131. package/src/search-result-service.js +256 -223
  132. package/src/seed-element.js +13 -20
  133. package/src/settings.js +4 -4
  134. package/src/theming.js +96 -96
  135. package/src/urls.js +289 -289
  136. package/src/utils.js +53 -51
@@ -2,17 +2,17 @@ import { LitElement, html, css } from 'lit-element';
2
2
  import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
3
3
  import { themableMixin } from './theming.js';
4
4
  import { pbMixin, waitOnce } from './pb-mixin.js';
5
- import { translate } from "./pb-i18n.js";
6
- import { createConnectors } from "./authority/connectors.js";
7
- import "./pb-restricted.js";
5
+ import { translate } from './pb-i18n.js';
6
+ import { createConnectors } from './authority/connectors.js';
7
+ import './pb-restricted.js';
8
8
 
9
9
  /**
10
10
  * Performs authority lookups via configurable connectors.
11
- *
11
+ *
12
12
  * @fires pb-authority-select - Fired when user selects an entry from the list
13
13
  * @fires pb-authority-edit-entity - Fired when user clicks the edit button next to an entry
14
- * @fires pb-authority-new-entity - Fiaured when user clicks the add new entity button
15
- * @fires pb-authority-lookup - When received, starts a lookup using the passed in query string and
14
+ * @fires pb-authority-new-entity - Fired when user clicks the add new entity button
15
+ * @fires pb-authority-lookup - When received, starts a lookup using the passed in query string and
16
16
  * authority type
17
17
  */
18
18
  export class PbAuthorityLookup extends themableMixin(pbMixin(LitElement)) {
@@ -31,7 +31,7 @@ export class PbAuthorityLookup extends themableMixin(pbMixin(LitElement)) {
31
31
  */
32
32
  sortByLabel: {
33
33
  type: Boolean,
34
- attribute: 'sort-by-label'
34
+ attribute: 'sort-by-label',
35
35
  },
36
36
  /**
37
37
  * A list of comma-separated stopwords which should be excluded
@@ -39,16 +39,16 @@ export class PbAuthorityLookup extends themableMixin(pbMixin(LitElement)) {
39
39
  * HTML text
40
40
  */
41
41
  stopwords: {
42
- type: String
42
+ type: String,
43
43
  },
44
44
  /**
45
45
  * A list of space- or comma-separated group names, whose members will be
46
46
  * allowed to add or edit entries in the local register (if enabled).
47
- *
47
+ *
48
48
  * @default "tei"
49
49
  */
50
50
  group: {
51
- type: String
51
+ type: String,
52
52
  },
53
53
  /**
54
54
  * The authority type to use. Should correspond to a name defined for one of the connectors.
@@ -94,19 +94,21 @@ export class PbAuthorityLookup extends themableMixin(pbMixin(LitElement)) {
94
94
 
95
95
  this._stopwordSet = new Set();
96
96
  if (this.stopwords) {
97
- this.stopwords.split(/\s*,\s*/).forEach((sw) => this._stopwordSet.add(sw.toLowerCase()));
97
+ this.stopwords.split(/\s*,\s*/).forEach(sw => this._stopwordSet.add(sw.toLowerCase()));
98
98
  }
99
99
 
100
100
  this.subscribeTo('pb-authority-lookup', ev => {
101
- this.query = ev.detail.query;
102
- this.type = ev.detail.type;
103
- this._results = [];
104
- this._query();
101
+ this.query = ev.detail.query;
102
+ this.type = ev.detail.type;
103
+ this._results = [];
104
+ this._query();
105
105
  });
106
106
 
107
107
  waitOnce('pb-page-ready', () => {
108
108
  const connectors = createConnectors(this.getEndpoint(), this);
109
- connectors.forEach(connector => { this._authorities[connector.register] = connector });
109
+ connectors.forEach(connector => {
110
+ this._authorities[connector.register] = connector;
111
+ });
110
112
  if (this.autoLookup) {
111
113
  this._query();
112
114
  }
@@ -117,33 +119,41 @@ export class PbAuthorityLookup extends themableMixin(pbMixin(LitElement)) {
117
119
 
118
120
  render() {
119
121
  return html`
120
- <header>
122
+ <header>
121
123
  <input
122
- id="query"
123
- type="search"
124
- placeholder="${translate('annotations.lookup')}"
125
- .value="${this.query}"
126
- @input="${e => this._queryChanged(e)}"
127
- @change="${e => this._queryChanged(e)}"
128
- aria-label="${translate('annotations.lookup')}"
124
+ id="query"
125
+ type="search"
126
+ placeholder="${translate('annotations.lookup')}"
127
+ .value="${this.query}"
128
+ @input="${e => this._queryChanged(e)}"
129
+ @change="${e => this._queryChanged(e)}"
130
+ aria-label="${translate('annotations.lookup')}"
129
131
  />
130
- ${
131
- this._authorities[this.type] && this._authorities[this.type].editable ?
132
- html`
133
- <pb-restricted group="${this.group}">
132
+ ${this._authorities[this.type] && this._authorities[this.type].editable
133
+ ? html`
134
+ <pb-restricted group="${this.group}">
134
135
  <button @click="${this._addEntity}" title="${translate('annotations.add-entity')}">
135
- <svg xmlns="http://www.w3.org/2000/svg" class="ionicon" viewBox="0 0 512 512"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M256 112v288M400 256H112"/></svg>
136
+ <svg xmlns="http://www.w3.org/2000/svg" class="ionicon" viewBox="0 0 512 512">
137
+ <path
138
+ fill="none"
139
+ stroke="currentColor"
140
+ stroke-linecap="round"
141
+ stroke-linejoin="round"
142
+ stroke-width="32"
143
+ d="M256 112v288M400 256H112"
144
+ />
145
+ </svg>
136
146
  </button>
137
- </pb-restricted>
138
- ` : null
139
- }
140
- </header>
141
- <slot name="authform"></slot>
142
- <div id="output">
143
- <ul part="output">
144
- ${this._results.map(item => this._formatItem(item))}
145
- </ul>
146
- </div>
147
+ </pb-restricted>
148
+ `
149
+ : null}
150
+ </header>
151
+ <slot name="authform"></slot>
152
+ <div id="output">
153
+ <ul part="output">
154
+ ${this._results.map(item => this._formatItem(item))}
155
+ </ul>
156
+ </div>
147
157
  `;
148
158
  }
149
159
 
@@ -154,11 +164,16 @@ export class PbAuthorityLookup extends themableMixin(pbMixin(LitElement)) {
154
164
  return Promise.resolve();
155
165
  }
156
166
  const authority = this._authorities[register];
157
- console.log('<pb-authority-lookup> Retrieving info for %s from %s using %s', id, register, authority.constructor.name);
167
+ console.log(
168
+ '<pb-authority-lookup> Retrieving info for %s from %s using %s',
169
+ id,
170
+ register,
171
+ authority.constructor.name,
172
+ );
158
173
  let info = await authority.info(id, container);
159
174
  if (info.strings) {
160
175
  info = Object.assign(info, {
161
- strings: info.strings.filter((s) => s && !this._stopwordSet.has(s.toLowerCase()))
176
+ strings: info.strings.filter(s => s && !this._stopwordSet.has(s.toLowerCase())),
162
177
  });
163
178
  }
164
179
  return info;
@@ -166,111 +181,134 @@ export class PbAuthorityLookup extends themableMixin(pbMixin(LitElement)) {
166
181
 
167
182
  _formatItem(item) {
168
183
  return html`
169
- <li>
170
- <div>
171
- <button @click="${() => this._select(item)}" title="link to">
172
- <svg xmlns="http://www.w3.org/2000/svg" class="ionicon" viewBox="0 0 512 512"><path d="M208 352h-64a96 96 0 010-192h64M304 160h64a96 96 0 010 192h-64M163.29 256h187.42" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="36"/></svg>
173
- </button>
174
- ${item.link
175
- ? html`<a target="_blank" href="${item.link}">${unsafeHTML(item.label)}</a>`
176
- : html`${unsafeHTML(item.label)}`
177
- }
178
- <div class="badges">
179
- ${item.occurrences > 0 ? html`<span class="occurrences badge" part="occurrences">${item.occurrences}</span>` : null}
180
- ${item.provider ? html`<span class="source badge" part="source">${item.provider}</span>` :null}
181
- <span class="register badge" part="register">${item.register}</span>
182
- ${
183
- this._authorities[this.type] && this._authorities[this.type].editable ?
184
- html`
185
- <pb-restricted group="${this.group}">
186
- <button
187
- @click="${() => this._editEntity(item)}"
188
- title="${translate('annotations.edit-entity')}">
189
- <svg xmlns="http://www.w3.org/2000/svg" class="ionicon" viewBox="0 0 512 512"><path d="M384 224v184a40 40 0 01-40 40H104a40 40 0 01-40-40V168a40 40 0 0140-40h167.48" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32"/><path d="M459.94 53.25a16.06 16.06 0 00-23.22-.56L424.35 65a8 8 0 000 11.31l11.34 11.32a8 8 0 0011.34 0l12.06-12c6.1-6.09 6.67-16.01.85-22.38zM399.34 90L218.82 270.2a9 9 0 00-2.31 3.93L208.16 299a3.91 3.91 0 004.86 4.86l24.85-8.35a9 9 0 003.93-2.31L422 112.66a9 9 0 000-12.66l-9.95-10a9 9 0 00-12.71 0z"/></svg>
190
- </button>
191
- </pb-restricted>` : null
192
- }
193
- </div>
194
- </div>
195
- ${item.details ? html`<div class="details" part="details">${item.details}</div>` : null}
184
+ <li>
185
+ <div>
186
+ <button @click="${() => this._select(item)}" title="link to">
187
+ <svg xmlns="http://www.w3.org/2000/svg" class="ionicon" viewBox="0 0 512 512">
188
+ <path
189
+ d="M208 352h-64a96 96 0 010-192h64M304 160h64a96 96 0 010 192h-64M163.29 256h187.42"
190
+ fill="none"
191
+ stroke="currentColor"
192
+ stroke-linecap="round"
193
+ stroke-linejoin="round"
194
+ stroke-width="36"
195
+ />
196
+ </svg>
197
+ </button>
198
+ ${item.link
199
+ ? html`<a target="_blank" href="${item.link}">${unsafeHTML(item.label)}</a>`
200
+ : html`${unsafeHTML(item.label)}`}
201
+ <div class="badges">
202
+ ${item.occurrences > 0
203
+ ? html`<span class="occurrences badge" part="occurrences">${item.occurrences}</span>`
204
+ : null}
205
+ ${item.provider
206
+ ? html`<span class="source badge" part="source">${item.provider}</span>`
207
+ : null}
208
+ <span class="register badge" part="register">${item.register}</span>
209
+ ${this._authorities[this.type] && this._authorities[this.type].editable
210
+ ? html` <pb-restricted group="${this.group}">
211
+ <button
212
+ @click="${() => this._editEntity(item)}"
213
+ title="${translate('annotations.edit-entity')}"
214
+ >
215
+ <svg xmlns="http://www.w3.org/2000/svg" class="ionicon" viewBox="0 0 512 512">
216
+ <path
217
+ d="M384 224v184a40 40 0 01-40 40H104a40 40 0 01-40-40V168a40 40 0 0140-40h167.48"
218
+ fill="none"
219
+ stroke="currentColor"
220
+ stroke-linecap="round"
221
+ stroke-linejoin="round"
222
+ stroke-width="32"
223
+ />
224
+ <path
225
+ d="M459.94 53.25a16.06 16.06 0 00-23.22-.56L424.35 65a8 8 0 000 11.31l11.34 11.32a8 8 0 0011.34 0l12.06-12c6.1-6.09 6.67-16.01.85-22.38zM399.34 90L218.82 270.2a9 9 0 00-2.31 3.93L208.16 299a3.91 3.91 0 004.86 4.86l24.85-8.35a9 9 0 003.93-2.31L422 112.66a9 9 0 000-12.66l-9.95-10a9 9 0 00-12.71 0z"
226
+ />
227
+ </svg>
228
+ </button>
229
+ </pb-restricted>`
230
+ : null}
231
+ </div>
232
+ </div>
233
+ ${item.details ? html`<div class="details" part="details">${item.details}</div>` : null}
196
234
  </li>
197
235
  `;
198
236
  }
199
237
 
200
- static get styles() {
201
- return css`
202
- :host {
203
- display: flex;
204
- flex-direction: column;
205
- }
238
+ static get styles() {
239
+ return css`
240
+ :host {
241
+ display: flex;
242
+ flex-direction: column;
243
+ }
206
244
 
207
- header {
208
- display: flex;
209
- justify-content: space-between;
210
- align-items: center;
211
- margin-bottom: 1rem;
212
- }
245
+ header {
246
+ display: flex;
247
+ justify-content: space-between;
248
+ align-items: center;
249
+ margin-bottom: 1rem;
250
+ }
213
251
 
214
- header > input {
215
- flex-grow: 1;
216
- }
252
+ header > input {
253
+ flex-grow: 1;
254
+ }
217
255
 
218
- .link {
219
- flex-grow: 2;
220
- }
221
-
222
- #output {
223
- overflow: auto;
224
- /*FireFox*/
225
- scrollbar-width: none;
226
- }
256
+ .link {
257
+ flex-grow: 2;
258
+ }
227
259
 
228
- #output > ul {
229
- width: 100%;
230
- padding: 0;
231
- list-style: none;
232
- }
260
+ #output {
261
+ overflow: auto;
262
+ /*FireFox*/
263
+ scrollbar-width: none;
264
+ }
265
+
266
+ #output > ul {
267
+ width: 100%;
268
+ padding: 0;
269
+ list-style: none;
270
+ }
233
271
 
234
- #output > ul > li {
235
- border-bottom: 1px solid var(--pb-color-border);
236
- }
272
+ #output > ul > li {
273
+ border-bottom: 1px solid var(--pb-color-border);
274
+ }
237
275
 
238
- #output > ul > li > div {
239
- display: flex;
240
- justify-content: space-between;
241
- align-items: center;
242
- flex-wrap: wrap;
243
- gap: .125rem;
244
- }
276
+ #output > ul > li > div {
277
+ display: flex;
278
+ justify-content: space-between;
279
+ align-items: center;
280
+ flex-wrap: wrap;
281
+ gap: 0.125rem;
282
+ }
245
283
 
246
- #output > ul > li > div > a {
247
- flex-grow: 2;
248
- }
284
+ #output > ul > li > div > a {
285
+ flex-grow: 2;
286
+ }
249
287
 
250
- .badges {
251
- display: inline-flex;
252
- gap: .125rem;
253
- align-items: center;
254
- }
288
+ .badges {
289
+ display: inline-flex;
290
+ gap: 0.125rem;
291
+ align-items: center;
292
+ }
255
293
 
256
- .badge {
257
- font-size: .75rem;
258
- border-radius: 4px;
259
- padding: 4px;
260
- color: var(--pb-color-inverse);
261
- }
294
+ .badge {
295
+ font-size: 0.75rem;
296
+ border-radius: 4px;
297
+ padding: 4px;
298
+ color: var(--pb-color-inverse);
299
+ }
262
300
 
263
- .source {
264
- background-color: #637b8c;
265
- }
266
- .register {
267
- background-color: var(--pb-color-lighter, #35424b);
268
- }
269
- .occurrences {
270
- background-color: var(--pb-color-focus, #f6a623);
271
- }
301
+ .source {
302
+ background-color: #637b8c;
303
+ }
304
+ .register {
305
+ background-color: var(--pb-color-lighter, #35424b);
306
+ }
307
+ .occurrences {
308
+ background-color: var(--pb-color-focus, #f6a623);
309
+ }
272
310
  `;
273
- }
311
+ }
274
312
 
275
313
  _select(item) {
276
314
  const connector = this._authorities[item.register];
@@ -279,13 +317,13 @@ export class PbAuthorityLookup extends themableMixin(pbMixin(LitElement)) {
279
317
  type: item.register,
280
318
  properties: {
281
319
  ref: item.id,
282
- }
320
+ },
283
321
  };
284
322
  if (connector) {
285
323
  connector
286
324
  .select(item)
287
325
  .then(() => this.emitTo('pb-authority-select', options))
288
- .catch((e) => this.emitTo('pb-authority-error', {status: e.message}));
326
+ .catch(e => this.emitTo('pb-authority-error', { status: e.message }));
289
327
  } else {
290
328
  this.emitTo('pb-authority-select', options);
291
329
  }
@@ -296,24 +334,23 @@ export class PbAuthorityLookup extends themableMixin(pbMixin(LitElement)) {
296
334
  if (connector) {
297
335
  connector
298
336
  .select(item)
299
- .then(() => this.emitTo('pb-authority-edit-entity', {id: item.id, type: item.register}));
337
+ .then(() => this.emitTo('pb-authority-edit-entity', { id: item.id, type: item.register }));
300
338
  } else {
301
- this.emitTo('pb-authority-edit-entity', {id: item.id, type: item.register});
339
+ this.emitTo('pb-authority-edit-entity', { id: item.id, type: item.register });
302
340
  }
303
341
  }
304
342
 
305
343
  _queryChanged(e) {
306
344
  this._results = [];
307
- this.query = e.target.value;
308
- this._query();
345
+ this.query = e.target.value;
346
+ this._query();
309
347
  }
310
348
 
311
349
  _query() {
312
350
  this.emitTo('pb-start-update');
313
351
  this._authorities[this.type].query(this.query).then(results => {
314
- this._occurrences(results.items)
315
- .then((merged) => {
316
- this._results = merged;
352
+ this._occurrences(results.items).then(merged => {
353
+ this._results = merged;
317
354
  });
318
355
  this.emitTo('pb-end-update');
319
356
  // this.shadowRoot.getElementById('query').focus();
@@ -321,7 +358,7 @@ export class PbAuthorityLookup extends themableMixin(pbMixin(LitElement)) {
321
358
  }
322
359
 
323
360
  _addEntity() {
324
- this.emitTo('pb-authority-new-entity', {query: this.query, type: this.type});
361
+ this.emitTo('pb-authority-new-entity', { query: this.query, type: this.type });
325
362
  }
326
363
 
327
364
  _occurrences(items) {
@@ -330,13 +367,13 @@ export class PbAuthorityLookup extends themableMixin(pbMixin(LitElement)) {
330
367
  }
331
368
  const params = new FormData();
332
369
  params.append('register', this.type);
333
- items.forEach((item) => {
370
+ items.forEach(item => {
334
371
  params.append('id', item.id);
335
372
  });
336
- return new Promise((resolve) => {
373
+ return new Promise(resolve => {
337
374
  fetch(`${this.getEndpoint()}/api/annotations/occurrences`, {
338
375
  method: 'POST',
339
- body: params
376
+ body: params,
340
377
  })
341
378
  .then(response => {
342
379
  if (response.ok) {
@@ -344,7 +381,7 @@ export class PbAuthorityLookup extends themableMixin(pbMixin(LitElement)) {
344
381
  }
345
382
  })
346
383
  .then(json => {
347
- items.forEach((item) => {
384
+ items.forEach(item => {
348
385
  if (json[item.id]) {
349
386
  item.occurrences = json[item.id];
350
387
  } else {
@@ -366,7 +403,7 @@ export class PbAuthorityLookup extends themableMixin(pbMixin(LitElement)) {
366
403
  });
367
404
  resolve(items);
368
405
  });
369
- });
406
+ });
370
407
  }
371
408
  }
372
409
  customElements.define('pb-authority-lookup', PbAuthorityLookup);