@progress/kendo-angular-layout 16.0.0-develop.4 → 16.0.0-develop.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/index.mjs +7 -0
- package/esm2020/layout.module.mjs +7 -3
- package/esm2020/package-metadata.mjs +2 -2
- package/esm2020/timeline/events/navigation-direction.mjs +5 -0
- package/esm2020/timeline/localization/custom-messages.component.mjs +41 -0
- package/esm2020/timeline/localization/localized-messages.directive.mjs +37 -0
- package/esm2020/timeline/localization/messages.mjs +25 -0
- package/esm2020/timeline/models/anchor-target.mjs +5 -0
- package/esm2020/timeline/models/default-model-fields.mjs +16 -0
- package/esm2020/timeline/models/model-fields.mjs +5 -0
- package/esm2020/timeline/models/timeline-event.mjs +5 -0
- package/esm2020/timeline/templates/timeline-card-actions.directive.mjs +29 -0
- package/esm2020/timeline/templates/timeline-card-body.directive.mjs +29 -0
- package/esm2020/timeline/templates/timeline-card-header.directive.mjs +29 -0
- package/esm2020/timeline/timeline-card.component.mjs +402 -0
- package/esm2020/timeline/timeline-horizontal.component.mjs +722 -0
- package/esm2020/timeline/timeline-vertical.component.mjs +175 -0
- package/esm2020/timeline/timeline.component.mjs +418 -0
- package/esm2020/timeline/timeline.service.mjs +31 -0
- package/esm2020/timeline/util.mjs +26 -0
- package/esm2020/timeline.module.mjs +65 -0
- package/fesm2015/progress-kendo-angular-layout.mjs +1996 -63
- package/fesm2020/progress-kendo-angular-layout.mjs +1969 -63
- package/index.d.ts +10 -0
- package/layout.module.d.ts +2 -1
- package/package.json +7 -7
- package/timeline/events/navigation-direction.d.ts +5 -0
- package/timeline/localization/custom-messages.component.d.ts +17 -0
- package/timeline/localization/localized-messages.directive.d.ts +16 -0
- package/timeline/localization/messages.d.ts +21 -0
- package/timeline/models/anchor-target.d.ts +5 -0
- package/timeline/models/default-model-fields.d.ts +9 -0
- package/timeline/models/model-fields.d.ts +51 -0
- package/timeline/models/timeline-event.d.ts +49 -0
- package/timeline/templates/timeline-card-actions.directive.d.ts +20 -0
- package/timeline/templates/timeline-card-body.directive.d.ts +20 -0
- package/timeline/templates/timeline-card-header.directive.d.ts +20 -0
- package/timeline/timeline-card.component.d.ts +59 -0
- package/timeline/timeline-horizontal.component.d.ts +110 -0
- package/timeline/timeline-vertical.component.d.ts +41 -0
- package/timeline/timeline.component.d.ts +186 -0
- package/timeline/timeline.service.d.ts +17 -0
- package/timeline/util.d.ts +18 -0
- package/timeline.module.d.ts +31 -0
|
@@ -0,0 +1,722 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { ChangeDetectorRef, Component, ElementRef, Input, NgZone, QueryList, Renderer2, ViewChild, ViewChildren, } from '@angular/core';
|
|
6
|
+
import { caretAltLeftIcon, caretAltRightIcon } from '@progress/kendo-svg-icons';
|
|
7
|
+
import { Subscription, fromEvent } from 'rxjs';
|
|
8
|
+
import { TimelineCardComponent } from './timeline-card.component';
|
|
9
|
+
import { Keys, guid, isChanged, isPresent } from '@progress/kendo-angular-common';
|
|
10
|
+
import { animate, state, style, transition, trigger } from '@angular/animations';
|
|
11
|
+
import { TimelineService } from './timeline.service';
|
|
12
|
+
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
13
|
+
import { TimelineCardBodyTemplateDirective } from './templates/timeline-card-body.directive';
|
|
14
|
+
import { TimelineCardHeaderTemplateDirective } from './templates/timeline-card-header.directive';
|
|
15
|
+
import { TimelineCardActionsTemplateDirective } from './templates/timeline-card-actions.directive';
|
|
16
|
+
import * as i0 from "@angular/core";
|
|
17
|
+
import * as i1 from "./timeline.service";
|
|
18
|
+
import * as i2 from "@progress/kendo-angular-l10n";
|
|
19
|
+
import * as i3 from "@angular/common";
|
|
20
|
+
import * as i4 from "@progress/kendo-angular-buttons";
|
|
21
|
+
import * as i5 from "./timeline-card.component";
|
|
22
|
+
import * as i6 from "@progress/kendo-angular-intl";
|
|
23
|
+
const DEFAULT_TAB_WIDTH = 200;
|
|
24
|
+
const SPACE_BETWEEN_TABS = 25;
|
|
25
|
+
const TRANSITION_EVENTS_COUNT = 3;
|
|
26
|
+
/**
|
|
27
|
+
* @hidden
|
|
28
|
+
*/
|
|
29
|
+
export class TimelineHorizontalComponent {
|
|
30
|
+
constructor(cdr, _zone, renderer, timelineService, localization) {
|
|
31
|
+
this.cdr = cdr;
|
|
32
|
+
this._zone = _zone;
|
|
33
|
+
this.renderer = renderer;
|
|
34
|
+
this.timelineService = timelineService;
|
|
35
|
+
this.localization = localization;
|
|
36
|
+
this.events = [];
|
|
37
|
+
this.svgLeftIcon = caretAltLeftIcon;
|
|
38
|
+
this.svgRightIcon = caretAltRightIcon;
|
|
39
|
+
this.animationState = 'center';
|
|
40
|
+
this.translateValue = 0;
|
|
41
|
+
this.eventsInInterval = [0, 1, 2];
|
|
42
|
+
this.selectedCardIndex = 0;
|
|
43
|
+
this.tabWidth = DEFAULT_TAB_WIDTH;
|
|
44
|
+
this.firstCircleInView = 0;
|
|
45
|
+
this.visibleEvents = [];
|
|
46
|
+
this.trackItems = [];
|
|
47
|
+
this.previousTitle = 'previous';
|
|
48
|
+
this.nextTitle = 'next';
|
|
49
|
+
this.subscriptions = new Subscription();
|
|
50
|
+
}
|
|
51
|
+
get selectedEvent() {
|
|
52
|
+
return this._selectedEvent;
|
|
53
|
+
}
|
|
54
|
+
set selectedEvent(value) {
|
|
55
|
+
if (this._selectedEvent === value) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const newSelectedIndex = this.events.findIndex(event => event === value);
|
|
59
|
+
if (newSelectedIndex === -1 && value !== null) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
this._selectedEvent = value;
|
|
63
|
+
this.selectedEventIndex = newSelectedIndex;
|
|
64
|
+
this.calloutStyle = this.calloutOffset;
|
|
65
|
+
}
|
|
66
|
+
ngOnInit() {
|
|
67
|
+
this._zone.runOutsideAngular(() => this.subscriptions.add(fromEvent(window, 'resize').subscribe(this.handleWindowResize.bind(this))));
|
|
68
|
+
this.l10nChange();
|
|
69
|
+
this.subscriptions.add(this.localization.changes.subscribe(this.l10nChange.bind(this)));
|
|
70
|
+
if (this.events.length > 0) {
|
|
71
|
+
this.selectedEvent = this.events[0];
|
|
72
|
+
}
|
|
73
|
+
this.events.forEach(event => {
|
|
74
|
+
if (event.flag) {
|
|
75
|
+
this.trackItems.push({ isFlag: event.flag });
|
|
76
|
+
}
|
|
77
|
+
this.trackItems.push(event);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
ngAfterViewInit() {
|
|
81
|
+
this.subscriptions.add(this.renderer.listen(this.trackElementRef.nativeElement, 'keydown', this.onKeyDown.bind(this)));
|
|
82
|
+
this.trackWrapWidth = this.trackElementRef.nativeElement.getBoundingClientRect().width;
|
|
83
|
+
this.scrollableTrackWidth = this.scrollableTrackElementRef.nativeElement.getBoundingClientRect().width;
|
|
84
|
+
this._zone.runOutsideAngular(() => {
|
|
85
|
+
this.onCirclesChange();
|
|
86
|
+
this.subscriptions.add(this.circleElementRefs.changes.subscribe(this.onCirclesChange.bind(this)));
|
|
87
|
+
this.subscriptions.add(this.cardElementRefs.changes.subscribe(this.onCardsChange.bind(this)));
|
|
88
|
+
});
|
|
89
|
+
if (this.events.length === 0) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
this.onCardsChange();
|
|
93
|
+
if (this.cardComponents.get(this.selectedCardIndex)) {
|
|
94
|
+
this.cardComponents.get(this.selectedCardIndex).calloutStyle = this.calloutOffset;
|
|
95
|
+
this.focusTrackItem(0);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
ngOnChanges(changes) {
|
|
99
|
+
if (isChanged('events', changes)) {
|
|
100
|
+
if (!this.events || this.events.length === 0) {
|
|
101
|
+
this.selectedEvent = null;
|
|
102
|
+
this.trackItems = [];
|
|
103
|
+
this.visibleEvents = [];
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
this.trackItems = [];
|
|
107
|
+
this.events.forEach(event => {
|
|
108
|
+
if (event.flag) {
|
|
109
|
+
this.trackItems.push({ isFlag: event.flag });
|
|
110
|
+
}
|
|
111
|
+
this.trackItems.push(event);
|
|
112
|
+
});
|
|
113
|
+
this.visibleEvents = this.trackItems
|
|
114
|
+
.slice(this.firstCircleInView, this.firstCircleInView + this.visibleTabsCount)
|
|
115
|
+
.filter(event => !event.isFlag);
|
|
116
|
+
this.selectedEvent = this.events[0];
|
|
117
|
+
this.cdr.detectChanges();
|
|
118
|
+
this.calloutStyle = this.calloutOffset;
|
|
119
|
+
this.focusTrackItem(0);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
ngOnDestroy() {
|
|
124
|
+
this.subscriptions.unsubscribe();
|
|
125
|
+
}
|
|
126
|
+
handleWindowResize() {
|
|
127
|
+
if (this.trackWrapWidth === this.trackElementRef.nativeElement.getBoundingClientRect().width) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
this.cardWidth = this.cardComponents.get(this.selectedCardIndex).element.nativeElement.offsetWidth;
|
|
131
|
+
this.transformCards();
|
|
132
|
+
this.trackWrapWidth = this.trackElementRef.nativeElement.getBoundingClientRect().width;
|
|
133
|
+
this.scrollableTrackWidth = this.scrollableTrackElementRef.nativeElement.getBoundingClientRect().width;
|
|
134
|
+
this.changeTabsCount();
|
|
135
|
+
this._zone.run(() => {
|
|
136
|
+
this.cardComponents.get(this.selectedCardIndex).calloutStyle = this.calloutOffset;
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
onTransitionEnd() {
|
|
140
|
+
this.cardElementRefs?.forEach(card => this.renderer.removeStyle(card.nativeElement, 'transition-duration'));
|
|
141
|
+
this.cardComponents.get(this.selectedCardIndex).event = this.selectedEvent;
|
|
142
|
+
this.calloutStyle = this.calloutOffset;
|
|
143
|
+
}
|
|
144
|
+
onTrackTransitionEnd() {
|
|
145
|
+
this.calloutStyle = this.calloutOffset;
|
|
146
|
+
}
|
|
147
|
+
onSlideDone() {
|
|
148
|
+
this.calloutStyle = this.calloutOffset;
|
|
149
|
+
}
|
|
150
|
+
previous() {
|
|
151
|
+
if (this.firstCircleInView === 0) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
this.updateInterval(false);
|
|
155
|
+
}
|
|
156
|
+
previousClick() {
|
|
157
|
+
this.previous();
|
|
158
|
+
this.timelineService.onNavigate('previous');
|
|
159
|
+
}
|
|
160
|
+
next() {
|
|
161
|
+
if (!this.visibleTabsCount || this.firstCircleInView + this.visibleTabsCount > this.trackItems.length) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
this.updateInterval(true);
|
|
165
|
+
}
|
|
166
|
+
nextClick() {
|
|
167
|
+
this.next();
|
|
168
|
+
this.timelineService.onNavigate('next');
|
|
169
|
+
}
|
|
170
|
+
open(index) {
|
|
171
|
+
if (index < 0 || index >= this.events.length) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (this.visibleEvents.findIndex(event => event === this.events[index]) === -1) {
|
|
175
|
+
// determine the start and end of the interval that the event belongs to, regardless of its position in the interval
|
|
176
|
+
const trackItemIndex = this.trackItems.findIndex(event => event === this.events[index]);
|
|
177
|
+
const start = Math.floor(trackItemIndex / this.visibleTabsCount) * this.visibleTabsCount;
|
|
178
|
+
this.navigateToInterval(start, index);
|
|
179
|
+
}
|
|
180
|
+
this.selectedEvent = this.events[index];
|
|
181
|
+
this.selectedCardIndex = this.getOtherSelectedCardIndex(index > this.selectedEventIndex);
|
|
182
|
+
this.calloutStyle = this.calloutOffset;
|
|
183
|
+
this.focusTrackItem(this.selectedEventIndex);
|
|
184
|
+
this.animateCards();
|
|
185
|
+
}
|
|
186
|
+
navigateToEvent(index) {
|
|
187
|
+
const eventIndex = this.events.findIndex(event => event === this.trackItems[index]);
|
|
188
|
+
if (this.selectedEventIndex === eventIndex) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
this.selectedEvent = this.events[eventIndex];
|
|
192
|
+
this.selectedCardIndex = this.getOtherSelectedCardIndex(index > eventIndex);
|
|
193
|
+
this.calloutStyle = this.calloutOffset;
|
|
194
|
+
this.animateCards();
|
|
195
|
+
}
|
|
196
|
+
getOtherSelectedCardIndex(forward) {
|
|
197
|
+
// change the selected card which changes all cards' transform styles
|
|
198
|
+
if (forward) {
|
|
199
|
+
return this.selectedCardIndex === 0 ? TRANSITION_EVENTS_COUNT - 1 : this.selectedCardIndex - 1;
|
|
200
|
+
}
|
|
201
|
+
return this.selectedCardIndex === TRANSITION_EVENTS_COUNT - 1 ? 0 : this.selectedCardIndex + 1;
|
|
202
|
+
}
|
|
203
|
+
tabStyle() {
|
|
204
|
+
if (!this.tabFlex) {
|
|
205
|
+
return {};
|
|
206
|
+
}
|
|
207
|
+
return { 'flex': `1 0 ${this.tabFlex}%` };
|
|
208
|
+
}
|
|
209
|
+
getTransformation(width, position) {
|
|
210
|
+
if (position === this.selectedCardIndex - 1 || position === this.selectedCardIndex + 2) {
|
|
211
|
+
return `translate3d(${-width}px, 0, 0)`;
|
|
212
|
+
}
|
|
213
|
+
if (position === this.selectedCardIndex + 1 || position === this.selectedCardIndex - 2) {
|
|
214
|
+
return `translate3d(${width}px, 0, 0)`;
|
|
215
|
+
}
|
|
216
|
+
return `translate3d(0, 0, 0)`;
|
|
217
|
+
}
|
|
218
|
+
getState(position) {
|
|
219
|
+
if (position === this.selectedCardIndex) {
|
|
220
|
+
return 'center';
|
|
221
|
+
}
|
|
222
|
+
if (position === this.selectedCardIndex - 1 || position === this.selectedCardIndex + 2) {
|
|
223
|
+
return 'left';
|
|
224
|
+
}
|
|
225
|
+
return 'right';
|
|
226
|
+
}
|
|
227
|
+
get calloutOffset() {
|
|
228
|
+
if (!this.circleElementRefs?.first || !this.trackElementRef || !isPresent(this.selectedEventIndex)) {
|
|
229
|
+
return {};
|
|
230
|
+
}
|
|
231
|
+
const circleCenter = this.circleElementRefs.get(this.selectedEventIndex).nativeElement.getBoundingClientRect().left +
|
|
232
|
+
this.circleElementRefs.get(this.selectedEventIndex).nativeElement.offsetWidth / 2;
|
|
233
|
+
const trackOffset = this.trackElementRef.nativeElement.getBoundingClientRect().left;
|
|
234
|
+
return { left: `${circleCenter - trackOffset}px` };
|
|
235
|
+
}
|
|
236
|
+
get isFirstRange() {
|
|
237
|
+
return this.firstCircleInView === 0;
|
|
238
|
+
}
|
|
239
|
+
get isLastRange() {
|
|
240
|
+
if (!this.circleElementRefs?.first && !this.flagElementRefs?.first) {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
return this.trackItems.length === 0 ||
|
|
244
|
+
this.firstCircleInView + this.visibleTabsCount >= this.trackItems.length;
|
|
245
|
+
}
|
|
246
|
+
onCardsChange() {
|
|
247
|
+
if (this.cardElementRefs?.get(this.selectedCardIndex)) {
|
|
248
|
+
this.cardWidth = this.cardElementRefs.get(this.selectedCardIndex).nativeElement.offsetWidth;
|
|
249
|
+
this.transformCards();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
onCirclesChange() {
|
|
253
|
+
if (!this.circleElementRefs?.first) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
this.circleElementRefs
|
|
257
|
+
.map(element => element.nativeElement)
|
|
258
|
+
.forEach((element, index) => {
|
|
259
|
+
this.subscriptions.add(this.renderer.listen(element, 'click', () => {
|
|
260
|
+
this.focusTrackItem(index);
|
|
261
|
+
}));
|
|
262
|
+
});
|
|
263
|
+
const width = this.circleElementRefs.first.nativeElement.getBoundingClientRect().width;
|
|
264
|
+
if (width > DEFAULT_TAB_WIDTH) {
|
|
265
|
+
this.tabWidth = this.circleElementRefs.first.nativeElement.getBoundingClientRect().width + SPACE_BETWEEN_TABS;
|
|
266
|
+
}
|
|
267
|
+
this.changeTabsCount();
|
|
268
|
+
this.visibleEvents = this.trackItems
|
|
269
|
+
.slice(this.firstCircleInView, this.firstCircleInView + this.visibleTabsCount)
|
|
270
|
+
.filter(event => !event.isFlag);
|
|
271
|
+
}
|
|
272
|
+
onKeyDown(event) {
|
|
273
|
+
if (!this.navigable) {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
if (event.keyCode === Keys.Home) {
|
|
277
|
+
this.onHomeKey();
|
|
278
|
+
}
|
|
279
|
+
else if (event.keyCode === Keys.End) {
|
|
280
|
+
this.onEndKey();
|
|
281
|
+
}
|
|
282
|
+
else if (event.keyCode === Keys.ArrowRight) {
|
|
283
|
+
this.onArrowRightKey();
|
|
284
|
+
}
|
|
285
|
+
else if (event.keyCode === Keys.ArrowLeft) {
|
|
286
|
+
this.onArrowLeftKey();
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
focusTrackItem(index) {
|
|
290
|
+
if (!this.circleElementRefs || index < 0 || index >= this.circleElementRefs.length) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
const selectedTrackItem = this.circleElementRefs
|
|
294
|
+
.find(element => element.nativeElement.hasAttribute('aria-selected'));
|
|
295
|
+
if (selectedTrackItem) {
|
|
296
|
+
this.removeTrackItemAttributes(selectedTrackItem);
|
|
297
|
+
this.removeCardsAttributes();
|
|
298
|
+
}
|
|
299
|
+
const newTrackItem = this.circleElementRefs.get(index).nativeElement;
|
|
300
|
+
this.setTrackItemAttributes(newTrackItem, index);
|
|
301
|
+
}
|
|
302
|
+
setTrackItemAttributes(element, index) {
|
|
303
|
+
const innerCard = this.cardComponents.get(this.selectedCardIndex).element.nativeElement.querySelector('.k-card');
|
|
304
|
+
const selectedCircle = this.circleElementRefs.get(index).nativeElement;
|
|
305
|
+
this.renderer.addClass(element, 'k-focus');
|
|
306
|
+
this.renderer.setAttribute(element, 'aria-selected', 'true');
|
|
307
|
+
this.assignAriaLabel(innerCard, selectedCircle);
|
|
308
|
+
this.assignAriaDescribedBy(innerCard, selectedCircle);
|
|
309
|
+
}
|
|
310
|
+
removeTrackItemAttributes(element) {
|
|
311
|
+
this.renderer.removeClass(element.nativeElement, 'k-focus');
|
|
312
|
+
this.renderer.removeAttribute(element.nativeElement, 'aria-selected');
|
|
313
|
+
this.renderer.removeAttribute(element.nativeElement, 'id');
|
|
314
|
+
this.renderer.removeAttribute(element.nativeElement, 'aria-describedby');
|
|
315
|
+
}
|
|
316
|
+
removeCardsAttributes() {
|
|
317
|
+
this.cardElementRefs.forEach(card => {
|
|
318
|
+
this.renderer.removeAttribute(card.nativeElement.querySelector('.k-card'), 'id');
|
|
319
|
+
this.renderer.removeAttribute(card.nativeElement.querySelector('.k-card'), 'aria-label');
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
assignAriaLabel(cardElement, dateElement) {
|
|
323
|
+
const dateLabelId = `k-${guid()}`;
|
|
324
|
+
this.renderer.setAttribute(dateElement, 'id', dateLabelId);
|
|
325
|
+
this.renderer.setAttribute(cardElement, 'aria-label', dateLabelId);
|
|
326
|
+
}
|
|
327
|
+
assignAriaDescribedBy(cardElement, dateElement) {
|
|
328
|
+
const cardId = `k-${guid()}`;
|
|
329
|
+
this.renderer.setAttribute(cardElement, 'id', cardId);
|
|
330
|
+
this.renderer.setAttribute(dateElement, 'aria-describedby', cardId);
|
|
331
|
+
}
|
|
332
|
+
updateInterval(forward) {
|
|
333
|
+
let start = forward ? this.firstCircleInView + this.visibleTabsCount : this.firstCircleInView - this.visibleTabsCount;
|
|
334
|
+
if (start < 0 || start >= this.trackItems.length) {
|
|
335
|
+
start = 0;
|
|
336
|
+
}
|
|
337
|
+
this.navigateToInterval(start, 0, forward, !forward);
|
|
338
|
+
}
|
|
339
|
+
onHomeKey() {
|
|
340
|
+
this.navigateToFirstInterval();
|
|
341
|
+
}
|
|
342
|
+
onEndKey() {
|
|
343
|
+
this.navigateToLastInterval();
|
|
344
|
+
}
|
|
345
|
+
onArrowRightKey() {
|
|
346
|
+
this.navigateToOtherEvent(true);
|
|
347
|
+
}
|
|
348
|
+
onArrowLeftKey() {
|
|
349
|
+
this.navigateToOtherEvent(false);
|
|
350
|
+
}
|
|
351
|
+
navigateToFirstInterval() {
|
|
352
|
+
this.navigateToInterval(0);
|
|
353
|
+
}
|
|
354
|
+
navigateToLastInterval() {
|
|
355
|
+
const start = Math.floor(this.trackItems.length / this.visibleTabsCount) * this.visibleTabsCount;
|
|
356
|
+
this.navigateToInterval(start, this.events.length - 1);
|
|
357
|
+
}
|
|
358
|
+
navigateToOtherEvent(direction) {
|
|
359
|
+
const offset = direction ? 1 : -1;
|
|
360
|
+
const newIndex = this.selectedEventIndex + offset;
|
|
361
|
+
if (newIndex < 0 || newIndex >= this.events.length) {
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
if (this.visibleEvents.findIndex(event => event === this.events[newIndex]) === -1) {
|
|
365
|
+
this.updateInterval(direction);
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
this.selectedEvent = this.events[newIndex];
|
|
369
|
+
this.selectedCardIndex = this.getOtherSelectedCardIndex(direction);
|
|
370
|
+
this.focusTrackItem(this.selectedEventIndex);
|
|
371
|
+
this.animateCards();
|
|
372
|
+
this.cdr.markForCheck();
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
navigateToInterval(start, selectedIndex = 0, selectFirst = false, selectLast = false) {
|
|
376
|
+
const end = start + this.visibleTabsCount < this.trackItems.length ? start + this.visibleTabsCount : undefined;
|
|
377
|
+
const forward = this.firstCircleInView < start;
|
|
378
|
+
this.firstCircleInView = start;
|
|
379
|
+
const interval = Math.floor(start / this.visibleTabsCount);
|
|
380
|
+
this.translateValue = interval * -100;
|
|
381
|
+
this.animationState = forward ? 'right' : 'left';
|
|
382
|
+
this.visibleEvents = this.trackItems.slice(this.firstCircleInView, end).filter(event => !event.isFlag);
|
|
383
|
+
if (selectFirst) {
|
|
384
|
+
this.selectedEvent = this.visibleEvents[0];
|
|
385
|
+
}
|
|
386
|
+
else if (selectLast) {
|
|
387
|
+
this.selectedEvent = this.visibleEvents[this.visibleEvents.length - 1];
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
this.selectedEvent = this.events[selectedIndex];
|
|
391
|
+
}
|
|
392
|
+
this.selectedCardIndex = this.getOtherSelectedCardIndex(forward);
|
|
393
|
+
this.cdr.detectChanges();
|
|
394
|
+
this.focusTrackItem(this.selectedEventIndex);
|
|
395
|
+
this.animateCards();
|
|
396
|
+
this.calloutStyle = this.calloutOffset;
|
|
397
|
+
this.cdr.markForCheck();
|
|
398
|
+
}
|
|
399
|
+
animateCards() {
|
|
400
|
+
if (this.animationDuration) {
|
|
401
|
+
this.cardComponents.get(this.selectedCardIndex).event = null;
|
|
402
|
+
}
|
|
403
|
+
this.cardElementRefs.forEach((card, index) => {
|
|
404
|
+
this.renderer.setStyle(card.nativeElement, 'transform', this.getTransformation(this.cardWidth, index));
|
|
405
|
+
this.renderer.setStyle(card.nativeElement, 'transition-duration', `${this.animationDuration || 0}ms`);
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
transformCards() {
|
|
409
|
+
this.cardElementRefs.forEach((card, index) => this.renderer.setStyle(card.nativeElement, 'transform', this.getTransformation(this.cardWidth, index)));
|
|
410
|
+
}
|
|
411
|
+
changeTabsCount() {
|
|
412
|
+
this.visibleTabsCount = Math.round(this.scrollableTrackWidth / this.tabWidth);
|
|
413
|
+
if (this.tabFlex !== 100 / this.visibleTabsCount) {
|
|
414
|
+
this.tabFlex = 100 / this.visibleTabsCount;
|
|
415
|
+
this.circleElementRefs.forEach(item => this.renderer.setStyle(item.nativeElement, 'flex', `1 0 ${this.tabFlex}%`));
|
|
416
|
+
this.flagElementRefs.forEach(item => this.renderer.setStyle(item.nativeElement, 'flex', `1 0 ${this.tabFlex}%`));
|
|
417
|
+
this.cdr.detectChanges();
|
|
418
|
+
this.visibleEvents = this.trackItems
|
|
419
|
+
.slice(this.firstCircleInView, this.firstCircleInView + this.visibleTabsCount)
|
|
420
|
+
.filter(event => !event.isFlag);
|
|
421
|
+
if (!this.visibleEvents.find(event => event === this.selectedEvent)) {
|
|
422
|
+
const trackItemIndex = this.trackItems.findIndex(event => event === this.selectedEvent);
|
|
423
|
+
this.navigateToInterval(trackItemIndex, this.selectedEventIndex);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
l10nChange() {
|
|
428
|
+
if (this.localization.get('previous')) {
|
|
429
|
+
this.previousTitle = this.localization.get('previous');
|
|
430
|
+
}
|
|
431
|
+
if (this.localization.get('next')) {
|
|
432
|
+
this.nextTitle = this.localization.get('next');
|
|
433
|
+
}
|
|
434
|
+
this.cdr.markForCheck();
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
TimelineHorizontalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: TimelineHorizontalComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i1.TimelineService }, { token: i2.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
438
|
+
TimelineHorizontalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: TimelineHorizontalComponent, selector: "kendo-timeline-horizontal", inputs: { events: "events", alterMode: "alterMode", collapsibleEvents: "collapsibleEvents", navigable: "navigable", showDateLabels: "showDateLabels", animationDuration: "animationDuration", eventHeight: "eventHeight", dateFormat: "dateFormat", headerTemplate: "headerTemplate", bodyTemplate: "bodyTemplate", actionsTemplate: "actionsTemplate" }, providers: [], viewQueries: [{ propertyName: "trackElementRef", first: true, predicate: ["track"], descendants: true }, { propertyName: "scrollableTrackElementRef", first: true, predicate: ["scrollableTrack"], descendants: true }, { propertyName: "cardElementRefs", predicate: ["card"], descendants: true, read: ElementRef }, { propertyName: "circleElementRefs", predicate: ["trackCircle"], descendants: true }, { propertyName: "flagElementRefs", predicate: ["trackFlag"], descendants: true }, { propertyName: "cardComponents", predicate: TimelineCardComponent, descendants: true }], exportAs: ["kendoTimelineHorizontal"], usesOnChanges: true, ngImport: i0, template: `
|
|
439
|
+
<div class="k-timeline-track-wrap" #track>
|
|
440
|
+
<button
|
|
441
|
+
kendoButton
|
|
442
|
+
[svgIcon]="svgLeftIcon"
|
|
443
|
+
class="k-timeline-arrow k-timeline-arrow-left"
|
|
444
|
+
rounded="full"
|
|
445
|
+
[title]="previousTitle"
|
|
446
|
+
(click)="previousClick()"
|
|
447
|
+
[disabled]="isFirstRange"
|
|
448
|
+
[attr.aria-hidden]="true"
|
|
449
|
+
tabindex="-1"
|
|
450
|
+
type="button"
|
|
451
|
+
></button>
|
|
452
|
+
<button
|
|
453
|
+
kendoButton
|
|
454
|
+
[svgIcon]="svgRightIcon"
|
|
455
|
+
class="k-timeline-arrow k-timeline-arrow-right"
|
|
456
|
+
rounded="full"
|
|
457
|
+
[title]="nextTitle"
|
|
458
|
+
(click)="nextClick()"
|
|
459
|
+
[disabled]="isLastRange"
|
|
460
|
+
[attr.aria-hidden]="true"
|
|
461
|
+
tabindex="-1"
|
|
462
|
+
type="button"
|
|
463
|
+
></button>
|
|
464
|
+
<div class="k-timeline-track">
|
|
465
|
+
<ul class="k-timeline-scrollable-wrap"
|
|
466
|
+
#scrollableTrack
|
|
467
|
+
[attr.role]="'tablist'"
|
|
468
|
+
[attr.tabindex]="'0'"
|
|
469
|
+
[@trackSlide]="{value: animationState, params: {transformValue: this.translateValue}}"
|
|
470
|
+
(@trackSlide.done)="onSlideDone()"
|
|
471
|
+
(transitionend)="onTrackTransitionEnd()"
|
|
472
|
+
>
|
|
473
|
+
<ng-container *ngFor="let event of trackItems; let index = index">
|
|
474
|
+
<li
|
|
475
|
+
#trackFlag
|
|
476
|
+
*ngIf="event.isFlag"
|
|
477
|
+
class="k-timeline-flag-wrap k-timeline-track-item"
|
|
478
|
+
[attr.role]="'none'"
|
|
479
|
+
[attr.aria-hidden]="true"
|
|
480
|
+
[ngStyle]="tabStyle()"
|
|
481
|
+
>
|
|
482
|
+
<span class="k-timeline-flag">{{ event.isFlag }}</span>
|
|
483
|
+
</li>
|
|
484
|
+
<li
|
|
485
|
+
*ngIf="!event.isFlag"
|
|
486
|
+
#trackCircle
|
|
487
|
+
class="k-timeline-track-item"
|
|
488
|
+
[attr.role]="'tab'"
|
|
489
|
+
(click)="navigateToEvent(index)"
|
|
490
|
+
[ngStyle]="tabStyle()"
|
|
491
|
+
>
|
|
492
|
+
<div class="k-timeline-date-wrap">
|
|
493
|
+
<span *ngIf="showDateLabels" class="k-timeline-date">
|
|
494
|
+
{{ event.date | kendoDate: dateFormat }}
|
|
495
|
+
</span>
|
|
496
|
+
</div>
|
|
497
|
+
<span class="k-timeline-circle"></span>
|
|
498
|
+
</li>
|
|
499
|
+
</ng-container>
|
|
500
|
+
</ul>
|
|
501
|
+
</div>
|
|
502
|
+
</div>
|
|
503
|
+
<div class="k-timeline-events-list">
|
|
504
|
+
<ul
|
|
505
|
+
*ngIf="selectedEvent"
|
|
506
|
+
class="k-timeline-scrollable-wrap"
|
|
507
|
+
[@eventsSlide]="{value: animationState, params: {animationDuration: this.animationDuration || 0}}"
|
|
508
|
+
(@eventsSlide.done)="onSlideDone()"
|
|
509
|
+
[ngStyle]="{'transform-origin': 'left top'}"
|
|
510
|
+
>
|
|
511
|
+
<li *ngFor="let event of eventsInInterval; let index = index"
|
|
512
|
+
#card
|
|
513
|
+
class="k-timeline-event"
|
|
514
|
+
(transitionend)="onTransitionEnd()"
|
|
515
|
+
>
|
|
516
|
+
<kendo-timeline-card
|
|
517
|
+
[event]="selectedCardIndex === index ? selectedEvent : null"
|
|
518
|
+
[expanded]="true"
|
|
519
|
+
[collapsible]="collapsibleEvents"
|
|
520
|
+
[calloutStyle]="selectedCardIndex === index ? calloutStyle : {}"
|
|
521
|
+
[ngStyle]="{visibility: selectedCardIndex === index ? 'visible' : 'hidden' }"
|
|
522
|
+
[tabIndex]="selectedCardIndex === index ? '0' : '-1'"
|
|
523
|
+
[navigable]="navigable"
|
|
524
|
+
[index]="selectedEventIndex"
|
|
525
|
+
[headerTemplate]="headerTemplate"
|
|
526
|
+
[bodyTemplate]="bodyTemplate"
|
|
527
|
+
[actionsTemplate]="actionsTemplate"
|
|
528
|
+
[eventHeight]="eventHeight"
|
|
529
|
+
orientation="horizontal"
|
|
530
|
+
>
|
|
531
|
+
</kendo-timeline-card>
|
|
532
|
+
</li>
|
|
533
|
+
</ul>
|
|
534
|
+
</div>
|
|
535
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i4.ButtonComponent, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "component", type: i5.TimelineCardComponent, selector: "kendo-timeline-card", inputs: ["event", "expanded", "collapsible", "reversed", "orientation", "navigable", "tabIndex", "animationDuration", "index", "eventWidth", "eventHeight", "headerTemplate", "bodyTemplate", "actionsTemplate", "calloutStyle"], exportAs: ["kendoTimelineCard"] }, { kind: "pipe", type: i6.DatePipe, name: "kendoDate" }], animations: [
|
|
536
|
+
trigger('trackSlide', [
|
|
537
|
+
state('left', style({
|
|
538
|
+
transform: `translateX({{transformValue}}%)`,
|
|
539
|
+
}), { params: { transformValue: '0' } }),
|
|
540
|
+
state('right', style({
|
|
541
|
+
transform: `translateX({{transformValue}}%)`,
|
|
542
|
+
}), { params: { transformValue: '0' } }),
|
|
543
|
+
state('center', style({
|
|
544
|
+
transform: `translateX(0)`,
|
|
545
|
+
}))
|
|
546
|
+
]),
|
|
547
|
+
trigger('eventsSlide', [
|
|
548
|
+
transition('* => right', [
|
|
549
|
+
animate('{{animationDuration}}ms', style({ transform: `translateX(-100%)` }))
|
|
550
|
+
], { params: { animationDuration: '400' } }),
|
|
551
|
+
transition('* => left', [
|
|
552
|
+
animate('{{animationDuration}}ms', style({ transform: `translateX(100%)` }))
|
|
553
|
+
], { params: { animationDuration: '400' } })
|
|
554
|
+
])
|
|
555
|
+
] });
|
|
556
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: TimelineHorizontalComponent, decorators: [{
|
|
557
|
+
type: Component,
|
|
558
|
+
args: [{
|
|
559
|
+
animations: [
|
|
560
|
+
trigger('trackSlide', [
|
|
561
|
+
state('left', style({
|
|
562
|
+
transform: `translateX({{transformValue}}%)`,
|
|
563
|
+
}), { params: { transformValue: '0' } }),
|
|
564
|
+
state('right', style({
|
|
565
|
+
transform: `translateX({{transformValue}}%)`,
|
|
566
|
+
}), { params: { transformValue: '0' } }),
|
|
567
|
+
state('center', style({
|
|
568
|
+
transform: `translateX(0)`,
|
|
569
|
+
}))
|
|
570
|
+
]),
|
|
571
|
+
trigger('eventsSlide', [
|
|
572
|
+
transition('* => right', [
|
|
573
|
+
animate('{{animationDuration}}ms', style({ transform: `translateX(-100%)` }))
|
|
574
|
+
], { params: { animationDuration: '400' } }),
|
|
575
|
+
transition('* => left', [
|
|
576
|
+
animate('{{animationDuration}}ms', style({ transform: `translateX(100%)` }))
|
|
577
|
+
], { params: { animationDuration: '400' } })
|
|
578
|
+
])
|
|
579
|
+
],
|
|
580
|
+
providers: [],
|
|
581
|
+
exportAs: 'kendoTimelineHorizontal',
|
|
582
|
+
selector: 'kendo-timeline-horizontal',
|
|
583
|
+
template: `
|
|
584
|
+
<div class="k-timeline-track-wrap" #track>
|
|
585
|
+
<button
|
|
586
|
+
kendoButton
|
|
587
|
+
[svgIcon]="svgLeftIcon"
|
|
588
|
+
class="k-timeline-arrow k-timeline-arrow-left"
|
|
589
|
+
rounded="full"
|
|
590
|
+
[title]="previousTitle"
|
|
591
|
+
(click)="previousClick()"
|
|
592
|
+
[disabled]="isFirstRange"
|
|
593
|
+
[attr.aria-hidden]="true"
|
|
594
|
+
tabindex="-1"
|
|
595
|
+
type="button"
|
|
596
|
+
></button>
|
|
597
|
+
<button
|
|
598
|
+
kendoButton
|
|
599
|
+
[svgIcon]="svgRightIcon"
|
|
600
|
+
class="k-timeline-arrow k-timeline-arrow-right"
|
|
601
|
+
rounded="full"
|
|
602
|
+
[title]="nextTitle"
|
|
603
|
+
(click)="nextClick()"
|
|
604
|
+
[disabled]="isLastRange"
|
|
605
|
+
[attr.aria-hidden]="true"
|
|
606
|
+
tabindex="-1"
|
|
607
|
+
type="button"
|
|
608
|
+
></button>
|
|
609
|
+
<div class="k-timeline-track">
|
|
610
|
+
<ul class="k-timeline-scrollable-wrap"
|
|
611
|
+
#scrollableTrack
|
|
612
|
+
[attr.role]="'tablist'"
|
|
613
|
+
[attr.tabindex]="'0'"
|
|
614
|
+
[@trackSlide]="{value: animationState, params: {transformValue: this.translateValue}}"
|
|
615
|
+
(@trackSlide.done)="onSlideDone()"
|
|
616
|
+
(transitionend)="onTrackTransitionEnd()"
|
|
617
|
+
>
|
|
618
|
+
<ng-container *ngFor="let event of trackItems; let index = index">
|
|
619
|
+
<li
|
|
620
|
+
#trackFlag
|
|
621
|
+
*ngIf="event.isFlag"
|
|
622
|
+
class="k-timeline-flag-wrap k-timeline-track-item"
|
|
623
|
+
[attr.role]="'none'"
|
|
624
|
+
[attr.aria-hidden]="true"
|
|
625
|
+
[ngStyle]="tabStyle()"
|
|
626
|
+
>
|
|
627
|
+
<span class="k-timeline-flag">{{ event.isFlag }}</span>
|
|
628
|
+
</li>
|
|
629
|
+
<li
|
|
630
|
+
*ngIf="!event.isFlag"
|
|
631
|
+
#trackCircle
|
|
632
|
+
class="k-timeline-track-item"
|
|
633
|
+
[attr.role]="'tab'"
|
|
634
|
+
(click)="navigateToEvent(index)"
|
|
635
|
+
[ngStyle]="tabStyle()"
|
|
636
|
+
>
|
|
637
|
+
<div class="k-timeline-date-wrap">
|
|
638
|
+
<span *ngIf="showDateLabels" class="k-timeline-date">
|
|
639
|
+
{{ event.date | kendoDate: dateFormat }}
|
|
640
|
+
</span>
|
|
641
|
+
</div>
|
|
642
|
+
<span class="k-timeline-circle"></span>
|
|
643
|
+
</li>
|
|
644
|
+
</ng-container>
|
|
645
|
+
</ul>
|
|
646
|
+
</div>
|
|
647
|
+
</div>
|
|
648
|
+
<div class="k-timeline-events-list">
|
|
649
|
+
<ul
|
|
650
|
+
*ngIf="selectedEvent"
|
|
651
|
+
class="k-timeline-scrollable-wrap"
|
|
652
|
+
[@eventsSlide]="{value: animationState, params: {animationDuration: this.animationDuration || 0}}"
|
|
653
|
+
(@eventsSlide.done)="onSlideDone()"
|
|
654
|
+
[ngStyle]="{'transform-origin': 'left top'}"
|
|
655
|
+
>
|
|
656
|
+
<li *ngFor="let event of eventsInInterval; let index = index"
|
|
657
|
+
#card
|
|
658
|
+
class="k-timeline-event"
|
|
659
|
+
(transitionend)="onTransitionEnd()"
|
|
660
|
+
>
|
|
661
|
+
<kendo-timeline-card
|
|
662
|
+
[event]="selectedCardIndex === index ? selectedEvent : null"
|
|
663
|
+
[expanded]="true"
|
|
664
|
+
[collapsible]="collapsibleEvents"
|
|
665
|
+
[calloutStyle]="selectedCardIndex === index ? calloutStyle : {}"
|
|
666
|
+
[ngStyle]="{visibility: selectedCardIndex === index ? 'visible' : 'hidden' }"
|
|
667
|
+
[tabIndex]="selectedCardIndex === index ? '0' : '-1'"
|
|
668
|
+
[navigable]="navigable"
|
|
669
|
+
[index]="selectedEventIndex"
|
|
670
|
+
[headerTemplate]="headerTemplate"
|
|
671
|
+
[bodyTemplate]="bodyTemplate"
|
|
672
|
+
[actionsTemplate]="actionsTemplate"
|
|
673
|
+
[eventHeight]="eventHeight"
|
|
674
|
+
orientation="horizontal"
|
|
675
|
+
>
|
|
676
|
+
</kendo-timeline-card>
|
|
677
|
+
</li>
|
|
678
|
+
</ul>
|
|
679
|
+
</div>
|
|
680
|
+
`,
|
|
681
|
+
}]
|
|
682
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i1.TimelineService }, { type: i2.LocalizationService }]; }, propDecorators: { events: [{
|
|
683
|
+
type: Input
|
|
684
|
+
}], alterMode: [{
|
|
685
|
+
type: Input
|
|
686
|
+
}], collapsibleEvents: [{
|
|
687
|
+
type: Input
|
|
688
|
+
}], navigable: [{
|
|
689
|
+
type: Input
|
|
690
|
+
}], showDateLabels: [{
|
|
691
|
+
type: Input
|
|
692
|
+
}], animationDuration: [{
|
|
693
|
+
type: Input
|
|
694
|
+
}], eventHeight: [{
|
|
695
|
+
type: Input
|
|
696
|
+
}], dateFormat: [{
|
|
697
|
+
type: Input
|
|
698
|
+
}], headerTemplate: [{
|
|
699
|
+
type: Input
|
|
700
|
+
}], bodyTemplate: [{
|
|
701
|
+
type: Input
|
|
702
|
+
}], actionsTemplate: [{
|
|
703
|
+
type: Input
|
|
704
|
+
}], cardElementRefs: [{
|
|
705
|
+
type: ViewChildren,
|
|
706
|
+
args: ['card', { read: ElementRef }]
|
|
707
|
+
}], circleElementRefs: [{
|
|
708
|
+
type: ViewChildren,
|
|
709
|
+
args: ['trackCircle']
|
|
710
|
+
}], flagElementRefs: [{
|
|
711
|
+
type: ViewChildren,
|
|
712
|
+
args: ['trackFlag']
|
|
713
|
+
}], trackElementRef: [{
|
|
714
|
+
type: ViewChild,
|
|
715
|
+
args: ['track']
|
|
716
|
+
}], scrollableTrackElementRef: [{
|
|
717
|
+
type: ViewChild,
|
|
718
|
+
args: ['scrollableTrack']
|
|
719
|
+
}], cardComponents: [{
|
|
720
|
+
type: ViewChildren,
|
|
721
|
+
args: [TimelineCardComponent]
|
|
722
|
+
}] } });
|