@memberjunction/ng-explorer-core 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/lib/ask-skip/ask-skip.component.d.ts +83 -0
  2. package/dist/lib/ask-skip/ask-skip.component.js +591 -0
  3. package/dist/lib/ask-skip/skip-dynamic-report-wrapper.d.ts +12 -0
  4. package/dist/lib/ask-skip/skip-dynamic-report-wrapper.js +49 -0
  5. package/dist/lib/auth-button/auth-button.component.d.ts +12 -0
  6. package/dist/lib/auth-button/auth-button.component.js +43 -0
  7. package/dist/lib/dashboard-browser-component/dashboard-browser.component.d.ts +14 -0
  8. package/dist/lib/dashboard-browser-component/dashboard-browser.component.js +55 -0
  9. package/dist/lib/data-browser-component/data-browser.component.d.ts +14 -0
  10. package/dist/lib/data-browser-component/data-browser.component.js +91 -0
  11. package/dist/lib/favorites/favorites.component.d.ts +13 -0
  12. package/dist/lib/favorites/favorites.component.js +100 -0
  13. package/dist/lib/generic/base-form-component.d.ts +76 -0
  14. package/dist/lib/generic/base-form-component.js +436 -0
  15. package/dist/lib/generic/base-form-section-component.d.ts +6 -0
  16. package/dist/lib/generic/base-form-section-component.js +10 -0
  17. package/dist/lib/generic/base-record-component.d.ts +6 -0
  18. package/dist/lib/generic/base-record-component.js +13 -0
  19. package/dist/lib/generic/base-resource-component.d.ts +34 -0
  20. package/dist/lib/generic/base-resource-component.js +75 -0
  21. package/dist/lib/generic/dynamic-chart.d.ts +26 -0
  22. package/dist/lib/generic/dynamic-chart.js +180 -0
  23. package/dist/lib/generic/dynamic-grid.d.ts +24 -0
  24. package/dist/lib/generic/dynamic-grid.js +135 -0
  25. package/dist/lib/generic/dynamic-report.d.ts +38 -0
  26. package/dist/lib/generic/dynamic-report.js +399 -0
  27. package/dist/lib/generic/form-toolbar.d.ts +7 -0
  28. package/dist/lib/generic/form-toolbar.js +98 -0
  29. package/dist/lib/generic/resource-container-component.d.ts +25 -0
  30. package/dist/lib/generic/resource-container-component.js +103 -0
  31. package/dist/lib/generic/section-loader-component.d.ts +17 -0
  32. package/dist/lib/generic/section-loader-component.js +65 -0
  33. package/dist/lib/generic-browse-list/generic-browse-list.component.d.ts +16 -0
  34. package/dist/lib/generic-browse-list/generic-browse-list.component.js +91 -0
  35. package/dist/lib/guards/auth-guard.service.d.ts +11 -0
  36. package/dist/lib/guards/auth-guard.service.js +24 -0
  37. package/dist/lib/guards/entities.guard.d.ts +3 -0
  38. package/dist/lib/guards/entities.guard.js +38 -0
  39. package/dist/lib/header/MSFT_UserImageService.d.ts +11 -0
  40. package/dist/lib/header/MSFT_UserImageService.js +23 -0
  41. package/dist/lib/header/header.component.d.ts +51 -0
  42. package/dist/lib/header/header.component.js +208 -0
  43. package/dist/lib/home-component/home.component.d.ts +9 -0
  44. package/dist/lib/home-component/home.component.js +54 -0
  45. package/dist/lib/join-grid/join-grid.component.d.ts +30 -0
  46. package/dist/lib/join-grid/join-grid.component.js +225 -0
  47. package/dist/lib/navigation/navigation.component.d.ts +102 -0
  48. package/dist/lib/navigation/navigation.component.js +970 -0
  49. package/dist/lib/report-browser-component/report-browser.component.d.ts +14 -0
  50. package/dist/lib/report-browser-component/report-browser.component.js +55 -0
  51. package/dist/lib/resource-wrappers/dashboard-resource.component.d.ts +8 -0
  52. package/dist/lib/resource-wrappers/dashboard-resource.component.js +49 -0
  53. package/dist/lib/resource-wrappers/record-resource.component.d.ts +8 -0
  54. package/dist/lib/resource-wrappers/record-resource.component.js +55 -0
  55. package/dist/lib/resource-wrappers/report-resource.component.d.ts +10 -0
  56. package/dist/lib/resource-wrappers/report-resource.component.js +53 -0
  57. package/dist/lib/resource-wrappers/resource-wrappers-loader.d.ts +1 -0
  58. package/dist/lib/resource-wrappers/resource-wrappers-loader.js +12 -0
  59. package/dist/lib/resource-wrappers/search-results-resource.component.d.ts +10 -0
  60. package/dist/lib/resource-wrappers/search-results-resource.component.js +50 -0
  61. package/dist/lib/resource-wrappers/view-resource.component.d.ts +8 -0
  62. package/dist/lib/resource-wrappers/view-resource.component.js +51 -0
  63. package/dist/lib/settings/settings.component.d.ts +5 -0
  64. package/dist/lib/settings/settings.component.js +14 -0
  65. package/dist/lib/shared/shared.service.d.ts +87 -0
  66. package/dist/lib/shared/shared.service.js +302 -0
  67. package/dist/lib/shared/urlPipe.d.ts +7 -0
  68. package/dist/lib/shared/urlPipe.js +16 -0
  69. package/dist/lib/single-application/single-application.component.d.ts +21 -0
  70. package/dist/lib/single-application/single-application.component.js +132 -0
  71. package/dist/lib/single-dashboard/Components/add-item/add-item.component.d.ts +28 -0
  72. package/dist/lib/single-dashboard/Components/add-item/add-item.component.js +212 -0
  73. package/dist/lib/single-dashboard/Components/edit-dashboard/edit-dashboard.component.d.ts +26 -0
  74. package/dist/lib/single-dashboard/Components/edit-dashboard/edit-dashboard.component.js +169 -0
  75. package/dist/lib/single-dashboard/single-dashboard.component.d.ts +55 -0
  76. package/dist/lib/single-dashboard/single-dashboard.component.js +266 -0
  77. package/dist/lib/single-entity/single-entity.component.d.ts +33 -0
  78. package/dist/lib/single-entity/single-entity.component.js +252 -0
  79. package/dist/lib/single-record/single-record.component.d.ts +20 -0
  80. package/dist/lib/single-record/single-record.component.js +95 -0
  81. package/dist/lib/single-report/single-report.component.d.ts +22 -0
  82. package/dist/lib/single-report/single-report.component.js +87 -0
  83. package/dist/lib/single-search-result/single-search-result.component.d.ts +15 -0
  84. package/dist/lib/single-search-result/single-search-result.component.js +60 -0
  85. package/dist/lib/single-view/single-view.component.d.ts +34 -0
  86. package/dist/lib/single-view/single-view.component.js +154 -0
  87. package/dist/lib/user-notifications/user-notifications.component.d.ts +32 -0
  88. package/dist/lib/user-notifications/user-notifications.component.js +282 -0
  89. package/dist/lib/user-profile/user-profile.component.d.ts +10 -0
  90. package/dist/lib/user-profile/user-profile.component.js +41 -0
  91. package/dist/lib/user-view-properties/view-properties-dialog.component.d.ts +70 -0
  92. package/dist/lib/user-view-properties/view-properties-dialog.component.js +568 -0
  93. package/dist/module.d.ts +64 -0
  94. package/dist/module.js +332 -0
  95. package/dist/public-api.d.ts +47 -0
  96. package/dist/public-api.js +50 -0
  97. package/package.json +39 -0
