@frxjs/ngx-timeline 1.0.7 → 1.0.12
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/.editorconfig +16 -0
- package/.github/workflows/CI-main.yml +48 -0
- package/README.md +136 -136
- package/angular.json +178 -0
- package/docs/3rdpartylicenses.txt +268 -0
- package/docs/assets/inter.png +0 -0
- package/docs/favicon.ico +0 -0
- package/docs/index.html +13 -0
- package/docs/main.6005a10000c87d7095d3.js +1 -0
- package/docs/polyfills.f8ddde825b13760c1743.js +1 -0
- package/docs/runtime.0e49e2b53282f40c8925.js +1 -0
- package/docs/styles.09e2c710755c8867a460.css +0 -0
- package/package.json +51 -16
- package/projects/demo-app/.browserslistrc +17 -0
- package/projects/demo-app/e2e/protractor.conf.js +37 -0
- package/projects/demo-app/e2e/src/app.e2e-spec.ts +23 -0
- package/projects/demo-app/e2e/src/app.po.ts +11 -0
- package/projects/demo-app/e2e/tsconfig.json +13 -0
- package/projects/demo-app/karma.conf.js +44 -0
- package/projects/demo-app/src/app/app.component.html +90 -0
- package/projects/demo-app/src/app/app.component.scss +417 -0
- package/projects/demo-app/src/app/app.component.spec.ts +24 -0
- package/projects/demo-app/src/app/app.component.ts +147 -0
- package/projects/demo-app/src/app/app.module.ts +20 -0
- 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 +3 -0
- package/projects/demo-app/src/environments/environment.ts +16 -0
- package/projects/demo-app/src/favicon.ico +0 -0
- package/projects/demo-app/src/index.html +13 -0
- package/projects/demo-app/src/main.ts +12 -0
- package/projects/demo-app/src/polyfills.ts +63 -0
- package/projects/demo-app/src/styles.scss +1 -0
- package/projects/demo-app/src/test.ts +25 -0
- package/projects/demo-app/tsconfig.app.json +26 -0
- package/projects/demo-app/tsconfig.spec.json +18 -0
- package/projects/demo-app/tslint.json +17 -0
- package/projects/ngx-timeline/README.md +136 -0
- package/projects/ngx-timeline/karma.conf.js +44 -0
- package/projects/ngx-timeline/ng-package.json +7 -0
- package/projects/ngx-timeline/package.json +20 -0
- package/{lib/components/index.d.ts → projects/ngx-timeline/src/lib/components/index.ts} +2 -2
- package/projects/ngx-timeline/src/lib/components/ngx-timeline-event/ngx-timeline-event.component.html +37 -0
- package/projects/ngx-timeline/src/lib/components/ngx-timeline-event/ngx-timeline-event.component.scss +197 -0
- package/projects/ngx-timeline/src/lib/components/ngx-timeline-event/ngx-timeline-event.component.spec.ts +89 -0
- package/projects/ngx-timeline/src/lib/components/ngx-timeline-event/ngx-timeline-event.component.ts +66 -0
- package/projects/ngx-timeline/src/lib/components/ngx-timeline.component.html +98 -0
- package/projects/ngx-timeline/src/lib/components/ngx-timeline.component.spec.ts +160 -0
- package/projects/ngx-timeline/src/lib/components/ngx-timeline.component.ts +187 -0
- package/projects/ngx-timeline/src/lib/components/ngx-timeline.scss +226 -0
- package/projects/ngx-timeline/src/lib/models/NgxConfigObj.ts +110 -0
- package/projects/ngx-timeline/src/lib/models/NgxTimelineEvent.ts +32 -0
- package/{lib/models/index.d.ts → projects/ngx-timeline/src/lib/models/index.ts} +2 -2
- package/projects/ngx-timeline/src/lib/ngx-timeline.module.ts +21 -0
- package/{lib/pipes/index.d.ts → projects/ngx-timeline/src/lib/pipes/index.ts} +1 -1
- package/projects/ngx-timeline/src/lib/pipes/ngx-date-pipe.ts +29 -0
- package/{public-api.d.ts → projects/ngx-timeline/src/public-api.ts} +7 -4
- package/projects/ngx-timeline/src/test.ts +26 -0
- package/projects/ngx-timeline/tsconfig.lib.json +25 -0
- package/projects/ngx-timeline/tsconfig.lib.prod.json +10 -0
- package/projects/ngx-timeline/tsconfig.spec.json +17 -0
- package/projects/ngx-timeline/tslint.json +17 -0
- package/tsconfig.json +35 -0
- package/tslint.json +140 -0
- package/bundles/frxjs-ngx-timeline.umd.js +0 -696
- package/bundles/frxjs-ngx-timeline.umd.js.map +0 -1
- package/bundles/frxjs-ngx-timeline.umd.min.js +0 -2
- package/bundles/frxjs-ngx-timeline.umd.min.js.map +0 -1
- package/esm2015/frxjs-ngx-timeline.js +0 -8
- package/esm2015/lib/components/index.js +0 -3
- package/esm2015/lib/components/ngx-timeline-event/ngx-timeline-event.component.js +0 -55
- package/esm2015/lib/components/ngx-timeline.component.js +0 -147
- package/esm2015/lib/models/NgxConfigObj.js +0 -93
- package/esm2015/lib/models/NgxTimelineEvent.js +0 -6
- package/esm2015/lib/models/index.js +0 -3
- package/esm2015/lib/ngx-timeline.module.js +0 -23
- package/esm2015/lib/pipes/index.js +0 -2
- package/esm2015/lib/pipes/ngx-date-pipe.js +0 -28
- package/esm2015/public-api.js +0 -8
- package/fesm2015/frxjs-ngx-timeline.js +0 -350
- package/fesm2015/frxjs-ngx-timeline.js.map +0 -1
- package/frxjs-ngx-timeline.d.ts +0 -7
- package/frxjs-ngx-timeline.metadata.json +0 -1
- package/lib/components/ngx-timeline-event/ngx-timeline-event.component.d.ts +0 -35
- package/lib/components/ngx-timeline.component.d.ts +0 -76
- package/lib/models/NgxConfigObj.d.ts +0 -59
- package/lib/models/NgxTimelineEvent.d.ts +0 -29
- package/lib/ngx-timeline.module.d.ts +0 -2
- package/lib/pipes/ngx-date-pipe.d.ts +0 -7
|
@@ -0,0 +1,226 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
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,2 +1,2 @@
|
|
|
1
|
-
export * from './NgxConfigObj';
|
|
2
|
-
export * from './NgxTimelineEvent';
|
|
1
|
+
export * from './NgxConfigObj';
|
|
2
|
+
export * from './NgxTimelineEvent';
|
|
@@ -0,0 +1,21 @@
|
|
|
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 +1 @@
|
|
|
1
|
-
export * from './ngx-date-pipe';
|
|
1
|
+
export * from './ngx-date-pipe';
|
|
@@ -0,0 +1,29 @@
|
|
|
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,4 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export * from './lib/
|
|
1
|
+
/*
|
|
2
|
+
* Public API Surface of ngx-timeline
|
|
3
|
+
*/
|
|
4
|
+
export * from './lib/components';
|
|
5
|
+
export * from './lib/models';
|
|
6
|
+
export * from './lib/pipes/';
|
|
7
|
+
export * from './lib/ngx-timeline.module';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
|
2
|
+
|
|
3
|
+
import 'zone.js';
|
|
4
|
+
import 'zone.js/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);
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compileOnSave": false,
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": "./",
|
|
5
|
+
"outDir": "./dist/out-tsc",
|
|
6
|
+
"forceConsistentCasingInFileNames": true,
|
|
7
|
+
"preserveSymlinks": true,
|
|
8
|
+
"strict": false,
|
|
9
|
+
"noImplicitReturns": true,
|
|
10
|
+
"noFallthroughCasesInSwitch": true,
|
|
11
|
+
"sourceMap": true,
|
|
12
|
+
"declaration": false,
|
|
13
|
+
"downlevelIteration": true,
|
|
14
|
+
"experimentalDecorators": true,
|
|
15
|
+
"moduleResolution": "node",
|
|
16
|
+
"importHelpers": true,
|
|
17
|
+
"target": "es2015",
|
|
18
|
+
"module": "es2020",
|
|
19
|
+
"lib": [
|
|
20
|
+
"es2018",
|
|
21
|
+
"dom"
|
|
22
|
+
],
|
|
23
|
+
"paths": {
|
|
24
|
+
"ngx-timeline": [
|
|
25
|
+
"dist/ngx-timeline/ngx-timeline",
|
|
26
|
+
"dist/ngx-timeline"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"angularCompilerOptions": {
|
|
31
|
+
"strictInjectionParameters": true,
|
|
32
|
+
"strictInputAccessModifiers": true,
|
|
33
|
+
"strictTemplates": false
|
|
34
|
+
}
|
|
35
|
+
}
|