@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
package/src/dts-client.js
CHANGED
|
@@ -11,351 +11,353 @@ import '@polymer/paper-button';
|
|
|
11
11
|
/**
|
|
12
12
|
* A client for the Distributed Text Services (DTS) protocol. This defines an API
|
|
13
13
|
* for working with collections of text.
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
*
|
|
15
|
+
*
|
|
16
16
|
* @slot toolbar - toolbar area
|
|
17
17
|
* @slot pagination - pagination area
|
|
18
|
-
*
|
|
18
|
+
*
|
|
19
19
|
* @csspart parent-link - Link to parent collection
|
|
20
20
|
* @csspart collection-title - Collection title
|
|
21
21
|
* @csspart title - Member title
|
|
22
22
|
* @csspart author - Author
|
|
23
23
|
* @csspart license - License information
|
|
24
24
|
* @csspart link - Links
|
|
25
|
-
*
|
|
25
|
+
*
|
|
26
26
|
* @fires pb-start-update - Fired before the element updates its content
|
|
27
27
|
* @fires pb-results-received - Fired when results are received from the server
|
|
28
28
|
* @fires pb-end-update - Fired after the element has finished updating its content
|
|
29
29
|
* @fires dts-endpoint - When received sets the endpoint to the one passed in from the event
|
|
30
|
-
* @fires pb-load - When received triggers the refresh accorting to the selected page
|
|
30
|
+
* @fires pb-load - When received triggers the refresh accorting to the selected page
|
|
31
31
|
*/
|
|
32
32
|
export class DtsClient extends pbMixin(LitElement) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
33
|
+
static get properties() {
|
|
34
|
+
return {
|
|
35
|
+
...super.properties,
|
|
36
|
+
baseUri: {
|
|
37
|
+
type: String,
|
|
38
|
+
},
|
|
39
|
+
data: {
|
|
40
|
+
type: Object,
|
|
41
|
+
},
|
|
42
|
+
collection: {
|
|
43
|
+
type: String,
|
|
44
|
+
},
|
|
45
|
+
page: {
|
|
46
|
+
type: Number,
|
|
47
|
+
},
|
|
48
|
+
perPage: {
|
|
49
|
+
type: Number,
|
|
50
|
+
},
|
|
51
|
+
_collectionEndpoint: {
|
|
52
|
+
type: String,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
constructor() {
|
|
58
|
+
super();
|
|
59
|
+
this._parentCollections = [];
|
|
60
|
+
this.collection = 'default';
|
|
61
|
+
}
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
connectedCallback() {
|
|
64
|
+
super.connectedCallback();
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
this.collection = registry.state.id;
|
|
67
|
+
this.page = registry.state.page;
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
this.subscribeTo('dts-endpoint', ev => {
|
|
70
|
+
this._setEndpoint(ev.detail.endpoint, ev.detail.collection, ev.detail.reload);
|
|
71
|
+
});
|
|
72
|
+
this.subscribeTo('pb-load', ev => {
|
|
73
|
+
this.page = ev.detail.params.page;
|
|
74
|
+
console.log('<dts-client> Loading page %d', this.page);
|
|
75
|
+
this._update();
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
firstUpdated() {
|
|
80
|
+
super.firstUpdated();
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
this.queryAPI = this.shadowRoot.getElementById('queryAPI');
|
|
83
|
+
this.documentsAPI = this.shadowRoot.getElementById('documentsAPI');
|
|
84
|
+
this.signalReady();
|
|
85
|
+
}
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
this.collection = collection;
|
|
92
|
-
this._configureEndpoint(endpoint);
|
|
93
|
-
this.baseUri = endpoint;
|
|
87
|
+
_setEndpoint(endpoint, collection, reload) {
|
|
88
|
+
if (!reload) {
|
|
89
|
+
this.page = null;
|
|
94
90
|
}
|
|
91
|
+
this.collection = collection;
|
|
92
|
+
this._configureEndpoint(endpoint);
|
|
93
|
+
this.baseUri = endpoint;
|
|
94
|
+
}
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
96
|
+
_configureEndpoint(newBaseUri) {
|
|
97
|
+
if (newBaseUri) {
|
|
98
|
+
console.log('<dts-client> initializing connection to endpoint %s', newBaseUri);
|
|
99
|
+
this.emitTo('pb-start-update');
|
|
100
|
+
this.queryAPI.url = newBaseUri;
|
|
101
|
+
this.queryAPI.generateRequest();
|
|
103
102
|
}
|
|
103
|
+
}
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
this.collection = member && typeof member === 'object' ? member['@id'] : member;
|
|
111
|
-
this.page = null;
|
|
112
|
-
console.log('<dts-client> navigating to collection %s', this.collection);
|
|
113
|
-
this._update();
|
|
105
|
+
_navigate(ev, member, downwards = true) {
|
|
106
|
+
ev.preventDefault();
|
|
107
|
+
if (downwards) {
|
|
108
|
+
this._parentCollections.push(this.collection);
|
|
114
109
|
}
|
|
110
|
+
this.collection = member && typeof member === 'object' ? member['@id'] : member;
|
|
111
|
+
this.page = null;
|
|
112
|
+
console.log('<dts-client> navigating to collection %s', this.collection);
|
|
113
|
+
this._update();
|
|
114
|
+
}
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
this._navigate(ev, this._parentCollections.pop(), false);
|
|
116
|
+
_navigateUp(ev) {
|
|
117
|
+
if (this._parentCollections.length === 0) {
|
|
118
|
+
return;
|
|
121
119
|
}
|
|
120
|
+
this._navigate(ev, this._parentCollections.pop(), false);
|
|
121
|
+
}
|
|
122
122
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
this.documentsAPI.generateRequest();
|
|
123
|
+
_preview(ev, member) {
|
|
124
|
+
ev.preventDefault();
|
|
125
|
+
this.emitTo('pb-start-update');
|
|
126
|
+
const path = member['dts:passage'] || member['dts:download'];
|
|
127
|
+
const url = new URL(path, this.baseUri).toString();
|
|
128
|
+
console.log('<dts-client> downloading %s', url);
|
|
129
|
+
if (this.lessThanApiVersion('1.0.0')) {
|
|
130
|
+
this.documentsAPI.url = `${this.getEndpoint()}/modules/lib/dts.xql`;
|
|
131
|
+
this.documentsAPI.params = {
|
|
132
|
+
preview: url,
|
|
133
|
+
id: member['@id'],
|
|
134
|
+
};
|
|
135
|
+
} else {
|
|
136
|
+
this.documentsAPI.url = `${this.getEndpoint()}/api/dts/import`;
|
|
137
|
+
this.documentsAPI.params = {
|
|
138
|
+
uri: url,
|
|
139
|
+
temp: true,
|
|
140
|
+
};
|
|
143
141
|
}
|
|
142
|
+
this.documentsAPI.generateRequest();
|
|
143
|
+
}
|
|
144
144
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
this.documentsAPI.generateRequest();
|
|
145
|
+
_download(ev, member) {
|
|
146
|
+
this.emitTo('pb-start-update');
|
|
147
|
+
const path = member['dts:passage'] || member['dts:download'];
|
|
148
|
+
const url = new URL(path, this.baseUri).toString();
|
|
149
|
+
console.log('<dts-client> importing %s', url);
|
|
150
|
+
if (this.lessThanApiVersion('1.0.0')) {
|
|
151
|
+
this.documentsAPI.url = `${this.getEndpoint()}/modules/lib/dts.xql`;
|
|
152
|
+
this.documentsAPI.params = {
|
|
153
|
+
import: url,
|
|
154
|
+
id: member['@id'],
|
|
155
|
+
};
|
|
156
|
+
} else {
|
|
157
|
+
this.documentsAPI.url = `${this.getEndpoint()}/api/dts/import`;
|
|
158
|
+
this.documentsAPI.params = {
|
|
159
|
+
uri: url,
|
|
160
|
+
temp: false,
|
|
161
|
+
};
|
|
164
162
|
}
|
|
163
|
+
this.documentsAPI.generateRequest();
|
|
164
|
+
}
|
|
165
165
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
registry.commit(this, newState);
|
|
176
|
-
|
|
177
|
-
this.queryAPI.params = newState;
|
|
178
|
-
this.queryAPI.url = this._collectionEndpoint;
|
|
179
|
-
this.queryAPI.generateRequest();
|
|
166
|
+
_update() {
|
|
167
|
+
this.emitTo('pb-start-update');
|
|
168
|
+
const newState = {};
|
|
169
|
+
if (this.collection) {
|
|
170
|
+
newState.id = this.collection;
|
|
171
|
+
}
|
|
172
|
+
if (this.page) {
|
|
173
|
+
newState.page = this.page + 1;
|
|
180
174
|
}
|
|
175
|
+
registry.commit(this, newState);
|
|
181
176
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
console.log('<dts-client> configured collection endpoint: %s', this._collectionEndpoint);
|
|
177
|
+
this.queryAPI.params = newState;
|
|
178
|
+
this.queryAPI.url = this._collectionEndpoint;
|
|
179
|
+
this.queryAPI.generateRequest();
|
|
180
|
+
}
|
|
187
181
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
this.perPage = json.member.length;
|
|
194
|
-
}
|
|
195
|
-
this.emitTo('pb-results-received', {
|
|
196
|
-
start: this.page && this.page > 0 ? this.page * this.perPage + 1 : 1,
|
|
197
|
-
count: json.totalItems
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
this.emitTo('pb-end-update');
|
|
201
|
-
}
|
|
182
|
+
_handleResponse() {
|
|
183
|
+
const json = this.queryAPI.lastResponse;
|
|
184
|
+
if (json['@type'] === 'EntryPoint') {
|
|
185
|
+
this._collectionEndpoint = new URL(json.collections, this.baseUri).toString();
|
|
186
|
+
console.log('<dts-client> configured collection endpoint: %s', this._collectionEndpoint);
|
|
202
187
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
188
|
+
this._update();
|
|
189
|
+
} else {
|
|
190
|
+
this.data = json;
|
|
191
|
+
console.log('<dts-client> received collection data: %o', json);
|
|
192
|
+
if (!this.page && json.totalItems > json.member.length) {
|
|
193
|
+
this.perPage = json.member.length;
|
|
194
|
+
}
|
|
195
|
+
this.emitTo('pb-results-received', {
|
|
196
|
+
start: this.page && this.page > 0 ? this.page * this.perPage + 1 : 1,
|
|
197
|
+
count: json.totalItems,
|
|
198
|
+
});
|
|
209
199
|
}
|
|
200
|
+
this.emitTo('pb-end-update');
|
|
201
|
+
}
|
|
210
202
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
203
|
+
_handlePreview() {
|
|
204
|
+
const json = this.documentsAPI.lastResponse;
|
|
205
|
+
this.emitTo('pb-end-update');
|
|
206
|
+
const url = new URL(json.path, window.location.href);
|
|
207
|
+
// use registry here?
|
|
208
|
+
window.location.replace(url);
|
|
209
|
+
}
|
|
217
210
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
dialog.open();
|
|
226
|
-
}
|
|
211
|
+
_handleError(ev) {
|
|
212
|
+
this.emitTo('pb-end-update');
|
|
213
|
+
const msg = ev.target.lastError.response;
|
|
214
|
+
const parser = new DOMParser();
|
|
215
|
+
const doc = parser.parseFromString(msg, 'application/xml');
|
|
216
|
+
const node = doc.querySelector('message');
|
|
227
217
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
218
|
+
const dialog = document.getElementById('errorDialog');
|
|
219
|
+
const body = dialog.querySelector('paper-dialog-scrollable');
|
|
220
|
+
if (node) {
|
|
221
|
+
body.innerHTML = node.textContent;
|
|
222
|
+
} else {
|
|
223
|
+
body.innerHTML = ev.detail.error.message;
|
|
231
224
|
}
|
|
225
|
+
dialog.open();
|
|
226
|
+
}
|
|
232
227
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
228
|
+
static _getCreator(item) {
|
|
229
|
+
const dc = item['dts:dublincore'];
|
|
230
|
+
return dc ? dc['dc:creator'] : null;
|
|
231
|
+
}
|
|
237
232
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
<iron-ajax
|
|
244
|
-
id="queryAPI"
|
|
245
|
-
verbose
|
|
246
|
-
handle-as="json"
|
|
247
|
-
method="get"
|
|
248
|
-
@response="${this._handleResponse}"
|
|
249
|
-
@error="${this._handleError}"></iron-ajax>
|
|
250
|
-
<iron-ajax
|
|
251
|
-
id="documentsAPI"
|
|
252
|
-
verbose
|
|
253
|
-
handle-as="json"
|
|
254
|
-
method="get"
|
|
255
|
-
@response="${this._handlePreview}"
|
|
256
|
-
@error="${this._handleError}"></iron-ajax>
|
|
257
|
-
`;
|
|
258
|
-
}
|
|
233
|
+
static _getLicense(item) {
|
|
234
|
+
const dc = item['dts:dublincore'];
|
|
235
|
+
return dc ? dc['dc:license'] : null;
|
|
236
|
+
}
|
|
259
237
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
<slot name="pagination"></slot>
|
|
265
|
-
${
|
|
266
|
-
this._parentCollections.length > 0 || this.collection ?
|
|
267
|
-
html`
|
|
268
|
-
<paper-button part="parent-link" @click="${this._navigateUp}">
|
|
269
|
-
<iron-icon icon="icons:arrow-upward"></iron-icon>
|
|
270
|
-
${translate('browse.up')}
|
|
271
|
-
</paper-button>`
|
|
272
|
-
: null
|
|
273
|
-
}
|
|
274
|
-
${this.data ? this._renderMembers() : ''}
|
|
275
|
-
`;
|
|
276
|
-
}
|
|
238
|
+
render() {
|
|
239
|
+
return html`
|
|
240
|
+
<slot name="toolbar"></slot>
|
|
241
|
+
${this.baseUri ? this._renderClient() : ''}
|
|
277
242
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
243
|
+
<iron-ajax
|
|
244
|
+
id="queryAPI"
|
|
245
|
+
verbose
|
|
246
|
+
handle-as="json"
|
|
247
|
+
method="get"
|
|
248
|
+
@response="${this._handleResponse}"
|
|
249
|
+
@error="${this._handleError}"
|
|
250
|
+
></iron-ajax>
|
|
251
|
+
<iron-ajax
|
|
252
|
+
id="documentsAPI"
|
|
253
|
+
verbose
|
|
254
|
+
handle-as="json"
|
|
255
|
+
method="get"
|
|
256
|
+
@response="${this._handlePreview}"
|
|
257
|
+
@error="${this._handleError}"
|
|
258
|
+
></iron-ajax>
|
|
259
|
+
`;
|
|
260
|
+
}
|
|
285
261
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
return html`
|
|
301
|
-
<iron-icon icon="icons:code"></iron-icon>
|
|
302
|
-
<div class="details">
|
|
303
|
-
<div>
|
|
304
|
-
<a href="#" @click="${(ev) => this._preview(ev, member)}" part="link">
|
|
305
|
-
<h4 part="title">
|
|
306
|
-
${member.title}
|
|
307
|
-
</h4>
|
|
308
|
-
</a>
|
|
309
|
-
<p part="creator" class="creator">${DtsClient._getCreator(member)}</p>
|
|
310
|
-
${license ? html`<p part="license" class="license"><a href="${license}">${translate('dts.licence')}</a></p>` : ''}
|
|
311
|
-
</div>
|
|
312
|
-
<iron-icon title="${translate('dts.import')}" icon="icons:file-download"
|
|
313
|
-
@click="${(ev) => this._download(ev, member)}">
|
|
314
|
-
</iron-icon>
|
|
315
|
-
</div>
|
|
316
|
-
`;
|
|
317
|
-
}
|
|
262
|
+
_renderClient() {
|
|
263
|
+
return html`
|
|
264
|
+
<div class="uri">${this.baseUri}</div>
|
|
265
|
+
<h3 part="collection-title">${this.data ? this.data.title : 'Loading ...'}</h3>
|
|
266
|
+
<slot name="pagination"></slot>
|
|
267
|
+
${this._parentCollections.length > 0 || this.collection
|
|
268
|
+
? html` <paper-button part="parent-link" @click="${this._navigateUp}">
|
|
269
|
+
<iron-icon icon="icons:arrow-upward"></iron-icon>
|
|
270
|
+
${translate('browse.up')}
|
|
271
|
+
</paper-button>`
|
|
272
|
+
: null}
|
|
273
|
+
${this.data ? this._renderMembers() : ''}
|
|
274
|
+
`;
|
|
275
|
+
}
|
|
318
276
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
277
|
+
_renderMembers() {
|
|
278
|
+
const members = [];
|
|
279
|
+
this.data.member.forEach(member => {
|
|
280
|
+
members.push(html`<div class="member">${this._renderMember(member)}</div>`);
|
|
281
|
+
});
|
|
282
|
+
return members;
|
|
283
|
+
}
|
|
324
284
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
}
|
|
336
|
-
.member .details {
|
|
337
|
-
flex: 2;
|
|
338
|
-
margin-left: 20px;
|
|
339
|
-
display: flex;
|
|
340
|
-
justify-content: space-between;
|
|
341
|
-
}
|
|
342
|
-
.member iron-icon {
|
|
343
|
-
width: 24px;
|
|
344
|
-
}
|
|
345
|
-
.member h4 {
|
|
346
|
-
margin: 0;
|
|
347
|
-
}
|
|
348
|
-
.member h4.collection {
|
|
349
|
-
margin-bottom: 10px;
|
|
350
|
-
}
|
|
351
|
-
[name='toolbar'] {
|
|
352
|
-
display: flex;
|
|
353
|
-
justify-content: space-between;
|
|
354
|
-
align-items: center;
|
|
355
|
-
color: #f6a622;
|
|
356
|
-
font-size: 85%;
|
|
357
|
-
}
|
|
358
|
-
`;
|
|
285
|
+
_renderMember(member) {
|
|
286
|
+
if (member['@type'] === 'Collection') {
|
|
287
|
+
return html`
|
|
288
|
+
<iron-icon icon="icons:folder-open"></iron-icon>
|
|
289
|
+
<div class="details">
|
|
290
|
+
<a href="#" @click="${ev => this._navigate(ev, member)}" part="link">
|
|
291
|
+
<h4 class="collection" part="collection-title">${member.title}</h4>
|
|
292
|
+
</a>
|
|
293
|
+
</div>
|
|
294
|
+
`;
|
|
359
295
|
}
|
|
296
|
+
const license = DtsClient._getLicense(member);
|
|
297
|
+
return html`
|
|
298
|
+
<iron-icon icon="icons:code"></iron-icon>
|
|
299
|
+
<div class="details">
|
|
300
|
+
<div>
|
|
301
|
+
<a href="#" @click="${ev => this._preview(ev, member)}" part="link">
|
|
302
|
+
<h4 part="title">${member.title}</h4>
|
|
303
|
+
</a>
|
|
304
|
+
<p part="creator" class="creator">${DtsClient._getCreator(member)}</p>
|
|
305
|
+
${license
|
|
306
|
+
? html`<p part="license" class="license">
|
|
307
|
+
<a href="${license}">${translate('dts.licence')}</a>
|
|
308
|
+
</p>`
|
|
309
|
+
: ''}
|
|
310
|
+
</div>
|
|
311
|
+
<iron-icon
|
|
312
|
+
title="${translate('dts.import')}"
|
|
313
|
+
icon="icons:file-download"
|
|
314
|
+
@click="${ev => this._download(ev, member)}"
|
|
315
|
+
>
|
|
316
|
+
</iron-icon>
|
|
317
|
+
</div>
|
|
318
|
+
`;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
static get styles() {
|
|
322
|
+
return css`
|
|
323
|
+
:host {
|
|
324
|
+
display: block;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.uri {
|
|
328
|
+
color: #607d8a;
|
|
329
|
+
margin-top: 12px;
|
|
330
|
+
font-weight: bold;
|
|
331
|
+
}
|
|
332
|
+
h3 {
|
|
333
|
+
margin-top: 0;
|
|
334
|
+
}
|
|
335
|
+
.member {
|
|
336
|
+
display: flex;
|
|
337
|
+
}
|
|
338
|
+
.member .details {
|
|
339
|
+
flex: 2;
|
|
340
|
+
margin-left: 20px;
|
|
341
|
+
display: flex;
|
|
342
|
+
justify-content: space-between;
|
|
343
|
+
}
|
|
344
|
+
.member iron-icon {
|
|
345
|
+
width: 24px;
|
|
346
|
+
}
|
|
347
|
+
.member h4 {
|
|
348
|
+
margin: 0;
|
|
349
|
+
}
|
|
350
|
+
.member h4.collection {
|
|
351
|
+
margin-bottom: 10px;
|
|
352
|
+
}
|
|
353
|
+
[name='toolbar'] {
|
|
354
|
+
display: flex;
|
|
355
|
+
justify-content: space-between;
|
|
356
|
+
align-items: center;
|
|
357
|
+
color: #f6a622;
|
|
358
|
+
font-size: 85%;
|
|
359
|
+
}
|
|
360
|
+
`;
|
|
361
|
+
}
|
|
360
362
|
}
|
|
361
|
-
customElements.define('dts-client', DtsClient);
|
|
363
|
+
customElements.define('dts-client', DtsClient);
|