@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
@@ -1,31 +1,30 @@
1
1
  import { LitElement, html, css } from 'lit-element';
2
2
  import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
3
- import { SearchResultService } from "./search-result-service.js";
4
- import { ParseDateService } from "./parse-date-service.js";
5
- import { pbMixin } from "./pb-mixin.js";
3
+ import { SearchResultService } from './search-result-service.js';
4
+ import { ParseDateService } from './parse-date-service.js';
5
+ import { pbMixin } from './pb-mixin.js';
6
6
  import '@polymer/iron-ajax';
7
- import '@polymer/iron-icons';
8
- import '@polymer/paper-icon-button';
9
- import { translate } from "./pb-i18n.js";
7
+ import { translate } from './pb-i18n.js';
8
+ import { themableMixin } from './theming.js';
10
9
 
11
10
  /**
12
11
  * A timeline component to display time series data in a bar chart like view.
13
12
  *
14
13
  * Time series data can be displayed in one of 6 different scales:
15
- *
14
+ *
16
15
  * - by decade (10Y)
17
16
  * - by 5 years (5Y)
18
17
  * - by years (Y)
19
18
  * - by month (M)
20
19
  * - by week (W)
21
20
  * - by day (D)
22
- *
21
+ *
23
22
  * The endpoint is expected to return a JSON object. Each property should either be a date or the special
24
23
  * marker `?`, which indicates undated resources.
25
24
  * The value associated with each entry
26
- * should either correspond to a count of resources or an object with properties `count` and `info`.
25
+ * should either correspond to a count of resources or an object with properties `count` and `info`.
27
26
  * `info` should be an array, containing HTML to be shown in a list within the tooltips.
28
- * Expected JSON:
27
+ * Expected JSON:
29
28
  * ```javascript
30
29
  * {
31
30
  * "1852-01-14": {
@@ -52,17 +51,17 @@ import { translate } from "./pb-i18n.js";
52
51
  * <span slot="label">Angezeigter Zeitraum: </span>
53
52
  * </pb-timeline>
54
53
  * ```
55
- * See https://www.briefedition.alfred-escher.ch/briefe/ for a running sample. The source code of the webpage is here: https://github.com/stazh/briefedition-escher. Relevant files are:
54
+ * See https://www.briefedition.alfred-escher.ch/briefe/ for a running sample. The source code of the webpage is here: https://github.com/stazh/briefedition-escher. Relevant files are:
56
55
  * - [templates/people.html](https://github.com/stazh/briefedition-escher/blob/master/templates/people.html#L91) - usage of pb-timeline
57
56
  * - [modules/custom-api.json](https://github.com/stazh/briefedition-escher/blob/master/modules/custom-api.json#L1080) - `/api/timeline` endpoint delivering required JSON object
58
- *
57
+ *
59
58
  * @slot label - Inserted before the label showing the currently displayed time range
60
- *
59
+ *
61
60
  * @fires pb-timeline-date-changed - Triggered when user clicks on a single entry
62
61
  * @fires pb-timeline-daterange-changed - Triggered when user selects a range of entries
63
62
  * @fires pb-timeline-reset-selection - Requests that the timeline is reset to initial state
64
63
  * @fires pb-timeline-loaded - Timeline was loaded
65
- *
64
+ *
66
65
  * @cssprop --pb-timeline-height
67
66
  * @cssprop --pb-timeline-padding
68
67
  * @cssprop --pb-timeline-color-highlight
@@ -72,17 +71,17 @@ import { translate } from "./pb-i18n.js";
72
71
  * @cssprop --pb-timeline-color-bin
73
72
  * @cssprop --pb-timeline-title-font-size
74
73
  * @cssprop --pb-timeline-tooltip-font-size
75
- *
74
+ * @cssprop --pb-timeline-tooltip-min-width
75
+ * @cssprop --pb-timeline-tooltip-max-width
76
+ *
76
77
  * @csspart label
77
78
  * @csspart tooltip
78
79
  * @csspart title
79
80
  */
