@teipublisher/pb-components 1.36.0 → 1.36.3

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.
@@ -3487,6 +3487,18 @@
3487
3487
  "type": "boolean",
3488
3488
  "default": "false"
3489
3489
  },
3490
+ {
3491
+ "name": "reference-strip",
3492
+ "description": "If set, thumbnails of all images are shown in a reference strip at the\nbottom of the viewer.",
3493
+ "type": "boolean",
3494
+ "default": "false"
3495
+ },
3496
+ {
3497
+ "name": "reference-strip-size-ratio",
3498
+ "description": "Size ratio for the reference strip thumbnails. 0.2 by default.",
3499
+ "type": "number",
3500
+ "default": "0.2"
3501
+ },
3490
3502
  {
3491
3503
  "name": "src",
3492
3504
  "type": "string",
@@ -3610,6 +3622,20 @@
3610
3622
  "type": "boolean",
3611
3623
  "default": "false"
3612
3624
  },
3625
+ {
3626
+ "name": "referenceStrip",
3627
+ "attribute": "reference-strip",
3628
+ "description": "If set, thumbnails of all images are shown in a reference strip at the\nbottom of the viewer.",
3629
+ "type": "boolean",
3630
+ "default": "false"
3631
+ },
3632
+ {
3633
+ "name": "referenceStripSizeRatio",
3634
+ "attribute": "reference-strip-size-ratio",
3635
+ "description": "Size ratio for the reference strip thumbnails. 0.2 by default.",
3636
+ "type": "number",
3637
+ "default": "0.2"
3638
+ },
3613
3639
  {
3614
3640
  "name": "src",
3615
3641
  "attribute": "src",
@@ -9550,6 +9576,11 @@
9550
9576
  "type": "array",
9551
9577
  "default": "[\"D\",\"W\",\"M\",\"Y\",\"5Y\",\"10Y\"]"
9552
9578
  },
9579
+ {
9580
+ "name": "max-interval",
9581
+ "type": "number",
9582
+ "default": "60"
9583
+ },
9553
9584
  {
9554
9585
  "name": "url",
9555
9586
  "description": "Endpoint to load timeline data from. Expects response to be an\nobject with key value pairs for (date, hits).\n\nWill be reloaded whenever 'start-date' or 'end-date' attributes change.",
@@ -9646,6 +9677,12 @@
9646
9677
  "type": "array",
9647
9678
  "default": "[\"D\",\"W\",\"M\",\"Y\",\"5Y\",\"10Y\"]"
9648
9679
  },
9680
+ {
9681
+ "name": "maxInterval",
9682
+ "attribute": "max-interval",
9683
+ "type": "number",
9684
+ "default": "60"
9685
+ },
9649
9686
  {
9650
9687
  "name": "url",
9651
9688
  "attribute": "url",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teipublisher/pb-components",
3
- "version": "1.36.0",
3
+ "version": "1.36.3",
4
4
  "description": "Collection of webcomponents underlying TEI Publisher",
5
5
  "repository": "https://github.com/eeditiones/tei-publisher-components.git",
6
6
  "main": "index.html",
package/pb-elements.json CHANGED
@@ -3487,6 +3487,18 @@
3487
3487
  "type": "boolean",
3488
3488
  "default": "false"
3489
3489
  },
3490
+ {
3491
+ "name": "reference-strip",
3492
+ "description": "If set, thumbnails of all images are shown in a reference strip at the\nbottom of the viewer.",
3493
+ "type": "boolean",
3494
+ "default": "false"
3495
+ },
3496
+ {
3497
+ "name": "reference-strip-size-ratio",
3498
+ "description": "Size ratio for the reference strip thumbnails. 0.2 by default.",
3499
+ "type": "number",
3500
+ "default": "0.2"
3501
+ },
3490
3502
  {
3491
3503
  "name": "src",
3492
3504
  "type": "string",
@@ -3610,6 +3622,20 @@
3610
3622
  "type": "boolean",
3611
3623
  "default": "false"
3612
3624
  },
