@teipublisher/pb-components 2.26.1-next.3 → 3.0.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/.github/workflows/main.yml +3 -3
- package/.github/workflows/node.js.yml +3 -3
- package/.github/workflows/release.js.yml +4 -4
- package/.releaserc.json +2 -2
- package/CHANGELOG.md +262 -11
- package/Dockerfile +78 -70
- package/css/components.css +5 -5
- package/css/leaflet/images/layers.png +0 -0
- package/dist/demo/components.css +46 -1
- package/dist/demo/pb-browse-docs2.html +1 -1
- package/dist/demo/pb-dialog.html +3 -5
- package/dist/demo/pb-drawer2.html +1 -1
- package/dist/demo/pb-facsimile.html +2 -2
- package/dist/demo/pb-grid.html +19 -6
- package/dist/demo/pb-leaflet-map.html +1 -1
- package/dist/demo/pb-login.html +0 -2
- package/dist/demo/pb-message.html +1 -2
- package/dist/demo/pb-progress.html +2 -2
- package/dist/demo/pb-repeat.html +1 -3
- package/dist/demo/pb-search.html +7 -4
- package/dist/demo/pb-search3.html +1 -1
- package/dist/demo/pb-search4.html +2 -2
- package/dist/demo/pb-view3.html +1 -1
- package/dist/{iron-form-3b8dcaa7.js → iron-form-dfb3e3b1.js} +95 -95
- package/dist/paper-checkbox-645e1077.js +200 -0
- package/dist/{paper-icon-button-b1d31571.js → paper-icon-button-984162bd.js} +1 -1
- package/dist/{paper-checkbox-515a5284.js → paper-inky-focus-behavior-fa16796b.js} +58 -247
- package/dist/{paper-listbox-a3b7175c.js → paper-listbox-5f5d1cec.js} +152 -162
- package/dist/pb-code-editor.js +25 -20
- package/dist/pb-component-docs.js +68 -64
- package/dist/pb-components-bundle.js +1983 -2293
- package/dist/pb-edit-app.js +167 -107
- package/dist/pb-elements.json +176 -120
- 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 +1023 -782
- package/dist/pb-tify.js +2 -2
- package/dist/vaadin-element-mixin-beb74ffd.js +545 -0
- package/gh-pages.js +5 -3
- package/i18n/common/en.json +6 -0
- package/i18n/common/pl.json +2 -2
- package/lib/openseadragon.min.js +6 -6
- package/package.json +3 -3
- package/pb-elements.json +176 -120
- 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 +50 -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 +158 -171
- package/src/pb-authority-lookup.js +191 -156
- 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 +211 -151
- package/src/pb-combo-box.js +190 -190
- package/src/pb-components-bundle.js +1 -1
- package/src/pb-components.js +1 -0
- package/src/pb-custom-form.js +173 -153
- package/src/pb-dialog.js +98 -62
- package/src/pb-document.js +89 -90
- package/src/pb-download.js +212 -196
- package/src/pb-drawer.js +145 -148
- package/src/pb-edit-app.js +301 -229
- package/src/pb-edit-xml.js +100 -97
- package/src/pb-events.js +114 -107
- package/src/pb-facs-link.js +104 -102
- package/src/pb-facsimile.js +474 -410
- 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 +142 -57
- package/src/pb-leaflet-map.js +488 -485
- package/src/pb-link.js +126 -124
- package/src/pb-load.js +431 -429
- package/src/pb-login.js +299 -244
- package/src/pb-manage-odds.js +352 -336
- 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 +139 -97
- package/src/pb-mixin.js +269 -264
- package/src/pb-navigation.js +80 -95
- package/src/pb-observable.js +38 -38
- package/src/pb-odd-editor.js +1054 -958
- package/src/pb-odd-elementspec-editor.js +349 -298
- package/src/pb-odd-model-editor.js +1075 -909
- package/src/pb-odd-parameter-editor.js +200 -178
- package/src/pb-odd-rendition-editor.js +136 -124
- package/src/pb-page.js +431 -422
- package/src/pb-paginate.js +228 -179
- package/src/pb-panel.js +198 -182
- package/src/pb-popover-themes.js +15 -8
- package/src/pb-popover.js +296 -287
- package/src/pb-print-preview.js +127 -127
- package/src/pb-progress.js +51 -51
- package/src/pb-repeat.js +105 -104
- package/src/pb-restricted.js +84 -77
- package/src/pb-search.js +256 -228
- 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 +382 -249
- package/src/pb-toggle-feature.js +195 -187
- package/src/pb-upload.js +184 -174
- package/src/pb-version.js +30 -30
- package/src/pb-view-annotate.js +135 -98
- package/src/pb-view.js +1282 -1270
- package/src/pb-zoom.js +127 -45
- 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 +98 -91
- package/src/urls.js +289 -289
- package/src/utils.js +53 -51
- package/css/pb-styles.css +0 -51
- package/dist/vaadin-element-mixin-fe4a4883.js +0 -527
- package/src/assets/pb-styles.css +0 -51
- package/src/pb-light-dom.js +0 -41
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { LitElement, html, css } from 'lit-element';
|
|
2
2
|
import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
|
|
3
|
+
import { themableMixin } from './theming.js';
|
|
3
4
|
import { pbMixin, waitOnce } from './pb-mixin.js';
|
|
4
|
-
import { translate } from
|
|
5
|
-
import { createConnectors } from
|
|
6
|
-
import
|
|
7
|
-
import '@polymer/paper-input/paper-input';
|
|
8
|
-
import '@polymer/paper-icon-button';
|
|
5
|
+
import { translate } from './pb-i18n.js';
|
|
6
|
+
import { createConnectors } from './authority/connectors.js';
|
|
7
|
+
import './pb-restricted.js';
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* Performs authority lookups via configurable connectors.
|
|
12
|
-
*
|
|
11
|
+
*
|
|
13
12
|
* @fires pb-authority-select - Fired when user selects an entry from the list
|
|
14
13
|
* @fires pb-authority-edit-entity - Fired when user clicks the edit button next to an entry
|
|
15
14
|
* @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
|
|
15
|
+
* @fires pb-authority-lookup - When received, starts a lookup using the passed in query string and
|
|
17
16
|
* authority type
|
|
18
17
|
*/
|
|
19
|
-
export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
18
|
+
export class PbAuthorityLookup extends themableMixin(pbMixin(LitElement)) {
|
|
20
19
|
static get properties() {
|
|
21
20
|
return {
|
|
22
21
|
/**
|
|
@@ -32,7 +31,7 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
32
31
|
*/
|
|
33
32
|
sortByLabel: {
|
|
34
33
|
type: Boolean,
|
|
35
|
-
attribute: 'sort-by-label'
|
|
34
|
+
attribute: 'sort-by-label',
|
|
36
35
|
},
|
|
37
36
|
/**
|
|
38
37
|
* A list of comma-separated stopwords which should be excluded
|
|
@@ -40,16 +39,16 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
40
39
|
* HTML text
|
|
41
40
|
*/
|
|
42
41
|
stopwords: {
|
|
43
|
-
type: String
|
|
42
|
+
type: String,
|
|
44
43
|
},
|
|
45
44
|
/**
|
|
46
45
|
* A list of space- or comma-separated group names, whose members will be
|
|
47
46
|
* allowed to add or edit entries in the local register (if enabled).
|
|
48
|
-
*
|
|
47
|
+
*
|
|
49
48
|
* @default "tei"
|
|
50
49
|
*/
|
|
51
50
|
group: {
|
|
52
|
-
type: String
|
|
51
|
+
type: String,
|
|
53
52
|
},
|
|
54
53
|
/**
|
|
55
54
|
* The authority type to use. Should correspond to a name defined for one of the connectors.
|
|
@@ -95,19 +94,21 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
95
94
|
|
|
96
95
|
this._stopwordSet = new Set();
|
|
97
96
|
if (this.stopwords) {
|
|
98
|
-
this.stopwords.split(/\s*,\s*/).forEach(
|
|
97
|
+
this.stopwords.split(/\s*,\s*/).forEach(sw => this._stopwordSet.add(sw.toLowerCase()));
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
this.subscribeTo('pb-authority-lookup', ev => {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
this.query = ev.detail.query;
|
|
102
|
+
this.type = ev.detail.type;
|
|
103
|
+
this._results = [];
|
|
104
|
+
this._query();
|
|
106
105
|
});
|
|
107
106
|
|
|
108
107
|
waitOnce('pb-page-ready', () => {
|
|
109
108
|
const connectors = createConnectors(this.getEndpoint(), this);
|
|
110
|
-
connectors.forEach(connector => {
|
|
109
|
+
connectors.forEach(connector => {
|
|
110
|
+
this._authorities[connector.register] = connector;
|
|
111
|
+
});
|
|
111
112
|
if (this.autoLookup) {
|
|
112
113
|
this._query();
|
|
113
114
|
}
|
|
@@ -118,23 +119,35 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
118
119
|
|
|
119
120
|
render() {
|
|
120
121
|
return html`
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
<
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
122
|
+
<header>
|
|
123
|
+
<input
|
|
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')}"
|
|
131
|
+
/>
|
|
132
|
+
${this._authorities[this.type] && this._authorities[this.type].editable
|
|
133
|
+
? html`
|
|
134
|
+
<pb-restricted group="${this.group}">
|
|
135
|
+
<button @click="${this._addEntity}" title="${translate('annotations.add-entity')}">
|
|
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>
|
|
146
|
+
</button>
|
|
147
|
+
</pb-restricted>
|
|
148
|
+
`
|
|
149
|
+
: null}
|
|
150
|
+
</header>
|
|
138
151
|
<slot name="authform"></slot>
|
|
139
152
|
<div id="output">
|
|
140
153
|
<ul part="output">
|
|
@@ -151,11 +164,16 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
151
164
|
return Promise.resolve();
|
|
152
165
|
}
|
|
153
166
|
const authority = this._authorities[register];
|
|
154
|
-
console.log(
|
|
167
|
+
console.log(
|
|
168
|
+
'<pb-authority-lookup> Retrieving info for %s from %s using %s',
|
|
169
|
+
id,
|
|
170
|
+
register,
|
|
171
|
+
authority.constructor.name,
|
|
172
|
+
);
|
|
155
173
|
let info = await authority.info(id, container);
|
|
156
174
|
if (info.strings) {
|
|
157
175
|
info = Object.assign(info, {
|
|
158
|
-
strings: info.strings.filter(
|
|
176
|
+
strings: info.strings.filter(s => s && !this._stopwordSet.has(s.toLowerCase())),
|
|
159
177
|
});
|
|
160
178
|
}
|
|
161
179
|
return info;
|
|
@@ -164,42 +182,133 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
164
182
|
_formatItem(item) {
|
|
165
183
|
return html`
|
|
166
184
|
<li>
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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}
|
|
179
231
|
</div>
|
|
180
|
-
|
|
181
|
-
${item.provider ? html`<div><span class="source" part="source">${item.provider}</span></div>` :null}
|
|
182
|
-
<div><span class="register" part="register">${item.register}</span></div>
|
|
183
|
-
|
|
184
|
-
${
|
|
185
|
-
this._authorities[this.type] && this._authorities[this.type].editable ?
|
|
186
|
-
html`
|
|
187
|
-
<pb-restricted group="${this.group}">
|
|
188
|
-
<div class="icons">
|
|
189
|
-
<paper-icon-button
|
|
190
|
-
icon="editor:mode-edit"
|
|
191
|
-
@click="${() => this._editEntity(item)}"
|
|
192
|
-
title="${translate('annotations.edit-entity')}"
|
|
193
|
-
></paper-icon-button>
|
|
194
|
-
</div>
|
|
195
|
-
</pb-restricted>` : null
|
|
196
|
-
}
|
|
232
|
+
</div>
|
|
197
233
|
${item.details ? html`<div class="details" part="details">${item.details}</div>` : null}
|
|
198
|
-
|
|
199
234
|
</li>
|
|
200
235
|
`;
|
|
201
236
|
}
|
|
202
237
|
|
|
238
|
+
static get styles() {
|
|
239
|
+
return css`
|
|
240
|
+
:host {
|
|
241
|
+
display: flex;
|
|
242
|
+
flex-direction: column;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
header {
|
|
246
|
+
display: flex;
|
|
247
|
+
justify-content: space-between;
|
|
248
|
+
align-items: center;
|
|
249
|
+
margin-bottom: 1rem;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
header > input {
|
|
253
|
+
flex-grow: 1;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.link {
|
|
257
|
+
flex-grow: 2;
|
|
258
|
+
}
|
|
259
|
+
|
|
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
|
+
}
|
|
271
|
+
|
|
272
|
+
#output > ul > li {
|
|
273
|
+
border-bottom: 1px solid var(--pb-color-border);
|
|
274
|
+
}
|
|
275
|
+
|
|
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
|
+
}
|
|
283
|
+
|
|
284
|
+
#output > ul > li > div > a {
|
|
285
|
+
flex-grow: 2;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.badges {
|
|
289
|
+
display: inline-flex;
|
|
290
|
+
gap: 0.125rem;
|
|
291
|
+
align-items: center;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.badge {
|
|
295
|
+
font-size: 0.75rem;
|
|
296
|
+
border-radius: 4px;
|
|
297
|
+
padding: 4px;
|
|
298
|
+
color: var(--pb-color-inverse);
|
|
299
|
+
}
|
|
300
|
+
|
|
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
|
+
}
|
|
310
|
+
`;
|
|
311
|
+
}
|
|
203
312
|
|
|
204
313
|
_select(item) {
|
|
205
314
|
const connector = this._authorities[item.register];
|
|
@@ -208,13 +317,13 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
208
317
|
type: item.register,
|
|
209
318
|
properties: {
|
|
210
319
|
ref: item.id,
|
|
211
|
-
}
|
|
320
|
+
},
|
|
212
321
|
};
|
|
213
322
|
if (connector) {
|
|
214
323
|
connector
|
|
215
324
|
.select(item)
|
|
216
325
|
.then(() => this.emitTo('pb-authority-select', options))
|
|
217
|
-
.catch(
|
|
326
|
+
.catch(e => this.emitTo('pb-authority-error', { status: e.message }));
|
|
218
327
|
} else {
|
|
219
328
|
this.emitTo('pb-authority-select', options);
|
|
220
329
|
}
|
|
@@ -225,24 +334,23 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
225
334
|
if (connector) {
|
|
226
335
|
connector
|
|
227
336
|
.select(item)
|
|
228
|
-
.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 }));
|
|
229
338
|
} else {
|
|
230
|
-
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 });
|
|
231
340
|
}
|
|
232
341
|
}
|
|
233
342
|
|
|
234
|
-
_queryChanged() {
|
|
343
|
+
_queryChanged(e) {
|
|
235
344
|
this._results = [];
|
|
236
|
-
|
|
237
|
-
|
|
345
|
+
this.query = e.target.value;
|
|
346
|
+
this._query();
|
|
238
347
|
}
|
|
239
348
|
|
|
240
349
|
_query() {
|
|
241
350
|
this.emitTo('pb-start-update');
|
|
242
351
|
this._authorities[this.type].query(this.query).then(results => {
|
|
243
|
-
this._occurrences(results.items)
|
|
244
|
-
.
|
|
245
|
-
this._results = merged;
|
|
352
|
+
this._occurrences(results.items).then(merged => {
|
|
353
|
+
this._results = merged;
|
|
246
354
|
});
|
|
247
355
|
this.emitTo('pb-end-update');
|
|
248
356
|
// this.shadowRoot.getElementById('query').focus();
|
|
@@ -250,7 +358,7 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
250
358
|
}
|
|
251
359
|
|
|
252
360
|
_addEntity() {
|
|
253
|
-
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 });
|
|
254
362
|
}
|
|
255
363
|
|
|
256
364
|
_occurrences(items) {
|
|
@@ -259,13 +367,13 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
259
367
|
}
|
|
260
368
|
const params = new FormData();
|
|
261
369
|
params.append('register', this.type);
|
|
262
|
-
items.forEach(
|
|
370
|
+
items.forEach(item => {
|
|
263
371
|
params.append('id', item.id);
|
|
264
372
|
});
|
|
265
|
-
return new Promise(
|
|
373
|
+
return new Promise(resolve => {
|
|
266
374
|
fetch(`${this.getEndpoint()}/api/annotations/occurrences`, {
|
|
267
375
|
method: 'POST',
|
|
268
|
-
body: params
|
|
376
|
+
body: params,
|
|
269
377
|
})
|
|
270
378
|
.then(response => {
|
|
271
379
|
if (response.ok) {
|
|
@@ -273,7 +381,7 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
273
381
|
}
|
|
274
382
|
})
|
|
275
383
|
.then(json => {
|
|
276
|
-
items.forEach(
|
|
384
|
+
items.forEach(item => {
|
|
277
385
|
if (json[item.id]) {
|
|
278
386
|
item.occurrences = json[item.id];
|
|
279
387
|
} else {
|
|
@@ -295,80 +403,7 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
295
403
|
});
|
|
296
404
|
resolve(items);
|
|
297
405
|
});
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
static get styles() {
|
|
302
|
-
return css`
|
|
303
|
-
:host {
|
|
304
|
-
display: flex;
|
|
305
|
-
flex-direction: column;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
header {
|
|
309
|
-
display: flex;
|
|
310
|
-
align-items: center;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
.link {
|
|
314
|
-
flex-grow: 2;
|
|
315
|
-
}
|
|
316
|
-
#output {
|
|
317
|
-
overflow: auto;
|
|
318
|
-
/*FireFox*/
|
|
319
|
-
scrollbar-width: none;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
/*
|
|
323
|
-
#output .icons{
|
|
324
|
-
visibility: hidden;
|
|
325
|
-
}
|
|
326
|
-
#output .icons:hover{
|
|
327
|
-
visibility: visible;
|
|
328
|
-
}
|
|
329
|
-
*/
|
|
330
|
-
|
|
331
|
-
#output ul {
|
|
332
|
-
width: 100%;
|
|
333
|
-
padding: 0;
|
|
334
|
-
list-style: none;
|
|
335
|
-
}
|
|
336
|
-
#output li {
|
|
337
|
-
display: flex;
|
|
338
|
-
justify-content: space-between;
|
|
339
|
-
flex-wrap: wrap;
|
|
340
|
-
align-items: center;
|
|
341
|
-
border-bottom: 1px solid #efefef;
|
|
342
|
-
}
|
|
343
|
-
#output li:hover{
|
|
344
|
-
background:#efefef;
|
|
345
|
-
}
|
|
346
|
-
#output td:nth-child(3), #output td:nth-child(4), #output td:nth-child(5) {
|
|
347
|
-
text-align: right;
|
|
348
|
-
vertical-align: middle;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
.details, .source, .register, .occurrences {
|
|
352
|
-
font-size: .85rem;
|
|
353
|
-
width: 100%;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
.source, .register, .occurrences {
|
|
357
|
-
border-radius: 4px;
|
|
358
|
-
padding: 4px;
|
|
359
|
-
color: var(--pb-color-inverse);
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
.source {
|
|
363
|
-
background-color: #637b8c;
|
|
364
|
-
}
|
|
365
|
-
.register {
|
|
366
|
-
background-color: var(--pb-color-lighter);
|
|
367
|
-
}
|
|
368
|
-
.occurrences {
|
|
369
|
-
background-color: var(--pb-color-focus);
|
|
370
|
-
}
|
|
371
|
-
`;
|
|
406
|
+
});
|
|
372
407
|
}
|
|
373
408
|
}
|
|
374
409
|
customElements.define('pb-authority-lookup', PbAuthorityLookup);
|