@memberjunction/ng-explorer-core 0.9.38 → 0.9.43

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.
@@ -59,12 +59,12 @@ export class FavoritesComponent {
59
59
  }).then((favorites) => __awaiter(this, void 0, void 0, function* () {
60
60
  this.favorites = favorites.Results; // set the result in the list and let the below happen after async and it will update via data binding when done
61
61
  const input = favorites.Results.map((fav) => {
62
- return { EntityName: fav.Entity, RecordID: fav.RecordID };
62
+ return { EntityName: fav.Entity, PrimaryKeyValue: fav.RecordID };
63
63
  });
64
64
  const results = yield md.GetEntityRecordNames(input);
65
65
  if (results)
66
66
  results.forEach((result) => {
67
- const fav = favorites.Results.find((f) => f.Entity == result.EntityName && f.RecordID == result.RecordID);
67
+ const fav = favorites.Results.find((f) => f.Entity == result.EntityName && f.RecordID == result.PrimaryKeyValue);
68
68
  if (fav) {
69
69
  fav.RecordName = result.Success ? result.RecordName : fav.Entity + ' ' + fav.RecordID;
70
70
  }
@@ -44,7 +44,7 @@ export class BaseFormComponent extends BaseRecordComponent {
44
44
  return __awaiter(this, void 0, void 0, function* () {
45
45
  if (this.record) {
46
46
  const md = new Metadata();
47
- this._isFavorite = yield md.GetRecordFavoriteStatus(md.CurrentUser.ID, this.record.EntityInfo.Name, this.record.ID);
47
+ this._isFavorite = yield md.GetRecordFavoriteStatus(md.CurrentUser.ID, this.record.EntityInfo.Name, this.record.PrimaryKey.Value);
48
48
  this.FavoriteInitDone = true;
49
49
  }
50
50
  });
@@ -107,7 +107,7 @@ export class BaseFormComponent extends BaseRecordComponent {
107
107
  SetFavoriteStatus(isFavorite) {
108
108
  return __awaiter(this, void 0, void 0, function* () {
109
109
  const md = new Metadata();
110
- yield md.SetRecordFavoriteStatus(md.CurrentUser.ID, this.record.EntityInfo.Name, this.record.ID, isFavorite);
110
+ yield md.SetRecordFavoriteStatus(md.CurrentUser.ID, this.record.EntityInfo.Name, this.record.PrimaryKey.Value, isFavorite);
111
111
  this._isFavorite = isFavorite;
112
112
  });
113
113
  }
@@ -389,13 +389,13 @@ export class BaseFormComponent extends BaseRecordComponent {
389
389
  return __awaiter(this, void 0, void 0, function* () {
390
390
  // for now dump to console
391
391
  const md = new Metadata();
392
- const dep = yield md.GetRecordDependencies(this.record.EntityInfo.Name, this.record.ID);
393
- console.log('Dependencies for: ' + this.record.EntityInfo.Name + ' ' + this.record.ID);
392
+ const dep = yield md.GetRecordDependencies(this.record.EntityInfo.Name, this.record.PrimaryKey.Value);
393
+ console.log('Dependencies for: ' + this.record.EntityInfo.Name + ' ' + this.record.PrimaryKey.Value);
394
394
  console.log(dep);
395
395
  // if (confirm('Do you want to merge records test?') == true) {
396
396
  // const mergeResult = await md.MergeRecords({
397
397
  // EntityName: this.record.EntityInfo.Name,
398
- // SurvivingRecordID: this.record.ID,
398
+ // SurvivingRecordID: this.record.PrimaryKey.Value,
399
399
  // RecordsToMerge: [4],
400
400
  // })
401
401
  // console.log(mergeResult);
@@ -1,6 +1,6 @@
1
1
  import { BaseEntity } from "@memberjunction/core";
2
2
  import { BaseRecordComponent } from "./base-record-component";
3
3
  export declare class BaseFormSectionComponent extends BaseRecordComponent {
4
- record: BaseEntity | null;
4
+ record: BaseEntity;
5
5
  EditMode: boolean;
6
6
  }
@@ -4,7 +4,6 @@ import { BaseRecordComponent } from "./base-record-component";
4
4
  export class BaseFormSectionComponent extends BaseRecordComponent {
5
5
  constructor() {
6
6
  super(...arguments);
7
- this.record = null;
8
7
  this.EditMode = false;
9
8
  }
10
9
  }
@@ -1,6 +1,6 @@
1
- import { EntityFieldInfo } from "@memberjunction/core";
1
+ import { BaseEntity, EntityFieldInfo } from "@memberjunction/core";
2
2
  export declare abstract class BaseRecordComponent {
3
- abstract record: any;
3
+ abstract record: BaseEntity;
4
4
  FormatField(entityFieldInfo: EntityFieldInfo, value: any, decimals?: number, currency?: string): string;
5
5
  FormatValue(fieldName: string, decimals?: number, currency?: string): string;
6
6
  }
@@ -5,9 +5,10 @@ export class BaseRecordComponent {
5
5
  FormatValue(fieldName, decimals = 2, currency = 'USD') {
6
6
  if (!this.record)
7
7
  throw new Error('this.record not set');
8
- const f = this.record.Fields.find(f => f.Name.trim().toLowerCase() === fieldName.trim().toLowerCase());
8
+ const r = this.record;
9
+ const f = r.Fields.find(f => f.Name.trim().toLowerCase() === fieldName.trim().toLowerCase());
9
10
  if (!f)
10
- throw new Error(`Field ${fieldName} not found in entity ${this.record.EntityInfo.Name}`);
11
+ throw new Error(`Field ${fieldName} not found in entity ${r.EntityInfo.Name}`);
11
12
  return f.FormatValue(decimals, currency);
12
13
  }
13
14
  }
@@ -24,7 +24,7 @@ export declare class ResourceData {
24
24
  ID: number;
25
25
  Name: string;
26
26
  ResourceTypeID: number;
27
- ResourceRecordID: number;
27
+ ResourceRecordID: any;
28
28
  Configuration: any;
29
29
  /**
30
30
  * Returns the name of the resource type based on the ResourceTypeID
@@ -45,7 +45,7 @@ export class BaseResourceComponent {
45
45
  }
46
46
  }
47
47
  ResourceRecordSaved(resourceRecordEntity) {
48
- this.Data.ResourceRecordID = resourceRecordEntity.ID;
48
+ this.Data.ResourceRecordID = resourceRecordEntity.PrimaryKey.Value;
49
49
  if (this._resourceRecordSavedEvent) {
50
50
  this._resourceRecordSavedEvent(resourceRecordEntity);
51
51
  }
@@ -495,7 +495,7 @@ export class NavigationComponent {
495
495
  else {
496
496
  existingTab = this.tabs.find(t => t.data.ResourceTypeID === data.ResourceTypeID &&
497
497
  t.data.ResourceRecordID === data.ResourceRecordID &&
498
- data.ResourceRecordID !== null && data.ResourceRecordID !== undefined && data.ResourceRecordID > 0 // make sure that we don't match on null/undefined/0 ResourceRecordID's - these should always be NEW tabs
498
+ data.ResourceRecordID // make sure that we don't match on null/undefined ResourceRecordID's - these should always be NEW tabs
499
499
  );
500
500
  }
501
501
  return existingTab;
@@ -659,7 +659,7 @@ export class NavigationComponent {
659
659
  yield wsItem.Load(tab.data.ID);
660
660
  else {
661
661
  wsItem.NewRecord();
662
- wsItem.Name = tab.data.Name ? tab.data.Name : tab.data.ResourceType + ' Record ID:' + tab.data.ResourceRecordID;
662
+ wsItem.Name = tab.data.Name ? tab.data.Name : tab.data.ResourceType + ' Record:' + tab.data.ResourceRecordID;
663
663
  wsItem.WorkSpaceID = this.workSpace.ID;
664
664
  wsItem.ResourceTypeID = (_a = tab.data) === null || _a === void 0 ? void 0 : _a.ResourceTypeID;
665
665
  }
@@ -30,18 +30,19 @@ let EntityRecordResource = class EntityRecordResource extends BaseResourceCompon
30
30
  else {
31
31
  const md = new Metadata();
32
32
  const name = yield md.GetEntityRecordName(data.Configuration.Entity, data.ResourceRecordID);
33
- return (name ? name : data.Configuration.Entity) + ` (ID: ${data.ResourceRecordID})`;
33
+ const e = md.Entities.find(e => e.Name === data.Configuration.Entity);
34
+ return (name ? name : data.Configuration.Entity) + ` (${data.ResourceRecordID.toString().trim()})`;
34
35
  }
35
36
  });
36
37
  }
37
38
  };
38
39
  EntityRecordResource.ɵfac = /*@__PURE__*/ function () { let ɵEntityRecordResource_BaseFactory; return function EntityRecordResource_Factory(t) { return (ɵEntityRecordResource_BaseFactory || (ɵEntityRecordResource_BaseFactory = i0.ɵɵgetInheritedFactory(EntityRecordResource)))(t || EntityRecordResource); }; }();
39
- EntityRecordResource.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: EntityRecordResource, selectors: [["record-resource"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 2, consts: [[3, "recordId", "entityName", "loadComplete"]], template: function EntityRecordResource_Template(rf, ctx) { if (rf & 1) {
40
+ EntityRecordResource.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: EntityRecordResource, selectors: [["record-resource"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 2, consts: [[3, "primaryKeyValue", "entityName", "loadComplete"]], template: function EntityRecordResource_Template(rf, ctx) { if (rf & 1) {
40
41
  i0.ɵɵelementStart(0, "app-single-record", 0);
41
42
  i0.ɵɵlistener("loadComplete", function EntityRecordResource_Template_app_single_record_loadComplete_0_listener() { return ctx.NotifyLoadComplete(); });
42
43
  i0.ɵɵelementEnd();
43
44
  } if (rf & 2) {
44
- i0.ɵɵproperty("recordId", ctx.Data.ResourceRecordID)("entityName", ctx.Data.Configuration.Entity);
45
+ i0.ɵɵproperty("primaryKeyValue", ctx.Data.ResourceRecordID)("entityName", ctx.Data.Configuration.Entity);
45
46
  } }, dependencies: [i1.SingleRecordComponent], encapsulation: 2 });
46
47
  EntityRecordResource = __decorate([
47
48
  RegisterClass(BaseResourceComponent, 'Records')
@@ -51,6 +52,6 @@ export { EntityRecordResource };
51
52
  type: Component,
52
53
  args: [{
53
54
  selector: 'record-resource',
54
- template: `<app-single-record [recordId]="Data.ResourceRecordID" [entityName]="Data.Configuration.Entity" (loadComplete)="NotifyLoadComplete()"></app-single-record>`
55
+ template: `<app-single-record [primaryKeyValue]="Data.ResourceRecordID" [entityName]="Data.Configuration.Entity" (loadComplete)="NotifyLoadComplete()"></app-single-record>`
55
56
  }]
56
57
  }], null, null); })();
@@ -68,12 +68,12 @@ export class SingleApplicationComponent {
68
68
  }).then((favorites) => __awaiter(this, void 0, void 0, function* () {
69
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
70
  const input = favorites.Results.map((fav) => {
71
- return { EntityName: fav.Entity, RecordID: fav.RecordID };
71
+ return { EntityName: fav.Entity, PrimaryKeyValue: fav.RecordID };
72
72
  });
73
73
  const results = yield md.GetEntityRecordNames(input);
74
74
  if (results)
75
75
  results.forEach((result) => {
76
- const fav = favorites.Results.find((f) => f.Entity == result.EntityName && f.RecordID == result.RecordID);
76
+ const fav = favorites.Results.find((f) => f.Entity === result.EntityName && f.RecordID === result.PrimaryKeyValue);
77
77
  if (fav) {
78
78
  fav.RecordName = result.Success ? result.RecordName : fav.Entity + ' ' + fav.RecordID;
79
79
  }
@@ -5,7 +5,7 @@ import * as i0 from "@angular/core";
5
5
  export declare class SingleRecordComponent implements OnInit, AfterViewInit {
6
6
  private route;
7
7
  formContainer: Container;
8
- recordId: number;
8
+ primaryKeyValue: any;
9
9
  entityName: string | null;
10
10
  loadComplete: EventEmitter<any>;
11
11
  constructor(route: ActivatedRoute);
@@ -14,7 +14,7 @@ export declare class SingleRecordComponent implements OnInit, AfterViewInit {
14
14
  loading: boolean;
15
15
  ngOnInit(): void;
16
16
  ngAfterViewInit(): void;
17
- LoadForm(recordId: number, entityName: string): Promise<void>;
17
+ LoadForm(primaryKeyValue: any, entityName: string): Promise<void>;
18
18
  static ɵfac: i0.ɵɵFactoryDeclaration<SingleRecordComponent, never>;
19
- static ɵcmp: i0.ɵɵComponentDeclaration<SingleRecordComponent, "app-single-record", never, { "recordId": "recordId"; "entityName": "entityName"; }, { "loadComplete": "loadComplete"; }, never, never, false, never>;
19
+ static ɵcmp: i0.ɵɵComponentDeclaration<SingleRecordComponent, "app-single-record", never, { "primaryKeyValue": "primaryKeyValue"; "entityName": "entityName"; }, { "loadComplete": "loadComplete"; }, never, never, false, never>;
20
20
  }
@@ -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.recordId = -1;
27
+ this.primaryKeyValue = null;
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.recordId, this.entityName);
37
+ this.LoadForm(this.primaryKeyValue, this.entityName);
38
38
  }
39
- LoadForm(recordId, entityName) {
39
+ LoadForm(primaryKeyValue, 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 (recordId && entityName) {
42
+ if (primaryKeyValue && entityName) {
43
43
  this.entityName = entityName;
44
- this.recordId = recordId;
44
+ this.primaryKeyValue = primaryKeyValue;
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.Load(recordId);
54
+ yield record.Load(primaryKeyValue);
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 ID ${recordId}`);
64
+ throw new Error(`Unable to load entity ${entityName} with primary key value of: ${primaryKeyValue}`);
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: { recordId: "recordId", 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) {
77
+ } }, inputs: { primaryKeyValue: "primaryKeyValue", 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
- }], recordId: [{
89
+ }], primaryKeyValue: [{
90
90
  type: Input
91
91
  }], entityName: [{
92
92
  type: Input
@@ -100,7 +100,7 @@ export class SingleViewComponent {
100
100
  handleRowClick(args) {
101
101
  return __awaiter(this, void 0, void 0, function* () {
102
102
  // 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.recordId], { queryParams: { Entity: args.entityName } });
103
+ this.router.navigate(['resource', 'record', args.primaryKeyValue], { queryParams: { Entity: args.entityName } });
104
104
  });
105
105
  }
106
106
  LoadView(viewInfo) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/ng-explorer-core",
3
- "version": "0.9.38",
3
+ "version": "0.9.43",
4
4
  "description": "MemberJunction Explorer: Core Angular Components",
5
5
  "main": "./dist/public-api.js",
6
6
  "typings": "./dist/public-api.d.ts",
@@ -27,12 +27,12 @@
27
27
  "@progress/kendo-angular-listview": "^12.1.0"
28
28
  },
29
29
  "dependencies": {
30
- "@memberjunction/global": "^0.9.101",
31
- "@memberjunction/core": "^0.9.99",
32
- "@memberjunction/ng-compare-records": "^0.9.98",
33
- "@memberjunction/ng-record-changes": "^0.9.36",
34
- "@memberjunction/ng-container-directives": "^0.9.73",
35
- "@memberjunction/ng-user-view-grid": "^0.9.77",
30
+ "@memberjunction/global": "^0.9.104",
31
+ "@memberjunction/core": "^0.9.103",
32
+ "@memberjunction/ng-compare-records": "^0.9.104",
33
+ "@memberjunction/ng-record-changes": "^0.9.42",
34
+ "@memberjunction/ng-container-directives": "^0.9.80",
35
+ "@memberjunction/ng-user-view-grid": "^0.9.83",
36
36
  "tslib": "^2.3.0"
37
37
  },
38
38
  "sideEffects": false