@teipublisher/pb-components 1.32.0 → 1.33.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/pb-elements.json CHANGED
@@ -3755,6 +3755,7 @@
3755
3755
  },
3756
3756
  {
3757
3757
  "name": "event",
3758
+ "description": "Name of the event which triggers a pb-geolocation event, e.g. 'click'.\nDefault is 'mouseover'.",
3758
3759
  "type": "string",
3759
3760
  "default": "\"mouseover\""
3760
3761
  },
@@ -3764,6 +3765,11 @@
3764
3765
  "type": "boolean",
3765
3766
  "default": "false"
3766
3767
  },
3768
+ {
3769
+ "name": "zoom",
3770
+ "description": "Zoom level to use for the map if it centers on the location.",
3771
+ "type": "number"
3772
+ },
3767
3773
  {
3768
3774
  "name": "key",
3769
3775
  "description": "The key to which this element is connected.",
@@ -3842,6 +3848,7 @@
3842
3848
  {
3843
3849
  "name": "event",
3844
3850
  "attribute": "event",
3851
+ "description": "Name of the event which triggers a pb-geolocation event, e.g. 'click'.\nDefault is 'mouseover'.",
3845
3852
  "type": "string",
3846
3853
  "default": "\"mouseover\""
3847
3854
  },
@@ -3852,6 +3859,12 @@
3852
3859
  "type": "boolean",
3853
3860
  "default": "false"
3854
3861
  },
3862
+ {
3863
+ "name": "zoom",
3864
+ "attribute": "zoom",
3865
+ "description": "Zoom level to use for the map if it centers on the location.",
3866
+ "type": "number"
3867
+ },
3855
3868
  {
3856
3869
  "name": "key",
3857
3870
  "attribute": "key",
@@ -4592,6 +4605,11 @@
4592
4605
  "type": "boolean",
4593
4606
  "default": "false"
4594
4607
  },
4608
+ {
4609
+ "name": "disable-clustering-at",
4610
+ "description": "Limits up to which zoom level markers are arranged into clusters.\nUsing a higher zoom level here will result in more markers to be shown.\n\nRequires `cluster` option to be enabled.",
4611
+ "type": "number"
4612
+ },
4595
4613
  {
4596
4614
  "name": "subscribe",
4597
4615
  "description": "The name of the channel to subscribe to. Only events on a channel corresponding\nto this property are listened to.",
@@ -4695,6 +4713,12 @@
4695
4713
  "type": "boolean",
4696
4714
  "default": "false"
4697
4715
  },
4716
+ {
4717
+ "name": "disableClusteringAt",
4718
+ "attribute": "disable-clustering-at",
4719
+ "description": "Limits up to which zoom level markers are arranged into clusters.\nUsing a higher zoom level here will result in more markers to be shown.\n\nRequires `cluster` option to be enabled.",
4720
+ "type": "number"
4721
+ },
4698
4722
  {
4699
4723
  "name": "subscribe",
4700
4724
  "attribute": "subscribe",
@@ -4740,15 +4764,15 @@
4740
4764
  },
4741
4765
  {
4742
4766
  "name": "pb-update-map",
4743
- "description": "When received, redraws the map to fit markers passed in with the event"
4767
+ "description": "When received, redraws the map to fit markers passed in with the event.\nEvent details should include an array of locations, see `pb-geolocation` event below."
4744
4768
  },
4745
4769
  {
4746
4770
  "name": "pb-update",
4747
- "description": "When received, redraws the map to show markers for all pb-geolocation elements"
4771
+ "description": "When received, redraws the map to show markers for all pb-geolocation elements found in the content of the pb-view"
4748
4772
  },
4749
4773
  {
4750
4774
  "name": "pb-geolocation",
4751
- "description": "When received, focuses the map on the geocoordinates passed in with the event"
4775
+ "description": "When received, focuses the map on the geocoordinates passed in with the event.\nThe event details should include an object:\n```\n{\ncoordinates: {\n latitude: Number,\n longitude: Number\n},\nlabel: string - the label to show on mouseover,\nzoom: Number - fixed zoom level to zoom to,\nfitBounds: Boolean - if true, recompute current zoom level to show all markers\n}\n```"
4752
4776
  }
