@teipublisher/pb-components 1.32.2 → 1.34.1
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/CHANGELOG.md +41 -0
- package/dist/demo/demos.json +4 -1
- package/dist/demo/pb-timeline.html +122 -0
- package/dist/demo/pb-timeline2.html +94 -0
- package/dist/demo/timeline-dev-data.json +3 -0
- package/dist/pb-components-bundle.js +508 -252
- package/dist/pb-elements.json +287 -0
- package/i18n/common/de.json +4 -0
- package/i18n/common/en.json +4 -0
- package/package.json +1 -1
- package/pb-elements.json +287 -0
- package/src/parse-date-service.js +266 -0
- package/src/pb-browse-docs.js +25 -8
- package/src/pb-components.js +1 -0
- package/src/pb-load.js +17 -6
- package/src/pb-timeline.js +741 -0
- package/src/pb-view.js +59 -10
- package/src/search-result-service.js +521 -0
package/src/pb-load.js
CHANGED
|
@@ -288,13 +288,12 @@ export class PbLoad extends pbMixin(LitElement) {
|
|
|
288
288
|
}
|
|
289
289
|
|
|
290
290
|
_handleContent(ev) {
|
|
291
|
-
this._parseHeaders(ev.detail.xhr);
|
|
292
|
-
|
|
293
291
|
const resp = this.shadowRoot.getElementById('loadContent').lastResponse;
|
|
294
292
|
if (this.container) {
|
|
295
293
|
this.style.display = 'none';
|
|
296
294
|
document.querySelectorAll(this.container).forEach((elem) => {
|
|
297
|
-
elem.innerHTML = resp
|
|
295
|
+
elem.innerHTML = resp;
|
|
296
|
+
this._parseHeaders(ev.detail.xhr, elem);
|
|
298
297
|
this._fixLinks(elem);
|
|
299
298
|
this._onLoad(elem);
|
|
300
299
|
});
|
|
@@ -304,6 +303,7 @@ export class PbLoad extends pbMixin(LitElement) {
|
|
|
304
303
|
|
|
305
304
|
const div = document.createElement('div');
|
|
306
305
|
div.innerHTML = resp;
|
|
306
|
+
this._parseHeaders(ev.detail.xhr, div);
|
|
307
307
|
div.slot = '';
|
|
308
308
|
this.appendChild(div);
|
|
309
309
|
this._fixLinks(div);
|
|
@@ -338,9 +338,20 @@ export class PbLoad extends pbMixin(LitElement) {
|
|
|
338
338
|
dialog.open();
|
|
339
339
|
}
|
|
340
340
|
|
|
341
|
-
_parseHeaders(xhr) {
|
|
342
|
-
|
|
343
|
-
|
|
341
|
+
_parseHeaders(xhr, content) {
|
|
342
|
+
// Try to determine number of pages and current position
|
|
343
|
+
// Search for data-pagination-* attributes first and if they
|
|
344
|
+
// can't be found, check HTTP headers
|
|
345
|
+
function getPaginationParam(type) {
|
|
346
|
+
const elem = content.querySelector(`[data-pagination-${type}]`);
|
|
347
|
+
if (elem) {
|
|
348
|
+
return elem.getAttribute(`data-pagination-${type}`);
|
|
349
|
+
}
|
|
350
|
+
return xhr.getResponseHeader(`pb-${type}`);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
const total = getPaginationParam('total');
|
|
354
|
+
const start = getPaginationParam('start');
|
|
344
355
|
|
|
345
356
|
if (this.start !== start) {
|
|
346
357
|
this.start = parseInt(start);
|