@progress/kendo-angular-layout 16.0.0-develop.2 → 16.0.0-develop.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/avatar/avatar.component.d.ts +1 -1
  2. package/avatar/l10n/custom-messages.component.d.ts +1 -1
  3. package/avatar/l10n/localized-messages.directive.d.ts +1 -1
  4. package/avatar/l10n/messages.d.ts +1 -1
  5. package/card/card-actions.component.d.ts +1 -1
  6. package/card/card-body.component.d.ts +1 -1
  7. package/card/card-footer.component.d.ts +1 -1
  8. package/card/card-header.component.d.ts +1 -1
  9. package/card/card.component.d.ts +1 -1
  10. package/card/directives/card-media.directive.d.ts +1 -1
  11. package/card/directives/card-separator.directive.d.ts +1 -1
  12. package/card/directives/card-subtitle.directive.d.ts +1 -1
  13. package/card/directives/card-title.directive.d.ts +1 -1
  14. package/drawer/drawer-container.component.d.ts +1 -1
  15. package/drawer/drawer-content.component.d.ts +1 -1
  16. package/drawer/drawer.component.d.ts +1 -1
  17. package/drawer/item.component.d.ts +1 -1
  18. package/drawer/list.component.d.ts +1 -1
  19. package/drawer/template-directives/drawer-template.directive.d.ts +1 -1
  20. package/drawer/template-directives/footer-template.directive.d.ts +1 -1
  21. package/drawer/template-directives/header-template.directive.d.ts +1 -1
  22. package/drawer/template-directives/item-template.directive.d.ts +1 -1
  23. package/esm2020/avatar/avatar.component.mjs +7 -7
  24. package/esm2020/avatar/l10n/custom-messages.component.mjs +3 -3
  25. package/esm2020/avatar/l10n/localized-messages.directive.mjs +3 -3
  26. package/esm2020/avatar/l10n/messages.mjs +3 -3
  27. package/esm2020/avatar.module.mjs +4 -4
  28. package/esm2020/card/card-actions.component.mjs +4 -4
  29. package/esm2020/card/card-body.component.mjs +3 -3
  30. package/esm2020/card/card-footer.component.mjs +3 -3
  31. package/esm2020/card/card-header.component.mjs +3 -3
  32. package/esm2020/card/card.component.mjs +3 -3
  33. package/esm2020/card/directives/card-media.directive.mjs +3 -3
  34. package/esm2020/card/directives/card-separator.directive.mjs +3 -3
  35. package/esm2020/card/directives/card-subtitle.directive.mjs +3 -3
  36. package/esm2020/card/directives/card-title.directive.mjs +3 -3
  37. package/esm2020/card.module.mjs +4 -4
  38. package/esm2020/drawer/drawer-container.component.mjs +4 -4
  39. package/esm2020/drawer/drawer-content.component.mjs +3 -3
  40. package/esm2020/drawer/drawer.component.mjs +6 -6
  41. package/esm2020/drawer/drawer.service.mjs +3 -3
  42. package/esm2020/drawer/item.component.mjs +8 -6
  43. package/esm2020/drawer/list.component.mjs +5 -5
  44. package/esm2020/drawer/template-directives/drawer-template.directive.mjs +3 -3
  45. package/esm2020/drawer/template-directives/footer-template.directive.mjs +3 -3
  46. package/esm2020/drawer/template-directives/header-template.directive.mjs +3 -3
  47. package/esm2020/drawer/template-directives/item-template.directive.mjs +3 -3
  48. package/esm2020/drawer.module.mjs +4 -4
  49. package/esm2020/expansionpanel/expansionpanel-title.directive.mjs +3 -3
  50. package/esm2020/expansionpanel/expansionpanel.component.mjs +6 -6
  51. package/esm2020/expansionpanel.module.mjs +4 -4
  52. package/esm2020/gridlayout.module.mjs +4 -4
  53. package/esm2020/index.mjs +7 -0
  54. package/esm2020/layout.module.mjs +11 -7
  55. package/esm2020/layouts/grid-layout.component.mjs +3 -3
  56. package/esm2020/layouts/gridlayout-item.component.mjs +3 -3
  57. package/esm2020/layouts/stack-layout.component.mjs +3 -3
  58. package/esm2020/package-metadata.mjs +2 -2
  59. package/esm2020/panelbar/panelbar-content.directive.mjs +3 -3
  60. package/esm2020/panelbar/panelbar-item-template.directive.mjs +3 -3
  61. package/esm2020/panelbar/panelbar-item-title.directive.mjs +3 -3
  62. package/esm2020/panelbar/panelbar-item.component.mjs +14 -20
  63. package/esm2020/panelbar/panelbar.component.mjs +6 -9
  64. package/esm2020/panelbar/panelbar.service.mjs +3 -3
  65. package/esm2020/panelbar.module.mjs +4 -4
  66. package/esm2020/splitter/splitter-bar.component.mjs +6 -6
  67. package/esm2020/splitter/splitter-pane.component.mjs +4 -4
  68. package/esm2020/splitter/splitter.component.mjs +7 -7
  69. package/esm2020/splitter/splitter.service.mjs +3 -3
  70. package/esm2020/splitter.module.mjs +6 -8
  71. package/esm2020/stacklayout.module.mjs +4 -4
  72. package/esm2020/stepper/list.component.mjs +5 -5
  73. package/esm2020/stepper/localization/custom-messages.component.mjs +3 -3
  74. package/esm2020/stepper/localization/localized-messages.directive.mjs +3 -3
  75. package/esm2020/stepper/localization/messages.mjs +3 -3
  76. package/esm2020/stepper/step.component.mjs +6 -6
  77. package/esm2020/stepper/stepper.component.mjs +7 -7
  78. package/esm2020/stepper/stepper.service.mjs +3 -3
  79. package/esm2020/stepper/template-directives/indicator-template.directive.mjs +3 -3
  80. package/esm2020/stepper/template-directives/label-template.directive.mjs +3 -3
  81. package/esm2020/stepper/template-directives/step-template.directive.mjs +3 -3
  82. package/esm2020/stepper.module.mjs +4 -4
  83. package/esm2020/tabstrip/directives/tab-content.directive.mjs +3 -3
  84. package/esm2020/tabstrip/directives/tab-title.directive.mjs +3 -3
  85. package/esm2020/tabstrip/directives/tab.directive.mjs +3 -3
  86. package/esm2020/tabstrip/localization/custom-messages.component.mjs +3 -3
  87. package/esm2020/tabstrip/localization/localized-messages.directive.mjs +3 -3
  88. package/esm2020/tabstrip/localization/messages.mjs +3 -3
  89. package/esm2020/tabstrip/models/tabstrip-tab.component.mjs +3 -3
  90. package/esm2020/tabstrip/rendering/tab.component.mjs +6 -6
  91. package/esm2020/tabstrip/scrollable-button.component.mjs +4 -4
  92. package/esm2020/tabstrip/tabstrip-scroll.service.mjs +3 -3
  93. package/esm2020/tabstrip/tabstrip.component.mjs +8 -10
  94. package/esm2020/tabstrip/tabstrip.service.mjs +3 -3
  95. package/esm2020/tabstrip.module.mjs +4 -4
  96. package/esm2020/tilelayout/dragging-service.mjs +3 -3
  97. package/esm2020/tilelayout/keyboard-navigation.service.mjs +3 -5
  98. package/esm2020/tilelayout/tilelayout-item-body.component.mjs +3 -3
  99. package/esm2020/tilelayout/tilelayout-item-header.component.mjs +3 -3
  100. package/esm2020/tilelayout/tilelayout-item.component.mjs +6 -6
  101. package/esm2020/tilelayout/tilelayout-resize-handle.directive.mjs +3 -3
  102. package/esm2020/tilelayout/tilelayout.component.mjs +6 -6
  103. package/esm2020/tilelayout.module.mjs +4 -4
  104. package/esm2020/timeline/events/navigation-direction.mjs +5 -0
  105. package/esm2020/timeline/localization/custom-messages.component.mjs +41 -0
  106. package/esm2020/timeline/localization/localized-messages.directive.mjs +37 -0
  107. package/esm2020/timeline/localization/messages.mjs +25 -0
  108. package/esm2020/timeline/models/anchor-target.mjs +5 -0
  109. package/esm2020/timeline/models/default-model-fields.mjs +16 -0
  110. package/esm2020/timeline/models/model-fields.mjs +5 -0
  111. package/esm2020/timeline/models/timeline-event.mjs +5 -0
  112. package/esm2020/timeline/templates/timeline-card-actions.directive.mjs +29 -0
  113. package/esm2020/timeline/templates/timeline-card-body.directive.mjs +29 -0
  114. package/esm2020/timeline/templates/timeline-card-header.directive.mjs +29 -0
  115. package/esm2020/timeline/timeline-card.component.mjs +400 -0
  116. package/esm2020/timeline/timeline-horizontal.component.mjs +723 -0
  117. package/esm2020/timeline/timeline-vertical.component.mjs +175 -0
  118. package/esm2020/timeline/timeline.component.mjs +418 -0
  119. package/esm2020/timeline/timeline.service.mjs +31 -0
  120. package/esm2020/timeline/util.mjs +26 -0
  121. package/esm2020/timeline.module.mjs +65 -0
  122. package/expansionpanel/expansionpanel-title.directive.d.ts +1 -1
  123. package/expansionpanel/expansionpanel.component.d.ts +1 -1
  124. package/fesm2015/progress-kendo-angular-layout.mjs +2527 -608
  125. package/fesm2020/progress-kendo-angular-layout.mjs +2258 -366
  126. package/index.d.ts +10 -0
  127. package/layout.module.d.ts +2 -1
  128. package/layouts/grid-layout.component.d.ts +1 -1
  129. package/layouts/gridlayout-item.component.d.ts +1 -1
  130. package/layouts/stack-layout.component.d.ts +1 -1
  131. package/package.json +13 -13
  132. package/panelbar/panelbar-content.directive.d.ts +1 -1
  133. package/panelbar/panelbar-item-template.directive.d.ts +1 -1
  134. package/panelbar/panelbar-item-title.directive.d.ts +1 -1
  135. package/panelbar/panelbar-item.component.d.ts +1 -2
  136. package/panelbar/panelbar.component.d.ts +1 -1
  137. package/splitter/splitter-bar.component.d.ts +1 -1
  138. package/splitter/splitter-pane.component.d.ts +1 -1
  139. package/splitter/splitter.component.d.ts +1 -1
  140. package/stepper/list.component.d.ts +1 -1
  141. package/stepper/localization/custom-messages.component.d.ts +1 -1
  142. package/stepper/localization/localized-messages.directive.d.ts +1 -1
  143. package/stepper/localization/messages.d.ts +1 -1
  144. package/stepper/step.component.d.ts +1 -1
  145. package/stepper/stepper.component.d.ts +1 -1
  146. package/stepper/template-directives/indicator-template.directive.d.ts +1 -1
  147. package/stepper/template-directives/label-template.directive.d.ts +1 -1
  148. package/stepper/template-directives/step-template.directive.d.ts +1 -1
  149. package/tabstrip/directives/tab-content.directive.d.ts +1 -1
  150. package/tabstrip/directives/tab-title.directive.d.ts +1 -1
  151. package/tabstrip/directives/tab.directive.d.ts +1 -1
  152. package/tabstrip/localization/custom-messages.component.d.ts +1 -1
  153. package/tabstrip/localization/localized-messages.directive.d.ts +1 -1
  154. package/tabstrip/localization/messages.d.ts +1 -1
  155. package/tabstrip/models/tabstrip-tab.component.d.ts +1 -1
  156. package/tabstrip/rendering/tab.component.d.ts +1 -1
  157. package/tabstrip/scrollable-button.component.d.ts +1 -1
  158. package/tabstrip/tabstrip.component.d.ts +1 -1
  159. package/tilelayout/tilelayout-item-body.component.d.ts +1 -1
  160. package/tilelayout/tilelayout-item-header.component.d.ts +1 -1
  161. package/tilelayout/tilelayout-item.component.d.ts +1 -1
  162. package/tilelayout/tilelayout-resize-handle.directive.d.ts +1 -1
  163. package/tilelayout/tilelayout.component.d.ts +1 -1
  164. package/timeline/events/navigation-direction.d.ts +5 -0
  165. package/timeline/localization/custom-messages.component.d.ts +17 -0
  166. package/timeline/localization/localized-messages.directive.d.ts +16 -0
  167. package/timeline/localization/messages.d.ts +21 -0
  168. package/timeline/models/anchor-target.d.ts +5 -0
  169. package/{progress-kendo-angular-layout.d.ts → timeline/models/default-model-fields.d.ts} +3 -3
  170. package/timeline/models/model-fields.d.ts +51 -0
  171. package/timeline/models/timeline-event.d.ts +49 -0
  172. package/timeline/templates/timeline-card-actions.directive.d.ts +20 -0
  173. package/timeline/templates/timeline-card-body.directive.d.ts +20 -0
  174. package/timeline/templates/timeline-card-header.directive.d.ts +20 -0
  175. package/timeline/timeline-card.component.d.ts +59 -0
  176. package/timeline/timeline-horizontal.component.d.ts +110 -0
  177. package/timeline/timeline-vertical.component.d.ts +41 -0
  178. package/timeline/timeline.component.d.ts +185 -0
  179. package/timeline/timeline.service.d.ts +17 -0
  180. package/timeline/util.d.ts +18 -0
  181. package/timeline.module.d.ts +31 -0
