@teipublisher/pb-components 2.25.5 → 2.25.6

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 (128) 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 +3 -3
  4. package/CHANGELOG.md +8 -0
  5. package/Dockerfile +78 -70
  6. package/css/components.css +5 -5
  7. package/dist/demo/pb-drawer2.html +1 -1
  8. package/dist/demo/pb-leaflet-map.html +1 -1
  9. package/dist/demo/pb-repeat.html +1 -3
  10. package/dist/demo/pb-view3.html +1 -1
  11. package/dist/{paper-icon-button-0fb125c4.js → paper-icon-button-72125e67.js} +1 -1
  12. package/dist/pb-code-editor.js +25 -20
  13. package/dist/pb-component-docs.js +58 -54
  14. package/dist/pb-components-bundle.js +1827 -1520
  15. package/dist/pb-edit-app.js +167 -107
  16. package/dist/pb-elements.json +54 -54
  17. package/dist/{pb-i18n-0611135a.js → pb-i18n-4cc00bfe.js} +1 -1
  18. package/dist/pb-leaflet-map.js +23 -23
  19. package/dist/pb-mei.js +56 -41
  20. package/dist/{pb-mixin-b1caa22e.js → pb-mixin-886ece32.js} +1 -1
  21. package/dist/pb-odd-editor.js +925 -758
  22. package/dist/pb-tify.js +2 -2
  23. package/dist/{vaadin-element-mixin-859a0132.js → vaadin-element-mixin-ad07ba25.js} +88 -61
  24. package/gh-pages.js +5 -3
  25. package/package.json +2 -2
  26. package/pb-elements.json +54 -54
  27. package/src/assets/components.css +5 -5
  28. package/src/authority/airtable.js +20 -21
  29. package/src/authority/anton.js +129 -129
  30. package/src/authority/custom.js +23 -21
  31. package/src/authority/geonames.js +38 -32
  32. package/src/authority/gnd.js +47 -42
  33. package/src/authority/kbga.js +137 -134
  34. package/src/authority/metagrid.js +44 -46
  35. package/src/authority/reconciliation.js +66 -67
  36. package/src/authority/registry.js +4 -4
  37. package/src/docs/pb-component-docs.js +2 -2
  38. package/src/docs/pb-component-view.js +5 -5
  39. package/src/docs/pb-components-list.js +2 -2
  40. package/src/docs/pb-demo-snippet.js +2 -2
  41. package/src/dts-client.js +299 -297
  42. package/src/dts-select-endpoint.js +90 -82
  43. package/src/parse-date-service.js +184 -135
  44. package/src/pb-ajax.js +171 -167
  45. package/src/pb-authority-lookup.js +96 -81
  46. package/src/pb-autocomplete.js +292 -280
  47. package/src/pb-blacklab-highlight.js +264 -259
  48. package/src/pb-blacklab-results.js +236 -221
  49. package/src/pb-browse-docs.js +540 -475
  50. package/src/pb-browse.js +68 -65
  51. package/src/pb-clipboard.js +79 -76
  52. package/src/pb-code-editor.js +110 -102
  53. package/src/pb-code-highlight.js +209 -204
  54. package/src/pb-codepen.js +79 -72
  55. package/src/pb-collapse.js +149 -146
  56. package/src/pb-combo-box.js +190 -190
  57. package/src/pb-components-bundle.js +1 -1
  58. package/src/pb-custom-form.js +150 -149
  59. package/src/pb-document.js +89 -90
  60. package/src/pb-download.js +208 -195
  61. package/src/pb-drawer.js +145 -148
  62. package/src/pb-edit-app.js +301 -229
  63. package/src/pb-edit-xml.js +99 -96
  64. package/src/pb-events.js +114 -107
  65. package/src/pb-facs-link.js +104 -102
  66. package/src/pb-facsimile.js +411 -413
  67. package/src/pb-formula.js +151 -153
  68. package/src/pb-geolocation.js +129 -131
  69. package/src/pb-grid-action.js +53 -56
  70. package/src/pb-grid.js +231 -228
  71. package/src/pb-highlight.js +140 -140
  72. package/src/pb-hotkeys.js +40 -42
  73. package/src/pb-i18n.js +101 -104
  74. package/src/pb-image-strip.js +84 -78
  75. package/src/pb-lang.js +83 -70
  76. package/src/pb-leaflet-map.js +488 -485
  77. package/src/pb-link.js +126 -124
  78. package/src/pb-load.js +431 -426
  79. package/src/pb-login.js +275 -254
  80. package/src/pb-manage-odds.js +364 -318
  81. package/src/pb-map-icon.js +89 -89
  82. package/src/pb-map-layer.js +85 -85
  83. package/src/pb-markdown.js +90 -99
  84. package/src/pb-media-query.js +74 -72
  85. package/src/pb-mei.js +306 -295
  86. package/src/pb-message.js +143 -130
  87. package/src/pb-mixin.js +269 -264
  88. package/src/pb-navigation.js +80 -82
  89. package/src/pb-observable.js +38 -38
  90. package/src/pb-odd-editor.js +1056 -958
  91. package/src/pb-odd-elementspec-editor.js +348 -297
  92. package/src/pb-odd-model-editor.js +1058 -898
  93. package/src/pb-odd-parameter-editor.js +200 -178
  94. package/src/pb-odd-rendition-editor.js +136 -124
  95. package/src/pb-page.js +432 -422
  96. package/src/pb-paginate.js +202 -190
  97. package/src/pb-panel.js +191 -179
  98. package/src/pb-popover-themes.js +7 -5
  99. package/src/pb-popover.js +296 -287
  100. package/src/pb-print-preview.js +127 -127
  101. package/src/pb-progress.js +49 -49
  102. package/src/pb-repeat.js +105 -104
  103. package/src/pb-restricted.js +84 -77
  104. package/src/pb-search.js +238 -221
  105. package/src/pb-select-feature.js +127 -120
  106. package/src/pb-select-odd.js +132 -124
  107. package/src/pb-select-template.js +89 -78
  108. package/src/pb-select.js +251 -227
  109. package/src/pb-split-list.js +179 -174
  110. package/src/pb-svg.js +80 -79
  111. package/src/pb-table-column.js +54 -54
  112. package/src/pb-table-grid.js +221 -203
  113. package/src/pb-tabs.js +61 -63
  114. package/src/pb-tify.js +154 -154
  115. package/src/pb-timeline.js +271 -229
  116. package/src/pb-toggle-feature.js +198 -185
  117. package/src/pb-upload.js +184 -174
  118. package/src/pb-version.js +30 -30
  119. package/src/pb-view-annotate.js +132 -98
  120. package/src/pb-view.js +1282 -1263
  121. package/src/pb-zoom.js +40 -40
  122. package/src/polymer-hack.js +1 -1
  123. package/src/search-result-service.js +256 -223
  124. package/src/seed-element.js +13 -20
  125. package/src/settings.js +4 -4
  126. package/src/theming.js +91 -91
  127. package/src/urls.js +289 -289
  128. package/src/utils.js +53 -51