80
- export class PbTimeline extends pbMixin(LitElement) {
81
-
82
-
83
- static get styles() {
81
+ export class PbTimeline extends themableMixin(pbMixin(LitElement)) {
82
+ static get styles() {
84
83
  return css`
85
- :host{
84
+ :host {
86
85
  display: block;
87
86
  }
88
87
  .hidden {
@@ -121,8 +120,9 @@ export class PbTimeline extends pbMixin(LitElement) {
121
120
  // justify-content: center;
122
121
  position: relative;
123
122
  }
124
- .bin-container.border-left, .bin-container.unknown {
125
- border-left: 1px solid rgba(0,0,0,0.4);
123
+ .bin-container.border-left,
124
+ .bin-container.unknown {
125
+ border-left: 1px solid rgba(0, 0, 0, 0.4);
126
126
  }
127
127
  .bin-container.unknown {
128
128
  margin-left: 40px;
@@ -196,10 +196,11 @@ export class PbTimeline extends pbMixin(LitElement) {
196
196
  }
197
197
 
198
198
  /* TOOLTIP */
199
- #tooltip {
199
+ .tooltip {
200
200
  display: inline-block;
201
201
  position: absolute;
202
202
  min-width: var(--pb-timeline-tooltip-min-width, 200px);
203
+ max-width: var(--pb-timeline-tooltip-max-width, calc(100vw - 40px));
203
204
  font-size: var(--pb-timeline-tooltip-font-size, 11px);
204
205
  line-height: 1.25;
205
206
  background: var(--pb-timeline-background-color-title, #535353);
@@ -207,36 +208,44 @@ export class PbTimeline extends pbMixin(LitElement) {
207
208
  text-align: left;
208
209
  border-radius: 6px;
209
210
  padding: 5px 10px;
210
- top: var(--pb-timeline-height, 80px);
211
+ top: calc(var(--pb-timeline-height, 80px) + 10px);
211
212
  left: 0;
212
213
  z-index: 1000;
214
+ word-wrap: break-word;
215
+ overflow-wrap: break-word;
216
+ }
217
+ .tooltip a:link, .tooltip a:visited {
218
+ color: var(--pb-timeline-color-title, #ffffff);
213
219
  }
214
- #tooltip ul {
220
+ .tooltip ul {
215
221
  list-style: none;
216
222
  margin: 0;
217
223
  padding: 0;
218
224
  }
219
- #tooltip-close {
225
+ .tooltip-close {
220
226
  position: absolute;
221
227
  top: -13px;
222
228
  right: -10px;
223
229
  }
224
- #tooltip::after { /* small triangle that points to top */
225
- content: "";
230
+ .tooltip::after {
231
+ /* small triangle that points to top */
232
+ content: '';
226
233
  position: absolute;
227
234
  bottom: 100%;
228
235
  left: 10px;
229
236
  margin-left: -5px;
230
237
  border-width: 5px;
231
238
  border-style: solid;
232
- border-color: transparent transparent black transparent;
239
+ border-color: transparent transparent var(--pb-timeline-background-color-title, #535353) transparent;
233
240
  }
234
- #tooltip.right::after {
235
- right: 10px;
236
- left: auto;
241
+ .tooltip.chevron-precise::after {
242
+ left: var(--chevron-position, 50%);
243
+ right: auto;
244
+ margin-left: -5px;
245
+ margin-right: 0;
237
246
  }
238
247
  /* pure css close button for tooltip */
239
- .close{
248
+ .close {
240
249
  position: relative;
241
250
  display: inline-block;
242
251
  width: 50px;
@@ -247,7 +256,8 @@ export class PbTimeline extends pbMixin(LitElement) {
247
256
  .close.rounded.black {
248
257
  cursor: pointer;
249
258
  }
250
- .close::before, .close::after {
259
+ .close::before,
260
+ .close::after {
251
261
  content: '';
252
262
  position: absolute;
253
263
  height: 2px;
@@ -263,82 +273,99 @@ export class PbTimeline extends pbMixin(LitElement) {
263
273
  .close::after {
264
274
  transform: rotate(-45deg);
265
275
  }
266
- .close.thick::before, .close.thick::after {
276
+ .close.thick::before,
277
+ .close.thick::after {
267
278
  height: 4px;
268
279
  margin-top: -2px;
269
280
  }
270
- .close.black::before, .close.black::after {
281
+ .close.black::before,
282
+ .close.black::after {
271
283
  height: 8px;
272
284
  margin-top: -4px;
273
285
  }
274
- .close.rounded::before, .close.rounded::after {
286
+ .close.rounded::before,
287
+ .close.rounded::after {
275
288
  border-radius: 5px;
276
289
  }
290
+ #clear {
291
+ background-image: var(
292
+ --pb-dialog-background-image,
293
+ url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(136, 145, 164)' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E")
294
+ );
295
+ background-position: center;
296
+ background-size: auto 1rem;
297
+ background-repeat: no-repeat;
298
+ background-color: transparent;
299
+ border: none;
300
+ display: block;
301
+ height: 1rem;
302
+ width: 1rem;
303
+ }
277
304
  `;
278
305
  }
279
306
 
280
- static get properties() {
281
- return {
282
- ...super.properties,
283
- /**
284
- * start date for timeline to display
285
- */
286
- startDate:{
287
- type: String,
288
- reflect: true,
289
- attribute: 'start-date'
290
- },
291
- /**
292
- * endDate for timeline to display
293
- */
294
- endDate: {
295
- type: String,
296
- reflect: true,
297
- attribute: 'end-date'
298
- },
299
- /**
300
- * The scope for the timeline. Must be one of the pre-defined scopes.
301
- * If not set, the component automatically tries to determine the best scope fitting the
302
- * given time series.
303
- */
304
- scope:{
305
- type: String
306
- },
307
- /**
308
- * The scopes to consider for automatic scoping.
309
- *
310
- * Defaults to ["D", "W", "M", "Y", "5Y", "10Y"]
311
- */
312
- scopes: {
313
- type: Array
314
- },
315
- maxInterval: {
316
- type: Number,
317
- attribute: 'max-interval'
318
- },
319
- /**
320
- * Endpoint to load timeline data from. Expects response to be an
321
- * object with key value pairs for (date, hits).
322
- *
323
- * Will be reloaded whenever 'start-date' or 'end-date' attributes change.
324
- */
325
- url:{
326
- type: String
327
- },
328
- /**
329
- * If set, data will be retrieved automatically on first load.
330
- */
331
- auto: {
332
- type: Boolean
333
- },
334
- resettable: {
335
- type: Boolean
336
- },
337
- _language: {
338
- type: String
339
- }
340
- };
341
- }
307
+ static get properties() {
308
+ return {
309
+ ...super.properties,
310
+ /**
311
+ * start date for timeline to display
312
+ */
313
+ startDate: {
314
+ type: String,
315
+ reflect: true,
316
+ attribute: 'start-date',
317
+ },
318
+ /**
319
+ * endDate for timeline to display
320
+ */
321
+ endDate: {
322
+ type: String,
323
+ reflect: true,
324
+ attribute: 'end-date',
325
+ },
326
+ /**
327
+ * The scope for the timeline. Must be one of the pre-defined scopes.
328
+ * If not set, the component automatically tries to determine the best scope fitting the
329
+ * given time series.
330
+ */
331
+ scope: {
332
+ type: String,
333
+ },
334
+ /**
335
+ * The scopes to consider for automatic scoping.
336
+ *
337
+ * Defaults to ["D", "W", "M", "Y", "5Y", "10Y"]
338
+ */
339
+ scopes: {
340
+ type: Array,
341
+ },
342
+ maxInterval: {
343
+ type: Number,
344
+ attribute: 'max-interval',
345
+ },
346
+ /**
347
+ * Endpoint to load timeline data from. Expects response to be an
348
+ * object with key value pairs for (date, hits).
349
+ *
350
+ * Will be reloaded whenever 'start-date' or 'end-date' attributes change.
351
+ */
352
+ url: {
353
+ type: String,
354
+ },
355
+ /**
356
+ * If set, data will be retrieved automatically on first load.
357
+ */
358
+ auto: {
359
+ type: Boolean,
360
+ },
361
+ resettable: {
362
+ type: Boolean,
363
+ },
364
+ _language: {
365
+ type: String,
366
+ },
367
+ };
368
+ }
342
369
 
343
370
  constructor() {
344
371
  super();
@@ -348,7 +375,7 @@ export class PbTimeline extends pbMixin(LitElement) {
348
375
  this.startDate = '';
349
376
  this.endDate = '';
350
377
  this.scope = '';
351
- this.scopes = ["D", "W", "M", "Y", "5Y", "10Y"];
378
+ this.scopes = ['D', 'W', 'M', 'Y', '5Y', '10Y'];
352
379
  this.maxInterval = 60;
353
380
  this.url = '';
354
381
  this.auto = false;
@@ -366,29 +393,29 @@ export class PbTimeline extends pbMixin(LitElement) {
366
393
  loader.url = url;
367
394
  loader.generateRequest();
368
395
  });
369
- this.subscribeTo('pb-i18n-update', (ev) => {
396
+ this.subscribeTo('pb-i18n-update', ev => {
370
397
  this._language = ev.detail.language;
371
398
  });
372
399
  }
373
400
 
374
401
  firstUpdated() {
375
- this.bins = this.shadowRoot.querySelectorAll(".bin-container");
376
- this.tooltip = this.shadowRoot.getElementById("tooltip");
402
+ this.bins = this.shadowRoot.querySelectorAll('.bin-container');
403
+ this.tooltip = this.shadowRoot.querySelector('.tooltip');
377
404
 
378
405
  // global mouseup event
379
- document.addEventListener("mouseup", () => {
406
+ document.addEventListener('mouseup', () => {
380
407
  this._mouseUp();
381
- })
408
+ });
382
409
  // pb-timeline-daterange-changed event:
383
410
  // changes daterange selection (marks bins on histogram)
384
411
  // is triggered by the componeent itself but can be also triggered
385
412
  // from outside by another component
386
- document.addEventListener("pb-timeline-daterange-changed", (event) => {
387
- const startDateStr = event.detail.startDateStr;
388
- const endDateStr = event.detail.endDateStr;
389
- if (this._fullRangeSelected(startDateStr, endDateStr)){
413
+ document.addEventListener('pb-timeline-daterange-changed', event => {
414
+ const { startDateStr } = event.detail;
415
+ const { endDateStr } = event.detail;
416
+ if (this._fullRangeSelected(startDateStr, endDateStr)) {
390
417
  // do not mark the whole histogram, reset selection instead
391
- console.log("_fullRangeSelected() is true");
418
+ console.log('_fullRangeSelected() is true');
392
419
  this.resetSelection();
393
420
  return;
394
421
  }
@@ -398,38 +425,35 @@ export class PbTimeline extends pbMixin(LitElement) {
398
425
  // resets selection (remove marking of all selected bins)
399
426
  // is triggered by the componeent itself but can be also triggered
400
427
  // from outside by another component
401
- document.addEventListener("pb-timeline-reset-selection", () => {
428
+ document.addEventListener('pb-timeline-reset-selection', () => {
402
429
  this.resetSelection();
403
430
  this._hideTooltip();
404
431
  });
405
432
  }
406
433
 
407
- /**
408
- * checks if 'scope' has changed and re-applies dataset accordingly
409
- *
410
- * @param changedProperties
411
- */
412
- updated (changedProperties){
413
- if(changedProperties.has('scope')){
414
-
415
- if(this.searchResult){
416
- if(this.scopes.includes(this.scope)){
417
- this.setData(this.searchResult.export(this.scope));
418
- }else{
419
- console.error('unknown scope ', this.scope);
420
- }
434
+ /**
435
+ * checks if 'scope' has changed and re-applies dataset accordingly
436
+ *
437
+ * @param changedProperties
438
+ */
439
+ updated(changedProperties) {
440
+ if (changedProperties.has('scope')) {
441
+ if (this.searchResult) {
442
+ if (this.scopes.includes(this.scope)) {
443
+ this.setData(this.searchResult.export(this.scope));
444
+ } else {
445
+ console.error('unknown scope ', this.scope);
421
446
  }
422
-
447
+ }
423
448
  }
424
449
  }
425
450
 
426
-
427
451
  setData(dataObj) {
428
452
  this.dataObj = dataObj;
429
453
  this.maxValue = Math.max(...this.dataObj.data.map(binObj => binObj.value));
430
454
  this.requestUpdate();
431
455
  this.updateComplete.then(() => {
432
- this.bins = this.shadowRoot.querySelectorAll(".bin-container");
456
+ this.bins = this.shadowRoot.querySelectorAll('.bin-container');
433
457
  this.resetSelection();
434
458
  this._resetTooltip();
435
459
  });
@@ -442,35 +466,39 @@ export class PbTimeline extends pbMixin(LitElement) {
442
466
  if (this.dataObj.data.length === 1) {
443
467
  return this.dataObj.data[0].category;
444
468
  }
445
- return `${this.dataObj.data[0].selectionStart} – ${this.dataObj.data[this.dataObj.data.length - 1].selectionEnd}`;
469
+ return `${this.dataObj.data[0].selectionStart} – ${
470
+ this.dataObj.data[this.dataObj.data.length - 1].selectionEnd
471
+ }`;
446
472
  }
447
473
 
448
474
  getSelectedStartDateStr() {
449
- return this.shadowRoot.querySelectorAll(".bin-container.selected")[0].dataset.selectionstart;
475
+ return this.shadowRoot.querySelectorAll('.bin-container.selected')[0].dataset.selectionstart;
450
476
  }
451
477
 
452
478
  getSelectedEndDateStr() {
453
- const selectedBins = this.shadowRoot.querySelectorAll(".bin-container.selected");
479
+ const selectedBins = this.shadowRoot.querySelectorAll('.bin-container.selected');
454
480
  return selectedBins[selectedBins.length - 1].dataset.selectionend;
455
481
  }
456
482
 
457
483
  getSelectedCategories() {
458
- const selectedBins = this.shadowRoot.querySelectorAll(".bin-container.selected");
484
+ const selectedBins = this.shadowRoot.querySelectorAll('.bin-container.selected');
459
485
  const categories = [];
460
- selectedBins.forEach((bin) => categories.push(bin.dataset.category));
486
+ selectedBins.forEach(bin => categories.push(bin.dataset.category));
461
487
  return categories;
462
488
  }
463
489
 
464
490
  getSelectedItemCount() {
465
- const selectedBins = this.shadowRoot.querySelectorAll(".bin-container.selected");
491
+ const selectedBins = this.shadowRoot.querySelectorAll('.bin-container.selected');
466
492
  let count = 0;
467
- selectedBins.forEach((bin) => { count += parseInt(bin.dataset.value); });
493
+ selectedBins.forEach(bin => {
494
+ count += parseInt(bin.dataset.value);
495
+ });
468
496
  return count;
469
497
  }
470
498
 
471
499
  resetSelection() {
472
500
  this.bins.forEach(bin => {
473
- bin.classList.remove("selected");
501
+ bin.classList.remove('selected');
474
502
  });
475
503
  this._resetSelectionProperty();
476
504
  this._hideTooltip();
@@ -479,8 +507,9 @@ export class PbTimeline extends pbMixin(LitElement) {
479
507
  select(startDateStr, endDateStr) {
480
508
  this.bins.forEach(bin => {
481
509
  if (bin.dataset.isodatestr >= startDateStr && bin.dataset.isodatestr <= endDateStr) {
482
- bin.classList.add("selected");
483
- } else {bin.classList.remove("selected");
510
+ bin.classList.add('selected');
511
+ } else {
512
+ bin.classList.remove('selected');
484
513
  }
485
514
  });
486
515
  this._displayTooltip();
@@ -488,7 +517,7 @@ export class PbTimeline extends pbMixin(LitElement) {
488
517
  }
489
518
 
490
519
  _fullRangeSelected(startDateStr, endDateStr) {
491
- const matchingStartDate = startDateStr = this.bins[0].dataset.isodatestr;
520
+ const matchingStartDate = (startDateStr = this.bins[0].dataset.isodatestr);
492
521
  const matchingEndDate = endDateStr === this.bins[this.bins.length - 1].dataset.isodatestr;
493
522
  return matchingStartDate && matchingEndDate;
494
523
  }
@@ -509,7 +538,12 @@ export class PbTimeline extends pbMixin(LitElement) {
509
538
  const startDateStr = new ParseDateService().run(start);
510
539
  const endDateStr = new ParseDateService().run(end);
511
540
  const itemCount = this.getSelectedItemCount();
512
- this._dispatchTimelineDaterangeChangedEvent(startDateStr, endDateStr, this.getSelectedCategories(), itemCount);
541
+ this._dispatchTimelineDaterangeChangedEvent(
542
+ startDateStr,
543
+ endDateStr,
544
+ this.getSelectedCategories(),
545
+ itemCount,
546
+ );
513
547
  }
514
548
  }
515
549
  }
@@ -518,22 +552,24 @@ export class PbTimeline extends pbMixin(LitElement) {
518
552
  if (this.mousedown) {
519
553
  this._brushing(event);
520
554
  this._showtooltipSelection();
521
- } else if (this.selection.start === undefined) { // no selection currently made
555
+ } else if (this.selection.start === undefined) {
556
+ // no selection currently made
522
557
  this._showtooltip(event);
523
558
  }
524
559
  }
525
560
 
526
561
  _mouseenter() {
527
- if (this.dataObj) { // if data is loaded
562
+ if (this.dataObj) {
563
+ // if data is loaded
528
564
  this._displayTooltip();
529
565
  }
530
566
  }
531
567
 
532
568
  _getMousePosition(mouseEvent) {
533
- let rect = this.shadowRoot.querySelector(".wrapper").getBoundingClientRect();
534
- let x = mouseEvent.clientX - rect.left + 1; //x position within the element.
535
- let y = mouseEvent.clientY - rect.top + 1; //y position within the element.
536
- return { x: x, y: y };
569
+ const rect = this.shadowRoot.querySelector('.wrapper').getBoundingClientRect();
570
+ const x = mouseEvent.clientX - rect.left + 1; // x position within the element.
571
+ const y = mouseEvent.clientY - rect.top + 1; // y position within the element.
572
+ return { x, y };
537
573
  }
538
574
 
539
575
  _brushing(event) {
@@ -543,8 +579,13 @@ export class PbTimeline extends pbMixin(LitElement) {
543
579
 
544
580
  _dispatchTimelineDaterangeChangedEvent(startDateStr, endDateStr, categories, itemCount) {
545
581
  if (startDateStr === '????-??-??') {
546
- this.emitTo('pb-timeline-date-changed', { startDateStr: null, endDateStr: null, categories: ['?'], count: itemCount });
547
- } else if(startDateStr === endDateStr) {
582
+ this.emitTo('pb-timeline-date-changed', {
583
+ startDateStr: null,
584
+ endDateStr: null,
585
+ categories: ['?'],
586
+ count: itemCount,
587
+ });
588
+ } else if (startDateStr === endDateStr) {
548
589
  if (this.dataObj.scope !== 'D') {
549
590
  this.emitTo('pb-timeline-daterange-changed', {
550
591
  startDateStr,
@@ -552,16 +593,16 @@ export class PbTimeline extends pbMixin(LitElement) {
552
593
  scope: this.dataObj.scope,
553
594
  categories,
554
595
  count: itemCount,
555
- label: this.label
596
+ label: this.label,
556
597
  });
557
598
  } else {
558
- this.emitTo('pb-timeline-date-changed', {
559
- startDateStr,
560
- endDateStr: null,
561
- scope: this.dataObj.scope,
562
- categories,
599
+ this.emitTo('pb-timeline-date-changed', {
600
+ startDateStr,
601
+ endDateStr: null,
602
+ scope: this.dataObj.scope,
603
+ categories,
563
604
  count: itemCount,
564
- label: this.label
605
+ label: this.label,
565
606
  });
566
607
  }
567
608
  } else {
@@ -571,7 +612,7 @@ export class PbTimeline extends pbMixin(LitElement) {
571
612
  categories,
572
613
  scope: this.dataObj.scope,
573
614
  count: itemCount,
574
- label: this.label
615
+ label: this.label,
575
616
  });
576
617
  }
577
618
  }
@@ -582,61 +623,144 @@ export class PbTimeline extends pbMixin(LitElement) {
582
623
 
583
624
  _showtooltip(event) {
584
625
  const interval = this._getElementInterval(event.currentTarget);
626
+ const datestr = event.currentTarget.dataset.tooltip;
627
+ const value = this._numberWithCommas(event.currentTarget.dataset.value);
628
+ const info = event.currentTarget.querySelector('.info');
629
+ this.tooltip.querySelector(
630
+ '.tooltip-text',
631
+ ).innerHTML = `<div><strong>${datestr}</strong>: ${value}</div><ul>${
632
+ info ? info.innerHTML : ''
633
+ }</ul>`;
634
+
635
+ // Force a reflow to get accurate tooltip dimensions
636
+ this.tooltip.style.visibility = 'hidden';
637
+ this.tooltip.style.display = 'block';
638
+ const tooltipWidth = this.tooltip.offsetWidth;
639
+ this.tooltip.style.visibility = '';
640
+ this.tooltip.style.display = '';
641
+
642
+ const wrapper = this.shadowRoot.querySelector('.wrapper');
643
+ const wrapperRect = wrapper.getBoundingClientRect();
644
+ const wrapperWidth = wrapperRect.width;
645
+
585
646
  let offset;
586
- if (interval[0] < interval[2]) {
587
- offset = Math.round((((interval[0] + interval[1]) / 2)) - 10);
647
+ const centerPosition = Math.round((interval[0] + interval[1]) / 2);
648
+
649
+ // Clear any existing chevron positioning classes
650
+ this.tooltip.classList.remove('chevron-precise');
651
+
652
+ // Check if tooltip would overflow on the right
653
+ if (centerPosition + tooltipWidth / 2 > wrapperWidth) {
654
+ // Position tooltip to the right of the bin, aligned to the right edge
655
+ offset = Math.max(0, interval[1] - tooltipWidth + 10);
656
+ this.tooltip.classList.add('right');
657
+ } else if (centerPosition - tooltipWidth / 2 < 0) {
658
+ // Position tooltip to the left of the bin, aligned to the left edge
659
+ offset = Math.min(wrapperWidth - tooltipWidth, interval[0] - 10);
588
660
  this.tooltip.classList.remove('right');
589
661
  } else {
590
- offset = Math.round((((interval[0] + interval[1]) / 2) - this.tooltip.offsetWidth)) + 10;
591
- this.tooltip.classList.add('right');
662
+ // Center the tooltip
663
+ offset = centerPosition - tooltipWidth / 2;
664
+ this.tooltip.classList.remove('right');
592
665
  }
593
- this.tooltip.style.left = offset + "px";
594
- const datestr = event.currentTarget.dataset.tooltip;
595
- const value = this._numberWithCommas(event.currentTarget.dataset.value);
596
- const info = event.currentTarget.querySelector('.info');
597
- this.tooltip.querySelector("#tooltip-text").innerHTML =
598
- `<div><strong>${datestr}</strong>: ${value}</div><ul>${info ? info.innerHTML : ''}</ul>`;
666
+
667
+ this.tooltip.style.left = `${offset}px`;
668
+
669
+ // Calculate precise chevron position to point to the bin
670
+ const binCenter = centerPosition;
671
+ const tooltipLeft = offset;
672
+ const chevronPosition = Math.max(10, Math.min(tooltipWidth - 10, binCenter - tooltipLeft));
673
+ this.tooltip.style.setProperty('--chevron-position', `${chevronPosition}px`);
674
+ this.tooltip.classList.add('chevron-precise');
599
675
  }
600
676
 
601
677
  _showtooltipSelection() {
602
678
  const selectedBins = this._getSelectedBins();
603
679
  const intervalStart = this._getElementInterval(selectedBins[0])[0]; // get first selected element left boundary
604
- const intervalEnd = this._getElementInterval(selectedBins[selectedBins.length-1])[1]; // get last selected element right boundary
680
+ const intervalEnd = this._getElementInterval(selectedBins[selectedBins.length - 1])[1]; // get last selected element right boundary
605
681
  const interval = [intervalStart, intervalEnd];
606
- const label = `${selectedBins[0].dataset.selectionstart} - ${selectedBins[selectedBins.length-1].dataset.selectionend}`;
682
+ const label = `${selectedBins[0].dataset.selectionstart} - ${
683
+ selectedBins[selectedBins.length - 1].dataset.selectionend
684
+ }`;
607
685
  const value = selectedBins.map(bin => Number(bin.dataset.value)).reduce((a, b) => a + b);
608
686
  const valueFormatted = this._numberWithCommas(value);
609
- this.tooltip.querySelector("#tooltip-text").innerHTML = `<strong>${label}</strong>: ${valueFormatted}`;
610
- this.tooltip.querySelector("#tooltip-close").classList.remove("hidden");
611
- this.tooltip.classList.add("draggable");
612
- const offset = Math.round((((interval[0] + interval[1]) / 2) - this.tooltip.offsetWidth / 2));
613
- this.tooltip.style.left = offset + "px";
687
+ this.tooltip.querySelector(
688
+ '.tooltip-text',
689
+ ).innerHTML = `<strong>${label}</strong>: ${valueFormatted}`;
690
+ this.tooltip.querySelector('.tooltip-close').classList.remove('hidden');
691
+ this.tooltip.classList.add('draggable');
692
+
693
+ // Force a reflow to get accurate tooltip dimensions
694
+ this.tooltip.style.visibility = 'hidden';
695
+ this.tooltip.style.display = 'block';
696
+ const tooltipWidth = this.tooltip.offsetWidth;
697
+ this.tooltip.style.visibility = '';
698
+ this.tooltip.style.display = '';
699
+
700
+ const wrapper = this.shadowRoot.querySelector('.wrapper');
701
+ const wrapperRect = wrapper.getBoundingClientRect();
702
+ const wrapperWidth = wrapperRect.width;
703
+
704
+ const centerPosition = Math.round((interval[0] + interval[1]) / 2);
705
+ let offset;
706
+
707
+ // Clear any existing chevron positioning classes
708
+ this.tooltip.classList.remove('chevron-precise');
709
+
710
+ // Check if tooltip would overflow on the right
711
+ if (centerPosition + tooltipWidth / 2 > wrapperWidth) {
712
+ // Position tooltip to the right of the selection, aligned to the right edge
713
+ offset = Math.max(0, interval[1] - tooltipWidth + 10);
714
+ this.tooltip.classList.add('right');
715
+ } else if (centerPosition - tooltipWidth / 2 < 0) {
716
+ // Position tooltip to the left of the selection, aligned to the left edge
717
+ offset = Math.min(wrapperWidth - tooltipWidth, interval[0] - 10);
718
+ this.tooltip.classList.remove('right');
719
+ } else {
720
+ // Center the tooltip
721
+ offset = centerPosition - tooltipWidth / 2;
722
+ this.tooltip.classList.remove('right');
723
+ }
724
+
725
+ this.tooltip.style.left = `${offset}px`;
726
+
727
+ // Calculate precise chevron position to point to the center of the selection
728
+ const selectionCenter = centerPosition;
729
+ const tooltipLeft = offset;
730
+ const chevronPosition = Math.max(10, Math.min(tooltipWidth - 10, selectionCenter - tooltipLeft));
731
+ this.tooltip.style.setProperty('--chevron-position', `${chevronPosition}px`);
732
+ this.tooltip.classList.add('chevron-precise');
614
733
  }
615
734
 
616
735
  _resetTooltip() {
617
736
  this._hideTooltip();
618
737
  this.tooltip.style.left = '-1000px';
619
- this.tooltip.querySelector("#tooltip-text").innerHTML = "";
738
+ this.tooltip.querySelector('.tooltip-text').innerHTML = '';
620
739
  }
621
740
 
622
741
  _hideTooltip() {
623
742
  if (this.selection.start === undefined) {
624
- this.tooltip.classList.add("hidden");
625
- this.tooltip.classList.remove("draggable");
626
- this.tooltip.querySelector("#tooltip-close").classList.add("hidden");
743
+ this.tooltip.classList.add('hidden');
744
+ this.tooltip.classList.remove('draggable');
745
+ this.tooltip.querySelector('.tooltip-close').classList.add('hidden');
746
+ // Clear chevron positioning classes
747
+ this.tooltip.classList.remove('chevron-precise');
627
748
  }
628
749
  }
629
750
 
630
751
  _displayTooltip() {
631
- this.tooltip.classList.remove("hidden");
752
+ this.tooltip.classList.remove('hidden');
632
753
  }
633
754
 
634
755
  _getElementInterval(nodeElement) {
635
- let rect = this.shadowRoot.querySelector(".wrapper").getBoundingClientRect();
636
- let bin = nodeElement;
637
- let interval = [bin.getBoundingClientRect().x, bin.getBoundingClientRect().x + bin.getBoundingClientRect().width]
638
- let x1 = interval[0] - rect.left + 1; //x position within the element.
639
- let x2 = interval[1] - rect.left + 1; //x position within the element.
756
+ const rect = this.shadowRoot.querySelector('.wrapper').getBoundingClientRect();
757
+ const bin = nodeElement;
758
+ const interval = [
759
+ bin.getBoundingClientRect().x,
760
+ bin.getBoundingClientRect().x + bin.getBoundingClientRect().width,
761
+ ];
762
+ const x1 = interval[0] - rect.left + 1; // x position within the element.
763
+ const x2 = interval[1] - rect.left + 1; // x position within the element.
640
764
  return [x1, x2, rect.width / 2];
641
765
  }
642
766
 
@@ -645,16 +769,16 @@ export class PbTimeline extends pbMixin(LitElement) {
645
769
  }
646
770
 
647
771
  _getSelectedBins() {
648
- return Array.prototype.slice.call(this.bins).filter(binContainer => {
649
- return binContainer.classList.contains("selected");
650
- });
772
+ return Array.prototype.slice
773
+ .call(this.bins)
774
+ .filter(binContainer => binContainer.classList.contains('selected'));
651
775
  }
652
776
 
653
777
  _resetSelectionProperty() {
654
778
  this.selection = {
655
779
  start: undefined,
656
- end: undefined
657
- }
780
+ end: undefined,
781
+ };
658
782
  }
659
783
 
660
784
  _applySelectionToBins() {
@@ -663,18 +787,19 @@ export class PbTimeline extends pbMixin(LitElement) {
663
787
  const elInterval = this._getElementInterval(bin);
664
788
  // if (this.intervalsOverlapping(elInterval, selectionInterval)) {
665
789
  if (this._areOverlapping(elInterval, selectionInterval)) {
666
- bin.classList.add("selected");
790
+ bin.classList.add('selected');
667
791
  } else {
668
- bin.classList.remove("selected");
792
+ bin.classList.remove('selected');
669
793
  }
670
- })
794
+ });
671
795
  }
672
796
 
673
797
  _numberWithCommas(input) {
674
- return new Intl.NumberFormat(this._language, {style: 'decimal'}).format(input);
798
+ return new Intl.NumberFormat(this._language, { style: 'decimal' }).format(input);
675
799
  }
676
800
 
677
- _areOverlapping(A, B) { // check if 2 intervals are overlapping
801
+ _areOverlapping(A, B) {
802
+ // check if 2 intervals are overlapping
678
803
  return B[0] < A[0] ? B[1] > A[0] : B[0] < A[1];
679
804
  }
680
805
 
@@ -682,40 +807,42 @@ export class PbTimeline extends pbMixin(LitElement) {
682
807
  return html`
683
808
  <div class="label" part="label">
684
809
  <span class="label"><slot name="label"></slot>${this.label}</span>
685
- ${
686
- this.resettable ? html`
687
- <paper-icon-button id="clear" icon="icons:clear" title="${translate('timeline.clear')}"
688
- @click="${this._dispatchPbTimelineResetSelectionEvent}"></paper-icon-button>
689
- ` : null
690
- }
810
+ ${this.resettable
811
+ ? html`
812
+ <button id="clear" title="${translate('timeline.clear')}"
813
+ @click="${this._dispatchPbTimelineResetSelectionEvent}"></button>
814
+ `
815
+ : null}
691
816
  </div>
692
- <div class="wrapper ${!this.dataObj || this.dataObj.data.length <= 1 ? 'empty' : ''}"
817
+ <div
818
+ class="wrapper ${!this.dataObj || this.dataObj.data.length <= 1 ? 'empty' : ''}"
693
819
  @mouseenter="${this._mouseenter}"
694
- @mouseleave="${this._hideTooltip}">
695
- ${this.dataObj ? this.renderBins() : ""}
696
- ${this.renderTooltip()}
820
+ @mouseleave="${this._hideTooltip}"
821
+ >
822
+ ${this.dataObj ? this.renderBins() : ''} ${this.renderTooltip()}
697
823
  <iron-ajax
698
- id="loadData"
699
- verbose
700
- handle-as="json"
701
- method="get"
702
- with-credentials
703
- @response="${this._handleResponse}"
704
- url="${this.url}?start=${this.startDate}&end=${this.endDate}"
705
- ?auto="${this.auto}"></iron-ajax>
824
+ id="loadData"
825
+ verbose
826
+ handle-as="json"
827
+ method="get"
828
+ with-credentials
829
+ @response="${this._handleResponse}"
830
+ url="${this.url}?start=${this.startDate}&end=${this.endDate}"
831
+ ?auto="${this.auto}"
832
+ ></iron-ajax>
706
833
  </div>
707
834
  `;
708
835
  }
709
836
 
710
837
  renderTooltip() {
711
838
  return html`
712
- <div id="tooltip" class="hidden" part="tooltip">
713
- <div id="tooltip-text"></div>
839
+ <div class="tooltip hidden" part="tooltip">
840
+ <div class="tooltip-text"></div>
714
841
  <div
715
- id="tooltip-close"
716
- class="hidden"
842
+ class="tooltip-close hidden"
717
843
  @click="${this._dispatchPbTimelineResetSelectionEvent}"
718
- ><span class="close rounded black"></span>
844
+ >
845
+ <span class="close rounded black"></span>
719
846
  </div>
720
847
  </div>
721
848
  `;
@@ -723,10 +850,11 @@ export class PbTimeline extends pbMixin(LitElement) {
723
850
 
724
851
  renderBins() {
725
852
  return html`
726
- ${this.dataObj.data.map((binObj, indx) => {
727
- return html`
728
- <div class="bin-container ${binObj.seperator ? "border-left" : ""}
729
- ${indx % 2 === 0 ? "grey" : "white"} ${binObj.category === '?' ? 'unknown' : ''}"
853
+ ${this.dataObj.data.map(
854
+ (binObj, indx) => html`
855
+ <div
856
+ class="bin-container ${binObj.seperator ? 'border-left' : ''}
857
+ ${indx % 2 === 0 ? 'grey' : 'white'} ${binObj.category === '?' ? 'unknown' : ''}"
730
858
  data-tooltip="${binObj.tooltip}"
731
859
  data-category="${binObj.category}"
732
860
  data-selectionstart="${binObj.selectionStart}"
@@ -735,20 +863,24 @@ export class PbTimeline extends pbMixin(LitElement) {
735
863
  data-datestr="${binObj.dateStr}"
736
864
  data-value="${binObj.value}"
737
865
  @mousemove="${this._mouseMove}"
738
- @mousedown="${this._mouseDown}">
739
- <div class="bin" style="height: ${(binObj.value / this.maxValue) * this.maxHeight * this.multiplier}px"></div>
740
- <p class="bin-title
741
- ${this.dataObj.binTitleRotated ? "rotated" : ""}
866
+ @mousedown="${this._mouseDown}"
867
+ >
868
+ <div
869
+ class="bin"
870
+ style="height: ${(binObj.value / this.maxValue) * this.maxHeight * this.multiplier}px"
871
+ ></div>
872
+ <p
873
+ class="bin-title
874
+ ${this.dataObj.binTitleRotated ? 'rotated' : ''}
742
875
  ${this.scope}"
743
- >${binObj.binTitle ? binObj.binTitle : ""}
876
+ >
877
+ ${binObj.binTitle ? binObj.binTitle : ''}
744
878
  </p>
745
- ${binObj.title ? html`
746
- <p class="bins-title" part="title">${binObj.title}</p>
747
- ` : ""}
879
+ ${binObj.title ? html` <p class="bins-title" part="title">${binObj.title}</p> ` : ''}
748
880
  ${this.renderInfo(binObj)}
749
881
  </div>
750
- `;
751
- })}
882
+ `,
883
+ )}
752
884
  `;
753
885
  }
754
886
 
@@ -756,34 +888,35 @@ export class PbTimeline extends pbMixin(LitElement) {
756
888
  if (binObj.info && binObj.info.length > 0 && binObj.info.length <= 10) {
757
889
  return html`
758
890
  <ul class="info">
759
- ${ binObj.info.map(info => html`<li>${unsafeHTML(info)}</li>`) }
891
+ ${binObj.info.map(info => html`<li>${unsafeHTML(info)}</li>`)}
760
892
  </ul>
761
893
  `;
762
894
  }
763
895
  return null;
764
896
  }
765
897
 
766
- async _handleResponse (){
767
- await this.updateComplete;
768
- const loader = this.shadowRoot.getElementById('loadData');
769
- const data = loader.lastResponse;
898
+ async _handleResponse() {
899
+ await this.updateComplete;
900
+ const loader = this.shadowRoot.getElementById('loadData');
901
+ const data = loader.lastResponse;
770
902
 
771
- let newJsonData = {};
772
- if (this.startDate && this.endDate) {
773
- Object.keys(data).filter(key => key >= this.startDate && key < this.endDate).forEach(key => {
774
- newJsonData[key] = data[key];
775
- });
776
- } else {
777
- newJsonData = data;
778
- }
779
- this.searchResult = new SearchResultService(newJsonData, this.maxInterval, this.scopes);
780
- this.setData(this.searchResult.export(this.scope));
781
- this.emitTo('pb-timeline-loaded', {
782
- value: true,
783
- label: this.label
903
+ let newJsonData = {};
904
+ if (this.startDate && this.endDate) {
905
+ Object.keys(data)
906
+ .filter(key => key >= this.startDate && key < this.endDate)
907
+ .forEach(key => {
908
+ newJsonData[key] = data[key];
784
909
  });
910
+ } else {
911
+ newJsonData = data;
785
912
  }
786
-
913
+ this.searchResult = new SearchResultService(newJsonData, this.maxInterval, this.scopes);
914
+ this.setData(this.searchResult.export(this.scope));
915
+ this.emitTo('pb-timeline-loaded', {
916
+ value: true,
917
+ label: this.label,
918
+ });
919
+ }
787
920
  }
788
921
 
789
922
  customElements.define('pb-timeline', PbTimeline);