@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.
Files changed (128) 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 +8 -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-leaflet-map.html +1 -1
  9. package/dist/demo/pb-repeat.html +1 -3
  10. package/dist/demo/pb-view3.html +1 -1
  11. package/dist/{paper-icon-button-0fb125c4.js → paper-icon-button-72125e67.js} +1 -1
  12. package/dist/pb-code-editor.js +25 -20
  13. package/dist/pb-component-docs.js +58 -54
  14. package/dist/pb-components-bundle.js +1827 -1520
  15. package/dist/pb-edit-app.js +167 -107
  16. package/dist/pb-elements.json +54 -54
  17. package/dist/{pb-i18n-0611135a.js → pb-i18n-4cc00bfe.js} +1 -1
  18. package/dist/pb-leaflet-map.js +23 -23
  19. package/dist/pb-mei.js +56 -41
  20. package/dist/{pb-mixin-b1caa22e.js → pb-mixin-886ece32.js} +1 -1
  21. package/dist/pb-odd-editor.js +925 -758
  22. package/dist/pb-tify.js +2 -2
  23. package/dist/{vaadin-element-mixin-859a0132.js → vaadin-element-mixin-ad07ba25.js} +88 -61
  24. package/gh-pages.js +5 -3
  25. package/package.json +2 -2
  26. package/pb-elements.json +54 -54
  27. package/src/assets/components.css +5 -5
  28. package/src/authority/airtable.js +20 -21
  29. package/src/authority/anton.js +129 -129
  30. package/src/authority/custom.js +23 -21
  31. package/src/authority/geonames.js +38 -32
  32. package/src/authority/gnd.js +47 -42
  33. package/src/authority/kbga.js +137 -134
  34. package/src/authority/metagrid.js +44 -46
  35. package/src/authority/reconciliation.js +66 -67
  36. package/src/authority/registry.js +4 -4
  37. package/src/docs/pb-component-docs.js +2 -2
  38. package/src/docs/pb-component-view.js +5 -5
  39. package/src/docs/pb-components-list.js +2 -2
  40. package/src/docs/pb-demo-snippet.js +2 -2
  41. package/src/dts-client.js +299 -297
  42. package/src/dts-select-endpoint.js +90 -82
  43. package/src/parse-date-service.js +184 -135
  44. package/src/pb-ajax.js +171 -167
  45. package/src/pb-authority-lookup.js +96 -81
  46. package/src/pb-autocomplete.js +292 -280
  47. package/src/pb-blacklab-highlight.js +264 -259
  48. package/src/pb-blacklab-results.js +236 -221
  49. package/src/pb-browse-docs.js +540 -475
  50. package/src/pb-browse.js +68 -65
  51. package/src/pb-clipboard.js +79 -76
  52. package/src/pb-code-editor.js +110 -102
  53. package/src/pb-code-highlight.js +209 -204
  54. package/src/pb-codepen.js +79 -72
  55. package/src/pb-collapse.js +149 -146
  56. package/src/pb-combo-box.js +190 -190
  57. package/src/pb-components-bundle.js +1 -1
  58. package/src/pb-custom-form.js +150 -149
  59. package/src/pb-document.js +89 -90
  60. package/src/pb-download.js +208 -195
  61. package/src/pb-drawer.js +145 -148
  62. package/src/pb-edit-app.js +301 -229
  63. package/src/pb-edit-xml.js +99 -96
  64. package/src/pb-events.js +114 -107
  65. package/src/pb-facs-link.js +104 -102
  66. package/src/pb-facsimile.js +411 -413
  67. package/src/pb-formula.js +151 -153
  68. package/src/pb-geolocation.js +129 -131
  69. package/src/pb-grid-action.js +53 -56
  70. package/src/pb-grid.js +231 -228
  71. package/src/pb-highlight.js +140 -140
  72. package/src/pb-hotkeys.js +40 -42
  73. package/src/pb-i18n.js +101 -104
  74. package/src/pb-image-strip.js +84 -78
  75. package/src/pb-lang.js +83 -70
  76. package/src/pb-leaflet-map.js +488 -485
  77. package/src/pb-link.js +126 -124
  78. package/src/pb-load.js +431 -426
  79. package/src/pb-login.js +275 -254
  80. package/src/pb-manage-odds.js +364 -318
  81. package/src/pb-map-icon.js +89 -89
  82. package/src/pb-map-layer.js +85 -85
  83. package/src/pb-markdown.js +90 -99
  84. package/src/pb-media-query.js +74 -72
  85. package/src/pb-mei.js +306 -295
  86. package/src/pb-message.js +143 -130
  87. package/src/pb-mixin.js +269 -264
  88. package/src/pb-navigation.js +80 -82
  89. package/src/pb-observable.js +38 -38
  90. package/src/pb-odd-editor.js +1056 -958
  91. package/src/pb-odd-elementspec-editor.js +348 -297
  92. package/src/pb-odd-model-editor.js +1058 -898
  93. package/src/pb-odd-parameter-editor.js +200 -178
  94. package/src/pb-odd-rendition-editor.js +136 -124
  95. package/src/pb-page.js +432 -422
  96. package/src/pb-paginate.js +202 -190
  97. package/src/pb-panel.js +191 -179
  98. package/src/pb-popover-themes.js +7 -5
  99. package/src/pb-popover.js +296 -287
  100. package/src/pb-print-preview.js +127 -127
  101. package/src/pb-progress.js +49 -49
  102. package/src/pb-repeat.js +105 -104
  103. package/src/pb-restricted.js +84 -77
  104. package/src/pb-search.js +238 -221
  105. package/src/pb-select-feature.js +127 -120
  106. package/src/pb-select-odd.js +132 -124
  107. package/src/pb-select-template.js +89 -78
  108. package/src/pb-select.js +251 -227
  109. package/src/pb-split-list.js +179 -174
  110. package/src/pb-svg.js +80 -79
  111. package/src/pb-table-column.js +54 -54
  112. package/src/pb-table-grid.js +221 -203
  113. package/src/pb-tabs.js +61 -63
  114. package/src/pb-tify.js +154 -154
  115. package/src/pb-timeline.js +271 -229
  116. package/src/pb-toggle-feature.js +198 -185
  117. package/src/pb-upload.js +184 -174
  118. package/src/pb-version.js +30 -30
  119. package/src/pb-view-annotate.js +132 -98
  120. package/src/pb-view.js +1282 -1263
  121. package/src/pb-zoom.js +40 -40
  122. package/src/polymer-hack.js +1 -1
  123. package/src/search-result-service.js +256 -223
  124. package/src/seed-element.js +13 -20
  125. package/src/settings.js +4 -4
  126. package/src/theming.js +91 -91
  127. package/src/urls.js +289 -289
  128. package/src/utils.js +53 -51
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
- 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
- }
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
- constructor() {
58
- super();
59
- this._parentCollections = [];
60
- this.collection = 'default';
61
- }
57
+ constructor() {
58
+ super();
59
+ this._parentCollections = [];
60
+ this.collection = 'default';
61
+ }
62
62
 