@@ -0,0 +1,302 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { Injectable } from '@angular/core';
11
+ import { LogError, Metadata, RunView } from '@memberjunction/core';
12
+ import { MJEventType, MJGlobal } from '@memberjunction/global';
13
+ import { Subject } from 'rxjs';
14
+ import * as i0 from "@angular/core";
15
+ import * as i1 from "@progress/kendo-angular-notification";
16
+ export class SharedService {
17
+ constructor(notificationService) {
18
+ this.notificationService = notificationService;
19
+ this.tabChange = new Subject();
20
+ this.tabChange$ = this.tabChange.asObservable();
21
+ this._currentUserImage = '/assets/user.png';
22
+ this._resourceTypeMap = [
23
+ { routeSegment: 'record', name: 'records' },
24
+ { routeSegment: 'view', name: 'user views' },
25
+ { routeSegment: 'search', name: 'search results' },
26
+ { routeSegment: 'report', name: 'reports' },
27
+ { routeSegment: 'dashboard', name: 'dashboards' }
28
+ ];
29
+ if (SharedService._instance) {
30
+ // return existing instance which will short circuit the creation of a new instance
31
+ return SharedService._instance;
32
+ }
33
+ // first time this has been called, so return ourselves since we're in the constructor
34
+ SharedService._instance = this;
35
+ MJGlobal.Instance.GetEventListener(true).subscribe((event) => {
36
+ switch (event.event) {
37
+ case MJEventType.DisplaySimpleNotificationRequest:
38
+ // received the message to display a notification to the user, so do that...
39
+ const messageData = event.args;
40
+ this.CreateSimpleNotification(messageData.message, messageData.style, messageData.DisplayDuration);
41
+ break;
42
+ case MJEventType.ComponentEvent:
43
+ if (event.eventCode === EventCodes.UserNotificationsUpdated) {
44
+ // refresh the user notifications
45
+ SharedService.RefreshUserNotifications();
46
+ }
47
+ break;
48
+ case MJEventType.LoggedIn:
49
+ if (SharedService._loaded === false)
50
+ SharedService.RefreshData();
51
+ // got the login, now subscribe to push status updates here so we can then raise them as events in MJ Global locally
52
+ this.PushStatusUpdates().subscribe((status) => {
53
+ var _a, _b;
54
+ const statusObj = JSON.parse(status.message);
55
+ // pass along as an event so anyone else who wants to know about the push status update can do stuff
56
+ MJGlobal.Instance.RaiseEvent({
57
+ event: MJEventType.ComponentEvent,
58
+ eventCode: EventCodes.PushStatusUpdates,
59
+ args: statusObj,
60
+ component: this
61
+ });
62
+ if (((_a = statusObj.type) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === 'usernotifications') {
63
+ if (statusObj.details && ((_b = statusObj.details.action) === null || _b === void 0 ? void 0 : _b.trim().toLowerCase()) === 'create') {
64
+ // we have changes to user notifications, so refresh them
65
+ this.CreateSimpleNotification('New Notification Available', "success", 2000);
66
+ SharedService.RefreshUserNotifications();
67
+ }
68
+ }
69
+ else {
70
+ // otherwise just post it as a simple notification
71
+ this.CreateSimpleNotification(statusObj.message, "success", 2500);
72
+ }
73
+ });
74
+ break;
75
+ }
76
+ });
77
+ }
78
+ static get Instance() {
79
+ return SharedService._instance;
80
+ }
81
+ /**
82
+ * Returns the current session ID, which is automatically created when the service is instantiated.
83
+ */
84
+ get SessionId() {
85
+ return Metadata.Provider.sessionId;
86
+ }
87
+ get ResourceTypes() {
88
+ return SharedService._resourceTypes;
89
+ }
90
+ get ViewResourceType() {
91
+ return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === 'user views');
92
+ }
93
+ get RecordResourceType() {
94
+ return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === 'records');
95
+ }
96
+ get DashboardResourceType() {
97
+ return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === 'dashboards');
98
+ }
99
+ get ReportResourceType() {
100
+ return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === 'reports');
101
+ }
102
+ get SearchResultsResourceType() {
103
+ return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === 'search results');
104
+ }
105
+ ResourceTypeByID(id) {
106
+ return SharedService._resourceTypes.find(rt => rt.ID === id);
107
+ }
108
+ ResourceTypeByName(name) {
109
+ return SharedService._resourceTypes.find(rt => rt.Name.trim().toLowerCase() === name.trim().toLowerCase());
110
+ }
111
+ static RefreshData() {
112
+ return __awaiter(this, void 0, void 0, function* () {
113
+ // if we have a provider, then we can load the data, otherwise load isn't done yet
114
+ const md = new Metadata();
115
+ const rtResult = yield md.GetAndCacheDatasetByName('ResourceTypes');
116
+ if (rtResult && rtResult.Success) {
117
+ const data = rtResult.Results.find(r => r.EntityName === 'Resource Types');
118
+ if (data) {
119
+ SharedService._resourceTypes = data.Results;
120
+ SharedService._loaded = true;
121
+ }
122
+ }
123
+ SharedService.RefreshUserNotifications(); // also call this initially when refreshing the dataset...
124
+ });
125
+ }
126
+ FormatColumnValue(col, value, maxLength = 0, trailingChars = "...") {
127
+ if (value === null || value === undefined)
128
+ return value;
129
+ try {
130
+ const retVal = col.EntityField.FormatValue(value, 0);
131
+ if (maxLength > 0 && retVal && retVal.length > maxLength)
132
+ return retVal.substring(0, maxLength) + trailingChars;
133
+ else
134
+ return retVal;
135
+ }
136
+ catch (e) {
137
+ LogError(e);
138
+ return value;
139
+ }
140
+ }
141
+ ConvertMarkdownStringToHtmlList(listType, text) {
142
+ const listTag = listType === HtmlListType.Unordered ? 'ul' : 'ol';
143
+ if (!text.includes('\n')) {
144
+ return text;
145
+ }
146
+ const listItems = text.split('\n').map(line => `<li>${line.trim().replace(/^-\s*/, '')}</li>`).join('');
147
+ return `<${listTag}>${listItems}</${listTag}>`;
148
+ }
149
+ InvokeManualResize(delay = 50) {
150
+ setTimeout(() => {
151
+ MJGlobal.Instance.RaiseEvent({
152
+ event: MJEventType.ManualResizeRequest,
153
+ eventCode: '',
154
+ args: null,
155
+ component: this
156
+ });
157
+ }, delay); // give the tabstrip time to render
158
+ }
159
+ PushStatusUpdates() {
160
+ const gp = Metadata.Provider;
161
+ return gp.PushStatusUpdates();
162
+ }
163
+ get CurrentUserImage() {
164
+ return this._currentUserImage;
165
+ }
166
+ set CurrentUserImage(value) {
167
+ this._currentUserImage = value;
168
+ }
169
+ static get UserNotifications() {
170
+ return SharedService._userNotifications;
171
+ }
172
+ static get UnreadUserNotifications() {
173
+ return SharedService._userNotifications.filter(n => n.Unread);
174
+ }
175
+ static get UnreadUserNotificationCount() {
176
+ return SharedService.UnreadUserNotifications.length;
177
+ }
178
+ /**
179
+ * Creates a notification in the database and refreshes the UI. Returns the notification object.
180
+ * @param title
181
+ * @param message
182
+ * @param resourceTypeId
183
+ * @param resourceRecordId
184
+ * @param resourceConfiguration Any object, it is converted to a string by JSON.stringify and stored in the database
185
+ * @returns
186
+ */
187
+ CreateNotification(title, message, resourceTypeId, resourceRecordId, resourceConfiguration) {
188
+ return __awaiter(this, void 0, void 0, function* () {
189
+ const md = new Metadata();
190
+ const notification = yield md.GetEntityObject('User Notifications');
191
+ notification.Title = title;
192
+ notification.Message = message;
193
+ if (resourceTypeId)
194
+ notification.ResourceTypeID = resourceTypeId;
195
+ if (resourceRecordId)
196
+ notification.ResourceRecordID = resourceRecordId;
197
+ if (resourceConfiguration)
198
+ notification.ResourceConfiguration = JSON.stringify(resourceConfiguration);
199
+ notification.UserID = md.CurrentUser.ID;
200
+ notification.Unread = true;
201
+ const result = yield notification.Save();
202
+ if (result) {
203
+ SharedService.RefreshUserNotifications();
204
+ }
205
+ // test
206
+ this.CreateSimpleNotification(notification.Message, "success", 2500);
207
+ return notification;
208
+ });
209
+ }
210
+ static RefreshUserNotifications() {
211
+ return __awaiter(this, void 0, void 0, function* () {
212
+ try {
213
+ const rv = new RunView();
214
+ const md = new Metadata();
215
+ const result = yield rv.RunView({
216
+ EntityName: 'User Notifications',
217
+ ExtraFilter: 'UserID=' + md.CurrentUser.ID,
218
+ OrderBy: 'CreatedAt DESC'
219
+ });
220
+ if (result && result.Success) {
221
+ SharedService._userNotifications = result.Results;
222
+ }
223
+ }
224
+ catch (e) {
225
+ LogError(e);
226
+ }
227
+ });
228
+ }
229
+ /**
230
+ * Creates a message that is not saved to the User Notifications table, but is displayed to the user.
231
+ * @param message - text to display
232
+ * @param style - display styling
233
+ * @param hideAfter - option to auto hide after the specified delay in milliseconds
234
+ */
235
+ CreateSimpleNotification(message, style = "success", hideAfter) {
236
+ const props = {
237
+ content: message,
238
+ cssClass: "button-notification",
239
+ animation: { type: "slide", duration: 400 },
240
+ position: { horizontal: "center", vertical: "top" },
241
+ type: { style: style, icon: true }
242
+ };
243
+ if (hideAfter)
244
+ props.hideAfter = hideAfter;
245
+ else
246
+ props.closable = true;
247
+ this.notificationService.show(props);
248
+ }
249
+ /**
250
+ * Maps a Resource Type record Name column to the corresponding route segment
251
+ * @param resourceTypeName
252
+ * @returns
253
+ */
254
+ mapResourceTypeNameToRouteSegment(resourceTypeName) {
255
+ const item = this._resourceTypeMap.find(rt => rt.name.trim().toLowerCase() === resourceTypeName.trim().toLowerCase());
256
+ if (item)
257
+ return item.routeSegment;
258
+ else
259
+ return null;
260
+ }
261
+ /**
262
+ * Maps a route segment to the corresponding Resource Type record Name column
263
+ * @param resourceRouteSegment
264
+ * @returns
265
+ */
266
+ mapResourceTypeRouteSegmentToName(resourceRouteSegment) {
267
+ const item = this._resourceTypeMap.find(rt => rt.routeSegment.trim().toLowerCase() === resourceRouteSegment.trim().toLowerCase());
268
+ if (item)
269
+ return item.name;
270
+ else
271
+ return null;
272
+ }
273
+ }
274
+ SharedService._loaded = false;
275
+ SharedService._resourceTypes = [];
276
+ SharedService._userNotifications = [];
277
+ SharedService.ɵfac = function SharedService_Factory(t) { return new (t || SharedService)(i0.ɵɵinject(i1.NotificationService)); };
278
+ SharedService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: SharedService, factory: SharedService.ɵfac, providedIn: 'root' });
279
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SharedService, [{
280
+ type: Injectable,
281
+ args: [{
282
+ providedIn: 'root'
283
+ }]
284
+ }], function () { return [{ type: i1.NotificationService }]; }, null); })();
285
+ export var HtmlListType;
286
+ (function (HtmlListType) {
287
+ HtmlListType[HtmlListType["Unordered"] = 0] = "Unordered";
288
+ HtmlListType[HtmlListType["Ordered"] = 1] = "Ordered";
289
+ })(HtmlListType || (HtmlListType = {}));
290
+ export var EventCodes;
291
+ (function (EventCodes) {
292
+ EventCodes["ViewClicked"] = "viewClicked";
293
+ EventCodes["EntityRecordClicked"] = "entityRecordClicked";
294
+ EventCodes["AddDashboard"] = "addDashboard";
295
+ EventCodes["AddReport"] = "addReport";
296
+ EventCodes["ViewCreated"] = "viewCreated";
297
+ EventCodes["ViewUpdated"] = "viewUpdated";
298
+ EventCodes["RunSearch"] = "runSearch";
299
+ EventCodes["ViewNotifications"] = "viewNotifications";
300
+ EventCodes["PushStatusUpdates"] = "pushStatusUpdates";
301
+ EventCodes["UserNotificationsUpdated"] = "userNotificationsUpdated";
302
+ })(EventCodes || (EventCodes = {}));
@@ -0,0 +1,7 @@
1
+ import { PipeTransform } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export declare class URLPipe implements PipeTransform {
4
+ transform(value: string): string;
5
+ static ɵfac: i0.ɵɵFactoryDeclaration<URLPipe, never>;
6
+ static ɵpipe: i0.ɵɵPipeDeclaration<URLPipe, "formatUrl", false>;
7
+ }
@@ -0,0 +1,16 @@
1
+ import { Pipe } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export class URLPipe {
4
+ transform(value) {
5
+ if (value && !value.includes('http'))
6
+ return 'https://' + value;
7
+ else
8
+ return value;
9
+ }
10
+ }
11
+ URLPipe.ɵfac = function URLPipe_Factory(t) { return new (t || URLPipe)(); };
12
+ URLPipe.ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "formatUrl", type: URLPipe, pure: true });
13
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(URLPipe, [{
14
+ type: Pipe,
15
+ args: [{ name: 'formatUrl' }]
16
+ }], null, null); })();
@@ -0,0 +1,21 @@
1
+ import { OnInit } from '@angular/core';
2
+ import { ActivatedRoute, Router } from '@angular/router';
3
+ import { ApplicationEntityInfo } from '@memberjunction/core';
4
+ import { UserFavoriteEntity } from '@memberjunction/core-entities';
5
+ import { SharedService } from '../shared/shared.service';
6
+ import * as i0 from "@angular/core";
7
+ export declare class SingleApplicationComponent implements OnInit {
8
+ private router;
9
+ private route;
10
+ private sharedService;
11
+ constructor(router: Router, route: ActivatedRoute, sharedService: SharedService);
12
+ appName: string;
13
+ appDescription: string;
14
+ appEntities: ApplicationEntityInfo[];
15
+ appFavorites: UserFavoriteEntity[];
16
+ ngOnInit(): void;
17
+ entityItemClick(info: ApplicationEntityInfo): void;
18
+ favoriteItemClick(fav: UserFavoriteEntity): void;
19
+ static ɵfac: i0.ɵɵFactoryDeclaration<SingleApplicationComponent, never>;
20
+ static ɵcmp: i0.ɵɵComponentDeclaration<SingleApplicationComponent, "app-single-application", never, {}, {}, never, never, false, never>;
21
+ }
@@ -0,0 +1,132 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { Component } from '@angular/core';
11
+ import { Metadata, RunView } from '@memberjunction/core';
12
+ import * as i0 from "@angular/core";
13
+ import * as i1 from "@angular/router";
14
+ import * as i2 from "../shared/shared.service";
15
+ import * as i3 from "@progress/kendo-angular-listview";
16
+ import * as i4 from "../favorites/favorites.component";
17
+ function SingleApplicationComponent_ng_template_11_Template(rf, ctx) { if (rf & 1) {
18
+ i0.ɵɵelementStart(0, "div", 10)(1, "div", 11);
19
+ i0.ɵɵelement(2, "span", 12);
20
+ i0.ɵɵtext(3);
21
+ i0.ɵɵelementEnd();
22
+ i0.ɵɵelementStart(4, "div", 13);
23
+ i0.ɵɵtext(5);
24
+ i0.ɵɵelementEnd()();
25
+ } if (rf & 2) {
26
+ const ctx_r0 = i0.ɵɵnextContext();
27
+ i0.ɵɵadvance(3);
28
+ i0.ɵɵtextInterpolate1(" ", ctx_r0.appName, " - Entities ");
29
+ i0.ɵɵadvance(2);
30
+ i0.ɵɵtextInterpolate(ctx_r0.appEntities.length);
31
+ } }
32
+ function SingleApplicationComponent_ng_template_12_Template(rf, ctx) { if (rf & 1) {
33
+ const _r4 = i0.ɵɵgetCurrentView();
34
+ i0.ɵɵelementStart(0, "div", 14);
35
+ i0.ɵɵlistener("click", function SingleApplicationComponent_ng_template_12_Template_div_click_0_listener() { const restoredCtx = i0.ɵɵrestoreView(_r4); const dataItem_r2 = restoredCtx.dataItem; const ctx_r3 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r3.entityItemClick(dataItem_r2)); });
36
+ i0.ɵɵtext(1);
37
+ i0.ɵɵelementEnd();
38
+ } if (rf & 2) {
39
+ const dataItem_r2 = ctx.dataItem;
40
+ i0.ɵɵadvance(1);
41
+ i0.ɵɵtextInterpolate1(" ", dataItem_r2.Entity, " ");
42
+ } }
43
+ export class SingleApplicationComponent {
44
+ constructor(router, route, sharedService) {
45
+ this.router = router;
46
+ this.route = route;
47
+ this.sharedService = sharedService;
48
+ this.appName = '';
49
+ this.appDescription = '';
50
+ this.appEntities = [];
51
+ this.appFavorites = [];
52
+ }
53
+ ngOnInit() {
54
+ this.route.paramMap.subscribe(params => {
55
+ const appName = params.get('appName');
56
+ // Perform any necessary actions with the ViewID, such as fetching data
57
+ if (appName) {
58
+ this.appName = appName;
59
+ const md = new Metadata();
60
+ const app = md.Applications.find(a => a.Name == appName);
61
+ if (app) {
62
+ this.appDescription = app.Description;
63
+ this.appEntities = app.ApplicationEntities;
64
+ const rv = new RunView();
65
+ rv.RunView({
66
+ EntityName: 'User Favorites',
67
+ ExtraFilter: `UserID=${md.CurrentUser.ID} AND EntityID IN (${app.ApplicationEntities.map(ae => ae.EntityID).join(',')})`
68
+ }).then((favorites) => __awaiter(this, void 0, void 0, function* () {
69
+ this.appFavorites = favorites.Results; // set the result in the list and let the below happen after async and it will update via data binding when done
70
+ const input = favorites.Results.map((fav) => {
71
+ return { EntityName: fav.Entity, RecordID: fav.RecordID };
72
+ });
73
+ const results = yield md.GetEntityRecordNames(input);
74
+ if (results)
75
+ results.forEach((result) => {
76
+ const fav = favorites.Results.find((f) => f.Entity == result.EntityName && f.RecordID == result.RecordID);
77
+ if (fav) {
78
+ fav.RecordName = result.Success ? result.RecordName : fav.Entity + ' ' + fav.RecordID;
79
+ }
80
+ });
81
+ }));
82
+ }
83
+ }
84
+ });
85
+ }
86
+ entityItemClick(info) {
87
+ if (info) {
88
+ const paramsArray = ['entity', info.Entity];
89
+ this.router.navigate(paramsArray);
90
+ }
91
+ }
92
+ favoriteItemClick(fav) {
93
+ if (fav) {
94
+ if (fav.Entity === 'User Views') {
95
+ // opening a view, different route
96
+ this.router.navigate(['resource', 'view', fav.RecordID]);
97
+ }
98
+ else {
99
+ this.router.navigate(['resource', 'record', fav.RecordID], { queryParams: { Entity: fav.Entity } });
100
+ }
101
+ }
102
+ }
103
+ }
104
+ SingleApplicationComponent.ɵfac = function SingleApplicationComponent_Factory(t) { return new (t || SingleApplicationComponent)(i0.ɵɵdirectiveInject(i1.Router), i0.ɵɵdirectiveInject(i1.ActivatedRoute), i0.ɵɵdirectiveInject(i2.SharedService)); };
105
+ SingleApplicationComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SingleApplicationComponent, selectors: [["app-single-application"]], decls: 14, vars: 3, consts: [[1, "card-container"], [1, "card-header-entity"], [1, "title-wrap"], [1, "k-icon", "k-i-information"], [1, "main-area"], [1, "list-view", "entity-list", 3, "data"], [1, "entity-wrap"], ["kendoListViewHeaderTemplate", ""], ["kendoListViewItemTemplate", ""], [1, "favorites-list"], [1, "header"], [1, "head-tag"], [1, "k-icon", "k-i-data"], [1, "count"], [1, "list-item", 3, "click"]], template: function SingleApplicationComponent_Template(rf, ctx) { if (rf & 1) {
106
+ i0.ɵɵelementStart(0, "div", 0)(1, "div", 1)(2, "div", 2)(3, "h1");
107
+ i0.ɵɵtext(4);
108
+ i0.ɵɵelementEnd();
109
+ i0.ɵɵelementStart(5, "p");
110
+ i0.ɵɵelement(6, "span", 3);
111
+ i0.ɵɵtext(7);
112
+ i0.ɵɵelementEnd()()();
113
+ i0.ɵɵelementStart(8, "div", 4)(9, "kendo-listview", 5);
114
+ i0.ɵɵelementContainerStart(10, 6);
115
+ i0.ɵɵtemplate(11, SingleApplicationComponent_ng_template_11_Template, 6, 2, "ng-template", 7);
116
+ i0.ɵɵtemplate(12, SingleApplicationComponent_ng_template_12_Template, 2, 1, "ng-template", 8);
117
+ i0.ɵɵelementContainerEnd();
118
+ i0.ɵɵelementEnd();
119
+ i0.ɵɵelement(13, "app-favorites", 9);
120
+ i0.ɵɵelementEnd()();
121
+ } if (rf & 2) {
122
+ i0.ɵɵadvance(4);
123
+ i0.ɵɵtextInterpolate(ctx.appName);
124
+ i0.ɵɵadvance(3);
125
+ i0.ɵɵtextInterpolate1(" ", ctx.appDescription, "");
126
+ i0.ɵɵadvance(2);
127
+ i0.ɵɵproperty("data", ctx.appEntities);
128
+ } }, dependencies: [i3.ItemTemplateDirective, i3.HeaderTemplateDirective, i3.ListViewComponent, i4.FavoritesComponent], styles: [".entity-list[_ngcontent-%COMP%] {\r\n width: 500px;\r\n }\r\n .favorites-list[_ngcontent-%COMP%] {\r\n width: 400px;\r\n }", ".main-area[_ngcontent-%COMP%] {\r\n display: flex;\r\n height: 100%;\r\n width: 100%;\r\n gap: 24px;\r\n padding: 24px 0;\r\n}\r\n.list-view[_ngcontent-%COMP%] {\r\n padding: 16px;\r\n min-width: 300px;\r\n border-radius: 4px;\r\n background: #FAFAFA;\r\n border: none;\r\n}\r\n .list-view .k-listview-header, .list-view .k-listview-footer {\r\n border: none;\r\n}\r\n .list-view .k-listview-content {\r\n border: 1px solid rgba(0, 0, 0, 0.08);\r\n border-radius: 4px;\r\n background: #fff;\r\n padding: 16px;\r\n}\r\n\r\n.header[_ngcontent-%COMP%], .footer[_ngcontent-%COMP%] {\r\n color: #424242;\r\n font-size: 16px;\r\n height: auto;\r\n margin:0;\r\n}\r\n\r\n.header[_ngcontent-%COMP%] {\r\n color: #424242;\r\n margin-bottom: 16px;\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n}\r\n.header[_ngcontent-%COMP%] .head-tag[_ngcontent-%COMP%] {\r\n display: flex;\r\n align-items: center;\r\n gap: 8px;\r\n color: #424242;\r\nfont-size: 16px;\r\nfont-style: normal;\r\nfont-weight: 400;\r\nline-height: 20px;\r\n}\r\n\r\n.header[_ngcontent-%COMP%] .count[_ngcontent-%COMP%] {\r\n width: 24px;\r\n height: 24px;\r\n min-width: 24px;\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n font-size: 10px;\r\n background: rgba(0, 0, 0, 0.08);\r\n border-radius: 50%;\r\n}\r\n.footer[_ngcontent-%COMP%] {\r\n font-size: 14px;\r\n margin-top: 16px;\r\n}\r\n\r\n.list-item[_ngcontent-%COMP%] {\r\n color: #424242;\r\n font-size: 14px;\r\n font-style: normal;\r\n font-weight: 400;\r\n line-height: 30px;\r\n cursor: pointer;\r\n margin: 4px;\r\n}\r\n.card-container[_ngcontent-%COMP%] {\r\n margin: 0;\r\n padding: 0;\r\n box-shadow: none;\r\n}\r\n.card-header-entity[_ngcontent-%COMP%] {\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: flex-start;\r\n padding-bottom: 20px;\r\n border-bottom: 1px solid rgba(0, 0, 0, 0.08);\r\n}\r\n.card-header-entity[_ngcontent-%COMP%] .title-wrap[_ngcontent-%COMP%] h1[_ngcontent-%COMP%] {\r\n color: #424242;\r\n font-size: 28px;\r\n font-style: normal;\r\n font-weight: 300;\r\n line-height: 28px;\r\n margin-bottom: 15px;\r\n }\r\n .card-header-entity[_ngcontent-%COMP%] .title-wrap[_ngcontent-%COMP%] {\r\n display: flex;\r\n flex-direction: column;\r\n }\r\n .card-header-entity[_ngcontent-%COMP%] .title-wrap[_ngcontent-%COMP%] p[_ngcontent-%COMP%] {\r\n margin: 0;\r\n display: flex;\r\n align-items: center;\r\n gap: 8px;\r\n color: #424242;\r\n font-size: 14px;\r\n font-style: normal;\r\n font-weight: 400;\r\n line-height: 20px;\r\n }\r\n\r\n \r\n\r\n\r\n \r\n .view-card[_ngcontent-%COMP%] .view-icon[_ngcontent-%COMP%] {\r\n color: #ff6358;\r\n }\r\n .card-wrapper[_ngcontent-%COMP%] {\r\n border: 1px solid rgba(0, 0, 0, 0.08);\r\n border-radius: 6px;\r\n }\r\n .card-wrapper[_ngcontent-%COMP%] .k-card-body[_ngcontent-%COMP%] {\r\n background: #fff;\r\n padding: 12px 20px;\r\n }\r\n .card-wrapper[_ngcontent-%COMP%] .view-card[_ngcontent-%COMP%] {\r\n overflow: auto;\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n background: #fafafa;\r\n padding: 4px 15px;\r\n }\r\n .view-card[_ngcontent-%COMP%] .btn-wrapper[_ngcontent-%COMP%] {\r\n display: flex;\r\n align-items: center;\r\n }\r\n \r\n .k-card-body[_ngcontent-%COMP%] .view-card-content[_ngcontent-%COMP%] h5[_ngcontent-%COMP%] {\r\n color: #424242;\r\n font-size: 16px;\r\n font-style: normal;\r\n font-weight: 400;\r\n line-height: 20px;\r\n margin-bottom: 0;\r\n letter-spacing: 0.18px;\r\n }\r\n .k-card-body[_ngcontent-%COMP%] .view-card-content[_ngcontent-%COMP%] p[_ngcontent-%COMP%] {\r\n color: #666;\r\n font-size: 14px;\r\n font-style: normal;\r\n font-weight: 400;\r\n line-height: 20px;\r\n height: 48px;\r\n margin-bottom: 0;\r\n }\r\n .card-container[_ngcontent-%COMP%] {\r\n padding: 0;\r\n margin: 0;\r\n box-shadow: none;\r\n }\r\n .card-header-entity[_ngcontent-%COMP%] {\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: flex-start;\r\n padding-bottom: 20px;\r\n border-bottom: 1px solid rgba(0, 0, 0, 0.08);\r\n }\r\n \r\n .card-header-entity[_ngcontent-%COMP%] .title-wrap[_ngcontent-%COMP%] h1[_ngcontent-%COMP%] {\r\n color: #424242;\r\n font-size: 28px;\r\n font-style: normal;\r\n font-weight: 300;\r\n line-height: 28px;\r\n margin-bottom: 15px;\r\n }\r\n .card-header-entity[_ngcontent-%COMP%] .title-wrap[_ngcontent-%COMP%] {\r\n display: flex;\r\n flex-direction: column;\r\n }\r\n .card-header-entity[_ngcontent-%COMP%] .title-wrap[_ngcontent-%COMP%] p[_ngcontent-%COMP%] {\r\n margin: 0;\r\n display: flex;\r\n align-items: center;\r\n gap: 8px;\r\n color: #424242;\r\n font-size: 14px;\r\n font-style: normal;\r\n font-weight: 400;\r\n line-height: 20px;\r\n }\r\n .main-area[_ngcontent-%COMP%] .card-list[_ngcontent-%COMP%] {\r\n display: flex;\r\n gap: 20px;\r\n }"] });
129
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SingleApplicationComponent, [{
130
+ type: Component,
131
+ args: [{ selector: 'app-single-application', template: "<div class=\"card-container\">\r\n <div class=\"card-header-entity\">\r\n <div class=\"title-wrap\">\r\n <h1>{{appName}}</h1>\r\n <p><span class=\"k-icon k-i-information\"></span> {{appDescription}}</p>\r\n </div>\r\n</div>\r\n <div class=\"main-area\">\r\n <kendo-listview\r\n [data]=\"appEntities\"\r\n class=\"list-view entity-list\"\r\n >\r\n <ng-container class=\"entity-wrap\">\r\n <ng-template kendoListViewHeaderTemplate>\r\n <div class=\"header\"> \r\n <div class=\"head-tag\">\r\n <span class=\"k-icon k-i-data\"></span>\r\n {{appName}} - Entities\r\n </div>\r\n <div class=\"count\">{{appEntities.length}}</div>\r\n </div>\r\n </ng-template>\r\n <ng-template kendoListViewItemTemplate let-dataItem=\"dataItem\">\r\n <div class=\"list-item\" (click)=\"entityItemClick(dataItem)\">\r\n {{dataItem.Entity}}\r\n </div>\r\n </ng-template>\r\n </ng-container>\r\n </kendo-listview>\r\n\r\n <app-favorites class=\"favorites-list\"></app-favorites>\r\n </div>\r\n</div>\r\n", styles: [" .entity-list {\r\n width: 500px;\r\n }\r\n .favorites-list {\r\n width: 400px;\r\n }", "\r\n.main-area {\r\n display: flex;\r\n height: 100%;\r\n width: 100%;\r\n gap: 24px;\r\n padding: 24px 0;\r\n}\r\n.list-view {\r\n padding: 16px;\r\n min-width: 300px;\r\n border-radius: 4px;\r\n background: #FAFAFA;\r\n border: none;\r\n}\r\n::ng-deep .list-view .k-listview-header, \r\n::ng-deep .list-view .k-listview-footer {\r\n border: none;\r\n}\r\n::ng-deep .list-view .k-listview-content {\r\n border: 1px solid rgba(0, 0, 0, 0.08);\r\n border-radius: 4px;\r\n background: #fff;\r\n padding: 16px;\r\n}\r\n\r\n.header,\r\n.footer {\r\n color: #424242;\r\n font-size: 16px;\r\n height: auto;\r\n margin:0;\r\n}\r\n\r\n.header {\r\n color: #424242;\r\n margin-bottom: 16px;\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n}\r\n.header .head-tag {\r\n display: flex;\r\n align-items: center;\r\n gap: 8px;\r\n color: #424242;\r\nfont-size: 16px;\r\nfont-style: normal;\r\nfont-weight: 400;\r\nline-height: 20px;\r\n}\r\n\r\n.header .count {\r\n width: 24px;\r\n height: 24px;\r\n min-width: 24px;\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n font-size: 10px;\r\n background: rgba(0, 0, 0, 0.08);\r\n border-radius: 50%;\r\n}\r\n.footer {\r\n font-size: 14px;\r\n margin-top: 16px;\r\n}\r\n\r\n.list-item {\r\n color: #424242;\r\n font-size: 14px;\r\n font-style: normal;\r\n font-weight: 400;\r\n line-height: 30px;\r\n cursor: pointer;\r\n margin: 4px;\r\n}\r\n.card-container {\r\n margin: 0;\r\n padding: 0;\r\n box-shadow: none;\r\n}\r\n.card-header-entity {\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: flex-start;\r\n padding-bottom: 20px;\r\n border-bottom: 1px solid rgba(0, 0, 0, 0.08);\r\n}\r\n.card-header-entity .title-wrap h1 {\r\n color: #424242;\r\n font-size: 28px;\r\n font-style: normal;\r\n font-weight: 300;\r\n line-height: 28px;\r\n margin-bottom: 15px;\r\n }\r\n .card-header-entity .title-wrap {\r\n display: flex;\r\n flex-direction: column;\r\n }\r\n .card-header-entity .title-wrap p {\r\n margin: 0;\r\n display: flex;\r\n align-items: center;\r\n gap: 8px;\r\n color: #424242;\r\n font-size: 14px;\r\n font-style: normal;\r\n font-weight: 400;\r\n line-height: 20px;\r\n }\r\n\r\n \r\n\r\n\r\n \r\n .view-card .view-icon {\r\n color: #ff6358;\r\n }\r\n .card-wrapper {\r\n border: 1px solid rgba(0, 0, 0, 0.08);\r\n border-radius: 6px;\r\n }\r\n .card-wrapper .k-card-body {\r\n background: #fff;\r\n padding: 12px 20px;\r\n }\r\n .card-wrapper .view-card {\r\n overflow: auto;\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n background: #fafafa;\r\n padding: 4px 15px;\r\n }\r\n .view-card .btn-wrapper {\r\n display: flex;\r\n align-items: center;\r\n }\r\n \r\n .k-card-body .view-card-content h5 {\r\n color: #424242;\r\n font-size: 16px;\r\n font-style: normal;\r\n font-weight: 400;\r\n line-height: 20px;\r\n margin-bottom: 0;\r\n letter-spacing: 0.18px;\r\n }\r\n .k-card-body .view-card-content p {\r\n color: #666;\r\n font-size: 14px;\r\n font-style: normal;\r\n font-weight: 400;\r\n line-height: 20px;\r\n height: 48px;\r\n margin-bottom: 0;\r\n }\r\n .card-container {\r\n padding: 0;\r\n margin: 0;\r\n box-shadow: none;\r\n }\r\n .card-header-entity {\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: flex-start;\r\n padding-bottom: 20px;\r\n border-bottom: 1px solid rgba(0, 0, 0, 0.08);\r\n }\r\n \r\n .card-header-entity .title-wrap h1 {\r\n color: #424242;\r\n font-size: 28px;\r\n font-style: normal;\r\n font-weight: 300;\r\n line-height: 28px;\r\n margin-bottom: 15px;\r\n }\r\n .card-header-entity .title-wrap {\r\n display: flex;\r\n flex-direction: column;\r\n }\r\n .card-header-entity .title-wrap p {\r\n margin: 0;\r\n display: flex;\r\n align-items: center;\r\n gap: 8px;\r\n color: #424242;\r\n font-size: 14px;\r\n font-style: normal;\r\n font-weight: 400;\r\n line-height: 20px;\r\n }\r\n .main-area .card-list {\r\n display: flex;\r\n gap: 20px;\r\n }\r\n "] }]
132
+ }], function () { return [{ type: i1.Router }, { type: i1.ActivatedRoute }, { type: i2.SharedService }]; }, null); })();
@@ -0,0 +1,28 @@
1
+ import { EventEmitter, OnInit } from '@angular/core';
2
+ import { ResourceTypeEntity } from '@memberjunction/core-entities';
3
+ import * as i0 from "@angular/core";
4
+ export declare class AddItemComponent implements OnInit {
5
+ onClose: EventEmitter<any>;
6
+ selectedResource: ResourceTypeEntity | null;
7
+ showloader: boolean;
8
+ resourceType: any;
9
+ selectedEntity: any;
10
+ selectedView: any;
11
+ selectedReport: any;
12
+ Entities: any[];
13
+ Views: any[];
14
+ Reports: any[];
15
+ get ResourceTypes(): any[];
16
+ private md;
17
+ constructor();
18
+ ngOnInit(): void;
19
+ onResourceTypeChange(event: any): Promise<void>;
20
+ getViews(): Promise<void>;
21
+ getReports(): Promise<void>;
22
+ onEntityChange(event: any): void;
23
+ onViewChange(event: any): void;
24
+ addItem(): void;
25
+ closeDialog(): void;
26
+ static ɵfac: i0.ɵɵFactoryDeclaration<AddItemComponent, never>;
27
+ static ɵcmp: i0.ɵɵComponentDeclaration<AddItemComponent, "app-add-item-dialog", never, { "selectedResource": "selectedResource"; }, { "onClose": "onClose"; }, never, never, false, never>;
28
+ }