@teipublisher/pb-components 2.25.5 → 2.25.6
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/.github/workflows/main.yml +3 -3
- package/.github/workflows/node.js.yml +3 -3
- package/.github/workflows/release.js.yml +3 -3
- package/CHANGELOG.md +8 -0
- package/Dockerfile +78 -70
- package/css/components.css +5 -5
- package/dist/demo/pb-drawer2.html +1 -1
- package/dist/demo/pb-leaflet-map.html +1 -1
- package/dist/demo/pb-repeat.html +1 -3
- package/dist/demo/pb-view3.html +1 -1
- package/dist/{paper-icon-button-0fb125c4.js → paper-icon-button-72125e67.js} +1 -1
- package/dist/pb-code-editor.js +25 -20
- package/dist/pb-component-docs.js +58 -54
- package/dist/pb-components-bundle.js +1827 -1520
- package/dist/pb-edit-app.js +167 -107
- package/dist/pb-elements.json +54 -54
- package/dist/{pb-i18n-0611135a.js → pb-i18n-4cc00bfe.js} +1 -1
- package/dist/pb-leaflet-map.js +23 -23
- package/dist/pb-mei.js +56 -41
- package/dist/{pb-mixin-b1caa22e.js → pb-mixin-886ece32.js} +1 -1
- package/dist/pb-odd-editor.js +925 -758
- package/dist/pb-tify.js +2 -2
- package/dist/{vaadin-element-mixin-859a0132.js → vaadin-element-mixin-ad07ba25.js} +88 -61
- package/gh-pages.js +5 -3
- package/package.json +2 -2
- package/pb-elements.json +54 -54
- package/src/assets/components.css +5 -5
- package/src/authority/airtable.js +20 -21
- package/src/authority/anton.js +129 -129
- package/src/authority/custom.js +23 -21
- package/src/authority/geonames.js +38 -32
- package/src/authority/gnd.js +47 -42
- package/src/authority/kbga.js +137 -134
- package/src/authority/metagrid.js +44 -46
- package/src/authority/reconciliation.js +66 -67
- package/src/authority/registry.js +4 -4
- package/src/docs/pb-component-docs.js +2 -2
- package/src/docs/pb-component-view.js +5 -5
- package/src/docs/pb-components-list.js +2 -2
- package/src/docs/pb-demo-snippet.js +2 -2
- package/src/dts-client.js +299 -297
- package/src/dts-select-endpoint.js +90 -82
- package/src/parse-date-service.js +184 -135
- package/src/pb-ajax.js +171 -167
- package/src/pb-authority-lookup.js +96 -81
- package/src/pb-autocomplete.js +292 -280
- package/src/pb-blacklab-highlight.js +264 -259
- package/src/pb-blacklab-results.js +236 -221
- package/src/pb-browse-docs.js +540 -475
- package/src/pb-browse.js +68 -65
- package/src/pb-clipboard.js +79 -76
- package/src/pb-code-editor.js +110 -102
- package/src/pb-code-highlight.js +209 -204
- package/src/pb-codepen.js +79 -72
- package/src/pb-collapse.js +149 -146
- package/src/pb-combo-box.js +190 -190
- package/src/pb-components-bundle.js +1 -1
- package/src/pb-custom-form.js +150 -149
- package/src/pb-document.js +89 -90
- package/src/pb-download.js +208 -195
- package/src/pb-drawer.js +145 -148
- package/src/pb-edit-app.js +301 -229
- package/src/pb-edit-xml.js +99 -96
- package/src/pb-events.js +114 -107
- package/src/pb-facs-link.js +104 -102
- package/src/pb-facsimile.js +411 -413
- package/src/pb-formula.js +151 -153
- package/src/pb-geolocation.js +129 -131
- package/src/pb-grid-action.js +53 -56
- package/src/pb-grid.js +231 -228
- package/src/pb-highlight.js +140 -140
- package/src/pb-hotkeys.js +40 -42
- package/src/pb-i18n.js +101 -104
- package/src/pb-image-strip.js +84 -78
- package/src/pb-lang.js +83 -70
- package/src/pb-leaflet-map.js +488 -485
- package/src/pb-link.js +126 -124
- package/src/pb-load.js +431 -426
- package/src/pb-login.js +275 -254
- package/src/pb-manage-odds.js +364 -318
- package/src/pb-map-icon.js +89 -89
- package/src/pb-map-layer.js +85 -85
- package/src/pb-markdown.js +90 -99
- package/src/pb-media-query.js +74 -72
- package/src/pb-mei.js +306 -295
- package/src/pb-message.js +143 -130
- package/src/pb-mixin.js +269 -264
- package/src/pb-navigation.js +80 -82
- package/src/pb-observable.js +38 -38
- package/src/pb-odd-editor.js +1056 -958
- package/src/pb-odd-elementspec-editor.js +348 -297
- package/src/pb-odd-model-editor.js +1058 -898
- package/src/pb-odd-parameter-editor.js +200 -178
- package/src/pb-odd-rendition-editor.js +136 -124
- package/src/pb-page.js +432 -422
- package/src/pb-paginate.js +202 -190
- package/src/pb-panel.js +191 -179
- package/src/pb-popover-themes.js +7 -5
- package/src/pb-popover.js +296 -287
- package/src/pb-print-preview.js +127 -127
- package/src/pb-progress.js +49 -49
- package/src/pb-repeat.js +105 -104
- package/src/pb-restricted.js +84 -77
- package/src/pb-search.js +238 -221
- package/src/pb-select-feature.js +127 -120
- package/src/pb-select-odd.js +132 -124
- package/src/pb-select-template.js +89 -78
- package/src/pb-select.js +251 -227
- package/src/pb-split-list.js +179 -174
- package/src/pb-svg.js +80 -79
- package/src/pb-table-column.js +54 -54
- package/src/pb-table-grid.js +221 -203
- package/src/pb-tabs.js +61 -63
- package/src/pb-tify.js +154 -154
- package/src/pb-timeline.js +271 -229
- package/src/pb-toggle-feature.js +198 -185
- package/src/pb-upload.js +184 -174
- package/src/pb-version.js +30 -30
- package/src/pb-view-annotate.js +132 -98
- package/src/pb-view.js +1282 -1263
- package/src/pb-zoom.js +40 -40
- package/src/polymer-hack.js +1 -1
- package/src/search-result-service.js +256 -223
- package/src/seed-element.js +13 -20
- package/src/settings.js +4 -4
- package/src/theming.js +91 -91
- package/src/urls.js +289 -289
- package/src/utils.js +53 -51
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { LitElement, html, css } from 'lit-element';
|
|
2
2
|
import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
|
|
3
3
|
import { pbMixin, waitOnce } from './pb-mixin.js';
|
|
4
|
-
import { translate } from
|
|
5
|
-
import { createConnectors } from
|
|
6
|
-
import
|
|
4
|
+
import { translate } from './pb-i18n.js';
|
|
5
|
+
import { createConnectors } from './authority/connectors.js';
|
|
6
|
+
import './pb-restricted.js';
|
|
7
7
|
import '@polymer/paper-input/paper-input';
|
|
8
8
|
import '@polymer/paper-icon-button';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Performs authority lookups via configurable connectors.
|
|
12
|
-
*
|
|
12
|
+
*
|
|
13
13
|
* @fires pb-authority-select - Fired when user selects an entry from the list
|
|
14
14
|
* @fires pb-authority-edit-entity - Fired when user clicks the edit button next to an entry
|
|
15
15
|
* @fires pb-authority-new-entity - Fired when user clicks the add new entity button
|
|
16
|
-
* @fires pb-authority-lookup - When received, starts a lookup using the passed in query string and
|
|
16
|
+
* @fires pb-authority-lookup - When received, starts a lookup using the passed in query string and
|
|
17
17
|
* authority type
|
|
18
18
|
*/
|
|
19
19
|
export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
@@ -32,7 +32,7 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
32
32
|
*/
|
|
33
33
|
sortByLabel: {
|
|
34
34
|
type: Boolean,
|
|
35
|
-
attribute: 'sort-by-label'
|
|
35
|
+
attribute: 'sort-by-label',
|
|
36
36
|
},
|
|
37
37
|
/**
|
|
38
38
|
* A list of comma-separated stopwords which should be excluded
|
|
@@ -40,16 +40,16 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
40
40
|
* HTML text
|
|
41
41
|
*/
|
|
42
42
|
stopwords: {
|
|
43
|
-
type: String
|
|
43
|
+
type: String,
|
|
44
44
|
},
|
|
45
45
|
/**
|
|
46
46
|
* A list of space- or comma-separated group names, whose members will be
|
|
47
47
|
* allowed to add or edit entries in the local register (if enabled).
|
|
48
|
-
*
|
|
48
|
+
*
|
|
49
49
|
* @default "tei"
|
|
50
50
|
*/
|
|
51
51
|
group: {
|
|
52
|
-
type: String
|
|
52
|
+
type: String,
|
|
53
53
|
},
|
|
54
54
|
/**
|
|
55
55
|
* The authority type to use. Should correspond to a name defined for one of the connectors.
|
|
@@ -95,19 +95,21 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
95
95
|
|
|
96
96
|
this._stopwordSet = new Set();
|
|
97
97
|
if (this.stopwords) {
|
|
98
|
-
this.stopwords.split(/\s*,\s*/).forEach(
|
|
98
|
+
this.stopwords.split(/\s*,\s*/).forEach(sw => this._stopwordSet.add(sw.toLowerCase()));
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
this.subscribeTo('pb-authority-lookup', ev => {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
this.query = ev.detail.query;
|
|
103
|
+
this.type = ev.detail.type;
|
|
104
|
+
this._results = [];
|
|
105
|
+
this._query();
|
|
106
106
|
});
|
|
107
107
|
|
|
108
108
|
waitOnce('pb-page-ready', () => {
|
|
109
109
|
const connectors = createConnectors(this.getEndpoint(), this);
|
|
110
|
-
connectors.forEach(connector => {
|
|
110
|
+
connectors.forEach(connector => {
|
|
111
|
+
this._authorities[connector.register] = connector;
|
|
112
|
+
});
|
|
111
113
|
if (this.autoLookup) {
|
|
112
114
|
this._query();
|
|
113
115
|
}
|
|
@@ -126,14 +128,17 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
126
128
|
@change="${this._queryChanged}"
|
|
127
129
|
>
|
|
128
130
|
<iron-icon icon="icons:search" slot="prefix"></iron-icon>
|
|
129
|
-
${
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
131
|
+
${this._authorities[this.type] && this._authorities[this.type].editable
|
|
132
|
+
? html`
|
|
133
|
+
<pb-restricted group="${this.group}" slot="suffix">
|
|
134
|
+
<paper-icon-button
|
|
135
|
+
icon="icons:add"
|
|
136
|
+
@click="${this._addEntity}"
|
|
137
|
+
title="${translate('annotations.add-entity')}"
|
|
138
|
+
></paper-icon-button>
|
|
139
|
+
</pb-restricted>
|
|
140
|
+
`
|
|
141
|
+
: null}
|
|
137
142
|
</paper-input>
|
|
138
143
|
<slot name="authform"></slot>
|
|
139
144
|
<div id="output">
|
|
@@ -151,11 +156,16 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
151
156
|
return Promise.resolve();
|
|
152
157
|
}
|
|
153
158
|
const authority = this._authorities[register];
|
|
154
|
-
console.log(
|
|
159
|
+
console.log(
|
|
160
|
+
'<pb-authority-lookup> Retrieving info for %s from %s using %s',
|
|
161
|
+
id,
|
|
162
|
+
register,
|
|
163
|
+
authority.constructor.name,
|
|
164
|
+
);
|
|
155
165
|
let info = await authority.info(id, container);
|
|
156
166
|
if (info.strings) {
|
|
157
167
|
info = Object.assign(info, {
|
|
158
|
-
strings: info.strings.filter(
|
|
168
|
+
strings: info.strings.filter(s => s && !this._stopwordSet.has(s.toLowerCase())),
|
|
159
169
|
});
|
|
160
170
|
}
|
|
161
171
|
return info;
|
|
@@ -164,43 +174,42 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
164
174
|
_formatItem(item) {
|
|
165
175
|
return html`
|
|
166
176
|
<li>
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
177
|
+
<div class="icons">
|
|
178
|
+
<paper-icon-button
|
|
179
|
+
icon="icons:link"
|
|
180
|
+
@click="${() => this._select(item)}"
|
|
181
|
+
title="link to"
|
|
182
|
+
></paper-icon-button>
|
|
183
|
+
</div>
|
|
184
|
+
<div class="link">
|
|
185
|
+
${item.link
|
|
186
|
+
? html`<a target="_blank" href="${item.link}">${unsafeHTML(item.label)}</a>`
|
|
187
|
+
: html`${unsafeHTML(item.label)}`}
|
|
188
|
+
</div>
|
|
189
|
+
${item.occurrences > 0
|
|
190
|
+
? html`<div><span class="occurrences" part="occurrences">${item.occurrences}</span></div>`
|
|
191
|
+
: null}
|
|
192
|
+
${item.provider
|
|
193
|
+
? html`<div><span class="source" part="source">${item.provider}</span></div>`
|
|
194
|
+
: null}
|
|
182
195
|
<div><span class="register" part="register">${item.register}</span></div>
|
|
183
196
|
|
|
184
|
-
${
|
|
185
|
-
|
|
186
|
-
html`
|
|
187
|
-
<pb-restricted group="${this.group}">
|
|
197
|
+
${this._authorities[this.type] && this._authorities[this.type].editable
|
|
198
|
+
? html` <pb-restricted group="${this.group}">
|
|
188
199
|
<div class="icons">
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
200
|
+
<paper-icon-button
|
|
201
|
+
icon="editor:mode-edit"
|
|
202
|
+
@click="${() => this._editEntity(item)}"
|
|
203
|
+
title="${translate('annotations.edit-entity')}"
|
|
204
|
+
></paper-icon-button>
|
|
194
205
|
</div>
|
|
195
|
-
</pb-restricted>`
|
|
196
|
-
|
|
206
|
+
</pb-restricted>`
|
|
207
|
+
: null}
|
|
197
208
|
${item.details ? html`<div class="details" part="details">${item.details}</div>` : null}
|
|
198
|
-
|
|
199
209
|
</li>
|
|
200
210
|
`;
|
|
201
211
|
}
|
|
202
212
|
|
|
203
|
-
|
|
204
213
|
_select(item) {
|
|
205
214
|
const connector = this._authorities[item.register];
|
|
206
215
|
const options = {
|
|
@@ -208,13 +217,13 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
208
217
|
type: item.register,
|
|
209
218
|
properties: {
|
|
210
219
|
ref: item.id,
|
|
211
|
-
}
|
|
220
|
+
},
|
|
212
221
|
};
|
|
213
222
|
if (connector) {
|
|
214
223
|
connector
|
|
215
224
|
.select(item)
|
|
216
225
|
.then(() => this.emitTo('pb-authority-select', options))
|
|
217
|
-
.catch(
|
|
226
|
+
.catch(e => this.emitTo('pb-authority-error', { status: e.message }));
|
|
218
227
|
} else {
|
|
219
228
|
this.emitTo('pb-authority-select', options);
|
|
220
229
|
}
|
|
@@ -225,24 +234,23 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
225
234
|
if (connector) {
|
|
226
235
|
connector
|
|
227
236
|
.select(item)
|
|
228
|
-
.then(() => this.emitTo('pb-authority-edit-entity', {id: item.id, type: item.register}));
|
|
237
|
+
.then(() => this.emitTo('pb-authority-edit-entity', { id: item.id, type: item.register }));
|
|
229
238
|
} else {
|
|
230
|
-
this.emitTo('pb-authority-edit-entity', {id: item.id, type: item.register});
|
|
239
|
+
this.emitTo('pb-authority-edit-entity', { id: item.id, type: item.register });
|
|
231
240
|
}
|
|
232
241
|
}
|
|
233
242
|
|
|
234
243
|
_queryChanged() {
|
|
235
244
|
this._results = [];
|
|
236
|
-
|
|
237
|
-
|
|
245
|
+
this.query = this.shadowRoot.getElementById('query').value;
|
|
246
|
+
this._query();
|
|
238
247
|
}
|
|
239
248
|
|
|
240
249
|
_query() {
|
|
241
250
|
this.emitTo('pb-start-update');
|
|
242
251
|
this._authorities[this.type].query(this.query).then(results => {
|
|
243
|
-
this._occurrences(results.items)
|
|
244
|
-
.
|
|
245
|
-
this._results = merged;
|
|
252
|
+
this._occurrences(results.items).then(merged => {
|
|
253
|
+
this._results = merged;
|
|
246
254
|
});
|
|
247
255
|
this.emitTo('pb-end-update');
|
|
248
256
|
// this.shadowRoot.getElementById('query').focus();
|
|
@@ -250,7 +258,7 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
250
258
|
}
|
|
251
259
|
|
|
252
260
|
_addEntity() {
|
|
253
|
-
this.emitTo('pb-authority-new-entity', {query: this.query, type: this.type});
|
|
261
|
+
this.emitTo('pb-authority-new-entity', { query: this.query, type: this.type });
|
|
254
262
|
}
|
|
255
263
|
|
|
256
264
|
_occurrences(items) {
|
|
@@ -259,13 +267,13 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
259
267
|
}
|
|
260
268
|
const params = new FormData();
|
|
261
269
|
params.append('register', this.type);
|
|
262
|
-
items.forEach(
|
|
270
|
+
items.forEach(item => {
|
|
263
271
|
params.append('id', item.id);
|
|
264
272
|
});
|
|
265
|
-
return new Promise(
|
|
273
|
+
return new Promise(resolve => {
|
|
266
274
|
fetch(`${this.getEndpoint()}/api/annotations/occurrences`, {
|
|
267
275
|
method: 'POST',
|
|
268
|
-
body: params
|
|
276
|
+
body: params,
|
|
269
277
|
})
|
|
270
278
|
.then(response => {
|
|
271
279
|
if (response.ok) {
|
|
@@ -273,7 +281,7 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
273
281
|
}
|
|
274
282
|
})
|
|
275
283
|
.then(json => {
|
|
276
|
-
items.forEach(
|
|
284
|
+
items.forEach(item => {
|
|
277
285
|
if (json[item.id]) {
|
|
278
286
|
item.occurrences = json[item.id];
|
|
279
287
|
} else {
|
|
@@ -295,7 +303,7 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
295
303
|
});
|
|
296
304
|
resolve(items);
|
|
297
305
|
});
|
|
298
|
-
|
|
306
|
+
});
|
|
299
307
|
}
|
|
300
308
|
|
|
301
309
|
static get styles() {
|
|
@@ -334,26 +342,33 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
334
342
|
list-style: none;
|
|
335
343
|
}
|
|
336
344
|
#output li {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
345
|
+
display: flex;
|
|
346
|
+
justify-content: space-between;
|
|
347
|
+
flex-wrap: wrap;
|
|
348
|
+
align-items: center;
|
|
349
|
+
border-bottom: 1px solid #efefef;
|
|
342
350
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
#output td:nth-child(3),
|
|
351
|
+
#output li:hover {
|
|
352
|
+
background: #efefef;
|
|
353
|
+
}
|
|
354
|
+
#output td:nth-child(3),
|
|
355
|
+
#output td:nth-child(4),
|
|
356
|
+
#output td:nth-child(5) {
|
|
347
357
|
text-align: right;
|
|
348
358
|
vertical-align: middle;
|
|
349
359
|
}
|
|
350
360
|
|
|
351
|
-
.details,
|
|
352
|
-
|
|
353
|
-
|
|
361
|
+
.details,
|
|
362
|
+
.source,
|
|
363
|
+
.register,
|
|
364
|
+
.occurrences {
|
|
365
|
+
font-size: 0.85rem;
|
|
366
|
+
width: 100%;
|
|
354
367
|
}
|
|
355
368
|
|
|
356
|
-
.source,
|
|
369
|
+
.source,
|
|
370
|
+
.register,
|
|
371
|
+
.occurrences {
|
|
357
372
|
border-radius: 4px;
|
|
358
373
|
padding: 4px;
|
|
359
374
|
color: var(--pb-color-inverse);
|