3625
+ {
3626
+ "name": "referenceStrip",
3627
+ "attribute": "reference-strip",
3628
+ "description": "If set, thumbnails of all images are shown in a reference strip at the\nbottom of the viewer.",
3629
+ "type": "boolean",
3630
+ "default": "false"
3631
+ },
3632
+ {
3633
+ "name": "referenceStripSizeRatio",
3634
+ "attribute": "reference-strip-size-ratio",
3635
+ "description": "Size ratio for the reference strip thumbnails. 0.2 by default.",
3636
+ "type": "number",
3637
+ "default": "0.2"
3638
+ },
3613
3639
  {
3614
3640
  "name": "src",
3615
3641
  "attribute": "src",
@@ -9550,6 +9576,11 @@
9550
9576
  "type": "array",
9551
9577
  "default": "[\"D\",\"W\",\"M\",\"Y\",\"5Y\",\"10Y\"]"
9552
9578
  },
9579
+ {
9580
+ "name": "max-interval",
9581
+ "type": "number",
9582
+ "default": "60"
9583
+ },
9553
9584
  {
9554
9585
  "name": "url",
9555
9586
  "description": "Endpoint to load timeline data from. Expects response to be an\nobject with key value pairs for (date, hits).\n\nWill be reloaded whenever 'start-date' or 'end-date' attributes change.",
@@ -9646,6 +9677,12 @@
9646
9677
  "type": "array",
9647
9678
  "default": "[\"D\",\"W\",\"M\",\"Y\",\"5Y\",\"10Y\"]"
9648
9679
  },