@@ -12,99 +12,107 @@ import '@polymer/paper-item';
12
12
  * The list may either be given as a JSON-formatted string within the
13
13
  * `endpoints` property or it can be loaded from a JSON file whose path
14
14
  * is specified via the `load` property.
15
- *
15
+ *
16
16
  * The JSON should contain an array of objects, each having an `url` and
17
17
  * `title` property.
18
- *
18
+ *
19
19
  * @fires dts-endpoint - Sets the endpoint
20
20
  */
21
21
  export class DtsSelectEndpoint extends pbMixin(LitElement) {
22
- static get properties() {
23
- return {
24
- ...super.properties,
25
- /**
26
- * The currently selected endpoint. Will be set from URL parameter if present.
27
- */
28
- endpoint: {
29
- type: String
30
- },
31
- label: {
32
- type: String
33
- },
34
- /**
35
- * Array of endpoints to select from, each being an object with
36
- * properties `url` and `title`.
37
- */
38
- endpoints: {
39
- type: Array
40
- },
41
- /**
42
- * Set to true to automatically select the first endpoint
43
- */
44
- auto: {
45
- type: Boolean
46
- }
47
- };
48
- }
22
+ static get properties() {
23
+ return {
24
+ ...super.properties,
25
+ /**
26
+ * The currently selected endpoint. Will be set from URL parameter if present.
27
+ */
28
+ endpoint: {
29
+ type: String,
30
+ },
31
+ label: {
32
+ type: String,
33
+ },
34
+ /**
35
+ * Array of endpoints to select from, each being an object with
36
+ * properties `url` and `title`.
37
+ */
38
+ endpoints: {
39
+ type: Array,
40
+ },
41
+ /**
42
+ * Set to true to automatically select the first endpoint
43
+ */
44
+ auto: {
45
+ type: Boolean,
46
+ },
47
+ };
48
+ }
49
49
 
50
- constructor() {
51
- super();
52
- this.endpoints = [];
53
- this.label = 'dts.endpoint';
54
- }
50
+ constructor() {
51
+ super();
52
+ this.endpoints = [];
53
+ this.label = 'dts.endpoint';
54
+ }
55
55
 
56
- connectedCallback() {
57
- super.connectedCallback();
58
- this.endpoint = registry.state.endpoint;
59
- }
56
+ connectedCallback() {
57
+ super.connectedCallback();
58
+ this.endpoint = registry.state.endpoint;
59
+ }
60
60
 
61
- updated(changedProperties) {
62
- super.updated();
63
- if (changedProperties.has('endpoints')) {
64
- const item = this.shadowRoot.getElementById('endpoints').selectedItem;
65
- if (!item && this.auto && this.endpoints.length > 0) {
66
- this.endpoint = this.endpoints[0].url;
67
- }
68
- }
61
+ updated(changedProperties) {
62
+ super.updated();
63
+ if (changedProperties.has('endpoints')) {
64
+ const item = this.shadowRoot.getElementById('endpoints').selectedItem;
65
+ if (!item && this.auto && this.endpoints.length > 0) {
66
+ this.endpoint = this.endpoints[0].url;
67
+ }
69
68
  }
69
+ }
70
70
 
71
- render() {
72
- return html`
73
- <paper-dropdown-menu id="menu" label="${translate(this.label)}">
74
- <paper-listbox id="endpoints" slot="dropdown-content" class="dropdown-content" selected="${this.endpoint}" attr-for-selected="value"
75
- @selected-item-changed="${this._selected}">
76
- ${this.endpoints.map((ep) => html`<paper-item value="${ep.url ? ep.url : ''}">${ep.title}</paper-item>`)}
77
- </paper-listbox>
78
- </paper-dropdown-menu>
79
- `;
80
- }
71
+ render() {
72
+ return html`
73
+ <paper-dropdown-menu id="menu" label="${translate(this.label)}">
74
+ <paper-listbox
75
+ id="endpoints"
76
+ slot="dropdown-content"
77
+ class="dropdown-content"
78
+ selected="${this.endpoint}"
79
+ attr-for-selected="value"
80
+ @selected-item-changed="${this._selected}"
81
+ >
82
+ ${this.endpoints.map(
83
+ ep => html`<paper-item value="${ep.url ? ep.url : ''}">${ep.title}</paper-item>`,
84
+ )}
85
+ </paper-listbox>
86
+ </paper-dropdown-menu>
87
+ `;
88
+ }
81
89
 
82
- static get styles() {
83
- return css`
84
- :host {
85
- display: block;
86
- }
87
- `;
88
- }
90
+ static get styles() {
91
+ return css`
92
+ :host {
93
+ display: block;
94
+ }
95
+ `;
96
+ }
89
97
 
90
- _selected() {
91
- const item = this.shadowRoot.getElementById('endpoints').selectedItem;
92
- if (!item) {
93
- return;
94
- }
95
- const newEndpoint = item.getAttribute('value');
96
- if (!newEndpoint) {
97
- return;
98
- }
99
- const endpoint = this.endpoints.find((endp) => endp.url === newEndpoint);
100
- registry.commit(this, { endpoint: endpoint.url });
101
- console.log('<dts-select-endpoint> Setting endpoint to %s', newEndpoint);
102
- this.emitTo('dts-endpoint', {
103
- endpoint: endpoint.url,
104
- collection: endpoint.collection,
105
- reload: !this.endpoint
106
- });
107
- this.endpoint = endpoint.url;
98
+ _selected() {
99
+ const item = this.shadowRoot.getElementById('endpoints').selectedItem;
100
+ if (!item) {
101
+ return;
102
+ }
103
+ const newEndpoint = item.getAttribute('value');
104
+ if (!newEndpoint) {
105
+ return;
108
106
  }
107
+ const endpoint = this.endpoints.find(endp => endp.url === newEndpoint);
108
+ registry.commit(this, { endpoint: endpoint.url });
109
+ console.log('<dts-select-endpoint> Setting endpoint to %s', newEndpoint);
110
+ this.emitTo('dts-endpoint', {
111
+ endpoint: endpoint.url,
112
+ collection: endpoint.collection,
113
+ reload: !this.endpoint,
114
+ });
115
+ this.endpoint = endpoint.url;
116
+ }
109
117
  }
110
- customElements.define('dts-select-endpoint', DtsSelectEndpoint);
118
+ customElements.define('dts-select-endpoint', DtsSelectEndpoint);
@@ -1,29 +1,28 @@
1
1
  export class ParseDateService {
2
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
- }
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() {}
21
20
 
22
- run (input) {
21
+ run(input) {
23
22
  this.input = input;
24
- this.day = "??";
25
- this.month = "??";
26
- this.year = "????";
23
+ this.day = '??';
24
+ this.month = '??';
25
+ this.year = '????';
27
26
 
28
27
  const resultIsoMatch = this.input.match(this._isoMatchRegex());
29
28
  const resultCustomMatch = this.input.match(this._customRegex());
@@ -31,14 +30,14 @@ export class ParseDateService {
31
30
  const resultYearAndMonthMatch = this.input.match(this._yearAndMonthRegex());
32
31
  if (resultIsoMatch) {
33
32
  const split = resultIsoMatch[1].split(/-|\/|\s/);
34
- this.year = split[0];
33
+ this.year = split[0];
35
34
  this.month = this._setWithLeadingZero(split[1]);
36
- this.day = this._setWithLeadingZero(split[2]);
35
+ this.day = this._setWithLeadingZero(split[2]);
37
36
  } else if (resultYearAndMonthMatch) {
38
- const split = resultYearAndMonthMatch[1].split("-");
37
+ const split = resultYearAndMonthMatch[1].split('-');
39
38
  this.year = split[0];
40
39
  this.month = this._setWithLeadingZero(split[1]);
41
- this.day = "01";
40
+ this.day = '01';
42
41
  } else if (resultCustomMatch) {
43
42
  const split = resultCustomMatch[0].split(/\.|\s|\/|-/);
44
43
  this.day = this._setWithLeadingZero(split[0]);
@@ -47,7 +46,7 @@ export class ParseDateService {
47
46
  } else if (resultWeekMatch) {
48
47
  const split = resultWeekMatch[0].split(/\.|\s|\/|-/);
49
48
  const year = Number(split[0]);
50
- const week = Number(split[1].replace("W0", "").replace("W", ""));
49
+ const week = Number(split[1].replace('W0', '').replace('W', ''));
51
50
  return this._getDateStrOfISOWeek(year, week);
52
51
  } else {
53
52
  this._findYear();
@@ -58,65 +57,65 @@ export class ParseDateService {
58
57
  }
59
58
 
60
59
  _buildResult() {
61
- if (this.year != "????" && this.month === "??") {
62
- this.month = "01";
60
+ if (this.year != '????' && this.month === '??') {
61
+ this.month = '01';
63
62
  }
64
- if (this.month != "??" && this.day === "??") {
65
- this.day = "01";
63
+ if (this.month != '??' && this.day === '??') {
64
+ this.day = '01';
66
65
  }
67
66
  return `${this.year}-${this.month}-${this.day}`;
68
67
  }
69
68
 
70
69
  /*
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
- */
70
+ * matches ISO string format (with some extensions)
71
+ * | 2012-01-31 | 2012-1-31 | 2012/01/31 |
72
+ * | 2012/1/31 | 2012 1 31 | 2012 01 31 |
73
+ */
75
74
  _isoMatchRegex() {
76
75
  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
76
  /* | | 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 <-|*/
77
+ * | | dash or slash | dash or slash |
78
+ * |preceding with space or start of string end with space endofstr or dot <-| */
80
79
  }
81
80
 
82
81
  /*
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
- */
82
+ * matches a custom date string format (reversed order, day-month-year)
83
+ * | 12.3.2000 | 1.2.2012 | 1-2-2012 |
84
+ * | 12/3/2000 | 1 2 2012 | 1/2/2012 |
85
+ */
87
86
  _customRegex() {
88
87
  return /\d{1,2}(\.|\s|\/|-)\d{1,2}(\.|\s|\/|-)\d{4}/;
89
88
  /* | day | | month | | year
90
- * |___________________|
91
- * |
92
- * seperated by dot, space, slash or dash */
89
+ * |___________________|
90
+ * |
91
+ * seperated by dot, space, slash or dash */
93
92
  }
94
93
 
95
94
  /*
96
- * matches a date format that specifies the week
97
- * | 2012-W1 | 2012 W1 | 2012 W01 |
98
- * | 2020.W2 | 2020-W53 | 2012/W1 |
99
- */
95
+ * matches a date format that specifies the week
96
+ * | 2012-W1 | 2012 W1 | 2012 W01 |
97
+ * | 2020.W2 | 2020-W53 | 2012/W1 |
98
+ */
100
99
  _weekMatchRegex() {
101
100
  return /\d{4}(\.|\s|\/|-)W\d{1,2}(?=\s|$|\.)/;
102
101
  /* |year | |W1-W53 |
103
- * |___________________|
104
- * |
105
- * seperated by dot, space, slash or dash */
102
+ * |___________________|
103
+ * |
104
+ * seperated by dot, space, slash or dash */
106
105
  }
107
106
 
108
107
  /*
109
- * matches a date format with only year and month
110
- * YYYY-MM (1-12)
111
- * | 2020-01 | 2020-12 | 2012-1 |
112
- */
108
+ * matches a date format with only year and month
109
+ * YYYY-MM (1-12)
110
+ * | 2020-01 | 2020-12 | 2012-1 |
111
+ */
113
112
  _yearAndMonthRegex() {
114
113
  return /(?:\s|^)(\d{4}-([0][1-9]|[1-9]|10|11|12))(?=\s|$)/;
115
114
  }
116
115
 
117
116
  _findYear() {
118
- let regex = /[1-9]{1}[0-9]{3}/;
119
- const result = this.input.match(regex)
117
+ const regex = /[1-9]{1}[0-9]{3}/;
118
+ const result = this.input.match(regex);
120
119
  if (result) {
121
120
  this.year = result[0];
122
121
  this._removeMatchFromInput(result);
@@ -126,9 +125,10 @@ export class ParseDateService {
126
125
  _findMonth() {
127
126
  const months = this._monthDictionaryValues();
128
127
  months.forEach(month => {
129
- const re = new RegExp(`(?:\\s|^)(${month})(?=\\s|$|\\.)`, "i")
128
+ const re = new RegExp(`(?:\\s|^)(${month})(?=\\s|$|\\.)`, 'i');
130
129
  const result = this.input.match(re);
131
- if (result) { // yes => get dict and value + return
130
+ if (result) {
131
+ // yes => get dict and value + return
132
132
  this.month = this._monthDictionary()[result[1].toLowerCase()];
133
133
  this._removeMatchFromInput(result);
134
134
  return this.month;
@@ -138,107 +138,155 @@ export class ParseDateService {
138
138
  }
139
139
 
140
140
  /*
141
- * find single numbers from 1-31
142
- */
141
+ * find single numbers from 1-31
142
+ */
143
143
  _findDay() {
144
144
  const regex = /(?:\s|^)([0][1-9]|[1-2][0-9]|3[01]|[1-9])(?=\s|$|\.|st|nd|rd|th)/;
145
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)
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
150
  if (result) {
151
151
  this.day = this._setWithLeadingZero(result[1]);
152
152
  }
153
153
  }
154
154
 
155
155
  /*
156
- * if a string or number has only 1 digit or char
157
- * a leading zro is added
158
- * returns a string
159
- */
156
+ * if a string or number has only 1 digit or char
157
+ * a leading zro is added
158
+ * returns a string
159
+ */
160
160
  _setWithLeadingZero(input) {
161
161
  input = input.toString();
162
162
  if (input.length == 1) {
163
- return "0" + input;
164
- } else {
165
- return input;
163
+ return `0${input}`;
166
164
  }
165
+ return input;
167
166
  }
168
167
 
169
168
  _removeMatchFromInput(matchObj) {
170
169
  if (matchObj && matchObj[0] && matchObj.index) {
171
- let len = matchObj[0].length;
172
- let charArr = this.input.split('');
170
+ const len = matchObj[0].length;
171
+ const charArr = this.input.split('');
173
172
  charArr.splice(matchObj.index, len);
174
- this.input = charArr.join("");
173
+ this.input = charArr.join('');
175
174
  }
176
175
  }
177
176
 
178
177
  _monthDictionaryValues() {
179
178
  return Object.keys(this._monthDictionary());
180
179
  }
180
+
181
181
  _monthDictionary() {
182
182
  return {
183
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",
184
+ jan: '01',
185
+ januar: '01',
186
+ feb: '02',
187
+ februar: '02',
188
+ mär: '03',
189
+ märz: '03',
190
+ apr: '04',
191
+ april: '04',
192
+ mai: '05',
193
+ mai: '05',
194
+ jun: '06',
195
+ juni: '06',
196
+ jul: '07',
197
+ juli: '07',
198
+ aug: '08',
199
+ august: '08',
200
+ sep: '09',
201
+ september: '09',
202
+ okt: '10',
203
+ oktober: '10',
204
+ nov: '11',
205
+ november: '11',
206
+ dez: '12',
207
+ dezember: '12',
196
208
  // 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
+ jan: '01',
210
+ january: '01',
211
+ feb: '02',
212
+ february: '02',
213
+ mar: '03',
214
+ march: '03',
215
+ apr: '04',
216
+ april: '04',
217
+ may: '05',
218
+ may: '05',
219
+ jun: '06',
220
+ june: '06',
221
+ jul: '07',
222
+ july: '07',
223
+ aug: '08',
224
+ august: '08',
225
+ sep: '09',
226
+ september: '09',
227
+ oct: '10',
228
+ october: '10',
229
+ nov: '11',
230
+ november: '11',
231
+ dec: '12',
232
+ december: '12',
209
233
  // 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
- }
234
+ janv: '01',
235
+ janvier: '01',
236
+ févr: '02',
237
+ "février'": '02',
238
+ mars: '03',
239
+ mars: '03',
240
+ avr: '04',
241
+ avril: '04',
242
+ mai: '05',
243
+ mai: '05',
244
+ juin: '06',
245
+ juin: '06',
246
+ juil: '07',
247
+ juillet: '07',
248
+ août: '08',
249
+ août: '08',
250
+ sept: '09',
251
+ septembre: '09',
252
+ oct: '10',
253
+ octobre: '10',
254
+ nov: '11',
255
+ novembre: '11',
256
+ déc: '12',
257
+ décembre: '12',
258
+ // italian
259
+ gen: '01',
260
+ gennaio: '01',
261
+ feb: '02',
262
+ febbraio: '02',
263
+ mar: '03',
264
+ marzo: '03',
265
+ apr: '04',
266
+ aprile: '04',
267
+ mag: '05',
268
+ maggio: '05',
269
+ giu: '06',
270
+ giugno: '06',
271
+ lug: '07',
272
+ luglio: '07',
273
+ ago: '08',
274
+ agosto: '08',
275
+ set: '09',
276
+ settembre: '09',
277
+ ott: '10',
278
+ ottobre: '10',
279
+ nov: '11',
280
+ novembre: '11',
281
+ dic: '12',
282
+ dicembre: '12',
283
+ };
236
284
  }
237
285
 
238
286
  _getDateStrOfISOWeek(y, w) {
239
- let simple = new Date(y, 0, 1 + (w - 1) * 7);
240
- let dow = simple.getDay();
241
- let ISOweekStart = simple;
287
+ const simple = new Date(y, 0, 1 + (w - 1) * 7);
288
+ const dow = simple.getDay();
289
+ const ISOweekStart = simple;
242
290
  if (dow <= 4) {
243
291
  ISOweekStart.setDate(simple.getDate() - simple.getDay() + 1);
244
292
  } else {
@@ -247,20 +295,21 @@ export class ParseDateService {
247
295
  // do not rollover to next or previous year
248
296
  if (ISOweekStart.getFullYear() > y) {
249
297
  return `${y}-12-31`;
250
- } else if (ISOweekStart.getFullYear() < y) {
298
+ }
299
+ if (ISOweekStart.getFullYear() < y) {
251
300
  return `${y}-01-01`;
252
301
  }
253
302
  return this._dateToDateStr(ISOweekStart);
254
303
  }
255
304
 
256
305
  /*
257
- * formats date object to dateStr YYYY-MM-DD
258
- */
306
+ * formats date object to dateStr YYYY-MM-DD
307
+ */
259
308
  _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();
309
+ const d = new Date(date);
310
+ const month = this._setWithLeadingZero(d.getMonth() + 1);
311
+ const day = this._setWithLeadingZero(d.getDate());
312
+ const year = d.getFullYear();
264
313
  return `${year}-${month}-${day}`;
265
314
  }
266
315
  }