@frxjs/ngx-timeline 1.0.3 → 1.0.7
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 +136 -127
- package/bundles/frxjs-ngx-timeline.umd.js +696 -0
- package/bundles/frxjs-ngx-timeline.umd.js.map +1 -0
- package/bundles/frxjs-ngx-timeline.umd.min.js +2 -0
- package/bundles/frxjs-ngx-timeline.umd.min.js.map +1 -0
- package/esm2015/frxjs-ngx-timeline.js +8 -0
- package/esm2015/lib/components/index.js +3 -0
- package/esm2015/lib/components/ngx-timeline-event/ngx-timeline-event.component.js +55 -0
- package/esm2015/lib/components/ngx-timeline.component.js +147 -0
- package/esm2015/lib/models/NgxConfigObj.js +93 -0
- package/esm2015/lib/models/NgxTimelineEvent.js +6 -0
- package/esm2015/lib/models/index.js +3 -0
- package/esm2015/lib/ngx-timeline.module.js +23 -0
- package/esm2015/lib/pipes/index.js +2 -0
- package/esm2015/lib/pipes/ngx-date-pipe.js +28 -0
- package/esm2015/public-api.js +8 -0
- package/fesm2015/frxjs-ngx-timeline.js +350 -0
- package/fesm2015/frxjs-ngx-timeline.js.map +1 -0
- package/frxjs-ngx-timeline.d.ts +7 -0
- package/frxjs-ngx-timeline.metadata.json +1 -0
- package/{projects/ngx-timeline/src/lib/components/index.ts → lib/components/index.d.ts} +2 -2
- package/lib/components/ngx-timeline-event/ngx-timeline-event.component.d.ts +35 -0
- package/lib/components/ngx-timeline.component.d.ts +76 -0
- package/lib/models/NgxConfigObj.d.ts +59 -0
- package/lib/models/NgxTimelineEvent.d.ts +29 -0
- package/{projects/ngx-timeline/src/lib/models/index.ts → lib/models/index.d.ts} +2 -2
- package/lib/ngx-timeline.module.d.ts +2 -0
- package/{projects/ngx-timeline/src/lib/pipes/index.ts → lib/pipes/index.d.ts} +1 -1
- package/lib/pipes/ngx-date-pipe.d.ts +7 -0
- package/package.json +21 -50
- package/{projects/ngx-timeline/src/public-api.ts → public-api.d.ts} +4 -7
- package/.editorconfig +0 -16
- package/.github/workflows/main.yml +0 -25
- package/angular.json +0 -169
- package/docs/3rdpartylicenses.txt +0 -268
- package/docs/assets/inter.png +0 -0
- package/docs/favicon.ico +0 -0
- package/docs/index.html +0 -13
- package/docs/main.6005a10000c87d7095d3.js +0 -1
- package/docs/polyfills.f8ddde825b13760c1743.js +0 -1
- package/docs/runtime.0e49e2b53282f40c8925.js +0 -1
- package/docs/styles.09e2c710755c8867a460.css +0 -0
- package/package-lock.json +0 -14400
- package/projects/demo-app/.browserslistrc +0 -17
- package/projects/demo-app/e2e/protractor.conf.js +0 -37
- package/projects/demo-app/e2e/src/app.e2e-spec.ts +0 -23
- package/projects/demo-app/e2e/src/app.po.ts +0 -11
- package/projects/demo-app/e2e/tsconfig.json +0 -13
- package/projects/demo-app/karma.conf.js +0 -44
- package/projects/demo-app/src/app/app.component.html +0 -90
- package/projects/demo-app/src/app/app.component.scss +0 -417
- package/projects/demo-app/src/app/app.component.ts +0 -147
- package/projects/demo-app/src/app/app.module.ts +0 -20
- package/projects/demo-app/src/assets/.gitkeep +0 -0
- package/projects/demo-app/src/assets/inter.png +0 -0
- package/projects/demo-app/src/environments/environment.prod.ts +0 -3
- package/projects/demo-app/src/environments/environment.ts +0 -16
- package/projects/demo-app/src/favicon.ico +0 -0
- package/projects/demo-app/src/index.html +0 -13
- package/projects/demo-app/src/main.ts +0 -12
- package/projects/demo-app/src/polyfills.ts +0 -63
- package/projects/demo-app/src/styles.scss +0 -1
- package/projects/demo-app/src/test.ts +0 -25
- package/projects/demo-app/tsconfig.app.json +0 -26
- package/projects/demo-app/tsconfig.spec.json +0 -18
- package/projects/demo-app/tslint.json +0 -17
- package/projects/ngx-timeline/README.md +0 -127
- package/projects/ngx-timeline/karma.conf.js +0 -44
- package/projects/ngx-timeline/ng-package.json +0 -7
- package/projects/ngx-timeline/package.json +0 -17
- package/projects/ngx-timeline/src/lib/components/ngx-timeline-event/ngx-timeline-event.component.html +0 -37
- package/projects/ngx-timeline/src/lib/components/ngx-timeline-event/ngx-timeline-event.component.scss +0 -197
- package/projects/ngx-timeline/src/lib/components/ngx-timeline-event/ngx-timeline-event.component.spec.ts +0 -89
- package/projects/ngx-timeline/src/lib/components/ngx-timeline-event/ngx-timeline-event.component.ts +0 -66
- package/projects/ngx-timeline/src/lib/components/ngx-timeline.component.html +0 -98
- package/projects/ngx-timeline/src/lib/components/ngx-timeline.component.spec.ts +0 -160
- package/projects/ngx-timeline/src/lib/components/ngx-timeline.component.ts +0 -187
- package/projects/ngx-timeline/src/lib/components/ngx-timeline.scss +0 -226
- package/projects/ngx-timeline/src/lib/models/NgxConfigObj.ts +0 -110
- package/projects/ngx-timeline/src/lib/models/NgxTimelineEvent.ts +0 -32
- package/projects/ngx-timeline/src/lib/ngx-timeline.module.ts +0 -21
- package/projects/ngx-timeline/src/lib/pipes/ngx-date-pipe.ts +0 -29
- package/projects/ngx-timeline/src/test.ts +0 -26
- package/projects/ngx-timeline/tsconfig.lib.json +0 -25
- package/projects/ngx-timeline/tsconfig.lib.prod.json +0 -10
- package/projects/ngx-timeline/tsconfig.spec.json +0 -17
- package/projects/ngx-timeline/tslint.json +0 -17
- package/tsconfig.json +0 -35
- package/tslint.json +0 -140
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import { Component, OnInit, Input, TemplateRef, OnChanges, SimpleChanges, Output } from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
NgxTimelineEvent,
|
|
4
|
-
NgxTimelineItem,
|
|
5
|
-
NgxTimelineItemPosition,
|
|
6
|
-
NgxTimelinePeriodInfo,
|
|
7
|
-
NgxDateFormat,
|
|
8
|
-
NgxTimelineEventGroup,
|
|
9
|
-
NgxTimelineEventChangeSideInGroup,
|
|
10
|
-
periodKeyDateFormat,
|
|
11
|
-
fieldsToCheckEventChangeSideInGroup,
|
|
12
|
-
fieldsToAddEventGroup } from '../models';
|
|
13
|
-
import { BehaviorSubject } from 'rxjs';
|
|
14
|
-
|
|
15
|
-
@Component({
|
|
16
|
-
selector: 'ngx-timeline',
|
|
17
|
-
templateUrl: './ngx-timeline.component.html',
|
|
18
|
-
styleUrls: ['./ngx-timeline.scss'],
|
|
19
|
-
})
|
|
20
|
-
export class NgxTimelineComponent implements OnInit, OnChanges {
|
|
21
|
-
/**
|
|
22
|
-
* List of events to be displayed
|
|
23
|
-
*/
|
|
24
|
-
@Input() events: NgxTimelineEvent[];
|
|
25
|
-
/**
|
|
26
|
-
* Language code used to show the date formatted
|
|
27
|
-
*/
|
|
28
|
-
@Input() langCode?: string;
|
|
29
|
-
/**
|
|
30
|
-
* Boolean used to enable or disable the animations
|
|
31
|
-
*/
|
|
32
|
-
@Input() enableAnimation = true;
|
|
33
|
-
/**
|
|
34
|
-
* Logic to be applied in order to group events
|
|
35
|
-
*/
|
|
36
|
-
@Input() groupEvent?: NgxTimelineEventGroup = NgxTimelineEventGroup.MONTH_YEAR;
|
|
37
|
-
/**
|
|
38
|
-
* Logic to be applied in order to put evetns on LEFT or RIGHT
|
|
39
|
-
*/
|
|
40
|
-
@Input() changeSideInGroup?: NgxTimelineEventChangeSideInGroup = NgxTimelineEventChangeSideInGroup.ON_DIFFERENT_DAY;
|
|
41
|
-
/**
|
|
42
|
-
* Custom Template displayed before a group of events
|
|
43
|
-
*/
|
|
44
|
-
@Input() periodCustomTemplate: TemplateRef<any>;
|
|
45
|
-
/**
|
|
46
|
-
* Custom Template displayed to show a single event
|
|
47
|
-
*/
|
|
48
|
-
@Input() eventCustomTemplate: TemplateRef<any>;
|
|
49
|
-
/**
|
|
50
|
-
* Custom Template displayed to show an separator icon
|
|
51
|
-
*/
|
|
52
|
-
@Input() centerIconCustomTemplate: TemplateRef<any>;
|
|
53
|
-
/**
|
|
54
|
-
* Custom Template displayed to show the side date
|
|
55
|
-
*/
|
|
56
|
-
@Input() dateInstantCustomTemplate: TemplateRef<any>;
|
|
57
|
-
/**
|
|
58
|
-
* Custom Template displayed to show the inner event
|
|
59
|
-
*/
|
|
60
|
-
@Input() innerEventCustomTemplate: TemplateRef<any>;
|
|
61
|
-
/**
|
|
62
|
-
* Output click event emitter
|
|
63
|
-
*/
|
|
64
|
-
@Output()
|
|
65
|
-
clickEmitter: BehaviorSubject<NgxTimelineItem> = new BehaviorSubject(null);
|
|
66
|
-
|
|
67
|
-
groups: { [key: string]: NgxTimelineEvent[] } = {};
|
|
68
|
-
periods: NgxTimelineItem[] = [];
|
|
69
|
-
items: NgxTimelineItem[] = [];
|
|
70
|
-
ngxTimelineItemPosition = NgxTimelineItemPosition;
|
|
71
|
-
ngxDateFormat = NgxDateFormat;
|
|
72
|
-
|
|
73
|
-
private readonly separator = '/';
|
|
74
|
-
|
|
75
|
-
constructor() {}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
ngOnInit(): void {
|
|
79
|
-
this.groupEvents(this.events);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
ngOnChanges(changes: SimpleChanges): void {
|
|
83
|
-
this.groupEvents(this.events);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
getPeriodKeyDateFormat(): string {
|
|
87
|
-
return periodKeyDateFormat[this.groupEvent];
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
protected clear(): void {
|
|
91
|
-
this.groups = {};
|
|
92
|
-
this.periods = [];
|
|
93
|
-
this.items = [];
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
protected groupEvents(events: NgxTimelineEvent[]): void {
|
|
97
|
-
if (events) {
|
|
98
|
-
this.clear();
|
|
99
|
-
this.sortEvents(events);
|
|
100
|
-
this.setGroups(events);
|
|
101
|
-
this.setPeriods();
|
|
102
|
-
this.setItems();
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
protected sortEvents(events: NgxTimelineEvent[]): void {
|
|
107
|
-
events.sort((a, b) => a.timestamp.getTime() - b.timestamp.getTime());
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
protected setGroups(events: NgxTimelineEvent[]): void {
|
|
111
|
-
events.forEach((event) => {
|
|
112
|
-
// conversion from string to actual Date
|
|
113
|
-
event.timestamp = new Date(event.timestamp);
|
|
114
|
-
const periodKey = this.getPeriodKeyFromEvent(event);
|
|
115
|
-
if (!this.groups[periodKey]) {
|
|
116
|
-
this.groups[periodKey] = [];
|
|
117
|
-
}
|
|
118
|
-
this.groups[periodKey].push(event);
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
protected setItems(): void {
|
|
123
|
-
this.periods.forEach((p) => {
|
|
124
|
-
// insert first the period
|
|
125
|
-
this.items.push(p);
|
|
126
|
-
// in each period putting items on left
|
|
127
|
-
const onLeft = true;
|
|
128
|
-
const periodInfo = p.periodInfo;
|
|
129
|
-
// insert then all the events in this period
|
|
130
|
-
this.addPeriodEvents(periodInfo, onLeft);
|
|
131
|
-
// onLeft = this.addEventItemsAndGetIfOnLeft(periodInfo, onLeft);
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
protected addPeriodEvents(periodInfo: NgxTimelinePeriodInfo, onLeft: boolean): void {
|
|
136
|
-
this.groups[periodInfo.periodKey].forEach((event, index) => {
|
|
137
|
-
const prevEvent = this.groups[periodInfo.periodKey][index - 1];
|
|
138
|
-
if (index > 0 && this.compareEvents(prevEvent, event)) {
|
|
139
|
-
onLeft = !onLeft;
|
|
140
|
-
}
|
|
141
|
-
this.pushEventOnItems(event, onLeft);
|
|
142
|
-
});
|
|
143
|
-
// return onLeft;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
protected pushEventOnItems(event: NgxTimelineEvent, onLeft: boolean): void {
|
|
147
|
-
this.items.push({
|
|
148
|
-
eventInfo: { ...event }, position: onLeft ?
|
|
149
|
-
this.ngxTimelineItemPosition.ON_LEFT : this.ngxTimelineItemPosition.ON_RIGHT
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Compare the events inside the same group
|
|
155
|
-
*/
|
|
156
|
-
protected compareEvents(prevEvent: NgxTimelineEvent, event: NgxTimelineEvent): boolean {
|
|
157
|
-
return this.changeSideInGroup === NgxTimelineEventChangeSideInGroup.ALL ||
|
|
158
|
-
this.compareEventsField(prevEvent, event, ...fieldsToCheckEventChangeSideInGroup[this.changeSideInGroup]);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
protected compareEventsField(prevEvent: NgxTimelineEvent, event: NgxTimelineEvent, ...fields: string[]): boolean {
|
|
162
|
-
return fields.reduce((res, field) => res = res || prevEvent.timestamp[field]() !== event.timestamp[field](), !!false);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
protected setPeriods(): void {
|
|
166
|
-
this.periods = Object.keys(this.groups).map((periodKey) => {
|
|
167
|
-
const split = periodKey.split(this.separator);
|
|
168
|
-
return this.getPeriodInfo(split, periodKey);
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
private getPeriodInfo(split: string[], periodKey: string): { periodInfo: NgxTimelinePeriodInfo } {
|
|
173
|
-
return {
|
|
174
|
-
periodInfo: {
|
|
175
|
-
year: Number(split[0]),
|
|
176
|
-
month: Number(split[1]),
|
|
177
|
-
day: Number(split[2]),
|
|
178
|
-
periodKey,
|
|
179
|
-
firstDate: this.groups[periodKey][0].timestamp as Date,
|
|
180
|
-
},
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
protected getPeriodKeyFromEvent(event: NgxTimelineEvent): string {
|
|
185
|
-
return fieldsToAddEventGroup[this.groupEvent].map(field => event.timestamp[field]()).join(this.separator);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
$flex-display-col: 49 49 0;
|
|
2
|
-
$flex-display-col-center: 2 2 0;
|
|
3
|
-
$background-line: #464646;
|
|
4
|
-
$background-orange: orange;
|
|
5
|
-
|
|
6
|
-
.main-container {
|
|
7
|
-
display: flex;
|
|
8
|
-
justify-content: center;
|
|
9
|
-
width: 100%
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.items-container {
|
|
13
|
-
padding: 1rem 0;
|
|
14
|
-
min-width: max(20rem, 100%);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.row {
|
|
18
|
-
display: -webkit-box;
|
|
19
|
-
display: -webkit-flex;
|
|
20
|
-
display: -ms-flexbox;
|
|
21
|
-
display: flex;
|
|
22
|
-
flex-wrap: wrap;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.row > [class*="col-"] {
|
|
26
|
-
display: flex;
|
|
27
|
-
flex-direction: column;
|
|
28
|
-
justify-content: center;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.col-left {
|
|
32
|
-
align-items: flex-end;
|
|
33
|
-
padding: 0;
|
|
34
|
-
flex: $flex-display-col;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.col-right {
|
|
38
|
-
align-items: flex-start;
|
|
39
|
-
padding: 0;
|
|
40
|
-
flex: $flex-display-col;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.col-center {
|
|
44
|
-
min-height: 6rem;
|
|
45
|
-
padding: 0;
|
|
46
|
-
flex: $flex-display-col-center;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.center-inner {
|
|
50
|
-
width: 100%;
|
|
51
|
-
display: flex;
|
|
52
|
-
flex-direction: column;
|
|
53
|
-
justify-content: center;
|
|
54
|
-
align-items: center;
|
|
55
|
-
height: 100%;
|
|
56
|
-
|
|
57
|
-
.line {
|
|
58
|
-
min-height: 50%;
|
|
59
|
-
max-height: 50%;
|
|
60
|
-
height: 50%;
|
|
61
|
-
background: $background-line;
|
|
62
|
-
width: 0.1rem;
|
|
63
|
-
|
|
64
|
-
&.transparent {
|
|
65
|
-
background: transparent;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.period-container {
|
|
71
|
-
background: $background-orange;
|
|
72
|
-
color: white;
|
|
73
|
-
margin: 0;
|
|
74
|
-
padding: 0.2rem 0.5rem;
|
|
75
|
-
|
|
76
|
-
.period-inner-container {
|
|
77
|
-
width: max-content;
|
|
78
|
-
padding: 0.2rem 0.5rem;
|
|
79
|
-
z-index: 10;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.center-icon-container {
|
|
84
|
-
padding: .8rem 0;
|
|
85
|
-
display: flex;
|
|
86
|
-
justify-content: center;
|
|
87
|
-
align-items: center;
|
|
88
|
-
position: absolute;
|
|
89
|
-
height: 10px;
|
|
90
|
-
width: 10px;
|
|
91
|
-
background: white;
|
|
92
|
-
|
|
93
|
-
.icon {
|
|
94
|
-
height: 1rem;
|
|
95
|
-
width: 1rem;
|
|
96
|
-
border-radius: 50%;
|
|
97
|
-
background: $background-orange;
|
|
98
|
-
margin: 0;
|
|
99
|
-
position: absolute;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.event-outer-container {
|
|
104
|
-
margin: 0 0.5rem;
|
|
105
|
-
width: 100%;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.hour {
|
|
109
|
-
padding: 0.5rem;
|
|
110
|
-
background: none;
|
|
111
|
-
display: flex;
|
|
112
|
-
justify-content: center;
|
|
113
|
-
align-items: center;
|
|
114
|
-
|
|
115
|
-
&.right {
|
|
116
|
-
justify-content: flex-start;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
&.left {
|
|
120
|
-
justify-content: flex-end;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.hour-inner-container {
|
|
124
|
-
margin: 0;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.desktop {
|
|
129
|
-
display: flex !important;
|
|
130
|
-
}
|
|
131
|
-
.mobile {
|
|
132
|
-
display: none !important;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
@media (max-width: 900px) {
|
|
136
|
-
.desktop {
|
|
137
|
-
display: none !important;
|
|
138
|
-
}
|
|
139
|
-
.mobile {
|
|
140
|
-
display: flex !important;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.event-outer-container {
|
|
144
|
-
margin: 0.5rem 0.3rem;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.col-left {
|
|
148
|
-
align-items: flex-start;
|
|
149
|
-
|
|
150
|
-
.hour {
|
|
151
|
-
font-size: 12px;
|
|
152
|
-
padding: 0;
|
|
153
|
-
margin-right: 0.3rem;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
&.col-period {
|
|
157
|
-
flex: 18 18 0;
|
|
158
|
-
}
|
|
159
|
-
&.col-event {
|
|
160
|
-
flex: 18 18 0;
|
|
161
|
-
padding: 0;
|
|
162
|
-
align-items: flex-end;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.col-right {
|
|
167
|
-
align-items: flex-start;
|
|
168
|
-
|
|
169
|
-
&.col-period {
|
|
170
|
-
flex: 77 77 0;
|
|
171
|
-
}
|
|
172
|
-
&.col-event {
|
|
173
|
-
flex: 77 77 0;
|
|
174
|
-
padding: 0;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.col-center {
|
|
179
|
-
min-height: 6rem;
|
|
180
|
-
justify-content: center;
|
|
181
|
-
margin: 0;
|
|
182
|
-
|
|
183
|
-
&.col-period {
|
|
184
|
-
flex: 5 5 0;
|
|
185
|
-
min-height: 3rem;
|
|
186
|
-
}
|
|
187
|
-
&.col-event {
|
|
188
|
-
flex: 5 5 0;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.center-inner {
|
|
193
|
-
align-items: center;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.period-container {
|
|
197
|
-
min-height: 20%;
|
|
198
|
-
height: 20%;
|
|
199
|
-
max-height: 20%;
|
|
200
|
-
background: transparent;
|
|
201
|
-
background: transparent;
|
|
202
|
-
display: flex;
|
|
203
|
-
justify-content: center;
|
|
204
|
-
align-items: center;
|
|
205
|
-
border-radius: 6px;
|
|
206
|
-
|
|
207
|
-
.period-inner-container {
|
|
208
|
-
position: absolute;
|
|
209
|
-
background: $background-orange;
|
|
210
|
-
color: white;
|
|
211
|
-
width: max-content;
|
|
212
|
-
padding: 0.2rem 0.5rem;
|
|
213
|
-
z-index: 10;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.center-icon-container {
|
|
218
|
-
align-items: center;
|
|
219
|
-
justify-content: center;
|
|
220
|
-
.icon {
|
|
221
|
-
height: 1rem;
|
|
222
|
-
width: 1rem;
|
|
223
|
-
position: absolute;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
export let supportedLanguageCodes = ['en', 'it', 'fr', 'de', 'es'];
|
|
2
|
-
|
|
3
|
-
export interface NgxConfigDate {
|
|
4
|
-
code: string;
|
|
5
|
-
dayMonthYear: string;
|
|
6
|
-
fullDate: string;
|
|
7
|
-
hoursMinutes: string;
|
|
8
|
-
monthYear: string;
|
|
9
|
-
year: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface NgxDateObjMap {
|
|
13
|
-
[key: string]: NgxConfigDate;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export let dateConfigMap: NgxDateObjMap = {
|
|
17
|
-
en: {
|
|
18
|
-
code: 'en-US',
|
|
19
|
-
fullDate: 'MM/dd/yyyy h:mm a',
|
|
20
|
-
dayMonthYear: 'dd MMMM yyyy',
|
|
21
|
-
monthYear: 'MMMM yyyy',
|
|
22
|
-
year: 'yyyy',
|
|
23
|
-
hoursMinutes: 'hh:mm a'
|
|
24
|
-
},
|
|
25
|
-
it: {
|
|
26
|
-
code: 'it-IT',
|
|
27
|
-
fullDate: 'dd/MM/yyyy H:mm',
|
|
28
|
-
dayMonthYear: 'dd MMMM yyyy',
|
|
29
|
-
monthYear: 'MMMM yyyy',
|
|
30
|
-
year: 'yyyy',
|
|
31
|
-
hoursMinutes: 'HH:mm'
|
|
32
|
-
},
|
|
33
|
-
fr: {
|
|
34
|
-
code: 'fr-FR',
|
|
35
|
-
fullDate: 'dd/MM/yyyy H:mm',
|
|
36
|
-
dayMonthYear: 'dd MMMM yyyy',
|
|
37
|
-
monthYear: 'MMMM yyyy',
|
|
38
|
-
year: 'yyyy',
|
|
39
|
-
hoursMinutes: 'HH:mm'
|
|
40
|
-
},
|
|
41
|
-
de: {
|
|
42
|
-
code: 'de',
|
|
43
|
-
fullDate: 'dd/MM/yyyy H:mm',
|
|
44
|
-
dayMonthYear: 'dd MMMM yyyy',
|
|
45
|
-
monthYear: 'MMMM yyyy',
|
|
46
|
-
year: 'yyyy',
|
|
47
|
-
hoursMinutes: 'HH:mm'
|
|
48
|
-
},
|
|
49
|
-
es: {
|
|
50
|
-
code: 'es',
|
|
51
|
-
fullDate: 'dd/MM/yyyy H:mm',
|
|
52
|
-
dayMonthYear: 'dd MMMM yyyy',
|
|
53
|
-
monthYear: 'MMMM yyyy',
|
|
54
|
-
year: 'yyyy',
|
|
55
|
-
hoursMinutes: 'HH:mm'
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export enum NgxDateFormat {
|
|
60
|
-
DAY_MONTH_YEAR = 'DAY_MONTH_YEAR',
|
|
61
|
-
FULL_DATE = 'FULL_DATE',
|
|
62
|
-
MONTH_YEAR = 'MONTH_YEAR',
|
|
63
|
-
HOURS_MINUTES = 'HOURS_MINUTES',
|
|
64
|
-
YEAR = 'YEAR'
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export let fieldConfigDate = {
|
|
68
|
-
MONTH_YEAR: 'monthYear',
|
|
69
|
-
YEAR: 'year',
|
|
70
|
-
HOURS_MINUTES: 'hoursMinutes',
|
|
71
|
-
FULL_DATE: 'fullDate',
|
|
72
|
-
DAY_MONTH_YEAR: 'dayMonthYear'
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Enum used to set the group event logic
|
|
77
|
-
*/
|
|
78
|
-
export enum NgxTimelineEventGroup {
|
|
79
|
-
YEAR = 'YEAR',
|
|
80
|
-
MONTH_YEAR = 'MONTH_YEAR',
|
|
81
|
-
DAY_MONTH_YEAR = 'DAY_MONTH_YEAR'
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export let fieldsToAddEventGroup = {
|
|
85
|
-
YEAR: ['getFullYear'],
|
|
86
|
-
MONTH_YEAR: ['getFullYear', 'getMonth'],
|
|
87
|
-
DAY_MONTH_YEAR: ['getFullYear', 'getMonth', 'getDate']
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export let periodKeyDateFormat = {
|
|
91
|
-
YEAR: NgxDateFormat.YEAR,
|
|
92
|
-
MONTH_YEAR: NgxDateFormat.MONTH_YEAR,
|
|
93
|
-
DAY_MONTH_YEAR: NgxDateFormat.DAY_MONTH_YEAR,
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Enum used to set the change side event logic
|
|
98
|
-
*/
|
|
99
|
-
export enum NgxTimelineEventChangeSideInGroup {
|
|
100
|
-
ALL = 'ALL',
|
|
101
|
-
ON_DIFFERENT_HMS = 'ON_DIFFERENT_HMS',
|
|
102
|
-
ON_DIFFERENT_DAY = 'ON_DIFFERENT_DAY',
|
|
103
|
-
ON_DIFFERENT_MONTH = 'ON_DIFFERENT_MONTH'
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export let fieldsToCheckEventChangeSideInGroup = {
|
|
107
|
-
ON_DIFFERENT_MONTH: ['getFullYear', 'getMonth'],
|
|
108
|
-
ON_DIFFERENT_DAY: ['getFullYear', 'getMonth', 'getDate'],
|
|
109
|
-
ON_DIFFERENT_HMS: ['getFullYear', 'getMonth', 'getDate', 'getHours', 'getMinutes', 'getSeconds']
|
|
110
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Event to be provided from outside the timeline
|
|
3
|
-
*/
|
|
4
|
-
export interface NgxTimelineEvent {
|
|
5
|
-
timestamp?: Date;
|
|
6
|
-
title?: string;
|
|
7
|
-
description?: string;
|
|
8
|
-
id?: any;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface NgxTimelinePeriodInfo {
|
|
12
|
-
periodKey?: string;
|
|
13
|
-
year?: number;
|
|
14
|
-
month?: number;
|
|
15
|
-
day?: number;
|
|
16
|
-
firstDate?: any;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Item used inside the timeline
|
|
21
|
-
*/
|
|
22
|
-
export interface NgxTimelineItem {
|
|
23
|
-
type?: string;
|
|
24
|
-
position?: NgxTimelineItemPosition.ON_LEFT | NgxTimelineItemPosition.ON_RIGHT;
|
|
25
|
-
periodInfo?: NgxTimelinePeriodInfo;
|
|
26
|
-
eventInfo?: NgxTimelineEvent;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export enum NgxTimelineItemPosition {
|
|
30
|
-
ON_LEFT = 'ON_LEFT',
|
|
31
|
-
ON_RIGHT = 'ON_RIGHT'
|
|
32
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { NgxTimelineComponent } from './components/ngx-timeline.component';
|
|
3
|
-
import { NgxTimelineEventComponent } from './components/ngx-timeline-event/ngx-timeline-event.component';
|
|
4
|
-
import { CommonModule, registerLocaleData } from '@angular/common';
|
|
5
|
-
import { NgxDatePipe } from './pipes/ngx-date-pipe';
|
|
6
|
-
import localeIt from '@angular/common/locales/it';
|
|
7
|
-
import localeFr from '@angular/common/locales/fr';
|
|
8
|
-
import localeDe from '@angular/common/locales/de';
|
|
9
|
-
import localeEs from '@angular/common/locales/es';
|
|
10
|
-
|
|
11
|
-
registerLocaleData(localeIt);
|
|
12
|
-
registerLocaleData(localeFr);
|
|
13
|
-
registerLocaleData(localeDe);
|
|
14
|
-
registerLocaleData(localeEs);
|
|
15
|
-
|
|
16
|
-
@NgModule({
|
|
17
|
-
declarations: [NgxTimelineComponent, NgxTimelineEventComponent, NgxDatePipe],
|
|
18
|
-
imports: [CommonModule],
|
|
19
|
-
exports: [NgxTimelineComponent, NgxDatePipe]
|
|
20
|
-
})
|
|
21
|
-
export class NgxTimelineModule { }
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { DatePipe } from '@angular/common';
|
|
2
|
-
import { Pipe, PipeTransform } from '@angular/core';
|
|
3
|
-
import { NgxConfigDate, NgxDateObjMap, NgxDateFormat, supportedLanguageCodes, fieldConfigDate, dateConfigMap } from '../models';
|
|
4
|
-
|
|
5
|
-
@Pipe({ name: 'ngxdate', pure: false })
|
|
6
|
-
export class NgxDatePipe implements PipeTransform {
|
|
7
|
-
|
|
8
|
-
constructor() {
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
transform(date: Date | string, dateFormat?: string, langCode?: string): string {
|
|
12
|
-
let transformedDate = null;
|
|
13
|
-
if (date) {
|
|
14
|
-
const objDate = this.getDateConfig(langCode);
|
|
15
|
-
transformedDate = new DatePipe(objDate.code).transform(new Date(date), this.dateFormat(dateFormat, objDate));
|
|
16
|
-
}
|
|
17
|
-
return transformedDate;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
private dateFormat(dateFormat: string, configDate: NgxConfigDate): string {
|
|
21
|
-
return configDate[fieldConfigDate[dateFormat]];
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
private getDateConfig(langCode: string): NgxConfigDate {
|
|
25
|
-
const code = langCode || supportedLanguageCodes[0];
|
|
26
|
-
const configDate = dateConfigMap[code] || dateConfigMap[supportedLanguageCodes[0]];
|
|
27
|
-
return configDate;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
|
2
|
-
|
|
3
|
-
import 'zone.js/dist/zone';
|
|
4
|
-
import 'zone.js/dist/zone-testing';
|
|
5
|
-
import { getTestBed } from '@angular/core/testing';
|
|
6
|
-
import {
|
|
7
|
-
BrowserDynamicTestingModule,
|
|
8
|
-
platformBrowserDynamicTesting
|
|
9
|
-
} from '@angular/platform-browser-dynamic/testing';
|
|
10
|
-
|
|
11
|
-
declare const require: {
|
|
12
|
-
context(path: string, deep?: boolean, filter?: RegExp): {
|
|
13
|
-
keys(): string[];
|
|
14
|
-
<T>(id: string): T;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
// First, initialize the Angular testing environment.
|
|
19
|
-
getTestBed().initTestEnvironment(
|
|
20
|
-
BrowserDynamicTestingModule,
|
|
21
|
-
platformBrowserDynamicTesting()
|
|
22
|
-
);
|
|
23
|
-
// Then we find all the tests.
|
|
24
|
-
const context = require.context('./', true, /\.spec\.ts$/);
|
|
25
|
-
// And load the modules.
|
|
26
|
-
context.keys().map(context);
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
|
2
|
-
{
|
|
3
|
-
"extends": "../../tsconfig.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"outDir": "../../out-tsc/lib",
|
|
6
|
-
"target": "es2015",
|
|
7
|
-
"declaration": true,
|
|
8
|
-
"declarationMap": true,
|
|
9
|
-
"inlineSources": true,
|
|
10
|
-
"types": [],
|
|
11
|
-
"lib": [
|
|
12
|
-
"dom",
|
|
13
|
-
"es2018"
|
|
14
|
-
]
|
|
15
|
-
},
|
|
16
|
-
"angularCompilerOptions": {
|
|
17
|
-
"skipTemplateCodegen": true,
|
|
18
|
-
"strictMetadataEmit": true,
|
|
19
|
-
"enableResourceInlining": true
|
|
20
|
-
},
|
|
21
|
-
"exclude": [
|
|
22
|
-
"src/test.ts",
|
|
23
|
-
"**/*.spec.ts"
|
|
24
|
-
]
|
|
25
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
|
2
|
-
{
|
|
3
|
-
"extends": "../../tsconfig.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"outDir": "../../out-tsc/spec",
|
|
6
|
-
"types": [
|
|
7
|
-
"jasmine"
|
|
8
|
-
]
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"src/test.ts"
|
|
12
|
-
],
|
|
13
|
-
"include": [
|
|
14
|
-
"**/*.spec.ts",
|
|
15
|
-
"**/*.d.ts"
|
|
16
|
-
]
|
|
17
|
-
}
|