@frxjs/ngx-timeline 1.0.12 → 1.2.1
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 +4 -1
- package/esm2020/frxjs-ngx-timeline.mjs +5 -0
- package/esm2020/lib/components/index.mjs +3 -0
- package/esm2020/lib/components/ngx-timeline-event/ngx-timeline-event.component.mjs +58 -0
- package/esm2020/lib/components/ngx-timeline.component.mjs +167 -0
- package/esm2020/lib/models/NgxConfigObj.mjs +93 -0
- package/esm2020/lib/models/NgxTimelineEvent.mjs +6 -0
- package/esm2020/lib/models/index.mjs +3 -0
- package/esm2020/lib/ngx-timeline.module.mjs +28 -0
- package/esm2020/lib/pipes/index.mjs +2 -0
- package/esm2020/lib/pipes/ngx-date-pipe.mjs +31 -0
- package/esm2020/public-api.mjs +8 -0
- package/fesm2015/frxjs-ngx-timeline.mjs +376 -0
- package/fesm2015/frxjs-ngx-timeline.mjs.map +1 -0
- package/fesm2020/frxjs-ngx-timeline.mjs +375 -0
- package/fesm2020/frxjs-ngx-timeline.mjs.map +1 -0
- package/frxjs-ngx-timeline.d.ts +5 -0
- package/{projects/ngx-timeline/src/lib/components/index.ts → lib/components/index.d.ts} +0 -0
- package/lib/components/ngx-timeline-event/ngx-timeline-event.component.d.ts +38 -0
- package/lib/components/ngx-timeline.component.d.ts +83 -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} +0 -0
- package/lib/ngx-timeline.module.d.ts +10 -0
- package/{projects/ngx-timeline/src/lib/pipes/index.ts → lib/pipes/index.d.ts} +0 -0
- package/lib/pipes/ngx-date-pipe.d.ts +10 -0
- package/package.json +29 -51
- package/{projects/ngx-timeline/src/public-api.ts → public-api.d.ts} +0 -3
- package/.editorconfig +0 -16
- package/.github/workflows/CI-main.yml +0 -48
- package/angular.json +0 -178
- 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/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.spec.ts +0 -24
- 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 -136
- 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 -20
- 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,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file includes polyfills needed by Angular and is loaded before the app.
|
|
3
|
-
* You can add your own extra polyfills to this file.
|
|
4
|
-
*
|
|
5
|
-
* This file is divided into 2 sections:
|
|
6
|
-
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
|
7
|
-
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
|
8
|
-
* file.
|
|
9
|
-
*
|
|
10
|
-
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
|
11
|
-
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
|
12
|
-
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
|
|
13
|
-
*
|
|
14
|
-
* Learn more in https://angular.io/guide/browser-support
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/***************************************************************************************************
|
|
18
|
-
* BROWSER POLYFILLS
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/** IE11 requires the following for NgClass support on SVG elements */
|
|
22
|
-
// import 'classlist.js'; // Run `npm install --save classlist.js`.
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Web Animations `@angular/platform-browser/animations`
|
|
26
|
-
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
|
|
27
|
-
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
|
|
28
|
-
*/
|
|
29
|
-
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* By default, zone.js will patch all possible macroTask and DomEvents
|
|
33
|
-
* user can disable parts of macroTask/DomEvents patch by setting following flags
|
|
34
|
-
* because those flags need to be set before `zone.js` being loaded, and webpack
|
|
35
|
-
* will put import in the top of bundle, so user need to create a separate file
|
|
36
|
-
* in this directory (for example: zone-flags.ts), and put the following flags
|
|
37
|
-
* into that file, and then add the following code before importing zone.js.
|
|
38
|
-
* import './zone-flags';
|
|
39
|
-
*
|
|
40
|
-
* The flags allowed in zone-flags.ts are listed here.
|
|
41
|
-
*
|
|
42
|
-
* The following flags will work for all browsers.
|
|
43
|
-
*
|
|
44
|
-
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
|
45
|
-
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
|
46
|
-
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
|
47
|
-
*
|
|
48
|
-
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
|
|
49
|
-
* with the following flag, it will bypass `zone.js` patch for IE/Edge
|
|
50
|
-
*
|
|
51
|
-
* (window as any).__Zone_enable_cross_context_check = true;
|
|
52
|
-
*
|
|
53
|
-
*/
|
|
54
|
-
|
|
55
|
-
/***************************************************************************************************
|
|
56
|
-
* Zone JS is required by default for Angular itself.
|
|
57
|
-
*/
|
|
58
|
-
import 'zone.js'; // Included with Angular CLI.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
/***************************************************************************************************
|
|
62
|
-
* APPLICATION IMPORTS
|
|
63
|
-
*/
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/* You can add global styles to this file, and also import other style files */
|
|
@@ -1,25 +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/testing';
|
|
4
|
-
import { getTestBed } from '@angular/core/testing';
|
|
5
|
-
import {
|
|
6
|
-
BrowserDynamicTestingModule,
|
|
7
|
-
platformBrowserDynamicTesting
|
|
8
|
-
} from '@angular/platform-browser-dynamic/testing';
|
|
9
|
-
|
|
10
|
-
declare const require: {
|
|
11
|
-
context(path: string, deep?: boolean, filter?: RegExp): {
|
|
12
|
-
keys(): string[];
|
|
13
|
-
<T>(id: string): T;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
// First, initialize the Angular testing environment.
|
|
18
|
-
getTestBed().initTestEnvironment(
|
|
19
|
-
BrowserDynamicTestingModule,
|
|
20
|
-
platformBrowserDynamicTesting()
|
|
21
|
-
);
|
|
22
|
-
// Then we find all the tests.
|
|
23
|
-
const context = require.context('./', true, /\.spec\.ts$/);
|
|
24
|
-
// And load the modules.
|
|
25
|
-
context.keys().map(context);
|
|
@@ -1,26 +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/app",
|
|
6
|
-
"types": [],
|
|
7
|
-
"paths": {
|
|
8
|
-
"ngx-timeline": [
|
|
9
|
-
"dist/ngx-timeline/ngx-timeline",
|
|
10
|
-
"dist/ngx-timeline"
|
|
11
|
-
]
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"angularCompilerOptions": {
|
|
15
|
-
"strictInjectionParameters": true,
|
|
16
|
-
"strictInputAccessModifiers": true,
|
|
17
|
-
"strictTemplates": false
|
|
18
|
-
},
|
|
19
|
-
"files": [
|
|
20
|
-
"src/main.ts",
|
|
21
|
-
"src/polyfills.ts"
|
|
22
|
-
],
|
|
23
|
-
"include": [
|
|
24
|
-
"src/**/*.d.ts"
|
|
25
|
-
]
|
|
26
|
-
}
|
|
@@ -1,18 +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
|
-
"src/polyfills.ts"
|
|
13
|
-
],
|
|
14
|
-
"include": [
|
|
15
|
-
"src/**/*.spec.ts",
|
|
16
|
-
"src/**/*.d.ts"
|
|
17
|
-
]
|
|
18
|
-
}
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
# NgxTimeline 
|
|
2
|
-
|
|
3
|
-
The main goal of this angular library is to give you the possibility to integrate a timeline in your app.
|
|
4
|
-
<br/>
|
|
5
|
-
Go [here](https://emanuelefricano93.github.io/frxjs-Ngx-Timeline/) and discover all possible configurations for the timeline
|
|
6
|
-
|
|
7
|
-

|
|
8
|
-
<p align = "center">
|
|
9
|
-
Fig.1 - Preview of <a href="https://emanuelefricano93.github.io/frxjs-Ngx-Timeline/">Timeline example configuration page</a>
|
|
10
|
-
</p>
|
|
11
|
-
<br/><br/>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## Installation
|
|
15
|
-
Running the following command to install the library
|
|
16
|
-
```
|
|
17
|
-
npm install @frxjs/ngx-timeline
|
|
18
|
-
```
|
|
19
|
-
<br/><br/>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
## Examples of Usage
|
|
24
|
-
|
|
25
|
-
After installing the library and including NgxTimelineModule in your imports module you could add one of following examples to your template in order to display your timeline
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
<ngx-timeline [events]="events"></ngx-timeline>
|
|
29
|
-
<ngx-timeline [events]="events" [langCode]="it"></ngx-timeline>
|
|
30
|
-
<ngx-timeline [events]="events" [langCode]="it" [enableAnimation]="false"></ngx-timeline>
|
|
31
|
-
```
|
|
32
|
-
<br/><br/>
|
|
33
|
-
|
|
34
|
-
## Configuration
|
|
35
|
-
|
|
36
|
-
### Input
|
|
37
|
-
Input name | Explanation | Mandatory | Type/Supported Values | Default value
|
|
38
|
-
--- | --- | --- | --- | ---
|
|
39
|
-
events | list of events to be displayed | yes | NgxTimelineEvent | no default
|
|
40
|
-
langCode | language code use to format dates | no | <ul><li>'en'</li><li>'it'</li><li>'fr'</li><li>'de'</li><li>'es'</li></ul> | 'en'
|
|
41
|
-
enableAnimation | Boolean used to enable or disable the animations | no | boolean | true
|
|
42
|
-
groupEvent | Logic to be applied in order to group events | no | enum NgxTimelineEventGroup | NgxTimelineEventGroup.MONTH_YEAR
|
|
43
|
-
changeSideInGroup | Logic to be applied in order to put evetns on LEFT or RIGHT | no | enum NgxTimelineEventChangeSideInGroup | NgxTimelineEventChangeSideInGroup.ON_DIFFERENT_DAY
|
|
44
|
-
periodCustomTemplate | Custom Template displayed before a group of events | no | TemplateRef<any> | no default
|
|
45
|
-
eventCustomTemplate | Custom Template displayed to show a single event | no | TemplateRef<any> | no default
|
|
46
|
-
centerIconCustomTemplate | Custom Template displayed to show an separator icon | no | TemplateRef<any> | no default
|
|
47
|
-
dateInstantCustomTemplate | Custom Template displayed to show the side date | no | TemplateRef<any> | no default
|
|
48
|
-
innerEventCustomTemplate | Custom Template displayed to show the inner event | no | TemplateRef<any> | no default
|
|
49
|
-
<br/>
|
|
50
|
-
|
|
51
|
-
### Output
|
|
52
|
-
Output name | Explanation | Mandatory | Type/Supported Values | Default value
|
|
53
|
-
--- | --- | --- | --- | ---
|
|
54
|
-
clickEmitter | Output click event emitter | no | BehaviorSubject<NgxTimelineItem> | no default
|
|
55
|
-
<br/>
|
|
56
|
-
|
|
57
|
-
### Types and Enums
|
|
58
|
-
```typescript
|
|
59
|
-
interface NgxTimelineEvent {
|
|
60
|
-
timestamp?: Date;
|
|
61
|
-
title?: string;
|
|
62
|
-
description?: string;
|
|
63
|
-
id?: any;
|
|
64
|
-
}
|
|
65
|
-
```
|
|
66
|
-
```typescript
|
|
67
|
-
enum NgxTimelineEventGroup {
|
|
68
|
-
YEAR = 'YEAR',
|
|
69
|
-
MONTH_YEAR = 'MONTH_YEAR',
|
|
70
|
-
DAY_MONTH_YEAR = 'DAY_MONTH_YEAR'
|
|
71
|
-
}
|
|
72
|
-
```
|
|
73
|
-
```typescript
|
|
74
|
-
enum NgxTimelineEventChangeSideInGroup {
|
|
75
|
-
ALL = 'ALL',
|
|
76
|
-
ON_DIFFERENT_HMS = 'ON_DIFFERENT_HMS',
|
|
77
|
-
ON_DIFFERENT_DAY = 'ON_DIFFERENT_DAY',
|
|
78
|
-
ON_DIFFERENT_MONTH = 'ON_DIFFERENT_MONTH'
|
|
79
|
-
}
|
|
80
|
-
```
|
|
81
|
-
<br/>
|
|
82
|
-
|
|
83
|
-
### Examples with contexts of custom templates
|
|
84
|
-
```html
|
|
85
|
-
<ng-template #periodCustomTemplate let-period=period let-index=index>
|
|
86
|
-
<div [ngClass]="{'transparent first-line': !index}" class="line"></div>
|
|
87
|
-
<div class="period-container">
|
|
88
|
-
<p>
|
|
89
|
-
{{index}} - {{period | json }}
|
|
90
|
-
</p>
|
|
91
|
-
</div>
|
|
92
|
-
<div class="line"></div>
|
|
93
|
-
</ng-template>
|
|
94
|
-
```
|
|
95
|
-
```html
|
|
96
|
-
<ng-template #centerIconCustomTemplate>
|
|
97
|
-
<div class="icon-container">
|
|
98
|
-
<img src="assets/image.png"/>
|
|
99
|
-
</div>
|
|
100
|
-
</ng-template>
|
|
101
|
-
```
|
|
102
|
-
```html
|
|
103
|
-
<ng-template #innerEventCustomTemplate let-event=event>
|
|
104
|
-
<div class="event" (click)="handleClick(event)">
|
|
105
|
-
{{event | json}}
|
|
106
|
-
</div>
|
|
107
|
-
</ng-template>
|
|
108
|
-
```
|
|
109
|
-
```html
|
|
110
|
-
<ng-template #eventCustomTemplate let-event=event let-colSidePosition=colSidePosition>
|
|
111
|
-
<div class="event" (click)="handleClick(event)">
|
|
112
|
-
{{event | json}}
|
|
113
|
-
</div>
|
|
114
|
-
</ng-template>
|
|
115
|
-
```
|
|
116
|
-
```html
|
|
117
|
-
<ng-template #dateInstantCustomTemplate let-item=item>
|
|
118
|
-
<span>
|
|
119
|
-
{{item | json}}
|
|
120
|
-
</span>
|
|
121
|
-
</ng-template>
|
|
122
|
-
```
|
|
123
|
-
<br/><br/>
|
|
124
|
-
|
|
125
|
-
## How to contribute
|
|
126
|
-
First of all, in order to track everything, open an issue describing the problem or a missing functionality you would like to add to the lib.
|
|
127
|
-
|
|
128
|
-
To start the contribution:
|
|
129
|
-
- `npm run watch-lib` (you are builduing the lib with --watch options)
|
|
130
|
-
- `npm run start-dev` (you are linking the lib and starting the demo app )
|
|
131
|
-
|
|
132
|
-
Every time you will change the code in your lib, any update will trigger the re-load of the app.
|
|
133
|
-
When your code will be ready, create a Pull Request and put the link in a comment under the issue you opened before.
|
|
134
|
-
Now is time to enjoy and start to code.
|
|
135
|
-
|
|
136
|
-
Thanks in advance for your contribution
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// Karma configuration file, see link for more information
|
|
2
|
-
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
|
3
|
-
|
|
4
|
-
module.exports = function (config) {
|
|
5
|
-
config.set({
|
|
6
|
-
basePath: '',
|
|
7
|
-
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
|
8
|
-
plugins: [
|
|
9
|
-
require('karma-jasmine'),
|
|
10
|
-
require('karma-chrome-launcher'),
|
|
11
|
-
require('karma-jasmine-html-reporter'),
|
|
12
|
-
require('karma-coverage'),
|
|
13
|
-
require('@angular-devkit/build-angular/plugins/karma')
|
|
14
|
-
],
|
|
15
|
-
client: {
|
|
16
|
-
jasmine: {
|
|
17
|
-
// you can add configuration options for Jasmine here
|
|
18
|
-
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
|
19
|
-
// for example, you can disable the random execution with `random: false`
|
|
20
|
-
// or set a specific seed with `seed: 4321`
|
|
21
|
-
},
|
|
22
|
-
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
|
23
|
-
},
|
|
24
|
-
jasmineHtmlReporter: {
|
|
25
|
-
suppressAll: true // removes the duplicated traces
|
|
26
|
-
},
|
|
27
|
-
coverageReporter: {
|
|
28
|
-
dir: require('path').join(__dirname, '../../coverage/ngx-timeline'),
|
|
29
|
-
subdir: '.',
|
|
30
|
-
reporters: [
|
|
31
|
-
{ type: 'html' },
|
|
32
|
-
{ type: 'text-summary' }
|
|
33
|
-
]
|
|
34
|
-
},
|
|
35
|
-
reporters: ['progress', 'kjhtml'],
|
|
36
|
-
port: 9876,
|
|
37
|
-
colors: true,
|
|
38
|
-
logLevel: config.LOG_INFO,
|
|
39
|
-
autoWatch: false,
|
|
40
|
-
browsers: ['ChromeHeadless'],
|
|
41
|
-
singleRun: true,
|
|
42
|
-
restartOnFileChange: true
|
|
43
|
-
});
|
|
44
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@frxjs/ngx-timeline",
|
|
3
|
-
"version": "1.0.7",
|
|
4
|
-
"keywords": ["angular", "timeline"],
|
|
5
|
-
"author": {
|
|
6
|
-
"name": "Emanuele Fricano",
|
|
7
|
-
"email": "emanuelefricano93@gmail.com"
|
|
8
|
-
},
|
|
9
|
-
"repository": {
|
|
10
|
-
"url": "https://github.com/emanuelefricano93/frxjs-Ngx-Timeline"
|
|
11
|
-
},
|
|
12
|
-
"license": "MIT",
|
|
13
|
-
"peerDependencies": {
|
|
14
|
-
"@angular/common": "^11.0.9",
|
|
15
|
-
"@angular/core": "^11.0.9"
|
|
16
|
-
},
|
|
17
|
-
"dependencies": {
|
|
18
|
-
"tslib": "^2.0.0"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
<div class="event-wrapper-container" (click)="clickEmitter.next(event)">
|
|
2
|
-
<div *ngIf="colSidePosition===ngxTimelineItemPosition.ON_RIGHT" class="arrow left"></div>
|
|
3
|
-
<div class="event" [ngClass]="{'enableAnimation': enableAnimation}">
|
|
4
|
-
<ng-container *ngTemplateOutlet="innerEventCustomTemplate || innerEventContainer; context: {event: event}">
|
|
5
|
-
</ng-container>
|
|
6
|
-
</div>
|
|
7
|
-
<div *ngIf="colSidePosition===ngxTimelineItemPosition.ON_LEFT" class="arrow right"></div>
|
|
8
|
-
</div>
|
|
9
|
-
|
|
10
|
-
<ng-template #innerEventContainer let-event=event>
|
|
11
|
-
<div class="event-container" [ngClass]="{'reverse': colSidePosition === ngxTimelineItemPosition.ON_LEFT}">
|
|
12
|
-
<div class="event-info-container">
|
|
13
|
-
<div class="event-info-header">
|
|
14
|
-
<div class="title-container">{{event?.eventInfo?.title | titlecase}}</div>
|
|
15
|
-
</div>
|
|
16
|
-
<div class="event-info-body">
|
|
17
|
-
<p class="event-info-description">{{event?.eventInfo?.description}}</p>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
|
|
21
|
-
<div class="event-divider-container">
|
|
22
|
-
<hr/>
|
|
23
|
-
</div>
|
|
24
|
-
|
|
25
|
-
<div class="event-date-container" *ngIf="getDateObj() as dateObj">
|
|
26
|
-
<div>
|
|
27
|
-
<p>{{dateObj?.month}}</p>
|
|
28
|
-
</div>
|
|
29
|
-
<div>
|
|
30
|
-
<p class="day">{{dateObj?.day}}</p>
|
|
31
|
-
</div>
|
|
32
|
-
<div>
|
|
33
|
-
<p>{{dateObj?.year}}</p>
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
</ng-template>
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
.event-wrapper-container {
|
|
2
|
-
display: flex;
|
|
3
|
-
justify-content: center;
|
|
4
|
-
align-items: center;
|
|
5
|
-
cursor: pointer;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.arrow {
|
|
9
|
-
width: 0;
|
|
10
|
-
height: 0;
|
|
11
|
-
border-top: 0.5rem solid transparent;
|
|
12
|
-
border-bottom: 0.5rem solid transparent;
|
|
13
|
-
border-radius: 6px;
|
|
14
|
-
z-index: 10;
|
|
15
|
-
|
|
16
|
-
&.right {
|
|
17
|
-
filter: drop-shadow(2px 0px 0px #244a6e22);
|
|
18
|
-
border-left: 0.5rem solid white;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
&.left {
|
|
22
|
-
filter: drop-shadow(-1px 0px 0px #244a6e22);
|
|
23
|
-
border-right: 0.5rem solid white;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.event {
|
|
28
|
-
background: white;
|
|
29
|
-
border-radius: 0.8rem;
|
|
30
|
-
padding: 1rem;
|
|
31
|
-
width: 100%;
|
|
32
|
-
margin: 1rem 0;
|
|
33
|
-
|
|
34
|
-
&.enableAnimation:hover {
|
|
35
|
-
padding: 2rem;
|
|
36
|
-
transition: all 0.5s ease-in-out;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
&.enableAnimation:not(:hover) {
|
|
40
|
-
padding: 1rem;
|
|
41
|
-
transition: all 0.5s ease-in-out;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
&:not(.hour) {
|
|
45
|
-
background: #ffffff 0% 0% no-repeat padding-box;
|
|
46
|
-
box-shadow: 0px 3px 6px #244a6e52;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
&.hour {
|
|
50
|
-
padding: 0.5rem;
|
|
51
|
-
background: none;
|
|
52
|
-
display: flex;
|
|
53
|
-
justify-content: center;
|
|
54
|
-
align-items: center;
|
|
55
|
-
|
|
56
|
-
&.right {
|
|
57
|
-
justify-content: flex-start;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
&.left {
|
|
61
|
-
justify-content: flex-end;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.hour-inner-container {
|
|
66
|
-
margin: 0;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.event-container {
|
|
71
|
-
display: flex;
|
|
72
|
-
|
|
73
|
-
&.reverse {
|
|
74
|
-
flex-direction: row-reverse;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.event-info-container {
|
|
78
|
-
display: flex;
|
|
79
|
-
flex-direction: column;
|
|
80
|
-
align-items: flex-start;
|
|
81
|
-
padding: 0.1rem;
|
|
82
|
-
flex: 88 88 0;
|
|
83
|
-
|
|
84
|
-
.event-info-header {
|
|
85
|
-
display: flex;
|
|
86
|
-
align-items: center;
|
|
87
|
-
width: 100%;
|
|
88
|
-
|
|
89
|
-
.icon-container {
|
|
90
|
-
margin-right: 0.3rem;
|
|
91
|
-
|
|
92
|
-
nb-icon {
|
|
93
|
-
color: orange;
|
|
94
|
-
width: 1.5rem;
|
|
95
|
-
height: 1.5rem;
|
|
96
|
-
margin-bottom: 0.1rem;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.title-container {
|
|
101
|
-
font-weight: bold;
|
|
102
|
-
font-size: 15px;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.event-info-body {
|
|
107
|
-
padding: 0.5rem 0;
|
|
108
|
-
display: flex;
|
|
109
|
-
flex-direction: column;
|
|
110
|
-
justify-content: flex-start;
|
|
111
|
-
overflow-wrap: anywhere;
|
|
112
|
-
|
|
113
|
-
.event-info-description {
|
|
114
|
-
margin-bottom: 0.5rem;
|
|
115
|
-
font-size: 13px;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.expiration-container, .category-container {
|
|
119
|
-
display: flex;
|
|
120
|
-
font-size: 13px;
|
|
121
|
-
justify-content: flex-start;
|
|
122
|
-
align-items: center;
|
|
123
|
-
|
|
124
|
-
p {
|
|
125
|
-
font-size: 13px;
|
|
126
|
-
margin: 0;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.expiration-label, .category-label {
|
|
130
|
-
margin-right: 0.5rem;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.expiration-value, .category-value {
|
|
134
|
-
font-weight: bold;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.event-info-footer {
|
|
140
|
-
font-size: 15px;
|
|
141
|
-
cursor: pointer;
|
|
142
|
-
padding-top: 1rem;
|
|
143
|
-
|
|
144
|
-
.footer-inner-container {
|
|
145
|
-
display: flex;
|
|
146
|
-
justify-content: flex-start;
|
|
147
|
-
align-items: flex-end;
|
|
148
|
-
|
|
149
|
-
nb-icon {
|
|
150
|
-
color: #006cb4;
|
|
151
|
-
width: 1rem;
|
|
152
|
-
height: 1rem;
|
|
153
|
-
margin-bottom: 0.1rem;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
p {
|
|
158
|
-
margin: 0;
|
|
159
|
-
color: #006cb4;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.event-divider-container {
|
|
165
|
-
display: flex;
|
|
166
|
-
justify-content: center;
|
|
167
|
-
align-items: center;
|
|
168
|
-
padding: 0.1rem;
|
|
169
|
-
flex: 5 5 0;
|
|
170
|
-
|
|
171
|
-
hr {
|
|
172
|
-
height: 100%;
|
|
173
|
-
width: 1px;
|
|
174
|
-
background: #e9e9e9;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.event-date-container {
|
|
179
|
-
display: flex;
|
|
180
|
-
justify-content: center;
|
|
181
|
-
align-items: center;
|
|
182
|
-
flex-direction: column;
|
|
183
|
-
padding: 0.1rem;
|
|
184
|
-
flex: 15 15 0;
|
|
185
|
-
|
|
186
|
-
p {
|
|
187
|
-
margin: 0;
|
|
188
|
-
text-align: center;
|
|
189
|
-
|
|
190
|
-
&.day {
|
|
191
|
-
font-size: 32px;
|
|
192
|
-
font-weight: bold;
|
|
193
|
-
padding: 0.5rem 0;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { NgxTimelineEventComponent } from './ngx-timeline-event.component';
|
|
4
|
-
import { NgxTimelineItemPosition } from '../../models';
|
|
5
|
-
import localeIt from '@angular/common/locales/it';
|
|
6
|
-
import { registerLocaleData } from '@angular/common';
|
|
7
|
-
|
|
8
|
-
registerLocaleData(localeIt);
|
|
9
|
-
|
|
10
|
-
const year = 2021;
|
|
11
|
-
const monthIndex = 7;
|
|
12
|
-
const day = 19;
|
|
13
|
-
const event = {
|
|
14
|
-
type: "event",
|
|
15
|
-
position: NgxTimelineItemPosition.ON_LEFT,
|
|
16
|
-
periodInfo: {
|
|
17
|
-
periodKey: '08/2021',
|
|
18
|
-
year: year,
|
|
19
|
-
month: monthIndex + 1,
|
|
20
|
-
day: day,
|
|
21
|
-
firstDate: new Date(year, monthIndex, day)
|
|
22
|
-
},
|
|
23
|
-
eventInfo: {
|
|
24
|
-
timestamp: new Date(year, monthIndex, day),
|
|
25
|
-
title: 'event title',
|
|
26
|
-
description: 'event description',
|
|
27
|
-
id: '1'
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
describe('NgxTimelineEventComponent', () => {
|
|
31
|
-
let component: NgxTimelineEventComponent;
|
|
32
|
-
let fixture: ComponentFixture<NgxTimelineEventComponent>;
|
|
33
|
-
|
|
34
|
-
beforeEach(async () => {
|
|
35
|
-
await TestBed.configureTestingModule({
|
|
36
|
-
declarations: [ NgxTimelineEventComponent ]
|
|
37
|
-
})
|
|
38
|
-
.compileComponents();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
beforeEach(() => {
|
|
42
|
-
fixture = TestBed.createComponent(NgxTimelineEventComponent);
|
|
43
|
-
component = fixture.componentInstance;
|
|
44
|
-
component.event = event;
|
|
45
|
-
fixture.detectChanges();
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('should create', () => {
|
|
49
|
-
expect(component).toBeTruthy();
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
describe('should getDateObj', () => {
|
|
53
|
-
it('without event', () => {
|
|
54
|
-
component.event = null;
|
|
55
|
-
const res = component.getDateObj();
|
|
56
|
-
expect(res).toEqual({day: undefined, month: undefined, year: undefined});
|
|
57
|
-
});
|
|
58
|
-
it('without event info', () => {
|
|
59
|
-
component.event = {};
|
|
60
|
-
const res = component.getDateObj();
|
|
61
|
-
expect(res).toEqual({day: undefined, month: undefined, year: undefined});
|
|
62
|
-
});
|
|
63
|
-
it('without event info timestamp', () => {
|
|
64
|
-
component.event = {eventInfo: null};
|
|
65
|
-
const res = component.getDateObj();
|
|
66
|
-
expect(res).toEqual({day: undefined, month: undefined, year: undefined});
|
|
67
|
-
});
|
|
68
|
-
it('should getDateObj without langCode', () => {
|
|
69
|
-
const res = component.getDateObj();
|
|
70
|
-
expect(res).toEqual({day: '19', month: 'Aug', year: 2021});
|
|
71
|
-
});
|
|
72
|
-
it('should getDateObj with supported langCode', () => {
|
|
73
|
-
component.langCode = 'en';
|
|
74
|
-
const res = component.getDateObj();
|
|
75
|
-
expect(res).toEqual({day: '19', month: 'Aug', year: 2021});
|
|
76
|
-
});
|
|
77
|
-
it('should getDateObj with another supported langCode', () => {
|
|
78
|
-
component.langCode = 'it';
|
|
79
|
-
const res = component.getDateObj();
|
|
80
|
-
expect(res).toEqual({day: '19', month: 'ago', year: 2021});
|
|
81
|
-
});
|
|
82
|
-
it('should getDateObj with unsupported langCode', () => {
|
|
83
|
-
component.langCode = 'xx';
|
|
84
|
-
const res = component.getDateObj();
|
|
85
|
-
expect(res).toEqual({day: '19', month: 'Aug', year: 2021});
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
});
|