tltv-timeline-element 1.0.25 → 1.0.26

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.
@@ -1,4 +1,4 @@
1
- import { LitElement, html, css, nothing } from 'lit';
1
+ import { LitElement, html, css, nothing, PropertyValues } from 'lit';
2
2
  import { customElement, property, query } from 'lit/decorators.js';
3
3
  import { Resolution } from './model/Resolution.js';
4
4
  import { Weekday } from './model/Weekday.js';
@@ -12,6 +12,16 @@ import * as ElementUtil from './util/elementUtil.js';
12
12
  import { addDaysInZone, getZonedFields, isoWeekOfYear, parseWallTime, zonedWallTimeToInstant } from './util/zonedTime.js';
13
13
  import { DefaultLocaleDataProvider } from './model/DefaultLocaleDataProvider.js';
14
14
 
15
+ /* Attribute converter: truncates a date-time to hour accuracy ("yyyy-MM-ddTHH"). */
16
+ function toHourAccuracy(value: string | null): string | null {
17
+ return (value && value.length > 13) ? value.substring(0, 13) : value;
18
+ }
19
+
20
+ /* Attribute converter for default-true flags: only the value "false" turns them off. */
21
+ function visibleUnlessFalse(value: string | null): boolean {
22
+ return value !== 'false';
23
+ }
24
+
15
25
  /**
16
26
  * Scalable, time zone aware timeline header. Renders a date range as year,
17
27
  * month and day rows above a resolution row of hours, days, weeks, months or
@@ -38,6 +48,10 @@ import { DefaultLocaleDataProvider } from './model/DefaultLocaleDataProvider.js'
38
48
  * @cssprop [--timeline-col-weekend=#ccc] - Background of weekend resolution blocks.
39
49
  * @cssprop [--timeline-col-font-size=10px] - Font size of resolution blocks.
40
50
  * @cssprop [--timeline-col-current=#ffe082] - Background of the current-date highlight.
51
+ * @cssprop --timeline-col-min-width - Minimum width of a day or hour block. Default: width of the text "MM".
52
+ * @cssprop --timeline-col-week-min-width - Minimum width of a week block. Default: 4px per day.
53
+ * @cssprop --timeline-col-month-min-width - Minimum width of a 30 day month block. Default: 4px per day.
54
+ * @cssprop --timeline-col-year-min-width - Minimum width of a 365 day year block. Default: 1px per day.
41
55
  */
42
56
  @customElement('timeline-element')