9680
+ {
9681
+ "name": "maxInterval",
9682
+ "attribute": "max-interval",
9683
+ "type": "number",
9684
+ "default": "60"
9685
+ },
9649
9686
  {
9650
9687
  "name": "url",
9651
9688
  "attribute": "url",
@@ -14,7 +14,6 @@ export class KBGA extends Registry {
14
14
  const searchParam = register === 'bibls' ? 'biblsearch' : 'search';
15
15
  const url = `https://meta.karl-barth.ch/api/${register}?${searchParam}=${encodeURIComponent(key)}`;
16
16
  const label = this.getLabelField();
17
- console.log(label);
18
17
  return new Promise((resolve) => {
19
18
  fetch(url)
20
19
  .then(response => response.json())
@@ -63,7 +62,7 @@ export class KBGA extends Registry {
63
62
  container.innerHTML = output;
64
63
  resolve({
65
64
  id: json.data['full-id'],
66
- strings: [json.data[label]]
65
+ strings: [typeof label === 'string' ? json.data[label] : label(json.data)]
67
66
  });
68
67
  });
69
68
  });
@@ -115,7 +114,7 @@ export class KBGA extends Registry {
115
114
  label = 'label';
116
115
  break;
117
116
  case 'bibl':
118
- label = (data) => data.title.m || data.title.s;
117
+ label = 'asHtml';
119
118
  break;
120
119
  default:
121
120
  label = 'persName_full';
@@ -1,4 +1,5 @@
1
1
  import { LitElement, html, css } from 'lit-element';
2
+ import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
2
3
  import { pbMixin } from './pb-mixin.js';
3
4
  import { translate } from "./pb-i18n.js";
4
5
  import { createConnectors } from "./authority/connectors.js";
@@ -121,8 +122,9 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
121
122
  <td>
122
123
  <div>
123
124
  ${item.link
124
- ? html`<a target="_blank" href="${item.link}">${item.label}</a>`
125
- : item.label}
125
+ ? html`<a target="_blank" href="${item.link}">${unsafeHTML(item.label)}</a>`
126
+ : html`${unsafeHTML(item.label)}`
127
+ }
126
128
  </div>
127
129
  ${item.details ? html`<div class="details" part="details">${item.details}</div>` : null}
128
130
  </td>
@@ -85,6 +85,21 @@ export class PbFacsimile extends pbMixin(LitElement) {
85
85
  type: Number,
86
86
  attribute: 'visibility-ratio'
87
87
  },
88
+ /**
89
+ * If set, thumbnails of all images are shown in a reference strip at the
90
+ * bottom of the viewer.
91
+ */
92
+ referenceStrip: {
93
+ type: Boolean,
94
+ attribute: 'reference-strip'
95
+ },
96
+ /**
97
+ * Size ratio for the reference strip thumbnails. 0.2 by default.
98
+ */
99
+ referenceStripSizeRatio: {
100
+ type: Number,
101
+ attribute: 'reference-strip-size-ratio'
102
+ },
88
103
  /**
89
104
  * Type of the source of the image to display: either 'iiif' or 'image'
90
105
  * (for simple image links not served via IIIF).
@@ -134,6 +149,8 @@ export class PbFacsimile extends pbMixin(LitElement) {
134
149
  this.showFullPageControl = false;
135
150
  this.showRotationControl = false;
136
151
  this.constrainDuringPan = false;
152
+ this.referenceStrip = false;
153
+ this.referenceStripSizeRatio = 0.2;
137
154
  this.src = '';
138
155
  this.prefixUrl = '../images/openseadragon/';
139
156
  this.loaded = false;
@@ -197,7 +214,7 @@ export class PbFacsimile extends pbMixin(LitElement) {
197
214
  // Init openseadragon
198
215
  _initOpenSeadragon() {
199
216
  const prefixUrl = resolveURL(this.prefixUrl + (this.prefixUrl.endsWith("/") ? "" : "/"));
200
- this.viewer = OpenSeadragon({
217
+ const options = {
201
218
  element: this.shadowRoot.getElementById('viewer'),
202
219
  prefixUrl,
203
220
  preserveViewport: true,
@@ -213,7 +230,12 @@ export class PbFacsimile extends pbMixin(LitElement) {
213
230
  minZoomLevel: 1,
214
231
  defaultZoomLevel: this.defaultZoomLevel,
215
232
  constrainDuringPan: true
216
- });
233
+ };
234
+ if (this.referenceStrip) {
235
+ options.showReferenceStrip = true;
236
+ options.referenceStripSizeRatio = this.referenceStripSizeRatio;
237
+ }
238
+ this.viewer = OpenSeadragon(options);
217
239
 
218
240
  this.viewer.addHandler('open', () => {
219
241
  this.resetZoom();
@@ -282,6 +282,10 @@ export class PbTimeline extends pbMixin(LitElement) {
282
282
  scopes: {
283
283
  type: Array
284
284
  },
285
+ maxInterval: {
286
+ type: Number,
287
+ attribute: 'max-interval'
288
+ },
285
289
  /**
286
290
  * Endpoint to load timeline data from. Expects response to be an
287
291
  * object with key value pairs for (date, hits).
@@ -315,6 +319,7 @@ export class PbTimeline extends pbMixin(LitElement) {
315
319
  this.endDate = '';
316
320
  this.scope = '';
317
321
  this.scopes = ["D", "W", "M", "Y", "5Y", "10Y"];
322
+ this.maxInterval = 60;
318
323
  this.url = '';
319
324
  this.auto = false;
320
325
  this.resettable = false;
@@ -516,10 +521,18 @@ export class PbTimeline extends pbMixin(LitElement) {
516
521
  endDateStr: this.searchResult.getEndOfRangeDate(this.dataObj.scope, endDateStr),
517
522
  scope: this.dataObj.scope,
518
523
  categories,
519
- count: itemCount
524
+ count: itemCount,
525
+ label: this.label
520
526
  });
521
527
  } else {
522
- this.emitTo('pb-timeline-date-changed', { startDateStr, endDateStr: null, scope: this.dataObj.scope, categories, count: itemCount });
528
+ this.emitTo('pb-timeline-date-changed', {
529
+ startDateStr,
530
+ endDateStr: null,
531
+ scope: this.dataObj.scope,
532
+ categories,
533
+ count: itemCount,
534
+ label: this.label
535
+ });
523
536
  }
524
537
  } else {
525
538
  this.emitTo('pb-timeline-daterange-changed', {
@@ -527,7 +540,8 @@ export class PbTimeline extends pbMixin(LitElement) {
527
540
  endDateStr,
528
541
  categories,
529
542
  scope: this.dataObj.scope,
530
- count: itemCount
543
+ count: itemCount,
544
+ label: this.label
531
545
  });
532
546
  }
533
547
  }
@@ -732,15 +746,12 @@ export class PbTimeline extends pbMixin(LitElement) {
732
746
  } else {
733
747
  newJsonData = data;
734
748
  }
735
- this.searchResult = new SearchResultService(newJsonData, 60, this.scopes);
749
+ this.searchResult = new SearchResultService(newJsonData, this.maxInterval, this.scopes);
736
750
  this.setData(this.searchResult.export(this.scope));
737
- this.dispatchEvent(new CustomEvent('pb-timeline-loaded', {
738
- detail: {
739
- value: true
740
- },
741
- composed: true,
742
- bubbles: true
743
- }));
751
+ this.emitTo('pb-timeline-loaded', {
752
+ value: true,
753
+ label: this.label
754
+ });
744
755
  }
745
756
 
746
757
  }