4753
4777
  ],
4754
4778
  "slots": [
@@ -9447,6 +9471,254 @@
9447
9471
  }
9448
9472
  ]
9449
9473
  },
9474
+ {
9475
+ "name": "pb-timeline",
9476
+ "path": "./src/pb-timeline.js",
9477
+ "description": "A timeline component to display time series data in a bar chart like view.\n\nTime series data can be displayed in one of 6 different scales:\n\n- by decade (10Y)\n- by 5 years (5Y)\n- by years (Y)\n- by month (M)\n- by week (W)\n- by day (D)\n\nThe endpoint is expected to return a JSON object. Each property should either be a date or the special\nmarker `?`, which indicates undated resources.\nThe value associated with each entry\nshould either correspond to a count of resources or an object with properties `count` and `info`. \n`info` should be an array, containing HTML to be shown in a list within the tooltips.",
9478
+ "attributes": [
9479
+ {
9480
+ "name": "start-date",
9481
+ "description": "start date for timeline to display",
9482
+ "type": "string",
9483
+ "default": "\"\""
9484
+ },
9485
+ {
9486
+ "name": "end-date",
9487
+ "description": "endDate for timeline to display",
9488
+ "type": "string",
9489
+ "default": "\"\""
9490
+ },
9491
+ {
9492
+ "name": "scope",
9493
+ "description": "The scope for the timeline. Must be one of the pre-defined scopes.\nIf not set, the component automatically tries to determine the best scope fitting the\ngiven time series.",
9494
+ "type": "string",
9495
+ "default": "\"\""
9496
+ },
9497
+ {
9498
+ "name": "scopes",
9499
+ "description": "The scopes to consider for automatic scoping.\n\nDefaults to [\"D\", \"W\", \"M\", \"Y\", \"5Y\", \"10Y\"]",
9500
+ "type": "array",
9501
+ "default": "[\"D\",\"W\",\"M\",\"Y\",\"5Y\",\"10Y\"]"
9502
+ },
9503
+ {
9504
+ "name": "url",
9505
+ "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.",
9506
+ "type": "string",
9507
+ "default": "\"\""
9508
+ },
9509
+ {
9510
+ "name": "auto",
9511
+ "description": "If set, data will be retrieved automatically on first load.",
9512
+ "type": "boolean",
9513
+ "default": "false"
9514
+ },
9515
+ {
9516
+ "name": "resettable",
9517
+ "type": "boolean",
9518
+ "default": "false"
9519
+ },
9520
+ {
9521
+ "name": "subscribe",
9522
+ "description": "The name of the channel to subscribe to. Only events on a channel corresponding\nto this property are listened to.",
9523
+ "type": "string"
9524
+ },
9525
+ {
9526
+ "name": "subscribe-config",
9527
+ "description": "Configuration object to define a channel/event mapping. Every property\nin the object is interpreted as the name of a channel and its value should\nbe an array of event names to listen to.",
9528
+ "type": "object"
9529
+ },
9530
+ {
9531
+ "name": "emit",
9532
+ "description": "The name of the channel to send events to.",
9533
+ "type": "string"
9534
+ },
9535
+ {
9536
+ "name": "emit-config",
9537
+ "description": "Configuration object to define a channel/event mapping. Every property\nin the object is interpreted as the name of a channel and its value should\nbe an array of event names to be dispatched.",
9538
+ "type": "object"
9539
+ },
9540
+ {
9541
+ "name": "wait-for",
9542
+ "description": "A selector pointing to other components this component depends on.\nWhen method `wait` is called, it will wait until all referenced\ncomponents signal with a `pb-ready` event that they are ready and listening\nto events.",
9543
+ "type": "string"
9544
+ },
9545
+ {
9546
+ "name": "disabled",
9547
+ "description": "Common property to disable the functionality associated with a component.\n`pb-highlight` and `pb-popover` react to this.",
9548
+ "type": "boolean",
9549
+ "default": "false"
9550
+ }
9551
+ ],
9552
+ "properties": [
9553
+ {
9554
+ "name": "label"
9555
+ },
9556
+ {
9557
+ "name": "maxHeight",
9558
+ "type": "number",
9559
+ "default": "80"
9560
+ },
9561
+ {
9562
+ "name": "multiplier",
9563
+ "type": "number",
9564
+ "default": "0.75"
9565
+ },
9566
+ {
9567
+ "name": "mousedown",
9568
+ "type": "boolean",
9569
+ "default": "false"
9570
+ },
9571
+ {
9572
+ "name": "startDate",
9573
+ "attribute": "start-date",
9574
+ "description": "start date for timeline to display",
9575
+ "type": "string",
9576
+ "default": "\"\""
9577
+ },
9578
+ {
9579
+ "name": "endDate",
9580
+ "attribute": "end-date",
9581
+ "description": "endDate for timeline to display",
9582
+ "type": "string",
9583
+ "default": "\"\""
9584
+ },
9585
+ {
9586
+ "name": "scope",
9587
+ "attribute": "scope",
9588
+ "description": "The scope for the timeline. Must be one of the pre-defined scopes.\nIf not set, the component automatically tries to determine the best scope fitting the\ngiven time series.",
9589
+ "type": "string",
9590
+ "default": "\"\""
9591
+ },
9592
+ {
9593
+ "name": "scopes",
9594
+ "attribute": "scopes",
9595
+ "description": "The scopes to consider for automatic scoping.\n\nDefaults to [\"D\", \"W\", \"M\", \"Y\", \"5Y\", \"10Y\"]",
9596
+ "type": "array",
9597
+ "default": "[\"D\",\"W\",\"M\",\"Y\",\"5Y\",\"10Y\"]"
9598
+ },
9599
+ {
9600
+ "name": "url",
9601
+ "attribute": "url",
9602
+ "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.",
9603
+ "type": "string",
9604
+ "default": "\"\""
9605
+ },
9606
+ {
9607
+ "name": "auto",
9608
+ "attribute": "auto",
9609
+ "description": "If set, data will be retrieved automatically on first load.",
9610
+ "type": "boolean",
9611
+ "default": "false"
9612
+ },
9613
+ {
9614
+ "name": "resettable",
9615
+ "attribute": "resettable",
9616
+ "type": "boolean",
9617
+ "default": "false"
9618
+ },
9619
+ {
9620
+ "name": "subscribe",
9621
+ "attribute": "subscribe",
9622
+ "description": "The name of the channel to subscribe to. Only events on a channel corresponding\nto this property are listened to.",
9623
+ "type": "string"
9624
+ },
9625
+ {
9626
+ "name": "subscribeConfig",
9627
+ "attribute": "subscribe-config",
9628
+ "description": "Configuration object to define a channel/event mapping. Every property\nin the object is interpreted as the name of a channel and its value should\nbe an array of event names to listen to.",
9629
+ "type": "object"
9630
+ },
9631
+ {
9632
+ "name": "emit",
9633
+ "attribute": "emit",
9634
+ "description": "The name of the channel to send events to.",
9635
+ "type": "string"
9636
+ },
9637
+ {
9638
+ "name": "emitConfig",
9639
+ "attribute": "emit-config",
9640
+ "description": "Configuration object to define a channel/event mapping. Every property\nin the object is interpreted as the name of a channel and its value should\nbe an array of event names to be dispatched.",
9641
+ "type": "object"
9642
+ },
9643
+ {
9644
+ "name": "waitFor",
9645
+ "attribute": "wait-for",
9646
+ "description": "A selector pointing to other components this component depends on.\nWhen method `wait` is called, it will wait until all referenced\ncomponents signal with a `pb-ready` event that they are ready and listening\nto events.",
9647
+ "type": "string"
9648
+ },
9649
+ {
9650
+ "name": "disabled",
9651
+ "attribute": "disabled",
9652
+ "description": "Common property to disable the functionality associated with a component.\n`pb-highlight` and `pb-popover` react to this.",
9653
+ "type": "boolean",
9654
+ "default": "false"
9655
+ }
9656
+ ],
9657
+ "events": [
9658
+ {
9659
+ "name": "pb-timeline-date-changed",
9660
+ "description": "Triggered when user clicks on a single entry"
9661
+ },
9662
+ {
9663
+ "name": "pb-timeline-daterange-changed",
9664
+ "description": "Triggered when user selects a range of entries"
9665
+ },
9666
+ {
9667
+ "name": "pb-timeline-reset-selection",
9668
+ "description": "Requests that the timeline is reset to initial state"
9669
+ },
9670
+ {
9671
+ "name": "pb-timeline-loaded",
9672
+ "description": "Timeline was loaded"
9673
+ }
9674
+ ],
9675
+ "slots": [
9676
+ {
9677
+ "name": "label",
9678
+ "description": "Inserted before the label showing the currently displayed time range"
9679
+ }
9680
+ ],
9681
+ "cssProperties": [
9682
+ {
9683
+ "name": "--pb-timeline-height"
9684
+ },
9685
+ {
9686
+ "name": "--pb-timeline-padding"
9687
+ },
9688
+ {
9689
+ "name": "--pb-timeline-color-highlight"
9690
+ },
9691
+ {
9692
+ "name": "--pb-timeline-color-light"
9693
+ },
9694
+ {
9695
+ "name": "--pb-timeline-color-dark"
9696
+ },
9697
+ {
9698
+ "name": "--pb-timeline-color-selected"
9699
+ },
9700
+ {
9701
+ "name": "--pb-timeline-color-bin"
9702
+ },
9703
+ {
9704
+ "name": "--pb-timeline-title-font-size"
9705
+ },
9706
+ {
9707
+ "name": "--pb-timeline-tooltip-font-size"
9708
+ }
9709
+ ],
9710
+ "cssParts": [
9711
+ {
9712
+ "name": "label"
9713
+ },
9714
+ {
9715
+ "name": "tooltip"
9716
+ },
9717
+ {
9718
+ "name": "title"
9719
+ }
9720
+ ]
9721
+ },
9450
9722
  {
9451
9723
  "name": "pb-toggle-feature",
9452
9724
  "path": "./src/pb-toggle-feature.js",
@@ -0,0 +1,266 @@
1
+ export class ParseDateService {
2
+ /*
3
+ * PARSE DATE SERVICE
4
+ * whenever the user types a date, it should be allowed
5
+ * to type in a lot of dirrerent date formats. This service
6
+ * should detect all of the supported formats. Some supported formats:
7
+ * - 1. April 1970 => 1970-04-01
8
+ * - 1970 => 1970-01-01
9
+ * - 1970-12-23 => 1970-12-23
10
+ * - 1900 12 23 => 1900-12-23
11
+ * - 1 jan 1970 => 1970-01-01
12
+ * - 2020-W12 => 2020-03-16
13
+ * - 2020-01 => 2020-01-01
14
+ * For all formats check the tests written in AVA `test/parse-date-service-test.js`
15
+ *
16
+ * public methods
17
+ * run()
18
+ */
19
+ constructor() {
20
+ }
21
+
22
+ run (input) {
23
+ this.input = input;
24
+ this.day = "??";
25
+ this.month = "??";
26
+ this.year = "????";
27
+
28
+ const resultIsoMatch = this.input.match(this._isoMatchRegex());
29
+ const resultCustomMatch = this.input.match(this._customRegex());
30
+ const resultWeekMatch = this.input.match(this._weekMatchRegex());
31
+ const resultYearAndMonthMatch = this.input.match(this._yearAndMonthRegex());
32
+ if (resultIsoMatch) {
33
+ const split = resultIsoMatch[0].split(/-|\/|\s/);
34
+ this.year = split[0];
35
+ this.month = this._setWithLeadingZero(split[1]);
36
+ this.day = this._setWithLeadingZero(split[2]);
37
+ } else if (resultYearAndMonthMatch) {
38
+ const split = resultYearAndMonthMatch[0].split("-");
39
+ this.year = split[0];
40
+ this.month = this._setWithLeadingZero(split[1]);
41
+ this.day = "01";
42
+ } else if (resultCustomMatch) {
43
+ const split = resultCustomMatch[0].split(/\.|\s|\/|-/);
44
+ this.day = this._setWithLeadingZero(split[0]);
45
+ this.month = this._setWithLeadingZero(split[1]);
46
+ this.year = split[2];
47
+ } else if (resultWeekMatch) {
48
+ const split = resultWeekMatch[0].split(/\.|\s|\/|-/);
49
+ const year = Number(split[0]);
50
+ const week = Number(split[1].replace("W0", "").replace("W", ""));
51
+ return this._getDateStrOfISOWeek(year, week);
52
+ } else {
53
+ this._findYear();
54
+ this._findMonth();
55
+ this._findDay();
56
+ }
57
+ return this._buildResult();
58
+ }
59
+
60
+ _buildResult() {
61
+ if (this.year != "????" && this.month === "??") {
62
+ this.month = "01";
63
+ }
64
+ if (this.month != "??" && this.day === "??") {
65
+ this.day = "01";
66
+ }
67
+ return `${this.year}-${this.month}-${this.day}`;
68
+ }
69
+
70
+ /*
71
+ * matches ISO string format (with some extensions)
72
+ * | 2012-01-31 | 2012-1-31 | 2012/01/31 |
73
+ * | 2012/1/31 | 2012 1 31 | 2012 01 31 |
74
+ */
75
+ _isoMatchRegex() {
76
+ return /(?<=\s|^)\d{4}(-|\s|\/)([0][1-9]|[1-9]|10|11|12)(-|\s|\/)([0][1-9]|[1-2][0-9]|3[01]|[1-9])(?=\s|$|\.)/;
77
+ /* | | year | 01-09 | 1-9 | 10-12 | |01-09 |10-29 |30,31| 1-9 |
78
+ * | | dash or slash | dash or slash |
79
+ * |preceding with space or start of string end with space endofstr or dot <-|*/
80
+ }
81
+
82
+ /*
83
+ * matches a custom date string format (reversed order, day-month-year)
84
+ * | 12.3.2000 | 1.2.2012 | 1-2-2012 |
85
+ * | 12/3/2000 | 1 2 2012 | 1/2/2012 |
86
+ */
87
+ _customRegex() {
88
+ return /\d{1,2}(\.|\s|\/|-)\d{1,2}(\.|\s|\/|-)\d{4}/;
89
+ /* | day | | month | | year
90
+ * |___________________|
91
+ * |
92
+ * seperated by dot, space, slash or dash */
93
+ }
94
+
95
+ /*
96
+ * matches a date format that specifies the week
97
+ * | 2012-W1 | 2012 W1 | 2012 W01 |
98
+ * | 2020.W2 | 2020-W53 | 2012/W1 |
99
+ */
100
+ _weekMatchRegex() {
101
+ return /\d{4}(\.|\s|\/|-)W\d{1,2}(?=\s|$|\.)/;
102
+ /* |year | |W1-W53 |
103
+ * |___________________|
104
+ * |
105
+ * seperated by dot, space, slash or dash */
106
+ }
107
+
108
+ /*
109
+ * matches a date format with only year and month
110
+ * YYYY-MM (1-12)
111
+ * | 2020-01 | 2020-12 | 2012-1 |
112
+ */
113
+ _yearAndMonthRegex() {
114
+ return /(?<=\s|^)\d{4}-([0][1-9]|[1-9]|10|11|12)(?=\s|$)/;
115
+ }
116
+
117
+ _findYear() {
118
+ let regex = /[1-9]{1}[0-9]{3}/;
119
+ const result = this.input.match(regex)
120
+ if (result) {
121
+ this.year = result[0];
122
+ this._removeMatchFromInput(result);
123
+ }
124
+ }
125
+
126
+ _findMonth() {
127
+ const months = this._monthDictionaryValues();
128
+ months.forEach(month => {
129
+ let re = new RegExp(`(?<=\\s|^)(${month})(?=\\s|$|\\.)`, "i")
130
+ const result = this.input.match(re);
131
+ if (result) { // yes => get dict and value + return
132
+ this.month = this._monthDictionary()[result[0].toLowerCase()];
133
+ this._removeMatchFromInput(result);
134
+ return this.month;
135
+ }
136
+ })
137
+ return undefined;
138
+ }
139
+
140
+ /*
141
+ * find single numbers from 1-31
142
+ */
143
+ _findDay() {
144
+ let regex = /(?<=\s|^)([0][1-9]|[1-2][0-9]|3[01]|[1-9])(?=\s|$|\.|st|nd|rd|th)/;
145
+ /* | | 01-09 | 10-29 |30,31|1-9 | ends with whitespace, endofstr or dot.
146
+ * | starts with whitepace or startoftr | won't be included in match (lookbehind operator)
147
+ * | look behind operator (not included)
148
+ * | https://stackoverflow.com/a/6713378/6272061 */
149
+ const result = this.input.match(regex)
150
+ if (result) {
151
+ this.day = this._setWithLeadingZero(result[0]);
152
+ }
153
+ }
154
+
155
+ /*
156
+ * if a string or number has only 1 digit or char
157
+ * a leading zro is added
158
+ * returns a string
159
+ */
160
+ _setWithLeadingZero(input) {
161
+ input = input.toString();
162
+ if (input.length == 1) {
163
+ return "0" + input;
164
+ } else {
165
+ return input;
166
+ }
167
+ }
168
+
169
+ _removeMatchFromInput(matchObj) {
170
+ if (matchObj && matchObj[0] && matchObj.index) {
171
+ let len = matchObj[0].length;
172
+ let charArr = this.input.split('');
173
+ charArr.splice(matchObj.index, len);
174
+ this.input = charArr.join("");
175
+ }
176
+ }
177
+
178
+ _monthDictionaryValues() {
179
+ return Object.keys(this._monthDictionary());
180
+ }
181
+ _monthDictionary() {
182
+ return {
183
+ // german
184
+ "jan": "01", "januar": "01",
185
+ "feb": "02", "februar": "02",
186
+ "mär": "03", "märz": "03",
187
+ "apr": "04", "april": "04",
188
+ "mai": "05", "mai": "05",
189
+ "jun": "06", "juni": "06",
190
+ "jul": "07", "juli": "07",
191
+ "aug": "08", "august": "08",
192
+ "sep": "09", "september": "09",
193
+ "okt": "10", "oktober": "10",
194
+ "nov": "11", "november": "11",
195
+ "dez": "12", "dezember": "12",
196
+ // english
197
+ "jan": "01", "january": "01",
198
+ "feb": "02", "february": "02",
199
+ "mar": "03", "march": "03",
200
+ "apr": "04", "april": "04",
201
+ "may": "05", "may": "05",
202
+ "jun": "06", "june": "06",
203
+ "jul": "07", "july": "07",
204
+ "aug": "08", "august": "08",
205
+ "sep": "09", "september": "09",
206
+ "oct": "10", "october": "10",
207
+ "nov": "11", "november": "11",
208
+ "dec": "12", "december": "12",
209
+ // french
210
+ "janv":"01", "janvier": "01",
211
+ "févr":"02", "février'": "02",
212
+ "mars":"03", "mars": "03",
213
+ "avr": "04", "avril": "04",
214
+ "mai": "05", "mai": "05",
215
+ "juin":"06", "juin": "06",
216
+ "juil":"07", "juillet": "07",
217
+ "août":"08", "août": "08",
218
+ "sept":"09", "septembre": "09",
219
+ "oct": "10", "octobre": "10",
220
+ "nov": "11", "novembre": "11",
221
+ "déc": "12", "décembre": "12",
222
+ //italian
223
+ "gen": "01", "gennaio": "01",
224
+ "feb": "02", "febbraio": "02",
225
+ "mar": "03", "marzo": "03",
226
+ "apr": "04", "aprile": "04",
227
+ "mag": "05", "maggio": "05",
228
+ "giu": "06", "giugno": "06",
229
+ "lug": "07", "luglio": "07",
230
+ "ago": "08", "agosto": "08",
231
+ "set": "09", "settembre": "09",
232
+ "ott": "10", "ottobre": "10",
233
+ "nov": "11", "novembre": "11",
234
+ "dic": "12", "dicembre": "12",
235
+ }
236
+ }
237
+
238
+ _getDateStrOfISOWeek(y, w) {
239
+ let simple = new Date(y, 0, 1 + (w - 1) * 7);
240
+ let dow = simple.getDay();
241
+ let ISOweekStart = simple;
242
+ if (dow <= 4) {
243
+ ISOweekStart.setDate(simple.getDate() - simple.getDay() + 1);
244
+ } else {
245
+ ISOweekStart.setDate(simple.getDate() + 8 - simple.getDay());
246
+ }
247
+ // do not rollover to next or previous year
248
+ if (ISOweekStart.getFullYear() > y) {
249
+ return `${y}-12-31`;
250
+ } else if (ISOweekStart.getFullYear() < y) {
251
+ return `${y}-01-01`;
252
+ }
253
+ return this._dateToDateStr(ISOweekStart);
254
+ }
255
+
256
+ /*
257
+ * formats date object to dateStr YYYY-MM-DD
258
+ */
259
+ _dateToDateStr(date) {
260
+ let d = new Date(date);
261
+ let month = this._setWithLeadingZero((d.getMonth() + 1));
262
+ let day = this._setWithLeadingZero(d.getDate());
263
+ let year = d.getFullYear();
264
+ return `${year}-${month}-${day}`;
265
+ }
266
+ }
@@ -206,6 +206,7 @@ export class PbBrowseDocs extends PbLoad {
206
206
  }
207
207
  </style>
208
208
  </custom-style>
209
+ <slot name="header"></slot>
209
210
  <div class="toolbar">
210
211
  <paper-dropdown-menu id="sort" label="${translate(this.sortLabel)}" part="sort-dropdown">
211
212
  <paper-listbox id="sort-list" selected="${this.sortBy}" slot="dropdown-content" class="dropdown-content" attr-for-selected="value">
@@ -58,6 +58,7 @@ import './pb-blacklab-results.js';
58
58
  import './pb-blacklab-highlight.js';
59
59
  import './pb-table-grid.js';
60
60
  import './pb-split-list.js';
61
+ import './pb-timeline.js';
61
62
 
62
63
  import '@polymer/iron-icons/editor-icons';
63
64
  import '@polymer/iron-icons/social-icons';
@@ -30,9 +30,19 @@ export class PbGeolocation extends PbHighlight {
30
30
  label: {
31
31
  type: String
32
32
  },
33
+ /**
34
+ * Name of the event which triggers a pb-geolocation event, e.g. 'click'.
35
+ * Default is 'mouseover'.
36
+ */
33
37
  event: {
34
38
  type: String
35
39
  },
40
+ /**
41
+ * Zoom level to use for the map if it centers on the location.
42
+ */
43
+ zoom: {
44
+ type: Number
45
+ },
36
46
  /**
37
47
  * If set, add location to a map automatically upon load by
38
48
  * emitting an event. If not set, locations are only added when
@@ -48,6 +58,7 @@ export class PbGeolocation extends PbHighlight {
48
58
  super();
49
59
  this.event = 'mouseover';
50
60
  this.auto = false;
61
+ this.zoom = null;
51
62
  }
52
63
 
53
64
  connectedCallback() {
@@ -61,6 +72,7 @@ export class PbGeolocation extends PbHighlight {
61
72
  longitude: this.longitude
62
73
  },
63
74
  label: this.label,
75
+ zoom: this.zoom,
64
76
  popup: this.popup,
65
77
  element: this
66
78
  })