43
57
  export class TimelineElement extends LitElement {
@@ -72,37 +86,20 @@ export class TimelineElement extends LitElement {
72
86
  private static readonly AVERAGE_DAYS_IN_MONTH: number = 30;
73
87
  private static readonly AVERAGE_DAYS_IN_YEAR: number = 365;
74
88
 
75
- @property({
89
+ @property({
76
90
  reflect: true,
77
91
  converter: {
78
- fromAttribute: (value: string, type) => {
79
- return <any>Resolution[<any>value];
80
- },
81
- toAttribute: (value: Resolution, type) => {
82
- return <any>Resolution[value];
83
- }
92
+ // Attribute holds the enum name, e.g. "Week".
93
+ fromAttribute: (value: string | null): Resolution => Resolution[value as keyof typeof Resolution],
94
+ toAttribute: (value: Resolution): string => Resolution[value],
84
95
  }
85
- })
96
+ })
86
97
  public resolution: Resolution = Resolution.Day;
87
98
  /* Inclusive start Date (hour accuracy). E.g. "2020-04-01" or "2020-04-01T00" for Hour resolution.*/
88
- @property({
89
- reflect: true,
90
- converter: {
91
- fromAttribute: (value: string, type) => {
92
- return (value) ? (value.length > 13) ? value.substring(0, 13) : value : value;
93
- },
94
- }
95
- })
99
+ @property({ reflect: true, converter: { fromAttribute: toHourAccuracy } })
96
100
  public startDateTime: string;
97
101
  /* Inclusive end Date (hour accuracy). E.g. "2020-04-01" or "2020-04-01T00" for Hour resolution. */
98
- @property({
99
- reflect: true,
100
- converter: {
101
- fromAttribute: (value: string, type) => {
102
- return (value) ? (value.length > 13) ? value.substring(0, 13) : value : value;
103
- },
104
- }
105
- })
102
+ @property({ reflect: true, converter: { fromAttribute: toHourAccuracy } })
106
103
  public endDateTime: string;
107
104
  /** Start Date of the timeline. Native Date object can be in "wrong" time zone, as it matches browser's time zone. */
108
105
  public internalInclusiveStartDateTime: Date;
@@ -113,7 +110,8 @@ export class TimelineElement extends LitElement {
113
110
  public timeZone: string = "Europe/London";
114
111
  @property({ reflect: true})
115
112
  public locale: string = "en-US";
116
- @property({ reflect: true}) firstDayOfWeek: number = 1; // sunday;
113
+ /** First day of the week, 1 (Sunday) to 7 (Saturday). */
114
+ @property({ reflect: true, type: Number }) firstDayOfWeek: number = 1;
117
115
  @property({ reflect: true, type: Boolean }) twelveHourClock: boolean = false;
118
116
 
119
117
  @property() minWidth: number;
@@ -127,8 +125,10 @@ export class TimelineElement extends LitElement {
127
125
  @property() firstHourOfRange: number;
128
126
  @property({ reflect: true }) scrollContainerId: string;
129
127
 
130
- @property() monthRowVisible: boolean = true;
131
- @property() yearRowVisible: boolean = true;
128
+ /** Show the month header row. Visible by default; hide with `monthrowvisible="false"`. */
129
+ @property({ converter: { fromAttribute: visibleUnlessFalse } }) monthRowVisible: boolean = true;
130
+ /** Show the year header row. Visible by default; hide with `yearrowvisible="false"`. */
131
+ @property({ converter: { fromAttribute: visibleUnlessFalse } }) yearRowVisible: boolean = true;
132
132
 
133
133
  @property() monthNames: string[];
134
134
  @property() weekdayNames: string[];
@@ -136,6 +136,9 @@ export class TimelineElement extends LitElement {
136
136
  /* When true, the resolution block (and the day row block) covering the current date/time is highlighted with 'current' style. */
137
137
  @property({ reflect: true, type: Boolean }) currentDateVisible: boolean = false;
138
138
 
139
+ /** Log diagnostic messages to the browser console. */
140
+ @property({ type: Boolean }) debug: boolean = false;
141
+
139
142
  private localeDataProvider: ILocaleDataProvider;
140
143
  /* Current day formatted as 'yyyy-MM-dd' in the timeline's time zone. Refreshed before each fill. */
141
144
  private currentDayString: string = null;
@@ -204,13 +207,13 @@ export class TimelineElement extends LitElement {
204
207
 
205
208
  private ie: boolean = false; // deprecated property
206
209
 
207
- private lazyResolutionPaint: any;
210
+ private lazyResolutionPaint: ReturnType<typeof setTimeout>;
208
211
 
209
212
  /* directlyInsideScrollContainer:
210
213
  true: timeline element is a child element inside a container with scroll bar.
211
214
  false: timeline.style.left is adjusted by scrollHandler. */
212
215
  private directlyInsideScrollContainer: boolean = true;
213
- private scrollHandler: any;
216
+ private scrollHandler: () => void;
214
217
  private scrollContainer: HTMLElement | Window;
215
218
  private previousContainerScrollLeft: number = 0;
216
219
  private previousContainerScrollTop: number = 0;
@@ -235,116 +238,110 @@ export class TimelineElement extends LitElement {
235
238
  display: block;
236
239
  overflow: hidden;
237
240
  position: relative;
238
-
239
- --no-user-select: {
240
- -webkit-user-select: none;
241
- -khtml-user-select: none;
242
- -moz-user-select: none;
243
- -ms-user-select: none;
244
- user-select: none;
245
- }
246
241
  }
247
242
  :host([hidden]) {
248
243
  display: none;
249
244
  }
250
-
245
+
251
246
  .year,
252
- .month,
253
- .day {
254
- padding-left: 2px;
255
- text-overflow: ellipsis;
256
- white-space: nowrap;
257
- border-right: 1px solid #A9A9A9;
258
- box-sizing: border-box;
259
- -moz-box-sizing: border-box;
260
- -webkit-box-sizing: border-box;
261
- }
262
- .year.spacer,
263
- .month.spacer,
264
- .day.spacer {
265
- padding-left: 0px;
266
- }
267
-
268
- .month:nth-of-type(even),
269
- .day:nth-of-type(even) {
270
- background-color: var(--timeline-row-even-background, #ddd);
271
- }
272
- .col.even {
273
- background-color: var(--timeline-col-even-background-color, #ccc);
274
- }
275
-
276
- .col {
247
+ .month,
248
+ .day {
249
+ padding-left: 2px;
250
+ text-overflow: ellipsis;
251
+ white-space: nowrap;
252
+ border-right: 1px solid #A9A9A9;
253
+ box-sizing: border-box;
254
+ }
255
+ .year.spacer,
256
+ .month.spacer,
257
+ .day.spacer {
258
+ padding-left: 0px;
259
+ }
260
+
261
+ .month:nth-of-type(even),
262
+ .day:nth-of-type(even) {
263
+ background-color: var(--timeline-row-even-background, #ddd);
264
+ }
265
+ .col.even {
266
+ background-color: var(--timeline-col-even-background-color, #ccc);
267
+ }
268
+
269
+ .col {
277
270
  position: var(--timeline-col-position);
278
- left: var(--timeline-col-left);
279
- height: 100%;
280
- float: left;
281
- overflow: hidden;
282
- border-right: 1px solid #A9A9A9;
283
- background-color: var(--timeline-col-background-color, #ddd);
284
- font-size: var(--timeline-col-font-size, 10px);
285
- text-align: center;
286
- box-sizing: border-box;
287
- -moz-box-sizing: border-box;
288
- -webkit-box-sizing: border-box;
289
- -webkit-touch-callout: none;
290
- @apply --no-user-select;
291
- }
271
+ left: var(--timeline-col-left);
272
+ height: 100%;
273
+ float: left;
274
+ overflow: hidden;
275
+ border-right: 1px solid #A9A9A9;
276
+ background-color: var(--timeline-col-background-color, #ddd);
277
+ font-size: var(--timeline-col-font-size, 10px);
278
+ text-align: center;
279
+ box-sizing: border-box;
280
+ -webkit-touch-callout: none;
281
+ -webkit-user-select: none;
282
+ user-select: none;
283
+ }
292
284
 
293
285
  .c-col {
294
- width: var(--timeline-col-center-width);
295
- }
296
-
297
- .f-col {
298
- width: var(--timeline-col-first-width);
299
- }
300
-
301
- .l-col {
302
- width: var(--timeline-col-last-width);
303
- }
304
-
305
- .col.w,
306
- .col.m,
307
- .col.y {
308
- text-align: left;
309
- }
310
-
311
- .col.weekend {
312
- background-color: var(--timeline-col-weekend, #ccc);
313
- }
314
-
315
- .col.current,
316
- .day.current {
317
- background-color: var(--timeline-col-current, #ffe082);
318
- }
319
-
320
- .col.measure {
321
- // Change min-width to adjust grid's cell width with day and hour-resolution.
322
- //min-width: 40px;
323
- }
324
- .col.w.measure {
325
- // Change min-width to adjust grid's cell width with week-resolution.
326
- //min-width: 70px;
327
- }
328
- .col.m.measure {
329
- // Change min-width to adjust grid's cell width with month-resolution (width of a 30 day month).
330
- //min-width: 120px;
331
- }
332
- .col.y.measure {
333
- // Change min-width to adjust grid's cell width with year-resolution (width of a 365 day year).
334
- //min-width: 365px;
335
- }
336
-
337
- .row {
338
- width: 100%;
339
- float: left;
340
- overflow: hidden;
341
- height: var(--timeline-row-height, 15px);
342
- font-size: var(--timeline-row-font-size, 10px);
343
- background-color: var(--timeline-row-background, #d0d0d0);
344
- -ms-flex-pack: justify;
345
- -webkit-touch-callout: none;
346
- @apply --no-user-select;
347
- }
286
+ width: var(--timeline-col-center-width);
287
+ }
288
+
289
+ .f-col {
290
+ width: var(--timeline-col-first-width);
291
+ }
292
+
293
+ .l-col {
294
+ width: var(--timeline-col-last-width);
295
+ }
296
+
297
+ .col.w,
298
+ .col.m,
299
+ .col.y {
300
+ text-align: left;
301
+ }
302
+
303
+ .col.weekend {
304
+ background-color: var(--timeline-col-weekend, #ccc);
305
+ }
306
+
307
+ .col.current,
308
+ .day.current {
309
+ background-color: var(--timeline-col-current, #ffe082);
310
+ }
311
+
312
+ /*
313
+ * Minimum block widths are measured from these hidden elements (see
314
+ * calculateResolutionMinWidth()). An unset custom property leaves
315
+ * min-width unset, so the defaults apply.
316
+ */
317
+ .col.measure {
318
+ /* Day and hour block. */
319
+ min-width: var(--timeline-col-min-width);
320
+ }
321
+ .col.w.measure {
322
+ /* One week block. */
323
+ min-width: var(--timeline-col-week-min-width);
324
+ }
325
+ .col.m.measure {
326
+ /* A 30 day month block. */
327
+ min-width: var(--timeline-col-month-min-width);
328
+ }
329
+ .col.y.measure {
330
+ /* A 365 day year block. */
331
+ min-width: var(--timeline-col-year-min-width);
332
+ }
333
+
334
+ .row {
335
+ width: 100%;
336
+ float: left;
337
+ overflow: hidden;
338
+ height: var(--timeline-row-height, 15px);
339
+ font-size: var(--timeline-row-font-size, 10px);
340
+ background-color: var(--timeline-row-background, #d0d0d0);
341
+ -webkit-touch-callout: none;
342
+ -webkit-user-select: none;
343
+ user-select: none;
344
+ }
348
345
  `;
349
346
  }
350
347
 
@@ -371,13 +368,13 @@ export class TimelineElement extends LitElement {
371
368
  }
372
369
 
373
370
  dayBlocks() {
374
- if (this.isDayRowVisible) {
371
+ if (this.isDayRowVisible()) {
375
372
  return this.timelineBlocks(this.dayRowData, TimelineElement.STYLE_DAY);
376
373
  }
377
374
  return nothing;
378
375
  }
379
376
 
380
- shouldUpdate(changedProperties: any) {
377
+ shouldUpdate(changedProperties: PropertyValues<this>) {
381
378
  return changedProperties.has('resolution')
382
379
  || changedProperties.has('startDateTime')
383
380
  || changedProperties.has('endDateTime')
@@ -393,7 +390,7 @@ export class TimelineElement extends LitElement {
393
390
  ;
394
391
  }
395
392
 
396
- willUpdate(changedProps: any) {
393
+ willUpdate(changedProps: PropertyValues<this>) {
397
394
  if (changedProps.has('resolution')) {
398
395
  this.minResolutionWidth = -1;
399
396
  }
@@ -418,20 +415,20 @@ export class TimelineElement extends LitElement {
418
415
  this.updateTimeLine(this.resolution, this.internalInclusiveStartDateTime, this.internalInclusiveEndDateTime, new DefaultLocaleDataProvider(this.locale, this.timeZone, this.firstDayOfWeek, this.twelveHourClock));
419
416
  }
420
417
 
421
- protected updated(changedProps: any): void {
418
+ protected updated(): void {
422
419
  if(!(this.resolution) || !this.internalInclusiveStartDateTime || !this.internalInclusiveEndDateTime) {
423
420
  return;
424
421
  }
425
422
  if (this.resolution !== Resolution.Day && this.resolution !== Resolution.Week && this.resolution !== Resolution.Hour
426
423
  && !this.isMonthOrYearResolution()) {
427
- console.log("TimelineElement resolution " + (this.resolution ? Resolution[this.resolution] : "null")
424
+ console.warn("TimelineElement resolution " + (this.resolution ? Resolution[this.resolution] : "null")
428
425
  + " is not supported");
429
426
  return;
430
427
  }
431
428
 
432
- console.log("TimelineElement Constructed content.");
429
+ this.log("TimelineElement Constructed content.");
433
430
  this.updateWidths();
434
- console.log("TimelineElement is updated for resolution " + Resolution[this.resolution] + ".");
431
+ this.log("TimelineElement is updated for resolution " + Resolution[this.resolution] + ".");
435
432
 
436
433
  this.registerScrollHandler();
437
434
  }
@@ -460,16 +457,16 @@ export class TimelineElement extends LitElement {
460
457
  updateTimeLine(resolution: Resolution, startDate: Date, endDate: Date,
461
458
  localeDataProvider: ILocaleDataProvider) {
462
459
  if (!localeDataProvider) {
463
- console.log("TimelineElement requires ILocaleDataProvider. Can't complete update(...) operation.");
460
+ console.warn("TimelineElement requires ILocaleDataProvider. Can't complete update(...) operation.");
464
461
  return;
465
462
  }
466
463
  this.clear();
467
- console.log("TimelineElement content cleared.");
464
+ this.log("TimelineElement content cleared.");
468
465
 
469
466
  if(!(resolution) || !startDate || !endDate) {
470
467
  return;
471
468
  }
472
- console.log("TimelineElement Updating content.");
469
+ this.log("TimelineElement Updating content.");
473
470
 
474
471
  this.localeDataProvider = localeDataProvider;
475
472
  this.resolution = resolution;
@@ -505,19 +502,18 @@ export class TimelineElement extends LitElement {
505
502
  if (this.scrollHandler) {
506
503
  return;
507
504
  }
508
- const timeline = this;
509
505
  this.scrollContainer = this.setupScrollContainer();
510
- this.scrollHandler = function (e: any) {
511
- window.requestAnimationFrame(function () {
512
- const container: any = timeline.scrollContainer;
513
- const sl: number = container.scrollLeft || container.scrollX;
514
- const st: number = container.scrollTop || container.scrollY;
515
- if (sl != timeline.previousContainerScrollLeft) {
516
- timeline.setScrollLeft(sl);
517
- timeline.previousContainerScrollLeft = sl;
506
+ this.scrollHandler = () => {
507
+ window.requestAnimationFrame(() => {
508
+ const container = this.scrollContainer;
509
+ const sl: number = container instanceof Window ? container.scrollX : container.scrollLeft;
510
+ const st: number = container instanceof Window ? container.scrollY : container.scrollTop;
511
+ if (sl != this.previousContainerScrollLeft) {
512
+ this.setScrollLeft(sl);
513
+ this.previousContainerScrollLeft = sl;
518
514
  }
519
- if (st != timeline.previousContainerScrollTop) {
520
- timeline.previousContainerScrollTop = st;
515
+ if (st != this.previousContainerScrollTop) {
516
+ this.previousContainerScrollTop = st;
521
517
  }
522
518
  });
523
519
  };
@@ -525,16 +521,16 @@ export class TimelineElement extends LitElement {
525
521
  }
526
522
 
527
523
  setupScrollContainer(): HTMLElement | Window {
528
- let scrollContainer;
524
+ let scrollContainer: HTMLElement;
529
525
  if(this.scrollContainerId) {
530
- scrollContainer = this.getParentElement(this).querySelector('#' + this.scrollContainerId);
526
+ scrollContainer = this.getParentElement(this).querySelector<HTMLElement>('#' + this.scrollContainerId);
531
527
  if(!scrollContainer) {
532
- scrollContainer = document.querySelector('#' + this.scrollContainerId);
528
+ scrollContainer = document.querySelector<HTMLElement>('#' + this.scrollContainerId);
533
529
  }
534
530
  if(scrollContainer) {
535
- (<HTMLElement>scrollContainer).style.overflowX = "auto";
531
+ scrollContainer.style.overflowX = "auto";
536
532
  }
537
- }
533
+ }
538
534
  if(!scrollContainer) {
539
535
  scrollContainer = this.getParentElement(this);
540
536
  this.directlyInsideScrollContainer = true;
@@ -692,12 +688,19 @@ export class TimelineElement extends LitElement {
692
688
  return DateUtil.toNormalDate(zonedDate, this.localeDataProvider.getDaylightAdjustment(zonedDate));
693
689
  }
694
690
 
695
- getParentElement(node: any): any {
696
- let parent = node.parentNode;
697
- if (!parent || parent.nodeType != 1) {
698
- parent = null;
691
+ getParentElement(node: Node): HTMLElement {
692
+ const parent = node.parentNode;
693
+ if (!parent || parent.nodeType != Node.ELEMENT_NODE) {
694
+ return null;
695
+ }
696
+ return parent as HTMLElement;
697
+ }
698
+
699
+ /* Logs a diagnostic message when the debug property is set. */
700
+ private log(message: string) {
701
+ if (this.debug) {
702
+ console.log(message);
699
703
  }
700
- return parent;
701
704
  }
702
705
 
703
706
  getDay(date: Date): string {
@@ -1129,8 +1132,10 @@ export class TimelineElement extends LitElement {
1129
1132
  const offset: number = p * left;
1130
1133
  const date: Date = new Date(this.internalInclusiveStartDateTime.getTime() + offset);
1131
1134
 
1132
- console.log("Zoned: " + this.localeDataProvider.formatDate(date, "dd. HH:mm") + " DST: "
1133
- + this.localeDataProvider.getDaylightAdjustment(date) / 60000);
1135
+ if (this.debug) {
1136
+ this.log("Zoned: " + this.localeDataProvider.formatDate(date, "dd. HH:mm") + " DST: "
1137
+ + this.localeDataProvider.getDaylightAdjustment(date) / 60000);
1138
+ }
1134
1139
  return date;
1135
1140
  }
1136
1141
 
@@ -1188,10 +1193,10 @@ export class TimelineElement extends LitElement {
1188
1193
  */
1189
1194
  updateWidths() {
1190
1195
  if (this.resolutionDiv == null) {
1191
- console.log("TimelineElement is not ready for updateWidths() call. Call update(...) instead.");
1196
+ this.log("TimelineElement is not ready for updateWidths() call. Call update(...) instead.");
1192
1197
  return;
1193
1198
  }
1194
- console.log("TimelineElement Started updating widths.");
1199
+ this.log("TimelineElement Started updating widths.");
1195
1200
 
1196
1201
  // start by clearing old content in resolution element
1197
1202
  while (this.resolutionDiv.firstChild) {
@@ -1258,7 +1263,7 @@ export class TimelineElement extends LitElement {
1258
1263
  this.updateSpacerBlocks(this.dayOrHourWidthPx);
1259
1264
  }
1260
1265
 
1261
- console.log("TimelineElement Widths are updated.");
1266
+ this.log("TimelineElement Widths are updated.");
1262
1267
  }
1263
1268
 
1264
1269
  updateBlockWidths(rowData: BlockRowData) {
@@ -1367,7 +1372,7 @@ export class TimelineElement extends LitElement {
1367
1372
  this.resolutionDiv.appendChild(element);
1368
1373
  }
1369
1374
 
1370
- console.log(`TimelineElement Added ${blocks} visible timeline elements for resolution ${Resolution[this.resolution]}`);
1375
+ this.log(`TimelineElement Added ${blocks} visible timeline elements for resolution ${Resolution[this.resolution]}`);
1371
1376
  }
1372
1377
 
1373
1378
  calculateMinimumResolutionBlockWidth(): number {
@@ -1455,7 +1460,7 @@ export class TimelineElement extends LitElement {
1455
1460
  this.style.setProperty("--timeline-col-position", "relative");
1456
1461
  this.style.setProperty("--timeline-col-left", left + "px");
1457
1462
 
1458
- console.log(`TimelineElement Updated visible timeline elements for horizontal scroll position ${left} (plus ${datePos-left} to center-of-first-block)`);
1463
+ this.log(`TimelineElement Updated visible timeline elements for horizontal scroll position ${left} (plus ${datePos-left} to center-of-first-block)`);
1459
1464
  }
1460
1465
 
1461
1466
  showAllResolutionBlocks() {
@@ -1526,11 +1531,11 @@ export class TimelineElement extends LitElement {
1526
1531
  } else if (this.resolution == Resolution.Hour) {
1527
1532
  this.fillTimelineForHourResolution(startDate, endDate, left);
1528
1533
  } else {
1529
- console.log("TimelineElement resolution " + (this.resolution != null ? Resolution[this.resolution] : "null")
1534
+ console.warn("TimelineElement resolution " + (this.resolution != null ? Resolution[this.resolution] : "null")
1530
1535
  + " is not supported");
1531
1536
  return;
1532
1537
  }
1533
- console.log("TimelineElement Filled new data and styles to visible timeline elements");
1538
+ this.log("TimelineElement Filled new data and styles to visible timeline elements");
1534
1539
  }
1535
1540
 
1536
1541
  isFirstResBlockShort(): boolean {
@@ -1998,8 +2003,8 @@ export class TimelineElement extends LitElement {
1998
2003
  const visibleRangeNormalStartDate: Date = timeline.toNormalDate(startDate);
1999
2004
  if (timeline.normalStartDate.getTime() < visibleRangeNormalStartDate.getTime()) {
2000
2005
  let daysHidden: number = Math.floor(((visibleRangeNormalStartDate.getTime() - timeline.normalStartDate.getTime()) / DateTimeConstants.DAY_INTERVAL));
2001
- console.log("Days hidden: " + daysHidden);
2002
- console.log("firstWeekBlockHidden = " + timeline.firstWeekBlockHidden);
2006
+ timeline.log("Days hidden: " + daysHidden);
2007
+ timeline.log("firstWeekBlockHidden = " + timeline.firstWeekBlockHidden);
2003
2008
  if (daysHidden === 0) {
2004
2009
  return false;
2005
2010
  }
@@ -2027,7 +2032,7 @@ export class TimelineElement extends LitElement {
2027
2032
  }
2028
2033
 
2029
2034
  logIndexOutOfBounds(indexName: string, index: number, childCount: number) {
2030
- console.log(`${indexName} index ${index} out of bounds with childCount ${childCount}. Can't fill content.`);
2035
+ this.log(`${indexName} index ${index} out of bounds with childCount ${childCount}. Can't fill content.`);
2031
2036
  }
2032
2037
 
2033
2038
  fillTimelineForHour(interval: number, startDate: Date, endDate: Date,
@@ -2161,3 +2166,9 @@ export class TimelineElement extends LitElement {
2161
2166
  }
2162
2167
  }
2163
2168
  }
2169
+
2170
+ declare global {
2171
+ interface HTMLElementTagNameMap {
2172
+ 'timeline-element': TimelineElement;
2173
+ }
2174
+ }