@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.
Files changed (154) 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 +4 -4
  4. package/.releaserc.json +2 -2
  5. package/CHANGELOG.md +262 -11
  6. package/Dockerfile +78 -70
  7. package/css/components.css +5 -5
  8. package/css/leaflet/images/layers.png +0 -0
  9. package/dist/demo/components.css +46 -1
  10. package/dist/demo/pb-browse-docs2.html +1 -1
  11. package/dist/demo/pb-dialog.html +3 -5
  12. package/dist/demo/pb-drawer2.html +1 -1
  13. package/dist/demo/pb-facsimile.html +2 -2
  14. package/dist/demo/pb-grid.html +19 -6
  15. package/dist/demo/pb-leaflet-map.html +1 -1
  16. package/dist/demo/pb-login.html +0 -2
  17. package/dist/demo/pb-message.html +1 -2
  18. package/dist/demo/pb-progress.html +2 -2
  19. package/dist/demo/pb-repeat.html +1 -3
  20. package/dist/demo/pb-search.html +7 -4
  21. package/dist/demo/pb-search3.html +1 -1
  22. package/dist/demo/pb-search4.html +2 -2
  23. package/dist/demo/pb-view3.html +1 -1
  24. package/dist/{iron-form-3b8dcaa7.js → iron-form-dfb3e3b1.js} +95 -95
  25. package/dist/paper-checkbox-645e1077.js +200 -0
  26. package/dist/{paper-icon-button-b1d31571.js → paper-icon-button-984162bd.js} +1 -1
  27. package/dist/{paper-checkbox-515a5284.js → paper-inky-focus-behavior-fa16796b.js} +58 -247
  28. package/dist/{paper-listbox-a3b7175c.js → paper-listbox-5f5d1cec.js} +152 -162
  29. package/dist/pb-code-editor.js +25 -20
  30. package/dist/pb-component-docs.js +68 -64
  31. package/dist/pb-components-bundle.js +1983 -2293
  32. package/dist/pb-edit-app.js +167 -107
  33. package/dist/pb-elements.json +176 -120
  34. package/dist/{pb-i18n-0611135a.js → pb-i18n-4cc00bfe.js} +1 -1
  35. package/dist/pb-leaflet-map.js +23 -23
  36. package/dist/pb-mei.js +56 -41
  37. package/dist/{pb-mixin-b1caa22e.js → pb-mixin-886ece32.js} +1 -1
  38. package/dist/pb-odd-editor.js +1023 -782
  39. package/dist/pb-tify.js +2 -2
  40. package/dist/vaadin-element-mixin-beb74ffd.js +545 -0
  41. package/gh-pages.js +5 -3
  42. package/i18n/common/en.json +6 -0
  43. package/i18n/common/pl.json +2 -2
  44. package/lib/openseadragon.min.js +6 -6
  45. package/package.json +3 -3
  46. package/pb-elements.json +176 -120
  47. package/src/assets/components.css +5 -5
  48. package/src/authority/airtable.js +20 -21
  49. package/src/authority/anton.js +129 -129
  50. package/src/authority/custom.js +23 -21
  51. package/src/authority/geonames.js +38 -32
  52. package/src/authority/gnd.js +50 -42
  53. package/src/authority/kbga.js +137 -134
  54. package/src/authority/metagrid.js +44 -46
  55. package/src/authority/reconciliation.js +66 -67
  56. package/src/authority/registry.js +4 -4
  57. package/src/docs/pb-component-docs.js +2 -2
  58. package/src/docs/pb-component-view.js +5 -5
  59. package/src/docs/pb-components-list.js +2 -2
  60. package/src/docs/pb-demo-snippet.js +2 -2
  61. package/src/dts-client.js +299 -297
  62. package/src/dts-select-endpoint.js +90 -82
  63. package/src/parse-date-service.js +184 -135
  64. package/src/pb-ajax.js +158 -171
  65. package/src/pb-authority-lookup.js +191 -156
  66. package/src/pb-autocomplete.js +292 -280
  67. package/src/pb-blacklab-highlight.js +264 -259
  68. package/src/pb-blacklab-results.js +236 -221
  69. package/src/pb-browse-docs.js +540 -475
  70. package/src/pb-browse.js +68 -65
  71. package/src/pb-clipboard.js +79 -76
  72. package/src/pb-code-editor.js +110 -102
  73. package/src/pb-code-highlight.js +209 -204
  74. package/src/pb-codepen.js +79 -72
  75. package/src/pb-collapse.js +211 -151
  76. package/src/pb-combo-box.js +190 -190
  77. package/src/pb-components-bundle.js +1 -1
  78. package/src/pb-components.js +1 -0
  79. package/src/pb-custom-form.js +173 -153
  80. package/src/pb-dialog.js +98 -62
  81. package/src/pb-document.js +89 -90
  82. package/src/pb-download.js +212 -196
  83. package/src/pb-drawer.js +145 -148
  84. package/src/pb-edit-app.js +301 -229
  85. package/src/pb-edit-xml.js +100 -97
  86. package/src/pb-events.js +114 -107
  87. package/src/pb-facs-link.js +104 -102
  88. package/src/pb-facsimile.js +474 -410
  89. package/src/pb-formula.js +151 -153
  90. package/src/pb-geolocation.js +129 -131
  91. package/src/pb-grid-action.js +53 -56
  92. package/src/pb-grid.js +231 -228
  93. package/src/pb-highlight.js +140 -140
  94. package/src/pb-hotkeys.js +40 -42
  95. package/src/pb-i18n.js +101 -104
  96. package/src/pb-image-strip.js +84 -78
  97. package/src/pb-lang.js +142 -57
  98. package/src/pb-leaflet-map.js +488 -485
  99. package/src/pb-link.js +126 -124
  100. package/src/pb-load.js +431 -429
  101. package/src/pb-login.js +299 -244
  102. package/src/pb-manage-odds.js +352 -336
  103. package/src/pb-map-icon.js +89 -89
  104. package/src/pb-map-layer.js +85 -85
  105. package/src/pb-markdown.js +90 -99
  106. package/src/pb-media-query.js +74 -72
  107. package/src/pb-mei.js +306 -295
  108. package/src/pb-message.js +139 -97
  109. package/src/pb-mixin.js +269 -264
  110. package/src/pb-navigation.js +80 -95
  111. package/src/pb-observable.js +38 -38
  112. package/src/pb-odd-editor.js +1054 -958
  113. package/src/pb-odd-elementspec-editor.js +349 -298
  114. package/src/pb-odd-model-editor.js +1075 -909
  115. package/src/pb-odd-parameter-editor.js +200 -178
  116. package/src/pb-odd-rendition-editor.js +136 -124
  117. package/src/pb-page.js +431 -422
  118. package/src/pb-paginate.js +228 -179
  119. package/src/pb-panel.js +198 -182
  120. package/src/pb-popover-themes.js +15 -8
  121. package/src/pb-popover.js +296 -287
  122. package/src/pb-print-preview.js +127 -127
  123. package/src/pb-progress.js +51 -51
  124. package/src/pb-repeat.js +105 -104
  125. package/src/pb-restricted.js +84 -77
  126. package/src/pb-search.js +256 -228
  127. package/src/pb-select-feature.js +127 -120
  128. package/src/pb-select-odd.js +132 -124
  129. package/src/pb-select-template.js +89 -78
  130. package/src/pb-select.js +251 -227
  131. package/src/pb-split-list.js +179 -174
  132. package/src/pb-svg.js +80 -79
  133. package/src/pb-table-column.js +54 -54
  134. package/src/pb-table-grid.js +221 -203
  135. package/src/pb-tabs.js +61 -63
  136. package/src/pb-tify.js +154 -154
  137. package/src/pb-timeline.js +382 -249
  138. package/src/pb-toggle-feature.js +195 -187
  139. package/src/pb-upload.js +184 -174
  140. package/src/pb-version.js +30 -30
  141. package/src/pb-view-annotate.js +135 -98
  142. package/src/pb-view.js +1282 -1270
  143. package/src/pb-zoom.js +127 -45
  144. package/src/polymer-hack.js +1 -1
  145. package/src/search-result-service.js +256 -223
  146. package/src/seed-element.js +13 -20
  147. package/src/settings.js +4 -4
  148. package/src/theming.js +98 -91
  149. package/src/urls.js +289 -289
  150. package/src/utils.js +53 -51
  151. package/css/pb-styles.css +0 -51
  152. package/dist/vaadin-element-mixin-fe4a4883.js +0 -527
  153. package/src/assets/pb-styles.css +0 -51
  154. 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
- 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);