63
- connectedCallback() {
64
- super.connectedCallback();
63
+ connectedCallback() {
64
+ super.connectedCallback();
65
65
 
66
- this.collection = registry.state.id;
67
- this.page = registry.state.page;
66
+ this.collection = registry.state.id;
67
+ this.page = registry.state.page;
68
68
 
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
- }
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
- firstUpdated() {
80
- super.firstUpdated();
79
+ firstUpdated() {
80
+ super.firstUpdated();
81
81
 
82
- this.queryAPI = this.shadowRoot.getElementById('queryAPI');
83
- this.documentsAPI = this.shadowRoot.getElementById('documentsAPI');
84
- this.signalReady();
85
- }
82
+ this.queryAPI = this.shadowRoot.getElementById('queryAPI');
83
+ this.documentsAPI = this.shadowRoot.getElementById('documentsAPI');
84
+ this.signalReady();
85
+ }
86
86
 
87
- _setEndpoint(endpoint, collection, reload) {
88
- if (!reload) {
89
- this.page = null;
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
- _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();
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
- _navigate(ev, member, downwards = true) {
106
- ev.preventDefault();
107
- if (downwards) {
108
- this._parentCollections.push(this.collection);
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
- _navigateUp(ev) {
117
- if (this._parentCollections.length === 0) {
118
- return;
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
- _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
- };
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
- _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
- };
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
- _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;
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
- _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);
177
+ this.queryAPI.params = newState;
178
+ this.queryAPI.url = this._collectionEndpoint;
179
+ this.queryAPI.generateRequest();
180
+ }
187
181
 
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
- });
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
- _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);
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
- _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');
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
- 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;
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
- static _getCreator(item) {
229
- const dc = item['dts:dublincore'];
230
- return dc ? dc['dc:creator'] : null;
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
- static _getLicense(item) {
234
- const dc = item['dts:dublincore'];
235
- return dc ? dc['dc:license'] : null;
236
- }
228
+ static _getCreator(item) {
229
+ const dc = item['dts:dublincore'];
230
+ return dc ? dc['dc:creator'] : null;
231
+ }
237
232
 
238
- render() {
239
- return html`
240
- <slot name="toolbar"></slot>
241
- ${this.baseUri ? this._renderClient() : ''}
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
- _renderClient() {
261
- return html`
262
- <div class="uri">${this.baseUri}</div>
263
- <h3 part="collection-title">${this.data ? this.data.title : 'Loading ...'}</h3>
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
- _renderMembers() {
279
- const members = [];
280
- this.data.member.forEach((member) => {
281
- members.push(html`<div class="member">${this._renderMember(member)}</div>`);
282
- });
283
- return members;
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
- _renderMember(member) {
287
- if (member['@type'] === 'Collection') {
288
- return html`
289
- <iron-icon icon="icons:folder-open"></iron-icon>
290
- <div class="details">
291
- <a href="#" @click="${(ev) => this._navigate(ev, member)}" part="link">
292
- <h4 class="collection" part="collection-title">
293
- ${member.title}
294
- </h4>
295
- </a>
296
- </div>
297
- `;
298
- }
299
- const license = DtsClient._getLicense(member);
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
- static get styles() {
320
- return css`
321
- :host {
322
- display: block;
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
- .uri {
326
- color: #607d8a;
327
- margin-top: 12px;
328
- font-weight: bold;
329
- }
330
- h3 {
331
- margin-top: 0;
332
- }
333
- .member {
334
- display: flex;
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);