tltv-timeline-element 1.0.24 → 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.
- package/README.md +148 -10
- package/custom-elements.json +4201 -0
- package/dist/src/model/DefaultLocaleDataProvider.d.ts +35 -27
- package/dist/src/model/DefaultLocaleDataProvider.d.ts.map +1 -0
- package/dist/src/model/DefaultLocaleDataProvider.js +78 -111
- package/dist/src/model/DefaultLocaleDataProvider.js.map +1 -1
- package/dist/src/model/ILocaleDataProvider.d.ts +71 -62
- package/dist/src/model/ILocaleDataProvider.d.ts.map +1 -0
- package/dist/src/model/ILocaleDataProvider.js +1 -1
- package/dist/src/model/IResolutionBlockFiller.d.ts +5 -4
- package/dist/src/model/IResolutionBlockFiller.d.ts.map +1 -0
- package/dist/src/model/IResolutionBlockFiller.js +1 -1
- package/dist/src/model/IResolutionBlockRegisterer.d.ts +4 -3
- package/dist/src/model/IResolutionBlockRegisterer.d.ts.map +1 -0
- package/dist/src/model/IResolutionBlockRegisterer.js +1 -1
- package/dist/src/model/Resolution.d.ts +8 -7
- package/dist/src/model/Resolution.d.ts.map +1 -0
- package/dist/src/model/Resolution.js +8 -8
- package/dist/src/model/Weekday.d.ts +6 -5
- package/dist/src/model/Weekday.d.ts.map +1 -0
- package/dist/src/model/Weekday.js +6 -6
- package/dist/src/model/blockRowData.d.ts +12 -11
- package/dist/src/model/blockRowData.d.ts.map +1 -0
- package/dist/src/model/blockRowData.js +28 -28
- package/dist/src/model/blockRowData.js.map +1 -1
- package/dist/src/timeline-element.d.ts +406 -388
- package/dist/src/timeline-element.d.ts.map +1 -0
- package/dist/src/timeline-element.js +1987 -1987
- package/dist/src/timeline-element.js.map +1 -1
- package/dist/src/util/dateTimeUtil.d.ts +21 -14
- package/dist/src/util/dateTimeUtil.d.ts.map +1 -0
- package/dist/src/util/dateTimeUtil.js +42 -55
- package/dist/src/util/dateTimeUtil.js.map +1 -1
- package/dist/src/util/elementUtil.d.ts +5 -4
- package/dist/src/util/elementUtil.d.ts.map +1 -0
- package/dist/src/util/elementUtil.js +48 -48
- package/dist/src/util/elementUtil.js.map +1 -1
- package/dist/src/util/zonedTime.d.ts +85 -0
- package/dist/src/util/zonedTime.d.ts.map +1 -0
- package/dist/src/util/zonedTime.js +239 -0
- package/dist/src/util/zonedTime.js.map +1 -0
- package/package.json +53 -24
- package/src/model/DefaultLocaleDataProvider.ts +32 -66
- package/src/model/ILocaleDataProvider.ts +10 -2
- package/src/model/IResolutionBlockFiller.ts +1 -1
- package/src/model/IResolutionBlockRegisterer.ts +1 -1
- package/src/model/blockRowData.ts +4 -4
- package/src/timeline-element.ts +380 -372
- package/src/util/dateTimeUtil.ts +16 -29
- package/src/util/elementUtil.ts +4 -4
- package/src/util/zonedTime.ts +280 -0
- package/server.js +0 -18
- package/src/index.html +0 -112
- package/tsconfig.json +0 -15
- package/webpack.config.js +0 -33
|
@@ -1,2014 +1,2014 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var TimelineElement_1;
|
|
8
|
-
import { LitElement, html, css, nothing } from 'lit';
|
|
9
|
-
import { property,
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import { DefaultLocaleDataProvider } from './model/DefaultLocaleDataProvider';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* {@link
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
this.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
this.
|
|
76
|
-
|
|
77
|
-
this.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
this.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
this.
|
|
103
|
-
this.
|
|
104
|
-
this.
|
|
105
|
-
this.
|
|
106
|
-
this.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var TimelineElement_1;
|
|
8
|
+
import { LitElement, html, css, nothing } from 'lit';
|
|
9
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
10
|
+
import { Resolution } from './model/Resolution.js';
|
|
11
|
+
import { Weekday } from './model/Weekday.js';
|
|
12
|
+
import { BlockRowData } from './model/blockRowData.js';
|
|
13
|
+
import * as DateUtil from './util/dateTimeUtil.js';
|
|
14
|
+
import { DateTimeConstants } from './util/dateTimeUtil.js';
|
|
15
|
+
import * as ElementUtil from './util/elementUtil.js';
|
|
16
|
+
import { addDaysInZone, getZonedFields, isoWeekOfYear, parseWallTime, zonedWallTimeToInstant } from './util/zonedTime.js';
|
|
17
|
+
import { DefaultLocaleDataProvider } from './model/DefaultLocaleDataProvider.js';
|
|
18
|
+
/* Attribute converter: truncates a date-time to hour accuracy ("yyyy-MM-ddTHH"). */
|
|
19
|
+
function toHourAccuracy(value) {
|
|
20
|
+
return (value && value.length > 13) ? value.substring(0, 13) : value;
|
|
21
|
+
}
|
|
22
|
+
/* Attribute converter for default-true flags: only the value "false" turns them off. */
|
|
23
|
+
function visibleUnlessFalse(value) {
|
|
24
|
+
return value !== 'false';
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Scalable, time zone aware timeline header. Renders a date range as year,
|
|
28
|
+
* month and day rows above a resolution row of hours, days, weeks, months or
|
|
29
|
+
* years ({@link Resolution}), and provides an API for converting between dates
|
|
30
|
+
* and horizontal positions.
|
|
31
|
+
*
|
|
32
|
+
* When the range fits in the parent element, the timeline stretches to fill it
|
|
33
|
+
* and widths are calculated as percentages. Otherwise blocks get their minimum
|
|
34
|
+
* width, the timeline scrolls horizontally with its scroll container and only
|
|
35
|
+
* the visible resolution blocks are rendered.
|
|
36
|
+
*
|
|
37
|
+
* Set `startDateTime`, `endDateTime` and `resolution`; the timeline renders and
|
|
38
|
+
* calculates its widths when attached. The positioning API can be used after
|
|
39
|
+
* the first update has completed.
|
|
40
|
+
*
|
|
41
|
+
* @summary Scalable, time zone aware timeline header for scheduling views.
|
|
42
|
+
*
|
|
43
|
+
* @cssprop [--timeline-row-background=#d0d0d0] - Background of header rows (year, month, day).
|
|
44
|
+
* @cssprop [--timeline-row-even-background=#ddd] - Background of every even month and day block in the header.
|
|
45
|
+
* @cssprop [--timeline-row-height=15px] - Height of a header row.
|
|
46
|
+
* @cssprop [--timeline-row-font-size=10px] - Font size of a header row.
|
|
47
|
+
* @cssprop [--timeline-col-background-color=#ddd] - Background of resolution blocks.
|
|
48
|
+
* @cssprop [--timeline-col-even-background-color=#ccc] - Background of even resolution blocks.
|
|
49
|
+
* @cssprop [--timeline-col-weekend=#ccc] - Background of weekend resolution blocks.
|
|
50
|
+
* @cssprop [--timeline-col-font-size=10px] - Font size of resolution blocks.
|
|
51
|
+
* @cssprop [--timeline-col-current=#ffe082] - Background of the current-date highlight.
|
|
52
|
+
* @cssprop --timeline-col-min-width - Minimum width of a day or hour block. Default: width of the text "MM".
|
|
53
|
+
* @cssprop --timeline-col-week-min-width - Minimum width of a week block. Default: 4px per day.
|
|
54
|
+
* @cssprop --timeline-col-month-min-width - Minimum width of a 30 day month block. Default: 4px per day.
|
|
55
|
+
* @cssprop --timeline-col-year-min-width - Minimum width of a 365 day year block. Default: 1px per day.
|
|
56
|
+
*/
|
|
57
|
+
let TimelineElement = TimelineElement_1 = class TimelineElement extends LitElement {
|
|
58
|
+
constructor() {
|
|
59
|
+
super(...arguments);
|
|
60
|
+
this.resolutionWeekDayblockWidth = 4;
|
|
61
|
+
/* Default minimum width (px) of one day inside a month resolution block. */
|
|
62
|
+
this.resolutionMonthDayblockWidth = 4;
|
|
63
|
+
/* Default minimum width (px) of one day inside a year resolution block. */
|
|
64
|
+
this.resolutionYearDayblockWidth = 1;
|
|
65
|
+
this.resolution = Resolution.Day;
|
|
66
|
+
/** Timezone for date and time formatting. Doesn't match with actual start and end Date object's time zone. */
|
|
67
|
+
this.timeZone = "Europe/London";
|
|
68
|
+
this.locale = "en-US";
|
|
69
|
+
/** First day of the week, 1 (Sunday) to 7 (Saturday). */
|
|
70
|
+
this.firstDayOfWeek = 1;
|
|
71
|
+
this.twelveHourClock = false;
|
|
72
|
+
/** Show the month header row. Visible by default; hide with `monthrowvisible="false"`. */
|
|
73
|
+
this.monthRowVisible = true;
|
|
74
|
+
/** Show the year header row. Visible by default; hide with `yearrowvisible="false"`. */
|
|
75
|
+
this.yearRowVisible = true;
|
|
76
|
+
/* When true, the resolution block (and the day row block) covering the current date/time is highlighted with 'current' style. */
|
|
77
|
+
this.currentDateVisible = false;
|
|
78
|
+
/** Log diagnostic messages to the browser console. */
|
|
79
|
+
this.debug = false;
|
|
80
|
+
/* Current day formatted as 'yyyy-MM-dd' in the timeline's time zone. Refreshed before each fill. */
|
|
81
|
+
this.currentDayString = null;
|
|
82
|
+
this.currentHourString = null;
|
|
83
|
+
/*
|
|
84
|
+
* number of blocks in resolution range. Days for Day/Week/Month/Year
|
|
85
|
+
* resolution, Hours for hour resolution..
|
|
86
|
+
*/
|
|
87
|
+
this.blocksInRange = 0;
|
|
88
|
+
/*
|
|
89
|
+
* number of elements in resolution range. Same as blocksInRange for
|
|
90
|
+
* Day/Hour resolution. blocksInRange / 7 for Week resolution. Number of
|
|
91
|
+
* (partial) months/years for Month/Year resolution.
|
|
92
|
+
*/
|
|
93
|
+
this.resolutionBlockCount = 0;
|
|
94
|
+
this.firstResBlockCount = 0;
|
|
95
|
+
this.lastResBlockCount = 0;
|
|
96
|
+
/*
|
|
97
|
+
* Month/Year resolution only: number of days in each resolution block, the
|
|
98
|
+
* date of the first day in each block and a key ('yyyy-MM' or 'yyyy')
|
|
99
|
+
* identifying the block. Blocks have variable length (28-31 or 365-366 days,
|
|
100
|
+
* first and last block may be partial).
|
|
101
|
+
*/
|
|
102
|
+
this.resBlockDayCounts = [];
|
|
103
|
+
this.resBlockStartDates = [];
|
|
104
|
+
this.resBlockKeys = [];
|
|
105
|
+
this.spacerBlocks = [];
|
|
106
|
+
this.yearRowData = new BlockRowData();
|
|
107
|
+
this.monthRowData = new BlockRowData();
|
|
108
|
+
// days/daysLength are needed only with resolutions smaller than Day.
|
|
109
|
+
this.dayRowData = new BlockRowData();
|
|
110
|
+
/*
|
|
111
|
+
* Currently active widths. Updated each time when timeline column widths
|
|
112
|
+
* are updated.
|
|
113
|
+
*/
|
|
114
|
+
this.dayWidthPercentage = 0;
|
|
115
|
+
this.dayOrHourWidthPx = 0;
|
|
116
|
+
this.resBlockMinWidthPx = 0;
|
|
117
|
+
this.resBlockWidthPx = 0;
|
|
118
|
+
this.resBlockWidthPercentage = 0;
|
|
119
|
+
this.minResolutionWidth = -1;
|
|
120
|
+
this.calcPixels = false;
|
|
121
|
+
this.positionLeft = 0;
|
|
122
|
+
this.setPositionForEachBlock = false;
|
|
123
|
+
this.firstWeekBlockHidden = false;
|
|
124
|
+
this.ie = false; // deprecated property
|
|
125
|
+
/* directlyInsideScrollContainer:
|
|
126
|
+
true: timeline element is a child element inside a container with scroll bar.
|
|
127
|
+
false: timeline.style.left is adjusted by scrollHandler. */
|
|
128
|
+
this.directlyInsideScrollContainer = true;
|
|
129
|
+
this.previousContainerScrollLeft = 0;
|
|
130
|
+
this.previousContainerScrollTop = 0;
|
|
131
|
+
}
|
|
132
|
+
connectedCallback() {
|
|
133
|
+
super.connectedCallback();
|
|
134
|
+
if (this.scrollContainer && this.scrollHandler) {
|
|
135
|
+
this.scrollContainer.addEventListener('scroll', this.scrollHandler);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
disconnectedCallback() {
|
|
139
|
+
super.disconnectedCallback();
|
|
140
|
+
if (this.scrollContainer && this.scrollHandler) {
|
|
141
|
+
this.scrollContainer.removeEventListener('scroll', this.scrollHandler);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
static get styles() {
|
|
127
145
|
return css `
|
|
128
146
|
:host {
|
|
129
147
|
display: block;
|
|
130
148
|
overflow: hidden;
|
|
131
149
|
position: relative;
|
|
132
|
-
|
|
133
|
-
--no-user-select: {
|
|
134
|
-
-webkit-user-select: none;
|
|
135
|
-
-khtml-user-select: none;
|
|
136
|
-
-moz-user-select: none;
|
|
137
|
-
-ms-user-select: none;
|
|
138
|
-
user-select: none;
|
|
139
|
-
}
|
|
140
150
|
}
|
|
141
151
|
:host([hidden]) {
|
|
142
152
|
display: none;
|
|
143
153
|
}
|
|
144
|
-
|
|
154
|
+
|
|
145
155
|
.year,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
padding-left: 0px;
|
|
160
|
-
}
|
|
156
|
+
.month,
|
|
157
|
+
.day {
|
|
158
|
+
padding-left: 2px;
|
|
159
|
+
text-overflow: ellipsis;
|
|
160
|
+
white-space: nowrap;
|
|
161
|
+
border-right: 1px solid #A9A9A9;
|
|
162
|
+
box-sizing: border-box;
|
|
163
|
+
}
|
|
164
|
+
.year.spacer,
|
|
165
|
+
.month.spacer,
|
|
166
|
+
.day.spacer {
|
|
167
|
+
padding-left: 0px;
|
|
168
|
+
}
|
|
161
169
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
170
|
+
.month:nth-of-type(even),
|
|
171
|
+
.day:nth-of-type(even) {
|
|
172
|
+
background-color: var(--timeline-row-even-background, #ddd);
|
|
173
|
+
}
|
|
174
|
+
.col.even {
|
|
175
|
+
background-color: var(--timeline-col-even-background-color, #ccc);
|
|
176
|
+
}
|
|
169
177
|
|
|
170
|
-
|
|
178
|
+
.col {
|
|
171
179
|
position: var(--timeline-col-position);
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
180
|
+
left: var(--timeline-col-left);
|
|
181
|
+
height: 100%;
|
|
182
|
+
float: left;
|
|
183
|
+
overflow: hidden;
|
|
184
|
+
border-right: 1px solid #A9A9A9;
|
|
185
|
+
background-color: var(--timeline-col-background-color, #ddd);
|
|
186
|
+
font-size: var(--timeline-col-font-size, 10px);
|
|
187
|
+
text-align: center;
|
|
188
|
+
box-sizing: border-box;
|
|
189
|
+
-webkit-touch-callout: none;
|
|
190
|
+
-webkit-user-select: none;
|
|
191
|
+
user-select: none;
|
|
192
|
+
}
|
|
186
193
|
|
|
187
194
|
.c-col {
|
|
188
|
-
|
|
189
|
-
|
|
195
|
+
width: var(--timeline-col-center-width);
|
|
196
|
+
}
|
|
190
197
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
198
|
+
.f-col {
|
|
199
|
+
width: var(--timeline-col-first-width);
|
|
200
|
+
}
|
|
194
201
|
|
|
195
|
-
|
|
196
|
-
|
|
202
|
+
.l-col {
|
|
203
|
+
width: var(--timeline-col-last-width);
|
|
197
204
|
}
|
|
198
|
-
|
|
199
|
-
.col.w,
|
|
200
|
-
.col.m,
|
|
201
|
-
.col.y {
|
|
202
|
-
text-align: left;
|
|
203
|
-
}
|
|
204
205
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
206
|
+
.col.w,
|
|
207
|
+
.col.m,
|
|
208
|
+
.col.y {
|
|
209
|
+
text-align: left;
|
|
210
|
+
}
|
|
208
211
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
}
|
|
212
|
+
.col.weekend {
|
|
213
|
+
background-color: var(--timeline-col-weekend, #ccc);
|
|
214
|
+
}
|
|
213
215
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
.col.w.measure {
|
|
219
|
-
// Change min-width to adjust grid's cell width with week-resolution.
|
|
220
|
-
//min-width: 70px;
|
|
221
|
-
}
|
|
222
|
-
.col.m.measure {
|
|
223
|
-
// Change min-width to adjust grid's cell width with month-resolution (width of a 30 day month).
|
|
224
|
-
//min-width: 120px;
|
|
225
|
-
}
|
|
226
|
-
.col.y.measure {
|
|
227
|
-
// Change min-width to adjust grid's cell width with year-resolution (width of a 365 day year).
|
|
228
|
-
//min-width: 365px;
|
|
229
|
-
}
|
|
216
|
+
.col.current,
|
|
217
|
+
.day.current {
|
|
218
|
+
background-color: var(--timeline-col-current, #ffe082);
|
|
219
|
+
}
|
|
230
220
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
221
|
+
/*
|
|
222
|
+
* Minimum block widths are measured from these hidden elements (see
|
|
223
|
+
* calculateResolutionMinWidth()). An unset custom property leaves
|
|
224
|
+
* min-width unset, so the defaults apply.
|
|
225
|
+
*/
|
|
226
|
+
.col.measure {
|
|
227
|
+
/* Day and hour block. */
|
|
228
|
+
min-width: var(--timeline-col-min-width);
|
|
229
|
+
}
|
|
230
|
+
.col.w.measure {
|
|
231
|
+
/* One week block. */
|
|
232
|
+
min-width: var(--timeline-col-week-min-width);
|
|
233
|
+
}
|
|
234
|
+
.col.m.measure {
|
|
235
|
+
/* A 30 day month block. */
|
|
236
|
+
min-width: var(--timeline-col-month-min-width);
|
|
237
|
+
}
|
|
238
|
+
.col.y.measure {
|
|
239
|
+
/* A 365 day year block. */
|
|
240
|
+
min-width: var(--timeline-col-year-min-width);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.row {
|
|
244
|
+
width: 100%;
|
|
245
|
+
float: left;
|
|
246
|
+
overflow: hidden;
|
|
247
|
+
height: var(--timeline-row-height, 15px);
|
|
248
|
+
font-size: var(--timeline-row-font-size, 10px);
|
|
249
|
+
background-color: var(--timeline-row-background, #d0d0d0);
|
|
250
|
+
-webkit-touch-callout: none;
|
|
251
|
+
-webkit-user-select: none;
|
|
252
|
+
user-select: none;
|
|
253
|
+
}
|
|
254
|
+
`;
|
|
255
|
+
}
|
|
256
|
+
render() {
|
|
245
257
|
return html `
|
|
246
258
|
${this.yearBlocks()}
|
|
247
259
|
${this.monthBlocks()}
|
|
248
260
|
${this.dayBlocks()}
|
|
249
|
-
<div id="resolutionDiv" class="row resolution"></div>`;
|
|
250
|
-
}
|
|
251
|
-
yearBlocks() {
|
|
252
|
-
if (this.isYearRowVisible()) {
|
|
253
|
-
return this.timelineBlocks(this.yearRowData, TimelineElement_1.STYLE_YEAR);
|
|
254
|
-
}
|
|
255
|
-
return nothing;
|
|
256
|
-
}
|
|
257
|
-
monthBlocks() {
|
|
258
|
-
if (this.isMonthRowVisible()) {
|
|
259
|
-
return this.timelineBlocks(this.monthRowData, TimelineElement_1.STYLE_MONTH);
|
|
260
|
-
}
|
|
261
|
-
return nothing;
|
|
262
|
-
}
|
|
263
|
-
dayBlocks() {
|
|
264
|
-
if (this.isDayRowVisible) {
|
|
265
|
-
return this.timelineBlocks(this.dayRowData, TimelineElement_1.STYLE_DAY);
|
|
266
|
-
}
|
|
267
|
-
return nothing;
|
|
268
|
-
}
|
|
269
|
-
shouldUpdate(changedProperties) {
|
|
270
|
-
return changedProperties.has('resolution')
|
|
271
|
-
|| changedProperties.has('startDateTime')
|
|
272
|
-
|| changedProperties.has('endDateTime')
|
|
273
|
-
|| changedProperties.has('locale')
|
|
274
|
-
|| changedProperties.has('timeZone')
|
|
275
|
-
|| changedProperties.has('firstDayOfWeek')
|
|
276
|
-
|| changedProperties.has('twelveHourClock')
|
|
277
|
-
|| changedProperties.has('yearRowVisible')
|
|
278
|
-
|| changedProperties.has('monthRowVisible')
|
|
279
|
-
|| changedProperties.has('monthNames')
|
|
280
|
-
|| changedProperties.has('weekdayNames')
|
|
281
|
-
|| changedProperties.has('currentDateVisible');
|
|
282
|
-
}
|
|
283
|
-
willUpdate(changedProps) {
|
|
284
|
-
if (changedProps.has('resolution')) {
|
|
285
|
-
this.minResolutionWidth = -1;
|
|
286
|
-
}
|
|
287
|
-
if (changedProps.has('resolution') || changedProps.has('startDateTime') || changedProps.has('timeZone')) {
|
|
288
|
-
this.firstDayOfRange = null;
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
if (changedProps.has('resolution') || changedProps.has('endDateTime') || changedProps.has('timeZone')) {
|
|
297
|
-
//
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
this.
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
* @param
|
|
334
|
-
*
|
|
335
|
-
* @param
|
|
336
|
-
* Time-line's
|
|
337
|
-
* @param
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
this.
|
|
356
|
-
this.
|
|
357
|
-
this.
|
|
358
|
-
this.
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
this.
|
|
373
|
-
this.
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
//
|
|
377
|
-
|
|
378
|
-
this.
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
scrollContainer
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
this.
|
|
425
|
-
this.
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
//
|
|
447
|
-
resBlockMeasure.
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
this.
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
this.
|
|
502
|
-
this.
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
this.
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
*
|
|
541
|
-
*
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
block.
|
|
551
|
-
block
|
|
552
|
-
block
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
//
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
block
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
div.
|
|
636
|
-
div.
|
|
637
|
-
|
|
638
|
-
rowData.
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
if (dayCounter === this.
|
|
670
|
-
return Weekday.
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
this.
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
let
|
|
694
|
-
let
|
|
695
|
-
let
|
|
696
|
-
let
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
if (this.
|
|
707
|
-
|
|
708
|
-
}
|
|
709
|
-
if (this.
|
|
710
|
-
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
this.
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
timeline.
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
this.
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
let
|
|
752
|
-
let
|
|
753
|
-
let
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
let
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
lastTimelineBlock =
|
|
764
|
-
resBlockRegisterer.registerResolutionBlock(index, date, currentYear, lastTimelineBlock);
|
|
765
|
-
if (this.isYearRowVisible()) {
|
|
766
|
-
currentYear = this.addYearBlock(currentYear, date);
|
|
767
|
-
}
|
|
768
|
-
if (this.isMonthRowVisible()) {
|
|
769
|
-
currentMonth = this.addMonthBlock(currentMonth, date);
|
|
770
|
-
}
|
|
771
|
-
if (this.isDayRowVisible()) {
|
|
772
|
-
currentDay = this.addDayBlock(currentDay, date);
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
*
|
|
784
|
-
*
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
*
|
|
799
|
-
*
|
|
800
|
-
*
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
*
|
|
824
|
-
*
|
|
825
|
-
*
|
|
826
|
-
*
|
|
827
|
-
*
|
|
828
|
-
*
|
|
829
|
-
*
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
*
|
|
842
|
-
*
|
|
843
|
-
*
|
|
844
|
-
*
|
|
845
|
-
*
|
|
846
|
-
* @param
|
|
847
|
-
*
|
|
848
|
-
* @
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
return (
|
|
890
|
-
}
|
|
891
|
-
/**
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
return
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
return
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
return
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
this.
|
|
1014
|
-
|
|
1015
|
-
//
|
|
1016
|
-
|
|
1017
|
-
//
|
|
1018
|
-
this.
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
this.
|
|
1035
|
-
}
|
|
1036
|
-
else {
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
this.
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
*
|
|
1098
|
-
*
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
case Resolution.
|
|
1145
|
-
element = this.
|
|
1146
|
-
break;
|
|
1147
|
-
case Resolution.
|
|
1148
|
-
element = this.
|
|
1149
|
-
break;
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
}
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
resBlock
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
resBlock
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
this.
|
|
1237
|
-
this.
|
|
1238
|
-
this.
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
this.
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
this.
|
|
1290
|
-
|
|
1291
|
-
this.
|
|
1292
|
-
}
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
if (
|
|
1383
|
-
return
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
if (
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
return null;
|
|
1399
|
-
}
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
//
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
}
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
this.
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
resBlock
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
this.
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
return
|
|
1674
|
-
}
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
}
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
resBlock.style.
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
resBlock.style.
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
this.
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
resBlock.style.
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
}
|
|
1904
|
-
|
|
1905
|
-
TimelineElement.
|
|
1906
|
-
TimelineElement.
|
|
1907
|
-
TimelineElement.
|
|
1908
|
-
TimelineElement.
|
|
1909
|
-
TimelineElement.
|
|
1910
|
-
TimelineElement.
|
|
1911
|
-
TimelineElement.
|
|
1912
|
-
TimelineElement.
|
|
1913
|
-
TimelineElement.
|
|
1914
|
-
TimelineElement.
|
|
1915
|
-
TimelineElement.
|
|
1916
|
-
TimelineElement.
|
|
1917
|
-
TimelineElement.
|
|
1918
|
-
TimelineElement.
|
|
1919
|
-
TimelineElement.
|
|
1920
|
-
TimelineElement.
|
|
1921
|
-
TimelineElement.
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
TimelineElement.
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
toAttribute: (value
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
})
|
|
1949
|
-
], TimelineElement.prototype, "
|
|
1950
|
-
__decorate([
|
|
1951
|
-
property({
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
__decorate([
|
|
2003
|
-
property()
|
|
2004
|
-
], TimelineElement.prototype, "weekdayNames", void 0);
|
|
2005
|
-
__decorate([
|
|
2006
|
-
property({ reflect: true, type: Boolean })
|
|
2007
|
-
], TimelineElement.prototype, "currentDateVisible", void 0);
|
|
2008
|
-
__decorate([
|
|
2009
|
-
query('#resolutionDiv')
|
|
2010
|
-
], TimelineElement.prototype, "resolutionDiv", void 0);
|
|
2011
|
-
TimelineElement = TimelineElement_1 = __decorate([
|
|
2012
|
-
customElement('timeline-element')
|
|
2013
|
-
], TimelineElement);
|
|
261
|
+
<div id="resolutionDiv" class="row resolution"></div>`;
|
|
262
|
+
}
|
|
263
|
+
yearBlocks() {
|
|
264
|
+
if (this.isYearRowVisible()) {
|
|
265
|
+
return this.timelineBlocks(this.yearRowData, TimelineElement_1.STYLE_YEAR);
|
|
266
|
+
}
|
|
267
|
+
return nothing;
|
|
268
|
+
}
|
|
269
|
+
monthBlocks() {
|
|
270
|
+
if (this.isMonthRowVisible()) {
|
|
271
|
+
return this.timelineBlocks(this.monthRowData, TimelineElement_1.STYLE_MONTH);
|
|
272
|
+
}
|
|
273
|
+
return nothing;
|
|
274
|
+
}
|
|
275
|
+
dayBlocks() {
|
|
276
|
+
if (this.isDayRowVisible()) {
|
|
277
|
+
return this.timelineBlocks(this.dayRowData, TimelineElement_1.STYLE_DAY);
|
|
278
|
+
}
|
|
279
|
+
return nothing;
|
|
280
|
+
}
|
|
281
|
+
shouldUpdate(changedProperties) {
|
|
282
|
+
return changedProperties.has('resolution')
|
|
283
|
+
|| changedProperties.has('startDateTime')
|
|
284
|
+
|| changedProperties.has('endDateTime')
|
|
285
|
+
|| changedProperties.has('locale')
|
|
286
|
+
|| changedProperties.has('timeZone')
|
|
287
|
+
|| changedProperties.has('firstDayOfWeek')
|
|
288
|
+
|| changedProperties.has('twelveHourClock')
|
|
289
|
+
|| changedProperties.has('yearRowVisible')
|
|
290
|
+
|| changedProperties.has('monthRowVisible')
|
|
291
|
+
|| changedProperties.has('monthNames')
|
|
292
|
+
|| changedProperties.has('weekdayNames')
|
|
293
|
+
|| changedProperties.has('currentDateVisible');
|
|
294
|
+
}
|
|
295
|
+
willUpdate(changedProps) {
|
|
296
|
+
if (changedProps.has('resolution')) {
|
|
297
|
+
this.minResolutionWidth = -1;
|
|
298
|
+
}
|
|
299
|
+
if (changedProps.has('resolution') || changedProps.has('startDateTime') || changedProps.has('timeZone')) {
|
|
300
|
+
this.firstDayOfRange = null;
|
|
301
|
+
this.firstHourOfRange = null;
|
|
302
|
+
// Start is the first instant of the given hour/day (like Temporal's
|
|
303
|
+
// startOfDay): a repeated hour starts at its first occurrence, and a
|
|
304
|
+
// skipped midnight/hour starts at the first wall time that exists.
|
|
305
|
+
const start = parseWallTime(this.startDateTime.substring(0, this.resolution === Resolution.Hour ? 13 : 10));
|
|
306
|
+
this.internalInclusiveStartDateTime = zonedWallTimeToInstant(start, this.timeZone);
|
|
307
|
+
}
|
|
308
|
+
if (changedProps.has('resolution') || changedProps.has('endDateTime') || changedProps.has('timeZone')) {
|
|
309
|
+
// End is the last millisecond of the given hour/day, i.e. 1 ms before the next
|
|
310
|
+
// hour/day starts: 1AM becomes "01:59:59.999". A repeated end hour includes
|
|
311
|
+
// both occurrences; a skipped end hour adds nothing after the previous hour.
|
|
312
|
+
const end = parseWallTime(this.endDateTime.substring(0, this.resolution === Resolution.Hour ? 13 : 10));
|
|
313
|
+
const next = this.resolution === Resolution.Hour ? { ...end, hour: end.hour + 1 } : { ...end, day: end.day + 1 };
|
|
314
|
+
this.internalInclusiveEndDateTime = new Date(zonedWallTimeToInstant(next, this.timeZone).getTime() - 1);
|
|
315
|
+
}
|
|
316
|
+
this.updateTimeLine(this.resolution, this.internalInclusiveStartDateTime, this.internalInclusiveEndDateTime, new DefaultLocaleDataProvider(this.locale, this.timeZone, this.firstDayOfWeek, this.twelveHourClock));
|
|
317
|
+
}
|
|
318
|
+
updated() {
|
|
319
|
+
if (!(this.resolution) || !this.internalInclusiveStartDateTime || !this.internalInclusiveEndDateTime) {
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
if (this.resolution !== Resolution.Day && this.resolution !== Resolution.Week && this.resolution !== Resolution.Hour
|
|
323
|
+
&& !this.isMonthOrYearResolution()) {
|
|
324
|
+
console.warn("TimelineElement resolution " + (this.resolution ? Resolution[this.resolution] : "null")
|
|
325
|
+
+ " is not supported");
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
this.log("TimelineElement Constructed content.");
|
|
329
|
+
this.updateWidths();
|
|
330
|
+
this.log("TimelineElement is updated for resolution " + Resolution[this.resolution] + ".");
|
|
331
|
+
this.registerScrollHandler();
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* <p>
|
|
335
|
+
* Updates the content of this component. Builds the time-line and calculates
|
|
336
|
+
* width and heights for the content (calls in the end
|
|
337
|
+
* {@link #updateWidths()}). This should be called explicitly. Otherwise the
|
|
338
|
+
* component will be empty.
|
|
339
|
+
* <p>
|
|
340
|
+
* Date values should always follow specification in {@link Date#getTime()}.
|
|
341
|
+
* Start and end date is always required.
|
|
342
|
+
*
|
|
343
|
+
* @param resolution
|
|
344
|
+
* Resolution enum (not null)
|
|
345
|
+
* @param startDate
|
|
346
|
+
* Time-line's start date. (inclusive; not null)
|
|
347
|
+
* @param endDate
|
|
348
|
+
* Time-line's end date. (inclusive; not null)
|
|
349
|
+
* @param localeDataProvider
|
|
350
|
+
* Data provider for locale specific data. month names, first day
|
|
351
|
+
* of week etc.
|
|
352
|
+
*
|
|
353
|
+
*/
|
|
354
|
+
updateTimeLine(resolution, startDate, endDate, localeDataProvider) {
|
|
355
|
+
if (!localeDataProvider) {
|
|
356
|
+
console.warn("TimelineElement requires ILocaleDataProvider. Can't complete update(...) operation.");
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
this.clear();
|
|
360
|
+
this.log("TimelineElement content cleared.");
|
|
361
|
+
if (!(resolution) || !startDate || !endDate) {
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
this.log("TimelineElement Updating content.");
|
|
365
|
+
this.localeDataProvider = localeDataProvider;
|
|
366
|
+
this.resolution = resolution;
|
|
367
|
+
this.resetDateRange(startDate, endDate);
|
|
368
|
+
this.lastDayOfWeek = (localeDataProvider.getFirstDayOfWeek() == 1) ? 7 : Math.max((localeDataProvider.getFirstDayOfWeek() - 1) % 8, 1);
|
|
369
|
+
this.monthNames = this.monthNames || localeDataProvider.getMonthNames();
|
|
370
|
+
this.weekdayNames = this.weekdayNames || localeDataProvider.getWeekdayNames();
|
|
371
|
+
if (this.minResolutionWidth < 0) {
|
|
372
|
+
this.minResolutionWidth = this.calculateResolutionMinWidth();
|
|
373
|
+
}
|
|
374
|
+
if (this.resolution === Resolution.Day || this.resolution === Resolution.Week || this.isMonthOrYearResolution()) {
|
|
375
|
+
this.prepareTimelineForDayOrWeekResolution(this.internalInclusiveStartDateTime, this.internalInclusiveEndDateTime);
|
|
376
|
+
}
|
|
377
|
+
else if (this.resolution === Resolution.Hour) {
|
|
378
|
+
this.prepareTimelineForHourResolution(this.internalInclusiveStartDateTime, this.internalInclusiveEndDateTime);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
resetDateRange(startDate, endDate) {
|
|
382
|
+
this.internalInclusiveStartDateTime = startDate;
|
|
383
|
+
this.internalInclusiveEndDateTime = endDate;
|
|
384
|
+
this.normalStartDate = this.toNormalDate(this.internalInclusiveStartDateTime);
|
|
385
|
+
this.normalEndDate = this.toNormalDate(this.internalInclusiveEndDateTime);
|
|
386
|
+
// Weekday and hour in the timeline's time zone (not the browser's).
|
|
387
|
+
const zonedStart = getZonedFields(this.internalInclusiveStartDateTime, this.localeDataProvider.getTimeZone());
|
|
388
|
+
// zonedStart.dayOfWeek is ISO (Monday = 1 ... Sunday = 7); firstDayOfRange is 1-based from Sunday (Sunday = 1).
|
|
389
|
+
this.firstDayOfRange = this.firstDayOfRange || (zonedStart.dayOfWeek % 7) + 1;
|
|
390
|
+
this.firstHourOfRange = this.firstHourOfRange || zonedStart.hour;
|
|
391
|
+
}
|
|
392
|
+
registerScrollHandler() {
|
|
393
|
+
if (this.scrollHandler) {
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
this.scrollContainer = this.setupScrollContainer();
|
|
397
|
+
this.scrollHandler = () => {
|
|
398
|
+
window.requestAnimationFrame(() => {
|
|
399
|
+
const container = this.scrollContainer;
|
|
400
|
+
const sl = container instanceof Window ? container.scrollX : container.scrollLeft;
|
|
401
|
+
const st = container instanceof Window ? container.scrollY : container.scrollTop;
|
|
402
|
+
if (sl != this.previousContainerScrollLeft) {
|
|
403
|
+
this.setScrollLeft(sl);
|
|
404
|
+
this.previousContainerScrollLeft = sl;
|
|
405
|
+
}
|
|
406
|
+
if (st != this.previousContainerScrollTop) {
|
|
407
|
+
this.previousContainerScrollTop = st;
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
};
|
|
411
|
+
this.scrollContainer.addEventListener('scroll', this.scrollHandler);
|
|
412
|
+
}
|
|
413
|
+
setupScrollContainer() {
|
|
414
|
+
let scrollContainer;
|
|
415
|
+
if (this.scrollContainerId) {
|
|
416
|
+
scrollContainer = this.getParentElement(this).querySelector('#' + this.scrollContainerId);
|
|
417
|
+
if (!scrollContainer) {
|
|
418
|
+
scrollContainer = document.querySelector('#' + this.scrollContainerId);
|
|
419
|
+
}
|
|
420
|
+
if (scrollContainer) {
|
|
421
|
+
scrollContainer.style.overflowX = "auto";
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
if (!scrollContainer) {
|
|
425
|
+
scrollContainer = this.getParentElement(this);
|
|
426
|
+
this.directlyInsideScrollContainer = true;
|
|
427
|
+
if (scrollContainer === document.body) {
|
|
428
|
+
return window; // window scrolls by default, not body
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
return scrollContainer;
|
|
432
|
+
}
|
|
433
|
+
clear() {
|
|
434
|
+
this.spacerBlocks = [];
|
|
435
|
+
this.yearRowData.clear();
|
|
436
|
+
this.monthRowData.clear();
|
|
437
|
+
this.dayRowData.clear();
|
|
438
|
+
}
|
|
439
|
+
calculateResolutionMinWidth() {
|
|
440
|
+
const resDivMeasure = document.createElement('div');
|
|
441
|
+
resDivMeasure.classList.add(TimelineElement_1.STYLE_ROW, TimelineElement_1.STYLE_RESOLUTION);
|
|
442
|
+
const resBlockMeasure = document.createElement('div');
|
|
443
|
+
if (this.resolution === Resolution.Week) {
|
|
444
|
+
// configurable with '.col.w.measure' selector
|
|
445
|
+
resBlockMeasure.classList.add(TimelineElement_1.STYLE_COL, TimelineElement_1.STYLE_WEEK, TimelineElement_1.STYLE_MEASURE);
|
|
446
|
+
}
|
|
447
|
+
else if (this.resolution === Resolution.Month) {
|
|
448
|
+
// configurable with '.col.m.measure' selector
|
|
449
|
+
resBlockMeasure.classList.add(TimelineElement_1.STYLE_COL, TimelineElement_1.STYLE_MONTH_RES, TimelineElement_1.STYLE_MEASURE);
|
|
450
|
+
}
|
|
451
|
+
else if (this.resolution === Resolution.Year) {
|
|
452
|
+
// configurable with '.col.y.measure' selector
|
|
453
|
+
resBlockMeasure.classList.add(TimelineElement_1.STYLE_COL, TimelineElement_1.STYLE_YEAR_RES, TimelineElement_1.STYLE_MEASURE);
|
|
454
|
+
}
|
|
455
|
+
else {
|
|
456
|
+
// measure for text 'MM'
|
|
457
|
+
resBlockMeasure.innerText = "MM";
|
|
458
|
+
// configurable with '.col.measure' selector
|
|
459
|
+
resBlockMeasure.classList.add(TimelineElement_1.STYLE_COL, TimelineElement_1.STYLE_MEASURE);
|
|
460
|
+
}
|
|
461
|
+
resDivMeasure.appendChild(resBlockMeasure);
|
|
462
|
+
this.shadowRoot.appendChild(resDivMeasure);
|
|
463
|
+
let width = resBlockMeasure.clientWidth;
|
|
464
|
+
if (this.resolution === Resolution.Week) {
|
|
465
|
+
// divide given width by number of days in week
|
|
466
|
+
width = width / DateTimeConstants.DAYS_IN_WEEK;
|
|
467
|
+
}
|
|
468
|
+
let minDayWidth = this.resolutionWeekDayblockWidth;
|
|
469
|
+
if (this.resolution === Resolution.Month) {
|
|
470
|
+
// divide given width by average number of days in month
|
|
471
|
+
width = width / TimelineElement_1.AVERAGE_DAYS_IN_MONTH;
|
|
472
|
+
minDayWidth = this.resolutionMonthDayblockWidth;
|
|
473
|
+
}
|
|
474
|
+
else if (this.resolution === Resolution.Year) {
|
|
475
|
+
// divide given width by number of days in year
|
|
476
|
+
width = width / TimelineElement_1.AVERAGE_DAYS_IN_YEAR;
|
|
477
|
+
minDayWidth = this.resolutionYearDayblockWidth;
|
|
478
|
+
}
|
|
479
|
+
width = (width < minDayWidth) ? minDayWidth : width;
|
|
480
|
+
this.shadowRoot.removeChild(resDivMeasure);
|
|
481
|
+
return width;
|
|
482
|
+
}
|
|
483
|
+
registerHourResolutionBlock() {
|
|
484
|
+
this.blocksInRange++;
|
|
485
|
+
this.resolutionBlockCount++;
|
|
486
|
+
}
|
|
487
|
+
registerDayResolutionBlock() {
|
|
488
|
+
this.blocksInRange++;
|
|
489
|
+
this.resolutionBlockCount++;
|
|
490
|
+
}
|
|
491
|
+
registerWeekResolutionBlock(index, weekDay, lastBlock, firstWeek) {
|
|
492
|
+
if (index == 0 || weekDay === Weekday.First) {
|
|
493
|
+
this.resolutionBlockCount++;
|
|
494
|
+
}
|
|
495
|
+
if (firstWeek && (weekDay === Weekday.Last || lastBlock)) {
|
|
496
|
+
this.firstResBlockCount = index + 1;
|
|
497
|
+
}
|
|
498
|
+
else if (lastBlock) {
|
|
499
|
+
this.lastResBlockCount = (index + 1 - this.firstResBlockCount) % 7;
|
|
500
|
+
}
|
|
501
|
+
this.blocksInRange++;
|
|
502
|
+
}
|
|
503
|
+
/*
|
|
504
|
+
* Registers one day for Month or Year resolution. A new resolution block is
|
|
505
|
+
* started whenever the month (or year) of the given date changes.
|
|
506
|
+
*/
|
|
507
|
+
registerMonthOrYearResolutionBlock(index, date) {
|
|
508
|
+
const key = this.getMonthOrYearResolutionBlockKey(date);
|
|
509
|
+
const lastIndex = this.resBlockKeys.length - 1;
|
|
510
|
+
if (index == 0 || lastIndex < 0 || this.resBlockKeys[lastIndex] !== key) {
|
|
511
|
+
this.resolutionBlockCount++;
|
|
512
|
+
this.resBlockKeys.push(key);
|
|
513
|
+
this.resBlockStartDates.push(date);
|
|
514
|
+
this.resBlockDayCounts.push(1);
|
|
515
|
+
}
|
|
516
|
+
else {
|
|
517
|
+
this.resBlockDayCounts[lastIndex]++;
|
|
518
|
+
}
|
|
519
|
+
this.firstResBlockCount = this.resBlockDayCounts[0];
|
|
520
|
+
this.lastResBlockCount = this.resBlockDayCounts[this.resBlockDayCounts.length - 1];
|
|
521
|
+
this.blocksInRange++;
|
|
522
|
+
}
|
|
523
|
+
/* Returns 'yyyy-MM' key for Month resolution and 'yyyy' key for Year resolution. */
|
|
524
|
+
getMonthOrYearResolutionBlockKey(date) {
|
|
525
|
+
return this.localeDataProvider.formatDate(date, this.resolution === Resolution.Year ? "yyyy" : "yyyy-MM");
|
|
526
|
+
}
|
|
527
|
+
isMonthOrYearResolution() {
|
|
528
|
+
return this.resolution === Resolution.Month || this.resolution === Resolution.Year;
|
|
529
|
+
}
|
|
530
|
+
/* Year row is hidden with Year resolution as the resolution row shows years already. */
|
|
531
|
+
isYearRowVisible() {
|
|
532
|
+
return this.yearRowVisible && this.resolution !== Resolution.Year;
|
|
533
|
+
}
|
|
534
|
+
/* Month row is hidden with Month and Year resolutions: Month resolution row shows months already,
|
|
535
|
+
* and Year resolution shows a single year row. */
|
|
536
|
+
isMonthRowVisible() {
|
|
537
|
+
return this.monthRowVisible && !this.isMonthOrYearResolution();
|
|
538
|
+
}
|
|
539
|
+
timelineBlocks(rowData, style) {
|
|
540
|
+
const itemTemplates = [];
|
|
541
|
+
for (const entry of rowData.getBlockEntries()) {
|
|
542
|
+
itemTemplates.push(html `${entry[1]}`);
|
|
543
|
+
}
|
|
544
|
+
if (this.isAlwaysCalculatePixelWidths()) {
|
|
545
|
+
itemTemplates.push(html `${this.createSpacerBlock(style)}`);
|
|
546
|
+
}
|
|
547
|
+
return itemTemplates;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Returns true if Widget is set to calculate widths by itself. Default is
|
|
551
|
+
* false.
|
|
552
|
+
*
|
|
553
|
+
* @return
|
|
554
|
+
*/
|
|
555
|
+
isAlwaysCalculatePixelWidths() {
|
|
556
|
+
return this.calcPixels;
|
|
557
|
+
}
|
|
558
|
+
createSpacerBlock(className) {
|
|
559
|
+
const block = document.createElement('div');
|
|
560
|
+
block.classList.add(TimelineElement_1.STYLE_ROW, className, TimelineElement_1.STYLE_SPACER);
|
|
561
|
+
block.innerText = " ";
|
|
562
|
+
block.style.display = "none"; // not visible by default
|
|
563
|
+
this.spacerBlocks.push(block);
|
|
564
|
+
return block;
|
|
565
|
+
}
|
|
566
|
+
/** Clears Daylight saving time adjustment from the given time. */
|
|
567
|
+
toNormalDate(zonedDate) {
|
|
568
|
+
return DateUtil.toNormalDate(zonedDate, this.localeDataProvider.getDaylightAdjustment(zonedDate));
|
|
569
|
+
}
|
|
570
|
+
getParentElement(node) {
|
|
571
|
+
const parent = node.parentNode;
|
|
572
|
+
if (!parent || parent.nodeType != Node.ELEMENT_NODE) {
|
|
573
|
+
return null;
|
|
574
|
+
}
|
|
575
|
+
return parent;
|
|
576
|
+
}
|
|
577
|
+
/* Logs a diagnostic message when the debug property is set. */
|
|
578
|
+
log(message) {
|
|
579
|
+
if (this.debug) {
|
|
580
|
+
console.log(message);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
getDay(date) {
|
|
584
|
+
// by adjusting the date to the middle of the day before formatting is a
|
|
585
|
+
// workaround to avoid DST issues with DateTimeFormatter.
|
|
586
|
+
const adjusted = DateUtil.adjustToMiddleOfDay(date, this.localeDataProvider.getTimeZone());
|
|
587
|
+
return this.localeDataProvider.formatDate(adjusted, "d");
|
|
588
|
+
}
|
|
589
|
+
getYear(date) {
|
|
590
|
+
return this.localeDataProvider.formatDate(date, "yyyy");
|
|
591
|
+
}
|
|
592
|
+
getMonth(date) {
|
|
593
|
+
const m = this.localeDataProvider.formatDate(date, "M");
|
|
594
|
+
return parseInt(m) - 1;
|
|
595
|
+
}
|
|
596
|
+
isWeekEnd(dayCounter) {
|
|
597
|
+
return dayCounter == 1 || dayCounter == 7;
|
|
598
|
+
}
|
|
599
|
+
key(prefix, rowData) {
|
|
600
|
+
return prefix + "_" + (rowData.size());
|
|
601
|
+
}
|
|
602
|
+
newKey(prefix, rowData) {
|
|
603
|
+
return prefix + "_" + (rowData.size() + 1);
|
|
604
|
+
}
|
|
605
|
+
addBlock(current, target, date, rowData, operation) {
|
|
606
|
+
let key;
|
|
607
|
+
if (target !== current) {
|
|
608
|
+
current = target;
|
|
609
|
+
key = this.newKey("" + current, rowData);
|
|
610
|
+
operation(target, key, date);
|
|
611
|
+
}
|
|
612
|
+
else {
|
|
613
|
+
key = this.key("" + current, rowData);
|
|
614
|
+
rowData.setBlockLength(key, rowData.getBlockLength(key) + 1);
|
|
615
|
+
}
|
|
616
|
+
return current;
|
|
617
|
+
}
|
|
618
|
+
addDayBlock(currentDay, date) {
|
|
619
|
+
const day = this.getDay(date);
|
|
620
|
+
return this.addBlock(currentDay, day, date, this.dayRowData, (day, key, date) => {
|
|
621
|
+
const block = this.addDayBlockElement(key, this.formatDayCaption(day, date));
|
|
622
|
+
block.dataset.day = this.localeDataProvider.formatDate(date, TimelineElement_1.CURRENT_DAY_FORMAT);
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
addMonthBlock(currentMonth, date) {
|
|
626
|
+
const month = this.getMonth(date);
|
|
627
|
+
return this.addBlock(currentMonth, "" + month, date, this.monthRowData, (target, key, date) => {
|
|
628
|
+
this.addMonthBlockElement(key, this.formatMonthCaption(month, date));
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
addYearBlock(currentYear, date) {
|
|
632
|
+
const year = this.getYear(date);
|
|
633
|
+
return this.addBlock(currentYear, year, date, this.yearRowData, (year, key, date) => {
|
|
634
|
+
this.addYearBlockElement(key, this.formatYearCaption(year, date));
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
addMonthBlockElement(key, text) {
|
|
638
|
+
this.createTimelineBlock(key, text, TimelineElement_1.STYLE_MONTH, this.monthRowData);
|
|
639
|
+
}
|
|
640
|
+
addYearBlockElement(key, text) {
|
|
641
|
+
this.createTimelineBlock(key, text, TimelineElement_1.STYLE_YEAR, this.yearRowData);
|
|
642
|
+
}
|
|
643
|
+
addDayBlockElement(key, text) {
|
|
644
|
+
return this.createTimelineBlock(key, text, TimelineElement_1.STYLE_DAY, this.dayRowData);
|
|
645
|
+
}
|
|
646
|
+
createTimelineBlock(key, text, styleSuffix, rowData) {
|
|
647
|
+
const div = document.createElement('div');
|
|
648
|
+
div.classList.add(TimelineElement_1.STYLE_ROW, styleSuffix);
|
|
649
|
+
div.innerText = text;
|
|
650
|
+
rowData.setBlockLength(key, 1);
|
|
651
|
+
rowData.setBlock(key, div);
|
|
652
|
+
return div;
|
|
653
|
+
}
|
|
654
|
+
formatDayCaption(day, date) {
|
|
655
|
+
if (!this.dayFormat || this.dayFormat === "") {
|
|
656
|
+
return day;
|
|
657
|
+
}
|
|
658
|
+
return this.localeDataProvider.formatDate(date, this.dayFormat);
|
|
659
|
+
}
|
|
660
|
+
formatYearCaption(year, date) {
|
|
661
|
+
if (!this.yearFormat || this.yearFormat === "") {
|
|
662
|
+
return year;
|
|
663
|
+
}
|
|
664
|
+
return this.localeDataProvider.formatDate(date, this.yearFormat);
|
|
665
|
+
}
|
|
666
|
+
formatWeekCaption(date) {
|
|
667
|
+
if (!this.weekFormat || this.weekFormat === "") {
|
|
668
|
+
// ISO week of the calendar date in the timeline's zone.
|
|
669
|
+
const { year, month, day } = getZonedFields(date, this.localeDataProvider.getTimeZone());
|
|
670
|
+
return "" + isoWeekOfYear(year, month, day);
|
|
671
|
+
}
|
|
672
|
+
return this.localeDataProvider.formatDate(date, this.weekFormat);
|
|
673
|
+
}
|
|
674
|
+
formatMonthCaption(month, date) {
|
|
675
|
+
if (!this.monthFormat || this.monthFormat === "") {
|
|
676
|
+
return this.monthNames[month];
|
|
677
|
+
}
|
|
678
|
+
return this.localeDataProvider.formatDate(date, this.monthFormat);
|
|
679
|
+
}
|
|
680
|
+
getWeekday(dayCounter) {
|
|
681
|
+
if (dayCounter === this.localeDataProvider.getFirstDayOfWeek()) {
|
|
682
|
+
return Weekday.First;
|
|
683
|
+
}
|
|
684
|
+
if (dayCounter === this.lastDayOfWeek) {
|
|
685
|
+
return Weekday.Last;
|
|
686
|
+
}
|
|
687
|
+
return Weekday.Between;
|
|
688
|
+
}
|
|
689
|
+
prepareTimelineForHourResolution(startDate, endDate) {
|
|
690
|
+
const timeline = this;
|
|
691
|
+
this.firstDay = true;
|
|
692
|
+
let hourCounter = this.firstHourOfRange;
|
|
693
|
+
this.prepareTimelineForHour(DateTimeConstants.HOUR_INTERVAL, startDate, endDate, {
|
|
694
|
+
registerResolutionBlock(index, date, currentYear, lastTimelineBlock) {
|
|
695
|
+
timeline.registerHourResolutionBlock();
|
|
696
|
+
hourCounter = Math.max((hourCounter + 1) % 25, 1);
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
prepareTimelineForHour(interval, startDate, endDate, resBlockRegisterer) {
|
|
701
|
+
this.blocksInRange = 0;
|
|
702
|
+
this.resolutionBlockCount = 0;
|
|
703
|
+
this.firstResBlockCount = 0;
|
|
704
|
+
this.lastResBlockCount = 0;
|
|
705
|
+
let currentYear = null;
|
|
706
|
+
let currentMonth = null;
|
|
707
|
+
let currentDay = null;
|
|
708
|
+
let pos = startDate;
|
|
709
|
+
const end = endDate;
|
|
710
|
+
let index = 0;
|
|
711
|
+
let lastTimelineBlock;
|
|
712
|
+
let date;
|
|
713
|
+
while (pos.getTime() <= end.getTime()) {
|
|
714
|
+
date = pos;
|
|
715
|
+
const nextHour = new Date(pos.getTime() + interval);
|
|
716
|
+
lastTimelineBlock = nextHour.getTime() > end.getTime();
|
|
717
|
+
resBlockRegisterer.registerResolutionBlock(index, date, currentYear, lastTimelineBlock);
|
|
718
|
+
if (this.yearRowVisible) {
|
|
719
|
+
currentYear = this.addYearBlock(currentYear, date);
|
|
720
|
+
}
|
|
721
|
+
if (this.monthRowVisible) {
|
|
722
|
+
currentMonth = this.addMonthBlock(currentMonth, date);
|
|
723
|
+
}
|
|
724
|
+
if (this.isDayRowVisible()) {
|
|
725
|
+
currentDay = this.addDayBlock(currentDay, date);
|
|
726
|
+
}
|
|
727
|
+
pos = nextHour;
|
|
728
|
+
index++;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
prepareTimelineForDayOrWeekResolution(startDate, endDate) {
|
|
732
|
+
const timeline = this;
|
|
733
|
+
let dayCounter = this.firstDayOfRange;
|
|
734
|
+
let weekday;
|
|
735
|
+
let firstWeek = true;
|
|
736
|
+
this.resBlockDayCounts = [];
|
|
737
|
+
this.resBlockStartDates = [];
|
|
738
|
+
this.resBlockKeys = [];
|
|
739
|
+
this.prepareTimelineForDayOrWeek(DateTimeConstants.DAY_INTERVAL, startDate, endDate, {
|
|
740
|
+
registerResolutionBlock: function (index, date, currentYear, lastTimelineBlock) {
|
|
741
|
+
weekday = timeline.getWeekday(dayCounter);
|
|
742
|
+
if (timeline.isMonthOrYearResolution()) {
|
|
743
|
+
timeline.registerMonthOrYearResolutionBlock(index, date);
|
|
744
|
+
}
|
|
745
|
+
else if (timeline.resolution === Resolution.Week) {
|
|
746
|
+
timeline.registerWeekResolutionBlock(index, weekday, lastTimelineBlock, firstWeek);
|
|
747
|
+
if (firstWeek && (weekday === Weekday.Last || lastTimelineBlock)) {
|
|
748
|
+
firstWeek = false;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
else {
|
|
752
|
+
timeline.registerDayResolutionBlock();
|
|
753
|
+
}
|
|
754
|
+
dayCounter = Math.max((dayCounter + 1) % 8, 1);
|
|
755
|
+
}
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
prepareTimelineForDayOrWeek(interval, startDate, endDate, resBlockRegisterer) {
|
|
759
|
+
this.blocksInRange = 0;
|
|
760
|
+
this.resolutionBlockCount = 0;
|
|
761
|
+
this.firstResBlockCount = 0;
|
|
762
|
+
this.lastResBlockCount = 0;
|
|
763
|
+
let currentYear = null;
|
|
764
|
+
let currentMonth = null;
|
|
765
|
+
let currentDay = null;
|
|
766
|
+
const timeZone = this.localeDataProvider.getTimeZone();
|
|
767
|
+
// One block per calendar day, positioned at 12:00 wall-clock time. Stepping by
|
|
768
|
+
// calendar days in the zone handles 23h/25h DST switch days.
|
|
769
|
+
let date = DateUtil.adjustToMiddleOfDay(startDate, timeZone);
|
|
770
|
+
const end = endDate;
|
|
771
|
+
let index = 0;
|
|
772
|
+
let lastTimelineBlock = false;
|
|
773
|
+
while (!lastTimelineBlock) {
|
|
774
|
+
const next = addDaysInZone(date, 1, timeZone);
|
|
775
|
+
lastTimelineBlock = next.getTime() > end.getTime();
|
|
776
|
+
resBlockRegisterer.registerResolutionBlock(index, date, currentYear, lastTimelineBlock);
|
|
777
|
+
if (this.isYearRowVisible()) {
|
|
778
|
+
currentYear = this.addYearBlock(currentYear, date);
|
|
779
|
+
}
|
|
780
|
+
if (this.isMonthRowVisible()) {
|
|
781
|
+
currentMonth = this.addMonthBlock(currentMonth, date);
|
|
782
|
+
}
|
|
783
|
+
if (this.isDayRowVisible()) {
|
|
784
|
+
currentDay = this.addDayBlock(currentDay, date);
|
|
785
|
+
}
|
|
786
|
+
date = next;
|
|
787
|
+
index++;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
isDayRowVisible() {
|
|
791
|
+
return this.resolution === Resolution.Hour;
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Get actual width of the timeline.
|
|
795
|
+
*
|
|
796
|
+
* @return
|
|
797
|
+
*/
|
|
798
|
+
getResolutionWidth() {
|
|
799
|
+
if (!this.isTimelineOverflowingHorizontally()) {
|
|
800
|
+
return this.calculateTimelineWidth();
|
|
801
|
+
}
|
|
802
|
+
let width = this.getResolutionDivWidth();
|
|
803
|
+
if (this.isAlwaysCalculatePixelWidths() && this.containsResBlockSpacer()) {
|
|
804
|
+
width = width - ElementUtil.getWidth(this.resSpacerDiv);
|
|
805
|
+
}
|
|
806
|
+
return width;
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* Calculate the exact width of the timeline. Excludes any spacers in the
|
|
810
|
+
* end.
|
|
811
|
+
*
|
|
812
|
+
* @return
|
|
813
|
+
*/
|
|
814
|
+
calculateTimelineWidth() {
|
|
815
|
+
const last = this.getLastResolutionElement();
|
|
816
|
+
if (last === null) {
|
|
817
|
+
return 0.0;
|
|
818
|
+
}
|
|
819
|
+
const r = ElementUtil.getRight(last);
|
|
820
|
+
const l = ElementUtil.getLeft(this.getFirstResolutionElement());
|
|
821
|
+
const timelineRealWidth = r - l;
|
|
822
|
+
return timelineRealWidth;
|
|
823
|
+
}
|
|
824
|
+
/*
|
|
825
|
+
* Get width of the resolution div element.
|
|
826
|
+
*/
|
|
827
|
+
getResolutionDivWidth() {
|
|
828
|
+
if (!this.isTimelineOverflowingHorizontally()) {
|
|
829
|
+
return ElementUtil.getWidth(this.resolutionDiv);
|
|
830
|
+
}
|
|
831
|
+
return this.blocksInRange * this.minResolutionWidth;
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Calculate matching left offset in percentage for a date (
|
|
835
|
+
* {@link Date#getTime()}).
|
|
836
|
+
*
|
|
837
|
+
* @param date
|
|
838
|
+
* Target date in milliseconds.
|
|
839
|
+
* @param contentWidth
|
|
840
|
+
* Width of the content that the given 'date' is relative to.
|
|
841
|
+
* @return Left offset in percentage.
|
|
842
|
+
*/
|
|
843
|
+
getLeftPositionPercentageForDate(date, contentWidth) {
|
|
844
|
+
const timelineLeft = this.getLeftPositionForDate(date);
|
|
845
|
+
const relativeLeft = this.convertRelativeLeftPosition(timelineLeft, contentWidth);
|
|
846
|
+
const width = this.getResolutionWidth();
|
|
847
|
+
if (width <= 0) {
|
|
848
|
+
return 0; // not rendered (yet)
|
|
849
|
+
}
|
|
850
|
+
return (100.0 / width) * relativeLeft;
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Calculate CSS value for 'left' property matching left offset in
|
|
854
|
+
* percentage for a date ( {@link Date#getTime()}).
|
|
855
|
+
* <p>
|
|
856
|
+
* May return '2.123456%' or 'calc(2.123456%)' if IE;
|
|
857
|
+
*
|
|
858
|
+
* @param date
|
|
859
|
+
* Target date in milliseconds.
|
|
860
|
+
* @param contentWidth
|
|
861
|
+
* Width of the content that the given 'date' is relative to.
|
|
862
|
+
* @return Left offset as a String value.
|
|
863
|
+
*/
|
|
864
|
+
getLeftPositionPercentageStringForDate(date, contentWidth) {
|
|
865
|
+
const timelineLeft = this.getLeftPositionForDate(date);
|
|
866
|
+
const relativeLeft = this.convertRelativeLeftPosition(timelineLeft, contentWidth);
|
|
867
|
+
const width = this.getResolutionWidth();
|
|
868
|
+
if (width <= 0) {
|
|
869
|
+
return "0%"; // not rendered (yet)
|
|
870
|
+
}
|
|
871
|
+
const calc = this.createCalcCssValue(width, relativeLeft);
|
|
872
|
+
if (calc != null) {
|
|
873
|
+
return calc;
|
|
874
|
+
}
|
|
875
|
+
return (100.0 / width) * relativeLeft + "%";
|
|
876
|
+
}
|
|
877
|
+
getLeftPositionPercentageStringForDateRange(date, rangeWidth, rangeStartDate, rangeEndDate) {
|
|
878
|
+
if (!(rangeWidth > 0)) {
|
|
879
|
+
return "0%"; // e.g. parent element not rendered (yet)
|
|
880
|
+
}
|
|
881
|
+
const rangeLeft = this.getLeftPositionForDateRange(date, rangeWidth, rangeStartDate, rangeEndDate);
|
|
882
|
+
const width = rangeWidth;
|
|
883
|
+
const calc = this.createCalcCssValue(width, rangeLeft);
|
|
884
|
+
if (calc != null) {
|
|
885
|
+
return calc;
|
|
886
|
+
}
|
|
887
|
+
return (100.0 / width) * rangeLeft + "%";
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Calculate CSS value for 'width' property matching date interval inside
|
|
891
|
+
* the time-line. Returns percentage value. Interval is in milliseconds.
|
|
892
|
+
* <p>
|
|
893
|
+
* May return '2.123456%' or 'calc(2.123456%)' if IE;
|
|
894
|
+
*
|
|
895
|
+
* @param interval
|
|
896
|
+
* Date interval in milliseconds.
|
|
897
|
+
* @return
|
|
898
|
+
*/
|
|
899
|
+
getWidthPercentageStringForDateInterval(interval) {
|
|
900
|
+
const range = this.internalInclusiveEndDateTime.getTime() - this.internalInclusiveStartDateTime.getTime();
|
|
901
|
+
return this.getWidthPercentageStringForDateIntervalForRange(interval, range);
|
|
902
|
+
}
|
|
903
|
+
/** @see #getWidthPercentageStringForDateInterval(long) */
|
|
904
|
+
getWidthPercentageStringForDateIntervalForRange(interval, range) {
|
|
905
|
+
if (!(range > 0)) {
|
|
906
|
+
return "0%"; // e.g. zero-length parent range
|
|
907
|
+
}
|
|
908
|
+
const calc = this.createCalcCssValue(range, interval);
|
|
909
|
+
if (calc != null) {
|
|
910
|
+
return calc;
|
|
911
|
+
}
|
|
912
|
+
return (100.0 / range) * interval + "%";
|
|
913
|
+
}
|
|
914
|
+
/**
|
|
915
|
+
* Calculate matching left offset in pixels for a date (
|
|
916
|
+
* {@link Date#getTime()}).
|
|
917
|
+
*
|
|
918
|
+
* @param date
|
|
919
|
+
* Target date in milliseconds.
|
|
920
|
+
* @return Left offset in pixels.
|
|
921
|
+
*/
|
|
922
|
+
getLeftPositionForDate(date) {
|
|
923
|
+
return this.getLeftPositionForDateRange(date, this.getResolutionWidth(), this.internalInclusiveStartDateTime, this.internalInclusiveEndDateTime);
|
|
924
|
+
}
|
|
925
|
+
getLeftPositionForDateRange(date, rangeWidth, rangeStartDate, rangeEndDate) {
|
|
926
|
+
const width = rangeWidth;
|
|
927
|
+
const range = rangeEndDate.getTime() - rangeStartDate.getTime();
|
|
928
|
+
if (range <= 0) {
|
|
929
|
+
return 0;
|
|
930
|
+
}
|
|
931
|
+
const p = width / range;
|
|
932
|
+
const offset = date.getTime() - rangeStartDate.getTime();
|
|
933
|
+
const left = p * offset;
|
|
934
|
+
return left;
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* Calculate matching date ({@link Date#getTime()}) for the target left
|
|
938
|
+
* pixel offset.
|
|
939
|
+
*
|
|
940
|
+
* @param left
|
|
941
|
+
* Left offset in pixels.
|
|
942
|
+
* @return Date in a milliseconds or null if timeline width is invalid (<=0).
|
|
943
|
+
*/
|
|
944
|
+
getDateForLeftPosition(left) {
|
|
945
|
+
return this.getDateForLeftPositionNoticeDST(left, this.resolution === Resolution.Hour);
|
|
946
|
+
}
|
|
947
|
+
getDateForLeftPositionNoticeDST(left, noticeDST) {
|
|
948
|
+
const width = this.getResolutionWidth();
|
|
949
|
+
if (width <= 0) {
|
|
950
|
+
return null;
|
|
951
|
+
}
|
|
952
|
+
let range = this.normalEndDate.getTime() - this.normalStartDate.getTime();
|
|
953
|
+
if (noticeDST) {
|
|
954
|
+
range = this.adjustDateRangeByDST(range);
|
|
955
|
+
}
|
|
956
|
+
const p = range / width;
|
|
957
|
+
const offset = p * left;
|
|
958
|
+
const date = new Date(this.internalInclusiveStartDateTime.getTime() + offset);
|
|
959
|
+
if (this.debug) {
|
|
960
|
+
this.log("Zoned: " + this.localeDataProvider.formatDate(date, "dd. HH:mm") + " DST: "
|
|
961
|
+
+ this.localeDataProvider.getDaylightAdjustment(date) / 60000);
|
|
962
|
+
}
|
|
963
|
+
return date;
|
|
964
|
+
}
|
|
965
|
+
/**
|
|
966
|
+
* Convert left position for other relative target width.
|
|
967
|
+
*
|
|
968
|
+
* @param left
|
|
969
|
+
* @param contentWidthToConvertFor
|
|
970
|
+
* @return
|
|
971
|
+
*/
|
|
972
|
+
convertRelativeLeftPosition(left, contentWidthToConvertFor) {
|
|
973
|
+
const width = this.getResolutionWidth();
|
|
974
|
+
if (width <= 0 || contentWidthToConvertFor <= 0) {
|
|
975
|
+
return 0;
|
|
976
|
+
}
|
|
977
|
+
const relativePosition = (1.0 / contentWidthToConvertFor) * left;
|
|
978
|
+
const timelineLeft = relativePosition * width;
|
|
979
|
+
return timelineLeft;
|
|
980
|
+
}
|
|
981
|
+
adjustDateRangeByDST(range) {
|
|
982
|
+
/*
|
|
983
|
+
* Notice extra block(s) or missing block(s) in range when start time is
|
|
984
|
+
* in DST and end time is not, or vice versa.
|
|
985
|
+
*/
|
|
986
|
+
// 'range' is a wall-clock range (see toNormalDate()); remove the DST
|
|
987
|
+
// difference between start and end to get the real elapsed range.
|
|
988
|
+
const dstStart = this.localeDataProvider.getDaylightAdjustment(this.internalInclusiveStartDateTime);
|
|
989
|
+
const dstEnd = this.localeDataProvider.getDaylightAdjustment(this.internalInclusiveEndDateTime);
|
|
990
|
+
return range - (dstEnd - dstStart);
|
|
991
|
+
}
|
|
992
|
+
/**
|
|
993
|
+
* Set horizontal scroll position for the time-line.
|
|
994
|
+
*
|
|
995
|
+
* @param left
|
|
996
|
+
* Scroll position in pixels.
|
|
997
|
+
*/
|
|
998
|
+
setScrollLeft(left) {
|
|
999
|
+
if (this.positionLeft === left) {
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
1002
|
+
this.positionLeft = left || 0;
|
|
1003
|
+
if (!this.directlyInsideScrollContainer) {
|
|
1004
|
+
this.style.left = -this.positionLeft + "px";
|
|
1005
|
+
}
|
|
1006
|
+
this.lazyResolutionPaint = setTimeout(() => this.fillVisibleTimeline(), 20);
|
|
1007
|
+
}
|
|
1008
|
+
/**
|
|
1009
|
+
* Re-calculates required widths for this widget.
|
|
1010
|
+
* <p>
|
|
1011
|
+
* Re-creates and fills the visible part of the resolution element.
|
|
1012
|
+
*/
|
|
1013
|
+
updateWidths() {
|
|
1014
|
+
if (this.resolutionDiv == null) {
|
|
1015
|
+
this.log("TimelineElement is not ready for updateWidths() call. Call update(...) instead.");
|
|
1016
|
+
return;
|
|
1017
|
+
}
|
|
1018
|
+
this.log("TimelineElement Started updating widths.");
|
|
1019
|
+
// start by clearing old content in resolution element
|
|
1020
|
+
while (this.resolutionDiv.firstChild) {
|
|
1021
|
+
this.resolutionDiv.removeChild(this.resolutionDiv.lastChild);
|
|
1022
|
+
}
|
|
1023
|
+
this.setMinWidth(this.blocksInRange * this.minResolutionWidth);
|
|
1024
|
+
// update horizontal overflow state here, after min-width is updated.
|
|
1025
|
+
this.updateTimelineOverflowingHorizontally();
|
|
1026
|
+
this.createTimelineElementsOnVisibleArea();
|
|
1027
|
+
// fill timeline
|
|
1028
|
+
this.fillVisibleTimeline();
|
|
1029
|
+
// remove spacer block if it exist
|
|
1030
|
+
this.removeResolutionSpacerBlock();
|
|
1031
|
+
// calculate new block width for day-resolution.
|
|
1032
|
+
// Year and month blocks are vertically in-line with days.
|
|
1033
|
+
this.dayWidthPercentage = 100.0 / this.blocksInRange;
|
|
1034
|
+
this.dayOrHourWidthPx = this.calculateDayOrHourResolutionBlockWidthPx(this.blocksInRange);
|
|
1035
|
+
// calculate block width for currently selected resolution
|
|
1036
|
+
// (day,week,...)
|
|
1037
|
+
// resolution div's content may not be vertically in-line with
|
|
1038
|
+
// year/month blocks. This is the case for example with Week resolution.
|
|
1039
|
+
this.resBlockMinWidthPx = this.minResolutionWidth;
|
|
1040
|
+
this.resBlockWidthPx = this.calculateActualResolutionBlockWidthPx(this.dayOrHourWidthPx);
|
|
1041
|
+
this.resBlockWidthPercentage = 100.0 / this.resolutionBlockCount;
|
|
1042
|
+
let pct = this.createCalcCssValue(this.resolutionBlockCount, null);
|
|
1043
|
+
if (this.resolution === Resolution.Week) {
|
|
1044
|
+
this.resBlockMinWidthPx = DateTimeConstants.DAYS_IN_WEEK * this.minResolutionWidth;
|
|
1045
|
+
this.resBlockWidthPercentage = this.dayWidthPercentage * DateTimeConstants.DAYS_IN_WEEK;
|
|
1046
|
+
pct = this.createCalcCssValue(this.blocksInRange, DateTimeConstants.DAYS_IN_WEEK);
|
|
1047
|
+
}
|
|
1048
|
+
else if (this.isMonthOrYearResolution()) {
|
|
1049
|
+
// Month and year blocks have variable widths; these values represent an average block.
|
|
1050
|
+
this.resBlockMinWidthPx = this.calculateMinimumResolutionBlockWidth();
|
|
1051
|
+
this.resBlockWidthPercentage = 100.0 / this.resolutionBlockCount;
|
|
1052
|
+
}
|
|
1053
|
+
// update resolution block widths
|
|
1054
|
+
if (this.isMonthOrYearResolution()) {
|
|
1055
|
+
this.updateMonthOrYearResolutionBlockWidths();
|
|
1056
|
+
}
|
|
1057
|
+
else {
|
|
1058
|
+
this.updateResolutionBlockWidths(pct);
|
|
1059
|
+
}
|
|
1060
|
+
if (this.isYearRowVisible()) {
|
|
1061
|
+
// update year block widths
|
|
1062
|
+
this.updateBlockWidths(this.yearRowData);
|
|
1063
|
+
}
|
|
1064
|
+
if (this.isMonthRowVisible()) {
|
|
1065
|
+
// update month block widths
|
|
1066
|
+
this.updateBlockWidths(this.monthRowData);
|
|
1067
|
+
}
|
|
1068
|
+
if (this.isDayRowVisible()) {
|
|
1069
|
+
this.updateBlockWidths(this.dayRowData);
|
|
1070
|
+
}
|
|
1071
|
+
if (this.isAlwaysCalculatePixelWidths()) {
|
|
1072
|
+
this.updateSpacerBlocks(this.dayOrHourWidthPx);
|
|
1073
|
+
}
|
|
1074
|
+
this.log("TimelineElement Widths are updated.");
|
|
1075
|
+
}
|
|
1076
|
+
updateBlockWidths(rowData) {
|
|
1077
|
+
for (const entry of rowData.getBlockEntries()) {
|
|
1078
|
+
this.setWidth(entry[1], rowData.getBlockLength(entry[0]));
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
updateSpacerBlocks(dayWidthPx) {
|
|
1082
|
+
const spaceLeft = this.getResolutionDivWidth() - (this.blocksInRange * dayWidthPx);
|
|
1083
|
+
if (spaceLeft > 0) {
|
|
1084
|
+
for (const e of this.spacerBlocks) {
|
|
1085
|
+
e.style.removeProperty("display");
|
|
1086
|
+
e.style.width = spaceLeft + "px";
|
|
1087
|
+
}
|
|
1088
|
+
this.resSpacerDiv = this.createResolutionBlock();
|
|
1089
|
+
this.resSpacerDiv.classList.add(TimelineElement_1.STYLE_SPACER);
|
|
1090
|
+
this.resSpacerDiv.style.width = spaceLeft + "px";
|
|
1091
|
+
this.resSpacerDiv.innerText = " ";
|
|
1092
|
+
this.resolutionDiv.appendChild(this.resSpacerDiv);
|
|
1093
|
+
}
|
|
1094
|
+
else {
|
|
1095
|
+
this.hideSpacerBlocks();
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
hideSpacerBlocks() {
|
|
1099
|
+
for (const e of this.spacerBlocks) {
|
|
1100
|
+
e.style.display = "none";
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Set minimum width (pixels) of this widget's root DIV element. Default is
|
|
1105
|
+
* -1. Notice that
|
|
1106
|
+
* {@link #update(Resolution, long, long, int, int, LocaleDataProvider)}
|
|
1107
|
+
* will calculate min-width and call this internally.
|
|
1108
|
+
*
|
|
1109
|
+
* @param minWidth
|
|
1110
|
+
* Minimum width in pixels.
|
|
1111
|
+
*/
|
|
1112
|
+
setMinWidth(minWidth) {
|
|
1113
|
+
this.minWidth = minWidth;
|
|
1114
|
+
this.style.minWidth = this.minWidth + "px";
|
|
1115
|
+
this.resolutionDiv.style.minWidth = this.minWidth + "px";
|
|
1116
|
+
}
|
|
1117
|
+
/**
|
|
1118
|
+
* Returns true if the timeline is overflowing the parent's width. This
|
|
1119
|
+
* works only when this widget is attached to some parent.
|
|
1120
|
+
*
|
|
1121
|
+
* @return True when timeline width is more than the parent's width (@see
|
|
1122
|
+
* {@link Element#getClientWidth()}).
|
|
1123
|
+
*/
|
|
1124
|
+
isTimelineOverflowingHorizontally() {
|
|
1125
|
+
return this.timelineOverflowingHorizontally;
|
|
1126
|
+
}
|
|
1127
|
+
/**
|
|
1128
|
+
* Update horizontal overflow state.
|
|
1129
|
+
*/
|
|
1130
|
+
updateTimelineOverflowingHorizontally() {
|
|
1131
|
+
this.timelineOverflowingHorizontally = (ElementUtil.getWidth(this.resolutionDiv) > ElementUtil.getWidth(this.getParentElement(this)));
|
|
1132
|
+
}
|
|
1133
|
+
createTimelineElementsOnVisibleArea() {
|
|
1134
|
+
// create place holder elements that represents weeks/days/hours
|
|
1135
|
+
// depending on the resolution in the timeline.
|
|
1136
|
+
// Only visible blocks are created, and only once, content will change
|
|
1137
|
+
// on scroll.
|
|
1138
|
+
// first: detect how many blocks we can fit in the screen
|
|
1139
|
+
let blocks = this.resolutionBlockCount;
|
|
1140
|
+
// Month and Year resolutions have variable width blocks and only a few of
|
|
1141
|
+
// them even for long ranges, so all of them are created.
|
|
1142
|
+
if (this.isTimelineOverflowingHorizontally() && !this.isMonthOrYearResolution()) {
|
|
1143
|
+
blocks = Math.floor((ElementUtil.getWidth(this.getParentElement(this))
|
|
1144
|
+
/ this.calculateMinimumResolutionBlockWidth()));
|
|
1145
|
+
if (this.resolutionBlockCount < blocks) {
|
|
1146
|
+
// blocks need to be scaled up to fit the screen
|
|
1147
|
+
blocks = this.resolutionBlockCount;
|
|
1148
|
+
}
|
|
1149
|
+
else {
|
|
1150
|
+
blocks += 2;
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
let element = null;
|
|
1154
|
+
for (let i = 0; i < blocks; i++) {
|
|
1155
|
+
switch (this.resolution) {
|
|
1156
|
+
case Resolution.Hour:
|
|
1157
|
+
element = this.createHourResolutionBlock();
|
|
1158
|
+
break;
|
|
1159
|
+
case Resolution.Day:
|
|
1160
|
+
element = this.createDayResolutionBlock();
|
|
1161
|
+
break;
|
|
1162
|
+
case Resolution.Week:
|
|
1163
|
+
element = this.createWeekResolutionBlock();
|
|
1164
|
+
break;
|
|
1165
|
+
case Resolution.Month:
|
|
1166
|
+
element = this.createMonthResolutionBlock();
|
|
1167
|
+
break;
|
|
1168
|
+
case Resolution.Year:
|
|
1169
|
+
element = this.createYearResolutionBlock();
|
|
1170
|
+
break;
|
|
1171
|
+
}
|
|
1172
|
+
this.resolutionDiv.appendChild(element);
|
|
1173
|
+
}
|
|
1174
|
+
this.log(`TimelineElement Added ${blocks} visible timeline elements for resolution ${Resolution[this.resolution]}`);
|
|
1175
|
+
}
|
|
1176
|
+
calculateMinimumResolutionBlockWidth() {
|
|
1177
|
+
if (this.resolution === Resolution.Week) {
|
|
1178
|
+
return DateTimeConstants.DAYS_IN_WEEK * this.minResolutionWidth;
|
|
1179
|
+
}
|
|
1180
|
+
else if (this.resolution === Resolution.Month) {
|
|
1181
|
+
return TimelineElement_1.AVERAGE_DAYS_IN_MONTH * this.minResolutionWidth;
|
|
1182
|
+
}
|
|
1183
|
+
else if (this.resolution === Resolution.Year) {
|
|
1184
|
+
return TimelineElement_1.AVERAGE_DAYS_IN_YEAR * this.minResolutionWidth;
|
|
1185
|
+
}
|
|
1186
|
+
return this.minResolutionWidth;
|
|
1187
|
+
}
|
|
1188
|
+
createResolutionBlock() {
|
|
1189
|
+
const resBlock = document.createElement('div');
|
|
1190
|
+
resBlock.classList.add("col");
|
|
1191
|
+
return resBlock;
|
|
1192
|
+
}
|
|
1193
|
+
createHourResolutionBlock() {
|
|
1194
|
+
const resBlock = this.createResolutionBlock();
|
|
1195
|
+
resBlock.classList.add("h", TimelineElement_1.STYLE_CENTER);
|
|
1196
|
+
return resBlock;
|
|
1197
|
+
}
|
|
1198
|
+
createDayResolutionBlock() {
|
|
1199
|
+
const resBlock = this.createResolutionBlock();
|
|
1200
|
+
resBlock.classList.add(TimelineElement_1.STYLE_CENTER);
|
|
1201
|
+
return resBlock;
|
|
1202
|
+
}
|
|
1203
|
+
createWeekResolutionBlock() {
|
|
1204
|
+
const resBlock = this.createResolutionBlock();
|
|
1205
|
+
resBlock.classList.add("w", TimelineElement_1.STYLE_CENTER);
|
|
1206
|
+
return resBlock;
|
|
1207
|
+
}
|
|
1208
|
+
createMonthResolutionBlock() {
|
|
1209
|
+
// width is set explicitly for each block, see updateMonthOrYearResolutionBlockWidths()
|
|
1210
|
+
const resBlock = this.createResolutionBlock();
|
|
1211
|
+
resBlock.classList.add(TimelineElement_1.STYLE_MONTH_RES);
|
|
1212
|
+
return resBlock;
|
|
1213
|
+
}
|
|
1214
|
+
createYearResolutionBlock() {
|
|
1215
|
+
// width is set explicitly for each block, see updateMonthOrYearResolutionBlockWidths()
|
|
1216
|
+
const resBlock = this.createResolutionBlock();
|
|
1217
|
+
resBlock.classList.add(TimelineElement_1.STYLE_YEAR_RES);
|
|
1218
|
+
return resBlock;
|
|
1219
|
+
}
|
|
1220
|
+
fillVisibleTimeline() {
|
|
1221
|
+
if (this.isMonthOrYearResolution()) {
|
|
1222
|
+
// all month/year blocks exist and are positioned statically; scrolling needs no re-positioning.
|
|
1223
|
+
this.showAllResolutionBlocks();
|
|
1224
|
+
}
|
|
1225
|
+
else if (this.isTimelineOverflowingHorizontally()) {
|
|
1226
|
+
this.showResolutionBlocksOnView();
|
|
1227
|
+
}
|
|
1228
|
+
else {
|
|
1229
|
+
this.showAllResolutionBlocks();
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
showResolutionBlocksOnView() {
|
|
1233
|
+
const positionLeftSnapshot = this.positionLeft;
|
|
1234
|
+
let datePos = positionLeftSnapshot;
|
|
1235
|
+
this.firstWeekBlockHidden = false;
|
|
1236
|
+
let left = Math.floor(positionLeftSnapshot);
|
|
1237
|
+
if (positionLeftSnapshot > 0 && this.resBlockWidthPx > 0) {
|
|
1238
|
+
const firstResBlockShort = this.isFirstResBlockShort();
|
|
1239
|
+
const overflow = this.getScrollOverflowForResolutionBlock(positionLeftSnapshot, left, firstResBlockShort);
|
|
1240
|
+
left = Math.floor(positionLeftSnapshot - overflow);
|
|
1241
|
+
datePos = this.adjustLeftPositionForDateDetection(left);
|
|
1242
|
+
}
|
|
1243
|
+
if (datePos < 0.0) {
|
|
1244
|
+
datePos = positionLeftSnapshot;
|
|
1245
|
+
}
|
|
1246
|
+
const noticeDst = this.resolution === Resolution.Hour;
|
|
1247
|
+
const leftDate = this.getDateForLeftPositionNoticeDST(datePos, noticeDst);
|
|
1248
|
+
const containerWidth = ElementUtil.getWidth(this.getParentElement(this));
|
|
1249
|
+
this.fillTimelineForResolution(leftDate, new Date(Math.min(this.internalInclusiveEndDateTime.getTime(), this.getDateForLeftPositionNoticeDST(datePos + containerWidth, noticeDst).getTime())), left);
|
|
1250
|
+
this.style.setProperty("--timeline-col-position", "relative");
|
|
1251
|
+
this.style.setProperty("--timeline-col-left", left + "px");
|
|
1252
|
+
this.log(`TimelineElement Updated visible timeline elements for horizontal scroll position ${left} (plus ${datePos - left} to center-of-first-block)`);
|
|
1253
|
+
}
|
|
1254
|
+
showAllResolutionBlocks() {
|
|
1255
|
+
this.style.setProperty("--timeline-col-position", "relative");
|
|
1256
|
+
this.style.setProperty("--timeline-col-left", "0px");
|
|
1257
|
+
this.fillTimelineForResolution(this.internalInclusiveStartDateTime, this.internalInclusiveEndDateTime, 0);
|
|
1258
|
+
}
|
|
1259
|
+
/**
|
|
1260
|
+
* Re-applies 'current' style to the currently shown resolution blocks and day
|
|
1261
|
+
* row blocks without rebuilding the timeline. Call this when the current day
|
|
1262
|
+
* or hour changes.
|
|
1263
|
+
*/
|
|
1264
|
+
refreshCurrentDate() {
|
|
1265
|
+
if (!this.localeDataProvider || !this.resolutionDiv || !this.internalInclusiveStartDateTime
|
|
1266
|
+
|| !this.internalInclusiveEndDateTime || this.resolutionDiv.childElementCount === 0) {
|
|
1267
|
+
return;
|
|
1268
|
+
}
|
|
1269
|
+
this.fillVisibleTimeline();
|
|
1270
|
+
}
|
|
1271
|
+
updateCurrentDayString() {
|
|
1272
|
+
this.currentDayString = (this.currentDateVisible && this.localeDataProvider)
|
|
1273
|
+
? this.localeDataProvider.formatDate(new Date(), TimelineElement_1.CURRENT_DAY_FORMAT)
|
|
1274
|
+
: null;
|
|
1275
|
+
this.currentHourString = (this.currentDateVisible && this.localeDataProvider)
|
|
1276
|
+
? this.localeDataProvider.formatDate(new Date(), TimelineElement_1.CURRENT_HOUR_FORMAT)
|
|
1277
|
+
: null;
|
|
1278
|
+
}
|
|
1279
|
+
isCurrentDay(date) {
|
|
1280
|
+
return this.currentDayString != null && date != null
|
|
1281
|
+
&& this.localeDataProvider.formatDate(date, TimelineElement_1.CURRENT_DAY_FORMAT) === this.currentDayString;
|
|
1282
|
+
}
|
|
1283
|
+
isCurrentHour(date) {
|
|
1284
|
+
// Compare the hour bucket in the configured time zone, so the result does
|
|
1285
|
+
// not depend on where inside the hour the given date falls.
|
|
1286
|
+
return this.currentHourString != null && date != null
|
|
1287
|
+
&& this.localeDataProvider.formatDate(date, TimelineElement_1.CURRENT_HOUR_FORMAT) === this.currentHourString;
|
|
1288
|
+
}
|
|
1289
|
+
setCurrentStyle(element, current) {
|
|
1290
|
+
if (current) {
|
|
1291
|
+
element.classList.add(TimelineElement_1.STYLE_CURRENT);
|
|
1292
|
+
}
|
|
1293
|
+
else {
|
|
1294
|
+
element.classList.remove(TimelineElement_1.STYLE_CURRENT);
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
updateDayRowCurrentStyles() {
|
|
1298
|
+
if (!this.isDayRowVisible()) {
|
|
1299
|
+
return;
|
|
1300
|
+
}
|
|
1301
|
+
for (const entry of this.dayRowData.getBlockEntries()) {
|
|
1302
|
+
const block = entry[1];
|
|
1303
|
+
this.setCurrentStyle(block, this.currentDayString != null && block.dataset.day === this.currentDayString);
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
fillTimelineForResolution(startDate, endDate, left) {
|
|
1307
|
+
this.updateCurrentDayString();
|
|
1308
|
+
this.updateDayRowCurrentStyles();
|
|
1309
|
+
if (this.isMonthOrYearResolution()) {
|
|
1310
|
+
this.fillTimelineForMonthOrYearResolution();
|
|
1311
|
+
}
|
|
1312
|
+
else if (this.resolution === Resolution.Day || this.resolution === Resolution.Week) {
|
|
1313
|
+
this.fillTimelineForDayResolution(startDate, endDate, left);
|
|
1314
|
+
}
|
|
1315
|
+
else if (this.resolution == Resolution.Hour) {
|
|
1316
|
+
this.fillTimelineForHourResolution(startDate, endDate, left);
|
|
1317
|
+
}
|
|
1318
|
+
else {
|
|
1319
|
+
console.warn("TimelineElement resolution " + (this.resolution != null ? Resolution[this.resolution] : "null")
|
|
1320
|
+
+ " is not supported");
|
|
1321
|
+
return;
|
|
1322
|
+
}
|
|
1323
|
+
this.log("TimelineElement Filled new data and styles to visible timeline elements");
|
|
1324
|
+
}
|
|
1325
|
+
isFirstResBlockShort() {
|
|
1326
|
+
return this.firstResBlockCount > 0 && ((this.resolution === Resolution.Week && this.firstResBlockCount < DateTimeConstants.DAYS_IN_WEEK));
|
|
1327
|
+
}
|
|
1328
|
+
isLastResBlockShort() {
|
|
1329
|
+
return this.lastResBlockCount > 0 && ((this.resolution === Resolution.Week && this.lastResBlockCount < DateTimeConstants.DAYS_IN_WEEK));
|
|
1330
|
+
}
|
|
1331
|
+
getScrollOverflowForResolutionBlock(positionLeftSnapshot, left, firstResBlockShort) {
|
|
1332
|
+
let overflow;
|
|
1333
|
+
if (firstResBlockShort && left <= this.getFirstResolutionElementWidth()) {
|
|
1334
|
+
overflow = this.getScrollOverflowForShortFirstResolutionBlock(positionLeftSnapshot);
|
|
1335
|
+
}
|
|
1336
|
+
else {
|
|
1337
|
+
overflow = this.getScrollOverflowForRegularResoultionBlock(positionLeftSnapshot, firstResBlockShort);
|
|
1338
|
+
}
|
|
1339
|
+
return overflow;
|
|
1340
|
+
}
|
|
1341
|
+
getScrollOverflowForRegularResoultionBlock(positionLeftSnapshot, firstResBlockShort) {
|
|
1342
|
+
let overflow;
|
|
1343
|
+
const firstBlockWidth = this.getFirstResolutionElementWidth();
|
|
1344
|
+
const positionLeft = (positionLeftSnapshot - (firstResBlockShort ? firstBlockWidth : 0));
|
|
1345
|
+
overflow = positionLeft % this.resBlockWidthPx;
|
|
1346
|
+
if (firstResBlockShort) {
|
|
1347
|
+
overflow += firstBlockWidth;
|
|
1348
|
+
this.firstWeekBlockHidden = true;
|
|
1349
|
+
}
|
|
1350
|
+
return overflow;
|
|
1351
|
+
}
|
|
1352
|
+
getScrollOverflowForShortFirstResolutionBlock(positionLeftSnapshot) {
|
|
1353
|
+
let overflow;
|
|
1354
|
+
// need to notice a short resolution block due to timeline's
|
|
1355
|
+
// start date which is in middle of a week.
|
|
1356
|
+
overflow = positionLeftSnapshot % this.getFirstResolutionElementWidth();
|
|
1357
|
+
if (overflow == 0.0) {
|
|
1358
|
+
overflow = this.getFirstResolutionElementWidth();
|
|
1359
|
+
}
|
|
1360
|
+
return overflow;
|
|
1361
|
+
}
|
|
1362
|
+
/**
|
|
1363
|
+
* Returns a width of the first resolution block.
|
|
1364
|
+
*
|
|
1365
|
+
* @return
|
|
1366
|
+
*/
|
|
1367
|
+
getFirstResolutionElementWidth() {
|
|
1368
|
+
if (this.isMonthOrYearResolution()) {
|
|
1369
|
+
if (this.isTimelineOverflowingHorizontally()) {
|
|
1370
|
+
return this.firstResBlockCount * this.minResolutionWidth;
|
|
1371
|
+
}
|
|
1372
|
+
else {
|
|
1373
|
+
return ElementUtil.getWidth(this.getFirstResolutionElement());
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
if (this.isFirstResBlockShort()) {
|
|
1377
|
+
if (this.isTimelineOverflowingHorizontally()) {
|
|
1378
|
+
return this.firstResBlockCount * this.minResolutionWidth;
|
|
1379
|
+
}
|
|
1380
|
+
else {
|
|
1381
|
+
return ElementUtil.getWidth(this.getFirstResolutionElement());
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
else {
|
|
1385
|
+
if (this.isTimelineOverflowingHorizontally()) {
|
|
1386
|
+
return this.resBlockMinWidthPx;
|
|
1387
|
+
}
|
|
1388
|
+
else {
|
|
1389
|
+
return ElementUtil.getWidth(this.getFirstResolutionElement());
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
getFirstResolutionElement() {
|
|
1394
|
+
if (this.resolutionDiv.hasChildNodes()) {
|
|
1395
|
+
return this.resolutionDiv.firstElementChild;
|
|
1396
|
+
}
|
|
1397
|
+
return null;
|
|
1398
|
+
}
|
|
1399
|
+
getLastResolutionElement() {
|
|
1400
|
+
const div = this.resolutionDiv;
|
|
1401
|
+
if (!div) {
|
|
1402
|
+
return null;
|
|
1403
|
+
}
|
|
1404
|
+
const nodeList = div.childNodes;
|
|
1405
|
+
if (!nodeList) {
|
|
1406
|
+
return null;
|
|
1407
|
+
}
|
|
1408
|
+
const blockCount = nodeList.length;
|
|
1409
|
+
if (blockCount < 1) {
|
|
1410
|
+
return null;
|
|
1411
|
+
}
|
|
1412
|
+
if (this.containsResBlockSpacer()) {
|
|
1413
|
+
const index = blockCount - 2;
|
|
1414
|
+
if (blockCount > 1 && index >= 0) {
|
|
1415
|
+
return this.resolutionDiv.childNodes.item(index);
|
|
1416
|
+
}
|
|
1417
|
+
return null;
|
|
1418
|
+
}
|
|
1419
|
+
return this.resolutionDiv.lastChild;
|
|
1420
|
+
}
|
|
1421
|
+
containsResBlockSpacer() {
|
|
1422
|
+
return this.resSpacerDiv != null && this.resSpacerDiv.parentElement
|
|
1423
|
+
&& this.resSpacerDiv.parentElement === this.resolutionDiv;
|
|
1424
|
+
}
|
|
1425
|
+
removeResolutionSpacerBlock() {
|
|
1426
|
+
if (this.containsResBlockSpacer()) {
|
|
1427
|
+
this.resSpacerDiv.parentNode.removeChild(this.resSpacerDiv);
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
/*
|
|
1431
|
+
* Calculates either day or hour resolution block width depending on the
|
|
1432
|
+
* current resolution.
|
|
1433
|
+
*/
|
|
1434
|
+
calculateDayOrHourResolutionBlockWidthPx(blockCount) {
|
|
1435
|
+
let dayOrHourWidthPx = Math.round(this.resolutionDiv.clientWidth / blockCount);
|
|
1436
|
+
while ((blockCount * dayOrHourWidthPx) < this.resolutionDiv.clientWidth) {
|
|
1437
|
+
dayOrHourWidthPx++;
|
|
1438
|
+
}
|
|
1439
|
+
return dayOrHourWidthPx;
|
|
1440
|
+
}
|
|
1441
|
+
/*
|
|
1442
|
+
* Calculates the actual width of one resolution block element. For example:
|
|
1443
|
+
* week resolution will return 7 * dayOrHourBlockWidthPx.
|
|
1444
|
+
*/
|
|
1445
|
+
calculateActualResolutionBlockWidthPx(dayOrHourBlockWidthPx) {
|
|
1446
|
+
if (this.resolution === Resolution.Week) {
|
|
1447
|
+
return DateTimeConstants.DAYS_IN_WEEK * dayOrHourBlockWidthPx;
|
|
1448
|
+
}
|
|
1449
|
+
else if (this.resolution === Resolution.Month) {
|
|
1450
|
+
// average width; actual month block widths vary by number of days.
|
|
1451
|
+
return TimelineElement_1.AVERAGE_DAYS_IN_MONTH * dayOrHourBlockWidthPx;
|
|
1452
|
+
}
|
|
1453
|
+
else if (this.resolution === Resolution.Year) {
|
|
1454
|
+
// average width; actual year block widths vary by number of days.
|
|
1455
|
+
return TimelineElement_1.AVERAGE_DAYS_IN_YEAR * dayOrHourBlockWidthPx;
|
|
1456
|
+
}
|
|
1457
|
+
return dayOrHourBlockWidthPx;
|
|
1458
|
+
}
|
|
1459
|
+
/**
|
|
1460
|
+
* Adjust left position for optimal position to detect accurate date with
|
|
1461
|
+
* the current resolution.
|
|
1462
|
+
*/
|
|
1463
|
+
adjustLeftPositionForDateDetection(left) {
|
|
1464
|
+
let datePos;
|
|
1465
|
+
if (this.resolution === Resolution.Week) {
|
|
1466
|
+
// detect date from the center of the first day block inside the
|
|
1467
|
+
// week block.
|
|
1468
|
+
datePos = left + this.dayOrHourWidthPx / 2;
|
|
1469
|
+
}
|
|
1470
|
+
else {
|
|
1471
|
+
// detect date from the center of the block (day/hour)
|
|
1472
|
+
datePos = left + this.resBlockWidthPx / 2;
|
|
1473
|
+
}
|
|
1474
|
+
return datePos;
|
|
1475
|
+
}
|
|
1476
|
+
createCalcCssValue(v, multiplier) {
|
|
1477
|
+
if (this.ie) {
|
|
1478
|
+
// see comments in createCalcCssValue(int, Integer)
|
|
1479
|
+
const percents = 100.0 / v * multiplier;
|
|
1480
|
+
return "calc(" + percents + "%)";
|
|
1481
|
+
}
|
|
1482
|
+
return null;
|
|
1483
|
+
}
|
|
1484
|
+
updateResolutionBlockWidths(pct) {
|
|
1485
|
+
if (this.setPositionForEachBlock) {
|
|
1486
|
+
if (!this.isTimelineOverflowingHorizontally()) {
|
|
1487
|
+
this.resolutionDiv.style.display = "flex";
|
|
1488
|
+
}
|
|
1489
|
+
else {
|
|
1490
|
+
this.resolutionDiv.style.removeProperty("display");
|
|
1491
|
+
}
|
|
1492
|
+
const firstResBlockIsShort = this.isFirstResBlockShort();
|
|
1493
|
+
const lastResBlockIsShort = this.isLastResBlockShort();
|
|
1494
|
+
// when setPositionForEachBlock is true, set width for each block explicitly.
|
|
1495
|
+
let count = this.resolutionDiv.childElementCount;
|
|
1496
|
+
if (this.containsResBlockSpacer()) {
|
|
1497
|
+
count--;
|
|
1498
|
+
}
|
|
1499
|
+
const lastIndex = count - 1;
|
|
1500
|
+
let i;
|
|
1501
|
+
let resBlock;
|
|
1502
|
+
for (i = 0; i < count; i++) {
|
|
1503
|
+
resBlock = this.resolutionDiv.childNodes.item(i);
|
|
1504
|
+
// first and last week blocks may be thinner than other
|
|
1505
|
+
// resolution blocks.
|
|
1506
|
+
if (firstResBlockIsShort && i == 0) {
|
|
1507
|
+
this.setWidth(resBlock, this.firstResBlockCount);
|
|
1508
|
+
}
|
|
1509
|
+
else if (lastResBlockIsShort && i == lastIndex) {
|
|
1510
|
+
this.setWidth(resBlock, this.lastResBlockCount);
|
|
1511
|
+
}
|
|
1512
|
+
else {
|
|
1513
|
+
this.setWidthPct(this.resBlockWidthPx, pct, resBlock);
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
else {
|
|
1518
|
+
// set widths by updating injected styles in one place. Faster than
|
|
1519
|
+
// setting widths explicitly for each element.
|
|
1520
|
+
const center = this.getWidthStyleValue(pct);
|
|
1521
|
+
let first = center;
|
|
1522
|
+
let last = center;
|
|
1523
|
+
if (this.isFirstResBlockShort()) {
|
|
1524
|
+
first = this.getWidth(this.firstResBlockCount);
|
|
1525
|
+
}
|
|
1526
|
+
if (this.isLastResBlockShort()) {
|
|
1527
|
+
last = this.getWidth(this.lastResBlockCount);
|
|
1528
|
+
}
|
|
1529
|
+
this.style.setProperty("--timeline-col-center-width", center);
|
|
1530
|
+
this.style.setProperty("--timeline-col-first-width", first);
|
|
1531
|
+
this.style.setProperty("--timeline-col-last-width", last);
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
/*
|
|
1535
|
+
* Sets the width explicitly for each Month/Year resolution block based on
|
|
1536
|
+
* the number of days in the block. Blocks are kept vertically in-line with
|
|
1537
|
+
* the day based year and month rows.
|
|
1538
|
+
*/
|
|
1539
|
+
updateMonthOrYearResolutionBlockWidths() {
|
|
1540
|
+
this.resolutionDiv.style.removeProperty("display");
|
|
1541
|
+
const count = Math.min(this.resolutionDiv.childElementCount, this.resBlockDayCounts.length);
|
|
1542
|
+
for (let i = 0; i < count; i++) {
|
|
1543
|
+
const resBlock = this.resolutionDiv.children.item(i);
|
|
1544
|
+
if (resBlock === this.resSpacerDiv) {
|
|
1545
|
+
continue;
|
|
1546
|
+
}
|
|
1547
|
+
this.setWidth(resBlock, this.resBlockDayCounts[i]);
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
getWidth(multiplier) {
|
|
1551
|
+
if (this.isTimelineOverflowingHorizontally()) {
|
|
1552
|
+
return (multiplier * this.minResolutionWidth) + "px";
|
|
1553
|
+
}
|
|
1554
|
+
else {
|
|
1555
|
+
if (this.isAlwaysCalculatePixelWidths()) {
|
|
1556
|
+
return multiplier * this.dayOrHourWidthPx + "px";
|
|
1557
|
+
}
|
|
1558
|
+
else {
|
|
1559
|
+
return this.getCssPercentageWidth(this.blocksInRange, this.dayWidthPercentage, multiplier);
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
setWidth(element, multiplier) {
|
|
1564
|
+
if (this.isTimelineOverflowingHorizontally()) {
|
|
1565
|
+
element.style.width = (multiplier * this.minResolutionWidth) + "px";
|
|
1566
|
+
}
|
|
1567
|
+
else {
|
|
1568
|
+
if (this.isAlwaysCalculatePixelWidths()) {
|
|
1569
|
+
element.style.width = (multiplier * this.dayOrHourWidthPx) + "px";
|
|
1570
|
+
}
|
|
1571
|
+
else {
|
|
1572
|
+
this.setCssPercentageWidth(element, this.blocksInRange, this.dayWidthPercentage, multiplier);
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
setWidthPct(resBlockWidthPx, pct, element) {
|
|
1577
|
+
if (this.isTimelineOverflowingHorizontally()) {
|
|
1578
|
+
element.style.width = this.resBlockMinWidthPx + "px";
|
|
1579
|
+
}
|
|
1580
|
+
else {
|
|
1581
|
+
if (this.isAlwaysCalculatePixelWidths()) {
|
|
1582
|
+
element.style.width = resBlockWidthPx + "px";
|
|
1583
|
+
}
|
|
1584
|
+
else {
|
|
1585
|
+
if (this.ie) {
|
|
1586
|
+
element.style.flex = "1";
|
|
1587
|
+
}
|
|
1588
|
+
this.setCssPercentageWidthFor(element, this.resBlockWidthPercentage, pct);
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
setCssPercentageWidth(element, daysInRange, width, position) {
|
|
1593
|
+
const pct = this.createCalcCssValue(daysInRange, position);
|
|
1594
|
+
this.setCssPercentageWidthFor(element, position * width, pct);
|
|
1595
|
+
}
|
|
1596
|
+
getCssPercentageWidth(daysInRange, width, position) {
|
|
1597
|
+
const pct = this.createCalcCssValue(daysInRange, position);
|
|
1598
|
+
return this.getPercentageWidthString(position * width, pct);
|
|
1599
|
+
}
|
|
1600
|
+
setCssPercentageWidthFor(element, nValue, pct) {
|
|
1601
|
+
if (pct) {
|
|
1602
|
+
element.style.width = pct;
|
|
1603
|
+
}
|
|
1604
|
+
else {
|
|
1605
|
+
element.style.width = nValue + "%";
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
getPercentageWidthString(nValue, pct) {
|
|
1609
|
+
if (pct) {
|
|
1610
|
+
return pct;
|
|
1611
|
+
}
|
|
1612
|
+
else {
|
|
1613
|
+
return nValue + "%";
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
getWidthStyleValue(pct) {
|
|
1617
|
+
if (this.isTimelineOverflowingHorizontally()) {
|
|
1618
|
+
return this.resBlockMinWidthPx + "px";
|
|
1619
|
+
}
|
|
1620
|
+
else {
|
|
1621
|
+
if (this.isAlwaysCalculatePixelWidths()) {
|
|
1622
|
+
return this.resBlockWidthPx + "px";
|
|
1623
|
+
}
|
|
1624
|
+
else {
|
|
1625
|
+
return this.getPercentageWidthString(this.resBlockWidthPercentage, pct);
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
/*
|
|
1630
|
+
* Fills captions and styles for all Month/Year resolution blocks. Uses block
|
|
1631
|
+
* data collected in prepareTimelineForDayOrWeekResolution().
|
|
1632
|
+
*/
|
|
1633
|
+
fillTimelineForMonthOrYearResolution() {
|
|
1634
|
+
const childCount = this.resolutionDiv.childElementCount;
|
|
1635
|
+
// currentDayString is 'yyyy-MM-dd'; take 'yyyy-MM' or 'yyyy' part of it.
|
|
1636
|
+
let currentKey = null;
|
|
1637
|
+
if (this.currentDayString != null) {
|
|
1638
|
+
currentKey = this.currentDayString.substring(0, this.resolution === Resolution.Year ? 4 : 7);
|
|
1639
|
+
}
|
|
1640
|
+
for (let i = 0; i < this.resBlockStartDates.length; i++) {
|
|
1641
|
+
if (!this.isValidChildIndex(i, childCount)) {
|
|
1642
|
+
this.logIndexOutOfBounds(this.resolution === Resolution.Year ? "year" : "month", i, childCount);
|
|
1643
|
+
return;
|
|
1644
|
+
}
|
|
1645
|
+
const resBlock = this.resolutionDiv.children.item(i);
|
|
1646
|
+
const date = this.resBlockStartDates[i];
|
|
1647
|
+
this.fillMonthOrYearResolutionBlock(resBlock, date, i % 2 === 1, currentKey != null && this.resBlockKeys[i] === currentKey);
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
fillMonthOrYearResolutionBlock(resBlock, date, even, current) {
|
|
1651
|
+
if (this.resolution === Resolution.Year) {
|
|
1652
|
+
resBlock.innerText = this.formatYearCaption(this.getYear(date), date);
|
|
1653
|
+
}
|
|
1654
|
+
else {
|
|
1655
|
+
resBlock.innerText = this.formatMonthCaption(this.getMonth(date), date);
|
|
1656
|
+
}
|
|
1657
|
+
if (even) {
|
|
1658
|
+
resBlock.classList.add(TimelineElement_1.STYLE_EVEN);
|
|
1659
|
+
}
|
|
1660
|
+
else {
|
|
1661
|
+
resBlock.classList.remove(TimelineElement_1.STYLE_EVEN);
|
|
1662
|
+
}
|
|
1663
|
+
this.setCurrentStyle(resBlock, current);
|
|
1664
|
+
}
|
|
1665
|
+
fillTimelineForHourResolution(startDate, endDate, left) {
|
|
1666
|
+
const timeline = this;
|
|
1667
|
+
this.firstDay = true;
|
|
1668
|
+
let hourCounter;
|
|
1669
|
+
let even;
|
|
1670
|
+
this.fillTimelineForHour(DateTimeConstants.HOUR_INTERVAL, startDate, endDate, {
|
|
1671
|
+
setup() {
|
|
1672
|
+
hourCounter = this.getFirstHourOfVisibleRange(startDate);
|
|
1673
|
+
even = this.isEven(startDate);
|
|
1674
|
+
},
|
|
1675
|
+
fillResolutionBlock(index, date, currentYear, lastTimelineBlock) {
|
|
1676
|
+
const childCount = timeline.resolutionDiv.childElementCount;
|
|
1677
|
+
if (timeline.isValidChildIndex(index, childCount)) {
|
|
1678
|
+
const resBlock = timeline.resolutionDiv.childNodes.item(index);
|
|
1679
|
+
timeline.fillHourResolutionBlock(resBlock, date, index, hourCounter, lastTimelineBlock, left, even);
|
|
1680
|
+
hourCounter = (hourCounter + 1) % 24;
|
|
1681
|
+
even = !even;
|
|
1682
|
+
}
|
|
1683
|
+
else {
|
|
1684
|
+
timeline.logIndexOutOfBounds("hour", index, childCount);
|
|
1685
|
+
return;
|
|
1686
|
+
}
|
|
1687
|
+
},
|
|
1688
|
+
isEven(startDate) {
|
|
1689
|
+
const normalDate = timeline.toNormalDate(startDate);
|
|
1690
|
+
if (timeline.normalStartDate.getTime() < normalDate.getTime()) {
|
|
1691
|
+
const hours = Math.floor(((normalDate.getTime() - timeline.normalStartDate.getTime()) / DateTimeConstants.HOUR_INTERVAL));
|
|
1692
|
+
return (hours % 2) == 1;
|
|
1693
|
+
}
|
|
1694
|
+
return false;
|
|
1695
|
+
},
|
|
1696
|
+
getFirstHourOfVisibleRange(startDate) {
|
|
1697
|
+
const normalDate = timeline.toNormalDate(startDate);
|
|
1698
|
+
if (timeline.normalStartDate.getTime() < normalDate.getTime()) {
|
|
1699
|
+
const hours = Math.floor(((normalDate.getTime() - timeline.normalStartDate.getTime()) / DateTimeConstants.HOUR_INTERVAL));
|
|
1700
|
+
return ((timeline.firstHourOfRange + hours) % 24);
|
|
1701
|
+
}
|
|
1702
|
+
return timeline.firstHourOfRange;
|
|
1703
|
+
}
|
|
1704
|
+
});
|
|
1705
|
+
}
|
|
1706
|
+
fillTimelineForDayResolution(startDate, endDate, left) {
|
|
1707
|
+
const timeline = this;
|
|
1708
|
+
let dayCounter;
|
|
1709
|
+
let even;
|
|
1710
|
+
let firstWeek = true;
|
|
1711
|
+
let weekIndex = 0;
|
|
1712
|
+
let weekday;
|
|
1713
|
+
this.fillTimelineForDayOrWeek(DateTimeConstants.DAY_INTERVAL, startDate, endDate, {
|
|
1714
|
+
setup: function () {
|
|
1715
|
+
dayCounter = this.getFirstDayOfVisibleRange(startDate);
|
|
1716
|
+
even = this.isEven(startDate, timeline.firstDayOfRange);
|
|
1717
|
+
},
|
|
1718
|
+
fillResolutionBlock: function (index, date, currentYear, lastTimelineBlock) {
|
|
1719
|
+
try {
|
|
1720
|
+
weekday = timeline.getWeekday(dayCounter);
|
|
1721
|
+
if (timeline.resolution === Resolution.Week) {
|
|
1722
|
+
this.fillWeekBlock(left, index, date, lastTimelineBlock);
|
|
1723
|
+
}
|
|
1724
|
+
else {
|
|
1725
|
+
this.fillDayBlock(left, index, date);
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
finally {
|
|
1729
|
+
dayCounter = Math.max((dayCounter + 1) % 8, 1);
|
|
1730
|
+
}
|
|
1731
|
+
},
|
|
1732
|
+
fillDayBlock: function (left, index, date) {
|
|
1733
|
+
const childCount = timeline.resolutionDiv.childElementCount;
|
|
1734
|
+
if (timeline.isValidChildIndex(index, childCount)) {
|
|
1735
|
+
const resBlock = timeline.resolutionDiv.childNodes.item(index);
|
|
1736
|
+
timeline.fillDayResolutionBlock(resBlock, date, index, timeline.isWeekEnd(dayCounter), left);
|
|
1737
|
+
}
|
|
1738
|
+
else {
|
|
1739
|
+
timeline.logIndexOutOfBounds("day", index, childCount);
|
|
1740
|
+
return;
|
|
1741
|
+
}
|
|
1742
|
+
},
|
|
1743
|
+
fillWeekBlock: function (left, index, date, lastTimelineBlock) {
|
|
1744
|
+
let resBlock = null;
|
|
1745
|
+
if (index > 0 && weekday == Weekday.First) {
|
|
1746
|
+
weekIndex++;
|
|
1747
|
+
firstWeek = false;
|
|
1748
|
+
even = !even;
|
|
1749
|
+
}
|
|
1750
|
+
if (index == 0 || weekday == Weekday.First) {
|
|
1751
|
+
const childCount = timeline.resolutionDiv.childElementCount;
|
|
1752
|
+
if (timeline.isValidChildIndex(weekIndex, childCount)) {
|
|
1753
|
+
resBlock = timeline.resolutionDiv.childNodes.item(weekIndex);
|
|
1754
|
+
}
|
|
1755
|
+
else {
|
|
1756
|
+
timeline.logIndexOutOfBounds("week", weekIndex, childCount);
|
|
1757
|
+
return;
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
timeline.fillWeekResolutionBlock(resBlock, date, weekIndex, weekday, firstWeek, lastTimelineBlock, left, even);
|
|
1761
|
+
},
|
|
1762
|
+
calcDaysLeftInFirstWeek: function (startDay) {
|
|
1763
|
+
let daysLeftInWeek = 0;
|
|
1764
|
+
if (startDay != timeline.firstDayOfWeek) {
|
|
1765
|
+
for (let i = startDay;; i++) {
|
|
1766
|
+
daysLeftInWeek++;
|
|
1767
|
+
if (Math.max(i % 8, 1) === timeline.lastDayOfWeek) {
|
|
1768
|
+
break;
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
return daysLeftInWeek;
|
|
1773
|
+
},
|
|
1774
|
+
isEven: function (startDate, startDay) {
|
|
1775
|
+
const visibleRangeNormalStartDate = timeline.toNormalDate(startDate);
|
|
1776
|
+
if (timeline.normalStartDate.getTime() < visibleRangeNormalStartDate.getTime()) {
|
|
1777
|
+
let daysHidden = Math.floor(((visibleRangeNormalStartDate.getTime() - timeline.normalStartDate.getTime()) / DateTimeConstants.DAY_INTERVAL));
|
|
1778
|
+
timeline.log("Days hidden: " + daysHidden);
|
|
1779
|
+
timeline.log("firstWeekBlockHidden = " + timeline.firstWeekBlockHidden);
|
|
1780
|
+
if (daysHidden === 0) {
|
|
1781
|
+
return false;
|
|
1782
|
+
}
|
|
1783
|
+
const daysLeftInFirstWeek = this.calcDaysLeftInFirstWeek(startDay);
|
|
1784
|
+
if (daysHidden > daysLeftInFirstWeek) {
|
|
1785
|
+
daysHidden -= daysLeftInFirstWeek;
|
|
1786
|
+
}
|
|
1787
|
+
const weeks = daysHidden / DateTimeConstants.DAYS_IN_WEEK;
|
|
1788
|
+
const even = (weeks % 2) === 1;
|
|
1789
|
+
return (timeline.firstWeekBlockHidden) ? !even : even;
|
|
1790
|
+
}
|
|
1791
|
+
return false;
|
|
1792
|
+
},
|
|
1793
|
+
getFirstDayOfVisibleRange: function (startDate) {
|
|
1794
|
+
const visibleRangeNormalStartDate = timeline.toNormalDate(startDate);
|
|
1795
|
+
if (timeline.normalStartDate.getTime() < visibleRangeNormalStartDate.getTime()) {
|
|
1796
|
+
const days = Math.floor(((visibleRangeNormalStartDate.getTime() - timeline.normalStartDate.getTime()) / DateTimeConstants.DAY_INTERVAL));
|
|
1797
|
+
return ((timeline.firstDayOfRange - 1 + days) % 7) + 1;
|
|
1798
|
+
}
|
|
1799
|
+
return timeline.firstDayOfRange;
|
|
1800
|
+
}
|
|
1801
|
+
});
|
|
1802
|
+
}
|
|
1803
|
+
logIndexOutOfBounds(indexName, index, childCount) {
|
|
1804
|
+
this.log(`${indexName} index ${index} out of bounds with childCount ${childCount}. Can't fill content.`);
|
|
1805
|
+
}
|
|
1806
|
+
fillTimelineForHour(interval, startDate, endDate, resBlockFiller) {
|
|
1807
|
+
const currentYear = null;
|
|
1808
|
+
let pos = startDate;
|
|
1809
|
+
const end = endDate;
|
|
1810
|
+
let index = 0;
|
|
1811
|
+
let lastTimelineBlock;
|
|
1812
|
+
let date;
|
|
1813
|
+
resBlockFiller.setup();
|
|
1814
|
+
while (pos <= end) {
|
|
1815
|
+
date = pos;
|
|
1816
|
+
const nextHour = new Date(pos.getTime() + interval);
|
|
1817
|
+
lastTimelineBlock = nextHour.getTime() > end.getTime();
|
|
1818
|
+
resBlockFiller.fillResolutionBlock(index, date, currentYear, lastTimelineBlock);
|
|
1819
|
+
pos = nextHour;
|
|
1820
|
+
index++;
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
fillTimelineForDayOrWeek(interval, startDate, endDate, resBlockFiller) {
|
|
1824
|
+
const currentYear = null;
|
|
1825
|
+
const timeZone = this.localeDataProvider.getTimeZone();
|
|
1826
|
+
// Same calendar-day stepping as prepareTimelineForDayOrWeek().
|
|
1827
|
+
let date = DateUtil.adjustToMiddleOfDay(startDate, timeZone);
|
|
1828
|
+
const end = endDate;
|
|
1829
|
+
let index = 0;
|
|
1830
|
+
let lastTimelineBlock = false;
|
|
1831
|
+
resBlockFiller.setup();
|
|
1832
|
+
while (!lastTimelineBlock) {
|
|
1833
|
+
const next = addDaysInZone(date, 1, timeZone);
|
|
1834
|
+
lastTimelineBlock = next.getTime() > end.getTime();
|
|
1835
|
+
resBlockFiller.fillResolutionBlock(index, date, currentYear, lastTimelineBlock);
|
|
1836
|
+
date = next;
|
|
1837
|
+
index++;
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
isValidChildIndex(index, childCount) {
|
|
1841
|
+
return (index >= 0) && (index < childCount);
|
|
1842
|
+
}
|
|
1843
|
+
fillDayResolutionBlock(resBlock, date, index, weekend, left) {
|
|
1844
|
+
resBlock.innerText = this.localeDataProvider.formatDate(date, "d");
|
|
1845
|
+
if (weekend) {
|
|
1846
|
+
resBlock.classList.add(TimelineElement_1.STYLE_WEEKEND);
|
|
1847
|
+
}
|
|
1848
|
+
else {
|
|
1849
|
+
resBlock.classList.remove(TimelineElement_1.STYLE_WEEKEND);
|
|
1850
|
+
}
|
|
1851
|
+
this.setCurrentStyle(resBlock, this.isCurrentDay(date));
|
|
1852
|
+
if (this.setPositionForEachBlock && this.isTimelineOverflowingHorizontally()) {
|
|
1853
|
+
resBlock.style.position = "relative";
|
|
1854
|
+
resBlock.style.left = left + "px";
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
fillWeekResolutionBlock(resBlock, date, index, weekDay, firstWeek, lastBlock, left, even) {
|
|
1858
|
+
if (resBlock != null) {
|
|
1859
|
+
resBlock.innerText = this.formatWeekCaption(date);
|
|
1860
|
+
if (even) {
|
|
1861
|
+
resBlock.classList.add(TimelineElement_1.STYLE_EVEN);
|
|
1862
|
+
}
|
|
1863
|
+
else {
|
|
1864
|
+
resBlock.classList.remove(TimelineElement_1.STYLE_EVEN);
|
|
1865
|
+
}
|
|
1866
|
+
if (this.setPositionForEachBlock && this.isTimelineOverflowingHorizontally()) {
|
|
1867
|
+
resBlock.style.position = "relative";
|
|
1868
|
+
resBlock.style.left = left + "px";
|
|
1869
|
+
}
|
|
1870
|
+
resBlock.classList.remove(TimelineElement_1.STYLE_FIRST, TimelineElement_1.STYLE_LAST);
|
|
1871
|
+
// block is (re)filled starting from its first visible day; clear old state.
|
|
1872
|
+
this.setCurrentStyle(resBlock, false);
|
|
1873
|
+
}
|
|
1874
|
+
if (this.isCurrentDay(date) && this.isValidChildIndex(index, this.resolutionDiv.childElementCount)) {
|
|
1875
|
+
this.setCurrentStyle(this.resolutionDiv.childNodes.item(index), true);
|
|
1876
|
+
}
|
|
1877
|
+
if (firstWeek && (weekDay === Weekday.Last || lastBlock)) {
|
|
1878
|
+
const firstEl = this.resolutionDiv.firstElementChild;
|
|
1879
|
+
if (!firstEl.classList.contains(TimelineElement_1.STYLE_FIRST)) {
|
|
1880
|
+
firstEl.classList.add(TimelineElement_1.STYLE_FIRST);
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
else if (lastBlock) {
|
|
1884
|
+
const lastEl = this.resolutionDiv.lastChild;
|
|
1885
|
+
if (!lastEl.classList.contains(TimelineElement_1.STYLE_LAST)) {
|
|
1886
|
+
lastEl.classList.add(TimelineElement_1.STYLE_LAST);
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
fillHourResolutionBlock(resBlock, date, index, hourCounter, lastBlock, left, even) {
|
|
1891
|
+
if (this.localeDataProvider.isTwelveHourClock()) {
|
|
1892
|
+
resBlock.innerText = this.localeDataProvider.formatTime(date, "h");
|
|
1893
|
+
}
|
|
1894
|
+
else {
|
|
1895
|
+
resBlock.innerText = this.localeDataProvider.formatTime(date, "HH");
|
|
1896
|
+
}
|
|
1897
|
+
if (even) {
|
|
1898
|
+
resBlock.classList.add(TimelineElement_1.STYLE_EVEN);
|
|
1899
|
+
}
|
|
1900
|
+
else {
|
|
1901
|
+
resBlock.classList.remove(TimelineElement_1.STYLE_EVEN);
|
|
1902
|
+
}
|
|
1903
|
+
this.setCurrentStyle(resBlock, this.isCurrentHour(date));
|
|
1904
|
+
if (this.firstDay && (hourCounter == 24 || lastBlock)) {
|
|
1905
|
+
this.firstDay = false;
|
|
1906
|
+
this.firstResBlockCount = index + 1;
|
|
1907
|
+
}
|
|
1908
|
+
else if (lastBlock) {
|
|
1909
|
+
this.lastResBlockCount = (index + 1 - this.firstResBlockCount) % 24;
|
|
1910
|
+
}
|
|
1911
|
+
if (this.setPositionForEachBlock && this.isTimelineOverflowingHorizontally()) {
|
|
1912
|
+
resBlock.style.position = "relative";
|
|
1913
|
+
resBlock.style.left = left + "px";
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
};
|
|
1917
|
+
TimelineElement.STYLE_ROW = "row";
|
|
1918
|
+
TimelineElement.STYLE_COL = "col";
|
|
1919
|
+
TimelineElement.STYLE_MONTH = "month";
|
|
1920
|
+
TimelineElement.STYLE_YEAR = "year";
|
|
1921
|
+
TimelineElement.STYLE_DAY = "day";
|
|
1922
|
+
TimelineElement.STYLE_WEEK = "w";
|
|
1923
|
+
TimelineElement.STYLE_MONTH_RES = "m";
|
|
1924
|
+
TimelineElement.STYLE_YEAR_RES = "y";
|
|
1925
|
+
TimelineElement.STYLE_RESOLUTION = "resolution";
|
|
1926
|
+
TimelineElement.STYLE_EVEN = "even";
|
|
1927
|
+
TimelineElement.STYLE_WEEKEND = "weekend";
|
|
1928
|
+
TimelineElement.STYLE_SPACER = "spacer";
|
|
1929
|
+
TimelineElement.STYLE_FIRST = "f-col";
|
|
1930
|
+
TimelineElement.STYLE_CENTER = "c-col";
|
|
1931
|
+
TimelineElement.STYLE_LAST = "l-col";
|
|
1932
|
+
TimelineElement.STYLE_MEASURE = "measure";
|
|
1933
|
+
TimelineElement.STYLE_CURRENT = "current";
|
|
1934
|
+
TimelineElement.CURRENT_DAY_FORMAT = "yyyy-MM-dd";
|
|
1935
|
+
// Offset is included to tell apart the repeated hour when daylight saving time ends.
|
|
1936
|
+
TimelineElement.CURRENT_HOUR_FORMAT = "yyyy-MM-dd HH xxx";
|
|
1937
|
+
/* Average day counts used to convert a measured month/year block width to a day width. */
|
|
1938
|
+
TimelineElement.AVERAGE_DAYS_IN_MONTH = 30;
|
|
1939
|
+
TimelineElement.AVERAGE_DAYS_IN_YEAR = 365;
|
|
1940
|
+
__decorate([
|
|
1941
|
+
property({
|
|
1942
|
+
reflect: true,
|
|
1943
|
+
converter: {
|
|
1944
|
+
// Attribute holds the enum name, e.g. "Week".
|
|
1945
|
+
fromAttribute: (value) => Resolution[value],
|
|
1946
|
+
toAttribute: (value) => Resolution[value],
|
|
1947
|
+
}
|
|
1948
|
+
})
|
|
1949
|
+
], TimelineElement.prototype, "resolution", void 0);
|
|
1950
|
+
__decorate([
|
|
1951
|
+
property({ reflect: true, converter: { fromAttribute: toHourAccuracy } })
|
|
1952
|
+
], TimelineElement.prototype, "startDateTime", void 0);
|
|
1953
|
+
__decorate([
|
|
1954
|
+
property({ reflect: true, converter: { fromAttribute: toHourAccuracy } })
|
|
1955
|
+
], TimelineElement.prototype, "endDateTime", void 0);
|
|
1956
|
+
__decorate([
|
|
1957
|
+
property({ reflect: true })
|
|
1958
|
+
], TimelineElement.prototype, "timeZone", void 0);
|
|
1959
|
+
__decorate([
|
|
1960
|
+
property({ reflect: true })
|
|
1961
|
+
], TimelineElement.prototype, "locale", void 0);
|
|
1962
|
+
__decorate([
|
|
1963
|
+
property({ reflect: true, type: Number })
|
|
1964
|
+
], TimelineElement.prototype, "firstDayOfWeek", void 0);
|
|
1965
|
+
__decorate([
|
|
1966
|
+
property({ reflect: true, type: Boolean })
|
|
1967
|
+
], TimelineElement.prototype, "twelveHourClock", void 0);
|
|
1968
|
+
__decorate([
|
|
1969
|
+
property()
|
|
1970
|
+
], TimelineElement.prototype, "minWidth", void 0);
|
|
1971
|
+
__decorate([
|
|
1972
|
+
property()
|
|
1973
|
+
], TimelineElement.prototype, "normalStartDate", void 0);
|
|
1974
|
+
__decorate([
|
|
1975
|
+
property()
|
|
1976
|
+
], TimelineElement.prototype, "normalEndDate", void 0);
|
|
1977
|
+
__decorate([
|
|
1978
|
+
property()
|
|
1979
|
+
], TimelineElement.prototype, "lastDayOfWeek", void 0);
|
|
1980
|
+
__decorate([
|
|
1981
|
+
property()
|
|
1982
|
+
], TimelineElement.prototype, "firstDayOfRange", void 0);
|
|
1983
|
+
__decorate([
|
|
1984
|
+
property()
|
|
1985
|
+
], TimelineElement.prototype, "firstHourOfRange", void 0);
|
|
1986
|
+
__decorate([
|
|
1987
|
+
property({ reflect: true })
|
|
1988
|
+
], TimelineElement.prototype, "scrollContainerId", void 0);
|
|
1989
|
+
__decorate([
|
|
1990
|
+
property({ converter: { fromAttribute: visibleUnlessFalse } })
|
|
1991
|
+
], TimelineElement.prototype, "monthRowVisible", void 0);
|
|
1992
|
+
__decorate([
|
|
1993
|
+
property({ converter: { fromAttribute: visibleUnlessFalse } })
|
|
1994
|
+
], TimelineElement.prototype, "yearRowVisible", void 0);
|
|
1995
|
+
__decorate([
|
|
1996
|
+
property()
|
|
1997
|
+
], TimelineElement.prototype, "monthNames", void 0);
|
|
1998
|
+
__decorate([
|
|
1999
|
+
property()
|
|
2000
|
+
], TimelineElement.prototype, "weekdayNames", void 0);
|
|
2001
|
+
__decorate([
|
|
2002
|
+
property({ reflect: true, type: Boolean })
|
|
2003
|
+
], TimelineElement.prototype, "currentDateVisible", void 0);
|
|
2004
|
+
__decorate([
|
|
2005
|
+
property({ type: Boolean })
|
|
2006
|
+
], TimelineElement.prototype, "debug", void 0);
|
|
2007
|
+
__decorate([
|
|
2008
|
+
query('#resolutionDiv')
|
|
2009
|
+
], TimelineElement.prototype, "resolutionDiv", void 0);
|
|
2010
|
+
TimelineElement = TimelineElement_1 = __decorate([
|
|
2011
|
+
customElement('timeline-element')
|
|
2012
|
+
], TimelineElement);
|
|
2013
|
+
export { TimelineElement };
|
|
2014
2014
|
//# sourceMappingURL=timeline-element.js.map
|