@memberjunction/ng-explorer-core 0.9.60 → 0.9.63
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/dist/lib/navigation/navigation.component.js +2 -3
- package/dist/lib/resource-wrappers/record-resource.component.d.ts +2 -0
- package/dist/lib/resource-wrappers/record-resource.component.js +12 -3
- package/dist/lib/single-record/single-record.component.d.ts +4 -3
- package/dist/lib/single-record/single-record.component.js +9 -9
- package/dist/lib/single-view/single-view.component.js +2 -1
- package/dist/shared/shared.service.d.ts +3 -0
- package/dist/shared/shared.service.js +18 -0
- package/package.json +6 -6
|
@@ -476,13 +476,12 @@ export class NavigationComponent {
|
|
|
476
476
|
}
|
|
477
477
|
else if (data.ResourceType.trim().toLowerCase() === 'user views') {
|
|
478
478
|
// a viwe can be either saved (where we have a view id) or dyanmic (where we have an entity name, and optionally, an extra filter)
|
|
479
|
-
if (data.ResourceRecordID
|
|
479
|
+
if (data.ResourceRecordID) {
|
|
480
480
|
// saved view
|
|
481
481
|
existingTab = this.tabs.find(t => t.data.ResourceTypeID === data.ResourceTypeID &&
|
|
482
482
|
t.data.ResourceRecordID === data.ResourceRecordID &&
|
|
483
483
|
data.ResourceRecordID !== null &&
|
|
484
|
-
data.ResourceRecordID !== undefined
|
|
485
|
-
data.ResourceRecordID > 0 // make sure that we don't match on null/undefined/0 ResourceRecordID's - these should always be NEW tabs
|
|
484
|
+
data.ResourceRecordID !== undefined // make sure that we don't match on null/undefined ResourceRecordID's - these should always be NEW tabs
|
|
486
485
|
);
|
|
487
486
|
}
|
|
488
487
|
else {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { BaseResourceComponent, ResourceData } from '../generic/base-resource-component';
|
|
2
|
+
import { PrimaryKeyValue } from '@memberjunction/core';
|
|
2
3
|
import * as i0 from "@angular/core";
|
|
3
4
|
export declare function LoadRecordResource(): void;
|
|
4
5
|
export declare class EntityRecordResource extends BaseResourceComponent {
|
|
6
|
+
get primaryKeyValues(): PrimaryKeyValue[];
|
|
5
7
|
GetResourceDisplayName(data: ResourceData): Promise<string>;
|
|
6
8
|
static ɵfac: i0.ɵɵFactoryDeclaration<EntityRecordResource, never>;
|
|
7
9
|
static ɵcmp: i0.ɵɵComponentDeclaration<EntityRecordResource, "record-resource", never, {}, {}, never, never, false, never>;
|
|
@@ -17,12 +17,21 @@ import { Component } from '@angular/core';
|
|
|
17
17
|
import { BaseResourceComponent } from '../generic/base-resource-component';
|
|
18
18
|
import { RegisterClass } from '@memberjunction/global';
|
|
19
19
|
import { Metadata } from '@memberjunction/core';
|
|
20
|
+
import { SharedService } from '../../public-api';
|
|
20
21
|
import * as i0 from "@angular/core";
|
|
21
22
|
import * as i1 from "../single-record/single-record.component";
|
|
22
23
|
export function LoadRecordResource() {
|
|
23
24
|
const test = new EntityRecordResource(); // this looks really dumb. Thing is, in production builds, tree shaking causes the class below to not be included in the bundle. This is a hack to force it to be included.
|
|
24
25
|
}
|
|
25
26
|
let EntityRecordResource = class EntityRecordResource extends BaseResourceComponent {
|
|
27
|
+
get primaryKeyValues() {
|
|
28
|
+
const md = new Metadata();
|
|
29
|
+
const e = md.Entities.find(e => e.Name.trim().toLowerCase() === this.Data.Configuration.Entity.trim().toLowerCase());
|
|
30
|
+
if (!e)
|
|
31
|
+
throw new Error(`Entity ${this.Data.Configuration.Entity} not found in metadata`);
|
|
32
|
+
const pKeys = SharedService.ParsePrimaryKeys(e, this.Data.ResourceRecordID);
|
|
33
|
+
return pKeys;
|
|
34
|
+
}
|
|
26
35
|
GetResourceDisplayName(data) {
|
|
27
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
37
|
if (!data.Configuration.Entity)
|
|
@@ -37,12 +46,12 @@ let EntityRecordResource = class EntityRecordResource extends BaseResourceCompon
|
|
|
37
46
|
}
|
|
38
47
|
};
|
|
39
48
|
EntityRecordResource.ɵfac = /*@__PURE__*/ function () { let ɵEntityRecordResource_BaseFactory; return function EntityRecordResource_Factory(t) { return (ɵEntityRecordResource_BaseFactory || (ɵEntityRecordResource_BaseFactory = i0.ɵɵgetInheritedFactory(EntityRecordResource)))(t || EntityRecordResource); }; }();
|
|
40
|
-
EntityRecordResource.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: EntityRecordResource, selectors: [["record-resource"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 2, consts: [[3, "
|
|
49
|
+
EntityRecordResource.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: EntityRecordResource, selectors: [["record-resource"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 2, consts: [[3, "primaryKeyValues", "entityName", "loadComplete"]], template: function EntityRecordResource_Template(rf, ctx) { if (rf & 1) {
|
|
41
50
|
i0.ɵɵelementStart(0, "app-single-record", 0);
|
|
42
51
|
i0.ɵɵlistener("loadComplete", function EntityRecordResource_Template_app_single_record_loadComplete_0_listener() { return ctx.NotifyLoadComplete(); });
|
|
43
52
|
i0.ɵɵelementEnd();
|
|
44
53
|
} if (rf & 2) {
|
|
45
|
-
i0.ɵɵproperty("
|
|
54
|
+
i0.ɵɵproperty("primaryKeyValues", ctx.primaryKeyValues)("entityName", ctx.Data.Configuration.Entity);
|
|
46
55
|
} }, dependencies: [i1.SingleRecordComponent], encapsulation: 2 });
|
|
47
56
|
EntityRecordResource = __decorate([
|
|
48
57
|
RegisterClass(BaseResourceComponent, 'Records')
|
|
@@ -52,6 +61,6 @@ export { EntityRecordResource };
|
|
|
52
61
|
type: Component,
|
|
53
62
|
args: [{
|
|
54
63
|
selector: 'record-resource',
|
|
55
|
-
template: `<app-single-record [
|
|
64
|
+
template: `<app-single-record [primaryKeyValues]="this.primaryKeyValues" [entityName]="Data.Configuration.Entity" (loadComplete)="NotifyLoadComplete()"></app-single-record>`
|
|
56
65
|
}]
|
|
57
66
|
}], null, null); })();
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { AfterViewInit, EventEmitter, OnInit } from '@angular/core';
|
|
2
2
|
import { ActivatedRoute } from '@angular/router';
|
|
3
|
+
import { PrimaryKeyValue } from '@memberjunction/core';
|
|
3
4
|
import { Container } from '@memberjunction/ng-container-directives';
|
|
4
5
|
import * as i0 from "@angular/core";
|
|
5
6
|
export declare class SingleRecordComponent implements OnInit, AfterViewInit {
|
|
6
7
|
private route;
|
|
7
8
|
formContainer: Container;
|
|
8
|
-
|
|
9
|
+
primaryKeyValues: PrimaryKeyValue[];
|
|
9
10
|
entityName: string | null;
|
|
10
11
|
loadComplete: EventEmitter<any>;
|
|
11
12
|
constructor(route: ActivatedRoute);
|
|
@@ -14,7 +15,7 @@ export declare class SingleRecordComponent implements OnInit, AfterViewInit {
|
|
|
14
15
|
loading: boolean;
|
|
15
16
|
ngOnInit(): void;
|
|
16
17
|
ngAfterViewInit(): void;
|
|
17
|
-
LoadForm(
|
|
18
|
+
LoadForm(primaryKeyValues: PrimaryKeyValue[], entityName: string): Promise<void>;
|
|
18
19
|
static ɵfac: i0.ɵɵFactoryDeclaration<SingleRecordComponent, never>;
|
|
19
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SingleRecordComponent, "app-single-record", never, { "
|
|
20
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SingleRecordComponent, "app-single-record", never, { "primaryKeyValues": "primaryKeyValues"; "entityName": "entityName"; }, { "loadComplete": "loadComplete"; }, never, never, false, never>;
|
|
20
21
|
}
|
|
@@ -24,7 +24,7 @@ function SingleRecordComponent_ng_template_1_Template(rf, ctx) { }
|
|
|
24
24
|
export class SingleRecordComponent {
|
|
25
25
|
constructor(route) {
|
|
26
26
|
this.route = route;
|
|
27
|
-
this.
|
|
27
|
+
this.primaryKeyValues = [];
|
|
28
28
|
this.entityName = '';
|
|
29
29
|
this.loadComplete = new EventEmitter();
|
|
30
30
|
this.appDescription = '';
|
|
@@ -34,14 +34,14 @@ export class SingleRecordComponent {
|
|
|
34
34
|
ngOnInit() {
|
|
35
35
|
}
|
|
36
36
|
ngAfterViewInit() {
|
|
37
|
-
this.LoadForm(this.
|
|
37
|
+
this.LoadForm(this.primaryKeyValues, this.entityName);
|
|
38
38
|
}
|
|
39
|
-
LoadForm(
|
|
39
|
+
LoadForm(primaryKeyValues, entityName) {
|
|
40
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
41
|
// Perform any necessary actions with the ViewID, such as fetching data
|
|
42
|
-
if (
|
|
42
|
+
if (primaryKeyValues && entityName) {
|
|
43
43
|
this.entityName = entityName;
|
|
44
|
-
this.
|
|
44
|
+
this.primaryKeyValues = primaryKeyValues;
|
|
45
45
|
const formReg = MJGlobal.Instance.ClassFactory.GetRegistration(BaseFormComponent, entityName);
|
|
46
46
|
const md = new Metadata();
|
|
47
47
|
const entity = md.Entities.find(e => {
|
|
@@ -51,7 +51,7 @@ export class SingleRecordComponent {
|
|
|
51
51
|
if (formReg) {
|
|
52
52
|
const record = yield md.GetEntityObject(entityName);
|
|
53
53
|
if (record) {
|
|
54
|
-
yield record.
|
|
54
|
+
yield record.InnerLoad(primaryKeyValues);
|
|
55
55
|
const viewContainerRef = this.formContainer.viewContainerRef;
|
|
56
56
|
viewContainerRef.clear();
|
|
57
57
|
const componentRef = viewContainerRef.createComponent(formReg.SubClass);
|
|
@@ -61,7 +61,7 @@ export class SingleRecordComponent {
|
|
|
61
61
|
this.loadComplete.emit();
|
|
62
62
|
}
|
|
63
63
|
else
|
|
64
|
-
throw new Error(`Unable to load entity ${entityName} with primary key
|
|
64
|
+
throw new Error(`Unable to load entity ${entityName} with primary key values: ${primaryKeyValues.map(p => p.FieldName + ': ' + p.Value).join(', ')}`);
|
|
65
65
|
}
|
|
66
66
|
this.loading = false;
|
|
67
67
|
}
|
|
@@ -74,7 +74,7 @@ SingleRecordComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: Singl
|
|
|
74
74
|
} if (rf & 2) {
|
|
75
75
|
let _t;
|
|
76
76
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.formContainer = _t.first);
|
|
77
|
-
} }, inputs: {
|
|
77
|
+
} }, inputs: { primaryKeyValues: "primaryKeyValues", entityName: "entityName" }, outputs: { loadComplete: "loadComplete" }, decls: 2, vars: 1, consts: [["type", "converging-spinner", 4, "ngIf"], ["mjContainer", ""], ["type", "converging-spinner"]], template: function SingleRecordComponent_Template(rf, ctx) { if (rf & 1) {
|
|
78
78
|
i0.ɵɵtemplate(0, SingleRecordComponent_kendo_loader_0_Template, 1, 0, "kendo-loader", 0);
|
|
79
79
|
i0.ɵɵtemplate(1, SingleRecordComponent_ng_template_1_Template, 0, 0, "ng-template", 1);
|
|
80
80
|
} if (rf & 2) {
|
|
@@ -86,7 +86,7 @@ SingleRecordComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: Singl
|
|
|
86
86
|
}], function () { return [{ type: i1.ActivatedRoute }]; }, { formContainer: [{
|
|
87
87
|
type: ViewChild,
|
|
88
88
|
args: [Container, { static: true }]
|
|
89
|
-
}],
|
|
89
|
+
}], primaryKeyValues: [{
|
|
90
90
|
type: Input
|
|
91
91
|
}], entityName: [{
|
|
92
92
|
type: Input
|
|
@@ -13,6 +13,7 @@ import { Metadata, LogError } from '@memberjunction/core';
|
|
|
13
13
|
import { distinctUntilChanged, Subject } from "rxjs";
|
|
14
14
|
import { debounceTime } from "rxjs/operators";
|
|
15
15
|
import { ViewInfo } from '@memberjunction/core-entities';
|
|
16
|
+
import { SharedService } from '../../shared/shared.service';
|
|
16
17
|
import * as i0 from "@angular/core";
|
|
17
18
|
import * as i1 from "@angular/router";
|
|
18
19
|
import * as i2 from "../../shared/shared.service";
|
|
@@ -100,7 +101,7 @@ export class SingleViewComponent {
|
|
|
100
101
|
handleRowClick(args) {
|
|
101
102
|
return __awaiter(this, void 0, void 0, function* () {
|
|
102
103
|
// tell the router to navigate instead of raising an event directly. router will in turn handle raising the event as required
|
|
103
|
-
this.router.navigate(['resource', 'record', args.
|
|
104
|
+
this.router.navigate(['resource', 'record', SharedService.GeneratePrimaryKeyValueString(args.primaryKeyValues)], { queryParams: { Entity: args.entityName } });
|
|
104
105
|
});
|
|
105
106
|
}
|
|
106
107
|
LoadView(viewInfo) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EntityInfo, PrimaryKeyValue } from '@memberjunction/core';
|
|
1
2
|
import { ResourceTypeEntity, UserNotificationEntity, ViewColumnInfo } from '@memberjunction/core-entities';
|
|
2
3
|
import { Observable } from 'rxjs';
|
|
3
4
|
import { NotificationService } from "@progress/kendo-angular-notification";
|
|
@@ -24,6 +25,8 @@ export declare class SharedService {
|
|
|
24
25
|
ResourceTypeByID(id: number): ResourceTypeEntity | undefined;
|
|
25
26
|
ResourceTypeByName(name: string): ResourceTypeEntity | undefined;
|
|
26
27
|
static RefreshData(): Promise<void>;
|
|
28
|
+
static GeneratePrimaryKeyValueString(pkVals: PrimaryKeyValue[]): string;
|
|
29
|
+
static ParsePrimaryKeys(entity: EntityInfo, routeSegment: string): PrimaryKeyValue[];
|
|
27
30
|
FormatColumnValue(col: ViewColumnInfo, value: any, maxLength?: number, trailingChars?: string): any;
|
|
28
31
|
ConvertMarkdownStringToHtmlList(listType: HtmlListType, text: string): string;
|
|
29
32
|
InvokeManualResize(delay?: number): void;
|
|
@@ -123,6 +123,24 @@ export class SharedService {
|
|
|
123
123
|
SharedService.RefreshUserNotifications(); // also call this initially when refreshing the dataset...
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
|
+
static GeneratePrimaryKeyValueString(pkVals) {
|
|
127
|
+
return pkVals.map(pk => pk.FieldName + '|' + pk.Value).join('||');
|
|
128
|
+
}
|
|
129
|
+
static ParsePrimaryKeys(entity, routeSegment) {
|
|
130
|
+
if (!routeSegment.includes('|')) {
|
|
131
|
+
// If not, return a single element array with a default field name
|
|
132
|
+
return [{ FieldName: entity.PrimaryKey.Name, Value: routeSegment }];
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
const parts = routeSegment.split('||');
|
|
136
|
+
const pkVals = [];
|
|
137
|
+
for (let p of parts) {
|
|
138
|
+
const kv = p.split('|');
|
|
139
|
+
pkVals.push({ FieldName: kv[0], Value: kv[1] });
|
|
140
|
+
}
|
|
141
|
+
return pkVals;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
126
144
|
FormatColumnValue(col, value, maxLength = 0, trailingChars = "...") {
|
|
127
145
|
if (value === null || value === undefined)
|
|
128
146
|
return value;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ng-explorer-core",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.63",
|
|
4
4
|
"description": "MemberJunction Explorer: Core Angular Components",
|
|
5
5
|
"main": "./dist/public-api.js",
|
|
6
6
|
"typings": "./dist/public-api.d.ts",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@memberjunction/global": "^0.9.107",
|
|
31
|
-
"@memberjunction/core": "^0.9.
|
|
32
|
-
"@memberjunction/ng-compare-records": "^0.9.
|
|
33
|
-
"@memberjunction/ng-record-changes": "^0.9.
|
|
34
|
-
"@memberjunction/ng-container-directives": "^0.9.
|
|
35
|
-
"@memberjunction/ng-user-view-grid": "^0.9.
|
|
31
|
+
"@memberjunction/core": "^0.9.115",
|
|
32
|
+
"@memberjunction/ng-compare-records": "^0.9.119",
|
|
33
|
+
"@memberjunction/ng-record-changes": "^0.9.53",
|
|
34
|
+
"@memberjunction/ng-container-directives": "^0.9.92",
|
|
35
|
+
"@memberjunction/ng-user-view-grid": "^0.9.101",
|
|
36
36
|
"tslib": "^2.3.0"
|
|
37
37
|
},
|
|
38
38
|
"sideEffects": false
|