@@ -0,0 +1,723 @@
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
+ event.preventDefault();
277
+ if (event.keyCode === Keys.Home) {
278
+ this.onHomeKey();
279
+ }
280
+ else if (event.keyCode === Keys.End) {
281
+ this.onEndKey();
282
+ }
283
+ else if (event.keyCode === Keys.ArrowRight) {
284
+ this.onArrowRightKey();
285
+ }
286
+ else if (event.keyCode === Keys.ArrowLeft) {
287
+ this.onArrowLeftKey();
288
+ }
289
+ }
290
+ focusTrackItem(index) {
291
+ if (!this.circleElementRefs || index < 0 || index >= this.circleElementRefs.length) {
292
+ return;
293
+ }
294
+ const selectedTrackItem = this.circleElementRefs
295
+ .find(element => element.nativeElement.hasAttribute('aria-selected'));
296
+ if (selectedTrackItem) {
297
+ this.removeTrackItemAttributes(selectedTrackItem);
298
+ this.removeCardsAttributes();
299
+ }
300
+ const newTrackItem = this.circleElementRefs.get(index).nativeElement;
301
+ this.setTrackItemAttributes(newTrackItem, index);
302
+ }
303
+ setTrackItemAttributes(element, index) {
304
+ const innerCard = this.cardComponents.get(this.selectedCardIndex).element.nativeElement.querySelector('.k-card');
305
+ const selectedCircle = this.circleElementRefs.get(index).nativeElement;
306
+ this.renderer.addClass(element, 'k-focus');
307
+ this.renderer.setAttribute(element, 'aria-selected', 'true');
308
+ this.assignAriaLabel(innerCard, selectedCircle);
309
+ this.assignAriaDescribedBy(innerCard, selectedCircle);
310
+ }
311
+ removeTrackItemAttributes(element) {
312
+ this.renderer.removeClass(element.nativeElement, 'k-focus');
313
+ this.renderer.removeAttribute(element.nativeElement, 'aria-selected');
314
+ this.renderer.removeAttribute(element.nativeElement, 'id');
315
+ this.renderer.removeAttribute(element.nativeElement, 'aria-describedby');
316
+ }
317
+ removeCardsAttributes() {
318
+ this.cardElementRefs.forEach(card => {
319
+ this.renderer.removeAttribute(card.nativeElement.querySelector('.k-card'), 'id');
320
+ this.renderer.removeAttribute(card.nativeElement.querySelector('.k-card'), 'aria-label');
321
+ });
322
+ }
323
+ assignAriaLabel(cardElement, dateElement) {
324
+ const dateLabelId = `k-${guid()}`;
325
+ this.renderer.setAttribute(dateElement, 'id', dateLabelId);
326
+ this.renderer.setAttribute(cardElement, 'aria-label', dateLabelId);
327
+ }
328
+ assignAriaDescribedBy(cardElement, dateElement) {
329
+ const cardId = `k-${guid()}`;
330
+ this.renderer.setAttribute(cardElement, 'id', cardId);
331
+ this.renderer.setAttribute(dateElement, 'aria-describedby', cardId);
332
+ }
333
+ updateInterval(forward) {
334
+ let start = forward ? this.firstCircleInView + this.visibleTabsCount : this.firstCircleInView - this.visibleTabsCount;
335
+ if (start < 0 || start >= this.trackItems.length) {
336
+ start = 0;
337
+ }
338
+ this.navigateToInterval(start, 0, forward, !forward);
339
+ }
340
+ onHomeKey() {
341
+ this.navigateToFirstInterval();
342
+ }
343
+ onEndKey() {
344
+ this.navigateToLastInterval();
345
+ }
346
+ onArrowRightKey() {
347
+ this.navigateToOtherEvent(true);
348
+ }
349
+ onArrowLeftKey() {
350
+ this.navigateToOtherEvent(false);
351
+ }
352
+ navigateToFirstInterval() {
353
+ this.navigateToInterval(0);
354
+ }
355
+ navigateToLastInterval() {
356
+ const start = Math.floor(this.trackItems.length / this.visibleTabsCount) * this.visibleTabsCount;
357
+ this.navigateToInterval(start, this.events.length - 1);
358
+ }
359
+ navigateToOtherEvent(direction) {
360
+ const offset = direction ? 1 : -1;
361
+ const newIndex = this.selectedEventIndex + offset;
362
+ if (newIndex < 0 || newIndex >= this.events.length) {
363
+ return;
364
+ }
365
+ if (this.visibleEvents.findIndex(event => event === this.events[newIndex]) === -1) {
366
+ this.updateInterval(direction);
367
+ }
368
+ else {
369
+ this.selectedEvent = this.events[newIndex];
370
+ this.selectedCardIndex = this.getOtherSelectedCardIndex(direction);
371
+ this.focusTrackItem(this.selectedEventIndex);
372
+ this.animateCards();
373
+ this.cdr.markForCheck();
374
+ }
375
+ }
376
+ navigateToInterval(start, selectedIndex = 0, selectFirst = false, selectLast = false) {
377
+ const end = start + this.visibleTabsCount < this.trackItems.length ? start + this.visibleTabsCount : undefined;
378
+ const forward = this.firstCircleInView < start;
379
+ this.firstCircleInView = start;
380
+ const interval = Math.floor(start / this.visibleTabsCount);
381
+ this.translateValue = interval * -100;
382
+ this.animationState = forward ? 'right' : 'left';
383
+ this.visibleEvents = this.trackItems.slice(this.firstCircleInView, end).filter(event => !event.isFlag);
384
+ if (selectFirst) {
385
+ this.selectedEvent = this.visibleEvents[0];
386
+ }
387
+ else if (selectLast) {
388
+ this.selectedEvent = this.visibleEvents[this.visibleEvents.length - 1];
389
+ }
390
+ else {
391
+ this.selectedEvent = this.events[selectedIndex];
392
+ }
393
+ this.selectedCardIndex = this.getOtherSelectedCardIndex(forward);
394
+ this.cdr.detectChanges();
395
+ this.focusTrackItem(this.selectedEventIndex);
396
+ this.animateCards();
397
+ this.calloutStyle = this.calloutOffset;
398
+ this.cdr.markForCheck();
399
+ }
400
+ animateCards() {
401
+ if (this.animationDuration) {
402
+ this.cardComponents.get(this.selectedCardIndex).event = null;
403
+ }
404
+ this.cardElementRefs.forEach((card, index) => {
405
+ this.renderer.setStyle(card.nativeElement, 'transform', this.getTransformation(this.cardWidth, index));
406
+ this.renderer.setStyle(card.nativeElement, 'transition-duration', `${this.animationDuration || 0}ms`);
407
+ });
408
+ }
409
+ transformCards() {
410
+ this.cardElementRefs.forEach((card, index) => this.renderer.setStyle(card.nativeElement, 'transform', this.getTransformation(this.cardWidth, index)));
411
+ }
412
+ changeTabsCount() {
413
+ this.visibleTabsCount = Math.round(this.scrollableTrackWidth / this.tabWidth);
414
+ if (this.tabFlex !== 100 / this.visibleTabsCount) {
415
+ this.tabFlex = 100 / this.visibleTabsCount;
416
+ this.circleElementRefs.forEach(item => this.renderer.setStyle(item.nativeElement, 'flex', `1 0 ${this.tabFlex}%`));
417
+ this.flagElementRefs.forEach(item => this.renderer.setStyle(item.nativeElement, 'flex', `1 0 ${this.tabFlex}%`));
418
+ this.cdr.detectChanges();
419
+ this.visibleEvents = this.trackItems
420
+ .slice(this.firstCircleInView, this.firstCircleInView + this.visibleTabsCount)
421
+ .filter(event => !event.isFlag);
422
+ if (!this.visibleEvents.find(event => event === this.selectedEvent)) {
423
+ const trackItemIndex = this.trackItems.findIndex(event => event === this.selectedEvent);
424
+ this.navigateToInterval(trackItemIndex, this.selectedEventIndex);
425
+ }
426
+ }
427
+ }
428
+ l10nChange() {
429
+ if (this.localization.get('previous')) {
430
+ this.previousTitle = this.localization.get('previous');
431
+ }
432
+ if (this.localization.get('next')) {
433
+ this.nextTitle = this.localization.get('next');
434
+ }
435
+ this.cdr.markForCheck();
436
+ }
437
+ }
438
+ TimelineHorizontalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TimelineHorizontalComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i1.TimelineService }, { token: i2.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
439
+ TimelineHorizontalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", 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: `
440
+ <div class="k-timeline-track-wrap" #track>
441
+ <button
442
+ kendoButton
443
+ [svgIcon]="svgLeftIcon"
444
+ class="k-timeline-arrow k-timeline-arrow-left"
445
+ rounded="full"
446
+ [title]="previousTitle"
447
+ (click)="previousClick()"
448
+ [disabled]="isFirstRange"
449
+ [attr.aria-hidden]="true"
450
+ tabindex="-1"
451
+ type="button"
452
+ ></button>
453
+ <button
454
+ kendoButton
455
+ [svgIcon]="svgRightIcon"
456
+ class="k-timeline-arrow k-timeline-arrow-right"
457
+ rounded="full"
458
+ [title]="nextTitle"
459
+ (click)="nextClick()"
460
+ [disabled]="isLastRange"
461
+ [attr.aria-hidden]="true"
462
+ tabindex="-1"
463
+ type="button"
464
+ ></button>
465
+ <div class="k-timeline-track">
466
+ <ul class="k-timeline-scrollable-wrap"
467
+ #scrollableTrack
468
+ [attr.role]="'tablist'"
469
+ [attr.tabindex]="'0'"
470
+ [@trackSlide]="{value: animationState, params: {transformValue: this.translateValue}}"
471
+ (@trackSlide.done)="onSlideDone()"
472
+ (transitionend)="onTrackTransitionEnd()"
473
+ >
474
+ <ng-container *ngFor="let event of trackItems; let index = index">
475
+ <li
476
+ #trackFlag
477
+ *ngIf="event.isFlag"
478
+ class="k-timeline-flag-wrap k-timeline-track-item"
479
+ [attr.role]="'none'"
480
+ [attr.aria-hidden]="true"
481
+ [ngStyle]="tabStyle()"
482
+ >
483
+ <span class="k-timeline-flag">{{ event.isFlag }}</span>
484
+ </li>
485
+ <li
486
+ *ngIf="!event.isFlag"
487
+ #trackCircle
488
+ class="k-timeline-track-item"
489
+ [attr.role]="'tab'"
490
+ (click)="navigateToEvent(index)"
491
+ [ngStyle]="tabStyle()"
492
+ >
493
+ <div class="k-timeline-date-wrap">
494
+ <span *ngIf="showDateLabels" class="k-timeline-date">
495
+ {{ event.date | kendoDate: dateFormat }}
496
+ </span>
497
+ </div>
498
+ <span class="k-timeline-circle"></span>
499
+ </li>
500
+ </ng-container>
501
+ </ul>
502
+ </div>
503
+ </div>
504
+ <div class="k-timeline-events-list">
505
+ <ul
506
+ *ngIf="selectedEvent"
507
+ class="k-timeline-scrollable-wrap"
508
+ [@eventsSlide]="{value: animationState, params: {animationDuration: this.animationDuration || 0}}"
509
+ (@eventsSlide.done)="onSlideDone()"
510
+ [ngStyle]="{'transform-origin': 'left top'}"
511
+ >
512
+ <li *ngFor="let event of eventsInInterval; let index = index"
513
+ #card
514
+ class="k-timeline-event"
515
+ (transitionend)="onTransitionEnd()"
516
+ >
517
+ <kendo-timeline-card
518
+ [event]="selectedCardIndex === index ? selectedEvent : null"
519
+ [expanded]="true"
520
+ [collapsible]="collapsibleEvents"
521
+ [calloutStyle]="selectedCardIndex === index ? calloutStyle : {}"
522
+ [ngStyle]="{visibility: selectedCardIndex === index ? 'visible' : 'hidden' }"
523
+ [tabIndex]="selectedCardIndex === index ? '0' : '-1'"
524
+ [navigable]="navigable"
525
+ [index]="selectedEventIndex"
526
+ [headerTemplate]="headerTemplate"
527
+ [bodyTemplate]="bodyTemplate"
528
+ [actionsTemplate]="actionsTemplate"
529
+ [eventHeight]="eventHeight"
530
+ orientation="horizontal"
531
+ >
532
+ </kendo-timeline-card>
533
+ </li>
534
+ </ul>
535
+ </div>
536
+ `, 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: [
537
+ trigger('trackSlide', [
538
+ state('left', style({
539
+ transform: `translateX({{transformValue}}%)`,
540
+ }), { params: { transformValue: '0' } }),
541
+ state('right', style({
542
+ transform: `translateX({{transformValue}}%)`,
543
+ }), { params: { transformValue: '0' } }),
544
+ state('center', style({
545
+ transform: `translateX(0)`,
546
+ }))
547
+ ]),
548
+ trigger('eventsSlide', [
549
+ transition('* => right', [
550
+ animate('{{animationDuration}}ms', style({ transform: `translateX(-100%)` }))
551
+ ], { params: { animationDuration: '400' } }),
552
+ transition('* => left', [
553
+ animate('{{animationDuration}}ms', style({ transform: `translateX(100%)` }))
554
+ ], { params: { animationDuration: '400' } })
555
+ ])
556
+ ] });
557
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TimelineHorizontalComponent, decorators: [{
558
+ type: Component,
559
+ args: [{
560
+ animations: [
561
+ trigger('trackSlide', [
562
+ state('left', style({
563
+ transform: `translateX({{transformValue}}%)`,
564
+ }), { params: { transformValue: '0' } }),
565
+ state('right', style({
566
+ transform: `translateX({{transformValue}}%)`,
567
+ }), { params: { transformValue: '0' } }),
568
+ state('center', style({
569
+ transform: `translateX(0)`,
570
+ }))
571
+ ]),
572
+ trigger('eventsSlide', [
573
+ transition('* => right', [
574
+ animate('{{animationDuration}}ms', style({ transform: `translateX(-100%)` }))
575
+ ], { params: { animationDuration: '400' } }),
576
+ transition('* => left', [
577
+ animate('{{animationDuration}}ms', style({ transform: `translateX(100%)` }))
578
+ ], { params: { animationDuration: '400' } })
579
+ ])
580
+ ],
581
+ providers: [],
582
+ exportAs: 'kendoTimelineHorizontal',
583
+ selector: 'kendo-timeline-horizontal',
584
+ template: `
585
+ <div class="k-timeline-track-wrap" #track>
586
+ <button
587
+ kendoButton
588
+ [svgIcon]="svgLeftIcon"
589
+ class="k-timeline-arrow k-timeline-arrow-left"
590
+ rounded="full"
591
+ [title]="previousTitle"
592
+ (click)="previousClick()"
593
+ [disabled]="isFirstRange"
594
+ [attr.aria-hidden]="true"
595
+ tabindex="-1"
596
+ type="button"
597
+ ></button>
598
+ <button
599
+ kendoButton
600
+ [svgIcon]="svgRightIcon"
601
+ class="k-timeline-arrow k-timeline-arrow-right"
602
+ rounded="full"
603
+ [title]="nextTitle"
604
+ (click)="nextClick()"
605
+ [disabled]="isLastRange"
606
+ [attr.aria-hidden]="true"
607
+ tabindex="-1"
608
+ type="button"
609
+ ></button>
610
+ <div class="k-timeline-track">
611
+ <ul class="k-timeline-scrollable-wrap"
612
+ #scrollableTrack
613
+ [attr.role]="'tablist'"
614
+ [attr.tabindex]="'0'"
615
+ [@trackSlide]="{value: animationState, params: {transformValue: this.translateValue}}"
616
+ (@trackSlide.done)="onSlideDone()"
617
+ (transitionend)="onTrackTransitionEnd()"
618
+ >
619
+ <ng-container *ngFor="let event of trackItems; let index = index">
620
+ <li
621
+ #trackFlag
622
+ *ngIf="event.isFlag"
623
+ class="k-timeline-flag-wrap k-timeline-track-item"
624
+ [attr.role]="'none'"
625
+ [attr.aria-hidden]="true"
626
+ [ngStyle]="tabStyle()"
627
+ >
628
+ <span class="k-timeline-flag">{{ event.isFlag }}</span>
629
+ </li>
630
+ <li
631
+ *ngIf="!event.isFlag"
632
+ #trackCircle
633
+ class="k-timeline-track-item"
634
+ [attr.role]="'tab'"
635
+ (click)="navigateToEvent(index)"
636
+ [ngStyle]="tabStyle()"
637
+ >
638
+ <div class="k-timeline-date-wrap">
639
+ <span *ngIf="showDateLabels" class="k-timeline-date">
640
+ {{ event.date | kendoDate: dateFormat }}
641
+ </span>
642
+ </div>
643
+ <span class="k-timeline-circle"></span>
644
+ </li>
645
+ </ng-container>
646
+ </ul>
647
+ </div>
648
+ </div>
649
+ <div class="k-timeline-events-list">
650
+ <ul
651
+ *ngIf="selectedEvent"
652
+ class="k-timeline-scrollable-wrap"
653
+ [@eventsSlide]="{value: animationState, params: {animationDuration: this.animationDuration || 0}}"
654
+ (@eventsSlide.done)="onSlideDone()"
655
+ [ngStyle]="{'transform-origin': 'left top'}"
656
+ >
657
+ <li *ngFor="let event of eventsInInterval; let index = index"
658
+ #card
659
+ class="k-timeline-event"
660
+ (transitionend)="onTransitionEnd()"
661
+ >
662
+ <kendo-timeline-card
663
+ [event]="selectedCardIndex === index ? selectedEvent : null"
664
+ [expanded]="true"
665
+ [collapsible]="collapsibleEvents"
666
+ [calloutStyle]="selectedCardIndex === index ? calloutStyle : {}"
667
+ [ngStyle]="{visibility: selectedCardIndex === index ? 'visible' : 'hidden' }"
668
+ [tabIndex]="selectedCardIndex === index ? '0' : '-1'"
669
+ [navigable]="navigable"
670
+ [index]="selectedEventIndex"
671
+ [headerTemplate]="headerTemplate"
672
+ [bodyTemplate]="bodyTemplate"
673
+ [actionsTemplate]="actionsTemplate"
674
+ [eventHeight]="eventHeight"
675
+ orientation="horizontal"
676
+ >
677
+ </kendo-timeline-card>
678
+ </li>
679
+ </ul>
680
+ </div>
681
+ `,
682
+ }]
683
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i1.TimelineService }, { type: i2.LocalizationService }]; }, propDecorators: { events: [{
684
+ type: Input
685
+ }], alterMode: [{
686
+ type: Input
687
+ }], collapsibleEvents: [{
688
+ type: Input
689
+ }], navigable: [{
690
+ type: Input
691
+ }], showDateLabels: [{
692
+ type: Input
693
+ }], animationDuration: [{
694
+ type: Input
695
+ }], eventHeight: [{
696
+ type: Input
697
+ }], dateFormat: [{
698
+ type: Input
699
+ }], headerTemplate: [{
700
+ type: Input
701
+ }], bodyTemplate: [{
702
+ type: Input
703
+ }], actionsTemplate: [{
704
+ type: Input
705
+ }], cardElementRefs: [{
706
+ type: ViewChildren,
707
+ args: ['card', { read: ElementRef }]
708
+ }], circleElementRefs: [{
709
+ type: ViewChildren,
710
+ args: ['trackCircle']
711
+ }], flagElementRefs: [{
712
+ type: ViewChildren,
713
+ args: ['trackFlag']
714
+ }], trackElementRef: [{
715
+ type: ViewChild,
716
+ args: ['track']
717
+ }], scrollableTrackElementRef: [{
718
+ type: ViewChild,
719
+ args: ['scrollableTrack']
720
+ }], cardComponents: [{
721
+ type: ViewChildren,
722
+ args: [TimelineCardComponent]
723
+ }] } });