@memberjunction/ng-timeline 1.8.0 → 2.0.0
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AfterViewInit } from '@angular/core';
|
|
2
2
|
import { BaseEntity, RunViewParams } from '@memberjunction/core';
|
|
3
|
-
import {
|
|
3
|
+
import { TimelineEvent } from "@progress/kendo-angular-layout";
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
@@ -10,10 +10,18 @@ export declare class TimelineGroup {
|
|
|
10
10
|
* Entity name for the type of records to be displayed in this group
|
|
11
11
|
*/
|
|
12
12
|
EntityName: string;
|
|
13
|
+
/**
|
|
14
|
+
* Specifies if the data will come from a provided array of BaseEntity objects - the EntityObjects array, or alternatively, from this object running its own view against the provided EntityName, optionally with a provided Filter (or without).
|
|
15
|
+
*/
|
|
16
|
+
DataSourceType: 'array' | 'entity';
|
|
17
|
+
/**
|
|
18
|
+
* An optional filter that will be applied to the entity specified to reduce the number of records displayed
|
|
19
|
+
*/
|
|
20
|
+
Filter?: string;
|
|
13
21
|
/**
|
|
14
22
|
* The actual data you want displayed in this group. This is an array of BaseEntity objects that will be displayed in the timeline. You can populate this array from a view or any other source.
|
|
15
23
|
*/
|
|
16
|
-
EntityObjects
|
|
24
|
+
EntityObjects?: BaseEntity[];
|
|
17
25
|
/**
|
|
18
26
|
* The name of the field in the entity that contains the title of the record that will be displayed in the timeline
|
|
19
27
|
*/
|
|
@@ -25,7 +33,7 @@ export declare class TimelineGroup {
|
|
|
25
33
|
/**
|
|
26
34
|
* Use standard or custom icons, if custom is specified, the DisplayIcon property must be set
|
|
27
35
|
*/
|
|
28
|
-
DisplayIconMode
|
|
36
|
+
DisplayIconMode?: 'standard' | 'custom';
|
|
29
37
|
/**
|
|
30
38
|
* Only used if DisplayIconMode is set to custom, the CSS class name to use from Font Awesome (or any other library that has styles pre-loaded), for the span that will be shown
|
|
31
39
|
*/
|
|
@@ -33,7 +41,7 @@ export declare class TimelineGroup {
|
|
|
33
41
|
/**
|
|
34
42
|
* Color mode for items in this group, defaults to auto-selected in which case the color will be determined by the system automatically based on the # of groups
|
|
35
43
|
*/
|
|
36
|
-
DisplayColorMode
|
|
44
|
+
DisplayColorMode?: 'auto' | 'manual';
|
|
37
45
|
/**
|
|
38
46
|
* Only used if DisplayColorMode is set to manual, the color to use for the items in this group. Any valid color string that can be set into the element style via CSS is valid here.
|
|
39
47
|
*/
|
|
@@ -42,12 +50,12 @@ export declare class TimelineGroup {
|
|
|
42
50
|
* When set to field, the SummaryFieldName will be used to display detailed information about the record in the timeline. If set to custom, you need to provide
|
|
43
51
|
* a function for the SummaryFunction property. If set to none, no summary will be displayed.
|
|
44
52
|
*/
|
|
45
|
-
SummaryMode
|
|
53
|
+
SummaryMode?: 'field' | 'custom' | 'none';
|
|
46
54
|
/**
|
|
47
55
|
* When SummaryMode is set to 'custom', this function will be used to generate the summary for the record. The function should take a single parameter, the BaseEntity object and will return a string.
|
|
48
56
|
* The string returned can be plain text or HTML and will be displayed in the timeline.
|
|
49
57
|
*/
|
|
50
|
-
SummaryFunction?: ((record:
|
|
58
|
+
SummaryFunction?: ((record: any) => string) | undefined;
|
|
51
59
|
/**
|
|
52
60
|
* Creates a new instance of the TimelineGroup class using the information from the RunViewParams provided.
|
|
53
61
|
* After receiving back the new object, you can set other properties of the new instance as appropriate.
|
|
@@ -61,6 +69,7 @@ export declare class TimelineGroup {
|
|
|
61
69
|
*/
|
|
62
70
|
export declare class TimelineComponent implements AfterViewInit {
|
|
63
71
|
private _groups;
|
|
72
|
+
DisplayOrientation: 'horizontal' | 'vertical';
|
|
64
73
|
/**
|
|
65
74
|
* Provide an array of one or more TimelineGroup objects to display the data in the timeline. Each group will be displayed in a different color and icon.
|
|
66
75
|
*/
|
|
@@ -73,14 +82,18 @@ export declare class TimelineComponent implements AfterViewInit {
|
|
|
73
82
|
*/
|
|
74
83
|
get AllowLoad(): boolean;
|
|
75
84
|
set AllowLoad(value: boolean);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
ngAfterViewInit(): void;
|
|
85
|
+
events: TimelineEvent[];
|
|
86
|
+
ngAfterViewInit(): Promise<void>;
|
|
79
87
|
/**
|
|
80
88
|
* This method refreshes the timeline with the data from the provided parameters.
|
|
81
89
|
*/
|
|
82
|
-
Refresh(): void
|
|
83
|
-
|
|
90
|
+
Refresh(): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* This method loads the data for a single group and adds it to the timelineGroupEvents array.
|
|
93
|
+
* @param group
|
|
94
|
+
*/
|
|
95
|
+
protected LoadSingleGroup(group: TimelineGroup): Promise<void>;
|
|
96
|
+
protected mapEntityObjectsToEvents(group: TimelineGroup, entityObjects: BaseEntity[]): TimelineEvent[];
|
|
84
97
|
static ɵfac: i0.ɵɵFactoryDeclaration<TimelineComponent, never>;
|
|
85
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<TimelineComponent, "mj-timeline", never, { "Groups": { "alias": "Groups"; "required": false; }; "AllowLoad": { "alias": "AllowLoad"; "required": false; }; }, {}, never, never, false, never>;
|
|
98
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TimelineComponent, "mj-timeline", never, { "DisplayOrientation": { "alias": "DisplayOrientation"; "required": false; }; "Groups": { "alias": "Groups"; "required": false; }; "AllowLoad": { "alias": "AllowLoad"; "required": false; }; }, {}, never, never, false, never>;
|
|
86
99
|
}
|
|
@@ -11,21 +11,16 @@ import { Component, Input } from '@angular/core';
|
|
|
11
11
|
import { RunView } from '@memberjunction/core';
|
|
12
12
|
import * as i0 from "@angular/core";
|
|
13
13
|
import * as i1 from "@memberjunction/ng-container-directives";
|
|
14
|
-
import * as i2 from "@progress/kendo-angular-
|
|
15
|
-
function TimelineComponent_ng_template_2_Template(rf, ctx) { if (rf & 1) {
|
|
16
|
-
i0.ɵɵelementStart(0, "span", 3);
|
|
17
|
-
i0.ɵɵtext(1);
|
|
18
|
-
i0.ɵɵelementEnd();
|
|
19
|
-
} if (rf & 2) {
|
|
20
|
-
const event_r1 = ctx.event;
|
|
21
|
-
i0.ɵɵadvance();
|
|
22
|
-
i0.ɵɵtextInterpolate(event_r1.title);
|
|
23
|
-
} }
|
|
14
|
+
import * as i2 from "@progress/kendo-angular-layout";
|
|
24
15
|
/**
|
|
25
16
|
*
|
|
26
17
|
*/
|
|
27
18
|
export class TimelineGroup {
|
|
28
19
|
constructor() {
|
|
20
|
+
/**
|
|
21
|
+
* Specifies if the data will come from a provided array of BaseEntity objects - the EntityObjects array, or alternatively, from this object running its own view against the provided EntityName, optionally with a provided Filter (or without).
|
|
22
|
+
*/
|
|
23
|
+
this.DataSourceType = 'entity';
|
|
29
24
|
/**
|
|
30
25
|
* The actual data you want displayed in this group. This is an array of BaseEntity objects that will be displayed in the timeline. You can populate this array from a view or any other source.
|
|
31
26
|
*/
|
|
@@ -70,9 +65,13 @@ export class TimelineGroup {
|
|
|
70
65
|
export class TimelineComponent {
|
|
71
66
|
constructor() {
|
|
72
67
|
this._groups = [];
|
|
68
|
+
this.DisplayOrientation = 'vertical';
|
|
73
69
|
this._deferLoadCount = 0;
|
|
74
70
|
this._allowLoad = true;
|
|
75
|
-
|
|
71
|
+
/*
|
|
72
|
+
* events is the array of timeline events that gets updated on each call of LoadSingleGroup.
|
|
73
|
+
* timelineGroupEvents is the array of total timeline events that will get called used by the timeline component.
|
|
74
|
+
*/
|
|
76
75
|
this.events = [];
|
|
77
76
|
}
|
|
78
77
|
/**
|
|
@@ -100,61 +99,94 @@ export class TimelineComponent {
|
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
101
|
ngAfterViewInit() {
|
|
103
|
-
|
|
104
|
-
this.
|
|
102
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
if (this.AllowLoad)
|
|
104
|
+
yield this.Refresh();
|
|
105
|
+
});
|
|
105
106
|
}
|
|
106
107
|
/**
|
|
107
108
|
* This method refreshes the timeline with the data from the provided parameters.
|
|
108
109
|
*/
|
|
109
110
|
Refresh() {
|
|
110
|
-
|
|
111
|
-
this.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
this.events.splice(0, this.events.length); // clear out what we have
|
|
113
|
+
if (this.Groups && this.Groups.length > 0) {
|
|
114
|
+
for (const g of this.Groups) {
|
|
115
|
+
yield this.LoadSingleGroup(g);
|
|
116
|
+
}
|
|
115
117
|
}
|
|
116
|
-
}
|
|
118
|
+
});
|
|
117
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* This method loads the data for a single group and adds it to the timelineGroupEvents array.
|
|
122
|
+
* @param group
|
|
123
|
+
*/
|
|
118
124
|
LoadSingleGroup(group) {
|
|
119
|
-
this
|
|
125
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
+
// load up the events for the specified group into the events array
|
|
127
|
+
let newItems = [];
|
|
128
|
+
switch (group.DataSourceType) {
|
|
129
|
+
case 'array':
|
|
130
|
+
// use the provided array
|
|
131
|
+
if (!group.EntityObjects)
|
|
132
|
+
throw new Error("No EntityObjects provided for group");
|
|
133
|
+
newItems = this.mapEntityObjectsToEvents(group, group.EntityObjects);
|
|
134
|
+
break;
|
|
135
|
+
case 'entity':
|
|
136
|
+
// use run view
|
|
137
|
+
const rv = new RunView();
|
|
138
|
+
const result = yield rv.RunView({
|
|
139
|
+
EntityName: group.EntityName,
|
|
140
|
+
ExtraFilter: group.Filter,
|
|
141
|
+
ResultType: 'entity_object'
|
|
142
|
+
});
|
|
143
|
+
if (result && result.Success)
|
|
144
|
+
newItems = this.mapEntityObjectsToEvents(group, result.Results);
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
this.events.push(...newItems);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
mapEntityObjectsToEvents(group, entityObjects) {
|
|
151
|
+
const ret = entityObjects.map(e => {
|
|
120
152
|
let date = new Date(e.Get(group.DateFieldName));
|
|
121
153
|
let title = e.Get(group.TitleFieldName);
|
|
122
154
|
let summary = "";
|
|
123
155
|
if (group.SummaryMode == 'field') {
|
|
124
156
|
summary = e.Get(group.TitleFieldName);
|
|
125
157
|
}
|
|
126
|
-
else if (group.SummaryMode == 'custom'
|
|
127
|
-
summary = group.SummaryFunction(e);
|
|
158
|
+
else if (group.SummaryMode == 'custom') {
|
|
159
|
+
summary = group.SummaryFunction ? group.SummaryFunction(e) : "";
|
|
128
160
|
}
|
|
129
161
|
return {
|
|
130
|
-
id: e.Get("ID"),
|
|
131
|
-
title: title,
|
|
132
|
-
start: date,
|
|
133
|
-
end: date,
|
|
134
|
-
isAllDay: true,
|
|
135
162
|
description: summary,
|
|
136
|
-
|
|
137
|
-
|
|
163
|
+
date: date,
|
|
164
|
+
title: title,
|
|
165
|
+
subtitle: date.toDateString(),
|
|
166
|
+
images: [],
|
|
167
|
+
actions: [],
|
|
138
168
|
};
|
|
139
169
|
});
|
|
170
|
+
return ret;
|
|
140
171
|
}
|
|
141
172
|
}
|
|
142
173
|
TimelineComponent.ɵfac = function TimelineComponent_Factory(t) { return new (t || TimelineComponent)(); };
|
|
143
|
-
TimelineComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TimelineComponent, selectors: [["mj-timeline"]], inputs: { Groups: "Groups", AllowLoad: "AllowLoad" }, decls:
|
|
144
|
-
i0.ɵɵelementStart(0, "div", 0)
|
|
145
|
-
i0.ɵɵ
|
|
146
|
-
i0.ɵɵ
|
|
147
|
-
i0.ɵɵelementEnd()();
|
|
174
|
+
TimelineComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TimelineComponent, selectors: [["mj-timeline"]], inputs: { DisplayOrientation: "DisplayOrientation", Groups: "Groups", AllowLoad: "AllowLoad" }, decls: 2, vars: 4, consts: [["mjFillContainer", "", 1, "wrapper"], [3, "events", "orientation", "collapsibleEvents", "alterMode"]], template: function TimelineComponent_Template(rf, ctx) { if (rf & 1) {
|
|
175
|
+
i0.ɵɵelementStart(0, "div", 0);
|
|
176
|
+
i0.ɵɵelement(1, "kendo-timeline", 1);
|
|
177
|
+
i0.ɵɵelementEnd();
|
|
148
178
|
} if (rf & 2) {
|
|
149
179
|
i0.ɵɵadvance();
|
|
150
|
-
i0.ɵɵproperty("events", ctx.events)("
|
|
151
|
-
} }, dependencies: [i1.FillContainer, i2.
|
|
180
|
+
i0.ɵɵproperty("events", ctx.events)("orientation", ctx.DisplayOrientation)("collapsibleEvents", true)("alterMode", true);
|
|
181
|
+
} }, dependencies: [i1.FillContainer, i2.TimelineComponent] });
|
|
152
182
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TimelineComponent, [{
|
|
153
183
|
type: Component,
|
|
154
|
-
args: [{ selector: 'mj-timeline', template: "<div mjFillContainer class=\"wrapper\"> \n
|
|
155
|
-
}], null, {
|
|
184
|
+
args: [{ selector: 'mj-timeline', template: "<div mjFillContainer class=\"wrapper\"> \n <kendo-timeline\n [events]=\"events\"\n [orientation]=\"DisplayOrientation\"\n [collapsibleEvents]=\"true\"\n [alterMode]=\"true\"\n >\n </kendo-timeline>\n</div> " }]
|
|
185
|
+
}], null, { DisplayOrientation: [{
|
|
186
|
+
type: Input
|
|
187
|
+
}], Groups: [{
|
|
156
188
|
type: Input
|
|
157
189
|
}], AllowLoad: [{
|
|
158
190
|
type: Input
|
|
159
191
|
}] }); })();
|
|
160
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TimelineComponent, { className: "TimelineComponent"
|
|
192
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TimelineComponent, { className: "TimelineComponent" }); })();
|
package/dist/lib/module.d.ts
CHANGED
|
@@ -6,9 +6,8 @@ import * as i4 from "@progress/kendo-angular-buttons";
|
|
|
6
6
|
import * as i5 from "@memberjunction/ng-entity-form-dialog";
|
|
7
7
|
import * as i6 from "@progress/kendo-angular-indicators";
|
|
8
8
|
import * as i7 from "@progress/kendo-angular-layout";
|
|
9
|
-
import * as i8 from "@progress/kendo-angular-scheduler";
|
|
10
9
|
export declare class TimelineModule {
|
|
11
10
|
static ɵfac: i0.ɵɵFactoryDeclaration<TimelineModule, never>;
|
|
12
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<TimelineModule, [typeof i1.TimelineComponent], [typeof i2.CommonModule, typeof i3.ContainerDirectivesModule, typeof i4.ButtonsModule, typeof i5.EntityFormDialogModule, typeof i6.IndicatorsModule, typeof i7.LayoutModule
|
|
11
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<TimelineModule, [typeof i1.TimelineComponent], [typeof i2.CommonModule, typeof i3.ContainerDirectivesModule, typeof i4.ButtonsModule, typeof i5.EntityFormDialogModule, typeof i6.IndicatorsModule, typeof i7.LayoutModule], [typeof i1.TimelineComponent]>;
|
|
13
12
|
static ɵinj: i0.ɵɵInjectorDeclaration<TimelineModule>;
|
|
14
13
|
}
|
package/dist/lib/module.js
CHANGED
|
@@ -4,7 +4,6 @@ import { CommonModule } from '@angular/common';
|
|
|
4
4
|
import { ButtonsModule } from '@progress/kendo-angular-buttons';
|
|
5
5
|
import { IndicatorsModule } from '@progress/kendo-angular-indicators';
|
|
6
6
|
import { LayoutModule } from '@progress/kendo-angular-layout';
|
|
7
|
-
import { SchedulerModule } from '@progress/kendo-angular-scheduler';
|
|
8
7
|
// MJ
|
|
9
8
|
import { ContainerDirectivesModule } from '@memberjunction/ng-container-directives';
|
|
10
9
|
import { EntityFormDialogModule } from '@memberjunction/ng-entity-form-dialog';
|
|
@@ -20,8 +19,7 @@ TimelineModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonMod
|
|
|
20
19
|
ButtonsModule,
|
|
21
20
|
EntityFormDialogModule,
|
|
22
21
|
IndicatorsModule,
|
|
23
|
-
LayoutModule
|
|
24
|
-
SchedulerModule] });
|
|
22
|
+
LayoutModule] });
|
|
25
23
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TimelineModule, [{
|
|
26
24
|
type: NgModule,
|
|
27
25
|
args: [{
|
|
@@ -34,8 +32,7 @@ TimelineModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonMod
|
|
|
34
32
|
ButtonsModule,
|
|
35
33
|
EntityFormDialogModule,
|
|
36
34
|
IndicatorsModule,
|
|
37
|
-
LayoutModule
|
|
38
|
-
SchedulerModule
|
|
35
|
+
LayoutModule
|
|
39
36
|
],
|
|
40
37
|
exports: [
|
|
41
38
|
TimelineComponent
|
|
@@ -47,5 +44,4 @@ TimelineModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonMod
|
|
|
47
44
|
ButtonsModule,
|
|
48
45
|
EntityFormDialogModule,
|
|
49
46
|
IndicatorsModule,
|
|
50
|
-
LayoutModule,
|
|
51
|
-
SchedulerModule], exports: [TimelineComponent] }); })();
|
|
47
|
+
LayoutModule], exports: [TimelineComponent] }); })();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ng-timeline",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "MemberJunction: Timeline Display UI component",
|
|
5
5
|
"main": "./dist/public-api.js",
|
|
6
6
|
"typings": "./dist/public-api.d.ts",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"@angular/router": "18.0.2"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@memberjunction/core-entities": "
|
|
29
|
-
"@memberjunction/global": "
|
|
30
|
-
"@memberjunction/core": "
|
|
31
|
-
"@memberjunction/ng-container-directives": "
|
|
32
|
-
"@memberjunction/ng-entity-form-dialog": "
|
|
33
|
-
"@memberjunction/ng-shared": "
|
|
28
|
+
"@memberjunction/core-entities": "2.0.0",
|
|
29
|
+
"@memberjunction/global": "2.0.0",
|
|
30
|
+
"@memberjunction/core": "2.0.0",
|
|
31
|
+
"@memberjunction/ng-container-directives": "2.0.0",
|
|
32
|
+
"@memberjunction/ng-entity-form-dialog": "2.0.0",
|
|
33
|
+
"@memberjunction/ng-shared": "2.0.0",
|
|
34
34
|
"@progress/kendo-angular-buttons": "16.2.0",
|
|
35
35
|
"@progress/kendo-angular-layout": "16.2.0",
|
|
36
36
|
"@progress/kendo-angular-indicators": "16.2.0",
|